无人机管理后台前端(已迁走)
罗广辉
2025-09-06 c2e29fdee2d0e664961a84e95adf3882efbaf67a
Merge branch 'prod' into feature/v5.0/5.0.5
15 files modified
1 files added
1684 ■■■■■ changed files
.env.development 5 ●●●●● patch | view | raw | blame | history
.env.jiangwu 2 ●●●●● patch | view | raw | blame | history
.env.localhost 2 ●●●●● patch | view | raw | blame | history
.env.test 2 ●●●●● patch | view | raw | blame | history
src/api/patchManagement/index.js 8 ●●●●● patch | view | raw | blame | history
src/components/map-container/mapContainer.vue 192 ●●●● patch | view | raw | blame | history
src/utils/areaUtils.js 37 ●●●●● patch | view | raw | blame | history
src/utils/cesium/publicCesium.js 29 ●●●● patch | view | raw | blame | history
src/utils/cesium/useBoundary.js 1 ●●●● patch | view | raw | blame | history
src/utils/rem.js 7 ●●●●● patch | view | raw | blame | history
src/views/device/addDevice.vue 3 ●●●● patch | view | raw | blame | history
src/views/device/airport.vue 1 ●●●● patch | view | raw | blame | history
src/views/resource/components/DrawPolygon.vue 4 ●●●● patch | view | raw | blame | history
src/views/resource/components/spotDetails.vue 217 ●●●●● patch | view | raw | blame | history
src/views/resource/patchManagement.vue 31 ●●●●● patch | view | raw | blame | history
src/views/tickets/orderLog.vue 1143 ●●●●● patch | view | raw | blame | history
.env.development
@@ -21,7 +21,7 @@
# 服务地址
VITE_APP_URL = https://wrj.shuixiongit.com/api
#VITE_APP_URL= http://192.168.1.168
#VITE_APP_URL= http://192.168.1.168
#VITE_APP_URL= http://192.168.1.33
#新大屏地址
VITE_APP_DASHBOARD_URL = 'https://wrj.shuixiongit.com/command-center-dashboard/'
@@ -37,7 +37,8 @@
# 图片存放地址
VITE_APP_TERRAIN_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket/ztzf_terrain/all_terrain
# 行政区划存放地址
VITE_APP_REGION_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket/ztzf_region
# 算法仓库图片地址
VITE_APP_PICTURE_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket
.env.jiangwu
@@ -38,6 +38,8 @@
# 地形存放地址
VITE_APP_TERRAIN_URL = http://192.168.253.121:9000/cloud-bucket/ztzf_terrain
# 行政区划存放地址
VITE_APP_REGION_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket/ztzf_region
# 图片资源存放地址
VITE_APP_IMAGESOURCE_URL = http://192.168.253.121:9000/cloud-bucket
.env.localhost
@@ -28,6 +28,8 @@
# 图片存放地址
VITE_APP_TERRAIN_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket/ztzf_terrain/all_terrain
# 行政区划存放地址
VITE_APP_REGION_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket/ztzf_region
# 算法仓库图片地址
VITE_APP_PICTURE_URL = http://192.168.1.227:80/aiskyminio/cloud-bucket
.env.test
@@ -31,6 +31,8 @@
# 算法仓库图片地址
VITE_APP_PICTURE_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket
# 行政区划存放地址
VITE_APP_REGION_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket/ztzf_region
# 是否在打包时开启压缩,支持 gzip 和 brotli
VITE_BUILD_COMPRESS = gzip
src/api/patchManagement/index.js
@@ -103,4 +103,12 @@
        method: 'delete',
        params,
    })
}
// 获取所有图斑数据
export const AlltableMapListApi = params => {
    return request({
        url: `/drone-device-core/patches/api/v1/Patches/getLotInfoList`,
        method: 'get',
        params,
    })
}
src/components/map-container/mapContainer.vue
@@ -9,61 +9,64 @@
 * Copyright (c) 2024 by shuishen, All Rights Reserved.
-->
<template>
    <div class="map-container">
        <div class="viewer-container ztzf-cesium" id="viewer-container">
            <div class="content">
                <slot name="content"></slot>
            </div>
  <div class="map-container">
    <div class="viewer-container ztzf-cesium" id="viewer-container">
      <div class="content">
        <slot name="content"></slot>
      </div>
            <PlanarRouteLineList :curRouteLineData="curRouteLineData" @routeLineListClick="routeLineListClick" />
        </div>
      <PlanarRouteLineList
        :curRouteLineData="curRouteLineData"
        @routeLineListClick="routeLineListClick"
      />
    </div>
  </div>
</template>
<script setup>
import PlanarRouteLineList from '@/components/PlanarRouteLineList/PlanarRouteLineList.vue'
import PlanarRouteLineList from '@/components/PlanarRouteLineList/PlanarRouteLineList.vue';
import * as Cesium from 'cesium'
import { Cartesian3, Terrain, Viewer } from 'cesium'
import { PublicCesium } from '@/utils/cesium/publicCesium'
import ImageTrailMaterial from '@/utils/cesium/ImageTrailMaterial'
import { flyVisual } from '@/utils/cesium/mapUtil'
import * as turf from '@turf/turf'
import * as Cesium from 'cesium';
import { Cartesian3, Terrain, Viewer } from 'cesium';
import { PublicCesium } from '@/utils/cesium/publicCesium';
import ImageTrailMaterial from '@/utils/cesium/ImageTrailMaterial';
import { flyVisual } from '@/utils/cesium/mapUtil';
import * as turf from '@turf/turf';
import { nextTick, onBeforeUnmount, onMounted, onUnmounted } from 'vue'
import { read } from 'xlsx'
import { nextTick, onBeforeUnmount, onMounted, onUnmounted } from 'vue';
import { read } from 'xlsx';
import startPng from '@/assets/map_images/Startingpointicon.png'
import endPng from '@/assets/map_images/EndPointicon.png'
import rwqfdImg from '@/assets/images/task/arrow-right-blue.png'
import newNumPoint from '@/assets/images/task/custom-point.png'
import startPng from '@/assets/map_images/Startingpointicon.png';
import endPng from '@/assets/map_images/EndPointicon.png';
import rwqfdImg from '@/assets/images/task/arrow-right-blue.png';
import newNumPoint from '@/assets/images/task/custom-point.png';
import { useRouteLine } from '@/hooks/useRouteLine/useRouteLine.js'
import { useRouteLine } from '@/hooks/useRouteLine/useRouteLine.js';
const viewInstance = shallowRef(null);
// 加载航线hook
const { curRouteLineData, routeLineListClick, initViewer, renderPreviewLine } = useRouteLine()
const { curRouteLineData, routeLineListClick, initViewer, renderPreviewLine } = useRouteLine();
let publicCesiumInstance = null
let viewer = null
let publicCesiumInstance = null;
let viewer = null;
const { VITE_APP_BASE } = import.meta.env
const { VITE_APP_BASE } = import.meta.env;
// import * as Cesium from 'cesium'
// import 'cesium/Build/Cesium/Widgets/widgets.css'
const isViewerReady = ref(false)
const isViewerReady = ref(false);
const { rowDetails } = defineProps({
    rowDetails: {
        type: Object,
        default: () => ({}),
    }
})
  rowDetails: {
    type: Object,
    default: () => ({}),
  },
});
async function initMap () {
    if (viewer) return
    publicCesiumInstance = new PublicCesium({ dom: 'viewer-container',layerMode: 4 })
    viewer = publicCesiumInstance.getViewer()
    initViewer(viewer)
    isViewerReady.value = true
async function initMap() {
  if (viewer) return;
  publicCesiumInstance = new PublicCesium({ dom: 'viewer-container', layerMode: 4 });
  viewer = publicCesiumInstance.getViewer();
  viewInstance.value = publicCesiumInstance;
  initViewer(viewer);
  isViewerReady.value = true;
}
/**
@@ -72,92 +75,95 @@
 * @param data 数据
 */
const initAddEntity = (type, data) => {
    watch(() => isViewerReady.value,
        (ready) => {
            if (ready) {
                viewer.entities.removeAll()
                type === 'point' ? addPoint(data) : addPolyline(data)
            }
        },
        { deep: true, immediate: true } // 初始化时立即执行
    )
}
  watch(
    () => isViewerReady.value,
    ready => {
      if (ready) {
        viewer.entities.removeAll();
        if (type === 'initPosition') {
          viewInstance.value?.flyToContour();
        } else {
          type === 'point' ? addPoint(data) : addPolyline(data);
        }
      }
    },
    { deep: true, immediate: true } // 初始化时立即执行
  );
};
/**
 * 添加点标注
 * @param data 数据  数据格式 [lng, lat]
 */
function addPoint (data) {
    const [lng, lat] = data
function addPoint(data) {
  const [lng, lat] = data;
    if (!lng || !lat) return
  if (!lng || !lat) return;
    viewer.entities.add({
        position: Cartesian3.fromDegrees(lng, lat),
        point: {
            pixelSize: 10,
            color: Cesium.Color.BLUE,
            outlineColor: Cesium.Color.WHITE,
            outlineWidth: 2
        }
    })
  viewer.entities.add({
    position: Cartesian3.fromDegrees(lng, lat),
    point: {
      pixelSize: 10,
      color: Cesium.Color.BLUE,
      outlineColor: Cesium.Color.WHITE,
      outlineWidth: 2,
    },
  });
    // 定位到点位
    const points = [[lng, lat]]  // 确保格式为二维数组
    flyVisual({ positionsData:points, viewer,multiple: 10 })
  // 定位到点位
  const points = [[lng, lat]]; // 确保格式为二维数组
  flyVisual({ positionsData: points, viewer, multiple: 10 });
}
/**
 * 添加点标注
 * @param data 数据  数据格式 [[lng, lat], [lng, lat], [lng, lat]]
 */
async function addPolyline (data) {
    await renderPreviewLine(data.url, data.type, data.cb, data.infos)
async function addPolyline(data) {
  await renderPreviewLine(data.url, data.type, data.cb, data.infos);
}
onMounted(() => {
    nextTick(() => {
        initMap()
    })
})
  nextTick(() => {
    initMap();
  });
});
onBeforeUnmount(() => {
    var cesiumContainer = document.getElementById('viewer-container')
    if (cesiumContainer) {
        cesiumContainer.remove() // 移除与地图相关的DOM元素
    }
  var cesiumContainer = document.getElementById('viewer-container');
  if (cesiumContainer) {
    cesiumContainer.remove(); // 移除与地图相关的DOM元素
  }
    viewer.entities.removeAll()
    publicCesiumInstance.viewerDestroy()
    viewer = null
})
  viewer.entities.removeAll();
  publicCesiumInstance.viewerDestroy();
  viewer = null;
});
defineExpose({
    initAddEntity
})
  initAddEntity,
});
</script>
<script>
export default {
    name: 'MapContainer'
}
  name: 'MapContainer',
};
</script>
<style lang="scss" scoped>
.map-container {
    position: relative;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden;
  position: relative;
  width: 100% !important;
  height: 100% !important;
  overflow: hidden;
}
.viewer-container {
    position: absolute;
    top: 0%;
    left: 0%;
    width: 100%;
    height: 100%;
  position: absolute;
  top: 0%;
  left: 0%;
  width: 100%;
  height: 100%;
}
</style>
src/utils/areaUtils.js
New file
@@ -0,0 +1,37 @@
/**
 * 根据行政区划代码查找对应的行政区划名称
 * @param {string|number} areaCode - 行政区划代码
 * @param {Array} regionalData - 行政区划树形数据
 * @param {boolean} [needFullPath=false] - 是否需要完整路径
 * @returns {string} 行政区划名称或完整路径
 */
