无人机管理后台前端(已迁走)
张含笑
2025-07-17 a6e47023383faf316c2f7437b247dbdec46f7a94
Merge branch 'refs/heads/master' into feature/v3.0.0/个人工作台

# Conflicts:
# src/views/tickets/ticket.vue
15 files modified
1 files added
1600 ■■■■ changed files
.env.test 42 ●●●●● patch | view | raw | blame | history
package.json 2 ●●● patch | view | raw | blame | history
src/api/device/device.js 81 ●●●● patch | view | raw | blame | history
src/axios.js 393 ●●●● patch | view | raw | blame | history
src/buildConfig/buildConfig/config.jiangwu.js 6 ●●●●● patch | view | raw | blame | history
src/page/index/logo.vue 11 ●●●●● patch | view | raw | blame | history
src/page/index/top/index.vue 6 ●●●●● patch | view | raw | blame | history
src/permission.js 14 ●●●● patch | view | raw | blame | history
src/styles/element-ui.scss 23 ●●●●● patch | view | raw | blame | history
src/views/device/airport.vue 776 ●●●● patch | view | raw | blame | history
src/views/job/components/SearchBox.vue 33 ●●●●● patch | view | raw | blame | history
src/views/job/components/TaskAlgorithmBusiness.vue 32 ●●●●● patch | view | raw | blame | history
src/views/job/components/TaskIntermediateContent/TaskIntermediateContent.vue 2 ●●● patch | view | raw | blame | history
src/views/job/components/TaskTop/TaskTotal.vue 8 ●●●●● patch | view | raw | blame | history
src/views/tickets/orderLog.vue 6 ●●●● patch | view | raw | blame | history
src/views/tickets/ticket.vue 165 ●●●●● patch | view | raw | blame | history
.env.test
New file
@@ -0,0 +1,42 @@
NODE_ENV = 'test'
#开发环境配置
VITE_APP_ENV = 'test'
#接口地址
VITE_APP_API=/api
#页面基础路径
VITE_APP_BASE=/manage
# 服务地址
VITE_APP_URL = https://wrj.shuixiongit.com/api
#VITE_APP_URL= http://192.168.1.168 rjg
#VITE_APP_URL= http://192.168.1.33
#新大屏地址
VITE_APP_DASHBOARD_URL = 'https://wrj.shuixiongit.com/command-center-dashboard/'
# 域名
VITE_APP_AREA_NAME = https://wrj.shuixiongit.com
# ws地址
VITE_APP_WS_API_URL = wss://wrj.shuixiongit.com
# 航线文件地址
VITE_APP_AIRLINE_URL = https://wrj.shuixiongit.com/minio/cloud-bucket
# 图片存放地址
VITE_APP_TERRAIN_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket/ztzf_terrain/all_terrain
# 算法仓库图片地址
VITE_APP_PICTURE_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket
# 是否在打包时开启压缩,支持 gzip 和 brotli
VITE_BUILD_COMPRESS = gzip
#页面基础路径
# VITE_APP_BASE_COMMAND = /drone-web-manage/
#天地图token 浏览器端口
VITE_APP_TDT_TOKEN = e110584a27d506da2740edca951683f4
VITE_APP_CESIUM_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJkYTZlNGNlYS01NTU1LTQ1MGEtYmNlZS0yNTE2NDk5YWM2MjEiLCJpZCI6MTc5Njk2LCJpYXQiOjE3MDA1NDcwMjV9.qcl4AH2731cfFd0-I1ZLUINPXqvglLkDFD-UGR2zU5M
package.json
@@ -5,7 +5,7 @@
        "dev": "vite --host",
        "base": "vite --host --mode localhost",
        "prod": "vite --mode production",
        "build:test": "vite build --mode development",
        "build:test": "vite build --mode test",
        "build:prod": "vite build --mode production",
        "build:jiangwu": "vite build --mode jiangwu",
        "serve": "vite preview --host"
