From 9d5a91f5382f2cc626ad1bca1b36cd67a5c2182d Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期四, 28 三月 2024 11:41:59 +0800
Subject: [PATCH] 否则会影响其他页面
---
src/components/makepager/CommonFormTableView.vue | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 102 insertions(+), 9 deletions(-)
diff --git a/src/components/makepager/CommonFormTableView.vue b/src/components/makepager/CommonFormTableView.vue
index 32876d8..bca864a 100644
--- a/src/components/makepager/CommonFormTableView.vue
+++ b/src/components/makepager/CommonFormTableView.vue
@@ -3,11 +3,13 @@
<el-form ref="form" :model="tableList" :show-message="false" label-position="right">
<el-table
ref="fromTable"
+ :border="isBorder"
:data="tableList.tableData"
:show-summary="showSummary.show"
:summary-method="getSummaries"
:span-method="arraySpanMethod"
style="width: 100%"
+ :header-cell-style="{ background: '#f1f3f8', color: '#000009', 'font-size': '14px', 'font-family': 'PingFangSC' }"
@selection-change="handleSelectionChange"
:row-key="(row) => row.productId"
>
@@ -15,14 +17,18 @@
</el-table-column>
<el-table-column v-if="tableList.isReturn" type="index" label="#" width="50" align="center"></el-table-column>
<el-table-column
+ align="center"
v-for="(item, i) in tableList.tableColumn"
:key="i"
:prop="item.prop"
:label="item.label"
:width="item.width"
:min-width="item.min"
- align="center"
- >
+ show-overflow-tooltip
+ :sortable="item.sortable"
+ v-if="(item.isShowColumn&&colOpenShow)||item.isShowColumn==undefined"
+ >
+ <!-- 鎵�鏈夌殑琛ㄦ牸淇敼涓哄彲閰嶇疆琛ㄥご鐨勪箣鍚� v-if淇敼涓簐-if="item.isShowColumn" -->
<!-- 琛ㄥご鏍峰紡 -->
<template slot="header">
<span v-if="item.isRequird" style="color: #f56c6c">*</span>
@@ -198,13 +204,20 @@
<span v-else style="text-align: right">{{ scope.row[item.prop] }}</span>
</template>
</el-table-column>
- <el-table-column label="鎿嶄綔" width="40" v-if="!detailEnter" align="center">
+ <el-table-column label="鎿嶄綔" width="70" v-if="!detailEnter" align="center" fixed='right'>
<template slot-scope="scope">
+
<el-button type="text" size="small" :disabled="!isOperate" @click="deleteClick(scope)">鍒犻櫎</el-button>
</template>
</el-table-column>
<slot name="tableButton" />
</el-table>
+ <div class="styleBtn" v-if="colOpenShow">
+ <i @click="checkCol()" class="label">...</i>
+ <el-checkbox-group v-model="showcol" v-show="iscolopen" class="checkbox-group" @change="selectCheckBoxList">
+ <el-checkbox v-for="item in tableList.allcol" :label="item" :key="item">{{ item }} </el-checkbox>
+ </el-checkbox-group>
+ </div>
</el-form>
<div v-if="!detailEnter" style="margin: 10px">
<el-button size="small" type="primary" :disabled="!isOperate" @click="add">鏂板</el-button>
@@ -249,6 +262,11 @@
type: Boolean,
default: false
},
+ // 鏄惁鍙互閰嶇疆鍒楄〃 琛ㄥご
+ colOpenShow: {
+ type: Boolean,
+ default: false,
+ },
selectBox: {
type: Boolean,
default: false
@@ -273,12 +291,18 @@
type: Boolean,
default: true
},
+ isBorder:{
+ type: Boolean,
+ default: false
+ },
productTableList: {
type: Object,
default: () => {
return {
tableData: [], // 鎺ュ彛杩斿洖鏁版嵁
isReturn: false,
+ allcol: [],
+ showcol: [],
tableColumn: [
// table琛ㄥ崟
{ label: "", prop: "", min: 200, tooltip: true }
@@ -311,7 +335,10 @@
infomation: {}
},
productIndex: 0,
- isRecalculate: true
+ isRecalculate: true,
+ iscolopen: false,
+ showcol: [],
+ mergeNumber:1
}
},
created() {
@@ -323,13 +350,40 @@
watch:{
"productTableList": {
handler() {
+ this.showcol = this.productTableList.showcol
this.getTableInfo()
},
immediate: true
- }
+ },
+ "productTableList.showcol": {
+ handler(newVal) {
+ this.showcol = newVal
+ this.getMergeNumber()
+ },
+ immediate: true
+ },
},
computed: {},
methods: {
+ getMergeNumber(){
+ let pattern=new RegExp("[0-9]+");
+ if(pattern.test(this.showSummary.mergeNumber)){
+ this.mergeNumber=this.showSummary.mergeNumber
+ }else{
+ for(let i in this.showcol){
+ if(this.showcol[i]==this.showSummary.mergeNumber){
+ this.mergeNumber=Number(i)+1;
+ }
+ }
+ }
+ },
+ checkCol() {
+ this.iscolopen = !this.iscolopen
+ },
+ selectCheckBoxList(val) {
+ this.getMergeNumber()
+ this.$emit("selTableCol", val)
+ },
getTableInfo(){
this.tableList = this.productTableList
if (this.tableList.tableData.length === 1 && this.tableList.tableData[0].name === "") {
@@ -368,11 +422,11 @@
if (this.$refs.table) {
var current = this.$refs.table.querySelector(".el-table__footer-wrapper").querySelector(".el-table__footer")
var cell = current.rows[0].cells
- for (let i = 0; i < this.showSummary.mergeNumber; i++) {
+ for (let i = 0; i < this.mergeNumber; i++) {
cell[i].style.display = "none"
}
- cell[this.showSummary.mergeNumber].classList.remove("is-left")
- cell[this.showSummary.mergeNumber].colSpan = this.showSummary.mergeNumber.toString()
+ cell[this.mergeNumber].classList.remove("is-left")
+ cell[this.mergeNumber].colSpan = this.mergeNumber.toString()
}
})
}
@@ -383,7 +437,7 @@
const sums = []
columns.forEach((column, index) => {
// // 鏇存敼琛屽悕绉�
- if (index === this.showSummary.mergeNumber) {
+ if (index === this.mergeNumber) {
sums[index] = "灏忚:"
return
}
@@ -612,6 +666,7 @@
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.page-view {
+ position: relative;
.el-form-item {
margin-bottom: 0;
.custom-name {
@@ -640,9 +695,47 @@
.el-table th.el-table__cell > .cell {
padding: 0 5px;
}
+ .el-table__fixed-footer-wrapper tbody td.el-table__cell{
+ background:#fff;
+ }
.el-input__inner {
// text-align: left;
text-align: center !important;
}
+ .styleBtn {
+ position: absolute;
+ width: 30px;
+ height: 48px;
+ // line-height: 26px;
+ // background: #06c062;
+ top: 0;
+ right: -6px;
+ z-index: 11;
+ .label {
+ position: absolute;
+ top: 11px;
+ font-size: 20px;
+ // line-height: 5px;
+ cursor: pointer;
+ color: #000;
+ transform: rotate(-90deg);
+ }
+ .checkbox-group {
+ width: 160px;
+ height: 180px;
+ overflow: auto;
+ display: flex;
+ flex-direction: column;
+ line-height: 25px;
+ background: #ffffff;
+ border-radius: 16px;
+ padding: 12px;
+ position: absolute;
+ right: 0;
+ top: 30px;
+ z-index: 99;
+ box-shadow: 0 0 2px 2px #f8f8f8;
+ }
+ }
}
</style>
--
Gitblit v1.8.0