无人机管理后台前端(已迁走)
chenyao
2025-11-17 233e4fc4f35bd00a36ee34a7fbf5e47b41db26db
src/views/tickets/ticket.vue
@@ -134,7 +134,6 @@
                    collapse-tags-tooltip
                    clearable
                    @check="handleCheck"
                    @node-click="handleSFNodeClick"
                    @clear="handleClear"
                  />
                  </el-form-item>
@@ -207,6 +206,7 @@
                @click="openReviewDialog"
                >批量审核
              </el-button>
              <el-button
                v-if="permissionList.exportBtn"
                type="success"
@@ -233,7 +233,12 @@
                  >详情
                </el-button>
              </template>
              <template  v-if="row.status === 4 && activeTab === 'completed'">
                <el-button type="text" icon="el-icon-download"  @click="exportTheTick(row)"
                  >导出
                </el-button>
              </template>
              <template v-if="permission.tickets_repeat_review">
                <el-button
                  v-if="row.status === 4 && row.isReview !== 1"
@@ -685,7 +690,7 @@
                      :src="getThumbUrl(currentDetail.mediaUrl)"
                      :preview-src-list="[getPreviewUrl(currentDetail.mediaUrl)]"
                      fit="contain"
                      style="pxToRemNum(width: 700px); pxToRemNum(height: 520px); cursor: pointer"
                      style=" cursor: pointer"
                    >
                      <template #placeholder>
                        <div class="image-placeholder">
@@ -1011,6 +1016,7 @@
  getStepInfo,
  getReviewById,
  getCreateEventJob,
  exportTheTicket
} from '@/api/tickets/ticket';
import { getSFDictionaryTree } from '@/api/job/task';
import { export_json_to_excel } from '@/utils/exportExcel';
@@ -1108,7 +1114,7 @@
          { label: '工单编号', prop: 'orderNumber', width: 170 },
          { label: '工单名称', prop: 'orderName', width: 150, overHidden: true, tooltip: true },
          { label: '所属部门', prop: 'department', overHidden: true, tooltip: true },
          { label: '发起时间', prop: 'startTime', width: 160, overHidden: true },
          { label: '发起任务时间', prop: 'startTime', width: 160, overHidden: true },
          { label: '关联算法', prop: 'aiType', overHidden: true, tooltip: true },
          {
            label: '工单类型',
@@ -1788,7 +1794,8 @@
      try {
        const currentTab = this.tabs.find(tab => tab.name === this.activeTab);
        const params = {
          word_order_types: this.filters.type || undefined,
          // word_order_types: this.filters.type || undefined,
          ai_types: this.filters.type || undefined, // 算法使用该字段筛选
          status:
            currentTab?.name === 'myTickets'
              ? undefined
@@ -1811,7 +1818,8 @@
          user_id: currentTab?.name === 'myTickets' ? this.userInfo.user_id : undefined,
          is_review: this.filters.isReview === '' ? undefined : this.filters.isReview, // 添加复核状态查询参数
        };
       source:1  ,//数据来源
       };
        const response = await getList(params);
        if (!response?.data?.data?.records) {
@@ -1837,7 +1845,7 @@
            orderName: item.event_name,
            department:
              this.departments.find(d => d.value === item.dept_id)?.label || item.dept_name,
            startTime: item.create_time,
            startTime: item.job_create_time || '/',
            aiType: item.ai_types,
            content: item.content, // 将后端返回的 content 映射为 content
            type: item.work_order_type_dict_key,
@@ -1846,7 +1854,7 @@
                ? `${longitude.toFixed(6)}, ${latitude.toFixed(6)}`
                : '未知位置',
            address: item.address,
            creator: item.event_num?.slice(0, 2) === 'AI' ? 'AI 小飞' : item.create_user,
            creator: item.event_num?.slice(0, 2) === 'AI' ? '智飞agent' : item.create_user,
            handler: item.update_user || '未分配',
            status: Number(item.status || 0),
            // 保存原始字段
@@ -1859,6 +1867,8 @@
            job_name: item.job_name || '',
            job_create_time: item.job_create_time || '',
            isReview: item.is_review, // 添加复核状态字段映射
          };
        });
@@ -2268,9 +2278,10 @@
      };
      console.log('this.currentDetail', this.currentDetail);
      this.detailVisible = true;
      this.handleTypeChange(this.currentDetail.type);
      console.log('this.currentDetail.location', this.currentDetail.location);
      this.$nextTick(() => {
        if (this.$refs.MapContainer && this.$refs.MapContainer.initAddEntity) {
@@ -2592,6 +2603,7 @@
      // console.log('权限检查:', this.permission)
      return this.permission && this.permission.tickets_review_btn === true;
    },
    async submitDispatch() {
      if (this.dispatchLoading) return;
      if (!this.currentDetail.orderName || !this.currentDetail.orderName.trim()) {
@@ -2616,7 +2628,22 @@
      }
      this.dispatchLoading = true;
      console.log('派发成功', this.currentDetail);
      const isValue = this.algorithms.some(item => item.value === this.currentDetail.aiType);
      let resultValue;
      if (isValue) {
        // 如果已经是value,直接使用
        resultValue = this.currentDetail.aiType;
      } else {
        // 否则查找对应的value
        const matched = this.algorithms.find(
          item => item.dict_value === this.currentDetail.aiType ||
                  item.label === this.currentDetail.aiType
        );
        resultValue = matched ? matched.value : null;
      }
// console.log('resultValue',resultValue);
      this.$refs.dispatchForm.validate(async valid => {
        if (valid) {
          try {
@@ -2630,7 +2657,7 @@
              content: this.currentDetail.content, // 使用 content 替代原来的 remark
              createDept: this.dispatchForm.department, // 派发部门 ID
              updateUser: this.dispatchForm.handler, // 处理人 ID
              aiType: this.currentDetail.aiType,
              aiType:resultValue,
            };
            console.log('派发', data);
@@ -3168,6 +3195,23 @@
          });
      }
    },
    // 导出工单报表
    exportTheTick(row){
      const params = {
        num:row.orderNumber
      }
      exportTheTicket(params).then(res=>{
      const elink = document.createElement('a')
      elink.download = row.orderName + '.docx'
      elink.style.display = 'none'
      const blob = new Blob([res.data])
      elink.href = URL.createObjectURL(blob)
      document.body.appendChild(elink)
      elink.click()
      document.body.removeChild(elink)
      })
       this.$message.success('数据导出成功');
    }
  },
  activated() {
    this.handleReset();