src/api/device/device.js
@@ -1,4 +1,4 @@
import request from '@/axios';
import request from '@/axios'
export const getList = (current, size, params) => {
  return request({
@@ -9,8 +9,8 @@
      current,
      size,
    },
  });
};
  })
}
export const remove = ids => {
  return request({
@@ -19,32 +19,32 @@
    params: {
      ids,
    },
  });
};
  })
}
export const add = row => {
  return request({
    url: '/drone-device-core/manage/api/v1/devices/add',
    method: 'post',
    data: row,
  });
};
  })
}
export const update = row => {
  return request({
    url: '/drone-device-core/manage/api/v1/devices/update',
    method: 'post',
    data: row,
  });
};
  })
}
export const operatePasswordUpdate = row => {
  return request({
    url: '/drone-device-core/manage/api/v1/devices/operatePasswordUpdate',
    method: 'post',
    data: row,
  });
};
  })
}
export const getDetail = id => {
  return request({
@@ -53,8 +53,8 @@
    params: {
      id,
    },
  });
};
  })
}
export const getOperatePassword = id => {
  return request({
@@ -63,24 +63,24 @@
    params: {
      id,
    },
  });
};
  })
}
export const getDeviceUpgradeInfo = (params) => {
  return request({
    url: '/drone-device-core/manage/api/v1/workspaces/firmware-release-notes/latest',
    method: 'get',
    params: params
  });
};
  })
}
export const ota = (workspace_id,row) => {
export const ota = (workspace_id, row) => {
  return request({
    url: `/drone-device-core/manage/api/v1/devices/${workspace_id}/devices/ota`,
    method: 'post',
    data: row,
  });
};
  })
}
export const getDeviceFirmwareList = (current, size, params) => {
  return request({
@@ -91,25 +91,25 @@
      current,
      size,
    },
  });
};
  })
}
export const upload = (workspace_id,formDatas) => {
export const upload = (workspace_id, formDatas) => {
  return request({
    url: `/drone-device-core/manage/api/v1/workspaces/${workspace_id}/firmwares/file/upload`,
    method: 'post',
    data: formDatas,
    headers: { "Content-Type": "multipart/form-data" },
  });
};
  })
}
export const updateFirmware = (row) => {
  return request({
    url: `/drone-device-core/manage/api/v1/workspaces/firmwares/update`,
    method: 'post',
    data: row,
  });
};
  })
}
export const deleteFirmware = ids => {
  return request({
@@ -118,29 +118,36 @@
    params: {
      ids
    }
  });
};
  })
}
export const getDevices = (workspace_id,device_sn) => {
export const getDevices = (workspace_id, device_sn) => {
  return request({
    url: `/drone-device-core/manage/api/v1/devices/${workspace_id}/devices/${device_sn}`,
    method: 'get',
  });
};
  })
}
export const getAirportList = () => {
  return request({
    url: '/drone-device-core/manage/api/v1/devices/getAirportList',
    method: 'get',
  });
};
  })
}
//可飞行机巢列表
export const getFlyingNestBy = (param) => {
  return request({
    url: '/drone-device-core/manage/api/v1/devices/getFlyingNestBy',
    method: 'post',
    data:param
  });
};
    data: param
  })
}
// 设备下线
export const deviceOffline = (dockSn) => {
  return request({
    url: `/drone-device-core/manage/api/v1/devices/deviceOffline?dockSn=${dockSn}`,
    method: 'get',
  })
}
src/axios.js
@@ -9,32 +9,17 @@
import axios from 'axios';
import store from '@/store/';
import router from '@/router/';
import {
    serialize
} from '@/utils/util';
import {
    getToken,
    removeToken,
    removeRefreshToken
} from '@/utils/auth';
import {
    isURL,
    validatenull
} from '@/utils/validate';
import {
    ElMessage
} from 'element-plus';
import { serialize } from '@/utils/util';
import { getToken, removeToken, removeRefreshToken } from '@/utils/auth';
import { isURL, validatenull } from '@/utils/validate';
import { ElMessage } from 'element-plus';
import website from '@/config/website';
import NProgress from 'nprogress'; // progress bar
import 'nprogress/nprogress.css'; // progress bar style
import {
    Base64
} from 'js-base64';
import {
    baseUrl
} from '@/config/env';
import { Base64 } from 'js-base64';
import { baseUrl } from '@/config/env';
import crypto from '@/utils/crypto';
const adminUrl = import.meta.env.VITE_APP_DASHBOARD_URL
const adminUrl = import.meta.env.VITE_APP_DASHBOARD_URL;
// 全局未授权错误提示状态,只提示一次
let isErrorShown = false;
@@ -42,193 +27,209 @@
// 超时时间设置为10分钟,部分接口上传比较慢,如固件上传
axios.defaults.timeout = 600000;
//返回其他状态码
axios.defaults.validateStatus = function(status) {
    return status >= 200 && status <= 500; // 默认的
axios.defaults.validateStatus = function (status) {
  return status >= 200 && status <= 500; // 默认的
};
//跨域请求,允许保存cookie
axios.defaults.withCredentials = true;
// NProgress Configuration
NProgress.configure({
    showSpinner: false,
  showSpinner: false,
});
//http request拦截
axios.interceptors.request.use(
    config => {
        // start progress bar
        NProgress.start();
        // 初始化错误提示状态
        isErrorShown = false;
        //地址为已经配置状态则不添加前缀
        if (!isURL(config.url) && !config.url.startsWith(baseUrl)) {
            config.url = baseUrl + config.url;
        }
        //安全请求header
        config.headers['areaCode'] = store?.state?.user?.userInfo?.detail?.areaCode
        config.headers['Blade-Requested-With'] = 'BladeHttpRequest';
        //headers判断是否需要
        const authorization = config.authorization === false;
        if (!authorization) {
            config.headers['Authorization'] = `Basic ${Base64.encode(
  config => {
    // start progress bar
    NProgress.start();
    // 初始化错误提示状态
    isErrorShown = false;
    //地址为已经配置状态则不添加前缀
    if (!isURL(config.url) && !config.url.startsWith(baseUrl)) {
      config.url = baseUrl + config.url;
    }
    //安全请求header
    config.headers['areaCode'] = store?.state?.user?.userInfo?.detail?.areaCode;
    config.headers['Blade-Requested-With'] = 'BladeHttpRequest';
    //headers判断是否需要
    const authorization = config.authorization === false;
    if (!authorization) {
      config.headers['Authorization'] = `Basic ${Base64.encode(
        `${website.clientId}:${website.clientSecret}`
      )}`;
        }
        //headers判断请求是否携带token
        const meta = config.meta || {};
        const isToken = meta.isToken === false;
        //headers传递token是否加密
        const cryptoToken = config.cryptoToken === true;
        //判断传递数据是否加密
        const cryptoData = config.cryptoData === true;
        const token = getToken();
        if (token && !isToken) {
            config.headers[website.tokenHeader] = cryptoToken ?
                'crypto ' + crypto.encryptAES(token, crypto.cryptoKey) :
                'bearer ' + token;
        }
        // 开启报文加密
        // if (cryptoData) {
        //   if (config.params) {
        //     const data = crypto.encryptAES(JSON.stringify(config.params), crypto.aesKey);
        //     config.params = { data };
        //   }
        //   if (config.data) {
        //     config.text = true;
        //     config.data = crypto.encryptAES(JSON.stringify(config.data), crypto.aesKey);
        //   }
        // }
        //headers中配置text请求
        if (config.text === true) {
            config.headers['Content-Type'] = 'text/plain';
        }
        //headers中配置serialize为true开启序列化
        if (config.method === 'post' && meta.isSerialize === true) {
            config.data = serialize(config.data);
        }
        return config;
    },
    error => {
        return Promise.reject(error);
    }
    }
    //headers判断请求是否携带token
    const meta = config.meta || {};
    const isToken = meta.isToken === false;
    //headers传递token是否加密
    const cryptoToken = config.cryptoToken === true;
    //判断传递数据是否加密
    const cryptoData = config.cryptoData === true;
    const token = getToken();
    if (token && !isToken) {
      config.headers[website.tokenHeader] = cryptoToken
        ? 'crypto ' + crypto.encryptAES(token, crypto.cryptoKey)
        : 'bearer ' + token;
    }
    // 开启报文加密
    // if (cryptoData) {
    //   if (config.params) {
    //     const data = crypto.encryptAES(JSON.stringify(config.params), crypto.aesKey);
    //     config.params = { data };
    //   }
    //   if (config.data) {
    //     config.text = true;
    //     config.data = crypto.encryptAES(JSON.stringify(config.data), crypto.aesKey);
    //   }
    // }
    //headers中配置text请求
    if (config.text === true) {
      config.headers['Content-Type'] = 'text/plain';
    }
    //headers中配置serialize为true开启序列化
    if (config.method === 'post' && meta.isSerialize === true) {
      config.data = serialize(config.data);
    }
    return config;
  },
  error => {
    return Promise.reject(error);
  }
);
//http response拦截
axios.interceptors.response.use(
    res => {
        NProgress.done();
        const status = res.data.error_code || res.data.code || res.status;
        const statusWhiteList = website.statusWhiteList || [];
        const message = res.data.msg || res.data.error_description || res.data.message ||'系统错误';
        const config = res.config;
        const cryptoData = config.cryptoData === true;
        if (status === 511) {
            ElMessage({
                message: '请联系运维人员上传密钥证书!',
                type: 'error',
            });
            // 获取当前路由名称
            const currentRouteName = router.currentRoute.value.name;
            // 如果当前路由不是登录页,则跳转到登录页
            if (currentRouteName !== '登录页') {
                store.dispatch('FedLogOut').then(() => router.push({
                    path: '/login'
                }));
            }
            return Promise.reject(new Error(message));
        }
        //如果在白名单里则自行catch逻辑处理
        if (statusWhiteList.includes(status)) return Promise.reject(res);
        // 如果是401并且没有重试过,尝试刷新token
        if (status === 401 && !_retry) {
            // 标记此请求已尝试刷新token
            _retry = true;
            // 调用RefreshToken action来刷新token
            return store
                .dispatch('RefreshToken')
                .then(() => {
                    const meta = config.meta || {};
                    const isToken = meta.isToken === false;
                    const cryptoToken = config.cryptoToken === true;
                    // 获取刷新后的token
                    const token = getToken();
                    if (token && !isToken) {
                        config.headers[website.tokenHeader] = cryptoToken ?
                            'crypto ' + crypto.encryptAES(token, crypto.cryptoKey) :
                            'bearer ' + token;
                    }
                    // 重新发送原来的请求
                    return axios(config);
                })
                .catch(() => {
                    // 首次报错时提示
                    if (!isErrorShown) {
                        isErrorShown = true;
                        ElMessage({
                            message: message,
                            type: 'error',
                        });
                    }
                    // 清除token信息
                    removeToken();
                    removeRefreshToken();
                    // 重定向到登录页
                    // store.dispatch('FedLogOut').then(() => router.push({
                    //     path: '/login'
                    // }));
                    store.dispatch('FedLogOut').then(() =>  window.location.replace(`${adminUrl}#/login`));
                    return Promise.reject(new Error(message));
                });
        }
        // 如果是401并且已经重试过,直接跳转到登录页面
        if (status === 401 && _retry) {
            // 首次报错时提示
            if (!isErrorShown) {
                isErrorShown = true;
                ElMessage({
                    message: '用户令牌过期,请重新登录',
                    type: 'error',
                });
            }
            // 清除token信息
            removeToken();
            removeRefreshToken();
            // 重定向到登录页
            // store.dispatch('FedLogOut').then(() => router.push({
            //     path: '/login'
            // }));
            store.dispatch('FedLogOut').then(() =>  window.location.replace(`${adminUrl}#/login`));
            return Promise.reject(new Error(message));
        }
        // 如果请求为oauth2错误码则首次报错时提示
        if (status > 2000 && !validatenull(res.data.error_description)) {
            // 首次报错时提示
            if (!isErrorShown) {
                isErrorShown = true;
                ElMessage({
                    message: message,
                    type: 'error',
                });
            }
            return Promise.reject(new Error(message));
        }
        // 如果请求为非200默认统一处理
        if (status !== 200 && status !== 0) {
            if (!isErrorShown) {
                ElMessage({
                    message: message,
                    type: 'error',
                });
            }
            return Promise.reject(new Error(message));
        }
        // 解析加密报文
        if (cryptoData) {
            res.data = JSON.parse(crypto.decryptAES(res.data, crypto.aesKey));
        }
        return res;
    },
    error => {
        NProgress.done();
        return Promise.reject(new Error(error));
    }
  res => {
    NProgress.done();
    const status = res.data.error_code || res.data.code || res.status;
    const statusWhiteList = website.statusWhiteList || [];
    const message = res.data.msg || res.data.error_description || res.data.message || '系统错误';
    const config = res.config;
    const cryptoData = config.cryptoData === true;
    if (status === 511) {
      ElMessage({
        message: '请联系运维人员上传密钥证书!',
        type: 'error',
      });
      // 获取当前路由名称
      const currentRouteName = router.currentRoute.value.name;
      // 如果当前路由不是登录页,则跳转到登录页
      if (currentRouteName !== '登录页') {
        store.dispatch('FedLogOut').then(() =>
          router.push({
            path: '/login',
          })
        );
      }
      return Promise.reject(new Error(message));
    }
    //如果在白名单里则自行catch逻辑处理
    if (statusWhiteList.includes(status)) return Promise.reject(res);
    // 如果是401并且没有重试过,尝试刷新token
    if (status === 401 && !_retry) {
      // 标记此请求已尝试刷新token
      _retry = true;
      // 调用RefreshToken action来刷新token
      return store
        .dispatch('RefreshToken')
        .then(() => {
          const meta = config.meta || {};
          const isToken = meta.isToken === false;
          const cryptoToken = config.cryptoToken === true;
          // 获取刷新后的token
          const token = getToken();
          if (token && !isToken) {
            config.headers[website.tokenHeader] = cryptoToken
              ? 'crypto ' + crypto.encryptAES(token, crypto.cryptoKey)
              : 'bearer ' + token;
          }
          // 重新发送原来的请求
          return axios(config);
        })
        .catch(() => {
          // 首次报错时提示
          if (!isErrorShown) {
            isErrorShown = true;
            ElMessage({
              message: message,
              type: 'error',
            });
          }
          // 清除token信息
          removeToken();
          removeRefreshToken();
          const env = import.meta.env.VITE_APP_ENV;
          // 重定向到登录页
          // store.dispatch('FedLogOut').then(() => router.push({
          //     path: '/login'
          // }));
          env === 'development'
            ? store.dispatch('FedLogOut').then(() =>
                router.push({
                  path: '/login',
                })
              )
            : store.dispatch('FedLogOut').then(() => window.location.replace(`${adminUrl}#/login`));
          return Promise.reject(new Error(message));
        });
    }
    // 如果是401并且已经重试过,直接跳转到登录页面
    if (status === 401 && _retry) {
      // 首次报错时提示
      if (!isErrorShown) {
        isErrorShown = true;
        ElMessage({
          message: '用户令牌过期,请重新登录',
          type: 'error',
        });
      }
      // 清除token信息
      removeToken();
      removeRefreshToken();
      // 重定向到登录页
      //   store.dispatch('FedLogOut').then(() => router.push({
      //       path: '/login'
      //   }));
      const env = import.meta.env.VITE_APP_ENV;
      env === 'development'
        ? store.dispatch('FedLogOut').then(() =>
            router.push({
              path: '/login',
            })
          )
        : store.dispatch('FedLogOut').then(() => window.location.replace(`${adminUrl}#/login`));
      return Promise.reject(new Error(message));
    }
    // 如果请求为oauth2错误码则首次报错时提示
    if (status > 2000 && !validatenull(res.data.error_description)) {
      // 首次报错时提示
      if (!isErrorShown) {
        isErrorShown = true;
        ElMessage({
          message: message,
          type: 'error',
        });
      }
      return Promise.reject(new Error(message));
    }
    // 如果请求为非200默认统一处理
    if (status !== 200 && status !== 0) {
      if (!isErrorShown) {
        ElMessage({
          message: message,
          type: 'error',
        });
      }
      return Promise.reject(new Error(message));
    }
    // 解析加密报文
    if (cryptoData) {
      res.data = JSON.parse(crypto.decryptAES(res.data, crypto.aesKey));
    }
    return res;
  },
  error => {
    NProgress.done();
    return Promise.reject(new Error(error));
  }
);
export default axios;
src/buildConfig/buildConfig/config.jiangwu.js
@@ -5,8 +5,6 @@
        },
        loginTitle: '大吉山钨业无人机安防监测平台',
      hideMenuTopLogo: true, // 是否隐藏菜单顶部logo
    }
}
}
src/page/index/logo.vue
@@ -3,13 +3,13 @@
    <transition name="fade">
      <span v-if="getScreen(isCollapse)" class="avue-logo_subtitle" key="0">
