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

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