{"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\\FlowNodeStartNewFlow.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\src\\components\\flow\\FlowNodeStartNewFlow.vue","mtime":1675071991850},{"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\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 FlowNodeUserCondition = () => import('@/components/flow/FlowNodeUserCondition.vue');\r\nconst eipFlowDialog = () => import('@/components/dialog/EipFlowDialog.vue');\r\nconst FlowVarSelector = () => import('@/components/flow/FlowVarSelector.vue');\r\n\r\nexport default {\r\n  name: 'FlowStartConf',\r\n  components: {\r\n    eipScriptDialog,\r\n    FlowNodeUserCondition,\r\n    eipFlowDialog,\r\n    FlowVarSelector,\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    confList: {\r\n      type: Array,\r\n      required: true,\r\n    },\r\n    flowVar: {\r\n      type: Array,\r\n      required: false,\r\n    },\r\n  },\r\n  data() {\r\n    return {\r\n      dialogVisibleSetting: false, //是否显示设置节点新流程触发设置侧边栏\r\n      reminder: {\r\n        name: '',\r\n        triggerAction: 'agree',\r\n        userRule: { description: '' },\r\n        defName: '',\r\n        defKey: '',\r\n        formVarConf: [],\r\n        isAdd: true,\r\n      },\r\n      isSave: false, //判断是否可以保存\r\n      confListCopy: [], //复制一份最开始的新流程触发设置配置的信息\r\n      defVarMap: {},\r\n    };\r\n  },\r\n  watch: {\r\n    'reminder.defKey': function (n, o) {\r\n      if (n && !this.defVarMap[n]) {\r\n        this.getNewDefVar();\r\n      }\r\n    },\r\n  },\r\n  methods: {\r\n    getNewDefVar() {\r\n      let me_ = this;\r\n      req\r\n        .post(window.context.bpmModel + '/flow/node/v1/varTree', {\r\n          flowKey: this.reminder.defKey,\r\n          nodeId: this.node.nodeId,\r\n          includeBpmConstants: false,\r\n          removeSub: true,\r\n          bpmForm: true,\r\n        })\r\n        .then((response) => {\r\n          me_.$set(me_.defVarMap, me_.reminder.defKey, response.data || []);\r\n        });\r\n    },\r\n    handleDialogSure(data) {\r\n      if ((data && data.length > 0 && this.reminder.defKey == data[0].defKey) || !this.reminder.defKey) {\r\n        this.reminder.defName = data[0].name;\r\n        this.reminder.defKey = data[0].defKey;\r\n        return;\r\n      }\r\n      this.$confirm(`更换流程将会清空对应字段的配置,是否确定更换?`).then(() => {\r\n        if (data && data.length > 0) {\r\n          this.reminder.defName = data[0].name;\r\n          this.reminder.defKey = data[0].defKey;\r\n        } else {\r\n          this.reminder.defName = '';\r\n          this.reminder.defKey = '';\r\n        }\r\n        this.reminder.formVarConf = [];\r\n      });\r\n    },\r\n    selectDef() {\r\n      this.$refs.eipFlowDialog.showDialog();\r\n    },\r\n    addFormVarConf() {\r\n      if (!this.reminder.defKey) {\r\n        Message.warning('要先选择要触发的流程才能配置对应字段');\r\n        return;\r\n      }\r\n      this.reminder.formVarConf.push({});\r\n    },\r\n    nodeUserConditionConfirm(res) {\r\n      this.reminder.userRule = res;\r\n    },\r\n    //添加人员配置（办结抄送）\r\n    addUserCondition() {\r\n      let conf = {};\r\n      if (this.reminder && this.reminder.userRule && this.reminder.userRule.description) {\r\n        conf.userRule = JSON.parse(JSON.stringify(this.reminder.userRule));\r\n      }\r\n      conf = { ...conf, ...{ nodeType: '', nodeId: '', defId: this.defId } };\r\n      this.$refs.flowNodeUserCondition.showDialog(conf);\r\n    },\r\n    //编辑触发新流程设置\r\n    editTaskReminder() {\r\n      this.confListCopy = JSON.parse(JSON.stringify(this.confList));\r\n      this.confListCopy.forEach((conf) => {\r\n        conf.formVarConf = conf.formVarConf ? JSON.parse(conf.formVarConf) : [];\r\n        conf.userRule = conf.userRule ? JSON.parse(conf.userRule) : {};\r\n      });\r\n      if (this.confListCopy.length > 0) {\r\n        this.reminder = this.confListCopy[0];\r\n      } else {\r\n        this.restConf();\r\n      }\r\n      this.isSave = true;\r\n      this.dialogVisibleSetting = true;\r\n    },\r\n    //列表某一条数据时触发\r\n    orgRowClick(row, column, event) {\r\n      if (column.label != '操作') {\r\n        row.formVarConf = row.formVarConf || [];\r\n        row.userRule = row.userRule || { description: '' };\r\n        row.startDef = row.startDef || {};\r\n        this.reminder = row;\r\n        this.isSave = true;\r\n      }\r\n    },\r\n    //保存新流程触发设置\r\n    saveRemind() {\r\n      const this_ = this;\r\n      //判断是否有新增的数据\r\n      if (!this_.isSave) {\r\n        Message.warning('请先新增新流程触发设置信息再保存');\r\n        return;\r\n      } else {\r\n        let saveConf = JSON.parse(JSON.stringify(this_.confListCopy));\r\n        //校验是否有必填字段没有填写\r\n        for (let x = 0; x < saveConf.length; x++) {\r\n          if (this.validateData(saveConf[x])) {\r\n            this_.$message({\r\n              showClose: true,\r\n              message: '列表第' + (x + 1) + '行有字段未通过校验，请正确填写表单内容。',\r\n              type: 'warning',\r\n            });\r\n            return;\r\n          }\r\n          saveConf[x].formVarConf = JSON.stringify(saveConf[x].formVarConf);\r\n          saveConf[x].userRule = JSON.stringify(saveConf[x].userRule);\r\n        }\r\n        let remindersCopyJson = JSON.stringify(saveConf); //转json字符串\r\n        req.post('${bpmModel}/flow/plugins/v1/startNewFlowSave?defId=' + this_.node.defId + '&nodeId=' + this_.node.nodeId, remindersCopyJson).then(function (data) {\r\n          data = data.data;\r\n          if (data.state) {\r\n            Message.success('保存成功！');\r\n            this_.$emit('update:confList', saveConf); //子组件更新父组件的值\r\n            this_.restConf();\r\n            this_.dialogVisibleSetting = false;\r\n          } else {\r\n            Message.error('新流程触发设置保存出现异常：' + data.message);\r\n          }\r\n        });\r\n      }\r\n    },\r\n    validateData(data) {\r\n      //新增数据\r\n      let errMsg = [];\r\n      if (!data.name) {\r\n        errMsg.push('名称');\r\n      }\r\n      if (!data.defKey) {\r\n        errMsg.push('新流程');\r\n      }\r\n      if (!data.userRule || !data.userRule.description) {\r\n        errMsg.push('流程发起人');\r\n      }\r\n      return errMsg.join(',');\r\n    },\r\n    //新增新流程触发设置\r\n    addRemind() {\r\n      if (this.validateData(this.reminder)) {\r\n        Message.warning(this.validateData(this.reminder) + '不能为空');\r\n        return;\r\n      }\r\n      this.isSave = true;\r\n      delete this.reminder.isAdd;\r\n      this.confListCopy = [];\r\n      this.confListCopy.push(this.reminder); //新增新流程触发设置基本信息、消息设置\r\n      this.restConf();\r\n      this.saveRemind();\r\n    },\r\n    clear() {\r\n      this.$confirm(`是否确定清空该节点已有配置?`).then(() => {\r\n        this.confListCopy = [];\r\n        this.restConf();\r\n        this.saveRemind();\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      this.isSave = true;\r\n      this.restConf();\r\n    },\r\n    //初始化设置\r\n    restConf() {\r\n      this.reminder = {\r\n        name: '',\r\n        triggerAction: 'agree',\r\n        userRule: { description: '' },\r\n        defName: '',\r\n        defKey: '',\r\n        formVarConf: [],\r\n        isAdd: true,\r\n      };\r\n    },\r\n  },\r\n  mounted() {\r\n    this.$validator = this.$root.$validator;\r\n  },\r\n};\r\n",null]}