<!--        {{ website.logo }}-->
        <img class="logoImg" src="/img/bg/mainLogo.png" alt=""/>
        <img v-if="!hideMenuTopLogo" class="logoImg" src="/img/bg/mainLogo.png" alt=""/>
      </span>
    </transition>
    <transition-group name="fade">
      <template v-if="getScreen(!isCollapse)">
        <div class="fadeStyle">
          <img class="logoImg" src="/img/bg/mainLogo.png" alt=""/>
          <img v-if="!hideMenuTopLogo" class="logoImg" src="/img/bg/mainLogo.png" alt=""/>
          <div class="titleName">综合管理平台</div>
          <!-- <span style="font-size: 20px;"  key="1">
              {{ this.parentDeptInfo.sysName }}
@@ -22,11 +22,14 @@
<script>
import { mapGetters } from 'vuex';
import getBaseConfig from '@/buildConfig/config';
const { hideMenuTopLogo } = getBaseConfig()
export default {
  name: 'logo',
  data() {
    return {};
    return {
      hideMenuTopLogo
    };
  },
  created() {},
  computed: {
src/page/index/top/index.vue
@@ -102,9 +102,11 @@
        type: 'warning',
      }).then(() => {
        this.$store.dispatch('LogOut').then(() => {
          // this.$router.push({ path: '/login' })
        const env = import.meta.env.VITE_APP_ENV
          console.log(env);
          const adminUrl = import.meta.env.VITE_APP_DASHBOARD_URL
          window.location.replace(`${adminUrl}#/login`)
           env === 'development' ? this.$router.push({ path: '/login' }):window.location.replace(`${adminUrl}#/login`)
        })
      })
    },
src/permission.js
@@ -19,6 +19,8 @@
const lockPage = '/lock' //锁屏页
const urlParams = getUrlParams(window.location.href)
const adminUrl = import.meta.env.VITE_APP_DASHBOARD_URL
const env = import.meta.env.VITE_APP_ENV
function findRouteByPath (routes, targetPath) {
  // 遍历数组中的每个路由对象
  for (const route of routes) {
@@ -39,7 +41,6 @@
  // 遍历完所有路由都没找到,返回null
  return null
}
router.beforeEach((to, from, next) => {
  const meta = to.meta || {}
  const isMenu = meta.menu === undefined ? to.query.menu : meta.menu
@@ -93,10 +94,10 @@
    } else {
      const systemToken = store.getters.token || urlParams?.token
      if (systemToken === 0) {
        // store.dispatch('FedLogOut').then(() => {
        //   next({ path: '/login' })
        // })
        store.dispatch('FedLogOut').then(() =>  window.location.replace(`${adminUrl}#/login`));
        store.dispatch('FedLogOut').then(() => {
          next({ path: '/login' })
        })
        // store.dispatch('FedLogOut').then(() =>  window.location.replace(`${adminUrl}#/login`));
      } else {
        const meta = to.meta || {}
        const query = to.query || {}
@@ -121,8 +122,7 @@
    if (meta.isAuth === false) {
      next()
    } else {
      // next('/login')
      window.location.replace(`${adminUrl}#/login`)
      env === 'development' ? next('/login') : window.location.replace(`${adminUrl}#/login`)
    }
  }
})
src/styles/element-ui.scss
@@ -115,4 +115,27 @@
    display: flex;
    flex-direction: column;
  }
}
.ztzf-public-general-avue-crud {
  .el-table {
    tr {
      min-height: 30px !important;
      line-height: 30px !important;
      box-sizing: border-box !important;
    }
    tr th,
    tr td {
      padding: 6px 0 !important;
      min-height: 30px !important;
      line-height: 30px !important;
      box-sizing: border-box !important;
      div.cell {
        min-height: 30px !important;
        line-height: 30px !important;
      }
    }
  }
}
src/views/device/airport.vue
@@ -1,34 +1,12 @@
<template>
  <basic-main-content>
    <avue-crud
      :option="option"
      :table-loading="loading"
      :data="data"
      v-model:page="page"
      ref="crud"
      @row-del="rowDel"
      v-model="form"
      :permission="permissionList"
      @row-update="rowUpdate"
      @row-save="rowSave"
      :before-open="beforeOpen"
      @search-change="searchChange"
      @search-reset="searchReset"
      @selection-change="selectionChange"
      @current-change="currentChange"
      @size-change="sizeChange"
      @refresh-change="refreshChange"
      @on-load="onLoad"
      @tree-load="treeLoad"
    >
    <avue-crud :option="option" :table-loading="loading" :data="data" v-model:page="page" ref="crud" @row-del="rowDel"
      v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave" :before-open="beforeOpen"
      @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
      @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad"
      @tree-load="treeLoad">
      <template #menu-left>
        <el-button
          type="danger"
          icon="el-icon-delete"
          plain
          v-if="permission.device_delete"
          @click="handleDelete"
          >删 除
        <el-button type="danger" icon="el-icon-delete" plain v-if="permission.device_delete" @click="handleDelete">删 除
        </el-button>
      </template>
      <template #dept_name="{ row }">
@@ -47,69 +25,46 @@
      <template #firmware_status="{ row }">
        <div v-if="row.firmware_status == 1" class="onlineStatus1">
          <el-tag type="info">无需升级</el-tag>
          <el-tag type="primary" effect="dark" class="active-element" @click="rollFirmware(row)"
            >版本管理</el-tag
          >
          <el-tag type="primary" effect="dark" class="active-element" @click="rollFirmware(row)">版本管理</el-tag>
          <!-- <div style="background-color: #f1f1f1; border-radius: 4px">无需升级</div> -->
        </div>
        <div v-if="row.firmware_status == 2" class="onlineStatus1">
          <!-- <el-tag type="success" effect="dark" class="active-element" @click="updateFirmware(row)"
            >升级固件</el-tag
          > -->
          <el-tag type="primary" effect="dark" class="active-element" @click="rollFirmware(row)"
            >版本管理</el-tag
          >
          <el-tag type="primary" effect="dark" class="active-element" @click="rollFirmware(row)">版本管理</el-tag>
          <!-- <div @click="updateFirmware(row)" class="firmware_status">升级固件</div> -->
        </div>
        <div v-if="row.firmware_status == 3" class="onlineStatus">
          <el-tag type="success" effect="dark" class="active-element" @click="updateFirmware(row)"
            >一致性升级</el-tag
          >
          <el-tag type="success" effect="dark" class="active-element" @click="updateFirmware(row)">一致性升级</el-tag>
          <!-- <div @click="updateFirmware(row)" class="firmware_status">一致性升级</div> -->
        </div>
        <div v-if="row.firmware_status == 4" class="onlineStatus">
          <el-tag effect="dark" class="active-element" @click="updateFirmware(row)">升级中</el-tag>
          <el-progress
            v-if="row.firmware_progress > 0 && row.firmware_progress < 100"
            :percentage="row.firmware_progress"
          ></el-progress>
          <el-progress v-if="row.firmware_progress > 0 && row.firmware_progress < 100"
            :percentage="row.firmware_progress"></el-progress>
        </div>
      </template>
      <template #mode_code="{ row }">
        <span
          class="text"
          v-if="row.domain == 3"
          :style="row.mode_code != '-1' ? 'color: #00ee8b' : 'color: #de5e5e'"
        >
        <span class="text" v-if="row.domain == 3" :style="row.mode_code != '-1' ? 'color: #00ee8b' : 'color: #de5e5e'">
          {{ getDockModeText(row.mode_code) }}
        </span>
      </template>
      <template #menu="scope">
        <el-button
          type="primary"
          text
          icon="el-icon-paperclip"
          v-if="permission.oss_set"
          @click.stop="handleOpenOssSet(scope.row, scope.index)"
          >存储配置
        <el-button type="primary" text icon="el-icon-paperclip" v-if="permission.oss_set"
          @click.stop="handleOpenOssSet(scope.row, scope.index)">存储配置
        </el-button>
        <el-button
          type="primary"
          text
          icon="el-icon-share"
          v-if="permission.per_share && scope.row.domain == 3"
          @click.stop="handleOpenDevicePerShare(scope.row, scope.index)"
          >机场授权
        <el-button type="primary" text icon="el-icon-share" v-if="permission.per_share && scope.row.domain == 3"
          @click.stop="handleOpenDevicePerShare(scope.row, scope.index)">机场授权
        </el-button>
        <el-button
          type="primary"
          text
          icon="el-icon-position"
          :disabled="!scope.row.status"
        <el-button type="primary" text icon="el-icon-position" :disabled="!scope.row.status"
          v-if="permission.rang_con && scope.row.domain == 3"
          @click.stop="handleOpenRemoteDebugging(scope.row, scope.index)"
          >远程调试
          @click.stop="handleOpenRemoteDebugging(scope.row, scope.index)">远程调试
        </el-button>
        <el-button type="primary" text icon="el-icon-setting" v-if="permission.fly_device_offline"
          @click.stop="handleDeviceOffline(scope.row)">设备下线
        </el-button>
      </template>
      <!-- 添加行政区划显示模板 -->
