项目清单确认流程只能单选(优化代码)

This commit is contained in:
yanyizhou
2021-10-09 16:16:33 +08:00
parent d82440e435
commit d5d514c739
3 changed files with 61 additions and 22 deletions
@@ -53,6 +53,7 @@
height="70%"
style="width: 100%; border:1px solid #ccc"
@selection-change="selectStandChange"
@select="handleSelectionChange"
:header-cell-style="{background: '#e8e8e8', color: '#333333', fontSize: '16px',
fontWeight: 'bold', height: '48px'}">
<el-table-column
@@ -303,6 +304,7 @@
:header-cell-style="{background: '#f5f1f1', color: '#333333', fontSize: '16px',
fontWeight: 'bold', height: '48px'}"
@selection-change="selectListChange"
@select="handleSelectionChanges"
ref="selection"
>
<el-table-column
@@ -430,6 +432,20 @@ export default {
};
},
methods: {
// 表格勾选
handleSelectionChange(selection, val) {
if (selection.length > 1) {
let del_row = selection.shift();
this.$refs.selection.toggleRowSelection(del_row, false);
// this.$refs.listSelection.toggleRowSelection(del_row, false);
}
},
handleSelectionChanges(selection, val) {
if (selection.length > 1) {
let del_row = selection.shift();
this.$refs.selection.toggleRowSelection(del_row, false);
}
},
getData() {
queryTaskFirst({
bpnId: this.$route.query.bpnId
@@ -650,6 +666,10 @@ export default {
}
}
/deep/ .el-table__header-wrapper .el-checkbox {
display: none;
}
.choiceBtn {
.el-button--primary {
width: 150px;
@@ -55,6 +55,7 @@
height="70%"
style="width: 100%; border:1px solid #ccc"
@selection-change="selectStandChange"
@select="handleSelectionChange"
:header-cell-style="{background: '#e8e8e8', color: '#333333', fontSize: '16px',
fontWeight: 'bold', height: '48px'}">
<el-table-column
@@ -305,6 +306,7 @@
:header-cell-style="{background: '#f5f1f1', color: '#333333', fontSize: '16px',
fontWeight: 'bold', height: '48px'}"
@selection-change="selectListChange"
@select="handleSelectionChanges"
ref="listSelection"
>
<el-table-column
@@ -433,6 +435,20 @@ export default {
};
},
methods: {
// 表格勾选
handleSelectionChange(selection, val) {
if (selection.length > 1) {
let del_row = selection.shift();
this.$refs.selection.toggleRowSelection(del_row, false);
// this.$refs.listSelection.toggleRowSelection(del_row, false);
}
},
handleSelectionChanges(selection, val) {
if (selection.length > 1) {
let del_row = selection.shift();
this.$refs.listSelection.toggleRowSelection(del_row, false);
}
},
//tab发生变化
handleTabs(type) {
this.active = type;
@@ -538,14 +554,7 @@ export default {
},
//项目的多选框改变
selectListChange(data) {
// 单选
if (data.length > 1) {
this.$refs.listSelection.clearSelection()
this.$refs.listSelection.toggleRowSelection(data.pop())
}
this.multipleSelection = data
this.selectedList = data;
this.selectedList = data;
},
pageChange(page) {
this.page = page;
@@ -676,6 +685,10 @@ export default {
}
}
/deep/ .el-table__header-wrapper .el-checkbox {
display: none;
}
.choiceBtn {
.el-button--primary {
width: 150px;
@@ -195,6 +195,7 @@
:header-cell-style="{background: '#f5f1f1', color: '#333333', fontSize: '16px',
fontWeight: 'bold', height: '48px'}"
@selection-change="selectProjectChange"
@select="handleSelectionChange"
ref="projectSelection"
>
<el-table-column
@@ -298,6 +299,7 @@
:header-cell-style="{background: '#f5f1f1', color: '#333333', fontSize: '16px',
fontWeight: 'bold', height: '48px'}"
@selection-change="selectListChange"
@select="handleSelectionChanges"
ref="listSelection"
>
<el-table-column
@@ -463,6 +465,20 @@ export default {
this.commentText = mes.commentText;
});
},
// 表格勾选
handleSelectionChange(selection, val) {
if (selection.length > 1) {
let del_row = selection.shift();
this.$refs.projectSelection.toggleRowSelection(del_row, false);
// this.$refs.listSelection.toggleRowSelection(del_row, false);
}
},
handleSelectionChanges(selection, val) {
if (selection.length > 1) {
let del_row = selection.shift();
this.$refs.listSelection.toggleRowSelection(del_row, false);
}
},
handleTabs(type) {
this.active = type;
},
@@ -623,24 +639,10 @@ export default {
},
//清单勾选框数据
selectListChange(data) {
// 单选
if (data.length > 1) {
this.$refs.listSelection.clearSelection()
this.$refs.listSelection.toggleRowSelection(data.pop())
}
this.multipleSelection = data
this.selectedList = data;
},
//项目勾选框数据
selectProjectChange(data) {
// 单选
if (data.length > 1) {
this.$refs.projectSelection.clearSelection()
this.$refs.projectSelection.toggleRowSelection(data.pop())
}
this.multipleSelection = data
this.selectProject = data;
},
//提交事件
@@ -758,6 +760,10 @@ export default {
}
}
/deep/ .el-table__header-wrapper .el-checkbox {
display: none;
}
/deep/ .el-drawer__container {
.prc-content-border {
border: none;