无人机管理后台前端(已迁走)
张含笑
2025-09-01 2ca94de8ede18ac07ccfd8dec7b6f6a707adde9b
src/views/tickets/ticket.vue
@@ -31,7 +31,7 @@
                :value="item.value"
              />
            </el-select> -->
            <el-select
            <!-- <el-select
              v-model="filters.type"
              placeholder="请选择工单类型"
              class="filter-item"
@@ -44,7 +44,7 @@
                :label="item.label"
                :value="item.value"
              />
            </el-select>
            </el-select> -->
            <el-date-picker
              v-model="filters.dateRange"
              type="daterange"
@@ -69,7 +69,7 @@
                :value="item.value"
              />
            </el-select>
            <el-select
            <!-- <el-select
              v-model="filters.algorithm"
              placeholder="请选择关联算法"
              class="filter-item"
@@ -82,7 +82,42 @@
                :label="item.dict_value"
                :value="item.dict_key"
              />
            </el-select>
            </el-select> -->
            <!-- <el-tree-select
              popper-class="custom-tree-select"
              :style="{ width: pxToRem(186) }"
              placeholder="请选择关联算法"
              v-model="dictKey"
              :data="dataList"
              :default-expanded-keys="[dictKey]"
              check-strictly
              node-key="id"
              :props="treePropsSF"
              @node-click="handleSFNodeClick"
              clearable
              @clear="handleClear"
            /> -->
            <el-tree-select
              style="z-index: 1000"
              :teleported="false"
              class="custom-tree-select"
              :style="{ width: pxToRem(186) }"
              v-model="dictKey"
              :data="dataList"
              :default-expanded-keys="[dictKey]"
              :props="treePropsSF"
              :render-after-expand="false"
              :default-checked-keys="checkedKeys"
              node-key="id"
              multiple
              show-checkbox
              collapse-tags
              collapse-tags-tooltip
              clearable
              @check="handleCheck"
              @node-click="handleSFNodeClick"
              @clear="handleClear"
            />
            <el-select
              v-model="filters.isReview"
              placeholder="请选择复核状态"
@@ -273,7 +308,7 @@
                  :disabled="!form.type"
                >
                  <el-option
                    v-for="item in algorithms"
                    v-for="item in algorithms2"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
@@ -365,7 +400,7 @@
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="danger" :loading="submitLoading" @click="submitForm">发布</el-button>
          <el-button type="infoprimary" plain :loading="draftLoading" @click="saveDraft"
            >存草稿</el-button
@@ -464,7 +499,7 @@
                  class="required-input"
                >
                  <el-option
                    v-for="item in algorithms"
                    v-for="item in algorithms2"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
@@ -477,7 +512,7 @@
          <el-table-column prop="label2" label="基本信息" width="150">
            <template #default="{ row }">
              <!-- 添加必填星号的标签 -->
              <span
                v-if="
                  currentDetail.status === 0 &&
@@ -493,8 +528,8 @@
          <el-table-column>
            <template #default="{ row }">
              <!-- 修改工单类型和工单内容的显示 -->
              <template
                v-if="
                  currentDetail.status === 0 &&
@@ -579,7 +614,7 @@
        <!-- 图片和地图部分 -->
        <div class="media-section">
          <el-row :gutter="20">
            <el-col :span="12">
              <div class="media-box">
                <div class="media-title">事件图片</div>
@@ -646,10 +681,10 @@
                        placement="top"
                        title=""
                        trigger="click"
                     >
                        <template #reference>
                           <img @click.stop="handleQRCode(currentDetail)"  class="QRCodeImg" src="@/assets/images/dataCenter/positionicon.png" alt="" title="事件导航" />
                           <img @click.stop="handleQRCode(currentDetail)"  class="QRCodeImg" src="@/assets/images/dataCenter/qrCode.svg" alt="" title="事件导航" />
                        </template>
                        <div class="qrcode-content">
                           <CreateQRcode v-if="currentDetail.showQR && detailVisible" :latAndLon="currentDetail.location"></CreateQRcode>
@@ -662,8 +697,8 @@
                </template>
              </div>
            </el-col>
          </el-row>
        </div>
      </div>
@@ -752,7 +787,7 @@
      <el-form :model="dispatchForm" :rules="dispatchRules" ref="dispatchForm" label-width="100px">
        <el-form-item label="选择部门" prop="department">
          <el-select
            v-model="dispatchForm.department"
            placeholder="请选择部门"
            @change="handleDispatchDepartmentChange"
@@ -899,6 +934,7 @@
  getReviewById,
  getCreateEventJob,
} from '@/api/tickets/ticket'
import { getSFDictionaryTree  } from '@/api/job/task';
import { export_json_to_excel } from '@/utils/exportExcel'
import geoJson from '@/assets/geoJson.json'
import { mapGetters } from 'vuex'
@@ -955,6 +991,7 @@
      ],
      algorithms: [],
      algorithms2: [],
      statuses: [
        { label: '待审核', value: '2' },
        { label: '待处理', value: '0' },
@@ -989,9 +1026,9 @@
          // { label: "序号", prop: "id", width: 70 },
          { label: '工单编号', prop: 'orderNumber', width: 170 },
          { label: '工单名称', prop: 'orderName', width: 150, overHidden: true, tooltip: true },
          { label: '所属单位', prop: 'department',width: 150, overHidden: true, tooltip: true },
          { label: '所属单位', prop: 'department', overHidden: true, tooltip: true },
          { label: '发起时间', prop: 'startTime', width: 160 },
          { label: '关联算法', prop: 'aiType', width: 150, overHidden: true, tooltip: true },
          { label: '关联算法', prop: 'aiType', overHidden: true, tooltip: true },
          {
            label: '工单类型',
            prop: 'type',
@@ -1110,6 +1147,14 @@
      // 复核弹窗
      reCheckDialog: false,
      treePropsSF: {
        label: 'dictValue',
        value: 'id',
        children: 'children',
      },
      dictKey: '',
      dataList: [],
      checkedKeys: [],
    };
  },
  created() {
@@ -1122,7 +1167,9 @@
  },
  mounted() {
    this.getAlgorithmList()
    const href = this.$route.href;
    if (this.$route?.query?.status !== undefined && this.$route?.query?.status !== null) {
      this.filters.status = this.$route?.query?.status + '';
@@ -1317,7 +1364,7 @@
          value2: filteredFields[i + 1]?.value || (filteredFields[i + 1]?.label ? '暂无数据' : ''),
        });
      }
      return formattedFields;
    },