export const findAreaName = (areaCode, regionalData = [], needFullPath = false) => {
    if (!regionalData || regionalData.length === 0) return areaCode;
    const normalizeCode = code => {
      if (!code) return '';
      const strCode = String(code).replace(/0+$/, '');
      return strCode.length >= 6 ? strCode : '';
    };
    const targetCode = normalizeCode(areaCode);
    const findInTree = (treeNodes, parentPath = []) => {
      for (const node of treeNodes) {
        const currentPath = [...parentPath, node.name];
        if (normalizeCode(node.id) === targetCode) {
          return needFullPath ? currentPath.join('/') : node.name;
        }
        if (node.childrens?.length > 0) {
          const found = findInTree(node.childrens, currentPath);
          if (found) return found;
        }
      }
      return null;
    };
    return findInTree(regionalData) || areaCode;
  };
src/utils/cesium/publicCesium.js
@@ -94,7 +94,7 @@
            terrain = false,
            layerMode = 0,
            contour = true,
            // flyToContour = false,
            flyToContour = false,
            multiple = 1.4,
            dockOptions = {},
@@ -158,8 +158,8 @@
        this.viewer.scene.screenSpaceCameraController.maximumZoomDistance = 4500000
        this.switchLayers(layerMode)
        this.switchFlatMode(flatMode)
        // this.switchContour(contour)
        // flyToContour && this.flyToContour(contour)
        this.switchContour(contour)
        flyToContour && this.flyToContour(contour)
    }
    getViewer () {
@@ -202,21 +202,22 @@
    }
    setShowDock (sns) {
        // this.boundary?.setShowDock(sns)
        this.boundary?.setShowDock(sns)
    }
    // 切换轮廓显示
    // async switchContour (open) {
    //     if (open) {
    //         await this.boundary?.openContour()
    //     } else {
    //         this.boundary?.closeContour()
    //     }
    // }
    async switchContour (open) {
        if (open) {
            await this.boundary?.openContour()
        } else {
            this.boundary?.closeContour()
        }
    }
    // // 飞向轮廓居中
    // flyToContour () {
    //     this.boundary?.flyToBoundary()
    // }
    flyToContour () {
        this.boundary?.flyToBoundary()
    }
    // 飞行 flyto
    flyTo (pointOption, time = 4, height = 3000, orientation = {}, complete = () => { }) {
src/utils/cesium/useBoundary.js
@@ -217,6 +217,7 @@
    // 打开边界
    const openContour = async () => {
        const areaCode = selectedAreaCode || userAreaCode
        viewer.scene.postRender.removeEventListener(determineScaling)
        if (!areaCode) return
        const hierarchy = areaCodeToArr(areaCode.slice(0, 6))
src/utils/rem.js
@@ -10,3 +10,10 @@
export const pxToRem = width => {
    return width * 0.1 + 'rem'
}
// 不带单位的px转rem
export const pxToRemNum = width => {
    const scale = document.documentElement.clientWidth / 192
    return width * 0.1 * scale
}
src/views/device/addDevice.vue
@@ -75,6 +75,7 @@
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                searchGutter: 30,
                border: true,
                index: true,
                indexLabel: '序号',
@@ -95,7 +96,7 @@
                        prop: 'workspace_name',
                        // editDisabled: true,
                        editDisplay: false,
                        // searchLabelWidth: 130,
                        labelWidth: 130,
                        search: true,
                        // searchSpan: 4,
                        labelWidth: 130,
src/views/device/airport.vue
@@ -285,7 +285,6 @@
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        searchGutter: 30,
        border: true,
        index: true,
        indexLabel: '序号',
src/views/resource/components/DrawPolygon.vue
@@ -177,7 +177,7 @@
    curPolygonEntity.polyline = {
      width: 2,
      material: Cesium.Color.WHITE,
      clampToGround: false,
      clampToGround: true,
    };
    curPolygonEntity.polyline.positions = new Cesium.CallbackProperty(function () {
@@ -293,7 +293,7 @@
  background: rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  border-radius: 4px;
pointer-events: none;
  &::after {
    content: '';
    position: absolute;
src/views/resource/components/spotDetails.vue
@@ -65,24 +65,31 @@
              :row-class-name="tableRowClassName"
              :data="tableData"
              @row-click="handleLocationPolygon"
              @current-change="handleTableRowChange"
            >
              <el-table-column type="index" align="center" width="30" label="序号">
              <el-table-column type="index" align="center" :width="pxToRemNum(30)" label="序号">
                <template #default="{ $index }">
                  {{
                    ($index + 1 + (params.page - 1) * params.pageSize).toString().padStart(2, '0')
                  }}
                </template>
              </el-table-column>
              <el-table-column prop="dkbh" align="center" label="图斑名称" show-overflow-tooltip />
              <el-table-column prop="is_exception" align="center" label="图斑状态">
              <el-table-column prop="dkbh" align="center"  label="图斑名称" show-overflow-tooltip />
              <el-table-column prop="is_exception" :width="pxToRemNum(50)" align="center" label="图斑状态">
                <template #default="scope">
                  <span>{{ scope.row.is_exception === 2 ? '异常' : '正常' }}</span>
                </template>
              </el-table-column>
              <el-table-column label="操作" align="center" v-if="props.title === '图斑编辑'">
              <el-table-column label="操作"  align="center" v-if="props.title === '图斑编辑'">
                <template #default="scope">
                  <span class="operationspan" @click="handleDelete(scope.row)">删除</span>
                  <span class="operationspan" @click="handleSelectionChange(scope.row)">编辑</span>
                  <span
                    class="operationspan"
                    v-if="scope.row.is_exception == 2"
                    @click.stop="handleSelectionChange(scope.row)"
                  >
                    {{ isEditing && selectionIds === scope.row.id ? '取消编辑' : '编辑' }}
                  </span>
                </template>
              </el-table-column>
            </el-table>
@@ -103,54 +110,60 @@
          </div>
        </div>
        <!--绘制按钮-->
        <FunButton
          ref="funButtonEle"
          v-model:isBoxSelect="isBoxSelect"
          v-model:isDrawPolygon="isDrawPolygon"
        ></FunButton>
        <DrawPolygon
          ref="drawPolygonRef"
          v-if="isEditing"
          @upDateDrawState="handleUpDateDrawState"
        />
        <!-- 完成/取消 -->
        <div class="btnGroups" v-if="props.title === '图斑编辑'">
          <img @click="handleSave" src="@/assets/images/home/territory/savebtn.png" alt="" />
          <img @click="handleCancel" src="@/assets/images/home/territory/cancelbtn.png" alt="" />
        </div>
        <!-- 地图 -->
        <div id="spotMap" class="ztzf-cesium" v-show="uploadPatchDialog"></div>
        <div id="spotMap" v-loading="loading"  element-loading-text="加载中..." element-loading-background="rgba(0, 0, 0, 0.7)" class="ztzf-cesium" v-show="uploadPatchDialog"></div>
      </div>
    </div>
  </el-dialog>
</template>
<script setup>
import { pxToRem, pxToRemNum } from '@/utils/rem'
import DrawPolygon from '@/views/resource/components/DrawPolygon.vue';
import { ElMessage, ElMessageBox } from 'element-plus';
import { findAreaName } from '@/utils/areaUtils';
import {
  patchEditApi,
  spotManagementTableApi,
  searchManagementApi,
  uploadManagementApi,
  tableMapListApi,
  deletePatches,
  AlltableMapListApi,
  spotManagementTableApi,
} from '@/api/patchManagement/index';
import { getCenterPoint } from '@/utils/cesium/mapUtil.js';
import { getPatchesSpotList } from '@/api/patchManagement/index';
import * as Cesium from 'cesium';
import { PublicCesium } from '@/utils/cesium/publicCesium';
import { ref, watch, onBeforeUnmount, onMounted } from 'vue';
import FunButton from '@/views/resource/components/FunButton.vue';
const uploadPatchDialog = defineModel('show');
const props = defineProps(['title', 'detailid', 'detailList', 'spotTypeOption']);
const props = defineProps(['title', 'detailid', 'detailList', 'spotTypeOption', 'regionalData']);
const polygonTableEle = ref(null);
let publicCesiumInstance = null;
let viewer = null;
const viewInstance = shallowRef(null);
const homeViewer = shallowRef(null);
let tbJwdList = [];
const loading = ref(false);
const tableData = ref([]);
const AlltableData = ref([]);
let total = ref(0);
const refreshonload = inject('searchReset');
const initialFileName = ref('');
const initialSpotTypeId = ref('');
const initialSpotTypeLabel = ref('');
// 当前选中的图斑面数据
let nowSelectObj = ref({});
const spotManagementData = ref(null);
const isEditing = ref(false);
const drawPolygonRef = ref(null);
// 记录上一次点击高亮
let lastHighlightRow = null;
// 功能按钮区域相关:编辑图斑等
@@ -191,48 +204,47 @@
  { immediate: true }
);
watch(
  () => props.detailList,
  () => spotManagementData.value,
  newVal => {
    if (newVal) {
      updateInfoList(newVal);
    }
    if (newVal) updateInfoList(newVal);
  },
  { immediate: true }
);
// 图斑编辑详情
const getspotManagementTableApi = () => {
  spotManagementTableApi({ id: props.detailid }).then(res => {
    spotManagementData.value = {
      ...res.data.data.records[0],
      dataFrom: res.data.data.records[0].date_from === 0 ? '本地上传' : '国土调查云',
      areaName: findAreaName(res.data.data.records[0].area_code, props.regionalData, true),
    };
  });
};
// 将 lot_type_id 转换为对应的 label
const getPatchTypeLabel = lotTypeId => {
  const option = spotTypeOptions.value.find(opt => opt.value === String(lotTypeId));
  return option ? option.label : '';
};
const updateInfoList = detailData => {
  if (detailData && (initialFileName.value === '' || initialSpotTypeId.value === '')) {
  if (!detailData) return;
  if (initialFileName.value === '' || initialSpotTypeId.value === '') {
    initialFileName.value = detailData.file_name || '';
    initialSpotTypeId.value = detailData.lot_type_id || '';
    initialSpotTypeLabel.value = detailData.patches_type_desc
      ? detailData.patches_type_desc
      : getPatchTypeLabel(detailData.lot_type_id);
    initialSpotTypeLabel.value =
      detailData.patches_type_desc || getPatchTypeLabel(detailData.lot_type_id);
  }
  infoList.value = infoList.value.map(item => {
    let value = detailData[item.field] !== undefined ? detailData[item.field] : item.value;
    const value = detailData[item.field] ?? item.value;
    if (item.name === '图斑类型') {
      if (detailData.patches_type_desc !== undefined) {
        return {
          ...item,
          value: detailData.patches_type_desc,
          originalValue: detailData.lot_type_id,
        };
      } else if (detailData.lot_type_id !== undefined) {
        return {
          ...item,
          value: getPatchTypeLabel(detailData.lot_type_id),
          originalValue: detailData.lot_type_id,
        };
      }
      return {
        ...item,
        value: detailData.patches_type_desc || getPatchTypeLabel(detailData.lot_type_id),
        originalValue: detailData.lot_type_id,
      };
    }
    return { ...item, value: value };
    return { ...item, value };
  });
};
const params = ref({
@@ -254,10 +266,35 @@
    total.value = res.data.data.total || res.data.data.length;
    tbJwdList = [];
    viewer?.entities.removeAll();
    entitiesAddSpot();
    if (!AlltableData.value) {
      viewInstance.value?.flyToContour();
    } else {
      entitiesAddSpot();
    }
  });
};
// 所有图斑数据
const getAlltableMapListApi = () => {
  loading.value = true;
  const requestParams = {
    patchesInfoId: props.detailid,
  };
  AlltableMapListApi(requestParams).then(res => {
    AlltableData.value = res.data.data?.map(item => ({
      ...item,
      dkfw: item.sdfw && item.is_exception == 1 ? item.sdfw : item.dkfw,
    }));
    tbJwdList = [];
    viewer?.entities.removeAll();
    if (AlltableData.value.length < 1) {
      viewInstance.value?.flyToContour();
    } else {
      entitiesAddSpot();
    }
    loading.value = false;
  });
};
const handleSizeChange = val => {
  params.value.pageSize = val;
  params.value.page = 1;
@@ -267,7 +304,7 @@
  params.value.page = val;
  getTableList();
};
const tableData = ref([]);
// 地图
const initMap = () => {
  if (!document.getElementById('spotMap')) {
@@ -284,11 +321,12 @@
  viewer = publicCesiumInstance.getViewer();
  viewInstance.value = publicCesiumInstance;
  viewer.scene.globe.depthTestAgainstTerrain = true;
  viewInstance.value.switchContour(true);
};
// 初始化所有图斑
const entitiesAddSpot = () => {
  viewer?.entities.removeAll();
  tableData.value.forEach(item => {
  AlltableData.value.forEach(item => {
    // 取出当中经纬度
    const numbersWithCommas = item.dkfw.match(/\d+(\.\d+)?/g);
    if (!numbersWithCommas) return;
@@ -334,10 +372,7 @@
      const boundingSphere = Cesium.BoundingSphere.fromPoints(positions);
      homeViewer.value?.camera.flyToBoundingSphere(boundingSphere, {
        duration: 0,
        offset: new Cesium.HeadingPitchRange(
          Cesium.Math.toRadians(-45),
          Cesium.Math.toRadians(-90)
        ),
        offset: new Cesium.HeadingPitchRange(Cesium.Math.toRadians(0), Cesium.Math.toRadians(-90)),
      });
    }
    viewInstance.value?.removeLeftClickEvent('spotHighlighting');
@@ -346,9 +381,6 @@
};
// 高亮当前选中图斑,并定位
// const handleLocationPolygon = data => {
//   updateMapSpotInfo(data);
// };
const getEntityByDataId = dataId => {
  if (!homeViewer.value) return null;
  const entityId = `polygon_dk${dataId}`;
@@ -356,6 +388,15 @@
};
const handleLocationPolygon = data => {
  if (!data) return;
  // 取消任何现有的绘制状态(与编辑取消逻辑一致)
  if (isEditing.value) {
    isEditing.value = false;
    handleUpDateDrawState(false);
    selectionIds.value = null;
    selectionList.value = [];
  }
  const targetEntity = getEntityByDataId(data.id);
  if (targetEntity) {
    updateMapSpotInfo(targetEntity);
@@ -373,6 +414,7 @@
    });
  }
};
// 鼠标触发点击图斑高亮 pick:可以获取当前图斑数据
function spotHighlighting(click, pick, viewer) {
  let entities = viewer?.scene
@@ -380,7 +422,7 @@
    .filter(item => item.id)
    .map(i => i.id)
    .filter(i => i._customType === 'pattern_spot_polygon');
    if (!pick || !(pick.id?.customType == 'pattern_spot_polygon')) return;
  if (!pick || !(pick.id?.customType == 'pattern_spot_polygon')) return;
  const nowEntity = entities?.[0];
  const nowData = nowEntity.customInfo;
  const clickTableID = tableData.value.findIndex(i => i.id === nowData.id);
@@ -412,15 +454,14 @@
    const lastData = lastEntity.customInfo;
    const originalFillColor =
      lastData.is_exception === 2
          ? Cesium.Color.RED.withAlpha(0.5)
          : Cesium.Color.YELLOW.withAlpha(0.5);
     const originalOutlineColor = lastData.is_exception == 2
    ? Cesium.Color.RED
    : Cesium.Color.YELLOW;
        ? Cesium.Color.RED.withAlpha(0.5)
        : Cesium.Color.YELLOW.withAlpha(0.5);
    const originalOutlineColor =
      lastData.is_exception == 2 ? Cesium.Color.RED : Cesium.Color.YELLOW;
  lastEntity.polygon.material = originalFillColor;
  lastEntity.polygon.outlineColor = originalOutlineColor;
  lastEntity.polyline.material = originalOutlineColor;
    lastEntity.polygon.material = originalFillColor;
    lastEntity.polygon.outlineColor = originalOutlineColor;
    lastEntity.polyline.material = originalOutlineColor;
  }
  lastEntity = nowEntity;
  const numbersWithCommas = nowData.dkfw.match(/\d+(\.\d+)?/g);
@@ -430,7 +471,7 @@
      if (index % 2 === 0) acc.push(src.slice(index, index + 2));
      return acc;
    }, []);
    const polygonCenter = getCenterPoint(groupedArr);
    const polygonCenter = getCenterPoint(groupedArr);
    // 相机定位
    homeViewer.value.scene.camera.setView({
      destination: Cesium.Cartesian3.fromDegrees(
@@ -452,15 +493,31 @@
// 编辑
const handleSelectionChange = row => {
  let curRowIsSelect = row;
  curRowIsSelect && handleLocationPolygon(row);
  selectionIds.value = row.id;
  selectionList.value = row;
  curRowIsSelect && handleLocationPolygon(row);
  if (row.is_exception == 2 && curRowIsSelect) {
    isDrawPolygon.value = true;
    funButtonEle.value.upDateDrawState(true);
    handleLocationPolygon(row);
  if (isEditing.value) {
    //当前已编辑 → 取消编辑(关闭绘制、重置状态)
    isEditing.value = false;
    handleUpDateDrawState(false); // 通知DrawPolygon取消绘制
  } else {
    isDrawPolygon.value = false;
    // 当前未编辑 → 开启编辑(仅异常图斑可编辑)
    if (row.is_exception === 2 && curRowIsSelect) {
      isEditing.value = true;
      handleUpDateDrawState(true); // 通知DrawPolygon开启绘制
    } else {
      ElMessage.warning('仅异常图斑支持编辑绘制');
      isEditing.value = false;
    }
  }
};
const handleUpDateDrawState = show => {
  isEditing.value = show; // 同步编辑状态
  if (!show) {
    // 绘制关闭时,清空选中的编辑行
    selectionIds.value = null;
    selectionList.value = [];
  }
};
// 删除
@@ -474,6 +531,8 @@
      if (res.data.code !== 0) return ElMessage.warning('删除失败');
      ElMessage.success('删除成功');
      getTableList();
      getspotManagementTableApi();
      getAlltableMapListApi();
    });
  });
};
@@ -520,6 +579,10 @@
    spotTypeItem.value = initialSpotTypeLabel.value;
    spotTypeItem.originalValue = initialSpotTypeId.value;
  }
  if (isEditing.value) {
    isEditing.value = false;
    handleUpDateDrawState(false);
  }
  clearSelect();
  isDrawPolygon.value = false; // 关闭地图绘制状态
  uploadPatchDialog.value = false;
@@ -543,12 +606,12 @@
    setTimeout(() => {
      initMap();
      getTableList();
      getAlltableMapListApi();
      getspotManagementTableApi();
    }, 0);
  } else {
    if (funButtonEle.value) {
      isBoxSelect.value = false;
      isDrawPolygon.value = false;
    }
    isEditing.value = false;
    handleUpDateDrawState(false);
    destroyMap();
  }
  refreshonload();
@@ -701,6 +764,7 @@
    color: #fff !important;
    .cell {
      padding: 0px !important;
      font-size: 12px !important;
    }
    // 隔行变色
    .even-row {
@@ -752,9 +816,10 @@
  }
  .operationspan {
    cursor: pointer;
    color: #409eff;
  }
  .operationspan:first-child {
    margin-right: 10px;
    margin-right: 5px;
  }
  // 分页
src/views/resource/patchManagement.vue
@@ -84,10 +84,12 @@
      :detailid="detailid"
      :detailList="detailList"
      :spotTypeOption="allspotTypeOption"
      :regionalData="regionalData"
    ></SpotDetails>
  </basic-container>
</template>
<script setup>
import {findAreaName} from '@/utils/areaUtils'
import {
  spotManagementTableApi,
  searchManagementApi,
@@ -466,40 +468,13 @@
    data.value = d.records.map(i => ({
      ...i,
      dataFrom: i.date_from === 0 ? '本地上传' : '国土调查云',
      areaName: findAreaName(i.area_code),
      areaName: findAreaName(i.area_code, regionalData.value, true)
    }));
    loading.value = false;
    selectionClear();
  });
};
const findAreaName = areaCode => {
  const nodes = regionalData.value;
  if (!nodes || nodes.length === 0) return areaCode;
  const normalizeCode = code => {
    if (!code) return '';
    const strCode = String(code).replace(/0+$/, '');
    return strCode.length >= 6 ? strCode : '';
  };
  const targetCode = normalizeCode(areaCode);
  const findInTree = (treeNodes, needFullPath = false, parentPath = []) => {
    for (const node of treeNodes) {
      const currentPath = [...parentPath, node.name];
      if (normalizeCode(node.id) === targetCode) {
        return needFullPath ? currentPath.join('/') : node.name;
      }
      if (node.childrens?.length > 0) {
        const found = findInTree(node.childrens, needFullPath, currentPath);
        if (found) return found;
      }
    }
    return null;
  };
  return findInTree(nodes, true) || areaCode;
};
// 图斑详情/编辑
const uploadPatch = (row, type = 'detail') => {
  detailid.value = row.id;
src/views/tickets/orderLog.vue
@@ -1,39 +1,73 @@
<template>
  <basic-container>
    <el-tabs v-model="activeTab" @tab-click="handleTabChange">
      <el-tab-pane v-for="tab in filteredTabs" :key="tab.name" :label="`${tab.label} (${tab.count})`" :name="tab.name">
      <el-tab-pane
        v-for="tab in filteredTabs"
        :key="tab.name"
        :label="`${tab.label} (${tab.count})`"
        :name="tab.name"
      >
        <basic-main-content>
          <!-- 查询条件筛选栏 -->
          <div class="filter-bar">
            <div class="search-bar-box">
              <div class="search-bar-box-item">
                <el-input v-model="filters.key_word" placeholder="输入工单编号/名称/内容/姓名" clearable
                  @keyup.enter="handleSearch" />
                <el-input
                  v-model="filters.key_word"
                  placeholder="输入工单编号/名称/内容/姓名"
                  clearable
                  @keyup.enter="handleSearch"
                />
              </div>
<!--              <div class="search-bar-box-item">-->
<!--                <el-select placeholder="请选择所属单位" v-model="filters.create_dept" clearable>-->
<!--                  <el-option v-for="dept in departments" :key="dept.value" :label="dept.label" :value="dept.value" />-->
<!--                </el-select>-->
<!--              </div>-->
              <!--              <div class="search-bar-box-item">-->
              <!--                <el-select placeholder="请选择所属单位" v-model="filters.create_dept" clearable>-->
              <!--                  <el-option v-for="dept in departments" :key="dept.value" :label="dept.label" :value="dept.value" />-->
              <!--                </el-select>-->
              <!--              </div>-->
              <div class="search-bar-box-item">
                <el-date-picker @change="handleSearch" v-model="filters.dateRange" type="daterange" range-separator="至"
                  start-placeholder="开始日期" end-placeholder="结束日期" :default-value="datePickerDefaultVal" />
                <el-date-picker
                  @change="handleSearch"
                  v-model="filters.dateRange"
                  type="daterange"
                  range-separator="至"
                  start-placeholder="开始日期"
                  end-placeholder="结束日期"
                  :default-value="datePickerDefaultVal"
                />
              </div>
              <div class="search-bar-box-item">
                <el-select @change="handleSearch" v-model="filters.file_id" placeholder="请选择关联航线" filterable clearable>
                  <el-option v-for="item in wayLineList" :key="item.wayline_id" :label="item.name"
                    :value="item.wayline_id" />
                <el-select
                  @change="handleSearch"
                  v-model="filters.file_id"
                  placeholder="请选择关联航线"
                  filterable
                  clearable
                >
                  <el-option
                    v-for="item in wayLineList"
                    :key="item.wayline_id"
                    :label="item.name"
                    :value="item.wayline_id"
                  />
                </el-select>
              </div>
              <div class="search-bar-box-item">
                <el-select @change="handleSearch" v-model="filters.ai_types" placeholder="关联算法" clearable>
                  <el-option v-for="item in ai_types" :key="item.dictKey" :label="item.dictValue"
                    :value="item.dictKey" />
                <el-select
                  @change="handleSearch"
                  v-model="filters.ai_types"
                  placeholder="关联算法"
                  clearable
                >
                  <el-option
                    v-for="item in ai_types"
                    :key="item.dictKey"
                    :label="item.dictValue"
                    :value="item.dictKey"
                  />
                </el-select>
              </div>
@@ -45,46 +79,88 @@
              </div> -->
              <div class="search-bar-box-item">
                <el-select @change="handleSearch" v-model="filters.status" placeholder="请选择工单状态" clearable :disabled="activeTab !== 'all'">
                  <el-option v-for="item in statuses" :key="item.value" :label="item.label" :value="item.value" />
                <el-select
                  @change="handleSearch"
                  v-model="filters.status"
                  placeholder="请选择工单状态"
                  clearable
                  :disabled="activeTab !== 'all'"
                >
                  <el-option
                    v-for="item in statuses"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  />
                </el-select>
              </div>
            </div>
            <div class="search-bar-box">
              <div class="search-bar-box-item flex-2">
                <el-date-picker @change="handleSearch" v-model="filters.cycleDateRange" type="daterange" range-separator="至"
                  start-placeholder="工单周期开始日期" end-placeholder="工单周期结束日期" :default-value="datePickerDefaultVal" />
                <el-date-picker
                  @change="handleSearch"
                  v-model="filters.cycleDateRange"
                  type="daterange"
                  range-separator="至"
                  start-placeholder="工单周期开始日期"
                  end-placeholder="工单周期结束日期"
                  :default-value="datePickerDefaultVal"
                />
              </div>
              <div class="search-bar-box-item">
                <el-select @change="handleSearch" v-model="filters.rep_fre_type" placeholder="请选择频次" clearable>
                <el-select
                  @change="handleSearch"
                  v-model="filters.rep_fre_type"
                  placeholder="请选择频次"
                  clearable
                >
                  <el-option v-for="item in cycles" :key="item" :label="item" :value="item" />
                </el-select>
              </div>
              <div class="search-bar-box-item">
                <el-time-picker @change="handleSearch" v-model="filters.deal_time" placeholder="请选择执行时间" prop="deal_time" value-format="HH:mm"
                <el-time-picker
                  @change="handleSearch"
                  v-model="filters.deal_time"
                  placeholder="请选择执行时间"
                  prop="deal_time"
                  value-format="HH:mm"
                  :picker-options="{
                    selectableRange: '00:00 - 23:59',
                  }" />
                  }"
                />
              </div>
              <div class="search-bar-box-item"></div>
              <div class="search-bar-box-item"></div>
              <div class="search-bar-box-item search-btn">
                <el-button type="primary" icon="el-icon-search" @click="handleSearch">搜索</el-button>
                <el-button type="primary" icon="el-icon-search" @click="handleSearch"
                  >搜索</el-button
                >
                <el-button icon="el-icon-refresh" @click="handleReset">清空</el-button>
              </div>
            </div>
          </div>
          <!-- 表格部分 -->
          <avue-crud class="ztzf-public-general-avue-crud" :data="tableData" :option="option" v-model:page="page"
            ref="crud" :table-loading="loading" @current-change="currentChange" @refresh-change="refreshChange"
            @on-load="onLoad" @search-change="searchChange" @size-change="sizeChange" v-if="activeTab === tab.name">
            <template #job_info_num="{row}">
          <avue-crud
            class="ztzf-public-general-avue-crud"
            :data="tableData"
            :option="option"
            v-model:page="page"
            ref="crud"
            :table-loading="loading"
            @current-change="currentChange"
            @refresh-change="refreshChange"
            @on-load="onLoad"
            @search-change="searchChange"
            @size-change="sizeChange"
            v-if="activeTab === tab.name"
          >
            <template #job_info_num="{ row }">
              <el-tooltip-copy :content="row.job_info_num" :showCopyText="true" textAlign="left">
                {{ row.job_info_num }}
              </el-tooltip-copy>
