{"remainingRequest":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\xypm-web\\src\\components\\flow\\task\\taskToAddSign.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xypm-web\\src\\components\\flow\\task\\taskToAddSign.vue","mtime":1675214577151},{"path":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\r\nimport { mapState, mapActions } from \"vuex\";\r\nimport OpinionText from \"@/components/common/opinionText.vue\";\r\nimport FileUpload from \"@/components/common/fileUpload.vue\";\r\nimport HtUserSelector from \"@/components/control/HtUserSelector.vue\";\r\nimport { Message } from \"element-ui\";\r\nimport utils from \"@/utils.js\";\r\nimport req from \"@/request.js\";\r\nexport default {\r\n  name: \"taskToAddSign\",\r\n  props: [\"taskId\"],\r\n  components: { OpinionText, FileUpload, HtUserSelector },\r\n  data() {\r\n    return {\r\n      addSignDialog: false,\r\n      users: \"\",\r\n      nodeType:\"\",\r\n      instId:\"\",\r\n      flowThis:\"\"//flowAction的this\r\n    };\r\n  },\r\n  methods: {\r\n    //鼠标点击页面其他其他位置不关闭弹框\r\n    handleClose(nodeType,instId,_this) {\r\n      this.flowThis = _this;\r\n      this.instId = instId;\r\n      this.nodeType = nodeType;\r\n      this.addSignDialog = true;\r\n    },\r\n    //执行前置脚本\r\n    runBeforeScript(){\r\n      let _this = this;\r\n      let item = utils.indexOfList(_this.flowThis.rowsBtn, \"alias\", _this.flowThis.btnAlias);\r\n      return _this.tempScript(item.beforeScript);\r\n    },\r\n    //执行前置脚本\r\n    tempScript(script) {\r\n      let _this = this;\r\n      let _req = req;\r\n      let boData = _this.flowThis.$refs.formContent.data;\r\n      let tempScript = \"var tempFunction = function(_req,data,_this){ \" + script + \"};\";\r\n      let result = eval(tempScript + \"tempFunction(_req,boData,_this);\");\r\n      if (result && result.then && typeof result.then == \"function\") {\r\n        return result;\r\n      }\r\n      if (result === false) return false;\r\n      return true;\r\n    },\r\n    //人员选择器\r\n    selectUser() {\r\n      this.$refs.selectUser.showDialog(); //父组件调用子组件方法\r\n    },\r\n    //取消\r\n    cancel() {\r\n      this.addSignDialog = false;\r\n    },\r\n    //确认\r\n    confirm() {\r\n      if (this.users == \"\" || this.users == null) {\r\n        Message.warning(\"请选择加签人员\");\r\n        return;\r\n      } else if (this.$refs.opinionText.getOpinion() == \"\") {\r\n        Message.warning(\"请填写加签说明\");\r\n        return;\r\n      }\r\n      let userId = \"\";\r\n      for (var i = 0; i < this.users.length; i++) {\r\n        userId = userId + this.users[i].id + \",\";\r\n      }\r\n      userId = userId.substring(0, userId.length - 1);\r\n      let files = \"\";\r\n      if (this.$refs.fileUpload.getFiles() != \"\") {\r\n        files = JSON.stringify(this.$refs.fileUpload.getFiles());\r\n      }\r\n\r\n      if(this.nodeType==\"USERTASK\"){//用户任务加签\r\n        let data = {\r\n          action:\"back\",\r\n          files: files,\r\n          opinion: this.$refs.opinionText.getOpinion(),\r\n          taskId: this.taskId,\r\n          userIds: userId\r\n        };\r\n        //获取表单数据\r\n        utils.getOnlineFormData(true).then(\r\n          formDataStr => this.submitConfirm(formDataStr,data))\r\n        .catch((reason) =>\r\n          utils.handleGetFormDataReject(reason).then(() => this.submitConfirm(\"\",data))\r\n        );\r\n      }else{//会签任务加签\r\n        let data = {\r\n          taskId: this.taskId,\r\n          opinion: this.$refs.opinionText.getOpinion(),\r\n          userId: userId,\r\n          files: files\r\n        };\r\n        this.$store.dispatch(\"storeProcess/taskSignUsers\",data).then(()=>{\r\n          this.addSignDialog = false;\r\n          utils.reload();\r\n        });\r\n      }\r\n    },\r\n    //用户任务加签\r\n    submitConfirm(formDataStr,data){\r\n      let _this = this;\r\n      let scriptResult = this.runBeforeScript();\r\n      //执行前置脚本返回false时终止按钮操作\r\n      if (scriptResult === false) return;\r\n      //执行前置脚本返回的接口时先执行前置事件接口\r\n      if (scriptResult.then && typeof scriptResult.then == \"function\") {\r\n        scriptResult.then(() => {\r\n            //接口返回成功则正常执行按钮操作\r\n            _this.funcDoNext(formDataStr,data);\r\n          }, (fail) => {\r\n            //接口返回失败则终止按钮操作，并给与提示\r\n            _this.$message.warning(fail);\r\n            return;\r\n          }\r\n        );\r\n      } else {\r\n        //执行前置脚本返回true时正常执行按钮操作\r\n        _this.funcDoNext(formDataStr,data);\r\n      }\r\n    },\r\n    funcDoNext(formDataStr,data){\r\n      utils.closeAllNotification();\r\n      if (formDataStr) {\r\n        data.data = Base64.encode(formDataStr);\r\n      }\r\n      this.$store.dispatch(\"storeProcess/userTaskToSign\",data).then(()=>{\r\n        this.addSignDialog = false;\r\n        this.$router.push(\"/inst/\" + this.instId + \"/doneList\");\r\n      });\r\n    }\r\n  }\r\n};\r\n",null]}