@@ -128,22 +83,11 @@
      </template>
    </el-dialog>
    <el-dialog
      title="存储配置"
      append-to-body
      v-model="ossSetBox"
      @close="handleOssSetClose"
      width="600px"
    >
    <el-dialog title="存储配置" append-to-body v-model="ossSetBox" @close="handleOssSetClose" width="600px">
      <div class="onlineStatus">
        存储对象配置:
        <el-select v-model="ossEnd" clearable placeholder="请选择存储对象" style="width: 450px">
          <el-option
            v-for="item in ossList"
            :key="item.id"
            :label="item.name + ': ' + item.endpoint"
            :value="item.id"
          >
          <el-option v-for="item in ossList" :key="item.id" :label="item.name + ': ' + item.endpoint" :value="item.id">
            <span style="float: left">{{ item.name + ': ' + item.endpoint }}</span>
            <span v-if="item.status == 1" class="status1">{{ item.categoryName }}</span>
            <span v-if="item.status == 2" class="status2">{{ item.categoryName }}</span>
@@ -162,18 +106,9 @@
    <el-dialog title="固件版本管理" append-to-body v-model="rollFirmwareBox" width="455px">
      <div class="onlineStatus">
        固件版本升级/回退:
        <el-select
          v-model="rollFirmVersion"
          clearable
          placeholder="请选择固件版本"
          style="width: 240px"
        >
          <el-option
            v-for="item in firmList"
            :key="item.firmware_version"
            :label="item.firmware_version"
            :value="item.firmware_version"
          />
        <el-select v-model="rollFirmVersion" clearable placeholder="请选择固件版本" style="width: 240px">
          <el-option v-for="item in firmList" :key="item.firmware_version" :label="item.firmware_version"
            :value="item.firmware_version" />
        </el-select>
      </div>
      <template #footer>
@@ -184,29 +119,21 @@
      </template>
    </el-dialog>
    <el-drawer
      class="ztzf-drawer-body-basic-container"
      title="机场授权管理"
      size="60%"
      append-to-body
      v-model="devicePerShareVisible"
      :direction="'rtl'"
    >
    <el-drawer class="ztzf-drawer-body-basic-container" title="机场授权管理" size="60%" append-to-body
      v-model="devicePerShareVisible" :direction="'rtl'">
      <DevicePerShare ref="devicePerShare" />
    </el-drawer>
    <el-drawer :title="operateTitle" append-to-body v-model="remoteDebuggingShow" size="40%">
      <DockControlPanel
        v-if="remoteDebuggingShow"
        :sn="curDeviceInfo.device_sn"
        :deviceInfo="curDeviceInfo"
      >
      <DockControlPanel v-if="remoteDebuggingShow" :sn="curDeviceInfo.device_sn" :deviceInfo="curDeviceInfo">
      </DockControlPanel>
    </el-drawer>
  </basic-main-content>
</template>
<script>
import { ElMessage, ElMessageBox } from 'element-plus'
import {
  getList,
  remove,
@@ -217,24 +144,25 @@
  ota,
  getDeviceFirmwareList,
  getDevices,
} from '@/api/device/device';
import { deleteByOssId, addOrUpdate as addOrUpdateOssBind } from '@/api/device/ossBind';
import { getListPage as getOssList } from '@/api/resource/oss';
import { getLazyTree } from '@/api/base/region';
import { EDockModeText, EDockModeCode } from '@/types/device';
import { mapGetters } from 'vuex';
import FirmwareManage from './components/firmwareManage.vue';
import DevicePerShare from './components/devicePerShare.vue';
import DockControlPanel from './components/DockControlPanel.vue';
import { getWebsocketUrl } from '@/websocket/util/config';
import ConnectWebSocket from '@/websocket';
  deviceOffline
} from '@/api/device/device'
import { deleteByOssId, addOrUpdate as addOrUpdateOssBind } from '@/api/device/ossBind'
import { getListPage as getOssList } from '@/api/resource/oss'
import { getLazyTree } from '@/api/base/region'
import { EDockModeText, EDockModeCode } from '@/types/device'
import { mapGetters } from 'vuex'
import FirmwareManage from './components/firmwareManage.vue'
import DevicePerShare from './components/devicePerShare.vue'
import DockControlPanel from './components/DockControlPanel.vue'
import { getWebsocketUrl } from '@/websocket/util/config'
import ConnectWebSocket from '@/websocket'
export default {
  components: {
    FirmwareManage,
    DevicePerShare,
    DockControlPanel,
  },
  data() {
  data () {
    return {
      bindOssId: null,
      deviceSn: '',
@@ -462,22 +390,10 @@
                trigger: 'change',
              },
            ],
            change: ({ value }) => {
              if (!value) {
                this.form.area_code = null;
              } else {
                if (typeof value === 'string' && value.includes(',')) {
                  const codes = value.split(',');
                  this.form.area_code = codes[codes.length - 1];
                } else {
                  this.form.area_code = value;
                }
              }
            },
            lazy: true,
            lazyLoad(node, resolve) {
              let level = node.level;
              let list = [];
            lazyLoad (node, resolve) {
              let level = node.level
              let list = []
              let callback = () => {
                resolve(
                  (list || []).map(ele => ({
@@ -485,26 +401,26 @@
                    value: ele.value,
                    leaf: level >= 2,
                  }))
                );
              };
                )
              }
              if (level === 0) {
                getLazyTree('000000000000').then(res => {
                  list = res.data.data;
                  callback();
                });
                  list = res.data.data
                  callback()
                })
              } else if (level === 1) {
                getLazyTree(node.value).then(res => {
                  list = res.data.data;
                  callback();
                });
                  list = res.data.data
                  callback()
                })
              } else if (level === 2) {
                getLazyTree(node.value).then(res => {
                  list = res.data.data;
                  callback();
                });
                  list = res.data.data
                  callback()
                })
              } else {
                callback();
                callback()
              }
            },
          },