@@ -97,15 +173,28 @@
            </template>
            <template #menu-left>
              <el-button v-if="hasAddBtnPermission() && activeTab != 'WAIT_AUDIT'" type="primary" icon="el-icon-plus"
                @click="handleAdd">新建工单</el-button>
              <el-button type="success" plain icon="el-icon-download" @click="exportData">导出</el-button>
              <el-button
                v-if="hasAddBtnPermission() && activeTab != 'WAIT_AUDIT'"
                type="primary"
                icon="el-icon-plus"
                @click="handleAdd"
                >新建工单</el-button
              >
              <el-button type="success" plain icon="el-icon-download" @click="exportData"
                >导出</el-button
              >
            </template>
            <template #menu="{ row }">
              <div class="menu-custom-box">
                <template v-if="row.status == 1">
                  <el-button v-if="hasPaddingBtnPermission()" type="text" icon="el-icon-view" @click="handleCheckDetail(row)">审核</el-button>
                  <el-button
                    v-if="hasPaddingBtnPermission()"
                    type="text"
                    icon="el-icon-view"
                    @click="handleCheckDetail(row)"
                    >审核</el-button
                  >
                </template>
                <!-- v-if="
                    (userInfo.user_id == row.create_user || hasRecallPaddingBtnPermission()) &&
