{"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\\taskToEndProcess.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xypm-web\\src\\components\\flow\\task\\taskToEndProcess.vue","mtime":1675214577151},{"path":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\babel-loader\\lib\\index.js","mtime":456789000000},{"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\r\nimport { mapState, mapActions } from \"vuex\";\r\nimport OpinionText from \"@/components/common/opinionText.vue\";\r\nimport FileUpload from \"@/components/common/fileUpload.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: \"taskToEndProcess\",\r\n  props: [\"taskId\"],\r\n  components: { OpinionText, FileUpload },\r\n  data() {\r\n    return {\r\n      endProcessDialog: false,\r\n      token:utils.getUrlKey(\"token\"),\r\n      flowThis:\"\"//flowAction的this\r\n    };\r\n  },\r\n  computed: mapState({\r\n    currentUser: state => state.login.currentUser\r\n  }),\r\n  methods: {\r\n    //鼠标点击页面其他其他位置不关闭弹框\r\n    handleClose(_this) {\r\n      this.flowThis = _this;\r\n      this.endProcessDialog = 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    cancel() {\r\n      this.endProcessDialog = false;\r\n    },\r\n    //确认\r\n    confirm() {\r\n      if (this.$refs.opinionText.getOpinion() == \"\") {\r\n        Message.warning(\"请填写终止原因\");\r\n        return;\r\n      }\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();\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();\r\n      }\r\n    },\r\n    funcDoNext(){\r\n      let files = \"\";\r\n      if (this.$refs.fileUpload.getFiles() != \"\") {\r\n        files = JSON.stringify(this.$refs.fileUpload.getFiles());\r\n      }\r\n      this.$store.dispatch(\"login/validAndCompletedCurrent\").then(() => {\r\n        let data = {\r\n          taskId: this.taskId,\r\n          endReason: this.$refs.opinionText.getOpinion(),\r\n          messageType: \"inner\",\r\n          account: this.currentUser.account,\r\n          files: files,\r\n          busDataObjectNode: {test:\"我是测试数据,请在这里封装您需要的数据\"}\r\n        };\r\n        this.$store.dispatch(\"storeProcess/doEndProcess\", data).then(() => {\r\n          this.endProcessDialog = false;\r\n          if(this.token!=null){\r\n            window.close();\r\n          }else{\r\n            //终止流程后返回到待办页面\r\n            this.$router.push(\"/v-flow/v-todo\");\r\n            //this.$router.go(-1);\r\n          }\r\n        });\r\n      });\r\n    }\r\n  }\r\n};\r\n",null]}