@@ -547,7 +463,7 @@
              },
            ],
          },
           {
          {
            label: '在线状态',
            prop: 'cnstatus',
            hide: true,
@@ -561,7 +477,7 @@
            prop: 'status',
            addDisplay: false,
            editDisplay: false,
             viewDisplay: false,
            viewDisplay: false,
            labelWidth: 130,
            slot: true,
            width: 100,
@@ -617,241 +533,263 @@
        ConsistencyUpgrade: 3, // 一致性升级
        DuringUpgrade: 4, // 升级中
      },
    };
    }
  },
  computed: {
    ...mapGetters(['permission']),
    permissionList() {
    permissionList () {
      return {
        addBtn: this.validData(this.permission.air_add, true),
        viewBtn: this.validData(this.permission.air_view, true),
        delBtn: this.validData(this.permission.air_delete, true),
        editBtn: this.validData(this.permission.air_edit, true),
      };
      }
    },
    ids() {
      let ids = [];
    ids () {
      let ids = []
      this.selectionList.forEach(ele => {
        ids.push(ele.id);
      });
      return ids.join(',');
        ids.push(ele.id)
      })
      return ids.join(',')
    },
  },
  destroyed() {
  destroyed () {
    this.websocketMap.forEach((k, v) => {
      if (null != v) {
        v.close();
        this.websocketMap.delete(k);
        this.webSocketIdSet.delete(k);
        v.close()
        this.websocketMap.delete(k)
        this.webSocketIdSet.delete(k)
      }
    });
    })
  },
  methods: {
    getDockModeText(value) {
      return EDockModeText[value] || '';
    getDockModeText (value) {
      return EDockModeText[value] || ''
    },
    // 关闭所有的webscoket
    closeAllWebsoket() {
    closeAllWebsoket () {
      this.websocketMap.forEach((k, v) => {
        if (null != v) {
          v.close();
          this.websocketMap.delete(k);
          this.webSocketIdSet.delete(k);
          v.close()
          this.websocketMap.delete(k)
          this.webSocketIdSet.delete(k)
        }
      });
      })
    },
    // 连接webSocket
    connectWebSocket(data) {
      const webSocketId = data.workspace_id;
    connectWebSocket (data) {
      const webSocketId = data.workspace_id
      if (!this.webSocketIdSet.has(webSocketId)) {
        // 防止重复连接
        this.webSocketIdSet.add(webSocketId);
        const webSorketUrl = getWebsocketUrl() + '&workspace-id=' + data.workspace_id;
        this.webSocketIdSet.add(webSocketId)
        const webSorketUrl = getWebsocketUrl() + '&workspace-id=' + data.workspace_id
        // 监听ws 消息
        this.useConnectWebSocket(webSocketId, webSorketUrl);
        this.useConnectWebSocket(webSocketId, webSorketUrl)
      }
    },
    useConnectWebSocket(webSocketId, url) {
      const websocket = new ConnectWebSocket(url);
    useConnectWebSocket (webSocketId, url) {
      const websocket = new ConnectWebSocket(url)
      // 加入 webscoket map
      this.websocketMap.set(webSocketId, websocket);
      websocket?.registerMessageHandler(this.messageHandler);
      websocket?.initSocket();
      this.websocketMap.set(webSocketId, websocket)
      websocket?.registerMessageHandler(this.messageHandler)
      websocket?.initSocket()
    },
    async messageHandler(payload) {
    async messageHandler (payload) {
      if (!payload) {
        return;
        return
      }
      if (payload.biz_code != 'ota_progress') {
        return;
        return
      }
      var data = payload.data;
      var data = payload.data
      this.data.forEach(e => {
        if (e.device_sn == data.sn && data.output.status == 'in_progress') {
          e.firmware_progress = data.output.progress.percent;
          e.firmware_progress = data.output.progress.percent
        }
        if (e.device_sn == data.sn && data.output.status == 'ok') {
          // 升级完成修改状态
          e.firmware_status = 1;
          const webscoket = this.websocketMap.get(e.workspace_id);
          e.firmware_status = 1
          const webscoket = this.websocketMap.get(e.workspace_id)
          // 关闭
          webscoket?.close();
          webscoket?.close()
          //删除对应的webscoket
          this.websocketMap.delete(e.workspace_id);
          this.webSocketIdSet.delete(e.workspace_id);
          this.websocketMap.delete(e.workspace_id)
          this.webSocketIdSet.delete(e.workspace_id)
        }
      });
      })
    },
    init() {
    init () {
      (this.page = {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      }),
        this.onLoad(this.page);
        this.onLoad(this.page)
    },
    // 打开权限分享页面
    handleOpenDevicePerShare(row) {
      var that = this;
      this.devicePerShareVisible = true;
    handleOpenDevicePerShare (row) {
      var that = this
      this.devicePerShareVisible = true
      this.$nextTick(() => {
        that.$refs.devicePerShare.init(row);
      });
        that.$refs.devicePerShare.init(row)
      })
    },
    // 打开远程调试
    handleOpenRemoteDebugging(row) {
      this.curDeviceInfo = row;
      this.remoteDebuggingShow = true;
      this.operateTitle = row.nickname + ' - ' + row.device_sn;
    handleOpenRemoteDebugging (row) {
      this.curDeviceInfo = row
      this.remoteDebuggingShow = true
      this.operateTitle = row.nickname + ' - ' + row.device_sn
    },
    // 设备下线
    handleDeviceOffline (row) {
      ElMessageBox.confirm('确定下线该设备吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
        .then(() => {
          deviceOffline(row.device_sn)
            .then(res => {
              ElMessage.success('下线成功')
              this.init()
            })
            .catch(error => {
              ElMessage.error('下线失败')
            })
        })
        .catch(() => { })
    },
    // 打开存储对象配置页面
    handleOpenOssSet(row) {
      var that = this;
      this.deviceSn = row.device_sn;
      this.ossSetBox = true;
      this.bindOssId = row.oss_id;
      this.ossEnd = row.oss_id;
    handleOpenOssSet (row) {
      var that = this
      this.deviceSn = row.device_sn
      this.ossSetBox = true
      this.bindOssId = row.oss_id
      this.ossEnd = row.oss_id
      // 查询下拉列表
      const param = {
        categoryKeys: '1,3,6',
      };
      }
      getOssList(1, 50, param).then(res => {
        const data = res.data.data;
        that.ossList = data.records;
      });
        const data = res.data.data
        that.ossList = data.records
      })
    },
    // 打开固件管理页面
    handleOpenFirmwarm(row) {
      var that = this;
      this.firmwareManageVisible = true;
    handleOpenFirmwarm (row) {
      var that = this
      this.firmwareManageVisible = true
      this.$nextTick(() => {
        that.$refs.firmwareManage.init(row);
      });
        that.$refs.firmwareManage.init(row)
      })
    },
    // 版本回退点击事件
    rollFirmware(row) {
    rollFirmware (row) {
      if (row.status == 0) {
        this.$message({
          type: 'warning',
          message: '设备不在线!',
        });
        return;
        })
        return
      }
      // 如果是机场,查询飞机对应的信息
      if (row.domain === 3) {
        // 查询子设备名称
        getDevices(row.workspace_id, row.child_sn).then(res => {
          const data = res.data.data;
          that.firmwareInfo['child_device_name'] = data.device_name;
          that.firmwareInfo['child_version'] = data.firmware_version;
          that.firmwareInfo['child_status'] = data.status;
        });
          const data = res.data.data
          that.firmwareInfo['child_device_name'] = data.device_name
          that.firmwareInfo['child_version'] = data.firmware_version
          that.firmwareInfo['child_status'] = data.status
        })
      }
      var that = this;
      this.rollFirmwareBox = true;
      var that = this
      this.rollFirmwareBox = true
      const param = {
        device_name: row.device_name,
      };
      }
      // 获取固件最新版本信息
      getDeviceFirmwareList(1, 20, param).then(res => {
        that.firmList = [];
        const data = res.data.data.records;
        that.firmList = []
        const data = res.data.data.records
        if (data.length === 0) {
          return;
          return
        }
        data.forEach(e => {
          if (e.firmware_version != row.firmware_version) {
            that.firmList.push(e);
            that.firmList.push(e)
          }
        });
        that.firmwareInfo['device_name'] = row.device_name;
        that.firmwareInfo['sn'] = row.device_sn;
        })
        that.firmwareInfo['device_name'] = row.device_name
        that.firmwareInfo['sn'] = row.device_sn
        // 3-普通升级,2-一致性升级;
        that.firmwareInfo['firmware_upgrade_type'] = 3;
        that.firmwareInfo['workspaceId'] = row.workspace_id;
        that.firmwareInfo['firmware_version'] = row.firmware_version;
        that.firmwareInfo['status'] = row.status;
        that.firmwareInfo['firmware_upgrade_type'] = 3
        that.firmwareInfo['workspaceId'] = row.workspace_id
        that.firmwareInfo['firmware_version'] = row.firmware_version
        that.firmwareInfo['status'] = row.status
        // domain 0:飞机  3:机场
        that.firmwareInfo['domain'] = row.domain;
        that.firmwareInfo['child_sn'] = row.child_sn;
        that.firmwareInfo['now_version'] = row.firmware_version;
      });
        that.firmwareInfo['domain'] = row.domain
        that.firmwareInfo['child_sn'] = row.child_sn
        that.firmwareInfo['now_version'] = row.firmware_version
      })
    },
    // 比较版本大小
    compare(version1, version2) {
      let arr1 = version1.split('.');
      let arr2 = version2.split('.');
      let length = Math.max(arr1.length, arr2.length);
    compare (version1, version2) {
      let arr1 = version1.split('.')
      let arr2 = version2.split('.')
      let length = Math.max(arr1.length, arr2.length)
      for (let i = 0; i < length; i++) {
        const n1 = Number(arr1[i] || 0);
        const n2 = Number(arr2[i] || 0);
        const n1 = Number(arr1[i] || 0)
        const n2 = Number(arr2[i] || 0)
        // version1 > version2 返回1,如果 version1 < version2 返回-1,不然返回0
        if (n1 > n2) return 1;
        if (n1 < n2) return -1;
        if (n1 > n2) return 1
        if (n1 < n2) return -1
      }
      return 0;
      return 0
    },
    // 版本回退
    rollFirmwareConfirm() {
    rollFirmwareConfirm () {
      // 无人机升级/回滚
      if (this.rollFirmVersion == '') {
        this.$message({
          type: 'warning',
          message: '请先选择回退的固件版本!',
        });
        return;
        })
        return
      }
      var that = this;
      var arr = [];
      that.firmwareInfo['product_version'] = this.rollFirmVersion;
      var that = this
      var arr = []
      that.firmwareInfo['product_version'] = this.rollFirmVersion
      // 机场信息设置
      arr.push(that.firmwareInfo);
      arr.push(that.firmwareInfo)
      // 判断是机场升级还是飞机升级,如果是机场升级则把无人机信息一起带过去
      if (that.firmwareInfo.domain === 3) {
        // 判断当前机场和无人机固件版本是否一致
        var dockFlag = this.compare(
          this.firmwareInfo.firmware_version,
          this.firmwareInfo.child_version
        );
        )
        // 机场和无人机版本一致情况
        if (dockFlag == 0) {
          if (!this.firmwareInfo.status || !this.firmwareInfo.child_status) {
            this.$message({
              type: 'warning',
              message: '请先更新无人机固件版本后再进行机场固件版本更新!',
            });
            return;
            })
            return
          }
          // 只有同时在线并且是升级才能操作
          // 判断升级还是降级,不能降级
          var upDownFlag = this.compare(this.rollFirmVersion, this.firmwareInfo.firmware_version);
          var upDownFlag = this.compare(this.rollFirmVersion, this.firmwareInfo.firmware_version)
          if (upDownFlag == -1) {
            this.$message({
              type: 'warning',
              message: '请先回滚无人机固件版本后再进行机场固件版本更新!',
            });
            return;
            })
            return
          }
          // 同时升级操作
          // 无人机信息设置
