Merge branch 'master' of http://139.196.74.78:10010/r/drone/drone-web-manage
12 files modified
1 files deleted
| | |
| | | |
| | | # 航线文件地址 |
| | | VITE_APP_AIRLINE_URL = https://wrj.shuixiongit.com/minio/cloud-bucket |
| | | # 图片存放地址 |
| | | VITE_APP_TERRAIN_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket |
| | | |
| | | # 是否在打包时开启压缩,支持 gzip 和 brotli |
| | | VITE_BUILD_COMPRESS = gzip |
| | |
| | | <meta http-equiv="X-UA-Compatible" content="chrome=1" /> |
| | | <meta name="renderer" content="webkit" /> |
| | | <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" /> |
| | | <meta name="apple-mobile-web-app-capable" content="yes" /> |
| | | <meta name="mobile-web-app-capable" content="yes" /> |
| | | <meta name="apple-mobile-web-app-status-bar-style" content="black" /> |
| | | <meta name="format-detection" content="telephone=no" /> |
| | | <link rel="icon" href="/img/bg/index_logo.png" /> |
| | | <link rel="icon" href="/img/bg/index_logo2.png" /> |
| | | <link rel="stylesheet" href="/iconfont/index.css" /> |
| | | <link rel="stylesheet" href="/iconfont/avue/iconfont.css" /> |
| | | <link rel="stylesheet" href="/iconfont/saber/iconfont.css" /> |
| | |
| | | import request from '@/axios'; |
| | | import request from '@/axios' |
| | | |
| | | export const getList = (data) => { |
| | | return request({ |
| | | url: '/drone-device-core/jobEvent/eventPage', |
| | | method: 'post', |
| | | data, |
| | | }); |
| | | }; |
| | | }) |
| | | } |
| | | |
| | | // 修改创建工单的方法 |
| | | export const createTicket = (data, file) => { |
| | | const formData = new FormData(); |
| | | |
| | | const formData = new FormData() |
| | | |
| | | // 创建 eventDto 对象,不显式设置 file 字段 |
| | | const eventDto = { |
| | | ...data // 直接使用传入的 data,不添加 file: null |
| | | }; |
| | | } |
| | | |
| | | // 添加所有字段到 FormData |
| | | Object.entries(eventDto).forEach(([key, value]) => { |
| | | formData.append(key, value); |
| | | }); |
| | | |
| | | formData.append(key, value) |
| | | }) |
| | | |
| | | // 只有当 file 存在时才添加文件 |
| | | if (file) { |
| | | formData.append("file", file); |
| | | formData.append("file", file) |
| | | } |
| | | |
| | | return request({ |
| | |
| | | headers: { |
| | | 'Content-Type': 'multipart/form-data' |
| | | } |
| | | }); |
| | | }; |
| | | }) |
| | | } |
| | | |
| | | // 新增接口:获取工单详细信息 |
| | | export const getTicketInfo = (id) => { |
| | |
| | | url: '/drone-device-core/jobEvent/getTicketInfo', |
| | | method: 'get', |
| | | params: { id }, // 使用工单 ID 查询 |
| | | }); |
| | | }; |
| | | }) |
| | | } |
| | | |
| | | // 修改接口:处理待审核状态,动态构建 FormData 提交 |
| | | export const flowEvent = (data, file) => { |
| | | const formData = new FormData(); |
| | | const formData = new FormData() |
| | | |
| | | // 动态添加非空字段到 FormData |
| | | Object.entries(data).forEach(([key, value]) => { |
| | | if (value !== undefined && value !== null) { |
| | | formData.append(key, value); |
| | | formData.append(key, value) |
| | | } |
| | | }); |
| | | }) |
| | | |
| | | // 如果 file 存在,则添加到 FormData |
| | | if (file) { |
| | | formData.append('file', file); |
| | | formData.append('file', file) |
| | | } |
| | | |
| | | return request({ |
| | |
| | | headers: { |
| | | 'Content-Type': 'multipart/form-data', // 设置为表单数据格式 |
| | | }, |
| | | }); |
| | | }; |
| | | }) |
| | | } |
| | | |
| | | // 新增接口:获取状态统计数据 |
| | | export const getstatusCount = (params) => { |
| | |
| | | url: '/drone-device-core/jobEvent/getstatusCount', |
| | | method: 'get', |
| | | params, |
| | | }); |
| | | }; |
| | | }) |
| | | } |
| | | |
| | | export const getStepInfo = (eventNum) => { |
| | | return request({ |
| | | url: '/drone-device-core/jobEvent/getStepInfo', |
| | | method: 'get', |
| | | params: { eventNum } |
| | | }); |
| | | }; |
| | | }) |
| | | } |
| | | |
| | | // 人工复核接口 |
| | | export const getReviewById = (id) => { |
| | | return request({ |
| | | url: `/drone-device-core/jobEvent/reviewById/${id}`, |
| | | method: 'get', |
| | | }) |
| | | } |
| | | |
| | | // 下发任务 |
| | | export const getCreateEventJob = (id) => { |
| | | return request({ |
| | | url: `/drone-device-core/wayline/waylineJobInfo/createEventJob/${id}`, |
| | | method: 'post', |
| | | }) |
| | | } |
| | |
| | | import { nextTick, onMounted, onUnmounted } from 'vue' |
| | | import { read } from 'xlsx' |
| | | |
| | | import startPng from '@/assets/map_images/Startingpointicon.png' |
| | | import endPng from '@/assets/map_images/EndPointicon.png' |
| | | |
| | | window.$viewer = null |
| | | window.$Cesium = null |
| | | let pointLayer = null |
| | | let polylineLayer = null |
| | | let pointHtmlLayer = null |
| | | |
| | | const { VITE_APP_BASE } = import.meta.env |
| | | // import * as Cesium from 'cesium' |
| | |
| | | window.$viewer?.addLayer(pointLayer) |
| | | polylineLayer = new DC.VectorLayer('polylineLayer') |
| | | window.$viewer?.addLayer(polylineLayer) |
| | | pointHtmlLayer = new DC.HtmlLayer('pointHtmlLayer') |
| | | window.$viewer?.addLayer(pointHtmlLayer) |
| | | |
| | | isViewerReady.value = true |
| | | } |
| | |
| | | |
| | | if (!lng || !lat) return |
| | | |
| | | let [newLng, newLat] = DC.CoordTransform.GCJ02ToWGS84(lng, lat) |
| | | |
| | | let point = new DC.Point(new DC.Position(newLng, newLat)) |
| | | let point = new DC.Point(new DC.Position(lng, lat)) |
| | | pointLayer.addOverlay(point) |
| | | |
| | | window.$viewer?.zoomTo(pointLayer) |
| | |
| | | */ |
| | | function addPolyline (data) { |
| | | if (polylineLayer) polylineLayer.clear() |
| | | if (pointHtmlLayer) pointHtmlLayer.clear() |
| | | |
| | | if (data.length === 0) return |
| | | |
| | | const positionStr = data.map(item => { |
| | | const [lng, lat] = item |
| | | |
| | | let [newLng, newLat] = DC.CoordTransform.GCJ02ToWGS84(lng, lat) |
| | | |
| | | return `${newLng}, ${newLat}` |
| | | return `${lng}, ${lat}` |
| | | }).join(';') |
| | | |
| | | let polyline = new DC.Polyline(positionStr) |
| | |
| | | }) |
| | | polylineLayer.addOverlay(polyline) |
| | | |
| | | |
| | | data.forEach((item, index) => { |
| | | const [lng, lat] = item |
| | | let position = new DC.Position(lng, lat) |
| | | |
| | | console.log(lng, lat) |
| | | let billboard = null |
| | | |
| | | if (index === 0) { |
| | | billboard = new DC.Billboard(position, startPng) |
| | | } |
| | | |
| | | if (index === data.length - 1) { |
| | | billboard = new DC.Billboard(position, endPng) |
| | | } |
| | | |
| | | |
| | | billboard && (billboard.size = [20, 20]) |
| | | billboard && (billboard.setStyle({ |
| | | "pixelOffset": { "x": 0, "y": -8 } |
| | | })) |
| | | billboard && polylineLayer.addOverlay(billboard) |
| | | |
| | | if (index !== 0 && index !== data.length - 1) { |
| | | let divIcon = new DC.DivIcon( |
| | | position, |
| | | `<div class="point-icon-box">${index}</div>` |
| | | ) |
| | | pointHtmlLayer.addOverlay(divIcon) |
| | | } |
| | | }) |
| | | |
| | | const line = turf.lineString(positionStr.split(';').map(i => i.split(','))) |
| | | const bbox = turf.bbox(line) |
| | | const bboxPolygon = turf.bboxPolygon(bbox) |
| | |
| | | menu: true, |
| | | }, |
| | | fistPage: { |
| | | name: '首页', |
| | | path: '/wel/index', |
| | | name: '事件工单', |
| | | // path: '/wel/index', |
| | | path: '/tickets/ticket', |
| | | |
| | | }, |
| | | //配置菜单的属性 |
| | | menu: { |
| | |
| | | isAuth: false, |
| | | }, |
| | | }, |
| | | // { |
| | | // path: '/', |
| | | // name: '主页', |
| | | // // redirect: '/wel', |
| | | // redirect:'/tickets/ticket', |
| | | // }, |
| | | { |
| | | path: '/', |
| | | name: '主页', |
| | | redirect: '/wel', |
| | | }, |
| | | path: '/', |
| | | name: '主页', |
| | | redirect: '/tickets/ticket', |
| | | }, |
| | | ]; |
| | |
| | | }, |
| | | ], |
| | | }, |
| | | // 事件工单 |
| | | { |
| | | path: '/tickets', |
| | | component: () => |
| | | Store.getters.isMacOs ? import('@/mac/index.vue') : import('@/page/index/index.vue'), |
| | | redirect: '/tickets/ticket', |
| | | children: [ |
| | | { |
| | | path: 'ticket', |
| | | name: '事件工单', |
| | | meta: { |
| | | i18n: 'dashboard', |
| | | }, |
| | | component: () => import(/* webpackChunkName: "views" */ '@/views/tickets/ticket.vue'), |
| | | }, |
| | | ], |
| | | }, |
| | | |
| | | { |
| | | path: '/test', |
| | | component: Layout, |
| | |
| | | .avue-sidebar, |
| | | .avue-top, |
| | | .avue-logo, |
| | | .avue-layout |
| | | .login-logo, |
| | | .avue-layout .login-logo, |
| | | .avue-main { |
| | | transition: all .3s; |
| | | } |
| | |
| | | height: $top_height; |
| | | display: flex; |
| | | |
| | | .avue-menu, .el-menu-item, .el-sub-menu__title { |
| | | .avue-menu, |
| | | .el-menu-item, |
| | | .el-sub-menu__title { |
| | | height: $top_height; |
| | | line-height: $top_height; |
| | | } |
| | |
| | | } |
| | | |
| | | .avue--collapse { |
| | | |
| | | .avue-sidebar, |
| | | .avue-logo { |
| | | width: $sidebar_collapse; |
| | |
| | | @import './media.scss'; |
| | | //滚动条样式 |
| | | @include scrollBar; |
| | | |
| | | |
| | | // 地图区域html标签样式调整 |
| | | .div-icon { |
| | | padding: 0px !important; |
| | | border: none !important; |
| | | background: transparent !important; |
| | | border-radius: 50% !important; |
| | | |
| | | .point-icon-box { |
| | | width: 28px; |
| | | height: 28px; |
| | | line-height: 28px; |
| | | text-align: center; |
| | | font-size: 16px; |
| | | color: #fff; |
| | | background: rgb(255, 186, 0); |
| | | border-radius: 50%; |
| | | } |
| | | } |
| | |
| | | import { validatenull } from './validate'; |
| | | import sha256 from 'crypto-js/sha256'; |
| | | import Base64 from 'crypto-js/enc-base64'; |
| | | import { validatenull } from './validate' |
| | | import sha256 from 'crypto-js/sha256' |
| | | import Base64 from 'crypto-js/enc-base64' |
| | | //表单序列化 |
| | | export const serialize = data => { |
| | | let list = []; |
| | | let list = [] |
| | | Object.keys(data).forEach(ele => { |
| | | list.push(`${ele}=${data[ele]}`); |
| | | }); |
| | | return list.join('&'); |
| | | }; |
| | | list.push(`${ele}=${data[ele]}`) |
| | | }) |
| | | return list.join('&') |
| | | } |
| | | export const getObjType = obj => { |
| | | var toString = Object.prototype.toString; |
| | | var toString = Object.prototype.toString |
| | | var map = { |
| | | '[object Boolean]': 'boolean', |
| | | '[object Number]': 'number', |
| | |
| | | '[object Undefined]': 'undefined', |
| | | '[object Null]': 'null', |
| | | '[object Object]': 'object', |
| | | }; |
| | | if (obj instanceof Element) { |
| | | return 'element'; |
| | | } |
| | | return map[toString.call(obj)]; |
| | | }; |
| | | if (obj instanceof Element) { |
| | | return 'element' |
| | | } |
| | | return map[toString.call(obj)] |
| | | } |
| | | /** |
| | | * 对象深拷贝 |
| | | */ |
| | | export const deepClone = data => { |
| | | var type = getObjType(data); |
| | | var obj; |
| | | var type = getObjType(data) |
| | | var obj |
| | | if (type === 'array') { |
| | | obj = []; |
| | | obj = [] |
| | | } else if (type === 'object') { |
| | | obj = {}; |
| | | obj = {} |
| | | } else { |
| | | //不再具有下一层次 |
| | | return data; |
| | | return data |
| | | } |
| | | if (type === 'array') { |
| | | for (var i = 0, len = data.length; i < len; i++) { |
| | | obj.push(deepClone(data[i])); |
| | | obj.push(deepClone(data[i])) |
| | | } |
| | | } else if (type === 'object') { |
| | | for (var key in data) { |
| | | obj[key] = deepClone(data[key]); |
| | | obj[key] = deepClone(data[key]) |
| | | } |
| | | } |
| | | return obj; |
| | | }; |
| | | return obj |
| | | } |
| | | /** |
| | | * 设置灰度模式 |
| | | */ |
| | | export const toggleGrayMode = status => { |
| | | if (status) { |
| | | document.body.className = document.body.className + ' grayMode'; |
| | | document.body.className = document.body.className + ' grayMode' |
| | | } else { |
| | | document.body.className = document.body.className.replace(' grayMode', ''); |
| | | document.body.className = document.body.className.replace(' grayMode', '') |
| | | } |
| | | }; |
| | | } |
| | | /** |
| | | * 设置主题 |
| | | */ |
| | | export const setTheme = name => { |
| | | document.body.className = name; |
| | | }; |
| | | document.body.className = name |
| | | } |
| | | |
| | | /** |
| | | * 加密处理 |
| | | */ |
| | | export const encryption = params => { |
| | | let { data = {}, type, param, key } = params; |
| | | let result = JSON.parse(JSON.stringify(data)); |
| | | let { data = {}, type, param, key } = params |
| | | let result = JSON.parse(JSON.stringify(data)) |
| | | if (type == 'Base64') { |
| | | param.forEach(ele => { |
| | | result[ele] = Base64.stringify(result[ele]); |
| | | }); |
| | | result[ele] = Base64.stringify(result[ele]) |
| | | }) |
| | | } else if (type == 'Aes') { |
| | | param.forEach(ele => { |
| | | result[ele] = sha256(result[ele], key); |
| | | }); |
| | | result[ele] = sha256(result[ele], key) |
| | | }) |
| | | } |
| | | return result; |
| | | }; |
| | | return result |
| | | } |
| | | |
| | | /** |
| | | * 浏览器判断是否全屏 |
| | | */ |
| | | export const fullscreenToggel = () => { |
| | | if (fullscreenEnable()) { |
| | | exitFullScreen(); |
| | | exitFullScreen() |
| | | } else { |
| | | reqFullScreen(); |
| | | reqFullScreen() |
| | | } |
| | | }; |
| | | } |
| | | /** |
| | | * esc监听全屏 |
| | | */ |
| | | export const listenfullscreen = callback => { |
| | | function listen() { |
| | | callback(); |
| | | function listen () { |
| | | callback() |
| | | } |
| | | |
| | | document.addEventListener('fullscreenchange', function () { |
| | | listen(); |
| | | }); |
| | | listen() |
| | | }) |
| | | document.addEventListener('mozfullscreenchange', function () { |
| | | listen(); |
| | | }); |
| | | listen() |
| | | }) |
| | | document.addEventListener('webkitfullscreenchange', function () { |
| | | listen(); |
| | | }); |
| | | listen() |
| | | }) |
| | | document.addEventListener('msfullscreenchange', function () { |
| | | listen(); |
| | | }); |
| | | }; |
| | | listen() |
| | | }) |
| | | } |
| | | /** |
| | | * 浏览器判断是否全屏 |
| | | */ |
| | | export const fullscreenEnable = () => { |
| | | var isFullscreen = |
| | | document.isFullScreen || document.mozIsFullScreen || document.webkitIsFullScreen; |
| | | return isFullscreen; |
| | | }; |
| | | document.isFullScreen || document.mozIsFullScreen || document.webkitIsFullScreen |
| | | return isFullscreen |
| | | } |
| | | |
| | | /** |
| | | * 浏览器全屏 |
| | | */ |
| | | export const reqFullScreen = () => { |
| | | if (document.documentElement.requestFullScreen) { |
| | | document.documentElement.requestFullScreen(); |
| | | document.documentElement.requestFullScreen() |
| | | } else if (document.documentElement.webkitRequestFullScreen) { |
| | | document.documentElement.webkitRequestFullScreen(); |
| | | document.documentElement.webkitRequestFullScreen() |
| | | } else if (document.documentElement.mozRequestFullScreen) { |
| | | document.documentElement.mozRequestFullScreen(); |
| | | document.documentElement.mozRequestFullScreen() |
| | | } |
| | | }; |
| | | } |
| | | /** |
| | | * 浏览器退出全屏 |
| | | */ |
| | | export const exitFullScreen = () => { |
| | | if (document.documentElement.requestFullScreen) { |
| | | document.exitFullScreen(); |
| | | document.exitFullScreen() |
| | | } else if (document.documentElement.webkitRequestFullScreen) { |
| | | document.webkitCancelFullScreen(); |
| | | document.webkitCancelFullScreen() |
| | | } else if (document.documentElement.mozRequestFullScreen) { |
| | | document.mozCancelFullScreen(); |
| | | document.mozCancelFullScreen() |
| | | } |
| | | }; |
| | | } |
| | | /** |
| | | * 递归寻找子类的父类 |
| | | */ |
| | |
| | | if (menu[i].children.length != 0) { |
| | | for (let j = 0; j < menu[i].children.length; j++) { |
| | | if (menu[i].children[j].id == id) { |
| | | return menu[i]; |
| | | return menu[i] |
| | | } else { |
| | | if (menu[i].children[j].children.length != 0) { |
| | | return findParent(menu[i].children[j].children, id); |
| | | return findParent(menu[i].children[j].children, id) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | /** |
| | | * 判断2个对象属性和值是否相等 |
| | | */ |
| | |
| | | */ |
| | | |
| | | export const loadStyle = url => { |
| | | const link = document.createElement('link'); |
| | | link.type = 'text/css'; |
| | | link.rel = 'stylesheet'; |
| | | link.href = url; |
| | | const head = document.getElementsByTagName('head')[0]; |
| | | head.appendChild(link); |
| | | }; |
| | | const link = document.createElement('link') |
| | | link.type = 'text/css' |
| | | link.rel = 'stylesheet' |
| | | link.href = url |
| | | const head = document.getElementsByTagName('head')[0] |
| | | head.appendChild(link) |
| | | } |
| | | /** |
| | | * 判断路由是否相等 |
| | | */ |
| | | export const diff = (obj1, obj2) => { |
| | | delete obj1.close; |
| | | var o1 = obj1 instanceof Object; |
| | | var o2 = obj2 instanceof Object; |
| | | delete obj1.close |
| | | var o1 = obj1 instanceof Object |
| | | var o2 = obj2 instanceof Object |
| | | if (!o1 || !o2) { |
| | | /* 判断不是对象 */ |
| | | return obj1 === obj2; |
| | | return obj1 === obj2 |
| | | } |
| | | |
| | | if (Object.keys(obj1).length !== Object.keys(obj2).length) { |
| | | return false; |
| | | return false |
| | | //Object.keys() 返回一个由对象的自身可枚举属性(key值)组成的数组,例如:数组返回下表:let arr = ["a", "b", "c"];console.log(Object.keys(arr))->0,1,2; |
| | | } |
| | | |
| | | for (var attr in obj1) { |
| | | var t1 = obj1[attr] instanceof Object; |
| | | var t2 = obj2[attr] instanceof Object; |
| | | var t1 = obj1[attr] instanceof Object |
| | | var t2 = obj2[attr] instanceof Object |
| | | if (t1 && t2) { |
| | | return diff(obj1[attr], obj2[attr]); |
| | | return diff(obj1[attr], obj2[attr]) |
| | | } else if (obj1[attr] !== obj2[attr]) { |
| | | return false; |
| | | return false |
| | | } |
| | | } |
| | | return true; |
| | | }; |
| | | return true |
| | | } |
| | | /** |
| | | * 根据字典的value显示label |
| | | */ |
| | | export const findByvalue = (dic, value) => { |
| | | let result = ''; |
| | | if (validatenull(dic)) return value; |
| | | let result = '' |
| | | if (validatenull(dic)) return value |
| | | if (typeof value == 'string' || typeof value == 'number' || typeof value == 'boolean') { |
| | | let index = 0; |
| | | index = findArray(dic, value); |
| | | let index = 0 |
| | | index = findArray(dic, value) |
| | | if (index != -1) { |
| | | result = dic[index].label; |
| | | result = dic[index].label |
| | | } else { |
| | | result = value; |
| | | result = value |
| | | } |
| | | } else if (value instanceof Array) { |
| | | result = []; |
| | | let index = 0; |
| | | result = [] |
| | | let index = 0 |
| | | value.forEach(ele => { |
| | | index = findArray(dic, ele); |
| | | index = findArray(dic, ele) |
| | | if (index != -1) { |
| | | result.push(dic[index].label); |
| | | result.push(dic[index].label) |
| | | } else { |
| | | result.push(value); |
| | | result.push(value) |
| | | } |
| | | }); |
| | | result = result.toString(); |
| | | }) |
| | | result = result.toString() |
| | | } |
| | | return result; |
| | | }; |
| | | return result |
| | | } |
| | | /** |
| | | * 根据字典的value查找对应的index |
| | | */ |
| | | export const findArray = (dic, value) => { |
| | | for (let i = 0; i < dic.length; i++) { |
| | | if (dic[i].value == value) { |
| | | return i; |
| | | return i |
| | | } |
| | | } |
| | | return -1; |
| | | }; |
| | | return -1 |
| | | } |
| | | /** |
| | | * 生成随机len位数字 |
| | | */ |
| | | export const randomLenNum = (len, date) => { |
| | | let random = ''; |
| | | let random = '' |
| | | random = Math.ceil(Math.random() * 100000000000000) |
| | | .toString() |
| | | .substr(0, len ? len : 4); |
| | | if (date) random = random + Date.now(); |
| | | return random; |
| | | }; |
| | | .substr(0, len ? len : 4) |
| | | if (date) random = random + Date.now() |
| | | return random |
| | | } |
| | | /** |
| | | * 打开小窗口 |
| | | */ |
| | | export const openWindow = (url, title, w, h) => { |
| | | // Fixes dual-screen position Most browsers Firefox |
| | | const dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left; |
| | | const dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top; |
| | | const dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left |
| | | const dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top |
| | | |
| | | const width = window.innerWidth |
| | | ? window.innerWidth |
| | | : document.documentElement.clientWidth |
| | | ? document.documentElement.clientWidth |
| | | : screen.width; |
| | | ? document.documentElement.clientWidth |
| | | : screen.width |
| | | const height = window.innerHeight |
| | | ? window.innerHeight |
| | | : document.documentElement.clientHeight |
| | | ? document.documentElement.clientHeight |
| | | : screen.height; |
| | | ? document.documentElement.clientHeight |
| | | : screen.height |
| | | |
| | | const left = width / 2 - w / 2 + dualScreenLeft; |
| | | const top = height / 2 - h / 2 + dualScreenTop; |
| | | const left = width / 2 - w / 2 + dualScreenLeft |
| | | const top = height / 2 - h / 2 + dualScreenTop |
| | | const newWindow = window.open( |
| | | url, |
| | | title, |
| | | 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=' + |
| | | w + |
| | | ', height=' + |
| | | h + |
| | | ', top=' + |
| | | top + |
| | | ', left=' + |
| | | left |
| | | ); |
| | | w + |
| | | ', height=' + |
| | | h + |
| | | ', top=' + |
| | | top + |
| | | ', left=' + |
| | | left |
| | | ) |
| | | |
| | | // Puts focus on the newWindow |
| | | if (window.focus) { |
| | | newWindow.focus(); |
| | | newWindow.focus() |
| | | } |
| | | }; |
| | | } |
| | | |
| | | export const getScreen = isCollapse => { |
| | | if (document.body.clientWidth <= 768) { |
| | | return !isCollapse; |
| | | return !isCollapse |
| | | } else { |
| | | return isCollapse; |
| | | return isCollapse |
| | | } |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * 获取顶部地址栏地址 |
| | | */ |
| | | export const getTopUrl = () => { |
| | | return window.location.href.split('/#/')[0]; |
| | | }; |
| | | return window.location.href.split('/#/')[0] |
| | | } |
| | | |
| | | /** |
| | | * 获取url参数 |
| | | * @param name 参数名 |
| | | */ |
| | | export const getQueryString = name => { |
| | | let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i'); |
| | | let r = window.location.search.substr(1).match(reg); |
| | | if (r != null) return unescape(decodeURI(r[2])); |
| | | return null; |
| | | }; |
| | | let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i') |
| | | let r = window.location.search.substr(1).match(reg) |
| | | if (r != null) return unescape(decodeURI(r[2])) |
| | | return null |
| | | } |
| | | |
| | | /** |
| | | * 下载文件 |
| | |
| | | * @param {String} name - 文件名,eg: test.png |
| | | */ |
| | | export const downloadFileBlob = (path, name) => { |
| | | const xhr = new XMLHttpRequest(); |
| | | xhr.open('get', path); |
| | | xhr.responseType = 'blob'; |
| | | xhr.send(); |
| | | const xhr = new XMLHttpRequest() |
| | | xhr.open('get', path) |
| | | xhr.responseType = 'blob' |
| | | xhr.send() |
| | | xhr.onload = function () { |
| | | if (this.status === 200 || this.status === 304) { |
| | | // 如果是IE10及以上,不支持download属性,采用msSaveOrOpenBlob方法,但是IE10以下也不支持msSaveOrOpenBlob |
| | | if ('msSaveOrOpenBlob' in navigator) { |
| | | navigator.msSaveOrOpenBlob(this.response, name); |
| | | return; |
| | | navigator.msSaveOrOpenBlob(this.response, name) |
| | | return |
| | | } |
| | | const url = URL.createObjectURL(this.response); |
| | | const a = document.createElement('a'); |
| | | a.style.display = 'none'; |
| | | a.href = url; |
| | | a.download = name; |
| | | document.body.appendChild(a); |
| | | a.click(); |
| | | document.body.removeChild(a); |
| | | URL.revokeObjectURL(url); |
| | | const url = URL.createObjectURL(this.response) |
| | | const a = document.createElement('a') |
| | | a.style.display = 'none' |
| | | a.href = url |
| | | a.download = name |
| | | document.body.appendChild(a) |
| | | a.click() |
| | | document.body.removeChild(a) |
| | | URL.revokeObjectURL(url) |
| | | } |
| | | }; |
| | | }; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 下载文件 |
| | |
| | | * @param {String} name - 文件名,eg: test.png |
| | | */ |
| | | export const downloadFileBase64 = (path, name) => { |
| | | const xhr = new XMLHttpRequest(); |
| | | xhr.open('get', path); |
| | | xhr.responseType = 'blob'; |
| | | xhr.send(); |
| | | const xhr = new XMLHttpRequest() |
| | | xhr.open('get', path) |
| | | xhr.responseType = 'blob' |
| | | xhr.send() |
| | | xhr.onload = function () { |
| | | if (this.status === 200 || this.status === 304) { |
| | | const fileReader = new FileReader(); |
| | | fileReader.readAsDataURL(this.response); |
| | | const fileReader = new FileReader() |
| | | fileReader.readAsDataURL(this.response) |
| | | fileReader.onload = function () { |
| | | const a = document.createElement('a'); |
| | | a.style.display = 'none'; |
| | | a.href = this.result; |
| | | a.download = name; |
| | | document.body.appendChild(a); |
| | | a.click(); |
| | | document.body.removeChild(a); |
| | | }; |
| | | const a = document.createElement('a') |
| | | a.style.display = 'none' |
| | | a.href = this.result |
| | | a.download = name |
| | | document.body.appendChild(a) |
| | | a.click() |
| | | document.body.removeChild(a) |
| | | } |
| | | } |
| | | }; |
| | | }; |
| | | } |
| | | } |
| | | /** |
| | | * 下载excel |
| | | * @param {blob} fileArrayBuffer 文件流 |
| | | * @param {String} filename 文件名称 |
| | | */ |
| | | export const downloadXls = (fileArrayBuffer, filename) => { |
| | | let data = new Blob([fileArrayBuffer], { type: 'application/vnd.ms-excel,charset=utf-8' }); |
| | | let data = new Blob([fileArrayBuffer], { type: 'application/vnd.ms-excel,charset=utf-8' }) |
| | | if (typeof window.chrome !== 'undefined') { |
| | | // Chrome |
| | | var link = document.createElement('a'); |
| | | link.href = window.URL.createObjectURL(data); |
| | | link.download = filename; |
| | | link.click(); |
| | | var link = document.createElement('a') |
| | | link.href = window.URL.createObjectURL(data) |
| | | link.download = filename |
| | | link.click() |
| | | } else if (typeof window.navigator.msSaveBlob !== 'undefined') { |
| | | // IE |
| | | var blob = new Blob([data], { type: 'application/force-download' }); |
| | | window.navigator.msSaveBlob(blob, filename); |
| | | var blob = new Blob([data], { type: 'application/force-download' }) |
| | | window.navigator.msSaveBlob(blob, filename) |
| | | } else { |
| | | // Firefox |
| | | var file = new File([data], filename, { type: 'application/force-download' }); |
| | | window.open(URL.createObjectURL(file)); |
| | | var file = new File([data], filename, { type: 'application/force-download' }) |
| | | window.open(URL.createObjectURL(file)) |
| | | } |
| | | }; |
| | | } |
| | | |
| | | export const calculateDefaultRange = () => { |
| | | const now = new Date() |
| | | const currentYear = now.getFullYear() |
| | | const currentMonth = now.getMonth() // 0-11 |
| | | |
| | | // 计算上个月 |
| | | let lastMonthYear = currentYear |
| | | let lastMonth = currentMonth - 1 |
| | | if (lastMonth < 0) { |
| | | lastMonth = 11 |
| | | lastMonthYear = currentYear - 1 |
| | | } |
| | | |
| | | // 设置默认范围 [上个月, 当前月] |
| | | return [new Date(lastMonthYear, lastMonth, 1), new Date(currentYear, currentMonth, 1)] |
| | | } |
| | |
| | | <template> |
| | | <basic-container> |
| | | <avue-crud |
| | | :option="option" |
| | | :table-loading="loading" |
| | | :data="data" |
| | | ref="crud" |
| | | v-model="form" |
| | | :permission="permissionList" |
| | | :before-open="beforeOpen" |
| | | :before-close="beforeClose" |
| | | @row-del="rowDel" |
| | | @row-update="rowUpdate" |
| | | @row-save="rowSave" |
| | | @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" |
| | | v-if="permission.dept_delete" |
| | | plain |
| | | @click="handleDelete" |
| | | > |
| | | 删除 |
| | | </el-button> |
| | | </template> |
| | | <template #menu="scope"> |
| | | <el-button |
| | | type="primary" |
| | | text |
| | | icon="el-icon-plus" |
| | | @click.stop="handleAdd(scope.row, scope.index)" |
| | | v-if="userInfo.role_name.includes('admin')" |
| | | > |
| | | 新增子项 |
| | | </el-button> |
| | | </template> |
| | | <template #deptCategory="{ row }"> |
| | | <el-tag>{{ row.deptCategoryName }}</el-tag> |
| | | </template> |
| | | <!-- 自定义 areaCode 的显示模板,确保显示单一值 --> |
| | | <template #areaCode="{ row }"> |
| | | <span>{{ row.areaName }}</span> |
| | | </template> |
| | | </avue-crud> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | getLazyList, |
| | | getChildLazyTree, |
| | | remove, |
| | | update, |
| | | add, |
| | | getDept, |
| | | getDeptTree, |
| | | } from '@/api/system/dept'; |
| | | import { getLazyTree } from '@/api/base/region'; |
| | | import { mapGetters } from 'vuex'; |
| | | import website from '@/config/website'; |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | form: {}, |
| | | selectionList: [], |
| | | query: {}, |
| | | loading: true, |
| | | parentId: 0, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0, |
| | | }, |
| | | option: { |
| | | lazy: true, |
| | | tip: false, |
| | | simplePage: true, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | tree: true, |
| | | border: true, |
| | | index: true, |
| | | selection: true, |
| | | viewBtn: true, |
| | | menuWidth: 320, |
| | | dialogClickModal: false, |
| | | column: [ |
| | | { |
| | | label: '机构名称', |
| | | prop: 'deptName', |
| | | search: true, |
| | | labelWidth: 120, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请输入机构名称', |
| | | trigger: 'blur', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: '机构全称', |
| | | prop: 'fullName', |
| | | search: true, |
| | | labelWidth: 120, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请输入机构全称', |
| | | trigger: 'blur', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: '上级机构', |
| | | prop: 'parentId', |
| | | dicData: [], |
| | | type: 'tree', |
| | | hide: true, |
| | | addDisabled: false, |
| | | props: { |
| | | label: 'name', |
| | | value: 'id', |
| | | }, |
| | | labelWidth: 120, |
| | | rules: [ |
| | | { |
| | | required: false, |
| | | message: '请选择上级机构', |
| | | trigger: 'click', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: '机构类型', |
| | | type: 'select', |
| | | dicUrl: '/blade-system/dict/dictionary?code=org_category', |
| | | props: { |
| | | label: 'dictValue', |
| | | value: 'dictKey', |
| | | }, |
| | | dataType: 'number', |
| | | width: 120, |
| | | labelWidth: 120, |
| | | prop: 'deptCategory', |
| | | slot: true, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请输入机构类型', |
| | | trigger: 'blur', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: '机构性质', |
| | | type: 'select', |
| | | dicUrl: '/blade-system/dict/dictionary?code=org_nature', |
| | | props: { |
| | | label: 'dictValue', |
| | | value: 'dictKey', |
| | | }, |
| | | dataType: 'number', |
| | | width: 120, |
| | | labelWidth: 120, |
| | | prop: 'deptNature', |
| | | slot: true, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请输入机构性质', |
| | | trigger: 'blur', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: '排序', |
| | | prop: 'sort', |
| | | type: 'number', |
| | | align: 'right', |
| | | labelWidth: 120, |
| | | width: 80, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请输入排序', |
| | | trigger: 'blur', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: '组织id', |
| | | prop: 'bingId', |
| | | type: 'number', |
| | | align: 'right', |
| | | labelWidth: 120, |
| | | addDisplay: false, |
| | | editDisplay: false, |
| | | width: 80, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请输入组织id', |
| | | trigger: 'blur', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: '行政区划', |
| | | prop: 'areaCode', |
| | | checkStrictly: true, |
| | | type: 'cascader', |
| | | labelWidth: 120, |
| | | props: { |
| | | label: 'title', |
| | | value: 'value', |
| | | emitPath: false, // 只返回最后选中的值 |
| | | checkStrictly: true, // 可以选择任意一级 |
| | | multiple: false, // 确保只能单选 |
| | | expandTrigger: 'hover' // 鼠标悬停时展开子菜单 |
| | | }, |
| | | dataType: 'string', // 使用字符串类型 |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请选择行政区划', |
| | | trigger: 'change' |
| | | } |
| | | ], |
| | | change: ({ value }) => { |
| | | if (!value) { |
| | | this.form.areaCode = null; // 未选择时置为空 |
| | | } else { |
| | | // 如果 value 是逗号分隔的字符串,拆分并取最后一个值 |
| | | if (typeof value === 'string' && value.includes(',')) { |
| | | const codes = value.split(','); |
| | | this.form.areaCode = codes[codes.length - 1]; |
| | | } else { |
| | | this.form.areaCode = value; // 直接使用单一值 |
| | | } |
| | | } |
| | | console.log('cascader change value:', value); |
| | | console.log('处理后的区县编码:', this.form.areaCode); |
| | | }, |
| | | lazy: true, |
| | | lazyLoad(node, resolve) { |
| | | let level = node.level; |
| | | let list = []; |
| | | let callback = () => { |
| | | resolve( |
| | | (list || []).map((ele) => ({ |
| | | ...ele, |
| | | value: ele.value, // 保持原始值类型(字符串) |
| | | leaf: level >= 2 // 县级为最后一级 |
| | | })) |
| | | ); |
| | | }; |
| | | |
| | | if (level === 0) { |
| | | getLazyTree('000000000000').then((res) => { |
| | | list = res.data.data; |
| | | callback(); |
| | | }); |
| | | } else if (level === 1) { |
| | | getLazyTree(node.value).then((res) => { |
| | | list = res.data.data; |
| | | callback(); |
| | | }); |
| | | } else if (level === 2) { |
| | | getLazyTree(node.value).then((res) => { |
| | | list = res.data.data; |
| | | callback(); |
| | | }); |
| | | } else { |
| | | callback(); |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | label: '备注', |
| | | prop: 'remark', |
| | | labelWidth: 120, |
| | | rules: [ |
| | | { |
| | | required: false, |
| | | message: '请输入备注', |
| | | trigger: 'blur', |
| | | }, |
| | | ], |
| | | hide: true, |
| | | }, |
| | | ], |
| | | }, |
| | | data: [], |
| | | }; |
| | | }, |
| | | computed: { |
| | | ...mapGetters(['userInfo', 'permission']), |
| | | permissionList() { |
| | | return { |
| | | addBtn: this.validData(this.permission.dept_add, false), |
| | | viewBtn: this.validData(this.permission.dept_view, false), |
| | | delBtn: this.validData(this.permission.dept_delete, false), |
| | | editBtn: this.validData(this.permission.dept_edit, false), |
| | | }; |
| | | }, |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach((ele) => { |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(','); |
| | | }, |
| | | }, |
| | | methods: { |
| | | initData() { |
| | | getDeptTree().then((res) => { |
| | | const column = this.findObject(this.option.column, 'parentId'); |
| | | column.dicData = res.data.data; |
| | | }); |
| | | }, |
| | | handleAdd(row) { |
| | | this.parentId = row.id; |
| | | const column = this.findObject(this.option.column, 'parentId'); |
| | | column.value = row.id; |
| | | column.addDisabled = true; |
| | | this.form.areaCode = null; // 初始化为空 |
| | | this.$refs.crud.rowAdd(); |
| | | }, |
| | | validateSubmitData(row) { |
| | | if (!row.areaCode) { |
| | | this.$message.warning('请选择行政区划'); |
| | | return false; |
| | | } |
| | | return true; |
| | | }, |
| | | rowSave(row, done, loading) { |
| | | if (!this.validateSubmitData(row)) { |
| | | loading(); |
| | | return; |
| | | } |
| | | console.log('--- Start rowSave ---'); |
| | | console.log('Form data before save:', this.form); |
| | | |
| | | // 处理 areaCode,确保只取最后一个值 |
| | | let areaCode = this.form.areaCode; |
| | | if (Array.isArray(areaCode)) { |
| | | areaCode = areaCode[areaCode.length - 1]; // 数组取最后一个 |
| | | } else if (typeof areaCode === 'string' && areaCode.includes(',')) { |
| | | const codes = areaCode.split(','); |
| | | areaCode = codes[codes.length - 1]; // 字符串拆分取最后一个 |
| | | } |
| | | row.areaCode = areaCode || null; // 确保非空 |
| | | |
| | | console.log('Row data before submit:', row); |
| | | |
| | | add(row).then( |
| | | (res) => { |
| | | console.log('Save response:', res.data); |
| | | const data = res.data.data; |
| | | row.id = data.id; |
| | | row.deptCategoryName = data.deptCategoryName; |
| | | row.tenantId = data.tenantId; |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '操作成功!' |
| | | }); |
| | | this.onLoad(this.page); |
| | | done(row); |
| | | }, |
| | | (error) => { |
| | | console.log('Save error:', error); |
| | | this.loading = false; |
| | | loading(); |
| | | } |
| | | ); |
| | | }, |
| | | rowUpdate(row, index, done, loading) { |
| | | if (!this.validateSubmitData(row)) { |
| | | loading(); |
| | | return; |
| | | } |
| | | console.log('--- Start rowUpdate ---'); |
| | | |
| | | // 提交时只使用县级代码 |
| | | const submitData = { |
| | | ...row, |
| | | areaCode: row.areaCode.split(',').pop() // 取最后一个代码(县级) |
| | | }; |
| | | |
| | | console.log('Row data before submit:', row); |
| | | |
| | | update(submitData).then( |
| | | (res) => { |
| | | console.log('Update response:', res.data); |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '操作成功!', |
| | | }); |
| | | this.onLoad(this.page); |
| | | done(row); |
| | | }, |
| | | (error) => { |
| | | console.log('Update error:', error); |
| | | this.loading = false; |
| | | loading(); |
| | | } |
| | | ).catch((error) => { |
| | | console.log('Update promise rejected:', error); |
| | | this.loading = false; |
| | | }); |
| | | }, |
| | | rowDel(row, index, done) { |
| | | this.$confirm('确定将选择数据删除?', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | .then(() => { |
| | | return remove(row.id); |
| | | }) |
| | | .then(() => { |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '操作成功!', |
| | | }); |
| | | this.onLoad(this.page); |
| | | done(row); |
| | | }); |
| | | }, |
| | | handleDelete() { |
| | | if (this.selectionList.length === 0) { |
| | | this.$message.warning('请选择至少一条数据'); |
| | | return; |
| | | } |
| | | this.$confirm('确定将选择数据删除?', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | .then(() => { |
| | | return remove(this.ids); |
| | | }) |
| | | .then(() => { |
| | | this.data = []; |
| | | this.parentId = 0; |
| | | this.$refs.crud.refreshTable(); |
| | | this.$refs.crud.toggleSelection(); |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '操作成功!', |
| | | }); |
| | | }); |
| | | }, |
| | | searchReset() { |
| | | this.query = {}; |
| | | this.parentId = 0; |
| | | this.onLoad(this.page); |
| | | }, |
| | | searchChange(params, done) { |
| | | this.query = params; |
| | | this.parentId = ''; |
| | | this.page.currentPage = 1; |
| | | this.onLoad(this.page, params); |
| | | done(); |
| | | }, |
| | | selectionChange(list) { |
| | | this.selectionList = list; |
| | | }, |
| | | selectionClear() { |
| | | this.selectionList = []; |
| | | this.$refs.crud.toggleSelection(); |
| | | }, |
| | | beforeOpen(done, type) { |
| | | if (['add', 'edit'].includes(type)) { |
| | | this.initData(); |
| | | } |
| | | if (['edit', 'view'].includes(type)) { |
| | | getDept(this.form.id).then((res) => { |
| | | const areaCode = res.data.data.areaCode; |
| | | const areaName = res.data.data.areaName; |
| | | |
| | | // 生成完整的行政区划代码 |
| | | const fullAreaCode = this.getFullAreaCode(areaCode); |
| | | |
| | | this.form = Object.assign({}, res.data.data, { |
| | | hasChildren: this.form.hasChildren, |
| | | // 使用完整的行政区划代码 |
| | | areaCode: fullAreaCode, |
| | | areaName: areaName || '', |
| | | }); |
| | | }); |
| | | } else if (type === 'add') { |
| | | this.form.areaCode = ''; |
| | | this.form.areaName = ''; |
| | | } |
| | | done(); |
| | | }, |
| | | beforeClose(done) { |
| | | this.parentId = ''; |
| | | const column = this.findObject(this.option.column, 'parentId'); |
| | | column.value = ''; |
| | | column.addDisabled = false; |
| | | this.form.areaCode = null; |
| | | done(); |
| | | }, |
| | | currentChange(currentPage) { |
| | | this.page.currentPage = currentPage; |
| | | this.onLoad(this.page); |
| | | }, |
| | | sizeChange(pageSize) { |
| | | this.page.pageSize = pageSize; |
| | | this.onLoad(this.page); |
| | | }, |
| | | refreshChange() { |
| | | this.onLoad(this.page, this.query); |
| | | }, |
| | | onLoad(page, params = {}) { |
| | | this.loading = true; |
| | | console.log('onLoad triggered with page:', page, 'params:', params); |
| | | console.log('Current parentId:', this.parentId, 'query:', this.query); |
| | | getLazyList(this.parentId, Object.assign(params, this.query)).then((res) => { |
| | | console.log('onLoad response:', res.data); |
| | | // 处理 areaCode,确保是单一字符串 |
| | | const data = (res.data.data || []).map(item => { |
| | | const fullAreaCode = this.getFullAreaCode(item.areaCode); |
| | | return { |
| | | ...item, |
| | | // 保存完整的行政区划代码 |
| | | areaCode: fullAreaCode, |
| | | // 使用原始的县级代码作为实际值 |
| | | originalAreaCode: item.areaCode |
| | | }; |
| | | }); |
| | | this.data = data; |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | console.log('Table data after onLoad:', this.data); |
| | | }).catch((error) => { |
| | | console.log('onLoad error:', error); |
| | | this.loading = false; |
| | | this.data = this.data; // 保留当前数据 |
| | | console.log('Table data after onLoad error:', this.data); |
| | | }); |
| | | }, |
| | | treeLoad(tree, treeNode, resolve) { |
| | | getChildLazyTree({ parentId: tree.id }).then((res) => { |
| | | resolve(res.data.data); |
| | | }); |
| | | }, |
| | | // 新增:获取完整的行政区划代码 |
| | | getFullAreaCode(countyCode) { |
| | | if (!countyCode) return ''; |
| | | // 县级代码是12位,省级代码取前2位,市级代码取前4位 |
| | | const provinceCode = countyCode.substring(0, 2) + '0000000000'; |
| | | const cityCode = countyCode.substring(0, 4) + '00000000'; |
| | | return `${provinceCode},${cityCode},${countyCode}`; |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style></style> |
| | | <basic-container> |
| | | <avue-crud |
| | | :option="option" |
| | | :table-loading="loading" |
| | | :data="data" |
| | | ref="crud" |
| | | v-model="form" |
| | | :permission="permissionList" |
| | | :before-open="beforeOpen" |
| | | :before-close="beforeClose" |
| | | @row-del="rowDel" |
| | | @row-update="rowUpdate" |
| | | @row-save="rowSave" |
| | | @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" |
| | | v-if="permission.dept_delete" |
| | | plain |
| | | @click="handleDelete" |
| | | > |
| | | 删除 |
| | | </el-button> |
| | | </template> |
| | | <template #menu="scope"> |
| | | <el-button |
| | | type="primary" |
| | | text |
| | | icon="el-icon-plus" |
| | | @click.stop="handleAdd(scope.row, scope.index)" |
| | | v-if="userInfo.role_name.includes('admin')" |
| | | > |
| | | 新增子项 |
| | | </el-button> |
| | | </template> |
| | | <template #deptCategory="{ row }"> |
| | | <el-tag>{{ row.deptCategoryName }}</el-tag> |
| | | </template> |
| | | <!-- 自定义 areaCode 的显示模板,确保显示单一值 --> |
| | | <template #areaCode="{ row }"> |
| | | <span>{{ row.areaName }}</span> |
| | | </template> |
| | | </avue-crud> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | getLazyList, |
| | | getChildLazyTree, |
| | | remove, |
| | | update, |
| | | add, |
| | | getDept, |
| | | getDeptTree, |
| | | } from '@/api/system/dept'; |
| | | import { getLazyTree } from '@/api/base/region'; |
| | | import { mapGetters } from 'vuex'; |
| | | import website from '@/config/website'; |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | form: {}, |
| | | selectionList: [], |
| | | query: {}, |
| | | loading: true, |
| | | parentId: 0, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0, |
| | | }, |
| | | option: { |
| | | lazy: true, |
| | | tip: false, |
| | | simplePage: true, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | tree: true, |
| | | border: true, |
| | | index: true, |
| | | selection: true, |
| | | viewBtn: true, |
| | | menuWidth: 320, |
| | | dialogClickModal: false, |
| | | column: [ |
| | | { |
| | | label: '机构名称', |
| | | prop: 'deptName', |
| | | search: true, |
| | | labelWidth: 120, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请输入机构名称', |
| | | trigger: 'blur', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: '机构全称', |
| | | prop: 'fullName', |
| | | search: true, |
| | | labelWidth: 120, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请输入机构全称', |
| | | trigger: 'blur', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: '上级机构', |
| | | prop: 'parentId', |
| | | dicData: [], |
| | | type: 'tree', |
| | | hide: true, |
| | | addDisabled: false, |
| | | props: { |
| | | label: 'name', |
| | | value: 'id', |
| | | }, |
| | | labelWidth: 120, |
| | | rules: [ |
| | | { |
| | | required: false, |
| | | message: '请选择上级机构', |
| | | trigger: 'click', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: '机构类型', |
| | | type: 'select', |
| | | dicUrl: '/blade-system/dict/dictionary?code=org_category', |
| | | props: { |
| | | label: 'dictValue', |
| | | value: 'dictKey', |
| | | }, |
| | | dataType: 'number', |
| | | width: 120, |
| | | labelWidth: 120, |
| | | prop: 'deptCategory', |
| | | slot: true, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请输入机构类型', |
| | | trigger: 'blur', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: '机构性质', |
| | | type: 'select', |
| | | dicUrl: '/blade-system/dict/dictionary?code=org_nature', |
| | | props: { |
| | | label: 'dictValue', |
| | | value: 'dictKey', |
| | | }, |
| | | dataType: 'number', |
| | | width: 120, |
| | | labelWidth: 120, |
| | | prop: 'deptNature', |
| | | slot: true, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请输入机构性质', |
| | | trigger: 'blur', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: '排序', |
| | | prop: 'sort', |
| | | type: 'number', |
| | | align: 'right', |
| | | labelWidth: 120, |
| | | width: 80, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请输入排序', |
| | | trigger: 'blur', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: '组织id', |
| | | prop: 'bingId', |
| | | type: 'number', |
| | | align: 'right', |
| | | labelWidth: 120, |
| | | addDisplay: false, |
| | | editDisplay: false, |
| | | width: 80, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请输入组织id', |
| | | trigger: 'blur', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: '行政区划', |
| | | prop: 'areaCode', |
| | | checkStrictly: true, |
| | | type: 'cascader', |
| | | labelWidth: 120, |
| | | props: { |
| | | label: 'title', |
| | | value: 'value', |
| | | emitPath: false, // 只返回最后选中的值 |
| | | checkStrictly: true, // 可以选择任意一级 |
| | | multiple: false, // 确保只能单选 |
| | | expandTrigger: 'hover', // 鼠标悬停时展开子菜单 |
| | | }, |
| | | dataType: 'string', // 使用字符串类型 |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请选择行政区划', |
| | | trigger: 'change', |
| | | }, |
| | | ], |
| | | change: ({ value }) => { |
| | | if (!value) { |
| | | this.form.areaCode = null; // 未选择时置为空 |
| | | } else { |
| | | // 如果 value 是逗号分隔的字符串,拆分并取最后一个值 |
| | | if (typeof value === 'string' && value.includes(',')) { |
| | | const codes = value.split(','); |
| | | this.form.areaCode = codes[codes.length - 1]; |
| | | } else { |
| | | this.form.areaCode = value; // 直接使用单一值 |
| | | } |
| | | } |
| | | console.log('cascader change value:', value); |
| | | console.log('处理后的区县编码:', this.form.areaCode); |
| | | }, |
| | | lazy: true, |
| | | lazyLoad(node, resolve) { |
| | | let level = node.level; |
| | | let list = []; |
| | | let callback = () => { |
| | | resolve( |
| | | (list || []).map(ele => ({ |
| | | ...ele, |
| | | value: ele.value, // 保持原始值类型(字符串) |
| | | leaf: level >= 2, // 县级为最后一级 |
| | | })) |
| | | ); |
| | | }; |
| | | |
| | | if (level === 0) { |
| | | getLazyTree('000000000000').then(res => { |
| | | list = res.data.data; |
| | | callback(); |
| | | }); |
| | | } else if (level === 1) { |
| | | getLazyTree(node.value).then(res => { |
| | | list = res.data.data; |
| | | callback(); |
| | | }); |
| | | } else if (level === 2) { |
| | | getLazyTree(node.value).then(res => { |
| | | list = res.data.data; |
| | | callback(); |
| | | }); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }, |
| | | }, |
| | | { |
| | | label: '备注', |
| | | prop: 'remark', |
| | | labelWidth: 120, |
| | | rules: [ |
| | | { |
| | | required: false, |
| | | message: '请输入备注', |
| | | trigger: 'blur', |
| | | }, |
| | | ], |
| | | hide: true, |
| | | }, |
| | | ], |
| | | }, |
| | | data: [], |
| | | }; |
| | | }, |
| | | computed: { |
| | | ...mapGetters(['userInfo', 'permission']), |
| | | permissionList() { |
| | | return { |
| | | addBtn: this.validData(this.permission.dept_add, false), |
| | | viewBtn: this.validData(this.permission.dept_view, false), |
| | | delBtn: this.validData(this.permission.dept_delete, false), |
| | | editBtn: this.validData(this.permission.dept_edit, false), |
| | | }; |
| | | }, |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach(ele => { |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(','); |
| | | }, |
| | | }, |
| | | methods: { |
| | | initData() { |
| | | getDeptTree().then(res => { |
| | | const column = this.findObject(this.option.column, 'parentId'); |
| | | column.dicData = res.data.data; |
| | | }); |
| | | }, |
| | | handleAdd(row) { |
| | | this.parentId = row.id; |
| | | const column = this.findObject(this.option.column, 'parentId'); |
| | | column.value = row.id; |
| | | column.addDisabled = true; |
| | | this.form.areaCode = null; // 初始化为空 |
| | | this.$refs.crud.rowAdd(); |
| | | }, |
| | | validateSubmitData(row) { |
| | | if (!row.areaCode) { |
| | | this.$message.warning('请选择行政区划'); |
| | | return false; |
| | | } |
| | | return true; |
| | | }, |
| | | rowSave(row, done, loading) { |
| | | if (!this.validateSubmitData(row)) { |
| | | loading(); |
| | | return; |
| | | } |
| | | console.log('--- Start rowSave ---'); |
| | | console.log('Form data before save:', this.form); |
| | | |
| | | // 处理 areaCode,确保只取最后一个值 |
| | | let areaCode = this.form.areaCode; |
| | | if (Array.isArray(areaCode)) { |
| | | areaCode = areaCode[areaCode.length - 1]; // 数组取最后一个 |
| | | } else if (typeof areaCode === 'string' && areaCode.includes(',')) { |
| | | const codes = areaCode.split(','); |
| | | areaCode = codes[codes.length - 1]; // 字符串拆分取最后一个 |
| | | } |
| | | row.areaCode = areaCode || null; // 确保非空 |
| | | |
| | | console.log('Row data before submit:', row); |
| | | |
| | | add(row).then( |
| | | res => { |
| | | console.log('Save response:', res.data); |
| | | const data = res.data.data; |
| | | row.id = data.id; |
| | | row.deptCategoryName = data.deptCategoryName; |
| | | row.tenantId = data.tenantId; |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '操作成功!', |
| | | }); |
| | | this.onLoad(this.page); |
| | | done(row); |
| | | }, |
| | | error => { |
| | | console.log('Save error:', error); |
| | | this.loading = false; |
| | | loading(); |
| | | } |
| | | ); |
| | | }, |
| | | rowUpdate(row, index, done, loading) { |
| | | if (!this.validateSubmitData(row)) { |
| | | loading(); |
| | | return; |
| | | } |
| | | console.log('--- Start rowUpdate ---'); |
| | | |
| | | // 提交时只使用县级代码 |
| | | const submitData = { |
| | | ...row, |
| | | areaCode: row.areaCode.split(',').pop(), // 取最后一个代码(县级) |
| | | }; |
| | | |
| | | console.log('Row data before submit:', row); |
| | | |
| | | update(submitData) |
| | | .then( |
| | | res => { |
| | | console.log('Update response:', res.data); |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '操作成功!', |
| | | }); |
| | | this.onLoad(this.page); |
| | | done(row); |
| | | }, |
| | | error => { |
| | | console.log('Update error:', error); |
| | | this.loading = false; |
| | | loading(); |
| | | } |
| | | ) |
| | | .catch(error => { |
| | | console.log('Update promise rejected:', error); |
| | | this.loading = false; |
| | | }); |
| | | }, |
| | | rowDel(row, index, done) { |
| | | this.$confirm('确定将选择数据删除?', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | .then(() => { |
| | | return remove(row.id); |
| | | }) |
| | | .then(() => { |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '操作成功!', |
| | | }); |
| | | this.onLoad(this.page); |
| | | done(row); |
| | | }); |
| | | }, |
| | | handleDelete() { |
| | | if (this.selectionList.length === 0) { |
| | | this.$message.warning('请选择至少一条数据'); |
| | | return; |
| | | } |
| | | this.$confirm('确定将选择数据删除?', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | .then(() => { |
| | | return remove(this.ids); |
| | | }) |
| | | .then(() => { |
| | | this.data = []; |
| | | this.parentId = 0; |
| | | this.$refs.crud.refreshTable(); |
| | | this.$refs.crud.toggleSelection(); |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '操作成功!', |
| | | }); |
| | | }); |
| | | }, |
| | | searchReset() { |
| | | this.query = {}; |
| | | this.parentId = 0; |
| | | this.onLoad(this.page); |
| | | }, |
| | | searchChange(params, done) { |
| | | this.query = params; |
| | | this.parentId = ''; |
| | | this.page.currentPage = 1; |
| | | this.onLoad(this.page, params); |
| | | done(); |
| | | }, |
| | | selectionChange(list) { |
| | | this.selectionList = list; |
| | | }, |
| | | selectionClear() { |
| | | this.selectionList = []; |
| | | this.$refs.crud.toggleSelection(); |
| | | }, |
| | | // 修改 beforeOpen 方法 |
| | | beforeOpen(done, type) { |
| | | if (['add', 'edit'].includes(type)) { |
| | | this.initData(); |
| | | } |
| | | if (['edit', 'view'].includes(type)) { |
| | | getDept(this.form.id).then(res => { |
| | | const data = res.data.data; |
| | | const areaCode = data.areaCode; |
| | | const areaName = data.areaName; |
| | | |
| | | // 生成完整的行政区划代码(考虑不同级别) |
| | | const fullAreaCode = this.getFullAreaCode(areaCode); |
| | | |
| | | this.form = Object.assign({}, data, { |
| | | hasChildren: this.form.hasChildren, |
| | | areaCode: fullAreaCode, |
| | | areaName: areaName || '', |
| | | }); |
| | | |
| | | // 调试输出 |
| | | console.log('回显数据:', { |
| | | originalAreaCode: areaCode, |
| | | fullAreaCode: fullAreaCode, |
| | | areaName: areaName, |
| | | }); |
| | | }); |
| | | } else if (type === 'add') { |
| | | this.form.areaCode = ''; |
| | | this.form.areaName = ''; |
| | | } |
| | | done(); |
| | | }, |
| | | beforeClose(done) { |
| | | this.parentId = ''; |
| | | const column = this.findObject(this.option.column, 'parentId'); |
| | | column.value = ''; |
| | | column.addDisabled = false; |
| | | this.form.areaCode = null; |
| | | done(); |
| | | }, |
| | | currentChange(currentPage) { |
| | | this.page.currentPage = currentPage; |
| | | this.onLoad(this.page); |
| | | }, |
| | | sizeChange(pageSize) { |
| | | this.page.pageSize = pageSize; |
| | | this.onLoad(this.page); |
| | | }, |
| | | refreshChange() { |
| | | this.onLoad(this.page, this.query); |
| | | }, |
| | | onLoad(page, params = {}) { |
| | | this.loading = true; |
| | | console.log('onLoad triggered with page:', page, 'params:', params); |
| | | console.log('Current parentId:', this.parentId, 'query:', this.query); |
| | | getLazyList(this.parentId, Object.assign(params, this.query)) |
| | | .then(res => { |
| | | console.log('onLoad response:', res.data); |
| | | // 处理 areaCode,确保是单一字符串 |
| | | const data = (res.data.data || []).map(item => { |
| | | const fullAreaCode = this.getFullAreaCode(item.areaCode); |
| | | return { |
| | | ...item, |
| | | // 保存完整的行政区划代码 |
| | | areaCode: fullAreaCode, |
| | | // 使用原始的县级代码作为实际值 |
| | | originalAreaCode: item.areaCode, |
| | | }; |
| | | }); |
| | | this.data = data; |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | console.log('Table data after onLoad:', this.data); |
| | | }) |
| | | .catch(error => { |
| | | console.log('onLoad error:', error); |
| | | this.loading = false; |
| | | this.data = this.data; // 保留当前数据 |
| | | console.log('Table data after onLoad error:', this.data); |
| | | }); |
| | | }, |
| | | treeLoad(tree, treeNode, resolve) { |
| | | getChildLazyTree({ parentId: tree.id }).then(res => { |
| | | resolve(res.data.data); |
| | | }); |
| | | }, |
| | | // 修改 getFullAreaCode 方法 |
| | | getFullAreaCode(areaCode) { |
| | | if (!areaCode) return ''; |
| | | |
| | | // 根据编码长度判断层级 |
| | | const code = areaCode.toString(); |
| | | |
| | | // 如果已经是完整的逗号分隔格式,直接返回 |
| | | if (code.includes(',')) return code; |
| | | |
| | | // 处理不同级别的编码 |
| | | if (code.endsWith('0000000000')) { |
| | | // 省级编码 |
| | | return code; |
| | | } else if (code.endsWith('00000000') && !code.endsWith('0000000000')) { |
| | | // 市级编码 |
| | | 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}`; |
| | | } |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style></style> |
| | |
| | | * Copyright (c) 2025 by shuishen, All Rights Reserved. |
| | | --> |
| | | <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"> |
| | | <div class="tab-content"> |
| | | <!-- 查询条件筛选栏 --> |
| | | <div class="filter-bar"> |
| | | <el-input style="width: 250px" v-model="filters.key_word" placeholder="输入工单编号/名称/内容/姓名" |
| | | class="filter-item" clearable @keyup.enter="handleSearch" /> |
| | | <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"> |
| | | <div class="tab-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" /> |
| | | </div> |
| | | |
| | | <el-select placeholder="请选择所属单位" v-model="filters.create_dept" @change="handleDepartmentChange" |
| | | class="filter-item" clearable> |
| | | <el-option v-for="dept in departments" :key="dept.value" :label="dept.label" |
| | | :value="dept.value" /> |
| | | </el-select> |
| | | <div class="search-bar-box-item"> |
| | | <el-select placeholder="请选择所属单位" v-model="filters.create_dept" @change="handleDepartmentChange" |
| | | clearable> |
| | | <el-option v-for="dept in departments" :key="dept.value" :label="dept.label" :value="dept.value" /> |
| | | </el-select> |
| | | </div> |
| | | |
| | | <el-date-picker v-model="filters.dateRange" type="daterange" range-separator="至" |
| | | start-placeholder="开始日期" end-placeholder="结束日期" class="filter-item" style="width: 100px" |
| | | :default-value="datePickerDefaultVal" /> |
| | | <el-select v-model="filters.file_id" placeholder="请选择关联航线" class="filter-item frequency" |
| | | clearable> |
| | | <el-option v-for="item in wayLineList" :key="item.wayline_id" :label="item.name" |
| | | :value="item.wayline_id" /> |
| | | </el-select> |
| | | <div class="search-bar-box-item"> |
| | | <el-date-picker v-model="filters.dateRange" type="daterange" range-separator="至" |
| | | start-placeholder="开始日期" end-placeholder="结束日期" :default-value="datePickerDefaultVal" /> |
| | | </div> |
| | | |
| | | <el-select v-model="filters.ai_types" placeholder="关联算法" class="filter-item" clearable> |
| | | <el-option v-for="item in ai_types" :key="item.dictKey" :label="item.dictValue" |
| | | :value="item.dictKey" /> |
| | | </el-select> |
| | | <div class="search-bar-box-item"> |
| | | <el-select v-model="filters.file_id" placeholder="请选择关联航线" clearable> |
| | | <el-option v-for="item in wayLineList" :key="item.wayline_id" :label="item.name" |
| | | :value="item.wayline_id" /> |
| | | </el-select> |
| | | </div> |
| | | |
| | | <el-select v-model="filters.type" placeholder="请选择工单类型" class="filter-item" clearable> |
| | | <el-option v-for="item in types" :key="item.dictValue" :label="item.dictValue" |
| | | :value="item.dictKey" /> |
| | | </el-select> |
| | | <div class="search-bar-box-item"> |
| | | <el-select 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> |
| | | |
| | | <el-select v-model="filters.status" placeholder="请选择工单状态" class="filter-item" clearable> |
| | | <el-option v-for="item in statuses" :key="item.value" :label="item.label" |
| | | :value="item.value" /> |
| | | <div class="search-bar-box-item"> |
| | | <el-select v-model="filters.type" placeholder="请选择工单类型" clearable> |
| | | <el-option v-for="item in types" :key="item.dictValue" :label="item.dictValue" |
| | | :value="item.dictKey" /> |
| | | </el-select> |
| | | </div> |
| | | |
| | | </el-select> |
| | | <!-- <el-date-picker v-model="filters.cycleDateRange" type="datetimerange" range-separator="至" |
| | | start-placeholder="工单周期开始日期" end-placeholder="工单周期结束时间日期" class="filter-item" |
| | | style="width: 220px !important" /> --> |
| | | <el-time-picker style="width: 250px" v-model="filters.deal_time" placeholder="请选择执行时间" |
| | | prop="deal_time" value-format="HH:mm" :picker-options="{ |
| | | selectableRange: '00:00 - 23:59', |
| | | }" /> |
| | | <el-select v-model="filters.rep_fre_type" placeholder="请选择频次" class="filter-item frequency"> |
| | | <el-option v-for="item in cycles" :key="item" :label="item" :value="item" /> |
| | | </el-select> |
| | | <div class="search-bar-box-item"> |
| | | <el-select v-model="filters.status" placeholder="请选择工单状态" clearable> |
| | | <el-option v-for="item in statuses" :key="item.value" :label="item.label" :value="item.value" /> |
| | | </el-select> |
| | | </div> |
| | | </div> |
| | | |
| | | <el-col :span="8"> |
| | | </el-col> |
| | | <el-button type="primary" icon="el-icon-search" @click="handleSearch">查询</el-button> |
| | | <el-button icon="el-icon-refresh" @click="handleReset">重置</el-button> |
| | | </div> |
| | | <div class="search-bar-box"> |
| | | <div class="search-bar-box-item flex-2"> |
| | | <el-date-picker v-model="filters.cycleDateRange" type="daterange" range-separator="至" |
| | | start-placeholder="工单周期开始日期" end-placeholder="工单周期结束日期" :default-value="datePickerDefaultVal" /> |
| | | </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"> |
| | | <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> |
| | | </template> |
| | | <div class="search-bar-box-item"> |
| | | <el-select v-model="filters.rep_fre_type" placeholder="请选择频次"> |
| | | <el-option v-for="item in cycles" :key="item" :label="item" :value="item" /> |
| | | </el-select> |
| | | </div> |
| | | |
| | | <template #menu="{ row }"> |
| | | <div class="menu-custom-box"> |
| | | <div v-if="row.status == 1"> |
| | | <el-button class="audit-btn" v-if="hasPaddingBtnPermission()" type="text" |
| | | icon="el-icon-view" @click="handleViewDetail(row)">审核</el-button> |
| | | </div> |
| | | <div class="search-bar-box-item"> |
| | | <el-time-picker v-model="filters.deal_time" placeholder="请选择执行时间" prop="deal_time" value-format="HH:mm" |
| | | :picker-options="{ |
| | | selectableRange: '00:00 - 23:59', |
| | | }" /> |
| | | </div> |
| | | |
| | | <div |
| | | v-if="(userInfo.user_id == row.create_user || hasRecallPaddingBtnPermission()) && row.status == 1"> |
| | | <!--待审核状态--> |
| | | <el-button class="withdraw-btn" type="text" icon="el-icon-warning" |
| | | @click="orderLogRecall(row.id)">撤回</el-button> |
| | | </div> |
| | | <!--已驳回--> |
| | | <div v-if="row.status == 2"> |
| | | <el-button class="reject-reason-btn" type="text" icon="el-icon-warning" |
| | | @click="rejectDetail(row.id)">驳回原因</el-button> |
| | | </div> |
| | | <!--草稿--> |
| | | <div v-if="row.status == 0 && userInfo.user_id == row.create_user"> |
| | | <el-button class="edit-btn" type="text" icon="el-icon-edit-outline" |
| | | @click="handleViewDetail(row)">编辑</el-button> |
| | | <el-button class="publish-btn" type="text" icon="el-icon-position" |
| | | @click="userPublishPush(row.id)">发布</el-button> |
| | | <el-button class="delete-btn" type="text" icon="el-icon-delete" |
| | | @click="deleteOrderLog(row.id)">删除</el-button> |
| | | </div> |
| | | <div v-if="row.status == 3 || row.status == 1 || row.status == 2"> |
| | | <el-button class="detail-btn" type="text" icon="el-icon-view" |
| | | @click="handleViewDetail(row)">详情</el-button> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | <template #status="{ row }"> |
| | | <el-tag :type="getStatusTagType(row.status)">{{ mapStatus(row.status) }}</el-tag> |
| | | </template> |
| | | <template #keyData="{ row }"> |
| | | <el-tooltip :content="row.address" placement="top" effect="light"> |
| | | <span>{{ row.keyData }}</span> |
| | | </el-tooltip> |
| | | </template> |
| | | </avue-crud> |
| | | <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 icon="el-icon-refresh" @click="handleReset">清空</el-button> |
| | | </div> |
| | | </div> |
| | | </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"> |
| | | <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> |
| | | </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> |
| | | </template> |
| | | |
| | | <template v-if=" |
| | | (userInfo.user_id == row.create_user || hasRecallPaddingBtnPermission()) && |
| | | row.status == 1 |
| | | "> |
| | | <!--待审核状态--> |
| | | <el-button type="text" icon="el-icon-warning" @click="orderLogRecall(row.id)">撤回</el-button> |
| | | </template> |
| | | <!--已驳回--> |
| | | <template v-if="row.status == 2"> |
| | | <el-button type="text" icon="el-icon-warning" @click="rejectDetail(row.id)">驳回原因</el-button> |
| | | </template> |
| | | <!--草稿--> |
| | | <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 v-if="row.status == 3 || row.status == 1 || row.status == 2"> |
| | | <el-button type="text" icon="el-icon-view" @click="handleViewDetail(row)">详情</el-button> |
| | | </template> |
| | | </div> |
| | | </template> |
| | | <template #status="{ row }"> |
| | | <el-tag :type="getStatusTagType(row.status)">{{ mapStatus(row.status) }}</el-tag> |
| | | </template> |
| | | <template #keyData="{ row }"> |
| | | <el-tooltip :content="row.address" placement="top" effect="light"> |
| | | <span>{{ row.keyData }}</span> |
| | | </el-tooltip> |
| | | </template> |
| | | </avue-crud> |
| | | </div> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | |
| | | <!-- 新建工单对话框 --> |
| | | <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-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"> |
| | | <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> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="关联机巢" prop="device_sns"> |
| | | <el-select v-model="form.device_sns" placeholder="请选择机巢" multiple> |
| | | <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-select> |
| | | </el-form-item> |
| | | </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></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="结束日期" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <div class="flex"> |
| | | <div class="flex-1"> |
| | | <el-select v-model="form.rep_fre_type" placeholder="请选择频次"> |
| | | <el-option v-for="item in cycles" :key="item" :label="item" :value="item" /> |
| | | </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" |
| | | :picker-options="{ |
| | | selectableRange: '00:00 - 23:59', |
| | | }" /> |
| | | </div> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row :gutter="20" style="height: 400px"> |
| | | <el-col :span="24"> |
| | | <map-container v-if="dialogVisible" ref="MapContainer"></map-container> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row> |
| | | <div class="add-box-btns"> |
| | | <el-button type="danger" @click="submitForm(1)">发起</el-button> |
| | | <el-button type="primary" @click="submitForm(0)">存草稿</el-button> |
| | | </div> |
| | | </el-row> |
| | | </el-form> |
| | | </el-dialog> |
| | | |
| | | <!-- 工单详情对话框 --> |
| | | <el-dialog 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" ref="testform" label-width="100px"> |
| | | <div class="custom-steps-container"> |
| | | <!-- 标题行 --> |
| | | <div class="steps-titles"> |
| | | <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"> |
| | | <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 style=" |
| | | position: absolute; |
| | | left: 80%; |
| | | top: 50%; |
| | | transform: translateY(-50%); |
| | | width: 100px; |
| | | margin-left: 4px; |
| | | color: #666; |
| | | font-size: 12px; |
| | | "> |
| | | {{ record.interval_time_str }} |
| | | </span> |
| | | <div class="step-description"> |
| | | {{ record.create_time_str }} |
| | | </div> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </template> |
| | | </el-step> |
| | | </el-steps> |
| | | </div> |
| | | |
| | | <!-- 新建工单对话框 --> |
| | | <el-dialog v-model="dialogVisible" title="新建工单" width="70%" :close-on-click-modal="false" @close="resetForm"> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="工单名称" prop="name"> |
| | | <el-input v-model="form.name" placeholder="请输入工单名称"></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"> |
| | | <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> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="关联机巢" prop="device_sns"> |
| | | <el-select v-model="form.device_sns" placeholder="请选择机巢" multiple> |
| | | <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-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12" prop="statusStr"> |
| | | <el-form-item label="当前状态"> |
| | | {{ mapStatus(form.status) }} |
| | | </el-form-item> |
| | | </el-col> |
| | | |
| | | <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-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"> |
| | | <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> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="关联机巢" prop="device_sns"> |
| | | <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="结束日期" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | |
| | | <el-select v-model="form.device_sns" placeholder="请选择机巢" multiple> |
| | | <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-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-col :span="3"> |
| | | <el-select v-model="form.rep_fre_type" placeholder="请选择频次"> |
| | | <el-option v-for="item in cycles" :key="item" :label="item" :value="item" /> |
| | | </el-select> |
| | | </el-col> |
| | | |
| | | <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-form-item> |
| | | </el-col> |
| | | <el-col :span="3"> |
| | | <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', |
| | | }" /> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <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="结束日期" class="date-picker" /> |
| | | </el-form-item> |
| | | <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-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | </el-col> |
| | | <el-col :span="3"> |
| | | <el-select v-model="form.rep_fre_type" placeholder="请选择频次"> |
| | | <el-option v-for="item in cycles" :key="item" :label="item" :value="item" /> |
| | | </el-select> |
| | | </el-col> |
| | | <el-row :gutter="20" style="height: 400px"> |
| | | <el-col :span="24"> |
| | | <map-container v-if="detailVisible" ref="MapContainer"></map-container> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-col :span="3"> |
| | | <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', |
| | | }" /> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row :gutter="20" style="height: 400px"> |
| | | |
| | | <el-col :span="24"> |
| | | <map-container v-if='dialogVisible' ref="MapContainer"></map-container> |
| | | </el-col> |
| | | |
| | | </el-row> |
| | | |
| | | <el-row> |
| | | <div class="add-box-btns"> |
| | | <el-button type="danger" @click="submitForm(1)">发布</el-button> |
| | | <el-button type="primary" @click="submitForm(0)">存草稿</el-button> |
| | | </div> |
| | | </el-row> |
| | | </el-form> |
| | | </el-dialog> |
| | | |
| | | <!-- 工单详情对话框 --> |
| | | <el-dialog 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" ref="testform" label-width="100px"> |
| | | <div class="custom-steps-container"> |
| | | <!-- 标题行 --> |
| | | <div class="steps-titles"> |
| | | <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"> |
| | | <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 style=" |
| | | position: absolute; |
| | | left: 80%; |
| | | top: 50%; |
| | | transform: translateY(-50%); |
| | | width: 100px; |
| | | margin-left: 4px; |
| | | color: #666; |
| | | font-size: 12px; |
| | | "> |
| | | {{ record.interval_time_str }} |
| | | </span> |
| | | <div class="step-description"> |
| | | {{ record.create_time_str }} |
| | | </div> |
| | | </template> |
| | | </el-step> |
| | | </el-steps> |
| | | </div> |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="工单名称" prop="name"> |
| | | <el-input v-model="form.name" placeholder="请输入工单名称"></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"> |
| | | <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> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="关联机巢" prop="device_sns"> |
| | | <el-select v-model="form.device_sns" placeholder="请选择机巢" multiple> |
| | | <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-select> |
| | | </el-form-item> |
| | | </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></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | |
| | | <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="结束日期" class="date-picker" /> |
| | | </el-form-item> |
| | | |
| | | |
| | | <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 || userInfo.user_id == form.create_user" |
| | | <el-row> |
| | | <div class="add-box-btns"> |
| | | <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 || userInfo.user_id == form.create_user" |
| | | @click="submitForm(0)">保存</el-button> --> |
| | | |
| | | <el-button type="primary" v-if="form.status == 1 && this.permission.orderLogpass" |
| | | @click="orderLogPass(form.id)">通过</el-button> |
| | | <el-button type="danger" v-if="form.status == 1 && hasRejectionBtnPermission()" |
| | | @click="orderLogReject(form.id)">驳回</el-button> |
| | | </el-col> |
| | | <el-col :span="3"> |
| | | <el-select v-model="form.rep_fre_type" placeholder="请选择频次"> |
| | | <el-option v-for="item in cycles" :key="item" :label="item" :value="item" /> |
| | | </el-select> |
| | | </el-col> |
| | | <el-button type="primary" v-if="form.status == 1 && this.permission.orderLogpass" |
| | | @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-col :span="3"> |
| | | <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', |
| | | }" /> |
| | | </el-col> |
| | | </el-row> |
| | | <!-- 工单详情 --> |
| | | <el-dialog 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"> |
| | | <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> |
| | | |
| | | <el-row :gutter="20" style="height: 400px"> |
| | | <!-- Element Steps 组件 --> |
| | | <el-steps :active="form.active" align-center class="custom-steps"> |
| | | <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 style=" |
| | | position: absolute; |
| | | left: 80%; |
| | | top: 50%; |
| | | transform: translateY(-50%); |
| | | width: 100px; |
| | | margin-left: 4px; |
| | | color: #666; |
| | | font-size: 12px; |
| | | "> |
| | | {{ record.interval_time_str }} |
| | | </span> |
| | | <div class="step-description"> |
| | | {{ record.create_time_str }} |
| | | </div> |
| | | </template> |
| | | </el-step> |
| | | </el-steps> |
| | | </div> |
| | | |
| | | <el-col :span="24"> |
| | | <map-container v-if='detailVisible' ref="MapContainer"></map-container> |
| | | </el-col> |
| | | <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-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-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | </el-row> |
| | | </el-form> |
| | | </el-dialog> |
| | | </basic-container> |
| | | <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> |
| | | </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> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12" prop="statusStr"> |
| | | <el-form-item label="当前状态"> |
| | | {{ mapStatus(form.status) }} |
| | | </el-form-item> |
| | | </el-col> |
| | | |
| | | <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-form-item> |
| | | </el-col> |
| | | <el-col :span="3"> |
| | | <el-select v-model="form.rep_fre_type" placeholder="请选择频次" :disabled="true"> |
| | | <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" :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-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row :gutter="20" style="height: 400px"> |
| | | <el-col :span="24"> |
| | | <map-container v-if="detailVisibleCopy" ref="MapContainer"></map-container> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row> |
| | | <div class="add-box-btns"> |
| | | <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 || userInfo.user_id == form.create_user" |
| | | @click="submitForm(0)">保存</el-button> --> |
| | | |
| | | <el-button type="primary" v-if="form.status == 1 && this.permission.orderLogpass" |
| | | @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> |
| | | </el-form> |
| | | </el-dialog> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import { calculateDefaultRange } from '@/utils/util' |
| | | import { |
| | | getList, |
| | | saveUpdateOrderLog, |
| | | orderLogDetails, |
| | | orderLogRecall, |
| | | orderLogReject, |
| | | orderLogPass, |
| | | orderLogExport, |
| | | jobStatusNum, |
| | | userPublish, |
| | | deleteOrderLog |
| | | getList, |
| | | saveUpdateOrderLog, |
| | | orderLogDetails, |
| | | orderLogRecall, |
| | | orderLogReject, |
| | | orderLogPass, |
| | | orderLogExport, |
| | | jobStatusNum, |
| | | userPublish, |
| | | deleteOrderLog, |
| | | } from '@/api/tickets/orderLog' |
| | | import { getTicketInfo } from '@/api/tickets/ticket' |
| | | import { getDictionaryByCode } from '@/api/system/dictbiz' |
| | |
| | | import { analyzeKmzFile, removeTextKey, XMLToJSON } from '@/utils/cesium/kmz' |
| | | |
| | | export default { |
| | | name: 'TicketPage', |
| | | data() { |
| | | const calculateDefaultRange = () => { |
| | | const now = new Date() |
| | | const currentYear = now.getFullYear() |
| | | const currentMonth = now.getMonth() // 0-11 |
| | | name: 'TicketPage', |
| | | data () { |
| | | return { |
| | | activeTab: 'all', |
| | | |
| | | // 计算上个月 |
| | | let lastMonthYear = currentYear |
| | | let lastMonth = currentMonth - 1 |
| | | if (lastMonth < 0) { |
| | | lastMonth = 11 |
| | | lastMonthYear = currentYear - 1 |
| | | } |
| | | tabs: [ |
| | | { label: '全部工单', name: 'all', value: null, count: 0 }, |
| | | { label: '待审核', name: 'WAIT_AUDIT', value: 1, count: 0 }, |
| | | { label: '已驳回', name: 'REJECTED', value: 2, count: 0 }, |
| | | { label: '已通过', name: 'PASS', value: 3, count: 0 }, |
| | | { label: '草稿', name: 'DRAFT', value: 0, count: 0 }, |
| | | ], |
| | | filters: { |
| | | key_word: '', |
| | | create_dept: '', |
| | | start_date: null, |
| | | end_date: null, |
| | | file_id: '', |
| | | ai_types: [], |
| | | status: '', |
| | | dateRange: [], |
| | | }, |
| | | departments: [], |
| | | types: [], |
| | | device_sns: [], |
| | | ai_types: [], |
| | | wayLineList: [], |
| | | detailTitle: '编辑工单', |
| | | detailVisibleCopy: false, |
| | | |
| | | // 设置默认范围 [上个月, 当前月] |
| | | return [ |
| | | new Date(lastMonthYear, lastMonth, 1), |
| | | new Date(currentYear, currentMonth, 1) |
| | | ] |
| | | statuses: [ |
| | | { label: '草稿', value: '0' }, |
| | | { label: '待审核', value: '1' }, |
| | | { label: '已驳回', value: '2' }, |
| | | { label: '已通过', value: '3' }, |
| | | ], |
| | | //周期 |
| | | cycles: ['周一', '周二', '周三', '周四', '周五', '周六', '周末', '周天', '工作日', '每天'], |
| | | |
| | | tableData: [], |
| | | option: { |
| | | index: true, |
| | | indexWidth: 66, |
| | | indexLabel: '序号', |
| | | indexFixed: true, |
| | | |
| | | align: 'center', |
| | | border: true, |
| | | stripe: true, |
| | | searchShow: true, |
| | | searchBtnText: '搜索', |
| | | searchMenuSpan: 6, |
| | | addBtnText: '新建工单', |
| | | addBtn: false, |
| | | viewBtn: false, |
| | | editBtn: false, |
| | | delBtn: false, |
| | | cancelBtn: true, |
| | | cancelBtnText: '取消', |
| | | |
| | | menu: true, |
| | | menuWidth: 210, |
| | | menuClassName: 'cur-menu', |
| | | column: [ |
| | | { label: '工单编号', prop: 'job_info_num', width: 100, ellipsis: true, overHidden: true }, |
| | | { label: '工单名称', prop: 'name', width: 100, ellipsis: true, overHidden: true }, |
| | | { label: '工单状态', prop: 'status', width: 88 }, |
| | | { label: '所属单位', prop: 'dept_name', width: 100, ellipsis: true }, |
| | | { label: '发起时间', prop: 'create_time', width: 144, ellipsis: true }, |
| | | { label: '已执行次数', prop: 'job_num', width: 96, ellipsis: true }, |
| | | { label: '工单内容', prop: 'content', ellipsis: true, overHidden: true }, |
| | | { label: '关联航线', prop: 'wayline_name', width: 100, ellipsis: true, overHidden: true }, |
| | | { label: '关联算法', prop: 'ai_type_str', width: 100, ellipsis: true, overHidden: true }, |
| | | { label: '关联机巢', prop: 'device_names', width: 100, ellipsis: true, overHidden: true }, |
| | | |
| | | { label: '创建人', prop: 'creator_name', width: 96, ellipsis: true, overHidden: true }, |
| | | { label: '关联机巢', prop: 'device_names', width: 112, ellipsis: true, overHidden: true }, |
| | | { |
| | | label: '工单周期频次', |
| | | prop: '', |
| | | width: 110, |
| | | formatter: row => this.formatCycleTime(row), |
| | | html: true, |
| | | ellipsis: true, |
| | | // overHidden: true |
| | | }, |
| | | ], |
| | | }, |
| | | |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0, |
| | | }, |
| | | dialogVisible: false, |
| | | detailVisible: false, |
| | | currentDetail: {}, |
| | | form: {}, |
| | | rules: { |
| | | name: [ |
| | | { required: true, message: '请输入工单名称', trigger: 'blur' }, |
| | | { max: 100, message: '工单名称不能超过100个字', trigger: 'blur' }, |
| | | ], |
| | | file_id: [{ required: true, message: '需要选择航线', trigger: 'change' }], |
| | | device_sns: [{ required: true, message: '请选择机巢', trigger: 'change' }], |
| | | ai_types: [{ required: true, message: '请选择算法', trigger: 'change' }], |
| | | content: [ |
| | | { required: true, message: '请输入工单内容', trigger: 'blur' }, |
| | | { max: 255, message: '工单内容不能超过255个字', trigger: 'blur' }, |
| | | ], |
| | | date_range: [{ required: true, message: '请选择时间不能为空', trigger: 'blur' }], |
| | | rep_fre_type: [{ required: true, message: '请选择周期', trigger: 'blur' }], |
| | | deal_time: [{ required: true, message: '请选择执行时间', trigger: 'blur' }], |
| | | }, |
| | | loading: false, |
| | | globalCounts: {}, |
| | | mapLoaded: false, |
| | | |
| | | // 配置时间选择器默认配置 |
| | | 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'] |
| | | //获取航线 |
| | | 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() |
| | | }, |
| | | computed: { |
| | | ...mapGetters(['userInfo', 'permission']), |
| | | filteredTabs () { |
| | | // rejection_and_draft 权限控制“已驳回”和“草稿”tab |
| | | const canShowRejectAndDraft = this.permission?.rejection_and_draft === true |
| | | return this.tabs |
| | | .map(tab => { |
| | | if (tab.name === 'DRAFT') { |
| | | return { ...tab, isShow: canShowRejectAndDraft } |
| | | } |
| | | if (tab.name === 'REJECTED') { |
| | | return { ...tab, isShow: canShowRejectAndDraft } |
| | | } |
| | | return { ...tab, isShow: true } |
| | | }) |
| | | .filter(tab => tab.isShow) |
| | | }, |
| | | }, |
| | | |
| | | methods: { |
| | | searchChange (params, done) { |
| | | console.log('searchChange') |
| | | this.query = params |
| | | this.parentId = '' |
| | | this.page.currentPage = 1 |
| | | this.onLoad(this.page, params) |
| | | done() |
| | | }, |
| | | 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() |
| | | }) |
| | | }, |
| | | selectionClear () { |
| | | this.selectionList = [] |
| | | this.$refs.crud.toggleSelection() |
| | | }, |
| | | async loadAMapScripts () { |
| | | try { |
| | | // await loadAMap(); |
| | | // await loadAMapUI(); |
| | | this.mapLoaded = true |
| | | } catch (error) { |
| | | console.error('Failed to load AMap scripts:', error) |
| | | this.$message.error('地图加载失败,请检查网络或API Key配置') |
| | | } |
| | | }, |
| | | formatCycleTime (row) { |
| | | return `${row.cycle_time_value}` |
| | | }, |
| | | |
| | | async fetchTableData () { |
| | | this.loading = true |
| | | try { |
| | | let params = this.getQueryParam() |
| | | console.log('发送的参数:', params) |
| | | const response = await getList(params, this.page.currentPage, this.page.pageSize) |
| | | if (!response?.data?.data?.records) { |
| | | throw new Error('接口返回数据格式不正确') |
| | | } |
| | | |
| | | return { |
| | | activeTab: 'all', |
| | | const { total, records } = response.data.data |
| | | this.tableData = records.map(item => { |
| | | return item |
| | | }) |
| | | |
| | | tabs: [ |
| | | { label: '全部工单', name: 'all', value: null, count: 0 }, |
| | | { label: '待审核', name: 'WAIT_AUDIT', value: 1, count: 0 }, |
| | | { label: '已驳回', name: 'REJECTED', value: 2, count: 0 }, |
| | | { label: '已通过', name: 'PASS', value: 3, count: 0 }, |
| | | { label: '草稿', name: 'DRAFT', value: 0, count: 0 }, |
| | | ], |
| | | filters: { |
| | | key_word: '', |
| | | create_dept: '', |
| | | start_date: null, |
| | | end_date: null, |
| | | file_id: '', |
| | | ai_types: [], |
| | | status: '', |
| | | dateRange: [], |
| | | }, |
| | | departments: [], |
| | | types: [], |
| | | device_sns: [], |
| | | ai_types: [], |
| | | wayLineList: [], |
| | | detailTitle: "编辑工单", |
| | | console.log('权限检查:', this.permission) |
| | | this.page.total = total || 0 |
| | | this.updateGlobalCounts() |
| | | } catch (error) { |
| | | console.error('获取数据失败:', error) |
| | | this.$message.error(error.message || '获取数据失败') |
| | | this.tableData = [] |
| | | this.page.total = 0 |
| | | } finally { |
| | | this.loading = false |
| | | } |
| | | }, |
| | | |
| | | statuses: [ |
| | | { label: '草稿', value: '0' }, |
| | | { label: '待审核', value: '1' }, |
| | | { label: '已驳回', value: '2' }, |
| | | { label: '已通过', value: '3' }, |
| | | ], |
| | | //周期 |
| | | cycles: ['周一', '周二', '周三', '周四', '周五', '周六', '周末', '周天', '工作日', '每天'], |
| | | getQueryParam () { |
| | | const currentTab = this.tabs.find(tab => tab.name === this.activeTab) |
| | | if (this.filters.dateRange) { |
| | | console.log( |
| | | 'this.formatDate(this.filters.dateRange[0])', |
| | | this.formatDate(this.filters.dateRange[0]) |
| | | ) |
| | | } |
| | | |
| | | tableData: [], |
| | | option: { |
| | | indexFixed: true, |
| | | const params = { |
| | | key_word: this.filters.key_word || undefined, |
| | | create_dept: this.filters.create_dept || undefined, |
| | | ai_types: |
| | | this.filters.ai_types && this.filters.ai_types.length > 0 |
| | | ? [this.filters.ai_types] |
| | | : null, |
| | | file_id: this.filters.file_id || undefined, |
| | | status: this.filters.status !== '' ? Number(this.filters.status) : currentTab?.value, |
| | | dept_id: this.filters.department || undefined, |
| | | create_start_date: this.filters.dateRange?.[0] |
| | | ? this.formatDate(this.filters.dateRange[0]) |
| | | : undefined, |
| | | create_end_date: this.filters.dateRange?.[1] |
| | | ? this.formatDate(this.filters.dateRange[1]).replace('00:00:00', '23:59:59') |
| | | : undefined, |
| | | |
| | | align: 'center', |
| | | border: true, |
| | | stripe: true, |
| | | searchShow: true, |
| | | searchBtnText: '搜索', |
| | | searchMenuSpan: 6, |
| | | addBtnText: '新建工单', |
| | | addBtn: false, |
| | | viewBtn: false, |
| | | editBtn: false, |
| | | delBtn: false, |
| | | cancelBtn: true, |
| | | cancelBtnText: '取消', |
| | | start_date: this.filters.cycleDateRange?.[0] |
| | | ? this.formatDate(this.filters.cycleDateRange[0]) |
| | | : undefined, |
| | | end_date: this.filters.cycleDateRange?.[1] |
| | | ? this.formatDate(this.filters.cycleDateRange[1]).replace('00:00:00', '23:59:59') |
| | | : undefined, |
| | | rep_fre_type: this.filters.rep_fre_type || undefined, |
| | | deal_time: this.filters.deal_time || undefined, |
| | | current: this.page.currentPage, |
| | | size: this.page.pageSize, |
| | | } |
| | | return params |
| | | }, |
| | | sizeChange (pageSize) { |
| | | this.page.pageSize = pageSize |
| | | }, |
| | | async submitForm (status) { |
| | | this.$refs.testform.validate(async valid => { |
| | | if (valid) { |
| | | let dateRange = this.form.date_range |
| | | console.log('dateRange' + dateRange) |
| | | |
| | | menu: true, |
| | | menuWidth: 210, |
| | | menuClassName: 'cur-menu', |
| | | column: [ |
| | | { label: '序号', prop: 'id', width: 72, ellipsis: true }, |
| | | { label: '工单编号', prop: 'job_info_num', width: 100, ellipsis: true, overHidden: true }, |
| | | { label: '工单名称', prop: 'name', width: 100, ellipsis: true, overHidden: true }, |
| | | { label: '所属单位', prop: 'dept_name', width: 100, ellipsis: true }, |
| | | { label: '发起时间', prop: 'create_time', width: 144, ellipsis: true }, |
| | | { label: '工单内容', prop: 'content', width: 160, ellipsis: true, overHidden: true }, |
| | | { label: '关联航线', prop: 'wayline_name', width: 100, ellipsis: true, overHidden: true }, |
| | | { label: '关联算法', prop: 'ai_type_str', width: 100, ellipsis: true, overHidden: true }, |
| | | { label: '关联机巢', prop: 'device_names', width: 100, ellipsis: true, overHidden: true }, |
| | | this.form.begin_time = this.formatDate(dateRange[0]) |
| | | this.form.end_time = this.formatDate(dateRange[1]) |
| | | |
| | | { label: '创建人', prop: 'creator_name', width: 96, ellipsis: true, overHidden: true }, |
| | | { label: '关联机巢', prop: 'device_names', width: 112, ellipsis: true, overHidden: true }, |
| | | { |
| | | label: '工单周期频次', |
| | | prop: '', |
| | | width: 110, |
| | | formatter: row => this.formatCycleTime(row), |
| | | html: true, |
| | | ellipsis: true, |
| | | // overHidden: true |
| | | }, |
| | | { label: '工单状态', prop: 'status', width: 96 }, |
| | | ], |
| | | }, |
| | | const submitData = { |
| | | ...this.form, |
| | | |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0, |
| | | }, |
| | | dialogVisible: false, |
| | | detailVisible: false, |
| | | currentDetail: {}, |
| | | form: {}, |
| | | rules: { |
| | | name: [{ required: true, message: '请输入工单名称', trigger: 'blur' }, |
| | | { max: 100, message: '工单名称不能超过100个字', trigger: 'blur' }, |
| | | ], |
| | | file_id: [{ required: true, message: '需要选择航线', trigger: 'change' }], |
| | | device_sns: [{ required: true, message: '请选择机巢', trigger: 'change' }], |
| | | ai_types: [{ required: true, message: '请选择算法', trigger: 'change' }], |
| | | content: [ |
| | | { required: true, message: '请输入工单内容', trigger: 'blur' }, |
| | | { max: 255, message: '工单内容不能超过255个字', trigger: 'blur' }, |
| | | ], |
| | | date_range: [{ required: true, message: '请选择时间不能为空', trigger: 'blur' }], |
| | | rep_fre_type: [{ required: true, message: '请选择周期', trigger: 'blur' }], |
| | | deal_time: [{ required: true, message: '请选择执行时间', trigger: 'blur' }], |
| | | }, |
| | | loading: false, |
| | | globalCounts: {}, |
| | | mapLoaded: false, |
| | | |
| | | // 配置时间选择器默认配置 |
| | | datePickerDefaultVal: calculateDefaultRange() |
| | | status: status, |
| | | } |
| | | await saveUpdateOrderLog(submitData) |
| | | let id = this.form.id |
| | | if (id) { |
| | | this.$message.success('工单发布成功') |
| | | } else { |
| | | this.$message.success('工单创建成功') |
| | | } |
| | | this.dialogVisible = false |
| | | this.detailVisible = false; |
| | | (this.device_sns = []), (this.wayLineList = []), this.fetchTableData() |
| | | } |
| | | }) |
| | | }, |
| | | 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.departments = dept_data.map(item => ({ |
| | | label: item.dept_name, |
| | | value: item.id, |
| | | })) |
| | | //驳回原因显示 |
| | | async rejectDetail (id) { |
| | | const response = await orderLogDetails(id) |
| | | let data = response.data.data |
| | | this.$confirm(data.remark, '驳回原因', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }).then(() => { |
| | | this.form = { |
| | | ...response.data.data, |
| | | } |
| | | this.detailVisible = true |
| | | }) |
| | | }, |
| | | mounted() { |
| | | 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` |
| | | }, |
| | | |
| | | mapStatus (status) { |
| | | const statusTextMap = { |
| | | 0: '草稿', |
| | | 1: '待审核', |
| | | 2: '已驳回', |
| | | 3: '已通过', |
| | | } |
| | | return statusTextMap[status] || '未知状态' |
| | | }, |
| | | |
| | | getStatusTagType (status) { |
| | | const statusMap = { |
| | | 1: 'warning', |
| | | 2: 'info', |
| | | 3: 'primary', |
| | | 4: 'success', |
| | | 5: 'danger', |
| | | } |
| | | return statusMap[status] || 'info' |
| | | }, |
| | | |
| | | handleTabChange (tab) { |
| | | this.activeTab = tab.props?.name || tab.name |
| | | this.filters.status = '' |
| | | this.page.currentPage = 1 |
| | | this.fetchTableData() |
| | | }, |
| | | |
| | | handleSearch () { |
| | | this.page.currentPage = 1 |
| | | this.fetchTableData() |
| | | }, |
| | | |
| | | handleReset () { |
| | | this.filters = { |
| | | keyword: '', |
| | | department: '', |
| | | type: '', |
| | | dateRange: [], |
| | | status: '', |
| | | } |
| | | this.page.currentPage = 1 |
| | | this.fetchTableData() |
| | | }, |
| | | |
| | | currentChange (currentPage) { |
| | | this.page.currentPage = currentPage |
| | | }, |
| | | |
| | | async updateGlobalCounts () { |
| | | const counts = { |
| | | all: 0, |
| | | DRAFT: 0, |
| | | WAIT_AUDIT: 0, |
| | | REJECTED: 0, |
| | | PASS: 0, |
| | | } |
| | | 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) |
| | | if (tab) { |
| | | tab.count = item.num |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | handleAdd () { |
| | | this.form = {} |
| | | this.dialogVisible = true |
| | | //航线列表 |
| | | this.asyncgetWaylineFileListByArea() |
| | | }, |
| | | |
| | | resetForm () { |
| | | this.form = { |
| | | name: '', |
| | | type: '', |
| | | handler: '', |
| | | algorithm: '', |
| | | location: '', |
| | | address: '', |
| | | content: '', |
| | | photos: [], |
| | | } |
| | | if (this.$refs.testform) { |
| | | this.$refs.testform.resetFields() |
| | | } |
| | | }, |
| | | |
| | | formatLocation (location) { |
| | | if (!Array.isArray(location)) { |
| | | return '未知位置' |
| | | } |
| | | return `${location[0].toFixed(6)}, ${location[1].toFixed(6)}` |
| | | }, |
| | | async handleViewDetail (row) { |
| | | const response = await orderLogDetails(row.id) |
| | | const data = response.data.data |
| | | |
| | | this.form = { |
| | | ...data, |
| | | } |
| | | |
| | | // 更新机巢列表 |
| | | 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.detailTitle = '工单详情') |
| | | : (this.detailTitle = '编辑工单') |
| | | |
| | | this.detailVisible = true |
| | | |
| | | this.initMapLine(data.device_map_infos) |
| | | }, |
| | | async handleCheckDetail (row) { |
| | | const response = await orderLogDetails(row.id) |
| | | const data = response.data.data |
| | | |
| | | this.form = { |
| | | ...data, |
| | | } |
| | | |
| | | // 更新机巢列表 |
| | | this.device_sns = data.device_list |
| | | this.detailVisibleCopy = true |
| | | this.initMapLine(data.device_map_infos) |
| | | }, |
| | | //导出 |
| | | async exportData () { |
| | | this.$confirm('是否智飞工单数据?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }).then(() => { |
| | | NProgress.start() |
| | | let params = this.getQueryParam() |
| | | orderLogExport(params).then(res => { |
| | | downloadXls(res.data, `智飞工单${this.$dayjs().format('YYYY-MM-DD')}.xlsx`) |
| | | NProgress.done() |
| | | }) |
| | | }) |
| | | }, |
| | | 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 |
| | | }, |
| | | hasPaddingBtnPermission () { |
| | | // undefined 或 false 都返回 false,只有 true 返回 true |
| | | console.log('权限检查:', this.permission) |
| | | return this.permission && this.permission.order_log_review === true |
| | | }, |
| | | hasRecallPaddingBtnPermission () { |
| | | // undefined 或 false 都返回 false,只有 true 返回 true |
| | | console.log('权限检查:', this.permission) |
| | | return this.permission && this.permission.order_log_recall === true |
| | | }, |
| | | //驳回按钮权限 |
| | | hasRejectionBtnPermission () { |
| | | // undefined 或 false 都返回 false,只有 true 返回 true |
| | | console.log('权限检查:', this.permission) |
| | | return this.permission && this.permission.rejection_btn === true |
| | | }, |
| | | //自己点发布 |
| | | userPublishPush (id) { |
| | | this.$confirm('确定发布吗?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }).then(() => { |
| | | let response = userPublish(id) |
| | | this.$message.success('发布成功') |
| | | this.fetchTableData() |
| | | }, |
| | | computed: { |
| | | ...mapGetters(['userInfo', 'permission']), |
| | | filteredTabs() { |
| | | // rejection_and_draft 权限控制“已驳回”和“草稿”tab |
| | | const canShowRejectAndDraft = this.permission?.rejection_and_draft === true |
| | | return this.tabs.map(tab => { |
| | | if (tab.name === 'DRAFT') { |
| | | return { ...tab, isShow: canShowRejectAndDraft } |
| | | } |
| | | if (tab.name === 'REJECTED') { |
| | | return { ...tab, isShow: canShowRejectAndDraft } |
| | | } |
| | | return { ...tab, isShow: true } |
| | | }).filter(tab => tab.isShow) |
| | | }, |
| | | }) |
| | | }, |
| | | |
| | | methods: { |
| | | searchChange(params, done) { |
| | | console.log('searchChange') |
| | | this.query = params |
| | | this.parentId = '' |
| | | this.page.currentPage = 1 |
| | | this.onLoad(this.page, params) |
| | | done() |
| | | }, |
| | | 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() |
| | | }) |
| | | //删除 |
| | | deleteOrderLog (id) { |
| | | this.$confirm('确定删除吗?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }).then(() => { |
| | | let response = deleteOrderLog(id) |
| | | this.$message.success('删除') |
| | | this.fetchTableData() |
| | | }) |
| | | }, |
| | | refreshChange () { |
| | | this.fetchTableData() |
| | | }, |
| | | //获取航线列表 |
| | | async asyncgetWaylineFileListByArea (name) { |
| | | var wayLineListResponse = await getWaylineFileListByArea(this.userInfo.detail.areaCode) |
| | | this.wayLineList = wayLineListResponse.data.data |
| | | |
| | | |
| | | }, |
| | | selectionClear() { |
| | | this.selectionList = [] |
| | | this.$refs.crud.toggleSelection() |
| | | }, |
| | | async loadAMapScripts() { |
| | | try { |
| | | // await loadAMap(); |
| | | // await loadAMapUI(); |
| | | this.mapLoaded = true |
| | | } catch (error) { |
| | | console.error('Failed to load AMap scripts:', error) |
| | | this.$message.error('地图加载失败,请检查网络或API Key配置') |
| | | } |
| | | }, |
| | | formatCycleTime(row) { |
| | | return `${row.cycle_time_value}` |
| | | }, |
| | | |
| | | async fetchTableData() { |
| | | this.loading = true |
| | | try { |
| | | let params = this.getQueryParam() |
| | | console.log('发送的参数:', params) |
| | | const response = await getList(params, this.page.currentPage, this.page.pageSize) |
| | | if (!response?.data?.data?.records) { |
| | | throw new Error('接口返回数据格式不正确') |
| | | } |
| | | |
| | | const { total, records } = response.data.data |
| | | this.tableData = records.map(item => { |
| | | return item |
| | | }) |
| | | |
| | | |
| | | console.log('权限检查:', this.permission) |
| | | this.page.total = total || 0 |
| | | this.updateGlobalCounts() |
| | | } catch (error) { |
| | | console.error('获取数据失败:', error) |
| | | this.$message.error(error.message || '获取数据失败') |
| | | this.tableData = [] |
| | | this.page.total = 0 |
| | | } finally { |
| | | this.loading = false |
| | | } |
| | | }, |
| | | |
| | | getQueryParam() { |
| | | const currentTab = this.tabs.find(tab => tab.name === this.activeTab) |
| | | if (this.filters.dateRange) { |
| | | console.log( |
| | | 'this.formatDate(this.filters.dateRange[0])', |
| | | this.formatDate(this.filters.dateRange[0]) |
| | | ) |
| | | } |
| | | |
| | | const params = { |
| | | key_word: this.filters.key_word || undefined, |
| | | create_dept: this.filters.create_dept || undefined, |
| | | ai_types: |
| | | this.filters.ai_types && this.filters.ai_types.length > 0 |
| | | ? [this.filters.ai_types] |
| | | : null, |
| | | file_id: this.filters.file_id || undefined, |
| | | status: this.filters.status !== '' ? Number(this.filters.status) : currentTab?.value, |
| | | dept_id: this.filters.department || undefined, |
| | | creat_start_date: this.filters.dateRange?.[0] |
| | | ? this.formatDate(this.filters.dateRange[0]) |
| | | : undefined, |
| | | create_end_date: this.filters.dateRange?.[1] |
| | | ? this.formatDate(this.filters.dateRange[1]).replace('00:00:00', '23:59:59') |
| | | : undefined, |
| | | |
| | | start_date: this.filters.cycleDateRange?.[0] |
| | | ? this.formatDate(this.filters.cycleDateRange[0]) |
| | | : undefined, |
| | | end_date: this.filters.dateRacycleDateRangenge?.[1] |
| | | ? this.formatDate(this.filters.cycleDateRange[1]).replace('00:00:00', '23:59:59') |
| | | : undefined, |
| | | rep_fre_type: this.filters.rep_fre_type || undefined, |
| | | deal_time: this.filters.deal_time || undefined, |
| | | current: this.page.currentPage, |
| | | size: this.page.pageSize, |
| | | } |
| | | return params |
| | | }, |
| | | sizeChange(pageSize) { |
| | | this.page.pageSize = pageSize |
| | | }, |
| | | async submitForm(status) { |
| | | |
| | | this.$refs.testform.validate(async valid => { |
| | | |
| | | if (valid) { |
| | | 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]) |
| | | |
| | | const submitData = { |
| | | ...this.form, |
| | | |
| | | status: status, |
| | | } |
| | | await saveUpdateOrderLog(submitData) |
| | | let id = this.form.id |
| | | if (id) { |
| | | this.$message.success('工单发布成功') |
| | | } else { |
| | | this.$message.success('工单创建成功') |
| | | } |
| | | this.dialogVisible = false |
| | | this.detailVisible = false; |
| | | (this.device_sns = []), (this.wayLineList = []), this.fetchTableData() |
| | | } |
| | | }) |
| | | }, |
| | | //驳回原因显示 |
| | | async rejectDetail(id) { |
| | | const response = await orderLogDetails(id) |
| | | let data = response.data.data |
| | | this.$confirm(data.remark, '驳回原因', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }).then(() => { |
| | | this.form = { |
| | | ...response.data.data, |
| | | } |
| | | this.detailVisible = true |
| | | }) |
| | | }, |
| | | 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` |
| | | }, |
| | | |
| | | mapStatus(status) { |
| | | const statusTextMap = { |
| | | 0: '草稿', |
| | | 1: '待审核', |
| | | 2: '已驳回', |
| | | 3: '已通过', |
| | | } |
| | | return statusTextMap[status] || '未知状态' |
| | | }, |
| | | |
| | | getStatusTagType(status) { |
| | | const statusMap = { |
| | | 1: 'warning', |
| | | 2: 'info', |
| | | 3: 'primary', |
| | | 4: 'success', |
| | | 5: 'danger', |
| | | } |
| | | return statusMap[status] || 'info' |
| | | }, |
| | | |
| | | handleTabChange(tab) { |
| | | this.activeTab = tab.props?.name || tab.name |
| | | this.filters.status = '' |
| | | this.page.currentPage = 1 |
| | | this.fetchTableData() |
| | | }, |
| | | |
| | | handleSearch() { |
| | | this.page.currentPage = 1 |
| | | this.fetchTableData() |
| | | }, |
| | | |
| | | handleReset() { |
| | | this.filters = { |
| | | keyword: '', |
| | | department: '', |
| | | type: '', |
| | | dateRange: [], |
| | | status: '', |
| | | } |
| | | this.page.currentPage = 1 |
| | | this.fetchTableData() |
| | | }, |
| | | |
| | | currentChange(currentPage) { |
| | | this.page.currentPage = currentPage |
| | | }, |
| | | |
| | | async updateGlobalCounts() { |
| | | const counts = { |
| | | all: 0, |
| | | DRAFT: 0, |
| | | WAIT_AUDIT: 0, |
| | | REJECTED: 0, |
| | | PASS: 0, |
| | | |
| | | } |
| | | 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) |
| | | if (tab) { |
| | | tab.count = item.num |
| | | } |
| | | }) |
| | | |
| | | }, |
| | | |
| | | |
| | | handleAdd() { |
| | | this.form = {} |
| | | this.dialogVisible = true |
| | | //航线列表 |
| | | this.asyncgetWaylineFileListByArea() |
| | | }, |
| | | |
| | | resetForm() { |
| | | this.form = { |
| | | name: '', |
| | | type: '', |
| | | handler: '', |
| | | algorithm: '', |
| | | location: '', |
| | | address: '', |
| | | content: '', |
| | | photos: [], |
| | | } |
| | | if (this.$refs.testform) { |
| | | this.$refs.testform.resetFields() |
| | | } |
| | | }, |
| | | |
| | | formatLocation(location) { |
| | | if (!Array.isArray(location)) { |
| | | return '未知位置' |
| | | } |
| | | return `${location[0].toFixed(6)}, ${location[1].toFixed(6)}` |
| | | }, |
| | | async handleViewDetail(row) { |
| | | console.log("工单名称1111:") |
| | | const response = await orderLogDetails(row.id) |
| | | const data = response.data.data |
| | | |
| | | this.form = { |
| | | ...data, |
| | | } |
| | | |
| | | |
| | | this.detailVisible = true |
| | | |
| | | // 更新机巢列表 |
| | | 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.detailTitle = "工单详情" : this.detailTitle = "编辑工单" |
| | | console.log("工单名称:" + this.detailTitle) |
| | | }, |
| | | //导出 |
| | | async exportData() { |
| | | this.$confirm('是否智飞工单数据?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }).then(() => { |
| | | NProgress.start() |
| | | let params = this.getQueryParam() |
| | | orderLogExport(params).then(res => { |
| | | downloadXls(res.data, `智飞工单${this.$dayjs().format('YYYY-MM-DD')}.xlsx`) |
| | | NProgress.done() |
| | | }) |
| | | }) |
| | | }, |
| | | 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 |
| | | }, |
| | | hasPaddingBtnPermission() { |
| | | // undefined 或 false 都返回 false,只有 true 返回 true |
| | | console.log('权限检查:', this.permission) |
| | | return this.permission && this.permission.order_log_review === true |
| | | }, |
| | | hasRecallPaddingBtnPermission() { |
| | | // undefined 或 false 都返回 false,只有 true 返回 true |
| | | console.log('权限检查:', this.permission) |
| | | return this.permission && this.permission.order_log_recall === true |
| | | }, |
| | | //驳回按钮权限 |
| | | hasRejectionBtnPermission() { |
| | | // undefined 或 false 都返回 false,只有 true 返回 true |
| | | console.log('权限检查:', this.permission) |
| | | return this.permission && this.permission.rejection_btn === true |
| | | }, |
| | | //自己点发布 |
| | | userPublishPush(id) { |
| | | this.$confirm('确定发布吗?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }).then(() => { |
| | | let response = userPublish(id) |
| | | this.$message.success('发布成功') |
| | | this.fetchTableData() |
| | | |
| | | }) |
| | | }, |
| | | |
| | | //删除 |
| | | deleteOrderLog(id) { |
| | | this.$confirm('确定删除吗?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }).then(() => { |
| | | let response = deleteOrderLog(id) |
| | | this.$message.success('删除') |
| | | this.fetchTableData() |
| | | |
| | | }) |
| | | }, |
| | | refreshChange() { |
| | | this.fetchTableData() |
| | | }, |
| | | //获取航线列表 |
| | | async asyncgetWaylineFileListByArea(name) { |
| | | var wayLineListResponse = await getWaylineFileListByArea(this.userInfo.detail.areaCode) |
| | | this.wayLineList = wayLineListResponse.data.data |
| | | |
| | | this.initMapLine() |
| | | }, |
| | | |
| | | initMapLine() { |
| | | let currentLine = this.wayLineList.find(item => item.wayline_id == this.form.file_id) |
| | | |
| | | if (!currentLine) return |
| | | |
| | | // 异步解析kmz文件 |
| | | const analysis = async url => { |
| | | return new Promise(async resolve => { |
| | | const res = await analyzeKmzFile(`${url}?_t=${new Date().getTime()}`) |
| | | const templateXML = await res.fileInfoObj['wpmz/template.kml'] |
| | | const templateXMLJSON = XMLToJSON(templateXML)?.['Document'] |
| | | const templateXMLObj = removeTextKey(templateXMLJSON.Folder) |
| | | resolve(templateXMLObj) |
| | | }) |
| | | } |
| | | |
| | | const drawLine = async () => { |
| | | let prexUrl = ref(import.meta.env.VITE_APP_AIRLINE_URL + currentLine.object_key) |
| | | const res = await analysis(prexUrl.value) |
| | | if (!res.Placemark.length) return |
| | | renderingLine(res) |
| | | } |
| | | |
| | | const renderingLine = lineObj => { |
| | | const positions = lineObj.Placemark.map(item => { |
| | | return item.Point.coordinates.split(',') |
| | | }) |
| | | |
| | | this.$nextTick(() => { |
| | | if (this.$refs.MapContainer && this.$refs.MapContainer.initAddEntity) { |
| | | this.$refs.MapContainer.initAddEntity('polyline', positions) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | drawLine() |
| | | }, |
| | | |
| | | |
| | | |
| | | |
| | | //可飞行机巢列表 |
| | | async getFlyingNestBy(waylineId) { |
| | | this.initMapLine() |
| | | |
| | | //按照航线来 |
| | | const params = { |
| | | type: 0, |
| | | waylineId: waylineId, |
| | | } |
| | | var wayLineListResponse = await getFlyingNestBy(params) |
| | | this.device_sns = wayLineListResponse.data.data |
| | | }, |
| | | |
| | | //撤回 |
| | | async orderLogRecall(id) { |
| | | this.$confirm('确定撤回则到草稿箱。', '是否撤回?', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }).then(async () => { |
| | | let reposne = await orderLogRecall(id) |
| | | this.handleSearch() |
| | | }) |
| | | }, |
| | | onLoad() { |
| | | this.fetchTableData() |
| | | }, |
| | | /** |
| | | * 通过 |
| | | */ |
| | | async orderLogPass(id) { |
| | | let response = await orderLogPass(id) |
| | | let data = response.data.data |
| | | this.$message.success('审核通过') |
| | | this.detailVisible = false |
| | | }, |
| | | /** |
| | | * 驳回 |
| | | */ |
| | | 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.detailVisible = false |
| | | }) |
| | | }, |
| | | this.initMapLine() |
| | | }, |
| | | |
| | | watch: { |
| | | tableData: { |
| | | handler() { |
| | | // this.updateTabCounts() |
| | | }, |
| | | deep: true, |
| | | }, |
| | | initMapLine (infos = {}) { |
| | | let currentLine = this.wayLineList.find(item => item.wayline_id == this.form.file_id) |
| | | |
| | | if (!currentLine) return |
| | | |
| | | // 异步解析kmz文件 |
| | | const analysis = async url => { |
| | | return new Promise(async resolve => { |
| | | const res = await analyzeKmzFile(`${url}?_t=${new Date().getTime()}`) |
| | | const templateXML = await res.fileInfoObj['wpmz/template.kml'] |
| | | const templateXMLJSON = XMLToJSON(templateXML)?.['Document'] |
| | | const templateXMLObj = removeTextKey(templateXMLJSON.Folder) |
| | | resolve(templateXMLObj) |
| | | }) |
| | | } |
| | | |
| | | const drawLine = async () => { |
| | | let prexUrl = ref(import.meta.env.VITE_APP_AIRLINE_URL + currentLine.object_key) |
| | | const res = await analysis(prexUrl.value) |
| | | if (!res.Placemark.length) return |
| | | renderingLine(res) |
| | | } |
| | | |
| | | const renderingLine = lineObj => { |
| | | const positions = lineObj.Placemark.map(item => { |
| | | return item.Point.coordinates.split(',') |
| | | }) |
| | | |
| | | if (JSON.stringify(infos) != '{}') positions.unshift([ |
| | | infos[0].longitude, |
| | | infos[0].latitude, |
| | | ]) |
| | | |
| | | this.$nextTick(() => { |
| | | if (this.$refs.MapContainer && this.$refs.MapContainer.initAddEntity) { |
| | | this.$refs.MapContainer.initAddEntity('polyline', positions) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | drawLine() |
| | | }, |
| | | |
| | | //可飞行机巢列表 |
| | | async getFlyingNestBy (waylineId) { |
| | | this.initMapLine() |
| | | |
| | | //按照航线来 |
| | | const params = { |
| | | type: 0, |
| | | waylineId: waylineId, |
| | | } |
| | | var wayLineListResponse = await getFlyingNestBy(params) |
| | | this.device_sns = wayLineListResponse.data.data |
| | | }, |
| | | |
| | | //撤回 |
| | | async orderLogRecall (id) { |
| | | this.$confirm('确定撤回则到草稿箱。', '是否撤回?', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }).then(async () => { |
| | | let reposne = await orderLogRecall(id) |
| | | this.handleSearch() |
| | | }) |
| | | }, |
| | | onLoad () { |
| | | this.fetchTableData() |
| | | }, |
| | | /** |
| | | * 通过 |
| | | */ |
| | | async orderLogPass (id) { |
| | | let response = await orderLogPass(id) |
| | | let data = response.data.data |
| | | this.$message.success('审核通过') |
| | | this.detailVisibleCopy = false |
| | | }, |
| | | /** |
| | | * 驳回 |
| | | */ |
| | | 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 |
| | | }) |
| | | }, |
| | | }, |
| | | |
| | | watch: { |
| | | tableData: { |
| | | handler () { |
| | | // this.updateTabCounts() |
| | | }, |
| | | deep: true, |
| | | }, |
| | | }, |
| | | } |
| | | </script> |
| | | <style></style> |
| | | <style lang="scss" scoped> |
| | | :deep(.el-textarea__inner) { |
| | | padding: 8px 12px; |
| | | padding: 8px 12px; |
| | | } |
| | | |
| | | :deep(.el-input__inner), |
| | | :deep(.el-select), |
| | | :deep(.el-select .el-input) { |
| | | width: 100%; // 确保所有输入框和选择框宽度一致 |
| | | width: 100%; // 确保所有输入框和选择框宽度一致 |
| | | } |
| | | |
| | | .tab-content { |
| | | padding: 10px; |
| | | padding: 10px; |
| | | } |
| | | |
| | | .filter-bar { |
| | | display: flex; |
| | | // align-items: center; |
| | | // align-items: center; |
| | | |
| | | .search-bar-box { |
| | | margin-bottom: 15px; |
| | | flex-wrap: wrap; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | gap: 8px; |
| | | |
| | | .filter-item { |
| | | margin-right: 20px; |
| | | margin-bottom: 10px; |
| | | width: 200px; |
| | | &-item { |
| | | flex: 1; |
| | | |
| | | &> ::v-deep(.el-date-editor) { |
| | | width: 100%; |
| | | box-sizing: border-box; |
| | | } |
| | | } |
| | | |
| | | .frequency { |
| | | margin-left: 20px; |
| | | .search-btn { |
| | | flex: 1; |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | } |
| | | |
| | | .date-picker { |
| | | width: 240px; |
| | | .flex-2 { |
| | | min-width: 454px; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .action-bar { |
| | | margin-bottom: 16px; |
| | | margin-bottom: 16px; |
| | | } |
| | | |
| | | .el-tabs { |
| | | :deep(.el-tabs__content) { |
| | | overflow: visible; |
| | | } |
| | | :deep(.el-tabs__content) { |
| | | overflow: visible; |
| | | } |
| | | } |
| | | |
| | | .tab-content { |
| | | min-height: 200px; |
| | | min-height: 200px; |
| | | } |
| | | |
| | | .detail-form { |
| | | :deep(.el-form-item) { |
| | | margin-bottom: 10px; |
| | | } |
| | | :deep(.el-form-item) { |
| | | margin-bottom: 10px; |
| | | } |
| | | |
| | | :deep(.el-form-item__label) { |
| | | color: #606266; |
| | | font-weight: normal; |
| | | } |
| | | :deep(.el-form-item__label) { |
| | | color: #606266; |
| | | font-weight: normal; |
| | | } |
| | | |
| | | :deep(.el-form-item__content) { |
| | | color: #303133; |
| | | } |
| | | :deep(.el-form-item__content) { |
| | | color: #303133; |
| | | } |
| | | } |
| | | |
| | | .el-dialog { |
| | | .el-form-item { |
| | | margin-bottom: 20px; |
| | | } |
| | | .el-form-item { |
| | | margin-bottom: 20px; |
| | | } |
| | | } |
| | | |
| | | .el-upload { |
| | | width: 100%; |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | width: 100%; |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | |
| | | :deep(.el-upload-list__item) { |
| | | transition: all 0.3s ease; |
| | | } |
| | | :deep(.el-upload-list__item) { |
| | | transition: all 0.3s ease; |
| | | } |
| | | |
| | | :deep(.el-upload-list__item:hover) { |
| | | background-color: #f5f7fa; |
| | | } |
| | | :deep(.el-upload-list__item:hover) { |
| | | background-color: #f5f7fa; |
| | | } |
| | | } |
| | | |
| | | .el-upload__tip { |
| | | font-size: 12px; |
| | | color: #909399; |
| | | margin-top: 7px; |
| | | font-size: 12px; |
| | | color: #909399; |
| | | margin-top: 7px; |
| | | } |
| | | |
| | | .custom-steps-container { |
| | | width: 100%; |
| | | margin: 20px 0; |
| | | width: 100%; |
| | | margin: 20px 0; |
| | | } |
| | | |
| | | .steps-titles { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | margin-bottom: 16px; |
| | | position: relative; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | margin-bottom: 16px; |
| | | position: relative; |
| | | } |
| | | |
| | | .step-title { |
| | | text-align: center; |
| | | flex: 1; |
| | | font-size: 16px; |
| | | color: #999; |
| | | position: relative; |
| | | padding-bottom: 10px; |
| | | text-align: center; |
| | | flex: 1; |
| | | font-size: 16px; |
| | | color: #999; |
| | | position: relative; |
| | | padding-bottom: 10px; |
| | | } |
| | | |
| | | .step-title.active { |
| | | color: #409eff; |
| | | font-weight: bold; |
| | | color: #409eff; |
| | | font-weight: bold; |
| | | } |
| | | |
| | | .custom-steps { |
| | | margin-top: -20px; |
| | | /* 向上移动与标题重叠 */ |
| | | margin-top: -20px; |
| | | /* 向上移动与标题重叠 */ |
| | | } |
| | | |
| | | .el-step__head { |
| | | margin-top: 0; |
| | | margin-top: 0; |
| | | } |
| | | |
| | | .el-step__description { |
| | | margin-top: 8px; |
| | | padding: 0 20px; |
| | | margin-top: 8px; |
| | | padding: 0 20px; |
| | | } |
| | | |
| | | .step-description { |
| | | font-size: 14px; |
| | | color: #666; |
| | | line-height: 1.5; |
| | | font-size: 14px; |
| | | color: #666; |
| | | line-height: 1.5; |
| | | } |
| | | |
| | | .event-title-center { |
| | | text-align: center; |
| | | font-size: 20px; |
| | | font-weight: bold; |
| | | margin-bottom: 12px; |
| | | color: #333; |
| | | text-align: center; |
| | | font-size: 20px; |
| | | font-weight: bold; |
| | | margin-bottom: 12px; |
| | | color: #333; |
| | | } |
| | | |
| | | .cur-menu { |
| | | .menu-custom-box { |
| | | display: flex; |
| | | justify-content: center; |
| | | .menu-custom-box { |
| | | display: flex; |
| | | justify-content: center; |
| | | flex-wrap: wrap; |
| | | |
| | | &>div { |
| | | flex: 1; |
| | | } |
| | | &> ::v-deep(.el-button) { |
| | | flex: 1; |
| | | max-width: 44px; |
| | | |
| | | .audit-btn { |
| | | color: #1BA0FF; |
| | | } |
| | | |
| | | .withdraw-btn { |
| | | color: #FF5D9E; |
| | | } |
| | | |
| | | .reject-reason-btn { |
| | | color: #FF6A00; |
| | | } |
| | | |
| | | .edit-btn { |
| | | color: #00B187; |
| | | } |
| | | |
| | | .publish-btn { |
| | | color: #5E00FF; |
| | | } |
| | | |
| | | .delete-btn { |
| | | color: #FE0202; |
| | | } |
| | | |
| | | .detail-btn { |
| | | color: #1F4AFF; |
| | | } |
| | | &:nth-child(4n) { |
| | | margin-left: 0; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | .add-box-btns { |
| | | width: 100%; |
| | | display: flex; |
| | | justify-content: center; |
| | | width: 100%; |
| | | display: flex; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .flex { |
| | | display: flex; |
| | | } |
| | | |
| | | .flex-1 { |
| | | flex: 1; |
| | | |
| | | &> ::v-deep(div) { |
| | | width: 100% !important; |
| | | } |
| | | } |
| | | </style> |
| | | ` |
| | |
| | | <el-option v-for="item in types" :key="item.value" :label="item.label" :value="item.value" /> |
| | | </el-select> |
| | | <el-date-picker v-model="filters.dateRange" type="daterange" class="filter-item" range-separator="至" |
| | | start-placeholder="开始日期" end-placeholder="结束日期"> |
| | | start-placeholder="开始日期" end-placeholder="结束日期" :default-value="datePickerDefaultVal"> |
| | | </el-date-picker> |
| | | <el-select v-model="filters.status" placeholder="请选择状态" class="filter-item" clearable> |
| | | <el-option v-for="item in statuses" :key="item.value" :label="item.label" :value="item.value" /> |
| | |
| | | <el-option v-for="item in algorithms" :key="item.dict_key" :label="item.dict_value" |
| | | :value="item.dict_key" /> |
| | | </el-select> |
| | | <el-button type="primary" icon="el-icon-search" @click="handleSearch">查询</el-button> |
| | | <el-button icon="el-icon-refresh" @click="handleReset">重置</el-button> |
| | | <el-select v-model="filters.isReview" placeholder="请选择复核状态" class="filter-item" clearable> |
| | | <el-option v-for="item in reviewStatuses" :key="item.value" :label="item.label" :value="item.value" /> |
| | | </el-select> |
| | | <el-button type="primary" icon="el-icon-search" @click="handleSearch">搜索</el-button> |
| | | <el-button icon="el-icon-refresh" @click="handleReset">清空</el-button> |
| | | </div> |
| | | |
| | | <!-- 表格部分 --> |
| | |
| | | <el-button type="text" icon="el-icon-delete" class="danger-button" |
| | | @click="handleDelete(row)">删除</el-button> |
| | | </template> |
| | | |
| | | <template v-else> |
| | | <el-button type="text" icon="el-icon-view" @click="handleViewDetail(row)">详情</el-button> |
| | | </template> |
| | | |
| | | <el-button v-if="row.status === 4 && row.isReview !== 1" type="text" icon="el-icon-check" |
| | | @click="reCheck(row)">复核</el-button> |
| | | </template> |
| | | <template #status="{ row }"> |
| | | <span :style="getStatusTagType(row.status) ? 'color:' + getStatusTagType(row.status) : ''"> |
| | |
| | | </template> |
| | | <template #keyData="{ row }"> |
| | | <span>{{ row.address }}</span> |
| | | </template> |
| | | |
| | | <template #isReview="{ row }"> |
| | | <span>{{ showIsReviewText(row) }}</span> |
| | | </template> |
| | | </avue-crud> |
| | | </div> |
| | |
| | | </div> |
| | | |
| | | <!-- 上传图片 --> |
| | | <div v-if="[3, 4].includes(currentDetail.status)" class="form-section" style="margin-bottom: 32px;"> |
| | | <div v-if="[3].includes(currentDetail.status)" class="form-section" style="margin-bottom: 32px;"> |
| | | <div class="section-title" v-if="hasProcessedAndOverBtnPermission()"> |
| | | <!-- 已完成状态显示必填星号 --> |
| | | <template v-if="currentDetail.status === 4"> |
| | | <template v-if="currentDetail.status === 3"> |
| | | <span class="required-label"> |
| | | <span class="required-star">*</span>上传图片 |
| | | </span> |
| | |
| | | <el-col :span="12"> |
| | | <div class="media-box"> |
| | | <!-- 根据状态显示不同的标题和内容 --> |
| | | <template v-if="currentDetail.status === 5"> |
| | | <template v-if="currentDetail.status === 4"> |
| | | <div class="media-title">工单处理图片</div> |
| | | <div class="media-content"> |
| | | <el-image v-if="currentDetail.updatePhotoUrl" :src="getThumbUrl(currentDetail.updatePhotoUrl)" |
| | |
| | | </template> |
| | | <template v-else-if="currentDetail.status === 0"> |
| | | <el-button v-if="hasProcessingBtnPermission()" type="primary" :loading="dispatchLoading" |
| | | @click="approveAndDispatch">通过并派发</el-button> |
| | | @click="approveAndDispatch">受理</el-button> |
| | | <el-button v-if="hasProcessingBtnPermission()" type="danger" :loading="rejectLoading" |
| | | @click="rejectTicket">不通过</el-button> |
| | | @click="rejectTicket">不受理</el-button> |
| | | <el-button @click="detailVisible = false">取消</el-button> |
| | | </template> |
| | | <template v-if="currentDetail.status === 3"> |
| | |
| | | </template> |
| | | <template v-else-if="currentDetail.status === 4"> |
| | | <!-- 已完成 --> |
| | | <el-button v-if="hasProcessedAndOverBtnPermission()" type="primary" :loading="finalizeLoading" |
| | | @click="finalizeTicket">完结工单</el-button> |
| | | <!-- <el-button v-if="hasProcessedAndOverBtnPermission()" type="primary" :loading="finalizeLoading" |
| | | @click="finalizeTicket">完结工单</el-button> --> |
| | | <el-button @click="detailVisible = false">取消</el-button> |
| | | </template> |
| | | <template v-else-if="currentDetail.status === 5"> |
| | |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- 复核弹出层 --> |
| | | |
| | | <el-dialog v-model="reCheckDialog" title="工单复核" width="30%" append-to-body custom-class="re-check-dialog" |
| | | @close="reCheckDialog = false"> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="reCheckConfirm(1)">人工复核</el-button> |
| | | <el-button type="primary" @click="reCheckConfirm(2)">机器复核</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getList, createTicket, getTicketInfo, flowEvent, getstatusCount, getStepInfo } from '@/api/tickets/ticket' |
| | | import { ElMessageBox, ElLoading } from 'element-plus' |
| | | import { calculateDefaultRange } from '@/utils/util' |
| | | import { gcj02ToWgs84, wgs84ToGcj02 } from '@/utils/coordinateTransformation' |
| | | import { |
| | | getList, |
| | | createTicket, |
| | | getTicketInfo, |
| | | flowEvent, |
| | | getstatusCount, |
| | | getStepInfo, |
| | | getReviewById, |
| | | getCreateEventJob |
| | | } from '@/api/tickets/ticket' |
| | | import { export_json_to_excel } from '@/utils/exportExcel' |
| | | import geoJson from '@/assets/geoJson.json' |
| | | |
| | |
| | | { label: "待处理", name: "processing", value: 0, count: 0 }, |
| | | { label: "处理中", name: "inProgress", value: 3, count: 0 }, |
| | | { label: "已完成", name: "completed", value: 4, count: 0 }, |
| | | { label: "已完结", name: "closed", value: 5, count: 0 }, |
| | | // { label: "已完结", name: "closed", value: 5, count: 0 }, |
| | | { label: "我发起的工单", name: "myTickets", value: null, count: 0 }, |
| | | ], |
| | | filters: { |
| | |
| | | dateRange: [], |
| | | status: "", |
| | | algorithm: "", // 新增算法筛选字段 |
| | | isReview: "", // 添加复核状态筛选字段 |
| | | }, |
| | | departments: [], |
| | | types: [], |
| | |
| | | { label: "处理中", value: "3" }, |
| | | { label: "已完成", value: "4" }, |
| | | { label: "已完结", value: "5" }, |
| | | ], |
| | | reviewStatuses: [ |
| | | { label: "否", value: 0 }, |
| | | { label: "是", value: 1 } |
| | | ], |
| | | tableData: [], |
| | | option: { |
| | |
| | | page: true, |
| | | column: [ |
| | | // { label: "序号", prop: "id", width: 70 }, |
| | | { label: "工单编号", prop: "orderNumber", width: 150, overHidden: true, tooltip: true }, |
| | | { label: "工单名称", prop: "orderName", width: 170, overHidden: true, tooltip: true }, |
| | | { label: "所属单位", prop: "department", width: 100, overHidden: true, tooltip: true }, |
| | | { label: "工单编号", prop: "orderNumber", width: 120, overHidden: true, tooltip: true }, |
| | | { label: "工单名称", prop: "orderName", width: 150, overHidden: true, tooltip: true }, |
| | | { label: "所属单位", prop: "department", overHidden: true, tooltip: true }, |
| | | { label: "发起时间", prop: "startTime", width: 160 }, |
| | | { label: "关联算法", prop: "aiType", width: 160, overHidden: true, tooltip: true }, |
| | | { label: "工单类型", prop: "type", width: 120, overHidden: true, tooltip: true }, |
| | | { label: "关联算法", prop: "aiType", width: 150, overHidden: true, tooltip: true }, |
| | | { label: "工单类型", prop: "type", width: 130, overHidden: true, tooltip: true }, |
| | | { |
| | | label: "工单内容", |
| | | prop: "content", |
| | | slot: true, |
| | | width: 190, |
| | | width: 152, |
| | | overHidden: true |
| | | }, |
| | | { label: "创建人", prop: "creator", width: 100 }, |
| | | { label: "处理人", prop: "handler", width: 100 }, |
| | | { label: "工单状态", prop: "status", slot: true, width: 90 } |
| | | { |
| | | slot: true, |
| | | hide: false, |
| | | label: "复核状态", |
| | | prop: "isReview", |
| | | width: 90, |
| | | }, |
| | | { label: "工单状态", prop: "status", slot: true, width: 90 }, |
| | | |
| | | ], |
| | | }, |
| | | page: { |
| | |
| | | currentImageIndex: 1, // 新增:当前图片索引 |
| | | totalTime: '', |
| | | isShowInfo: false, |
| | | |
| | | // 配置时间选择器默认配置 |
| | | datePickerDefaultVal: calculateDefaultRange(), |
| | | |
| | | // 复核弹窗 |
| | | reCheckDialog: false, |
| | | } |
| | | }, |
| | | created () { |
| | |
| | | // 其它tab直接用接口返回的stepInfos |
| | | return this.stepInfos.map(step => String(step.status)) |
| | | }, |
| | | |
| | | showIsReviewText () { |
| | | return (row) => { |
| | | if (['4', '5'].includes(String(row.status))) return row.isReview === 1 ? '是' : '否' |
| | | |
| | | return '/' |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | async loadAMapScripts () { |
| | |
| | | is_draft: currentTab?.name === 'myTickets' ? 1 : undefined, |
| | | |
| | | user_id: currentTab?.name === 'myTickets' ? this.userInfo.user_id : undefined, |
| | | is_review: this.filters.isReview === '' ? undefined : this.filters.isReview, // 添加复核状态查询参数 |
| | | } |
| | | |
| | | const response = await getList(params) |
| | |
| | | work_type: item.work_type !== undefined ? Number(item.work_type) : 0, // 保留work_type字段并转为数字 |
| | | job_name: item.job_name || '', |
| | | job_create_time: item.job_create_time || '', |
| | | isReview: item.is_review, // 添加复核状态字段映射 |
| | | } |
| | | }) |
| | | |
| | |
| | | return |
| | | } |
| | | |
| | | let [lng, lat] = this.disposeLocation(true, this.form) |
| | | |
| | | const submitData = { |
| | | eventName: this.form.name, |
| | | content: this.form.content, |
| | | workType: "1", |
| | | longitude: String(this.form.location[0]), |
| | | latitude: String(this.form.location[1]), |
| | | longitude: lng, |
| | | latitude: lat, |
| | | address: this.form.address, |
| | | workOrderTypeDictKey: this.form.type, |
| | | aiType: Array.isArray(this.form.algorithm) ? this.form.algorithm : [this.form.algorithm], // 传数组 |
| | |
| | | if (!handlerValue || handlerValue === '未分配') { |
| | | handlerValue = undefined |
| | | } |
| | | |
| | | let [lng, lat] = this.disposeLocation(true, this.form) |
| | | |
| | | const submitData = { |
| | | id: this.form.id, |
| | | eventName: this.form.name || undefined, |
| | | content: this.form.content || undefined, |
| | | workType: "1", |
| | | longitude: this.form.location?.[0] ? String(this.form.location[0]) : undefined, |
| | | latitude: this.form.location?.[1] ? String(this.form.location[1]) : undefined, |
| | | longitude: lng, |
| | | latitude: lat, |
| | | address: this.form.address || undefined, |
| | | workOrderTypeDictKey: this.form.type || undefined, |
| | | aiType: this.form.algorithm && this.form.algorithm.length > 0 |
| | |
| | | |
| | | handleTabChange (tab) { |
| | | this.activeTab = tab.props?.name || tab.name |
| | | |
| | | const isReview = this.findObject(this.option.column, 'isReview') |
| | | // 根据条件切换显隐 |
| | | isReview.hide = !['all', 'completed', 'myTickets'].includes(this.activeTab) |
| | | |
| | | this.handleReset() |
| | | this.page.currentPage = 1 |
| | | this.fetchTableData() |
| | |
| | | dateRange: [], |
| | | status: "", |
| | | algorithm: "", // 重置时清空算法筛选 |
| | | isReview: "", // 重置时清空复核状态 |
| | | } |
| | | this.page.currentPage = 1 |
| | | this.fetchTableData() |
| | |
| | | const steps = Array.isArray(stepResponse.data.data) |
| | | ? stepResponse.data.data |
| | | : stepResponse.data.data?.steps || [] |
| | | const finishedStep = steps.find(s => String(s.status) === '5') |
| | | const finishedStep = steps.find(s => String(s.status) === '4') |
| | | this.totalTime = finishedStep && finishedStep.total_time ? finishedStep.total_time : '' |
| | | if (this.activeTab !== 'myTickets') { |
| | | this.stepInfos = steps.map(step => ({ |
| | |
| | | this.$message.warning('请先填写事件处理详情') |
| | | return |
| | | } |
| | | // 检查图片上传 |
| | | if (!this.currentDetail.photos || this.currentDetail.photos.length === 0) { |
| | | this.$message.warning('请选择上传图片') |
| | | this.completeLoading = false |
| | | return |
| | | } |
| | | |
| | | |
| | | const data = { |
| | | id: this.currentDetail.id, |
| | |
| | | isPass: 0, // 0 表示通过 |
| | | eventName: this.currentDetail.orderName, // 工单名称 |
| | | eventNum: this.currentDetail.orderNumber, |
| | | eventType: this.currentDetail.type, // 工单类型 |
| | | workOrderTypeDictKey: this.currentDetail.type, // 直接使用原始的 dict_key |
| | | content: this.currentDetail.content, // 使用 content 替代原来的 remark |
| | | createDept: this.dispatchForm.department, // 派发部门 ID |
| | | updateUser: this.dispatchForm.handler, // 处理人 ID |
| | | } |
| | | |
| | | |
| | | const file = this.currentDetail.file || null // 如果没有文件,则为 null |
| | | |
| | |
| | | photos: [], |
| | | } |
| | | |
| | | this.form.location = Array.isArray(row.location) && row.location.length >= 2 |
| | | ? [ |
| | | Number(row.location[0]), |
| | | Number(row.location[1]), |
| | | let curLocation = [] |
| | | |
| | | if (Array.isArray(row.location) && row.location.length >= 2) { |
| | | let [lng, lat] = this.disposeLocation(false, row) |
| | | |
| | | curLocation = [ |
| | | lng, |
| | | lat, |
| | | row.location[2] || row.address || '' |
| | | ] |
| | | : [] |
| | | } |
| | | |
| | | this.form.location = curLocation |
| | | this.form.address = this.form.location[2] || '' |
| | | // 设置地图中心点 |
| | | if (Array.isArray(this.form.location) && this.form.location.length >= 2) { |
| | |
| | | }) |
| | | |
| | | this.dialogVisible = true |
| | | }, |
| | | |
| | | // 添加数据监听以确保算法数据的响应性 |
| | | watch: { |
| | | 'form.algorithm': { |
| | | handler (newVal) { |
| | | console.log('算法值变化:', newVal) |
| | | }, |
| | | deep: true |
| | | } |
| | | }, |
| | | |
| | | // 添加删除方法 |
| | |
| | | if (lastDot === -1) return url |
| | | return url.slice(0, lastDot) + '_show' + url.slice(lastDot) |
| | | }, |
| | | |
| | | /** |
| | | * 坐标转换方法处理 |
| | | * @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 |
| | | |
| | | 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)) |
| | | } |
| | | } |
| | | |
| | | return [String(lng), String(lat)] |
| | | }, |
| | | |
| | | // 复核按钮 |
| | | reCheck (row) { |
| | | this.reCheckData = row |
| | | this.reCheckDialog = true |
| | | }, |
| | | |
| | | // 复核确认框按钮事件 |
| | | reCheckConfirm (key) { |
| | | const that = this |
| | | if (key == 1) { |
| | | getReviewById(this.reCheckData.id).then(res => { |
| | | this.reCheckDialog = false |
| | | this.page.currentPage = 1 |
| | | this.fetchTableData() |
| | | this.fetchTabCounts() |
| | | }) |
| | | } else { |
| | | |
| | | const loading = ElLoading.service({ |
| | | lock: true, |
| | | text: '复核任务创建中……', |
| | | background: 'rgba(0, 0, 0, 0.7)', |
| | | }) |
| | | |
| | | // 获取时间的接口 |
| | | getCreateEventJob(that.reCheckData.id).then(res => { |
| | | loading.close() |
| | | |
| | | ElMessageBox.confirm(`预计复核执行时间为${res.data.data}`, '提示', { |
| | | confirmButtonText: '确定', |
| | | showCancelButton: false, // 关键配置 |
| | | type: 'warning' |
| | | }).then(() => { |
| | | this.reCheckDialog = false |
| | | this.page.currentPage = 1 |
| | | this.fetchTableData() |
| | | this.fetchTabCounts() |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | }, |
| | | } |
| | | </script> |
| | |
| | | } |
| | | } |
| | | |
| | | .re-check-dialog { |
| | | :deep(.el-dialog__body) { |
| | | padding: 0; |
| | | background-color: #f5f7fa; |
| | | } |
| | | } |
| | | |
| | | .review-container { |
| | | position: relative; |
| | | |