@@ -113,25 +202,48 @@
                  " -->
                <template v-if="row.status == 1">
                  <!--待审核状态-->
                  <el-button type="text" icon="el-icon-warning" v-if="hasRecallPaddingBtnPermission()"
                    @click="orderLogRecall(row.id)">撤回</el-button>
                  <el-button
                    type="text"
                    icon="el-icon-warning"
                    v-if="hasRecallPaddingBtnPermission()"
                    @click="orderLogRecall(row.id)"
                    >撤回</el-button
                  >
                  <!-- <el-button type="text" icon="el-icon-view" @click="handleViewDetail(row)">详情</el-button> -->
                </template>
                <!--已驳回-->
                <template v-if="row.status == 2">
                  <el-button type="text" icon="el-icon-warning" @click="rejectDetail(row.id)">驳回原因</el-button>
                  <el-button v-if="userInfo.user_id == row.create_user" type="text" icon="el-icon-view" @click="handleViewDetail(row)">编辑</el-button>
                  <el-button v-else type="text" icon="el-icon-view" @click="handleViewDetail(row)">详情</el-button>
                  <el-button type="text" icon="el-icon-warning" @click="rejectDetail(row.id)"
                    >驳回原因</el-button
                  >
                  <el-button
                    v-if="userInfo.user_id == row.create_user"
                    type="text"
                    icon="el-icon-view"
                    @click="handleViewDetail(row)"
                    >编辑</el-button
                  >
                  <el-button v-else type="text" icon="el-icon-view" @click="handleViewDetail(row)"
                    >详情</el-button
                  >
                </template>
                <!-- 已通过 -->
                <template v-if="row.status == 3">
                  <el-button type="text" icon="el-icon-view" @click="handleViewDetail(row)">详情</el-button>
                  <el-button type="text" icon="el-icon-view" @click="handleViewDetail(row)"
                    >详情</el-button
                  >
                </template>
                <!--草稿-->
                <template v-if="row.status == 0">
                  <el-button type="text" icon="el-icon-edit" @click="handleViewDetail(row)">编辑</el-button>
                  <el-button type="text" icon="el-icon-position" @click="userPublishPush(row.id)">发布</el-button>
                  <el-button type="text" icon="el-icon-delete" @click="deleteOrderLog(row.id)">删除</el-button>
                  <el-button type="text" icon="el-icon-edit" @click="handleViewDetail(row)"
                    >编辑</el-button
                  >
                  <el-button type="text" icon="el-icon-position" @click="userPublishPush(row.id)"
                    >发布</el-button
                  >
                  <el-button type="text" icon="el-icon-delete" @click="deleteOrderLog(row.id)"
                    >删除</el-button
                  >
                </template>
              </div>
            </template>
@@ -149,19 +261,39 @@
    </el-tabs>
    <!-- 新建工单对话框 -->
    <el-dialog v-model="dialogVisible" title="新建工单" width="70%" :close-on-click-modal="false" @close="resetForm">
    <el-dialog
      v-model="dialogVisible"
      title="新建工单"
      width="70%"
      :close-on-click-modal="false"
      @close="resetForm"
    >
      <el-form :model="form" :rules="rules" ref="testform" label-width="100px">
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="工单名称" prop="name">
              <el-input v-model="form.name" placeholder="请输入工单名称" maxlength="100" show-word-limit></el-input>
              <el-input
                v-model="form.name"
                placeholder="请输入工单名称"
                maxlength="100"
                show-word-limit
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="关联航线" prop="file_id">
              <el-select v-model="form.file_id" placeholder="请选择航线" filterable @change="getFlyingNestBy">
                <el-option v-for="item in wayLineList" :key="item.wayline_id" :label="item.name"
                  :value="item.wayline_id" />
              <el-select
                v-model="form.file_id"
                placeholder="请选择航线"
                filterable
                @change="getFlyingNestBy"
              >
                <el-option
                  v-for="item in wayLineList"
                  :key="item.wayline_id"
                  :label="item.name"
                  :value="item.wayline_id"
                />
              </el-select>
            </el-form-item>
          </el-col>