@@ -860,229 +798,229 @@
            sn: that.firmwareInfo.child_sn,
            product_version: this.rollFirmVersion,
            firmware_upgrade_type: 3,
          });
          })
        } else {
          // 版本不一致情况
          // 比对需要改变的版本号和无人机版本号是否一致,不一致提示不能操作
          var verFlag = this.compare(this.rollFirmVersion, this.firmwareInfo.child_version);
          var verFlag = this.compare(this.rollFirmVersion, this.firmwareInfo.child_version)
          if (verFlag == -1 || verFlag == 1) {
            this.$message({
              type: 'warning',
              message: '更新版本与当前无人机固件版本不一致,请更新和无人机一致的版本!',
            });
            return;
            })
            return
          }
          // 需要改变的版本号和无人机版本号如果是一致,进行单独的机场升级/回滚操作
        }
      }
      ota(that.firmwareInfo.workspaceId, arr).then(res => {
        that.firmwareVersion = '';
        that.firmwareInfo = {};
        that.rollFirmwareBox = false;
        that.firmwareVersion = ''
        that.firmwareInfo = {}
        that.rollFirmwareBox = false
        this.$message({
          type: 'success',
          message: '操作成功!',
        });
        this.onLoad(this.page);
        done();
      });
        })
        this.onLoad(this.page)
        done()
      })
    },
    // 升级固件按钮事件
    updateFirmware(row) {
    updateFirmware (row) {
      if (row.status == 0) {
        this.$message({
          type: 'warning',
          message: '设备不在线!',
        });
        return;
        })
        return
      }
      var that = this;
      this.firmwareBox = true;
      var that = this
      this.firmwareBox = true
      const param = {
        device_name: row.device_name,
      };
      }
      // 获取固件最新版本信息
      getDeviceUpgradeInfo(param).then(res => {
        const data = res.data.data;
        const data = res.data.data
        if (data.length === 0) {
          return;
          return
        }
        that.firmwareVersion = data[0].product_version;
        that.firmwareInfo['device_name'] = row.device_name;
        that.firmwareInfo['sn'] = row.device_sn;
        that.firmwareInfo['product_version'] = data[0].product_version;
        that.firmwareVersion = data[0].product_version
        that.firmwareInfo['device_name'] = row.device_name
        that.firmwareInfo['sn'] = row.device_sn
        that.firmwareInfo['product_version'] = data[0].product_version
        // 3-普通升级,2-一致性升级;
        that.firmwareInfo['firmware_upgrade_type'] =
          row.firmware_status === that.DeviceFirmwareStatusEnum.ToUpgraded
            ? that.DeviceFirmwareTypeEnum.ToUpgraded
            : that.DeviceFirmwareTypeEnum.ConsistencyUpgrade;
        that.firmwareInfo['workspaceId'] = row.workspace_id;
      });
            : that.DeviceFirmwareTypeEnum.ConsistencyUpgrade
        that.firmwareInfo['workspaceId'] = row.workspace_id
      })
    },
    // 确定升级固件版本
    updateFirmwareConfirm() {
      var that = this;
      var arr = [];
      arr.push(that.firmwareInfo);
    updateFirmwareConfirm () {
      var that = this
      var arr = []
      arr.push(that.firmwareInfo)
      ota(that.firmwareInfo.workspaceId, arr).then(res => {
        that.firmwareVersion = '';
        that.firmwareInfo = {};
        that.firmwareBox = false;
        that.firmwareVersion = ''
        that.firmwareInfo = {}
        that.firmwareBox = false
        this.$message({
          type: 'success',
          message: '操作成功!',
        });
        this.onLoad(this.page);
        done();
      });
        })
        this.onLoad(this.page)
        done()
      })
    },
    handleOssSetClose() {
      this.ossEnd = '';
      this.deviceSn = '';
      this.bindOssId = null;
    handleOssSetClose () {
      this.ossEnd = ''
      this.deviceSn = ''
      this.bindOssId = null
    },
    // 存储对象配置确定
    ossSetConfirm() {
      var that = this;
    ossSetConfirm () {
      var that = this
      // 判断是否已选择
      if (!this.ossEnd) {
        this.$message({
          type: 'warning',
          message: '请选择对于的存储对象!',
        });
        return;
        })
        return
      }
      // 新增或者修改操作
      const data = {
        oss_id: this.ossEnd,
        sn: this.deviceSn,
      };
      }
      // 新增
      addOrUpdateOssBind(data).then(res => {
        this.$message({
          type: 'success',
          message: '操作成功!',
        });
        that.ossSetBox = false;
        this.onLoad(this.page);
        done();
      });
        })
        that.ossSetBox = false
        this.onLoad(this.page)
        done()
      })
    },
    // 取消配置
    cancelOssSetConfirm() {
      var that = this;
    cancelOssSetConfirm () {
      var that = this
      // 判断是否已有配置
      if (!this.bindOssId) {
        this.$message({
          type: 'warning',
          message: '当前机场尚未配置存储对象信息!',
        });
        return;
        })
        return
      }
      deleteByOssId(this.bindOssId).then(() => {
        that.ossSetBox = false;
        this.onLoad(this.page);
        that.ossSetBox = false
        this.onLoad(this.page)
        this.$message({
          type: 'success',
          message: '操作成功!',
        });
      });
        })
      })
    },
    // 取消按钮 oss
    cancelOssSet() {
      this.ossEnd = '';
      this.deviceSn = '';
      this.bindOssId = null;
      this.ossSetBox = false;
    cancelOssSet () {
      this.ossEnd = ''
      this.deviceSn = ''
      this.bindOssId = null
      this.ossSetBox = false
    },
    rowSave(row, done, loading) {
      let areaCode = row.area_code;
    rowSave (row, done, loading) {
      let areaCode = row.area_code
      if (Array.isArray(areaCode)) {
        areaCode = areaCode[areaCode.length - 1];
        areaCode = areaCode[areaCode.length - 1]
      } else if (typeof areaCode === 'string' && areaCode.includes(',')) {
        const codes = areaCode.split(',');
        areaCode = codes[codes.length - 1];
        const codes = areaCode.split(',')
        areaCode = codes[codes.length - 1]
      }
      row.area_code = areaCode || null;
      row.area_code = areaCode || null
      add(row).then(
        () => {
          this.onLoad(this.page);
          this.onLoad(this.page)
          this.$message({
            type: 'success',
            message: '操作成功!',
          });
          done();
          })
          done()
        },
        error => {
          window.console.log(error);
          loading();
          window.console.log(error)
          loading()
        }
      );
      )
    },
    rowUpdate(row, index, done, loading) {
    rowUpdate (row, index, done, loading) {
      const submitData = {
        ...row,
        area_code: row.area_code.split(',').pop(),
        insure_start_time: row.duration_of_insurance[0],
        insure_expired_time: row.duration_of_insurance[1],
      };
      }
      delete submitData.duration_of_insurance;
      delete submitData.duration_of_insurance
      update(submitData).then(
        () => {
          this.onLoad(this.page);
          this.onLoad(this.page)
          this.$message({
            type: 'success',
            message: '操作成功!',
          });
          done();
          })
          done()
        },
        error => {
          window.console.log(error);
          loading();
          window.console.log(error)
          loading()
        }
      );
      )
    },
    rowDel(row) {
    rowDel (row) {
      this.$confirm('确定将选择数据删除?', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
        .then(() => {
          return remove(row.id);
          return remove(row.id)
        })
        .then(() => {
          this.onLoad(this.page);
          this.onLoad(this.page)
          this.$message({
            type: 'success',
            message: '操作成功!',
          });
        });
          })
        })
    },
    searchReset() {
      this.query = {};
      this.onLoad(this.page);
    searchReset () {
      this.query = {}
      this.onLoad(this.page)
    },
    searchChange(params, done) {
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
      done();
    searchChange (params, done) {
      this.query = params
      this.page.currentPage = 1
      this.onLoad(this.page, params)
      done()
    },
    selectionChange(list) {
      this.selectionList = list;
    selectionChange (list) {
      this.selectionList = list
    },
    selectionClear() {
      this.selectionList = [];
      this.$refs.crud.toggleSelection();
    selectionClear () {
      this.selectionList = []
      this.$refs.crud.toggleSelection()
    },
    handleDelete() {
    handleDelete () {
      if (this.selectionList.length === 0) {
        this.$message.warning('请选择至少一条数据');
        return;
        this.$message.warning('请选择至少一条数据')
        return
      }
      this.$confirm('确定将选择数据删除?', {
        confirmButtonText: '确定',
@@ -1090,104 +1028,104 @@
        type: 'warning',
      })
        .then(() => {
          return remove(this.ids);
          return remove(this.ids)
        })
        .then(() => {
          this.onLoad(this.page);
          this.onLoad(this.page)
          this.$message({
            type: 'success',
            message: '操作成功!',
          });
          this.$refs.crud.toggleSelection();
        });
          })
          this.$refs.crud.toggleSelection()
        })
    },
    getFullAreaCode(areaCode) {
      if (!areaCode) return '';
    async getFullAreaCode (areaCode) {
      if (!areaCode) return ''
      const code = areaCode.toString();
      const code = areaCode.toString()
      if (code.includes(',')) return code;
      if (code.includes(',')) return code
      if (code.endsWith('0000000000')) {
        return code;
        return code
      } else if (code.endsWith('00000000') && !code.endsWith('0000000000')) {
        const provinceCode = code.substring(0, 2) + '0000000000';
        return `${provinceCode},${code}`;
        const provinceCode = code.substring(0, 2) + '0000000000'
        return `${provinceCode},${code}`
      } else {
        const provinceCode = code.substring(0, 2) + '0000000000';
        const cityCode = code.substring(0, 4) + '00000000';
        return `${provinceCode},${cityCode},${code}`;
        const provinceCode = code.substring(0, 2) + '0000000000'
        const cityCode = code.substring(0, 4) + '00000000'
        return `${provinceCode},${cityCode},${code}`
      }
    },
    beforeOpen(done, type) {
    beforeOpen (done, type) {
      if (['edit', 'view'].includes(type)) {
        getDetail(this.form.id).then(res => {
          const data = res.data.data;
        getDetail(this.form.id).then(async res => {
          const data = res.data.data
          this.form = {
            ...data,
            area_code: this.getFullAreaCode(data.area_code),
            area_code: await this.getFullAreaCode(data.area_code),
            area_name: this.form.area_name,
            cnmode_code: this.getDockModeText(this.form.mode_code),
            cnstatus:this.form.status === false ? '离线':'在线',
            cnstatus: this.form.status === false ? '离线' : '在线',
            duration_of_insurance: [data?.insure_start_time || '', data?.insure_expired_time || ''],
          };
          console.log('this.form', this.form);
          }
          done();
        });
          done()
        })
      }
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
    currentChange (currentPage) {
      this.page.currentPage = currentPage
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
    sizeChange (pageSize) {
      this.page.pageSize = pageSize
    },
    refreshChange() {
      this.onLoad(this.page, this.query);
    refreshChange () {
      this.onLoad(this.page, this.query)
    },
    onLoad(page, params = {}) {
    onLoad (page, params = {}) {
      // this.closeAllWebsoket();
      const { releaseTimeRange } = this.query;
      const { releaseTimeRange } = this.query
      let values = {
        ...params,
        ...this.query,
      };
      }
      if (releaseTimeRange) {
        values = {
          ...values,
          releaseTime_datege: releaseTimeRange[0],
          releaseTime_datelt: releaseTimeRange[1],
        };
        values.releaseTimeRange = null;
        }
        values.releaseTimeRange = null
      }
      values['type'] = 1;
      this.loading = true;
      values['type'] = 1
      this.loading = true
      getList(page.currentPage, page.pageSize, values).then(res => {
        const data = res.data.data;
        this.page.total = data.total;
        const data = res.data.data
        this.page.total = data.total
        data.records.forEach(e => {
          e['hasChildren'] = e.has_children;
          e['hasChildren'] = e.has_children
          if (e.firmware_status == 4) {
            this.connectWebSocket(e);
            this.connectWebSocket(e)
          }
        });
        this.data = data.records;
        this.loading = false;
        this.selectionClear();
      });
        })
        this.data = data.records
        this.loading = false
        this.selectionClear()
      })
    },
    treeLoad(tree, treeNode, resolve) {
    treeLoad (tree, treeNode, resolve) {
      var params = {
        childSn: tree.child_sn,
      };
      }
      getList(1, 10, params).then(res => {
        const data = res.data.data.records;
        resolve(data);
      });
        const data = res.data.data.records
        resolve(data)
      })
    },
  },
};
}
</script>
<style lang="scss" scoped>
src/views/job/components/SearchBox.vue
@@ -234,12 +234,15 @@
let checked = ref('today');
let timeClick = (item, index) => {
  checked.value = item;
  // dateRange.value = dateRanges[item];
  dateRange.value = [];
  // emit('change', dateRanges[item],timeListEnum[index]);
  searchForm.date_enum = timeListEnum[index];
  handleSearch();
  if (checked.value === item){
    checked.value = null
    searchForm.date_enum = undefined
  }else{
    checked.value = item
    searchForm.date_enum = timeListEnum[index]
  }
  dateRange.value = []
  handleSearch()
};
// 搜索
const handleSearch = () => {
@@ -265,18 +268,8 @@
  emit('search', params);
};
const handleDateChange = val => {
  if (val && val.length === 2) {
    const start = dayjs(val[0]);
    const end = dayjs(val[1]);
    const diff = end.diff(start, 'day');
    if (diff > 31) {
      ElMessage.warning('日期范围不能超过31天');
      dateRange.value = [];
      return;
    }
  }
  handleSearch();
  checked.value = null
  searchForm.date_enum = undefined
};
// 重置
@@ -302,7 +295,7 @@
// watch(
//   () => store.state.task.jumpTask,
//   newVal => {
//     if (newVal && Object.keys(newVal).length) {
//       // 兼容当日任务 计划任务 历史任务传参
//       if (newVal.clickValue) {
@@ -343,7 +336,7 @@
    const date = dayjs(calendarday.value).format(timeFormat);
    const dateArray = [date, date];
    dateRange.value = dateArray;
  }
    // 查询一次
