From 7a63fc77e172acc23bd8c0b7b314886c1753dd5d Mon Sep 17 00:00:00 2001 From: shen_yan_pu <1975145892@qq.com> Date: Tue, 17 Aug 2021 16:53:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E5=87=86=E6=B8=85=E5=8D=95=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=88=97=E8=A1=A8=E9=80=89=E6=8B=A9=E6=B8=85=E5=8D=95?= =?UTF-8?q?=E5=8D=95=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/creatProcess/bzqdfb/step1-1.vue | 105 ++++++++++++------ .../pages/creatProcess/bzqdfb/step1.vue | 36 +++++- 2 files changed, 108 insertions(+), 33 deletions(-) diff --git a/src/pages/processCenter/pages/creatProcess/bzqdfb/step1-1.vue b/src/pages/processCenter/pages/creatProcess/bzqdfb/step1-1.vue index ab09a65c8..f5d40035c 100644 --- a/src/pages/processCenter/pages/creatProcess/bzqdfb/step1-1.vue +++ b/src/pages/processCenter/pages/creatProcess/bzqdfb/step1-1.vue @@ -108,7 +108,8 @@ label="标准号"> @@ -728,7 +746,7 @@ import ProcessHeader from "../../components/ProcessHeader"; import ProcessFooter from "../../components/ProcessFooter"; import ProcessTitle from "../../components/ProcessTitle"; -import { saveTaskFirst, queryTaskFirst } from "api/process"; +import {saveTaskFirst, queryTaskFirst} from "api/process"; import seeDatalis from "@/pages/localTool/standContrast/pages/seeDatalis"; export default { @@ -778,21 +796,21 @@ export default { }, formRules: { listType: [ - { required: true, message: "请选择清单类型", trigger: "change" } + {required: true, message: "请选择清单类型", trigger: "change"} ], listName: [ - { required: true, message: "请填写清单名称", trigger: "change" } + {required: true, message: "请填写清单名称", trigger: "change"} ] }, roleFormRules: { dockUserName: [ - { required: true, message: "请选择会签责任人", trigger: "change" } + {required: true, message: "请选择会签责任人", trigger: "change"} ], ministerUserName: [ - { required: true, message: "请选择修订责任人", trigger: "change" } + {required: true, message: "请选择修订责任人", trigger: "change"} ], directorUserName: [ - { required: true, message: "请选择审批责任人", trigger: "change" } + {required: true, message: "请选择审批责任人", trigger: "change"} ] }, dataList: [],//清单里的标准数据 @@ -947,14 +965,14 @@ export default { _this: this }, res => { this.sarAccessListDatas = res.data.records; - this.sarAccessListDatas.forEach(item =>{ + this.sarAccessListDatas.forEach(item => { // 适用车型转换 if (item.carType !== null) { let k = (item.carType || "").split(',') for (let i in this.energyKindOptions) { - for (let m = 0; m< k.length; m++) { + for (let m = 0; m < k.length; m++) { if (this.energyKindOptions[i].value === k[m]) { - k[m] = this.energyKindOptions[i].label + k[m] = this.energyKindOptions[i].label } item.carType = k.join(',') } @@ -1097,7 +1115,7 @@ export default { this.$refs["Form"].validate((valid) => { if (valid) { this.isSubmit = true - this.$http.get("lawss/activiti/startProcess", { type: "4" }, { + this.$http.get("lawss/activiti/startProcess", {type: "4"}, { _this: this }, res => { if (res.ok) { @@ -1129,8 +1147,8 @@ export default { // 删除上传的文件 delFileInfo(file, fileList) { this.fileInfoList.forEach((item, index) => { - if (item.name === file.name || item.id === file.id ) { - this.fileInfoList.splice(index,1) + if (item.name === file.name || item.id === file.id) { + this.fileInfoList.splice(index, 1) } }) }, @@ -1276,7 +1294,7 @@ export default { this.listForm.listName = this.selectedList[0].detailedListName; this.listForm.descriptionList = this.selectedList[0].remark; // 将查询出的文件名字和id组合成数组 - if(this.selectedList[0].fileName !== null) { + if (this.selectedList[0].fileName !== null) { let textName = this.selectedList[0].fileName.split(',').map(item => { return { name: item @@ -1290,7 +1308,7 @@ export default { textName.forEach(item => { this.$set(item, 'id', '') }) - for (let i = 0; i< textName.length; i++) { + for (let i = 0; i < textName.length; i++) { textName[i].id = textId[i].id } this.fileInfoList = textName @@ -1300,7 +1318,7 @@ export default { this.ListModel = false; this.$http.get("sarLawsAttrDetailedList/sar-laws-attr-detailed-list/selectLawsById", - { id: this.selectedList[0].id, page: this.page, Size: this.pageSize }, { + {id: this.selectedList[0].id, page: this.page, Size: this.pageSize}, { _this: this }, res => { if (res.data === null) { @@ -1308,10 +1326,10 @@ export default { } this.dataList = res.data.records; this.dataList.forEach(item => { - if (item.xcxssrqgj === null){ + if (item.xcxssrqgj === null) { this.$set(item, "XCXSSRQ", ''); this.$set(item, "ZCCSSRQ", ''); - }else{ + } else { this.$set(item, "XCXSSRQ", item.xcxssrqgj); this.$set(item, "ZCCSSRQ", item.zccssrqgj); } @@ -1324,8 +1342,6 @@ export default { this.listForm.inforlist = formId.join(","); }, e => { }); - } else if (this.selectedList.length > 1) { - this.$message.warning("只能选择一条数据进行带入"); } else { this.$message.warning("请选择一条数据进行带入"); } @@ -1337,6 +1353,33 @@ export default { this.selectedList.push(data[0]); } }, + // 表格某一行的单击事件 + rowClick(row, column) { + const selectData = this.selectList + this.$refs.selection.clearSelection() + if (selectData.length === 1) { + selectData.forEach(item => { + // 判断 如果当前的一行被勾选, 再次点击的时候就会取消选中 + if (item === row) { + this.$refs.selection.toggleRowSelection(row, false); + } + // 不然就让当前的一行勾选 + else { + this.$refs.selection.toggleRowSelection(row, true); + } + }) + } else { + this.$refs.selection.toggleRowSelection(row, true); + } + }, + select(selection, row) { + // 清除 所有勾选项 + this.$refs.selection.clearSelection() + // 当表格数据都没有被勾选的时候 就返回 + // 主要用于将当前勾选的表格状态清除 + if (selection.length === 0) return + this.$refs.selection.toggleRowSelection(row, true) + }, //标准表格选择框改变 selectStandChange(data) { this.selectList = []; diff --git a/src/pages/processCenter/pages/creatProcess/bzqdfb/step1.vue b/src/pages/processCenter/pages/creatProcess/bzqdfb/step1.vue index 1ff1baf56..7bc613d02 100644 --- a/src/pages/processCenter/pages/creatProcess/bzqdfb/step1.vue +++ b/src/pages/processCenter/pages/creatProcess/bzqdfb/step1.vue @@ -302,6 +302,8 @@ height="100%" :header-cell-style="{background: '#f5f1f1', color: '#333333', fontSize: '16px', fontWeight: 'bold', height: '48px'}" + @row-click="rowClick" + @select="select" @selection-change="selectListChange" ref="selection" > @@ -371,6 +373,8 @@ height="100%" :header-cell-style="{background: '#f5f1f1', color: '#333333', fontSize: '16px', fontWeight: 'bold', height: '48px'}" + @row-click="rowClick" + @select="select" @selection-change="selectListChange" ref="selection" > @@ -440,6 +444,8 @@ height="100%" :header-cell-style="{background: '#f5f1f1', color: '#333333', fontSize: '16px', fontWeight: 'bold', height: '48px'}" + @row-click="rowClick" + @select="select" @selection-change="selectListChange" ref="selection" > @@ -1301,8 +1307,6 @@ export default { this.listForm.inforlist = formId.join(","); }, e => { }); - } else if (this.selectedList.length > 1) { - this.$message.warning("只能选择一条数据进行带入"); } else { this.$message.warning("请选择一条数据进行带入"); } @@ -1321,10 +1325,38 @@ export default { this.selectList.push(data[i].id); } }, + select(selection, row) { + // 清除 所有勾选项 + this.$refs.selection.clearSelection() + // 当表格数据都没有被勾选的时候 就返回 + // 主要用于将当前勾选的表格状态清除 + if(selection.length === 0) return + this.$refs.selection.toggleRowSelection(row, true) + }, //添加标准select的改变 selectThree(data) { this.standList = data; }, + // 表格某一行的单击事件 + rowClick(row, column) { + const selectData = this.selectList + this.$refs.selection.clearSelection() + if( selectData.length === 1 ) { + selectData.forEach(item => { + // 判断 如果当前的一行被勾选, 再次点击的时候就会取消选中 + if (item === row) { + this.$refs.selection.toggleRowSelection(row, false); + } + // 不然就让当前的一行勾选 + else { + this.$refs.selection.toggleRowSelection(row, true); + } + }) + } + else { + this.$refs.selection.toggleRowSelection(row, true); + } + }, choiceZRR(type, title, id) { this.nodeList = []; this.nodeList.push(id);