无人机管理后台前端(已迁走)
rjg
2025-04-12 f133d55b080a1d6c4738b330f899f85582336d38
查询优化
2 files modified
174 ■■■■ changed files
src/api/tickets/orderLog.js 4 ●●●● patch | view | raw | blame | history
src/views/tickets/orderLog.vue 170 ●●●● patch | view | raw | blame | history
src/api/tickets/orderLog.js
@@ -1,8 +1,8 @@
import request from '@/axios';
export const getList = (data) => {
export const getList = (data,current,size) => {
  return request({
    url: '/drone-device-core/wayline/orderLog/pageList',
    url: '/drone-device-core/wayline/orderLog/pageList?current='+current+"&size="+size,
    method: 'post',
    data,
  });
src/views/tickets/orderLog.vue
@@ -19,40 +19,42 @@
            />
            <el-select
              v-model="filters.create_dept"
              placeholder="请选择所属单位"
              v-model="filters.create_dept"
              @change="handleDepartmentChange"
              class="filter-item"
              clearable
            >
              <el-option
                v-for="item in departments"
                :key="item.value"
                :label="item.label"
                :value="item.value"
                v-for="dept in departments"
                :key="dept.value"
                :label="dept.label"
                :value="dept.value"
              />
            </el-select>
            <el-date-picker
              v-model="filters.dateRange"
              type="daterange"
              type="datetimerange"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              class="filter-item"
              style="width: 80px"
              value-format="yyyy-MM-dd"
              style="width: 100px"
            />
              <el-select v-model="form.file_id" placeholder="请选择关联航线"  class="filter-item"    clearable >
                <el-option
                  v-for="item in wayLineList"
                  :key="item.wayline_id"
                  :label="item.name"
                  :value="item.wayline_id"
                />
          </el-select>
            <el-select
              v-model="filters.file_id"
              placeholder="请选择关联航线"
              class="filter-item"
              clearable
            >
              <el-option
                v-for="item in wayLineList"
                :key="item.wayline_id"
                :label="item.name"
                :value="item.wayline_id"
              />
            </el-select>
            <el-select
              v-model="filters.ai_types"
@@ -103,15 +105,14 @@
          <avue-crud
            :data="tableData"
            :option="option"
            :page.sync="pagination"
            v-model:page="page"
            ref="crud"
            :table-loading="loading"
            @current-change="handlePaginationChange"
            @size-change="handlePaginationChange"
            @current-change="currentChange"
            @refresh-change="refreshChange"
            @on-load="onLoad"
            @search-change="searchChange"
            @size-change="sizeChange"
          >
            <template #menu-left>
              <el-button type="primary" icon="el-icon-plus" @click="handleAdd">新建工单</el-button>
@@ -270,44 +271,34 @@
      @close="resetForm"
    >
      <el-form :model="form" ref="form" label-width="100px">
 <div class="custom-steps-container">
  <!-- 标题行 -->
  <div class="steps-titles"  >
  <div  v-for="(record, index) in form.record_list" :class="{ 'active': record.user_id >=0  }" :key="index" class="step-title" >{{record.status_str}}</div>
  </div>
  <!-- Element Steps 组件 -->
  <el-steps :active="form.active" align-center class="custom-steps" >
   <el-step v-for="(record, index) in form.record_list"  :key="index">
      <template #description>
        <div class="step-description">
          {{record.user_name}}
        <div class="custom-steps-container">
          <!-- 标题行 -->
          <div class="steps-titles">
            <div
              v-for="(record, index) in form.record_list"
              :class="{ active: record.user_id >= 0 }"
              :key="index"
              class="step-title"
            >
              {{ record.status_str }}
            </div>
          </div>
             <div class="step-description">
          {{record.create_time_str}}
          </div>
      </template>
    </el-step>
          <!-- Element Steps 组件 -->
          <el-steps :active="form.active" align-center class="custom-steps">
            <el-step v-for="(record, index) in form.record_list" :key="index">
              <template #description>
                <div class="step-description">
                  {{ record.user_name }}
                </div>
                <div class="step-description">
                  {{ record.create_time_str }}
                </div>
              </template>
            </el-step>
          </el-steps>
        </div>
  </el-steps>
</div>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="工单名称" prop="name">
@@ -405,7 +396,7 @@
          <el-col :span="3">
            <el-time-picker
               style="width: 100px"
              style="width: 100px"
              v-model="form.deal_time"
              prop="deal_time"
              value-format="HH:mm"
@@ -430,6 +421,7 @@
  orderLogPass,
  orderLogExport,
} from '@/api/tickets/orderLog';
import { getTicketInfo } from '@/api/tickets/ticket';
import { getDictionary } from '@/api/system/dictbiz';
import { getWaylineFileListByArea } from '@/api/resource/wayline';
import { export_json_to_excel } from '@/utils/exportExcel';
@@ -460,7 +452,7 @@
        file_id: '',
        ai_types: [],
        status: '',
        dateRange: null,
        dateRange: [],
      },
      departments: [],
      types: [],
