无人机管理后台前端(已迁走)
罗广辉
2025-08-14 1dbfed01c8b1349a29796b20641ad0c77db1e313
feat: 算法下拉不出现
1 files modified
64 ■■■■ changed files
src/views/tickets/ticket.vue 64 ●●●● patch | view | raw | blame | history
src/views/tickets/ticket.vue
@@ -273,7 +273,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 +365,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 +464,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 +477,7 @@
          <el-table-column prop="label2" label="基本信息" width="150">
            <template #default="{ row }">
              <!-- 添加必填星号的标签 -->
              <span
                v-if="
                  currentDetail.status === 0 &&
@@ -493,8 +493,8 @@
          <el-table-column>
            <template #default="{ row }">
              <!-- 修改工单类型和工单内容的显示 -->
              <template
                v-if="
                  currentDetail.status === 0 &&
@@ -579,7 +579,7 @@
        <!-- 图片和地图部分 -->
        <div class="media-section">
          <el-row :gutter="20">
            <el-col :span="12">
              <div class="media-box">
                <div class="media-title">事件图片</div>
@@ -646,7 +646,7 @@
                                placement="top"
                                title=""
                                trigger="click"
                            >
                                <template #reference>
                                    <img @click.stop="handleQRCode(currentDetail)"  class="QRCodeImg" src="@/assets/images/dataCenter/positionicon.png" alt="" title="事件导航" />
@@ -662,8 +662,8 @@
                </template>
              </div>
            </el-col>
          </el-row>
        </div>
      </div>
@@ -752,7 +752,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"
@@ -956,6 +956,7 @@
      ],
      algorithms: [],
      algorithms2: [],
      statuses: [
        { label: '待审核', value: '2' },
        { label: '待处理', value: '0' },
@@ -1123,7 +1124,7 @@
  },
  mounted() {
    const href = this.$route.href;
    if (this.$route?.query?.status !== undefined && this.$route?.query?.status !== null) {
      this.filters.status = this.$route?.query?.status + '';
@@ -1318,7 +1319,7 @@
          value2: filteredFields[i + 1]?.value || (filteredFields[i + 1]?.label ? '暂无数据' : ''),
        });
      }
      return formattedFields;
    },
@@ -1558,14 +1559,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 = {};
@@ -1580,26 +1583,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
@@ -2089,7 +2091,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);
@@ -2394,7 +2396,7 @@
      this.dispatchDialogVisible = true;
      console.log('受理',this.currentDetail);
    },
    hasProcessingBtnPermission() {
      // undefined 或 false 都返回 false,只有 true 返回 true
@@ -2435,7 +2437,7 @@
      }
      this.dispatchLoading = true;
      console.log('派发成功',this.currentDetail);
      this.$refs.dispatchForm.validate(async valid => {
        if (valid) {
          try {