{"remainingRequest":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\xq-web-bpm\\src\\components\\flow\\FlowAutoTask.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\src\\components\\flow\\FlowAutoTask.vue","mtime":1675071991756},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\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//\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//\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//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\r\nimport req from \"@/request.js\";\r\nimport { mapState, mapActions } from \"vuex\";\r\nimport { Message } from \"element-ui\";\r\nconst eipScriptDialog = () => import(\"@/components/dialog/EipScriptDialog.vue\");\r\nconst MessageTypeSelector = () =>\r\n  import(\"@/components/flow/MessageTypeSelector.vue\");\r\nconst FlowVarSelector = () => import(\"@/components/flow/FlowVarSelector.vue\");\r\nconst FlowConditionBuildDialog = () =>\r\n  import(\"@/components/flow/FlowConditionBuildDialog.vue\");\r\nconst FlowNodeUserCondition = () =>\r\n  import(\"@/components/flow/FlowNodeUserCondition.vue\");\r\nexport default {\r\n  name: \"FlowNodeScript\",\r\n  components: {\r\n    MessageTypeSelector,\r\n    eipScriptDialog,\r\n    FlowVarSelector,\r\n    FlowConditionBuildDialog,\r\n    FlowNodeUserCondition\r\n  },\r\n  props: {\r\n    //任务节点信息\r\n    node: {\r\n      type: Object,\r\n      required: true\r\n    },\r\n    //流程配置信息\r\n    defConfigData: {\r\n      type: Object,\r\n      required: true\r\n    },\r\n    //脚本任务配置的信息\r\n    autoTask: {\r\n      type: Object,\r\n      required: true\r\n    }\r\n  },\r\n  data() {\r\n    return {\r\n      curEditSetting: \"\", //修改接收人配置的时候用于判断是修改富文本消息的还是修改普通消息的\r\n      curEditRuleIndex: \"\", //下标，用于记录修改接收人配置的时候是哪条数据\r\n      tabType: \"message\", //scriptNode:脚本任务，message：消息任务\r\n      dialogVisibleSetting: false,\r\n      titleSetting: \"设置自动任务\",\r\n      scriptJson: { script: \"\" }, //初始化脚本任务信息\r\n      nodeMessage: {\r\n        htmlSetting: { msgType: \"\", content: \"\", ruleList: [] },\r\n        plainTextSetting: { msgType: \"\", content: \"\", ruleList: [] }\r\n      }, //初始化消息任务信息\r\n      myConfig: {\r\n        initialFrameHeight: 240,\r\n        UEDITOR_HOME_URL: window.location.origin +'/'+ window.location.pathname.split('/')[1]+'/static/ueditor/',\r\n        toolbars: [\r\n          [\r\n            // 'source', //源代码\r\n            'undo', //撤销\r\n            'bold', //加粗\r\n            'indent', //首行缩进\r\n            'italic', //斜体\r\n            'underline', //下划线\r\n            'strikethrough', //删除线\r\n            'subscript', //下标\r\n            'fontborder', //字符边框\r\n            'superscript', //上标\r\n            'formatmatch', //格式刷\r\n            'forecolor',//字体颜色\r\n            'justifyleft', //居左对齐\r\n            'justifycenter', //居中对齐\r\n            'justifyright', //居右对齐\r\n            'justifyjustify', //两端对齐\r\n            'fontfamily', //字体\r\n            'fontsize', //字号\r\n            'insertorderedlist', //有序列表\r\n            'insertunorderedlist', //无序列表\r\n            'lineheight',//行间距\r\n            'inserttable', //插入表格\r\n          ]\r\n        ],\r\n        // 初始容器宽度\r\n        initialFrameWidth: \"100%\",\r\n        zIndex:9999,\r\n        enableAutoSave: false,\r\n        readonly : false\r\n      },\r\n      isEdit: false //是否编辑自动任务节点\r\n    };\r\n  },\r\n  methods: {\r\n    //添加接收人配置选择（消息任务）\r\n    addUserCondition(setting, index) {\r\n      this.curEditSetting = setting;\r\n      this.curEditRuleIndex = index;\r\n      let conf = {};\r\n      if (index != undefined) {\r\n        let ruleList = this.nodeMessage[setting].ruleList;\r\n        let userRule = ruleList[index];\r\n        conf.userRule = JSON.parse(JSON.stringify(userRule));\r\n      }\r\n      conf = {\r\n        ...conf,\r\n        ...{\r\n          nodeType: \"signTask\",\r\n          nodeId: this.node.nodeId,\r\n          defId: this.node.defId\r\n        }\r\n      };\r\n      this.$refs.flowNodeUserCondition.showDialog(conf);\r\n    },\r\n    //获取接收人配置返回的值\r\n    nodeUserConditionConfirm(res) {\r\n      if (this.curEditRuleIndex != undefined) {\r\n        this.nodeMessage[this.curEditSetting].ruleList.splice(\r\n          this.curEditRuleIndex,\r\n          1,\r\n          res\r\n        );\r\n      } else {\r\n        this.nodeMessage[this.curEditSetting].ruleList.push(res);\r\n      }\r\n      this.$forceUpdate();\r\n    },\r\n    //监听条件脚本确认事件(脚本任务)\r\n    conditionDialogConfirm(data) {\r\n      this.scriptJson.script = this.scriptJson.script + data;\r\n    },\r\n    //显示条件脚本对话框\r\n    showConditionBuild() {\r\n      this.$refs.flowConditionBuildDialog.showDialog();\r\n    },\r\n    //监督可选变量的返回值(脚本任务)\r\n    varTreeOnConfirmScript(data) {\r\n      this.scriptJson.script = this.scriptJson.script + data.pathValue;\r\n    },\r\n    //显示常用脚本\r\n    showDialog(action) {\r\n      this.$refs[action].showDialog();\r\n    },\r\n    //设置自动任务\r\n    editAutoService() {\r\n      let Base64 = require(\"js-base64\").Base64;\r\n      this.dialogVisibleSetting = true;\r\n      //根据定义id和节点id查询该自动任务节点是否已经配置过\r\n      let this_ = this;\r\n      req\r\n        .get(\r\n          \"${bpmModel}/flow/node/v1/autoTaskManager?defId=\" +\r\n            this.node.defId +\r\n            \"&nodeId=\" +\r\n            this.node.nodeId\r\n        )\r\n        .then(function(data) {\r\n          data = data.data;\r\n          if (data.bpmPluginContext) {\r\n            this_.isEdit = true;\r\n            this_.tabType = data.bpmPluginContext.type;\r\n            if (this_.tabType == \"message\") {\r\n              req\r\n                .get(\r\n                  \"${bpmModel}/flow/node/v1/autoTaskPluginGet?defId=\" +\r\n                    this_.node.defId +\r\n                    \"&nodeId=\" +\r\n                    this_.node.nodeId +\r\n                    \"&pluginType=message\"\r\n                )\r\n                .then(function(data) {\r\n                  data = data.data;\r\n                  if (data.bpmPluginDefJson) {\r\n                    let val = Base64.decode(data.bpmPluginDefJson, \"utf-8\");\r\n                    this_.nodeMessage = JSON.parse(val);\r\n                  } else {\r\n                    this_.nodeMessage = {\r\n                      htmlSetting: { msgType: \"\", content: \"\", ruleList: [] },\r\n                      plainTextSetting: {\r\n                        msgType: \"\",\r\n                        content: \"\",\r\n                        ruleList: []\r\n                      }\r\n                    };\r\n                  }\r\n                });\r\n            } else {\r\n              req\r\n                .get(\r\n                  \"${bpmModel}/flow/node/v1/autoTaskPluginGet?defId=\" +\r\n                    this_.node.defId +\r\n                    \"&nodeId=\" +\r\n                    this_.node.nodeId +\r\n                    \"&pluginType=scriptNode\"\r\n                )\r\n                .then(function(data) {\r\n                  data = data.data;\r\n                  if (data.bpmPluginDefJson) {\r\n                    let val = Base64.decode(data.bpmPluginDefJson, \"utf-8\");\r\n                    this_.scriptJson = JSON.parse(val);\r\n                  } else {\r\n                    this_.scriptJson = { script: \"\" };\r\n                  }\r\n                });\r\n            }\r\n          } else {\r\n            //第一次进入，默认初始化消息自动任务\r\n            this_.tabType = \"message\";\r\n            this_.nodeMessage = {\r\n              htmlSetting: { msgType: \"\", content: \"\", ruleList: [] },\r\n              plainTextSetting: { msgType: \"\", content: \"\", ruleList: [] }\r\n            };\r\n          }\r\n        });\r\n    },\r\n    //保存自动任务\r\n    saveScript() {\r\n      const this_ = this;\r\n      let formName  = this_.tabType == \"message\"?\"settingSave\" :\"scriptForm\";\r\n      this_.$validator.validateAll(formName).then(result => {\r\n        if (result) {\r\n          if (!this_.isEdit) {\r\n            this_.$confirm(\r\n              \"自动节点支持一种任务节点类型（脚本、消息等）， 保存所选择的任务类型后无法修改。\",\r\n              \"提示\",\r\n              {\r\n                cancelButtonText: \"取消\",\r\n                confirmButtonText: \"确定\",\r\n                type: \"warning\",\r\n                closeOnClickModal: false\r\n              }\r\n            ).then(() => {\r\n              this_.save();\r\n            });\r\n          } else {\r\n            this_.save();\r\n          }\r\n        } else {\r\n          let arr = this_.$validator.errors.items.filter(\r\n            item => item.scope == \"settingSave\"\r\n          );\r\n          let errorLength = arr.length;\r\n          this_.$message({\r\n            showClose: true,\r\n            message: `有${errorLength}个字段未通过校验，请正确填写表单内容。`,\r\n            type: \"warning\"\r\n          });\r\n        }\r\n      });\r\n    },\r\n    save() {\r\n        let this_ = this;\r\n      //消息任务\r\n      if (this_.tabType == \"message\") {\r\n        this_.nodeMessage.pluginType = \"message\";\r\n        if (!this_.nodeMessage.htmlSetting) this_.nodeMessage.htmlSetting = {};\r\n        let param = {\r\n          defId: this_.node.defId,\r\n          nodeId: this_.node.nodeId,\r\n          jsonStr: JSON.stringify(this_.nodeMessage)\r\n        };\r\n        let isHtmlEmpt = false;\r\n        if(!this_.nodeMessage.htmlSetting.content || !this_.nodeMessage.htmlSetting.msgType || !this_.nodeMessage.htmlSetting.subject ||\r\n        !this_.nodeMessage.htmlSetting.ruleList || this_.nodeMessage.htmlSetting.ruleList.length == 0){\r\n          isHtmlEmpt = true;\r\n        }\r\n\r\n        let isTextEmpt = false;\r\n        if(!this_.nodeMessage.plainTextSetting.content || !this_.nodeMessage.plainTextSetting.msgType || \r\n        !this_.nodeMessage.plainTextSetting.ruleList || this_.nodeMessage.plainTextSetting.ruleList.length == 0){\r\n          isTextEmpt = true;\r\n        }\r\n\r\n        if (isTextEmpt && isHtmlEmpt) {\r\n          this.$message.error(\"富文本和普通消息至少要有一种配置完整，才能发送\");\r\n          return;\r\n        }\r\n\r\n        let url = \"${bpmModel}/flow/node/v1/autoTaskPluginSave\";\r\n        req.post(url, param).then(function(data) {\r\n          data = data.data;\r\n          if (data.state) {\r\n            this_.dialogVisibleSetting = false;\r\n            let autoTask = {\r\n              pluginType: \"message\",\r\n              htmlSetting: this_.nodeMessage.htmlSetting,\r\n              plainTextSetting: this_.nodeMessage.plainTextSetting,\r\n              title: \"消息节点\",\r\n              externalClass: this_.nodeMessage.externalClass\r\n            };\r\n            this_.$emit(\"update:autoTask\", autoTask); //子组件更新父组件的值\r\n            Message.success(\"消息任务配置成功\");\r\n          } else {\r\n            Message.error(data.message);\r\n          }\r\n        });\r\n      } else if (this_.tabType == \"scriptNode\") {\r\n        //脚本任务\r\n        this_.scriptJson.pluginType = \"scriptNode\";\r\n        let param = {\r\n          defId: this_.node.defId,\r\n          nodeId: this_.node.nodeId,\r\n          jsonStr: JSON.stringify(this_.scriptJson)\r\n        };\r\n        let url = \"${bpmModel}/flow/node/v1/autoTaskPluginSave\";\r\n        req.post(url, param).then(function(data) {\r\n          data = data.data;\r\n          if (data.state) {\r\n            this_.dialogVisibleSetting = false;\r\n            let autoTask = {\r\n              pluginType: \"scriptNode\",\r\n              script: this_.scriptJson.script,\r\n              title: \"脚本\"\r\n            };\r\n            this_.$emit(\"update:autoTask\", autoTask); //子组件更新父组件的值\r\n            Message.success(\"脚本任务配置成功\");\r\n          } else {\r\n            Message.error(data.message);\r\n          }\r\n        });\r\n      }\r\n    },\r\n    //关闭自动任务设置列弹框\r\n    close() {\r\n      this.dialogVisibleSetting = false;\r\n    },\r\n    //删除\r\n    deleteSetting(list, index) {\r\n      list.splice(index, 1);\r\n    }\r\n  },\r\n  mounted() {\r\n    this.$validator = this.$root.$validator;\r\n  }\r\n};\r\n",null]}