@@ -515,11 +507,7 @@
          { label: '工单状态', prop: 'status', width: 60 },
        ],
      },
      pagination: {
        currentPage: 1,
        pageSize: 10,
        total: 0,
      },
      page: {
        pageSize: 10,
        currentPage: 1,
@@ -551,6 +539,12 @@
    this.types = word_order_typeResponse.data.data;
    //获取航线
    this.asyncgetWaylineFileListByArea();
       const response2 = await getTicketInfo();
      const { dept_data, event_type, ai_type } = response2.data.data;
      this.departments = dept_data.map(item => ({
        label: item.dept_name,
        value: item.id,
      }));
  },
  mounted() {
    this.fetchTableData();
@@ -568,13 +562,20 @@
      this.onLoad(this.page, params);
      done();
    },
    onLoad(page, params = {}) {
    async onLoad(page, params = {}) {
      this.loading = true;
      getList(null, Object.assign(params, this.query)).then(res => {
      getList(
        null,
        this.page.currentPage,
        this.page.pageSize,
        Object.assign(params, this.query)
      ).then(res => {
        this.tableData = res.data.data;
        this.loading = false;
        this.selectionClear();
      });
    },
    selectionClear() {
      this.selectionList = [];
@@ -599,7 +600,7 @@
      try {
        let params = this.getQueryParam();
        console.log('发送的参数:', params);
        const response = await getList(params);
        const response = await getList(params, this.page.currentPage, this.page.pageSize);
        if (!response?.data?.data?.records) {
          throw new Error('接口返回数据格式不正确');
        }
@@ -613,13 +614,13 @@
          this.updateGlobalCounts(records, total);
        }
        this.pagination.total = total || 0;
        this.page.total = total || 0;
        this.updateTabCounts();
      } catch (error) {
        console.error('获取数据失败:', error);
        this.$message.error(error.message || '获取数据失败');
        this.tableData = [];
        this.pagination.total = 0;
        this.page.total = 0;
      } finally {
        this.loading = false;
      }
@@ -627,6 +628,12 @@
    getQueryParam() {
      const currentTab = this.tabs.find(tab => tab.name === this.activeTab);
      if (this.filters.dateRange) {
        console.log(
          'this.formatDate(this.filters.dateRange[0])',
          this.formatDate(this.filters.dateRange[0])
        );
      }
      const params = {
        key_word: this.filters.key_word || undefined,
@@ -644,12 +651,14 @@
        end_date: this.filters.dateRange?.[1]
          ? this.formatDate(this.filters.dateRange[1]).replace('00:00:00', '23:59:59')
          : undefined,
        current: this.pagination.currentPage,
        size: this.pagination.pageSize,
        current: this.page.currentPage,
        size: this.page.pageSize,
      };
      return params;
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
    },
    async submitForm(status) {
      this.$refs.form.validate(async valid => {
        if (valid) {
@@ -724,12 +733,12 @@
    handleTabChange(tab) {
      this.activeTab = tab.props?.name || tab.name;
      this.filters.status = '';
      this.pagination.currentPage = 1;
      this.page.currentPage = 1;
      this.fetchTableData();
    },
    handleSearch() {
      this.pagination.currentPage = 1;
      this.page.currentPage = 1;
      this.fetchTableData();
    },
@@ -741,14 +750,12 @@
        dateRange: [],
        status: '',
      };
      this.pagination.currentPage = 1;
      this.page.currentPage = 1;
      this.fetchTableData();
    },
    handlePaginationChange(val) {
      this.pagination.currentPage = val.currentPage;
      this.pagination.pageSize = val.pageSize;
      this.fetchTableData();
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
    },
    updateGlobalCounts(records, total) {
@@ -990,8 +997,6 @@
  margin-top: 7px;
}
.custom-steps-container {
  width: 100%;
  margin: 20px 0;
@@ -1014,7 +1019,7 @@
}
.step-title.active {
  color: #409EFF;
  color: #409eff;
  font-weight: bold;
}
@@ -1036,5 +1041,4 @@
  color: #666;
  line-height: 1.5;
}
</style>