@@ -169,16 +301,30 @@
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="关联机巢" prop="device_sns">
              <el-select v-model="form.device_sns" placeholder="请选择机巢" multiple :disabled="!device_sns.length">
                <el-option v-for="item in device_sns" :key="item.device_sn" :label="item.nickname"
                  :value="item.device_sn" />
              <el-select
                v-model="form.device_sns"
                placeholder="请选择机巢"
                multiple
                :disabled="!device_sns.length"
              >
                <el-option
                  v-for="item in device_sns"
                  :key="item.device_sn"
                  :label="item.nickname"
                  :value="item.device_sn"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="关联算法" prop="ai_types">
              <el-select v-model="form.ai_types" placeholder="请选择关联算法" multiple>
                <el-option v-for="item in ai_types" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
                <el-option
                  v-for="item in ai_types"
                  :key="item.dictKey"
                  :label="item.dictValue"
                  :value="item.dictKey"
                />
              </el-select>
            </el-form-item>
          </el-col>
@@ -187,15 +333,27 @@
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="工单内容" prop="content">
              <el-input type="textarea" v-model="form.content" rows="4" placeholder="请输入工单内容" maxlength="255"
                show-word-limit></el-input>
              <el-input
                type="textarea"
                v-model="form.content"
                rows="4"
                placeholder="请输入工单内容"
                maxlength="255"
                show-word-limit
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="周期频次" prop="date_range">
              <el-date-picker v-model="form.date_range" type="daterange" range-separator="至" start-placeholder="开始日期"
                end-placeholder="结束日期" :disabled-date="disabledDate" />
              <el-date-picker
                v-model="form.date_range"
                type="daterange"
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                :disabled-date="disabledDate"
              />
            </el-form-item>
          </el-col>
          <el-col :span="4">
@@ -206,10 +364,15 @@
                </el-select>
              </div>
              <div class="flex-1">
                <el-time-picker style="width: 100px" v-model="form.deal_time" prop="deal_time" value-format="HH:mm"
                <el-time-picker
                  style="width: 100px"
                  v-model="form.deal_time"
                  prop="deal_time"
                  value-format="HH:mm"
                  :picker-options="{
                    selectableRange: '00:00 - 23:59',
                  }" />
                  }"
                />
              </div>
            </div>
          </el-col>
@@ -232,27 +395,42 @@
    </el-dialog>
    <!-- 工单详情对话框 -->
    <el-dialog align-center v-model="detailVisible" :title="detailTitle" width="70%" :close-on-click-modal="false"
      @close="resetForm">
    <el-dialog
      align-center
      v-model="detailVisible"
      :title="detailTitle"
      width="70%"
      :close-on-click-modal="false"
      @close="resetForm"
    >
      <div class="event-title-center">{{ form.name }}</div>
      <el-form :model="form" :rules="rules" ref="testform" label-width="100px">
        <div class="custom-steps-container">
          <!-- 标题行 -->
          <div class="steps-titles"  v-if="filters.status !== '0'">
            <div v-for="(record, index) in form.record_list" :class="{ active: record.user_id >= 0 }" :key="index"
              class="step-title">
          <div class="steps-titles" v-if="filters.status !== '0'">
            <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"  v-if="filters.status !== '0'">
          <el-steps
            :active="form.active"
            align-center
            class="custom-steps"
            v-if="filters.status !== '0'"
          >
            <el-step v-for="(record, index) in form.record_list" :key="index">
              <template #description>
                <span class="step-description" style="position: relative; display: inline-block">
                  {{ record.user_name }}
                </span>
                <span class="step-timer ">
                <span class="step-timer">
                  {{ record.interval_time_str }}
                </span>
                <div class="step-description">
@@ -266,14 +444,28 @@
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="工单名称" prop="name">
              <el-input v-model="form.name" placeholder="请输入工单名称" :disabled="detailTitle === '工单详情'"></el-input>
              <el-input
                v-model="form.name"
                placeholder="请输入工单名称"
                :disabled="detailTitle === '工单详情'"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="关联航线" prop="file_id">
              <el-select v-model="form.file_id" placeholder="请选择航线" @change="getFlyingNestBy" filterable :disabled="detailTitle === '工单详情'">
                <el-option v-for="item in wayLineList" :key="item.wayline_id" :label="item.name"
                  :value="item.wayline_id" />
              <el-select
                v-model="form.file_id"
                placeholder="请选择航线"
                @change="getFlyingNestBy"
                filterable
                :disabled="detailTitle === '工单详情'"
              >
                <el-option
                  v-for="item in wayLineList"
                  :key="item.wayline_id"
                  :label="item.name"
                  :value="item.wayline_id"
                />
              </el-select>
            </el-form-item>
          </el-col>
@@ -281,16 +473,35 @@
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="关联机巢" prop="device_sns">
              <el-select v-model="form.device_sns" placeholder="请选择机巢" multiple :disabled="detailTitle === '工单详情'">
                <el-option v-for="item in device_sns" :key="item.device_sn" :label="item.nickname"
                  :value="item.device_sn" />
              <el-select
                v-model="form.device_sns"
                placeholder="请选择机巢"
                multiple
                :disabled="detailTitle === '工单详情'"
              >
                <el-option
                  v-for="item in device_sns"
                  :key="item.device_sn"
                  :label="item.nickname"
                  :value="item.device_sn"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="关联算法" prop="ai_types">
              <el-select v-model="form.ai_types" placeholder="请选择关联算法" multiple  :disabled="detailTitle === '工单详情'">
                <el-option v-for="item in ai_types" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
              <el-select
                v-model="form.ai_types"
                placeholder="请选择关联算法"
                multiple
                :disabled="detailTitle === '工单详情'"
              >
                <el-option
                  v-for="item in ai_types"
                  :key="item.dictKey"
                  :label="item.dictValue"
                  :value="item.dictKey"
                />
              </el-select>
            </el-form-item>
          </el-col>
@@ -305,30 +516,54 @@
          <el-col :span="6">
            <el-form-item label="周期频次" prop="date_range">
              <el-date-picker v-model="form.date_range" type="daterange" range-separator="至" start-placeholder="开始日期"
                end-placeholder="结束日期" :disabled-date="disabledDate"   :disabled="detailTitle === '工单详情'" />
              <el-date-picker
                v-model="form.date_range"
                type="daterange"
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                :disabled-date="disabledDate"
                :disabled="detailTitle === '工单详情'"
              />
            </el-form-item>
          </el-col>
          <el-col :span="3">
            <el-select v-model="form.rep_fre_type" placeholder="请选择频次" :disabled="detailTitle === '工单详情'">
            <el-select
              v-model="form.rep_fre_type"
              placeholder="请选择频次"
              :disabled="detailTitle === '工单详情'"
            >
              <el-option v-for="item in cycles" :key="item" :label="item" :value="item" />
            </el-select>
          </el-col>
          <el-col :span="3">
            <el-time-picker style="width: 100px" v-model="form.deal_time" prop="deal_time" value-format="HH:mm"
            <el-time-picker
              style="width: 100px"
              v-model="form.deal_time"
              prop="deal_time"
              value-format="HH:mm"
              :picker-options="{
                selectableRange: '00:00 - 23:59',
              }"  :disabled="detailTitle === '工单详情'"/>
              }"
              :disabled="detailTitle === '工单详情'"
            />
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="工单内容" prop="content">
              <el-input type="textarea" v-model="form.content" rows="4" placeholder="请输入工单内容" maxlength="255"
                show-word-limit  :disabled="detailTitle === '工单详情'"></el-input>
              <el-input
                type="textarea"
                v-model="form.content"
                rows="4"
                placeholder="请输入工单内容"
                maxlength="255"
                show-word-limit
                :disabled="detailTitle === '工单详情'"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
@@ -341,43 +576,75 @@
        <el-row>
          <div class="add-box-btns">
            <el-button type="danger"
            <el-button
              type="danger"
              v-if="form.status == 0 || (form.status == 2 && userInfo.user_id == form.create_user)"
              @click="submitForm(1)">发布</el-button>
              <el-button type="primary" v-if="form.status == 0 || (form.status == 2 && userInfo.user_id == form.create_user)" @click="submitForm(0)">保存</el-button>
              @click="submitForm(1)"
              >发布</el-button
            >
            <el-button
              type="primary"
              v-if="form.status == 0 || (form.status == 2 && userInfo.user_id == form.create_user)"
              @click="submitForm(0)"
              >保存</el-button
            >
            <!-- <el-button type="primary" v-if="form.status == 0 || userInfo.user_id == form.create_user"
                            @click="submitForm(0)">保存</el-button> -->
            <el-button type="primary" v-if="form.status == 1 && hasPaddingBtnPermission()"
              @click="orderLogPass(form.id)">通过</el-button>
            <el-button type="danger" v-if="form.status == 1 && hasRejectionBtnPermission()"
              @click="orderLogReject(form.id)">驳回</el-button>
            <el-button
              type="primary"
              v-if="form.status == 1 && hasPaddingBtnPermission()"
              @click="orderLogPass(form.id)"
              >通过</el-button
            >
            <el-button
              type="danger"
              v-if="form.status == 1 && hasRejectionBtnPermission()"
              @click="orderLogReject(form.id)"
              >驳回</el-button
            >
          </div>
        </el-row>
      </el-form>
    </el-dialog>
    <!-- 工单详情 -->
    <el-dialog align-center v-model="detailVisibleCopy" title="工单详情" width="70%" :close-on-click-modal="false" @close="resetForm">
    <el-dialog
      align-center
      v-model="detailVisibleCopy"
      title="工单详情"
      width="70%"
      :close-on-click-modal="false"
      @close="resetForm"
    >
      <div class="event-title-center">{{ form.name }}</div>
      <el-form :model="form" ref="testform" label-width="100px">
        <div class="custom-steps-container">
          <!-- 标题行 -->
          <div class="steps-titles" v-if="filters.status !== '0'">
            <div v-for="(record, index) in form.record_list" :class="{ active: record.user_id >= 0 }" :key="index"
              class="step-title">
            <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" v-if="filters.status !== '0'">
          <el-steps
            :active="form.active"
            align-center
            class="custom-steps"
            v-if="filters.status !== '0'"
          >
            <el-step v-for="(record, index) in form.record_list" :key="index">
              <template #description>
                <span class="step-description" style="position: relative; display: inline-block">
                  {{ record.user_name }}
                </span>
                <span class="step-timer ">
                <span class="step-timer">
                  {{ record.interval_time_str }}
                </span>
                <div class="step-description">
