diff --git a/src/components/XyTable/index.vue b/src/components/XyTable/index.vue index 3184ed9..d78d421 100644 --- a/src/components/XyTable/index.vue +++ b/src/components/XyTable/index.vue @@ -709,7 +709,7 @@ export default { show-overflow-tooltip={item.showOverflowTooltip ?? true} align={item.align ?? "center"} header-align={item.headerAlign ?? "center"} - class-name={`xy-table__row-fade ${item.className}`} + class-name={`xy-table__row-fade ${item.className} ${item.prop}`} label-class-name={`xy-table__title-fade ${item.labelClassName}`} selectable={item.selectable} reserve-selection={item.reserveSelection} diff --git a/src/utils/contactTable.js b/src/utils/contactTable.js index baaf1e6..136c846 100644 --- a/src/utils/contactTable.js +++ b/src/utils/contactTable.js @@ -51,10 +51,10 @@ export const getMergeCells = (tableData = [], tableColumn = [], mergeCols = []) export const groupBy = (arr, prop) => { return arr.sort((a, b) => { if (a[prop] < b[prop]) { - return 1; + return -1; } if (a[prop] > b[prop]) { - return -1; + return 1; } return 0; }); diff --git a/src/views/task/list/components/addPlan.vue b/src/views/task/list/components/addPlan.vue index b3751e4..e5d17de 100644 --- a/src/views/task/list/components/addPlan.vue +++ b/src/views/task/list/components/addPlan.vue @@ -223,13 +223,13 @@
- 参与对象: + 责任科室:
部门 - 人员 - 组别 +
diff --git a/src/views/task/list/components/addUnit.vue b/src/views/task/list/components/addUnit.vue index 2843099..a33f2da 100644 --- a/src/views/task/list/components/addUnit.vue +++ b/src/views/task/list/components/addUnit.vue @@ -51,7 +51,7 @@
@@ -88,6 +97,10 @@ saveAs } from "file-saver"; import state from '@/store/modules/user.js' + import { + getMergeCells, + groupBy + } from '@/utils/contactTable.js' export default{ components:{ addPatrol, @@ -104,7 +117,7 @@ select:{ keyword:'', page:1, - page_size:10, + page_size:9999, status:'', myself:0, mission_id:'', @@ -179,21 +192,8 @@ } ], table:[{ - type:'selection', - // selectable:(row,index)=>{ - // if((this.is_guiji||this.is_chuzhang||this.login_id==row.up_admin_id)&&row.status==0){ - // return true - // }else{ - // return false - // } - // } - },{ label:"任务名称", - prop:'mission', - align:'left', - formatter:(cell,data,value,index)=>{ - return value?value.name:'日常巡查' - } + prop:'missionName', // width:180 },{ label:"状态", @@ -395,6 +395,18 @@ }], } }, + computed: { + // 获取所有单元格合并数据 + spanArr() { + for(var k in this.list){ + if (!this.list.length) return [] + const mergeCols = ['missionName'] // 需要合并的列(字段) + // const data = groupBy(this.list, 'monthIndex') + // console.log("data",data) + return getMergeCells(this.list, this.table, mergeCols) + } + } + }, created(){ // this.getUserId() @@ -468,9 +480,19 @@ // } }, + spanMethod({ + row, + colomn, + rowIndex, + columnIndex + }) { + return this.spanArr[rowIndex][columnIndex] + }, async getList(){ const res = await listpatrol({...this.select}) for(var k of res.data){ + k.missionName = k.mission?k.mission.name:'日常巡查' + console.log("k.missionName",k.missionName) k.is_myself = false if(k.status==2||k.status==3||k.status==4||k.status==7){ if(k.accept_admin_ids&&k.accept_admin_ids.length>0){ @@ -703,6 +725,9 @@