From 82a0439f46b893e008ce9156ab172fb3de7f1060 Mon Sep 17 00:00:00 2001 From: zss <zss@example.com> Date: 星期五, 12 四月 2024 14:15:39 +0800 Subject: [PATCH] 表单修改 --- src/views/common/ztt-table.vue | 68 ++++++++++++++++++++++++++------- 1 files changed, 53 insertions(+), 15 deletions(-) diff --git a/src/views/common/ztt-table.vue b/src/views/common/ztt-table.vue index 717635e..794915e 100644 --- a/src/views/common/ztt-table.vue +++ b/src/views/common/ztt-table.vue @@ -150,6 +150,7 @@ v-on="$listeners" :highlight-current-row="true" :row-key="rowKey" + :tree-props="{children: 'children', hasChildren: 'hasChildren'}" @row-dblclick="dbClickRow" @row-contextmenu="contextMenu" @header-click="headClick" @@ -174,6 +175,7 @@ v-loading="dataListLoading" element-loading-text="鍔犺浇涓�..." element-loading-spinner="el-icon-loading" + :expand-row-keys="expandRowKeys" > <!--澶氶�夋嫨妗�--> <el-table-column @@ -182,6 +184,7 @@ v-if="options.multiSelect && !isEdit" style="width: 55px;" :selectable="selectHandle" + > </el-table-column> <!--鍗曢�夋--> @@ -324,8 +327,13 @@ <template v-else> <template v-if="!item.render"> <template v-if="item.formatter"> - <span v-if="item.isTag" style="text-align: center;"> + <span v-if="item.isTag&&scope.row[item.prop]!=null" style="text-align: center;"> <el-tag style="width:60px;margin: 3px;" :type="scope.row[item.prop] == 0 ? 'success' : 'info'"> + <span v-html="item.formatter(scope.row, item, scope.row[item.prop])"></span> + </el-tag> + </span> + <span v-if="item.isTags&&scope.row[item.prop]!=null" style="text-align: center;"> + <el-tag style="width:60px;margin: 3px;" :type="scope.row[item.prop] == '姝e父' ? 'success' : (scope.row[item.prop] == '寮傚父'?'warning':(scope.row[item.prop] == '杩斾慨'?'danger':'info'))"> <span v-html="item.formatter(scope.row, item, scope.row[item.prop])"></span> </el-tag> </span> @@ -547,6 +555,10 @@ column: { type: Object, default: null + }, + expandRowKeys: { + type: Array, + default: ()=>[] } }, render: (h, data) => { @@ -567,6 +579,13 @@ default: ()=>{ return 'id' } + }, + //闇�瑕佸悎骞剁殑瀛楁闆嗗悎 + mergeSpanArr: { + type: Array, + default: ()=>{ + return [] + } }, toolbarMaxLength: { type: Number, @@ -928,22 +947,41 @@ }, objectSpanMethod({ row, column, rowIndex, columnIndex }) { if (this.options.tableCellMerge) { - let result = '' - this.$emit( - 'objectSpanMethod', - row, - column, - rowIndex, - columnIndex, - (val) => { - if (val) { - result = val + const propName = column.property + if (propName) { + if(this.mergeSpanArr.includes(propName)){ + if (rowIndex > 0 && row[propName] === this.tableData[rowIndex - 1][propName]) { + return { rowspan: 0, colspan: 0 }; + } else { + let rowspan = 1; + for (let i = rowIndex + 1; i < this.tableData.length; i++) { + if (this.tableData[i][propName] === row[propName]) { + rowspan++; + } else { + break; + } + } + return { rowspan: rowspan, colspan: 1 }; + } } - } - ) - if (result) { - return result } + // let result = '' + // this.$emit( + // 'objectSpanMethod', + // row, + // column, + // rowIndex, + // columnIndex, + // (val) => { + // console.log(val); + // if (val) { + // result = val + // } + // } + // ) + // if (result) { + // return result + // } } }, getDataList(selectedId) { -- Gitblit v1.9.3