@@ -391,14 +658,22 @@
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="工单名称" prop="name">
              <el-input v-model="form.name" placeholder="请输入工单名称" :disabled="true"></el-input>
              <el-input
                v-model="form.name"
                placeholder="请输入工单名称"
                :disabled="true"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="关联航线" prop="file_id">
              <el-select v-model="form.file_id" placeholder="请选择航线" :disabled="true">
                <el-option v-for="item in wayLineList" :key="item.wayline_id" :label="item.name"
                  :value="item.wayline_id" />
                <el-option
                  v-for="item in wayLineList"
                  :key="item.wayline_id"
                  :label="item.name"
                  :value="item.wayline_id"
                />
              </el-select>
            </el-form-item>
          </el-col>
@@ -407,16 +682,35 @@
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="关联机巢" prop="device_sns">
              <el-select v-model="form.device_sns" placeholder="请选择机巢" multiple :disabled="true">
                <el-option v-for="item in device_sns" :key="item.device_sn" :label="item.nickname"
                  :value="item.device_sn" />
              <el-select
                v-model="form.device_sns"
                placeholder="请选择机巢"
                multiple
                :disabled="true"
              >
                <el-option
                  v-for="item in device_sns"
                  :key="item.device_sn"
                  :label="item.nickname"
                  :value="item.device_sn"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="关联算法" prop="ai_types">
              <el-select v-model="form.ai_types" placeholder="请选择关联算法" multiple :disabled="true">
                <el-option v-for="item in ai_types" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
              <el-select
                v-model="form.ai_types"
                placeholder="请选择关联算法"
                multiple
                :disabled="true"
              >
                <el-option
                  v-for="item in ai_types"
                  :key="item.dictKey"
                  :label="item.dictValue"
                  :value="item.dictKey"
                />
              </el-select>
            </el-form-item>
          </el-col>
@@ -431,8 +725,14 @@
          <el-col :span="6">
            <el-form-item label="周期频次" prop="date_range">
              <el-date-picker v-model="form.date_range" type="daterange" range-separator="至" start-placeholder="开始日期"
                end-placeholder="结束日期" :disabled="true" />
              <el-date-picker
                v-model="form.date_range"
                type="daterange"
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                :disabled="true"
              />
            </el-form-item>
          </el-col>
          <el-col :span="3">
@@ -442,18 +742,32 @@
          </el-col>
          <el-col :span="3">
            <el-time-picker style="width: 100px" v-model="form.deal_time" prop="deal_time" :disabled="true"
              value-format="HH:mm" :picker-options="{
            <el-time-picker
              style="width: 100px"
              v-model="form.deal_time"
              prop="deal_time"
              :disabled="true"
              value-format="HH:mm"
              :picker-options="{
                selectableRange: '00:00 - 23:59',
              }" />
              }"
            />
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="工单内容" prop="content">
              <el-input type="textarea" v-model="form.content" rows="2" placeholder="请输入工单内容" maxlength="255"
                show-word-limit :readonly="true" :disabled="true"></el-input>
              <el-input
                type="textarea"
                v-model="form.content"
                rows="2"
                placeholder="请输入工单内容"
                maxlength="255"
                show-word-limit
                :readonly="true"
                :disabled="true"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
@@ -466,16 +780,27 @@
        <el-row>
          <div class="add-box-btns">
            <el-button type="danger"
            <el-button
              type="danger"
              v-if="form.status == 0 || (form.status == 2 && userInfo.user_id == form.create_user)"
              @click="submitForm(1)">发布</el-button>
              @click="submitForm(1)"
              >发布</el-button
            >
            <!-- <el-button type="primary" v-if="form.status == 0 || userInfo.user_id == form.create_user"
                            @click="submitForm(0)">保存</el-button> -->
            <el-button type="primary" v-if="form.status == 1 && hasPaddingBtnPermission()"
              @click="orderLogPass(form.id)">通过</el-button>
            <el-button type="danger" v-if="form.status == 1 && hasRejectionBtnPermission()"
              @click="orderLogReject(form.id)">驳回</el-button>
            <el-button
              type="primary"
              v-if="form.status == 1 && hasPaddingBtnPermission()"
              @click="orderLogPass(form.id)"
              >通过</el-button
            >
            <el-button
              type="danger"
              v-if="form.status == 1 && hasRejectionBtnPermission()"
              @click="orderLogReject(form.id)"
              >驳回</el-button
            >
            <el-button @click="detailVisibleCopy = false">取消</el-button>
          </div>
        </el-row>