src/views/job/components/TaskAlgorithmBusiness.vue
@@ -2,6 +2,7 @@
<template>
    <div class="task-algorithm" v-if="showAlgorithm">
        <el-select
        class="ztzf-select"
            :teleported="false"
            :style="{ width: pxToRem(setWidth) }"
            v-model="ai_types"
@@ -16,7 +17,7 @@
        </el-select>
    </div>
    <div class="task-business" v-if="showBusiness">
        <el-select
        <el-select class="ztzf-select"
            :teleported="false"
            :style="{ width: pxToRem(setWidth) }"
            v-model="industry_type"
@@ -88,4 +89,33 @@
//     --el-tag-hover-color: none !important;
//     color: #fff !important;
// }
::v-deep(.ztzf-select) {
    .el-select__wrapper {
        z-index: 1111;
        /* 修改 Tooltip 面板样式 */
        .el-popper.is-light {
            background: #fff !important;
            // box-shadow: none !important;
            // border: none !important;
            border-radius: 4px !important;
            .el-select__selection {
                max-width: 240px !important;
                .el-select__selected-item {
                    .el-tag {
                        // background: #fff !important;
                        // color: #000;
                    }
                }
            }
            .el-popper__arrow::before {
                // background: #fff !important;
                // border: 1px solid #8d8b8b !important;
            }
        }
    }
}
</style>
src/views/job/components/TaskIntermediateContent/TaskIntermediateContent.vue
@@ -78,7 +78,7 @@
                class="ztzf-pagination"
                popper-class="custom-pagination-dropdown"
                background
                :page-sizes="[10, 20, 30, 40]"
                :page-sizes="[10, 20, 30, 40,50,100]"
                :size="size"
                v-model:current-page="jobListParams.current"
                v-model:page-size="jobListParams.size"
