From d2e610d8814c4f2dbd4f0b8825ae595871668237 Mon Sep 17 00:00:00 2001 From: licp <lichunping@guanfang.com.cn> Date: 星期二, 09 四月 2024 15:52:48 +0800 Subject: [PATCH] 特殊的表格合并 --- src/components/tool/value-table.vue | 42 ++++++++++++++++++--- src/components/view/b1-inspect-order-plan.vue | 4 -- src/components/view/b1-expenses.vue | 50 +++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 10 deletions(-) diff --git a/src/components/tool/value-table.vue b/src/components/tool/value-table.vue index d13d1f4..6942552 100644 --- a/src/components/tool/value-table.vue +++ b/src/components/tool/value-table.vue @@ -100,7 +100,7 @@ @row-click="rowClick" :show-summary="data.countFleid!=undefined && data.countFleid.length > 0" :summary-method="getSummaries" :row-class-name="tableRowClassName" :row-key="record=>record.id" :current-row-key="data.currentId" - highlight-current-row + :highlight-current-row="data.highlight===undefined||data.highlight" :span-method="spanMethod"> <el-table-column type="selection" width="65" v-if="data.showSelect" :key="Math.random()"> </el-table-column> @@ -390,8 +390,12 @@ // position:0 // } ], - testArr: [], - testPosition: 0, + specialSpanList:[ + // { + // arr:[], + // position:0 + // } + ], } }, watch: { @@ -435,6 +439,7 @@ }); }, spanMethod({ row, column, rowIndex, columnIndex }){ + // 涓�鑸殑鍚堝苟琛� if(this.data.spanConfig!=undefined&&this.data.spanConfig.rows&&this.data.spanConfig.rows.length>0){ let i = null; let obj = this.data.spanConfig.rows.find((item,index)=>{ @@ -443,6 +448,22 @@ }) if(obj){ const _row = this.spanList[i].arr[rowIndex]; + const _col = _row > 0 ? 1 : 0; + return { + rowspan: _row, + colspan: _col, + }; + } + } + // 鐗规畩鐨勫悎骞惰 + if(this.data.spanConfig!=undefined&&this.data.spanConfig.special&&this.data.spanConfig.special.main&&this.data.spanConfig.special.rows&&this.data.spanConfig.special.rows.length>0){ + let i = null; + let obj = this.data.spanConfig.special.rows.find((item,index)=>{ + i = index; + return item.index==columnIndex + }) + if(obj){ + const _row = this.specialSpanList[i].arr[rowIndex]; const _col = _row > 0 ? 1 : 0; return { rowspan: _row, @@ -519,6 +540,7 @@ }) } } + // 涓�鑸殑鍚堝苟琛� if(this.data.spanConfig!=undefined&&this.data.spanConfig.rows&&this.data.spanConfig.rows.length>0){ this.spanList = []; this.data.spanConfig.rows.forEach((item,index)=>{ @@ -528,9 +550,17 @@ }) this.rowspan(this.spanList[index].arr, this.spanList[index].position, item.name); }) - // this.testArr = [] - // this.testPosition = 0 - // this.rowspan(this.testArr, this.testPosition, this.data.spanConfig.rows.name); + } + // 鐗规畩鐨勫悎骞惰 + if(this.data.spanConfig!=undefined&&this.data.spanConfig.special&&this.data.spanConfig.special.main&&this.data.spanConfig.special.rows&&this.data.spanConfig.special.rows.length>0){ + this.specialSpanList = [] + this.data.spanConfig.special.rows.forEach((item,index)=>{ + this.specialSpanList.push({ + arr:[], + position:0 + }) + this.rowspan(this.specialSpanList[index].arr, this.specialSpanList[index].position, this.data.spanConfig.special.main); + }) } this.loading = false }).catch(e => { diff --git a/src/components/view/b1-expenses.vue b/src/components/view/b1-expenses.vue index 4f667ad..cf2a16d 100644 --- a/src/components/view/b1-expenses.vue +++ b/src/components/view/b1-expenses.vue @@ -40,6 +40,12 @@ } </style> +<style> + .el-table tbody tr:hover > td { + background-color: transparent !important; + } +</style> + <template> <div class="inspection_order"> <div style="width: 100%;height: 100%;"> @@ -112,8 +118,52 @@ isIndex: true, showSelect: false, select: false, + highlight:false, do: [], linkEvent:{}, + spanConfig:{ + //鍚堝苟琛� + rows:[ + { + name:'createTime', + index:1 + }, + { + name:'entrustCode', + index:2 + }, + { + name:'company', + index:8 + }, + { + name:'name', + index:9 + }, + ], + // 鐗规畩鐨勫悎骞惰锛屾牴鎹甿ain鍜宺ows鐨刵ame鏉ュ悎骞� + special:{ + main:'insSampleId', + rows:[ + { + name:'sample', + index:3 + }, + { + name:'model', + index:4 + }, + { + name:'num', + index:5 + }, + { + name:'price', + index:6 + }, + ] + } + }, tagField: { type: { select: [{ diff --git a/src/components/view/b1-inspect-order-plan.vue b/src/components/view/b1-inspect-order-plan.vue index deabb5e..3162412 100644 --- a/src/components/view/b1-inspect-order-plan.vue +++ b/src/components/view/b1-inspect-order-plan.vue @@ -286,10 +286,6 @@ }] } }, - spanConfig:{ - rows:'entrustCode',//鍚堝苟琛�,閫氬父娑夊強涓�涓瓧娈� - cols:[],//鍚堝苟鍒�,閫氬父娑夊強鍑犱釜瀛楁 - }, selectField: {}, requiredAdd: [], requiredUp: [] -- Gitblit v1.9.3