@@ -485,7 +810,7 @@
</template>
<script>
import { calculateDefaultRange } from '@/utils/util'
import { calculateDefaultRange } from '@/utils/util';
import {
  getList,
  saveUpdateOrderLog,
@@ -497,21 +822,21 @@
  jobStatusNum,
  userPublish,
  deleteOrderLog,
} from '@/api/tickets/orderLog'
import { getTicketInfo } from '@/api/tickets/ticket'
import { getDictionaryByCode } from '@/api/system/dictbiz'
import { getWaylineFileListByArea } from '@/api/resource/wayline'
import { export_json_to_excel } from '@/utils/exportExcel'
import { getFlyingNestBy } from '@/api/device/device'
import { mapGetters } from 'vuex'
import NProgress from 'nprogress'
import { downloadXls } from '@/utils/util'
import 'nprogress/nprogress.css'
import { analyzeKmzFile, removeTextKey, XMLToJSON } from '@/utils/cesium/kmz'
} from '@/api/tickets/orderLog';
import { getTicketInfo } from '@/api/tickets/ticket';
import { getDictionaryByCode } from '@/api/system/dictbiz';
import { getWaylineFileListByArea } from '@/api/resource/wayline';
import { export_json_to_excel } from '@/utils/exportExcel';
import { getFlyingNestBy } from '@/api/device/device';
import { mapGetters } from 'vuex';
import NProgress from 'nprogress';
import { downloadXls } from '@/utils/util';
import 'nprogress/nprogress.css';
import { analyzeKmzFile, removeTextKey, XMLToJSON } from '@/utils/cesium/kmz';
import dayjs from 'dayjs';
import 'dayjs/locale/zh-cn'; // 导入中文语言包
import weekday from 'dayjs/plugin/weekday';
import elTooltipCopy from '@/components/ElTooltipCopy.vue'
import elTooltipCopy from '@/components/ElTooltipCopy.vue';
dayjs.extend(weekday);
dayjs.locale('zh-cn');
@@ -519,7 +844,7 @@
export default {
  components: { elTooltipCopy },
  name: 'TicketPage',
  data () {
  data() {
    return {
      activeTab: 'all',
@@ -587,47 +912,81 @@
        column: [
          {
            label: '工单编号', prop: 'job_info_num', width: 150,
            label: '工单编号',
            prop: 'job_info_num',
            width: 150,
          },
          {
            label: '工单名称', prop: 'name', width: 100, ellipsis: true, overHidden: true,
            label: '工单名称',
            prop: 'name',
            width: 100,
            ellipsis: true,
            overHidden: true,
            showOverflowTooltip: true,
          },
          {
            label: '工单状态', prop: 'status', width: 88,
            label: '工单状态',
            prop: 'status',
            width: 88,
            showOverflowTooltip: true,
          },
          {
            label: '所属单位', prop: 'dept_name', ellipsis: true,
            label: '所属单位',
            prop: 'dept_name',
            ellipsis: true,
            showOverflowTooltip: true,
          },
          {
            label: '创建时间', prop: 'create_time', width: 144, ellipsis: true,
            label: '创建时间',
            prop: 'create_time',
            width: 144,
            ellipsis: true,
            showOverflowTooltip: true,
          },
          {
            label: '已执行次数', prop: 'job_num', width: 70, ellipsis: true,
            label: '已执行次数',
            prop: 'job_num',
            width: 70,
            ellipsis: true,
            showOverflowTooltip: true,
          },
          {
            label: '工单内容', prop: 'content', ellipsis: true, overHidden: true,
            label: '工单内容',
            prop: 'content',
            ellipsis: true,
            overHidden: true,
            showOverflowTooltip: true,
          },
          {
            label: '关联航线', prop: 'wayline_name', ellipsis: true, overHidden: true,
            label: '关联航线',
            prop: 'wayline_name',
            ellipsis: true,
            overHidden: true,
            showOverflowTooltip: true,
          },
          {
            label: '关联算法', prop: 'ai_type_str', width: 100, ellipsis: true, overHidden: true,
            label: '关联算法',
            prop: 'ai_type_str',
            width: 100,
            ellipsis: true,
            overHidden: true,
            showOverflowTooltip: true,
          },
          {
            label: '关联机巢', prop: 'device_names', width: 100, ellipsis: true, overHidden: true,
            label: '关联机巢',
            prop: 'device_names',
            width: 100,
            ellipsis: true,
            overHidden: true,
            showOverflowTooltip: true,
          },
          {
            label: '创建人', prop: 'creator_name', width: 96, ellipsis: true, overHidden: true,
            label: '创建人',
            prop: 'creator_name',
            width: 96,
            ellipsis: true,
            overHidden: true,
            showOverflowTooltip: true,
          },
          // {
@@ -677,55 +1036,54 @@
      // 配置时间选择器默认配置
      datePickerDefaultVal: calculateDefaultRange(),
    }
    };
  },
  async created () {
    var response = await getDictionaryByCode('SF')
    var word_order_typeResponse = await getDictionaryByCode('WORK_ORDER_TYPE')
    this.ai_types = response.data.data['SF']
    this.types = word_order_typeResponse.data.data['WORK_ORDER_TYPE']
  async created() {
    var response = await getDictionaryByCode('SF');
    var word_order_typeResponse = await getDictionaryByCode('WORK_ORDER_TYPE');
    this.ai_types = response.data.data['SF'];
    this.types = word_order_typeResponse.data.data['WORK_ORDER_TYPE'];
    //获取航线
    this.asyncgetWaylineFileListByArea()
    const response2 = await getTicketInfo()
    const { dept_data, event_type, ai_type } = response2.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()
    const id = this.$route.query.id
    console.log('idddddd',id);
  mounted() {
    this.fetchTableData();
    const id = this.$route.query.id;
    console.log('idddddd', id);
    if (id) {
      // 确保 id 存在
      this.handleViewDetail({ id })
      const find = this.$store.state.tags.bsTagList.find(i => i.path === '/tickets/orderLog')
        find && (find.query = {})
      this.handleViewDetail({ id });
      const find = this.$store.state.tags.bsTagList.find(i => i.path === '/tickets/orderLog');
      find && (find.query = {});
    } else {
      console.error('工单ID不存在!')
      console.error('工单ID不存在!');
    }
  },
  computed: {
    ...mapGetters(['userInfo', 'permission']),
    filteredTabs () {
    filteredTabs() {
      // rejection_and_draft 权限控制“已驳回”和“草稿”tab
      // console.log(this.permission, '权限信息')
      // console.log(this.userInfo, '权限信息22')
      const canShowRejectAndDraft = this.permission?.rejection_and_draft === true
      const canShowRejectAndDraft = this.permission?.rejection_and_draft === true;
      return this.tabs
        .map(tab => {
          if (tab.name === 'DRAFT') {
            return { ...tab, isShow: canShowRejectAndDraft }
            return { ...tab, isShow: canShowRejectAndDraft };
          }
          if (tab.name === 'REJECTED') {
            return { ...tab, isShow: canShowRejectAndDraft }
            return { ...tab, isShow: canShowRejectAndDraft };
          }
          return { ...tab, isShow: true }
          return { ...tab, isShow: true };
        })
        .filter(tab => tab.isShow)
        .filter(tab => tab.isShow);
    },
  },
@@ -733,98 +1091,98 @@
    handleCellClick(row, column) {
      if (column.no === 1) {
        navigator.clipboard.writeText(row.job_info_num).then(() => {
          this.$message.success('复制工单编号成功')
        })
          this.$message.success('复制工单编号成功');
        });
      } else if (column.no === 2) {
        navigator.clipboard.writeText(row.name).then(() => {
          this.$message.success('复制工单名称成功')
        })
          this.$message.success('复制工单名称成功');
        });
      } else if (column.no === 4) {
        navigator.clipboard.writeText(row.dept_name).then(() => {
          this.$message.success('复制所属单位成功')
        })
          this.$message.success('复制所属单位成功');
        });
      } else if (column.no === 8) {
        navigator.clipboard.writeText(row.wayline_name).then(() => {
          this.$message.success('复制关联航线成功')
        })
          this.$message.success('复制关联航线成功');
        });
      } else if (column.no === 9) {
        navigator.clipboard.writeText(row.ai_type_str).then(() => {
          this.$message.success('复制关联算法成功')
        })
          this.$message.success('复制关联算法成功');
        });
      }
    },
    disabledDate (time) {
      return time.getTime() < Date.now() - 8.64e7 // 86400000 = 24 * 60 * 60 * 1000
    disabledDate(time) {
      return time.getTime() < Date.now() - 8.64e7; // 86400000 = 24 * 60 * 60 * 1000
    },
    searchChange (params, done) {
    searchChange(params, done) {
      // console.log('searchChange')
      this.query = params
      this.parentId = ''
      this.page.currentPage = 1
      this.onLoad(this.page, params)
      done()
      this.query = params;
      this.parentId = '';
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
      done();
    },
    async onLoad (page, params = {}) {
      this.loading = true
    async onLoad(page, params = {}) {
      this.loading = true;
      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()
      })
        this.tableData = res.data.data;
        this.loading = false;
        this.selectionClear();
      });
    },
    selectionClear () {
      this.selectionList = []
      this.$refs.crud.toggleSelection()
    selectionClear() {
      this.selectionList = [];
      this.$refs.crud.toggleSelection();
    },
    async loadAMapScripts () {
    async loadAMapScripts() {
      try {
        // await loadAMap();
        // await loadAMapUI();
        this.mapLoaded = true
        this.mapLoaded = true;
      } catch (error) {
        console.error('Failed to load AMap scripts:', error)
        this.$message.error('地图加载失败,请检查网络或API Key配置')
        console.error('Failed to load AMap scripts:', error);
        this.$message.error('地图加载失败,请检查网络或API Key配置');
      }
    },
    formatCycleTime (row) {
      return `${row.cycle_time_value}`
    formatCycleTime(row) {
      return `${row.cycle_time_value}`;
    },
    async fetchTableData () {
      this.loading = true
    async fetchTableData() {
      this.loading = true;
      try {
        let params = this.getQueryParam()
        let params = this.getQueryParam();
        // console.log('发送的参数:', params)
        const response = await getList(params, this.page.currentPage, this.page.pageSize)
        const response = await getList(params, this.page.currentPage, this.page.pageSize);
        if (!response?.data?.data?.records) {
          throw new Error('接口返回数据格式不正确')
          throw new Error('接口返回数据格式不正确');
        }
        const { total, records } = response.data.data
        const { total, records } = response.data.data;
        this.tableData = records.map(item => {
          return item
        })
          return item;
        });
        // console.log('权限检查:', this.permission)
        this.page.total = total || 0
        this.updateGlobalCounts()
        this.page.total = total || 0;
        this.updateGlobalCounts();
      } catch (error) {
        // console.error('获取数据失败:', error)
        this.$message.error(error.message || '获取数据失败')
        this.tableData = []
        this.page.total = 0
        this.$message.error(error.message || '获取数据失败');
        this.tableData = [];
        this.page.total = 0;
      } finally {
        this.loading = false
        this.loading = false;
      }
    },
    getQueryParam () {
      const currentTab = this.tabs.find(tab => tab.name === this.activeTab)
    getQueryParam() {
      const currentTab = this.tabs.find(tab => tab.name === this.activeTab);
      if (this.filters.dateRange) {
        // console.log(
        //   'this.formatDate(this.filters.dateRange[0])',
@@ -859,29 +1217,29 @@
        deal_time: this.filters.deal_time || undefined,
        current: this.page.currentPage,
        size: this.page.pageSize,
      }
      return params
      };
      return params;
    },
    sizeChange (pageSize) {
      this.page.pageSize = pageSize
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
    },
    async submitForm (status) {
    async submitForm(status) {
      this.$refs.testform.validate(async valid => {
        if (valid) {
          let dateRange = this.form.date_range
          let dateRange = this.form.date_range;
          // console.log('dateRange' + dateRange)
          this.form.begin_time = this.formatDate(dateRange[0])
          this.form.end_time = this.formatDate(dateRange[1])
          this.form.begin_time = this.formatDate(dateRange[0]);
          this.form.end_time = this.formatDate(dateRange[1]);
          // 如果选中日期包含当前天,那么选中的时间点不能小于当前时间
          if (this.form.deal_time) {
            const selectedDate = dayjs(this.form.date_range[0]).format('YYYY-MM-DD')
            const selectedTime = dayjs(selectedDate + ' ' + this.form.deal_time).toDate()
            const now = new Date()
            const selectedDate = dayjs(this.form.date_range[0]).format('YYYY-MM-DD');
            const selectedTime = dayjs(selectedDate + ' ' + this.form.deal_time).toDate();
            const now = new Date();
            if (selectedDate === dayjs().format('YYYY-MM-DD') && selectedTime < now) {
              return this.$message.warning('任务时间不能小于当前时间')
              return this.$message.warning('任务时间不能小于当前时间');
            }
          }
@@ -889,7 +1247,7 @@
            ...this.form,
            status: status,
            ai_types: this.form.ai_types?.length ? this.form.ai_types : [],
          }
          };
          // 判断该值this.form.date_range[0] 周几 和rep_fre_type 是不是相等
          // if (this.form.deal_time) {
          //    const weekday = dayjs(this.form.date_range[0]).format('dddd');
@@ -911,23 +1269,23 @@
          //   }
          // }
          await saveUpdateOrderLog(submitData)
          let id = this.form.id
          await saveUpdateOrderLog(submitData);
          let id = this.form.id;
          if (id) {
            this.$message.success('工单发布成功')
            this.$message.success('工单发布成功');
          } else {
            this.$message.success('工单创建成功')
            this.$message.success('工单创建成功');
          }
          this.dialogVisible = false
          this.dialogVisible = false;
          this.detailVisible = false;
          (this.device_sns = []), (this.wayLineList = []), this.fetchTableData()
          (this.device_sns = []), (this.wayLineList = []), this.fetchTableData();
        }
      })
      });
    },
    //驳回原因显示
    async rejectDetail (id) {
      const response = await orderLogDetails(id)
      let data = response.data.data
    async rejectDetail(id) {
      const response = await orderLogDetails(id);
      let data = response.data.data;
      this.$confirm(data.remark, '驳回原因', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
@@ -935,103 +1293,110 @@
      }).then(() => {
        this.form = {
          ...response.data.data,
        }
        };
        // this.detailVisible = true
        this.handleViewDetail(data)
      })
        this.handleViewDetail(data);
      });
    },
    formatDate (date) {
      if (!date) return undefined
      const d = new Date(date)
    formatDate(date) {
      if (!date) return undefined;
      const d = new Date(date);
      return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(
        d.getDate()
      ).padStart(2, '0')} 00:00:00`
      ).padStart(2, '0')} 00:00:00`;
    },
    mapStatus (status) {
    mapStatus(status) {
      const statusTextMap = {
        0: '草稿',
        1: '待审核',
        2: '已驳回',
        3: '已通过',
      }
      return statusTextMap[status] || '未知状态'
      };
      return statusTextMap[status] || '未知状态';
    },
    getStatusTagType (status) {
    getStatusTagType(status) {
      const statusMap = {
        1: 'warning',
        2: 'info',
        3: 'primary',
        4: 'success',
        5: 'danger',
      }
      return statusMap[status] || 'info'
      };
      return statusMap[status] || 'info';
    },
    handleTabChange (tab) {
      this.activeTab = tab.props?.name || tab.name
      this.filters.status = ''
    handleTabChange(tab) {
      this.activeTab = tab.props?.name || tab.name;
      this.filters.status = '';
      if (tab.props?.name === 'WAIT_AUDIT') {
        this.filters.status = '1'
        this.filters.status = '1';
      } else if (tab.props?.name === 'REJECTED') {
        this.filters.status = '2'
        this.filters.status = '2';
      } else if (tab.props?.name === 'PASS') {
        this.filters.status = '3'
        this.filters.status = '3';
      } else if (tab.props?.name === 'DRAFT') {
        this.filters.status = '0'
        this.filters.status = '0';
      }
      this.page.currentPage = 1
      this.fetchTableData()
      this.page.currentPage = 1;
      this.fetchTableData();
    },
    handleSearch () {
      this.page.currentPage = 1
      this.fetchTableData()
    handleSearch() {
      this.page.currentPage = 1;
      this.fetchTableData();
    },
    handleReset () {
    handleReset() {
      this.filters = {
        keyword: '',
        department: '',
        type: '',
        dateRange: [],
        status: '',
      }
      this.page.currentPage = 1
      this.fetchTableData()
      };
      this.page.currentPage = 1;
      this.fetchTableData();
    },
    currentChange (currentPage) {
      this.page.currentPage = currentPage
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
    },
    async updateGlobalCounts () {
    async updateGlobalCounts() {
      const counts = {
        all: 0,
        DRAFT: 0,
        WAIT_AUDIT: 0,
        REJECTED: 0,
        PASS: 0,
      }
      var reponse = await jobStatusNum()
      };
      var reponse = await jobStatusNum();
      // console.log('统计' + reponse.data.data)
      reponse.data.data.forEach(item => {
        const tab = this.tabs.find(t => t.name === item.dict_key)
        const tab = this.tabs.find(t => t.name === item.dict_key);
        if (tab) {
          tab.count = item.num
          tab.count = item.num;
        }
      })
      });
    },
    handleAdd () {
      this.form = {}
      this.dialogVisible = true
    handleAdd() {
      this.form = {};
      this.dialogVisible = true;
      this.$nextTick(() => {
        if (this.$refs.MapContainer && this.$refs.MapContainer.initAddEntity) {
          this.$refs.MapContainer.initAddEntity('initPosition');
        }
      });
      //航线列表
      this.asyncgetWaylineFileListByArea()
      this.asyncgetWaylineFileListByArea();
    },
    resetForm () {
    resetForm() {
      this.form = {
        name: '',
        type: '',
@@ -1041,250 +1406,253 @@
        address: '',
        content: '',
        photos: [],
      }
      };
      if (this.$refs.testform) {
        this.$refs.testform.resetFields()
        this.$refs.testform.resetFields();
      }
    },
    formatLocation (location) {
    formatLocation(location) {
      if (!Array.isArray(location)) {
        return '未知位置'
        return '未知位置';
      }
      return `${location[0].toFixed(6)}, ${location[1].toFixed(6)}`
      return `${location[0].toFixed(6)}, ${location[1].toFixed(6)}`;
    },
    async handleViewDetail (row) {
      const response = await orderLogDetails(row.id)
      const data = response.data.data
    async handleViewDetail(row) {
      const response = await orderLogDetails(row.id);
      const data = response.data.data;
      this.form = {
        ...data,
      }
      };
      // 更新机巢列表
      this.device_sns = data.device_list
      this.device_sns = data.device_list;
      this.permission &&
        (this.permission.order_log_review || this.permission.order_log_recall) &&
        (data.status == 1 || data.status == 3 || (data.status == 2 && this.userInfo.user_id !== this.form.create_user))
      (this.permission.order_log_review || this.permission.order_log_recall) &&
      (data.status == 1 ||
        data.status == 3 ||
        (data.status == 2 && this.userInfo.user_id !== this.form.create_user))
        ? (this.detailTitle = '工单详情')
        : (this.detailTitle = '编辑工单')
        : (this.detailTitle = '编辑工单');
      this.detailVisible = true
      this.detailVisible = true;
      // 更新航线列表,追加 wayline_file_region_vo 数据
      if (data.wayline_file_region_vo) {
        const newWayline = data.wayline_file_region_vo
        const newWayline = data.wayline_file_region_vo;
        // 检查是否已经存在于 this.wayLineList 中
        const isDuplicate = this.wayLineList.some(
          (item) => item.wayline_id === newWayline.wayline_id
        )
          item => item.wayline_id === newWayline.wayline_id
        );
        if (!isDuplicate) {
          this.wayLineList.push(newWayline)
          this.wayLineList.push(newWayline);
        }
      }
      this.initMapLine(data.device_map_infos)
            const find = this.$store.state.tags.bsTagList.find(i => i.path === '/tickets/orderLog')
        find && (find.query = {})
      this.initMapLine(data.device_map_infos);
      const find = this.$store.state.tags.bsTagList.find(i => i.path === '/tickets/orderLog');
      find && (find.query = {});
    },
    async handleCheckDetail (row) {
      const response = await orderLogDetails(row.id)
      const data = response.data.data
    async handleCheckDetail(row) {
      const response = await orderLogDetails(row.id);
      const data = response.data.data;
      this.form = {
        ...data,
      }
      };
      // 更新航线列表,追加 wayline_file_region_vo 数据
      // 更新航线列表,追加 wayline_file_region_vo 数据
      if (data.wayline_file_region_vo) {
        const newWayline = data.wayline_file_region_vo
        const newWayline = data.wayline_file_region_vo;
        // 检查是否已经存在于 this.wayLineList 中
        const isDuplicate = this.wayLineList.some(
          (item) => item.wayline_id === newWayline.wayline_id
        )
          item => item.wayline_id === newWayline.wayline_id
        );
        if (!isDuplicate) {
          this.wayLineList.push(newWayline)
          this.wayLineList.push(newWayline);
        }
      }
      // 更新机巢列表
      this.device_sns = data.device_list
      this.detailVisibleCopy = true
      this.initMapLine(data.device_map_infos)
      this.device_sns = data.device_list;
      this.detailVisibleCopy = true;
      this.initMapLine(data.device_map_infos);
    },
    //导出
    async exportData () {
    async exportData() {
      this.$confirm('是否智飞工单数据?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        NProgress.start()
        let params = this.getQueryParam()
        NProgress.start();
        let params = this.getQueryParam();
        orderLogExport(params).then(res => {
          downloadXls(res.data, `智飞工单${this.$dayjs().format('YYYY-MM-DD')}.xlsx`)
          NProgress.done()
        })
      })
          downloadXls(res.data, `智飞工单${this.$dayjs().format('YYYY-MM-DD')}.xlsx`);
          NProgress.done();
        });
      });
    },
    hasAddBtnPermission () {
    hasAddBtnPermission() {
      // undefined 或 false 都返回 false,只有 true 返回 true
      // console.log('this.permission.order_log_add :', this.permission.order_log_add)
      return this.permission && this.permission.order_log_add === true
      return this.permission && this.permission.order_log_add === true;
    },
    hasPaddingBtnPermission () {
    hasPaddingBtnPermission() {
      // undefined 或 false 都返回 false,只有 true 返回 true
      // console.log('权限检查:', this.permission)
      return this.permission && this.permission.order_log_review === true
      return this.permission && this.permission.order_log_review === true;
    },
    hasRecallPaddingBtnPermission () {
    hasRecallPaddingBtnPermission() {
      // undefined 或 false 都返回 false,只有 true 返回 true
      // console.log('权限检查:', this.permission)
      // 智飞工单撤回
      return this.permission && this.permission.order_log_recall === true
      return this.permission && this.permission.order_log_recall === true;
    },
    //驳回按钮权限
    hasRejectionBtnPermission () {
    hasRejectionBtnPermission() {
      // undefined 或 false 都返回 false,只有 true 返回 true
      // console.log('权限检查:', this.permission)
      return this.permission && this.permission.rejection_btn === true
      return this.permission && this.permission.rejection_btn === true;
    },
    //自己点发布
    userPublishPush (id) {
    userPublishPush(id) {
      this.$confirm('确定发布吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        let response = userPublish(id)
        this.$message.success('发布成功')
        this.fetchTableData()
      })
        let response = userPublish(id);
        this.$message.success('发布成功');
        this.fetchTableData();
      });
    },
    //删除
    deleteOrderLog (id) {
    deleteOrderLog(id) {
      this.$confirm('确定删除吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        let response = deleteOrderLog(id)
        this.$message.success('删除')
        this.fetchTableData()
      })
        let response = deleteOrderLog(id);
        this.$message.success('删除');
        this.fetchTableData();
      });
    },
    refreshChange () {
      this.fetchTableData()
    refreshChange() {
      this.fetchTableData();
    },
    //获取航线列表
    async asyncgetWaylineFileListByArea (name) {
      var wayLineListResponse = await getWaylineFileListByArea(this.userInfo.detail.areaCode)
      this.wayLineList = wayLineListResponse.data.data
    async asyncgetWaylineFileListByArea(name) {
      var wayLineListResponse = await getWaylineFileListByArea(this.userInfo.detail.areaCode);
      this.wayLineList = wayLineListResponse.data.data;
      this.initMapLine()
      this.initMapLine();
    },
    initMapLine (infos = {}, cb = () => { }) {
      let currentLine = this.wayLineList.find(item => item.wayline_id == this.form.file_id)
    initMapLine(infos = {}, cb = () => {}) {
      let currentLine = this.wayLineList.find(item => item.wayline_id == this.form.file_id);
      if (!currentLine) return
      if (!currentLine) return;
      this.$nextTick(() => {
        if (this.$refs.MapContainer && this.$refs.MapContainer.initAddEntity) {
          this.$refs.MapContainer.initAddEntity('polyline', {
            url: `${import.meta.env.VITE_APP_AIRLINE_URL + currentLine.object_key}?_t=${new Date().getTime()}`,
            url: `${
              import.meta.env.VITE_APP_AIRLINE_URL + currentLine.object_key
            }?_t=${new Date().getTime()}`,
            type: currentLine.wayline_type,
            cb,
            infos
          })
            infos,
          });
        }
      })
      });
    },
    //可飞行机巢列表
    async getFlyingNestBy (waylineId) {
      const that = this
    async getFlyingNestBy(waylineId) {
      const that = this;
       // 先清空
      that.form.device_sns = []
      that.device_sns = []
      // 先清空
      that.form.device_sns = [];
      that.device_sns = [];
      this.initMapLine({}, async (polygon) => {
        const currentLine = that.wayLineList.find(item => item.wayline_id === waylineId)
      this.initMapLine({}, async polygon => {
        const currentLine = that.wayLineList.find(item => item.wayline_id === waylineId);
        //按照航线来
        const params = {
          type: [2, 4, 5].includes(currentLine.wayline_type) ? 2 : 0,
          wayline_id: waylineId,
          polygon
        }
        var wayLineListResponse = await getFlyingNestBy(params)
          polygon,
        };
        var wayLineListResponse = await getFlyingNestBy(params);
        // 再赋值
        that.device_sns = wayLineListResponse.data.data
      })
        that.device_sns = wayLineListResponse.data.data;
      });
    },
    //撤回
    async orderLogRecall (id) {
    async orderLogRecall(id) {
      this.$confirm('确定撤回则到草稿箱。', '是否撤回?', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(async () => {
        let reposne = await orderLogRecall(id)
        this.handleSearch()
      })
        let reposne = await orderLogRecall(id);
        this.handleSearch();
      });
    },
    onLoad () {
      this.fetchTableData()
    onLoad() {
      this.fetchTableData();
    },
    /**
     * 通过
     */
    async orderLogPass (id) {
      let response = await orderLogPass(id)
      let data = response.data.data
      this.$message.success('审核通过')
      this.detailVisibleCopy = false
    async orderLogPass(id) {
      let response = await orderLogPass(id);
      let data = response.data.data;
      this.$message.success('审核通过');
      this.detailVisibleCopy = false;
      this.detailVisible = false
      this.detailVisible = false;
      this.page.currentPage = 1
      this.onLoad(this.page, this.query)
      this.page.currentPage = 1;
      this.onLoad(this.page, this.query);
      // this.handleViewDetail()
    },
    /**
     * 驳回
     */
    async orderLogReject (id) {
    async orderLogReject(id) {
      this.$prompt('', '驳回原因', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
      }).then(async ({ value }) => {
        let response = await orderLogReject(id, value)
        let data = response.data.data
        this.$message.success('驳回成功')
        this.detailVisibleCopy = false
        let response = await orderLogReject(id, value);
        let data = response.data.data;
        this.$message.success('驳回成功');
        this.detailVisibleCopy = false;
        // this.detailVisible = false
        this.page.currentPage = 1
        this.onLoad(this.page, this.query)
      })
        this.page.currentPage = 1;
        this.onLoad(this.page, this.query);
      });
    },
  },
  watch: {
    tableData: {
      handler () {
      handler() {
        // this.updateTabCounts()
      },
      deep: true,
    },
  },
}
};
</script>
<style lang="scss" scoped>
@@ -1328,7 +1696,7 @@
    &-item {
      flex: 1;
      &> ::v-deep(.el-date-editor) {
      & > ::v-deep(.el-date-editor) {
        width: 100%;
        box-sizing: border-box;
      }
@@ -1471,11 +1839,10 @@
    justify-content: center;
    flex-wrap: wrap;
    &> ::v-deep(.el-button) {
    & > ::v-deep(.el-button) {
      flex: 1;
      margin-left: 0;
      margin-right: 10px;
    }
  }
}
@@ -1493,7 +1860,7 @@
.flex-1 {
  flex: 1;
  &> ::v-deep(div) {
  & > ::v-deep(div) {
    width: 100% !important;
  }
}