{"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\\FlowFormConfig.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\src\\components\\flow\\FlowFormConfig.vue","mtime":1675071991803},{"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\r\nimport flow from '@/api/flow.js'\r\nimport req from '@/request.js'\r\nimport {mapState, mapActions} from 'vuex'\r\nconst FlowFormAuth = () => import('@/components/flow/FlowFormAuth.vue')\r\nconst FlowFormRightSubSetting = () =>\r\n  import('@/components/flow/FlowFormRightSubSetting.vue')\r\nconst FlowFormExtraPropSet = () =>\r\n  import('@/components/flow/FlowFormExtraPropSet.vue')\r\nconst EipFormDialog = () => import('@/components/dialog/EipFormDialog.vue')\r\nconst HtFileUpload = () => import('@/components/common/HtFileUpload.vue')\r\n\r\nexport default {\r\n  props: {\r\n    labelWidth: {\r\n      type: String,\r\n      default: '100px',\r\n    },\r\n    defId: String,\r\n    title: String,\r\n    type: String,\r\n    nodeId: String,\r\n    defkey: String,\r\n    nodeType: String,\r\n  },\r\n  components: {\r\n    FlowFormAuth,\r\n    FlowFormExtraPropSet,\r\n    EipFormDialog,\r\n    HtFileUpload,\r\n    FlowFormRightSubSetting,\r\n  },\r\n  data() {\r\n    return {\r\n      tempSettting: {},\r\n      bpmForm: {},\r\n      showAuthorizeSubData: false,\r\n      formDialogVisible: false,\r\n      formListData: [],\r\n      tableColumns: [\r\n        {prop: 'formKey', label: '表单key'},\r\n        {prop: 'name', label: '表单名称', width: '300'},\r\n        {prop: 'version', label: '版本号'},\r\n      ],\r\n      pageResult: {\r\n        page: 1,\r\n        pageSize: 50,\r\n        total: 0,\r\n      },\r\n      curSelectForm: {},\r\n      files: [],\r\n    }\r\n  },\r\n  computed: mapState({\r\n    defConfigData: (state) => state.flow.defConfigData,\r\n    header: (state) => {\r\n      return {Authorization: `Bearer ${state.login.currentUser.token}`}\r\n    },\r\n    actionUrl: function () {\r\n      return window.context.portal + '/file/v1/upload'\r\n    },\r\n  }),\r\n  watch: {\r\n    bpmForm: {\r\n      handler(newValue, oldValue) {\r\n        this.updateForm()\r\n      },\r\n      deep: true,\r\n    },\r\n  },\r\n  mounted() {\r\n    const this_ = this\r\n    //监听保存流程配置的点击事件\r\n    this.$root.$on('nodeSetUpdate', function (value) {\r\n      if (this_.nodeType) {\r\n        this_.bpmForm.pc.formValue = this_.bpmForm.pc.formValue || ''\r\n        //判断是否显示子表数据授权按钮\r\n        if (\r\n          (this_.nodeType == 'userTask' || this_.nodeType == 'signTask') &&\r\n          this_.bpmForm.pc.formValue != ''\r\n        ) {\r\n          this_.showAuthorizeSubData = true\r\n        } else {\r\n          this_.showAuthorizeSubData = false\r\n        }\r\n      }\r\n    })\r\n    //打开配件节点表单时，判断是否显示子表数据授权按钮\r\n    if (\r\n      this_.bpmForm.pc.formValue &&\r\n      (this_.nodeType == 'userTask' || this_.nodeType == 'signTask')\r\n    ) {\r\n      this_.showAuthorizeSubData = true\r\n    }\r\n  },\r\n  methods: {\r\n    handleTypeChange(val) {\r\n      if (this.bpmForm.pc.formValue || this.bpmForm.mb.formValue) {\r\n        let this_ = this\r\n        this.$confirm('更换表单类型会清除之前的表单配置，是否确认更换？', '提示', {\r\n            confirmButtonText: '确定',\r\n            cancelButtonText: '取消',\r\n            type: 'warning'\r\n          }).then(() => {\r\n            if (val == 'FRAME') {\r\n              if (this_.bpmForm.mb.formValue) {\r\n                this_.doClearForm(this_.bpmForm.mb)\r\n              }\r\n              this_.doClearForm(this_.bpmForm.pc)\r\n            }else{\r\n              this_.$set(this_.bpmForm.pc, 'name', '')\r\n              this_.$set(this_.bpmForm.pc, 'formValue', '')\r\n              this_.$set(this_.bpmForm.mb, 'name', '')\r\n              this_.$set(this_.bpmForm.mb, 'formValue', '')\r\n            }\r\n        }).catch(() => {\r\n          this.$set(this_.bpmForm.pc,'type',val == 'INNER' ?'FRAME':'INNER');         \r\n        });\r\n      } \r\n    },\r\n    //打开子表数据授权\r\n    authorizeSubData() {\r\n      this.$refs.flowFormRightSubSetting.showDialog()\r\n    },\r\n    dialogCancel() {},\r\n    formPropSetConfirm(conf) {\r\n      this.bpmForm.pc.formExtraConf = JSON.stringify(conf)\r\n    },\r\n    setFormExtraConf() {\r\n      let param = {\r\n        formkey: this.bpmForm.pc.formValue,\r\n        propConf: this.bpmForm.pc.formExtraConf,\r\n      }\r\n      this.$refs.flowFormExtraPropSet.showDialog(param)\r\n    },\r\n    dialogConfirm(data) {\r\n      if (data && data.length > 0) {\r\n        data = data[0]\r\n        if (\r\n          this.curSelectForm.formValue &&\r\n          this.curSelectForm.formValue != data.formKey &&\r\n          this.curSelectForm.formType == 'pc'\r\n        ) {\r\n          let this_ = this\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            if (this_.bpmForm.mb.formValue) {\r\n              this_.doClearForm(this_.bpmForm.mb)\r\n            }\r\n            this.doClearForm(this_.curSelectForm, function () {\r\n              this_.curSelectForm.formValue = data.formKey\r\n              this_.curSelectForm.name = data.name\r\n              this_.formDialogVisible = false\r\n              this_.$message.success('表单设置已清除')\r\n            })\r\n          })\r\n        } else {\r\n          this.curSelectForm.formValue = data.formKey\r\n          this.curSelectForm.name = data.name\r\n          this.formDialogVisible = false\r\n        }\r\n      }\r\n    },\r\n    selectForm(form) {\r\n      if (form.formType == 'mobile' && !this.bpmForm.pc.formValue) {\r\n        this.$message.warning(\r\n          '请先选择pc表单，才能根据pc表单的数据建模筛选手机表单'\r\n        )\r\n        return\r\n      }\r\n      this.curSelectForm = form\r\n      this.$refs.eipFormDialog.showDialog()\r\n    },\r\n    formAuth() {\r\n      let param = {\r\n        flowKey: this.defConfigData.initData.bpmDefinition.defKey,\r\n        formKey: this.bpmForm.pc.formValue,\r\n        nodeId: this.nodeId,\r\n        parentflowKey: this.defkey == undefined ? '' : this.defkey,\r\n        type: this.type,\r\n      }\r\n      this.$refs.flowFormAuth.showDialog(param)\r\n    },\r\n    clearForm(form, callBack) {\r\n      if (form.formType == 'pc') {\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.doClearForm(form)\r\n          if (this.bpmForm.mb.formValue) {\r\n            this.doClearForm(this.bpmForm.mb)\r\n          }\r\n        })\r\n      } else {\r\n        this.doClearForm(form)\r\n      }\r\n    },\r\n    doClearForm(form, callBack) {\r\n      let nodeId = form.nodeId || ''\r\n      let this_ = this\r\n      let parentFlowKey = this.defkey == undefined ? '' : this.defkey\r\n      req\r\n        .get(\r\n            '${form}/form/rights/v1/remove?flowKey=' +\r\n            this.defConfigData.initData.bpmDefinition.defKey +\r\n            '&nodeId=' +\r\n            nodeId +\r\n            '&parentFlowKey=' +\r\n            parentFlowKey\r\n        )\r\n        .then(function (resp) {\r\n          let data = resp.data\r\n          if (data.state) {\r\n            this_.$set(form, 'name', '')\r\n            this_.$set(form, 'formValue', '')\r\n            this_.showAuthorizeSubData = false\r\n            if (callBack) {\r\n              callBack()\r\n            } else {\r\n              this_.$message.success('表单设置已清除')\r\n            }\r\n          } else {\r\n            this_.$message.fail(data.message)\r\n          }\r\n        })\r\n    },\r\n    success(response, file, fileList) {\r\n      this.files = []\r\n      for (let i = 0; i < fileList.length; i++) {\r\n        if (fileList[i].response) {\r\n          let value = fileList[i].response\r\n          let arrarFile = {}\r\n          arrarFile.id = value.fileId\r\n          arrarFile.name = value.fileName\r\n          arrarFile.size = value.size\r\n          this.files.push(arrarFile)\r\n        }\r\n      }\r\n      this.bpmForm.pc.helpFile = JSON.stringify(this.files)\r\n    },\r\n    handleRemove(file, fileList) {\r\n      this.$set(this.bpmForm.pc, 'helpFile', '')\r\n    },\r\n    updateForm() {\r\n      //保持pc端和移动端表单的类型一致\r\n      this.bpmForm.mb.type = this.bpmForm.pc.type\r\n\r\n      if (this.type == '1') {\r\n        this.$store.dispatch('flow/updateConfig', {\r\n          'nodeSetData.bpmDefSetting.globalForm': this.bpmForm.pc,\r\n        })\r\n        this.$store.dispatch('flow/updateConfig', {\r\n          'nodeSetData.bpmDefSetting.globalMobileForm': this.bpmForm.mb,\r\n        })\r\n      } else if (this.type == '2') {\r\n        this.$store.dispatch('flow/updateConfig', {\r\n          'nodeSetData.bpmDefSetting.instForm': this.bpmForm.pc,\r\n        })\r\n        this.$store.dispatch('flow/updateConfig', {\r\n          'nodeSetData.bpmDefSetting.instMobileForm': this.bpmForm.mb,\r\n        })\r\n      } else {\r\n        let pcPath = 'nodeSetData.bpmDefSetting.formMap.' + this.nodeId\r\n        let mbPath = 'nodeSetData.bpmDefSetting.mobileFormMap.' + this.nodeId\r\n        let pcForm = {}\r\n        pcForm[pcPath] = this.bpmForm.pc\r\n        let mbForm = {}\r\n        mbForm[mbPath] = this.bpmForm.mb\r\n        this.$store.dispatch('flow/updateConfig', pcForm)\r\n        this.$store.dispatch('flow/updateConfig', mbForm)\r\n      }\r\n    },\r\n  },\r\n  created() {\r\n    if (this.defConfigData.nodeSetData.bpmDefSetting) {\r\n      this.tempSettting = JSON.parse(\r\n        JSON.stringify(this.defConfigData.nodeSetData.bpmDefSetting)\r\n      )\r\n      if (this.type == '1') {\r\n        this.bpmForm = {\r\n          pc: this.tempSettting.globalForm,\r\n          mb: this.tempSettting.globalMobileForm,\r\n        }\r\n      } else if (this.type == '2') {\r\n        this.bpmForm = {\r\n          pc: this.tempSettting.instForm,\r\n          mb: this.tempSettting.instMobileForm,\r\n        }\r\n      } else {\r\n        this.bpmForm = {\r\n          pc: this.tempSettting.formMap[this.nodeId],\r\n          mb: this.tempSettting.mobileFormMap[this.nodeId],\r\n        }\r\n      }\r\n      if (this.bpmForm.pc && this.bpmForm.pc.helpFile) {\r\n        this.files = JSON.parse(this.bpmForm.pc.helpFile)\r\n      }\r\n    }\r\n  },\r\n}\r\n",null]}