From 93e2493c1951202698c47a764dd1215dfd56ce6b Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Mon, 26 May 2025 17:16:49 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9=E6=A0=91?= =?UTF-8?q?=E5=BD=A2=20=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/task/list/patrol.vue | 59 ++++++++++++++++++++++++++++++---- vue.config.js | 2 +- 2 files changed, 54 insertions(+), 7 deletions(-) diff --git a/src/views/task/list/patrol.vue b/src/views/task/list/patrol.vue index e43b540..0c93883 100644 --- a/src/views/task/list/patrol.vue +++ b/src/views/task/list/patrol.vue @@ -59,7 +59,9 @@ :list="list" :total="total" stripe - + :row-key="'id'" + :default-expand-all="false" + :treeProps="{children: 'children', hasChildren: 'hasChildren'}" @cell-dblclick='cellClicks' @selection-change='selectionChange' @pageSizeChange="e => {select.page_size = e,getList()}" @@ -227,13 +229,18 @@ checkAll:false, selectMission:[], table:[{ + label:"问题类型", + prop:'ask_value', + width:120, + },{ label:"问题描述", prop:'ask_introduce', align:'left' - },{ - label:"问题类型", - prop:'ask.value', - width:80, + }, + { + label:"状态", + width:120, + prop:'fix_status_name' }, { label:"检查地点", @@ -440,6 +447,20 @@ k.missionName = k.mission?k.mission.name:'日常巡查' console.log("k.missionName",k.missionName) k.is_myself = false + if(k.fix_status===null){ + this.statusLabel.map(s=>{ + if(s.id==k.status){ + k.fix_status_name = s.value + } + }) + // for(var s of this.statusLabel){ + // if(item.id==k.status){ + // k.fix_status_name = item.value + // } + // } + }else{ + k.fix_status_name = k.fix_status==1?'已完成':'已列计划' + } if(k.status==2||k.status==3||k.status==4||k.status==7){ if(k.accept_admin_ids&&k.accept_admin_ids.length>0){ for(var a of k.accept_admin_ids){ @@ -457,11 +478,34 @@ } } } - this.list = res.data + this.list = this.groupByAskId(res.data) + console.log("this.list",this.list) // this.currentTableList = this.filterBySelectedMonths(this.list,this.selectMission) // console.log("currentTableList",this.currentTableList) this.total = res.total }, + groupByAskId(items) { + const groups = {}; + + items.forEach(item => { + const { ask_id } = item; + if (!groups[ask_id]) { + // 创建新组,第一个元素作为父级的ask + groups[ask_id] = { + ask_id, + id:ask_id, + ask_value:item.ask.value, + ask: { ...item }, + children: [] + }; + } + // 无论是否是第一个元素,都添加到children数组 + groups[ask_id].children.push({ ...item }); + }); + + // 转换为数组格式 + return Object.values(groups); + }, handleCheckAllChange() { // let _checkAll = this.checkAll ? false : true // console.log("_checkAll",_checkAll) @@ -636,6 +680,9 @@ this.$refs.addPatrol.isShow=true }, cellClicks(e){ + if(e.row.ask_value){ + return + } this.$refs.showPatrol.id= e.row.id // this.$refs.showPatrol.id= id diff --git a/vue.config.js b/vue.config.js index c1b0b04..8b49cd5 100644 --- a/vue.config.js +++ b/vue.config.js @@ -25,7 +25,7 @@ module.exports = { * Detail: https://cli.vuejs.org/config/#publicpath */ publicPath: process.env.ENV === 'staging' ? '/admin_test' : '/admin', - outputDir: '/Users/mac/Documents/朗业/2024/h-河道处项目/a-安全生产/safety-manage-service/public/admin', + outputDir: '/Users/mac/Documents/朗业/2024/h-河道处项目/a-安全生产/safety-manage-service/public/admin_test', assetsDir: 'static', lintOnSave: process.env.NODE_ENV === 'development', productionSourceMap: false,