{"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\\taskToTrans.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xypm-web\\src\\components\\flow\\task\\taskToTrans.vue","mtime":1675214577167},{"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//\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\r\nimport { mapState, mapActions } from \"vuex\";\r\nimport { Message } from \"element-ui\";\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 utils from \"@/utils.js\";\r\nimport req from \"@/request.js\";\r\nexport default {\r\n  name: \"taskToTrans\",\r\n  props: [\"taskId\",\"files\"],\r\n  components: { OpinionText, FileUpload, HtUserSelector },\r\n  data() {\r\n    return {\r\n      transDialog: false,\r\n      users: \"\",\r\n      radioVote: \"1\", //任务通过规则\r\n      decideType: \"agree\", //计票策略\r\n      voteType: \"percent\", //投票类型\r\n      voteAmount: \"100\", //票数\r\n      signType: \"parallel\", //流转类型\r\n      action: \"submit\", //流转结束后的动作\r\n      isHight: false,\r\n      isVoteAmount: false,\r\n      token: utils.getUrlKey(\"token\"),\r\n      flowThis:\"\",//flowAction的this\r\n      text: \"\",//意见内容\r\n      boData:\"\",//boData数据\r\n      opinionField:\"\", //要回填的字段\r\n      appendStr:true,\r\n      initBoAttr:'',\r\n      appendOpinion:false, //是否覆盖审批意见\r\n    };\r\n  },\r\n  methods: {\r\n    //获取意见\r\n    getOpinion(opinion) {\r\n      this.text = opinion;\r\n      let opinioValue=this.$refs.opinionText.getOpinion();\r\n      if( this.opinionField){\r\n        let currentUser= this.$store.state.user.currentUserDetail.user;\r\n        let moment = require(\"moment\");\r\n\r\n        let boData = this.boData;\r\n        let filed=this.opinionField.split(\".\");\r\n        if(boData[filed[0]][filed[1]] == '<p><br/></p>'){\r\n          boData[filed[0]][filed[1]] = \"\";\r\n        }\r\n        //是否覆盖审批意见\r\n        if (this.appendOpinion){\r\n          if (opinioValue){boData[filed[0]][filed[1]]=opinioValue+\"\\n\"+currentUser.fullname+\" \"+moment().format(\"YYYY-MM-DD HH:mm:ss\");\r\n          }\r\n        }else{\r\n          if (opinioValue){\r\n            opinioValue+=\"\\n\"+currentUser.fullname+\" \"+moment().format(\"YYYY-MM-DD HH:mm:ss\");\r\n          }\r\n          if (this.appendStr){\r\n            this.initBoAttr=boData[filed[0]][filed[1]];\r\n          }\r\n          if (filed.length==2){\r\n            if(this.initBoAttr){\r\n              if(opinion){\r\n                boData[filed[0]][filed[1]]=this.initBoAttr+\"\\n\\n\"+opinioValue;\r\n              }else{\r\n                boData[filed[0]][filed[1]]=this.initBoAttr\r\n              }\r\n            }else{\r\n              boData[filed[0]][filed[1]]=opinioValue;\r\n            }\r\n          }\r\n          this.appendStr=false;\r\n        }\r\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        }*/\r\n      }\r\n    },\r\n    //选择投票类型\r\n    voteTypeChange(value) {\r\n      if (value == \"percent\") {\r\n        this.isVoteAmount = true;\r\n      } else {\r\n        this.isVoteAmount = false;\r\n      }\r\n    },\r\n    //选择任务通过规则\r\n    setVote(value) {\r\n      this.voteType = \"amount\";\r\n      this.voteAmount = \"1\";\r\n      if (value == \"1\") {\r\n        this.isHight = false;\r\n      } else if (value == \"2\") {\r\n        this.isHight = false;\r\n        this.decideType = \"refuse\";\r\n      } else if (value == \"3\") {\r\n        this.isHight = false;\r\n        this.decideType = \"agree\";\r\n      } else if (value == \"4\") {\r\n        this.isHight = true;\r\n      }\r\n    },\r\n    //鼠标点击页面其他其他位置不关闭弹框\r\n    handleClose(_this,opinionField,boData,appendOpinion) {\r\n      this.opinionField = opinionField;\r\n      this.boData = boData;\r\n      this.appendOpinion = appendOpinion;\r\n      this.flowThis = _this;\r\n      this.transDialog = 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.transDialog = false;\r\n      this.getOpinion(\"\");\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      utils\r\n        .getOnlineFormData(true)\r\n        .then(formDataStr => this.submitConfirm(formDataStr))\r\n        .catch((reason) =>\r\n          utils\r\n            .handleGetFormDataReject(reason)\r\n            .then(() => this.submitConfirm())\r\n        );\r\n    },\r\n    submitConfirm(formDataStr) {\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);\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);\r\n      }\r\n    },\r\n    funcDoNext(formDataStr){\r\n      utils.closeAllNotification();\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 data = {\r\n        taskId: this.taskId,\r\n        opinion: this.$refs.opinionText.getOpinion(),\r\n        userIds: userId\r\n      };\r\n      if (this.$refs.fileUpload.getFiles() != \"\") {\r\n        data.files = JSON.stringify(this.$refs.fileUpload.getFiles());\r\n      }\r\n      data.action = this.action;\r\n      data.decideType = this.decideType;\r\n      data.signType = this.signType;\r\n      data.voteAmount = this.voteAmount;\r\n      data.voteType = this.voteType;\r\n      if (formDataStr) {\r\n        data.data = Base64.encode(formDataStr);\r\n      }\r\n      data.formKey=this.flowThis.$refs.formContent.formKey\r\n      \r\n      this.$store.dispatch(\"storeProcess/taskToTrans\", data).then(() => {\r\n        this.transDialog = false;\r\n        if (this.token != null) {\r\n          window.close();\r\n        } else {\r\n          this.$router.go(-1);\r\n        }\r\n      });\r\n    }\r\n  }\r\n};\r\n",null]}