From 6a891b851e322f6fe948310f6aaa9680cae81835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E4=BC=9F=E4=BD=B3?= <2797716443@qq.com> Date: Mon, 29 Nov 2021 20:45:27 +0800 Subject: [PATCH] commit --- .../pages/creatProcess/xmpg2/step5.vue | 400 +++++++++--------- 1 file changed, 199 insertions(+), 201 deletions(-) diff --git a/src/pages/processCenter/pages/creatProcess/xmpg2/step5.vue b/src/pages/processCenter/pages/creatProcess/xmpg2/step5.vue index 9a38ead1b..a66f721c1 100644 --- a/src/pages/processCenter/pages/creatProcess/xmpg2/step5.vue +++ b/src/pages/processCenter/pages/creatProcess/xmpg2/step5.vue @@ -5,36 +5,22 @@
-
基础信息
-
审批历史
+
基础信息
+
审批历史
-
+
- + - - + + - - + + @@ -42,75 +28,53 @@ - - - - - - - - +
+
+ 批量分发责任人 + +
+
+ + - + - + - + - + - - @@ -238,7 +148,7 @@ import ProcessHeader from "../../components/ProcessHeader"; import ProcessFooter from "../../components/ProcessFooter"; import ProcessTitle from "../../components/ProcessTitle"; -import { inboundLiaisonDetail, saveTaskForPub ,changeAssigneeNew } from "api/process"; +import { changeAssigneeNew, inboundLiaisonDetail, saveTaskForPub } from "api/process"; export default { name: "xmpg2Step5", @@ -252,7 +162,7 @@ export default { isTransfer: false, // 调整处理人抽屉状态 drawerModal: false, - workPeopleList:[], + workPeopleList: [], //防止按钮点击过快的按钮loading buttonLoading: false, //刷新表格 @@ -282,8 +192,8 @@ export default { }, //表单的数据 listForm: { - projectNumber: "", //项目编号 - projectName: "", //项目名称 + projectNumber: "", //项目编号 + projectName: "", //项目名称 dataList: [], //项目下的标准数据 children: [] //标准下的分解单数据 }, @@ -298,45 +208,45 @@ export default { }, methods: { //确认转办 - checkedTransferRole (data) { - this.assigneeNewLoading = true + checkedTransferRole(data) { + this.assigneeNewLoading = true; changeAssigneeNew({ taskId: this.$route.query.taskIds, // 任务id assignee: data[0].id, // 被委托人 userId: this.$store.getters.userInfo.userId, // 委托人 pId: this.$route.query.prcId // 流程实例 }).then(res => { - this.isTransfer = false + this.isTransfer = false; if (res.success) { - this.drawerModal = false - this.$message.success('调整成功') + this.drawerModal = false; + this.$message.success("调整成功"); this.$router.push("/processCenter"); - this.processNum() + this.processNum(); } else { - this.$message.warning(res.message) + this.$message.warning(res.message); } - }) + }); }, // 请求转换流程图 - processNum (row) { + processNum(row) { axios.request({ - url: '/api/lawss/activiti/getImg?_t=' + new Date().getTime(), - responseType: 'blob', - method: 'get', + url: "/api/lawss/activiti/getImg?_t=" + new Date().getTime(), + responseType: "blob", + method: "get", params: { prcNum: this.$route.query.prcNum } }).then(res => { // let blob = new Blob([res.data], {type: 'image/jpg'}) // let url = window.URL.createObjectURL(res.data) - this.processStep = window.URL.createObjectURL(res.data) - }) + this.processStep = window.URL.createObjectURL(res.data); + }); }, //转办事件 - handleTransfer(){ - this.drawerModal = true - this.drawerTitle = '转办处理人' - this.selectPeople = row + handleTransfer() { + this.drawerModal = true; + this.drawerTitle = "转办处理人"; + this.selectPeople = row; }, // 点击查看 handlePreview(item) { @@ -407,6 +317,7 @@ export default { }, //动态表单读取 getFormFieldList(item) { + console.log(item); this.$nextTick(() => { this.listForm = JSON.parse(JSON.stringify(item)); if (item.form === undefined) { @@ -444,9 +355,18 @@ export default { } }); this.listForm.children = children; + this.dataList.forEach(item => { + this.$set(item, "workPeople", "请选择责任人"); + }); + console.log(this.dataList); } else { this.listForm = item.form; this.dataList = item.form.dataList; + this.dataList.forEach(item => { + this.$set(item, "workPeople", "请选择责任人"); + this.$set(item, "workPeopleId", ""); + }); + console.log(this.dataList); } }); }, @@ -471,19 +391,21 @@ export default { }, //提交事件 handleSubmit() { - let dataChildren = [] - let dataListChildren = [] + let dataChildren = []; + let dataListChildren = []; this.dataList.forEach(item => { - dataChildren.push(item.children) - }) - dataChildren.forEach((item,index) => { - dataListChildren = dataListChildren.concat(item) - }) + dataChildren.push(item.children); + }); + dataChildren.forEach((item, index) => { + dataListChildren = dataListChildren.concat(item); + }); this.isSubmit = true; this.listForm.commentText = this.commentText; - this.listForm.children = dataListChildren - this.listForm.dataList = this.dataList + this.listForm.children = dataListChildren; + this.listForm.dataList = this.dataList; const json = JSON.stringify(this.listForm); + console.log(json); + return; this.$http.post("lawss/activiti/completeTask", { taskIds: this.taskIds, userId: this.userId, @@ -501,7 +423,8 @@ export default { }, //批量分发按钮 choiceZRRS(row, type, index) { - this.selectedId = row.id; + console.log(row); + this.selectedId = row.id || row.standId; this.type = type; if (type === 1) { this.drawerTitle = "选择责任人"; @@ -522,24 +445,86 @@ export default { } } //批量分发某标准下的责任人 - else if (type === 3){ + else if (type === 3) { //弹出选人框 // if (this.tableExpand === false){ - this.modalshowflag = true; - this.drawerTitle = "批量选择责任人"; + this.modalshowflag = true; + this.drawerTitle = "批量选择责任人"; // } //展开表格 - this.workPeopleList = row + this.workPeopleList = row; // console.log('279',row.children) - this.refreshTable = false + this.refreshTable = false; // this.tableExpand = !this.tableExpand this.$nextTick(() => { - this.refreshTable = true + this.refreshTable = true; }); } }, + setChildren(children, type) { + // 编辑多个子层级 + children.map(j => { + this.toggleSelection(j, type); + if (j.children) { + this.setChildren(j.children, type); + } + }); + }, + // 选中父节点时,子节点一起选中取消 + select(selection, row) { + const hasSelect = selection.some(el => { + return row.id === el.id; + }); + if (hasSelect) { + if (row.children) { + // 解决子组件没有被勾选到 + this.setChildren(row.children, true); + } + } else { + if (row.children) { + this.setChildren(row.children, false); + } + } + }, + toggleSelection(row, select) { + if (row) { + this.$nextTick(() => { + this.$refs.myTable && + this.$refs.myTable.toggleRowSelection(row, select); + }); + } + }, + // 选择全部 + selectAll(selection) { + // dataList第一层只要有在selection里面就是全选 + const isSelect = selection.some(el => { + const dataListIds = this.dataList.map(j => j.id); + return dataListIds.includes(el.id); + }); + // dataList第一层只要有不在selection里面就是全不选 + const isCancel = !this.dataList.every(el => { + const selectIds = selection.map(j => j.id); + return selectIds.includes(el.id); + }); + if (isSelect) { + selection.map(el => { + if (el.children) { + // 解决子组件没有被勾选到 + this.setChildren(el.children, true); + } + }); + } + if (isCancel) { + this.dataList.map(el => { + if (el.children) { + // 解决子组件没有被勾选到 + this.setChildren(el.children, false); + } + }); + } + }, //标准表格选择框改变 selectStandChange(data) { this.selectList = data; @@ -559,14 +544,28 @@ export default { } }, checkedRole(data) { + var idList = ""; + var nameList = ""; + data.forEach(item => { + if (nameList.length > 0) { + nameList += ","; + idList += ","; + } + idList += item.id; + nameList += item.name; + }); //单选操作 if (this.type === 1) { this.dataList.forEach(item => { + if(item.standId === this.selectedId){ + item.workPeople = nameList; + item.workPeopleId = idList; + } if (item.children) { item.children.forEach(items => { if (items.id === this.selectedId) { - items.workPeople = data[0].name; - items.workPeopleId = data[0].id; + items.workPeople = nameList; + items.workPeopleId = idList; // this.$set(items,'workPeople',data[0].name) //this.$set(items,'workPeopleId',data[0].id) } @@ -577,37 +576,37 @@ export default { } else if (this.type === 2) { this.selectList.forEach(item => { this.dataList.map(items => { - if (item.id === items.id) { - items.workPeople = ""; - items.workPeopleId = ""; - this.$message.warning('您只能针对条款进行分发') + if (item.standId === items.standId) { + items.workPeople = nameList; + items.workPeopleId = idList; + // this.$message.warning('您只能针对条款进行分发') } - if (items.children.length) { + if (items.children) { items.children.map(childrenItem => { if (childrenItem.id === item.id) { - childrenItem.workPeople = data[0].name; - childrenItem.workPeopleId = data[0].id; + childrenItem.workPeople = nameList; + childrenItem.workPeopleId = idList; } }); } }); }); this.dataList = JSON.parse(JSON.stringify(this.dataList)); - }else if (this.type === 3){ + } else if (this.type === 3) { // console.log("529",this.workPeopleList) - for (let i=0;i { - // - // childrenItem.workPeople = data[0].name; - // childrenItem.workPeopleId = data[0].id; - // }) + // items.children.map(childrenItem => { + // + // childrenItem.workPeople = data[0].name; + // childrenItem.workPeopleId = data[0].id; + // }) } this.modalshowflag = false; @@ -704,4 +703,3 @@ export default { } } -