@@ -1391,6 +1438,49 @@
  },
  methods: {
    handleCheck(data, { checkedKeys, checkedNodes }) {
      this.checkedKeys = checkedKeys
      // 获取所有选中节点的 dictKey
      const selectedDictKeys = checkedNodes.map(node => node.dictKey).filter(Boolean)
      this.filters.type = selectedDictKeys
      this.fetchTableData();
    },
    // 算法
    getAlgorithmList() {
      getSFDictionaryTree({code:'SF'}).then((res) => {
          if (res.data.code === 200) {
              const result = res.data.data[0].children
              // 过滤第一层数据
              const filteredData = result.map(item => {
                  // 过滤第二层数据
                  const children = item.children?.map(child => ({
                      ...child,
                      children: [] // 清空第三层数据
                  }))
                  return {
                      ...item,
                      children: children || []
                  }
              })
              this.dataList = filteredData
          }
      })
    },
    handleSFNodeClick(data) {
      console.log(data.dictKey, '666666666')
      this.filters.type = ''
      this.filters.algorithm = ''
      this.filters.type = data.dictKey
      // 更新列表请求
      this.fetchTableData();
    },
    handleClear() {
        this.dictKey = ''
        this.filters.algorithm = ''
         this.filters.type = ''
        this.fetchTableData();
    },
    handleCellClick(row, column) {
      console.log(row, column.no);
      if (column.no === 2) {
@@ -1555,14 +1645,16 @@
        console.log('工单类型',this.types);
        console.log('关联算法',this.allAlgorithms );
        // 确保算法数据的映射一致
        // this.algorithms =
        //   ai_type?.map(item => ({
        //     dict_key: item.dict_key,
        //     dict_value: item.dict_value,
        //     // 同时添加 label 和 value 以兼容两处使用
        //     label: item.dict_value,
        //     value: item.dict_key,
        //   })) || [];
        this.algorithms =
          ai_type?.map(item => ({
            dict_key: item.dict_key,
            dict_value: item.dict_value,
            // 同时添加 label 和 value 以兼容两处使用
            label: item.dict_value,
            value: item.dict_key,
          })) || [];
        this.algorithms2 = _.cloneDeep(this.algorithms)
        // 构建用户ID和名称的映射关系
        this.userNameToIdMap = {};
@@ -1577,26 +1669,25 @@
    },
    // 工单类型变化时触发
    handleTypeChange(typeValue) {
      this.form.algorithm = []
      if (!typeValue) {
        // 未选择类型时清空算法列表
        this.algorithms = [];
        this.algorithms2 = [];
        return;
      }
      const matchedCategory = this.allAlgorithms.find(
        category => category.dict_key === typeValue
        category => category.dict_key === typeValue
      );
      if (!matchedCategory || !matchedCategory.algorithms || matchedCategory.algorithms.length === 0) {
        // 无匹配的算法时清空
        this.algorithms = [];
        this.algorithms2 = [];
        this.$message.info('该工单类型暂无关联算法');
        return;
      }
// console.log('matchedCategory',matchedCategory);
      this.algorithms = matchedCategory.algorithms.map(algo => ({
        label: algo.dict_value,
      this.algorithms2 = matchedCategory.algorithms.map(algo => ({
        label: algo.dict_value,
        value: algo.dict_key,
        dict_key: algo.dict_key,
        dict_value: algo.dict_value
@@ -1611,7 +1702,7 @@
      try {
        const currentTab = this.tabs.find(tab => tab.name === this.activeTab);
        const params = {
          word_order_type: this.filters.type || undefined,
          word_order_types: this.filters.type || undefined,
          status:
            currentTab?.name === 'myTickets'
              ? undefined
@@ -1948,6 +2039,7 @@
    },
    handleReset() {
      this.dictKey = '';
      this.filters = {
        keyword: '',
        department: '',
@@ -2086,7 +2178,7 @@
      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) {
          this.$refs.MapContainer.initAddEntity('point', this.currentDetail.location);
@@ -2391,7 +2483,7 @@
      this.dispatchDialogVisible = true;
      console.log('受理',this.currentDetail);
    },
    hasProcessingBtnPermission() {
      // undefined 或 false 都返回 false,只有 true 返回 true
@@ -2432,7 +2524,7 @@
      }
      this.dispatchLoading = true;
      console.log('派发成功',this.currentDetail);
      this.$refs.dispatchForm.validate(async valid => {
        if (valid) {
          try {
@@ -3035,11 +3127,11 @@
  gap: 8px; // 使用 gap 统一设置间距
  .filter-item {
    width: 160px; // 减小宽度
    width: 280px; // 减小宽度
  }
  .date-picker {
    width: 240px; // 日期选择器宽度适当调整
    // width: 240px; // 日期选择器宽度适当调整
  }
  .el-button {
@@ -3447,6 +3539,7 @@
    width: 18px;
    height: 18px;
    cursor: pointer;
    padding-bottom: 1px;
    }
  }