From 5ecb7958c96d3f0b6d47b79aff7eb306c2cf690f Mon Sep 17 00:00:00 2001 From: charles <981744753@qq.com> Date: 星期二, 06 八月 2024 11:16:58 +0800 Subject: [PATCH] gitlab上面的wms转移到公司git --- src/components/makepager/TableCommonView.vue | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 51 insertions(+), 7 deletions(-) diff --git a/src/components/makepager/TableCommonView.vue b/src/components/makepager/TableCommonView.vue index df44eff..d4bc001 100644 --- a/src/components/makepager/TableCommonView.vue +++ b/src/components/makepager/TableCommonView.vue @@ -22,7 +22,7 @@ :summary-method="getSummaries" :show-summary="showSummary" > - <el-table-column v-if="tableList.selectBox" type="selection" width="40"> </el-table-column> + <el-table-column v-if="tableList.selectBox" type="selection" width="40" :selectable="selectable"> </el-table-column> <el-table-column v-if="tableList.selectIndex" type="index" label="搴忓彿" width="50"> </el-table-column> <el-table-column v-for="(item, i) in tableList.tableColumn" @@ -102,6 +102,10 @@ export default { name: "TableCommonView", props: { + warehouseId:{ + type:Number, + default:0 + }, tableList: { type: Object, default: () => { @@ -151,6 +155,15 @@ showSummary: { type: Boolean, default: false + }, + // 鍒楄〃涓嶅彲閫夌殑鏁版嵁 + selectBoxList: { + type: Array, + default: () => [] + }, + name:{ + type:String, + default:'' } }, data() { @@ -210,12 +223,20 @@ }, // 鍗曢�夎鐩稿叧 tableRowClassName({ row }) { - if (Object.keys(this.selectClassRow).length > 0) { - if (row.id == this.selectClassRow.id) { - return "onSelect" + if(this.$route.query.workType!=1){ + if(Object.keys(this.selectClassRow).length>0&&this.selectClassRow.location){ + if(this.selectClassRow.id==row.id&&this.selectClassRow.location.warehouseId==row.location.warehouseId&&row.location.name==this.selectClassRow.location.name){ + return "onSelect"; + } + } + } else{ + if (Object.keys(this.selectClassRow).length > 0) { + if (row.id == this.selectClassRow.id) { + return "onSelect" + } + } } - } - this.$emit("tableRowClassName", row) + this.$emit("tableRowClassName", row); }, timeAgo(val) { return timeago(val) @@ -232,7 +253,7 @@ } this.tableList.countcol.forEach((countcols) => { if (column.label === countcols) { - const values = data.map((item) => Number(item[column.property])) + const values = (data||[]).map((item) => Number(item[column.property])) if (!values.every((value) => isNaN(value))) { sums[index] = values.reduce((prev, curr) => { const value = Number(curr) @@ -253,6 +274,28 @@ }) }) return sums + } + }, + selectable(row) { + let prop='id' + if(this.name=='product'){ + prop='productId' + } + if(this.$route.query.workType!=1){ + const flag= this.selectBoxList.some(item=>{ + if(item.location){ + return item[prop]==row.id&&item.location.warehouseId==row.location.warehouseId&&item.location.name==row.location.name; + } + return false; + }) + return !flag; + }else{ + let list = (this.selectBoxList||[]).map((item) => item[prop]) + if (list.findIndex((v) => v == row.id) == -1) { + return true + } else { + return false + } } } } @@ -392,6 +435,7 @@ .el-table__cell.is-right { text-align: right !important; } + .el-table::before{ width: 0px; } } .overSpread1 { width: 100%; -- Gitblit v1.8.0