{"remainingRequest":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\xypm-web\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\xypm-web\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!D:\\jenkins\\workspace\\xypm-web\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\xypm-web\\src\\components\\flow\\task\\taskToReject.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xypm-web\\src\\components\\flow\\task\\taskToReject.vue","mtime":1675214577151},{"path":"D:\\jenkins\\workspace\\xypm-web\\babel.config.js","mtime":1675214572901},{"path":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"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":["import \"core-js/modules/es6.regexp.split\";\nimport \"core-js/modules/web.dom.iterable\";\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//\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//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nimport { mapState, mapActions } from \"vuex\";\nimport { Message } from \"element-ui\";\nimport OpinionText from \"@/components/common/opinionText.vue\";\nimport FileUpload from \"@/components/common/fileUpload.vue\";\nimport utils from \"@/utils.js\";\nimport req from \"@/request.js\";\nexport default {\n  name: \"taskToReject\",\n  props: [\"taskId\", \"leaderId\", \"opinion\", \"opinionField\", \"appendOpinion\", \"instId\"],\n  components: {\n    OpinionText: OpinionText,\n    FileUpload: FileUpload\n  },\n  data: function data() {\n    return {\n      rejectTaskId: \"\",\n      //要驳回的任务ID\n      rejectDialog: false,\n      radio: \"\",\n      nodeId: \"\",\n      backHandMode: \"normal\",\n      token: utils.getUrlKey(\"token\"),\n      canRejectNode: [],\n      rejectConf: {},\n      isSameNode: true,\n      title: \"驳回\",\n      fullscreenLoading: true,\n      flowThis: \"\",\n      //flowAction的this,\n      boData: {},\n      wrap: \"\\n\",\n      initBoAttr: \"\",\n      appendStr: true\n    };\n  },\n  computed: {},\n  watch: {\n    backHandMode: function backHandMode(n, o) {\n      var _this2 = this;\n\n      if (this.rejectConf.inSubProcess) {\n        if (n == \"normal\") {\n          this.radio = \"backToStart\";\n        } else {\n          this.radio = \"reject\";\n        }\n      }\n\n      if (!this.isSameNode) {\n        if (n == \"normal\") {\n          this.canRejectNode = this.rejectConf.allowNormalNode;\n        } else {\n          this.canRejectNode = this.rejectConf.allowDirectNode;\n        }\n\n        var flag = false;\n        this.canRejectNode.forEach(function (n) {\n          if (n.nodeId == _this2.nodeId) {\n            flag = true;\n            return;\n          }\n        });\n\n        if (!flag) {\n          this.nodeId = \"\";\n        }\n      }\n    }\n  },\n  methods: {\n    //鼠标点击页面其他其他位置不关闭弹框\n    handleClose: function handleClose() {\n      this.rejectDialog = true;\n    },\n    //执行前置脚本\n    runBeforeScript: function runBeforeScript() {\n      var _this = this;\n\n      var item = utils.indexOfList(_this.flowThis.rowsBtn, \"alias\", _this.flowThis.btnAlias);\n      return _this.tempScript(item.beforeScript);\n    },\n    //执行前置脚本\n    tempScript: function tempScript(script) {\n      var _this = this;\n\n      var _req = req;\n      var boData = _this.flowThis.$refs.formContent.data;\n      var tempScript = \"var tempFunction = function(_req,data,_this){ \" + script + \"};\";\n      var result = eval(tempScript + \"tempFunction(_req,boData,_this);\");\n\n      if (result && result.then && typeof result.then == \"function\") {\n        return result;\n      }\n\n      if (result === false) return false;\n      return true;\n    },\n    //打开驳回设置页面\n    handleOpen: function handleOpen(parentTaskId, _this) {\n      if (this.opinionField && document.querySelector(\"[model-name='data.\" + this.opinionField + \"']\")) {\n        var con = document.querySelector(\"[model-name='data.\" + this.opinionField + \"']\").__vue__;\n\n        if (con && con.isEditor) {\n          this.wrap = \"<br>\";\n        }\n      }\n\n      this.boData = _this.$refs.formContent.data;\n\n      if (parentTaskId) {\n        this.rejectTaskId = parentTaskId;\n      }\n\n      this.flowThis = _this;\n      var data = {\n        taskId: this.taskId,\n        backModel: \"reject\"\n      };\n      var this_ = this;\n      this.$store.dispatch(\"storeProcess/taskToReject\", data).then(function (resp) {\n        this_.rejectConf = resp;\n        var normalNodeIds = [];\n        resp.allowNormalNode.forEach(function (element) {\n          normalNodeIds.push(element.nodeId);\n        });\n\n        if (resp.allowNormalNode) {\n          resp.allowDirectNode.forEach(function (element) {\n            if (normalNodeIds.indexOf(element.nodeId) < 0) {\n              this_.isSameNode = false;\n            }\n          });\n        }\n\n        if (resp.inGateway) {\n          this_.backHandMode = \"direct\";\n        }\n\n        if (this_.backHandMode == \"normal\") {\n          this_.canRejectNode = resp.allowNormalNode;\n        } else {\n          this_.canRejectNode = resp.allowDirectNode;\n        } // 只有驳回发起人的情况\n\n\n        if (this_.rejectConf.canRejectToStart && !this_.rejectConf.canRejectPreAct && !this_.rejectConf.canRejectToAnyNode) {\n          this_.radio = \"backToStart\";\n          this_.rejectDialog = true;\n          this_.fullscreenLoading = false;\n          return;\n        } // 只有驳回上一步的情况\n\n\n        if (!this_.rejectConf.canRejectToStart && this_.rejectConf.canRejectPreAct && !this_.rejectConf.canRejectToAnyNode) {\n          this_.radio = \"rejectPre\";\n          this_.rejectDialog = true;\n          this_.fullscreenLoading = false;\n          return;\n        } // 只有驳回指定节点的情况并且指定节点只有一个\n\n\n        if (!this_.rejectConf.canRejectToStart && !this_.rejectConf.canRejectPreAct && this_.rejectConf.canRejectToAnyNode && this_.canRejectNode.length == 1) {\n          this_.nodeId = this_.canRejectNode[0].nodeId;\n          this_.radio = \"reject\";\n          this_.rejectDialog = true;\n          this_.fullscreenLoading = false;\n          return;\n        }\n\n        if (this_.rejectConf.canRejectToStart && (this_.backHandMode == 'normal' || !this_.rejectConf.inSubProcess)) {\n          this_.radio = \"backToStart\";\n        } else if (!this_.rejectConf.afterGateway && !this_.rejectConf.inGateway && !this_.rejectConf.inSubProcess && this_.rejectConf.canRejectPreAct) {\n          this_.radio = \"rejectPre\";\n        } else if (this_.rejectConf.canRejectToAnyNode && (!this_.rejectConf.inSubProcess || this_.backHandMode != 'normal')) {\n          this_.radio = \"reject\";\n          this_.isNode = true;\n        }\n\n        this_.title = \"驳回设置\";\n        this_.rejectDialog = true;\n        this_.fullscreenLoading = false;\n      });\n    },\n    //取消\n    cancel: function cancel() {\n      this.rejectDialog = false;\n      this.$refs.opinionText.opinion = \"\";\n    },\n    //确认\n    confirm: function confirm() {\n      var _this3 = this;\n\n      if (!this.radio) {\n        Message.warning(\"请选择驳回方式\");\n        return;\n      }\n\n      if (this.radio == \"reject\" && !this.nodeId) {\n        Message.warning(\"请选择驳回节点\");\n        return;\n      }\n\n      if (!this.opinion && this.$refs.opinionText.getOpinion() == \"\") {\n        Message.warning(\"请填写驳回意见\");\n        return;\n      }\n\n      utils.getOnlineFormData(true).then(function (formDataStr) {\n        return _this3.submitConfirm(formDataStr);\n      }).catch(function (reason) {\n        return utils.handleGetFormDataReject(reason).then(function () {\n          return _this3.submitConfirm();\n        });\n      });\n    },\n    submitConfirm: function submitConfirm(formDataStr) {\n      var _this = this;\n\n      var scriptResult = this.runBeforeScript(); //执行前置脚本返回false时终止按钮操作\n\n      if (scriptResult === false) return; //执行前置脚本返回的接口时先执行前置事件接口\n\n      if (scriptResult.then && typeof scriptResult.then == \"function\") {\n        scriptResult.then(function () {\n          //接口返回成功则正常执行按钮操作\n          _this.funcDoNext(formDataStr);\n        }, function (fail) {\n          //接口返回失败则终止按钮操作，并给与提示\n          _this.$message.warning(fail);\n\n          return;\n        });\n      } else {\n        //执行前置脚本返回true时正常执行按钮操作\n        _this.funcDoNext(formDataStr);\n      }\n    },\n    funcDoNext: function funcDoNext(formDataStr) {\n      var _this4 = this;\n\n      utils.closeAllNotification();\n\n      if (formDataStr && formDataStr.constructor != String) {\n        formDataStr = JSON.stringify(formDataStr);\n      }\n\n      if (this.radio == \"rejectPre\") {\n        this.nodeId = \"\";\n      }\n\n      var files = this.$refs.FileUpload.getFiles();\n\n      if (files != \"\") {\n        files = JSON.stringify(files);\n      }\n\n      this.$refs.FileUpload.isFinishUpload();\n      var data = {\n        taskId: this.taskId,\n        rejectTaskId: this.rejectTaskId,\n        actionName: this.radio == \"rejectPre\" ? \"reject\" : this.radio,\n        backHandMode: this.backHandMode,\n        opinion: this.opinion || this.$refs.opinionText.getOpinion(),\n        destination: this.nodeId,\n        agentLeaderId: this.leaderId,\n        files: files\n      };\n\n      if (window.urgentStateValue) {\n        data.urgentStateValue = window.urgentStateValue;\n      }\n\n      if (formDataStr) {\n        data.data = Base64.encode(formDataStr);\n      }\n\n      data.formKey = this.flowThis.$refs.formContent.formKey;\n      this.$loading();\n      this.$store.dispatch(\"storeProcess/rejectComplete\", data).then(function () {\n        _this4.$loading().close();\n\n        _this4.rejectDialog = false;\n\n        if (_this4.token != null) {\n          window.close();\n        } else {\n          _this4.$parent.nextTask(); //this.$router.go(-1);\n\n        }\n      });\n    },\n    //获取意见\n    getOpinion: function getOpinion(opinion) {\n      this.text = opinion;\n      var opinioValue = this.$refs.opinionText.getOpinion();\n\n      if (this.opinionField && document.querySelector(\"[model-name='data.\" + this.opinionField + \"']\")) {\n        var currentUser = this.$store.state.user.currentUserDetail.user;\n\n        var moment = require(\"moment\");\n\n        var boData = this.boData;\n        var filed = this.opinionField.split(\".\");\n\n        if (boData[filed[0]][filed[1]] == '<p><br/></p>') {\n          boData[filed[0]][filed[1]] = \"\";\n        } //是否覆盖审批意见\n\n\n        if (this.appendOpinion) {\n          if (opinioValue) {\n            boData[filed[0]][filed[1]] = opinioValue + this.wrap + currentUser.fullname + \" \" + moment().format(\"YYYY-MM-DD HH:mm:ss\");\n          }\n        } else {\n          if (opinioValue) {\n            opinioValue += this.wrap + currentUser.fullname + \" \" + moment().format(\"YYYY-MM-DD HH:mm:ss\");\n          }\n\n          if (this.appendStr) {\n            this.initBoAttr = boData[filed[0]][filed[1]];\n          }\n\n          if (filed.length == 2) {\n            if (this.initBoAttr) {\n              if (opinion) {\n                boData[filed[0]][filed[1]] = this.initBoAttr + this.wrap + this.wrap + opinioValue;\n              } else {\n                boData[filed[0]][filed[1]] = this.initBoAttr;\n              }\n            } else {\n              boData[filed[0]][filed[1]] = opinioValue;\n            }\n          }\n\n          this.appendStr = false;\n        }\n        /*else if (filed.length==3 &&boData[filed[0]][filed[1]].length>0){//处理子表\r\n          for (let i = 0; i <boData[filed[0]][filed[1]].length ; i++) {\r\n            boData[filed[0]][filed[1]][i][filed[2]]=opinioValue;\r\n          }\r\n        }*/\n\n      }\n    }\n  }\n};",null]}