src/views/job/components/TaskTop/TaskTotal.vue
@@ -51,13 +51,14 @@
    totalJobNum().then(res => {
        if (res.data.code !== 0) returen
        total.value = res.data.data.job_total_num
        numTotal.value = res.data.data.deal_job_num
    })
}
// 获取其他任务统计
const getJobStatistics = value => {
    jobStatistics(value).then(res => {
        if (res.data.code !== 0) returen
    const {executed = 0,failed_executions = 0,go_home_executions = 0} = res.data?.data || {}
    numTotal.value = executed + failed_executions + go_home_executions
        list.value[0].value = res.data.data.planned_executions || 0
        list.value[1].value = res.data.data.executed || 0
        list.value[2].value = res.data.data.running_num || 0
@@ -79,9 +80,6 @@
    { immediate: true,deep: true }
)
onMounted(() => {
    getTotalJobNum()
})
</script>
<style scoped lang="scss">
@@ -136,7 +134,7 @@
        height: 160px;
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
        align-content: space-evenly;
        .total {
src/views/tickets/orderLog.vue
@@ -90,9 +90,9 @@
          </div>
          <!-- 表格部分 -->
          <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">
          <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 #menu-left>
              <el-button v-if="hasAddBtnPermission() && activeTab != 'WAIT_AUDIT'" type="primary" icon="el-icon-plus"
                @click="handleAdd">新建工单</el-button>
src/views/tickets/ticket.vue
@@ -31,9 +31,10 @@
          </div>
          <!-- 表格部分 -->
          <avue-crud ref="avueCrud" v-model="tableData" :option="option" :data="tableData" v-model:page="page"
            @size-change="sizeChange" @current-change="handleCurrentChange" :table-loading="loading"
            @selection-change="handleSelectionChange" :permission="permissionList" v-if="activeTab === tab.name">
          <avue-crud class="ztzf-public-general-avue-crud" ref="avueCrud" v-model="tableData" :option="option"
            :data="tableData" v-model:page="page" @size-change="sizeChange" @current-change="handleCurrentChange"
            @refresh-change="refreshChange" :table-loading="loading" @selection-change="handleSelectionChange"
            :permission="permissionList" v-if="activeTab === tab.name">
            <template #menu-left>
              <el-button v-if="(activeTab === 'all' || activeTab === 'myTickets') && permissionList.addBtn"
                type="primary" icon="el-icon-plus" @click="handleAdd">新建工单</el-button>
@@ -55,7 +56,7 @@
              <template v-if="permission.tickets_repeat_review">
                <el-button v-if="row.status === 4 && row.isReview !== 1" type="text" icon="el-icon-check"
                           @click="reCheck(row)">复核</el-button>
                  @click="reCheck(row)">复核</el-button>
              </template>
            </template>
@@ -124,10 +125,10 @@
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="选择位置" prop="location" required>
              <el-form-item label="选择位置" prop="location">
                <div class="location-wrapper">
                  <avue-input-map v-model="form.location" :params="mapParams" @change="handleLocationChange"
                    type="button">
                  <avue-input-map v-model="form.location" :clearable="false" :params="mapParams"
                    @change="handleLocationChange" type="button">
                    <el-button type="primary" plain class="map-button">
                      <i class="el-icon-map-location"></i> 地图选点
                    </el-button>
@@ -148,22 +149,23 @@
            </el-col>
            <el-col :span="12">
              <el-form-item label="附件图片" prop="photos" required class="upload-wrapper">
                <el-upload v-if="createoredit === 1" ref="upload" :action="'#'" :auto-upload="false" list-type="picture-card"
                  :on-change="handleFileChange" :on-remove="handleUploadRemove" :before-upload="beforeUpload"
                  :file-list="form.photos" :limit="1" accept="image/*" class="create-upload">
                <el-upload v-if="createoredit === 1" ref="upload" :action="'#'" :auto-upload="false"
                  list-type="picture-card" :on-change="handleFileChange" :on-remove="handleUploadRemove"
                  :before-upload="beforeUpload" :file-list="form.photos" :limit="1" accept="image/*"
                  class="create-upload">
                  <template v-if="form.photos.length < 1">
                    <!-- <i class="el-icon-plus">+</i> -->
                      <div class="el-icon-plus">
                    <div class="el-icon-plus">
                      <span>+</span>
                    </div>
                  </template>
                </el-upload>
                  <el-upload v-else ref="upload" :action="'#'" :auto-upload="false" list-type="picture-card"
                <el-upload v-else ref="upload" :action="'#'" :auto-upload="false" list-type="picture-card"
                  :on-change="handleFileChange" :on-remove="handleUploadRemove" :before-upload="beforeUpload"
                  :file-list="popupShowImage(form.photos)" :limit="1" accept="image/*" class="create-upload">
                  <template v-if="form.photos.length < 1">
                      <div class="el-icon-plus">
                    <div class="el-icon-plus">
                      <span>+</span>
                    </div>
                  </template>
@@ -186,8 +188,10 @@
    <!-- 工单详情对话框 -->
    <el-dialog v-model="detailVisible" title="工单详情" width="80%" append-to-body>
      <div class="detail-container">
        <div class="detail-top-title">  <div class="event-title-center event-orderNumber">{{ currentDetail.orderNumber || '工单编号' }}</div>
        <div class="event-title-center">{{ currentDetail.orderName || '事件名称' }}</div></div>
        <div class="detail-top-title">
          <div class="event-title-center event-orderNumber">{{ currentDetail.orderNumber || '工单编号' }}</div>
          <div class="event-title-center">{{ currentDetail.orderName || '事件名称' }}</div>
        </div>
        <div v-if="totalTime" class="event-total-time">
          总耗时:{{ totalTime }}
        </div>
@@ -321,8 +325,8 @@
            <template v-if="!currentDetail.photos || currentDetail.photos.length < 1">
              <!-- <i class="el-icon-plus">+</i> -->
              <div class="el-icon-plus">
                      <span>+</span>
                    </div>
                <span>+</span>
              </div>
            </template>
          </el-upload>
          <div class="el-upload__tip" v-if="hasProcessedAndOverBtnPermission()">
@@ -517,10 +521,11 @@
</template>
<script>
import { getSmallImg,getShowImg } from '@/utils/util';
import { getSmallImg, getShowImg } from '@/utils/util'
import { ElMessageBox, ElLoading } from 'element-plus'
import { calculateDefaultRange } from '@/utils/util'
import { gcj02ToWgs84, wgs84ToGcj02 } from '@/utils/coordinateTransformation'
import _ from 'lodash'
import {
  getList,
  createTicket,
@@ -552,7 +557,7 @@
      dispatchLoading: false,
      completeLoading: false,
      finalizeLoading: false,
      createoredit:'',
      createoredit: '',
      activeTab: 'all',
      // tabs 只保留静态结构,不做权限判断
      tabs: [
@@ -674,14 +679,17 @@
        algorithm: [{ required: true, message: '请选择关联算法', trigger: 'change' }],
        location: [
          {
            required: true,
            validator: (rule, value, callback) => {
              if (!value || value.length < 2) {
                callback(new Error('请选择位置信息'))
              } else if (!value[0] || !value[1]) {
                callback(new Error('请选择位置信息'))
              } else {
                callback()
              }
            },
            trigger: 'blur',
            trigger: 'change'
          },
        ],
        photos: [
@@ -736,6 +744,8 @@
    }
  },
  created () {
    this.inputMapShowDefaultCenter = null
    this.loadAMapScripts()
    this.fetchDropdownData()
    console.log('permission.tickets_processing_btn', this.permission.tickets_processing_btn)
@@ -744,7 +754,7 @@
  mounted () {
    const href = this.$route.href
    if (this.$route?.query?.status !== undefined && this.$route?.query?.status !== null){
    if (this.$route?.query?.status !== undefined && this.$route?.query?.status !== null) {
      this.filters.status = this.$route?.query?.status + ''
      this.$router.replace({})
    }
@@ -910,7 +920,7 @@
        { label: '关联任务', value: this.currentDetail.job_name || '/' },
        { label: '任务发起人', value: this.currentDetail.creator },
        { label: '当前状态', value: this.mapStatus(this.currentDetail.status) },
        { label: '事件地址', value: this.currentDetail.address }, // 包含经纬度信息
        { label: '事件地址', value: this.currentDetail.address || this.currentDetail.latAndLon }, // 包含经纬度信息
        { label: '关联算法', value: this.currentDetail.aiType },
        { label: '发起单位', value: this.currentDetail.department },
        { label: '发起任务时间', value: this.currentDetail.startTime },
@@ -1037,19 +1047,21 @@
        // 直接从返回对象中获取正确的路径
        const center = adcodeObj?.payload?.objects?.collection?.geometries?.[0]?.properties?.center
        if (Array.isArray(center) && center.length === 2) {
          this.mapParams.center = center
          this.inputMapShowDefaultCenter = center
        } else {
          // 如果找不到中心点,尝试使用 bbox 的中心点
          const bbox = adcodeObj?.payload?.bbox
          if (Array.isArray(bbox) && bbox.length === 4) {
            const centerX = (bbox[0] + bbox[2]) / 2
            const centerY = (bbox[1] + bbox[3]) / 2
            this.mapParams.center = [centerX, centerY]
            this.inputMapShowDefaultCenter = [centerX, centerY]
          } else {
            this.mapParams.center = [115.861365, 28.621311]
            this.inputMapShowDefaultCenter = [115.861365, 28.621311]
          }
        }
        this.mapParams.center = [...this.inputMapShowDefaultCenter]
        this.mapLoaded = true
      } catch (error) {
@@ -1341,6 +1353,13 @@
          handlerValue = undefined
        }
        // 验证位置信息
        if (!this.form.location || this.form.location.length < 2 || !this.form.location[0] || !this.form.location[1]) {
          this.$message.warning('请在地图上选择位置')
          return
        }
        let [lng, lat] = this.disposeLocation(true, this.form)
        const submitData = {
@@ -1361,7 +1380,7 @@
        // 草稿时也至少需要工单名称
        if (!submitData.eventName) {
          this.$message.warning('请至少输入工单名称')
          this.$message.warning('请输入工单名称')
          return
        }
@@ -1379,18 +1398,18 @@
        if (response.data.code === 0) {
          this.$message.success('草稿保存成功')
          this.dialogVisible = false
          this.form={
        name: '',
        type: '',
        department: '',
        handler: '',
        algorithm: [], // 关联算法改为数组
        location: [], // 将存储为[经度, 纬度, 地址]格式
        address: '',
        photos: [],
        content: '', // 新增字段,用于存储后端返回的 content
      },
          this.fetchTableData()
          this.form = {
            name: '',
            type: '',
            department: '',
            handler: '',
            algorithm: [], // 关联算法改为数组
            location: [], // 将存储为[经度, 纬度, 地址]格式
            address: '',
            photos: [],
            content: '', // 新增字段,用于存储后端返回的 content
          },
            this.fetchTableData()
        } else {
          throw new Error(response.data.msg || '保存失败')
        }
@@ -1503,6 +1522,8 @@
    },
    async handleCurrentChange (val) {
      // 先更新页码
      this.page.currentPage = val
      // 等待 DOM 更新后再请求数据
@@ -1511,6 +1532,7 @@
    },
    async sizeChange (val) {
      this.page.pageSize = val
      this.page.currentPage = 1 // 重置到第一页
      await this.$nextTick()
@@ -1518,10 +1540,9 @@
    },
    handleAdd () {
    this.createoredit =1
      this.createoredit = 1
      this.dialogVisible = true
      this.mapParams.center = null
      this.mapParams.center = [...this.inputMapShowDefaultCenter]
      this.form.location = []
    },
@@ -1601,8 +1622,8 @@
          })
        }
        this.currentDetail.status = row.status
      } catch (error) {
        if (this.activeTab === 'myTickets') {
          const statusArr = this.workType === 1 ? ['3', '4'] : this.fixedStatuses
@@ -1615,9 +1636,14 @@
          this.stepInfos = []
        }
      }
      console.log(detailData, 'detailDatadetailDatadetailData')
      this.currentDetail = {
        ...detailData,
        address: null,
        latAndLon: _.round(detailData.location[0], 6) + ',' + _.round(detailData.location[1], 6)
      }
      this.currentDetail = detailData
       console.log('this.currentDetail',this.currentDetail);
      console.log('this.currentDetail', this.currentDetail)
      this.detailVisible = true
      this.$nextTick(() => {
        if (this.$refs.MapContainer && this.$refs.MapContainer.initAddEntity) {
@@ -2031,7 +2057,7 @@
    // 添加编辑方法
    handleEdit (row) {
    this.createoredit = 2
      this.createoredit = 2
      console.log('编辑原始数据:', row)
      // 尝试从row.dept_id或通过部门名称查找对应的部门ID
@@ -2107,7 +2133,7 @@
        address: row.address || '',
        content: row.content,
        photos: [],
      }
      let curLocation = []
@@ -2124,7 +2150,7 @@
      if (Array.isArray(this.form.location) && this.form.location.length >= 2) {
        this.mapParams.center = [Number(this.form.location[0]), Number(this.form.location[1])]
      } else {
        this.mapParams.center = null // 没有经纬度时用默认
        this.mapParams.center = [...this.inputMapShowDefaultCenter]
      }
      // 如果有图片,添加到表单中
      if (row.photo_url) {
@@ -2181,6 +2207,7 @@
    // 添加选择变化处理方法
    handleSelectionChange (selection) {
      this.selections = selection
      console.log('已选择的行:', selection)
    },
@@ -2431,20 +2458,23 @@
     * @param goWgs84 是否由国测转换到84,默认false----由84转换到国测
     */
    disposeLocation (goWgs84 = false, data) {
      let lng, lat
      if (goWgs84) {
        lng = data.location?.[0] ? String(data.location[0]) : undefined
        lat = data.location?.[1] ? String(data.location[1]) : undefined
      let lng = '', lat = ''
        if (lng && lat) {
          [lng, lat] = gcj02ToWgs84(Number(lng), Number(lat))
        }
      } else {
        lng = Number(data.location[0])
        lat = Number(data.location[1])
      if (Array.isArray(data.location) && data.location.length > 0) {
        if (goWgs84) {
          lng = data.location?.[0] ? String(data.location[0]) : undefined
          lat = data.location?.[1] ? String(data.location[1]) : undefined
        if (lng && lat) {
          [lng, lat] = wgs84ToGcj02(Number(lng), Number(lat))
          if (lng && lat) {
            [lng, lat] = gcj02ToWgs84(Number(lng), Number(lat))
          }
        } else {
          lng = Number(data.location[0])
          lat = Number(data.location[1])
          if (lng && lat) {
            [lng, lat] = wgs84ToGcj02(Number(lng), Number(lat))
          }
        }
      }
@@ -2805,12 +2835,15 @@
.detail-container {
  padding: 20px;
  .detail-top-title {
  display: flex;
  justify-content: center;
  align-items: center;
  .event-orderNumber{
  margin-right: 10px;}
    display: flex;
    justify-content: center;
    align-items: center;
    .event-orderNumber {
      margin-right: 10px;
    }
  }
}