{"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\\taskFlowComponents\\formContent.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xypm-web\\src\\components\\flow\\taskFlowComponents\\formContent.vue","mtime":1675214577167},{"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":456789000000},{"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/es6.function.name\";\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\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 OnlineForm from '@/components/flow/OnlineForm.vue';\nimport form from '@/api/formContent.js';\nimport { Message } from 'element-ui';\nimport { Loading } from 'element-ui';\nimport FilePreview from '@/components/common/FilePreview.vue';\nimport req from '@/request.js';\nexport default {\n  name: 'formContent',\n  props: ['instId', 'taskId', 'defId', 'proInstId', 'type', 'readId', 'readDoneId', 'myReadType', 'leaderId', 'formLoading', 'task_state', 'tasks', 'isLook', 'copyInstId', 'startFlow', 'relationData'],\n  data: function data() {\n    return {\n      buttons: [],\n      status_style: '',\n      dataInstId: '',\n      html: null,\n      data: null,\n      permission: null,\n      isView: true,\n      formType: 'INNER',\n      htmlSrc: null,\n      urgentStateConf: {},\n      formHelpFile: '',\n      src: '',\n      files: [],\n      fileId: '',\n      fileTree: '',\n      formData: '',\n      initFillData: false,\n      formId: '',\n      flowKey: '',\n      taskDetailLoading: '',\n      topDivHeight: '99px',\n      //空div的高度 用于撑开页面下的div内容\n      formKey: '',\n      //表单key\n      formComponentKey: new Date().getTime(),\n      iframeWin: null\n    };\n  },\n  watch: {\n    tasks: function tasks(newVal, oldVal) {\n      if (newVal) {\n        this.init();\n      }\n    },\n    urgentStateValue: function urgentStateValue(newVal, oldVal) {\n      if (window.urgentStateValue) {\n        window.urgentStateValue.new = newVal;\n      }\n    }\n  },\n  created: function created() {\n    if (this.isPlmeformPage) {\n      this.topDivHeight = 0;\n    }\n    //待办的时候,watch已经监听了tasks,可以不用初始化\n    if (!this.taskId) {\n      this.init();\n    }\n    if (this.type == 'request') {\n      this.topDivHeight = '20px';\n    }\n  },\n  methods: {\n    /**\r\n     * 修改样式\r\n     * @param divheight  最上面div的高度\r\n     */\n    updateStyle: function updateStyle(divheight) {\n      this.topDivHeight = divheight;\n    },\n    previewHelpFile: function previewHelpFile() {\n      var obj = {};\n      obj.id = this.formHelpFile[0].id;\n      obj.name = this.formHelpFile[0].name;\n      obj.size = this.formHelpFile[0].size;\n      this.$refs.filePreview.preview(obj);\n    },\n    setInitFillData: function setInitFillData(isInitFillData) {\n      this.initFillData = isInitFillData;\n    },\n    hiddenContent: function hiddenContent() {\n      this.$refs.formContainer.className = 'form-container-not';\n    },\n    init: function init(updateFormComponent) {\n      var _this2 = this;\n      if (this.task_state == 'FOLLOW') {\n        this.status_style = 'padding-top:0px !important;';\n      }\n      var $ = require('jquery');\n      var _me = this;\n      if (_me.tasks) {\n        _me.initFillData = _me.tasks.initFillData;\n      }\n      var readOnly = false;\n      if (_me.tasks && _me.tasks.bpmTask && (_me.tasks.bpmTask.status === 'COMMU' || _me.tasks.bpmTask.status === 'TRANSFORMEDINQU' || _me.tasks.bpmTask.status === 'FOLLOW')) {\n        readOnly = true;\n      }\n\n      //获取流程定义key\n      _me.getFlowKey();\n      var handlerJs = function handlerJs(rep) {\n        var currentUser = _me.$store.state.login.currentUser;\n        var data = _me.data;\n        var _this = _me;\n        if (rep && rep.diyJs) {\n          eval(rep.diyJs);\n        }\n      };\n      var handler = function handler(rep) {\n        //发起流程的时候得到按钮对象\n        if (rep.buttons) {\n          _me.buttons = rep.buttons;\n        }\n        if (_me.taskDetailLoading) {\n          _me.taskDetailLoading.close();\n        }\n        if (_me.myReadType == 'agent') {\n          Message.warning('此流程已被委托,没有审批权');\n        }\n        if (!rep) {\n          return;\n        }\n        if (JSON.stringify(rep) == '{}') {\n          Message.error('此流程还没有设置全局表单,请先设置全局表单!');\n          return;\n        }\n        if (rep.resultMsg == 'formEmpty' || rep.result == 'formEmpty') {\n          Message.error('此流程还没有设置表单,请先设置表单!');\n          return;\n        }\n        _me.formKey = rep.form.formKey;\n        //_me.formId=rep.form.formId;\n        if (rep.form && rep.form.type == 'FRAME') {\n          _me.htmlSrc = rep.form.formValue;\n          console.log(_me.htmlSrc, '_me.htmlSrc ', _me);\n          _me.formType = rep.form.type;\n\n          //表单加载完成发布事件 审批按钮才可以点击\n          _me.$root.$emit('formLoading', false);\n        } else {\n          _me.formId = rep.form.formId;\n          form.preview(rep.form.formId, handlerJs);\n          if (_me.formData) {\n            _me.data = JSON.parse(Base64.decode(_me.formData));\n          } else {\n            _me.data = rep.data;\n          }\n          if (rep.permission) {\n            var permissionObj = JSON.parse(rep.permission);\n            var commonRight = '';\n            //如果是管理端进入，则将页面字段的权限修改为可编辑\n            if (_me.type == 'manage') {\n              commonRight = 'w';\n              //如果是查看实例，也是获取发起流程的表单和权限。只不过所有可见的权限要变成编辑\n            } else if ('request' == _me.type || _me.myReadType == 'myRequest' || _me.myReadType == 'delegate' || _me.myReadType == 'myRead' || _me.readDoneId || _me.type == 'read' || readOnly) {\n              commonRight = 'r';\n            }\n            if (permissionObj.fields && commonRight) {\n              for (var key in permissionObj.fields) {\n                var bodef = permissionObj.fields[key];\n                if (bodef) {\n                  for (var fname in bodef) {\n                    if (commonRight == 'w' || commonRight == 'r' && bodef[fname] != 'n') {\n                      bodef[fname] = commonRight;\n                    }\n                  }\n                }\n                permissionObj.fields[key] = bodef;\n              }\n            }\n            if (permissionObj.table && commonRight) {\n              for (var key in permissionObj.table) {\n                var table = permissionObj.table[key];\n                if (table) {\n                  if (commonRight == 'w') {\n                    table['hidden'] = false;\n                    table['add'] = true;\n                    table['del'] = true;\n                  } else if (commonRight == 'r') {\n                    table['add'] = false;\n                    table['del'] = false;\n                    table['required'] = false;\n                    table['edit'] = false;\n                  }\n                }\n                permissionObj.table[key] = table;\n              }\n            }\n            _me.permission = permissionObj;\n          }\n          _me.html = rep.form.formHtml;\n          if (rep.form.helpFile) {\n            _me.formHelpFile = JSON.parse(rep.form.helpFile);\n          }\n          if (_me.html.split('ref=\"next_step_check_').length > 1) {\n            _me.$root.$emit('startFlowBtnChange', false);\n          }\n          //表单加载完成发布事件 审批按钮才可以点击\n          _me.$root.$emit('formLoading', false);\n          if (updateFormComponent) {\n            _me.formComponentKey = new Date().getTime();\n          }\n        }\n      };\n      this.$store.dispatch('storeProcess/getUrgentStateConf', {\n        defId: this.defId,\n        instId: this.instId,\n        taskId: this.taskId\n      }).then(function (data) {\n        if (data.conf) {\n          try {\n            data.conf = JSON.parse(data.conf);\n          } catch (error) {\n            data.conf = eval('(' + data.conf + ')');\n          }\n          window.urgentStateValue = {\n            old: data.value\n          };\n          if (!data.value) {\n            for (var index = 0, c; c = data.conf[index++];) {\n              if (c.default) {\n                data.value = c.state;\n                break;\n              }\n            }\n          }\n          _me.urgentStateConf = data;\n        }\n      });\n      if (this.taskId && this.tasks && JSON.stringify(this.tasks) != '{}') {\n        if (!this.tasks.bpmTask && !this.tasks.state && this.tasks.message == '此任务已被处理或不存在！') {\n          _me.$router.push('/v-flow/v-todo');\n          return;\n        }\n        this.taskDetailLoading = Loading.service({\n          fullscreen: true,\n          lock: true,\n          text: '表单数据加载中，请耐心等待...',\n          spinner: 'el-icon-loading',\n          background: 'rgba(0, 0, 0, 0.7)'\n        }); //开始\n        if (this.tasks.bpmTask.bpmnInstId) {\n          form.taskDetail({\n            taskId: this.taskId,\n            leaderId: this.leaderId\n          }, handler);\n        } else {\n          form.getInstFormAndBO(this.tasks.bpmTask.procInstId, handler);\n        }\n      } else if (this.taskId && window.location.href.indexOf('/task/' + this.taskId + '/0') != -1) {\n        form.taskDetail({\n          taskId: this.taskId,\n          leaderId: this.leaderId\n        }, handler);\n        var params = {\n          taskId: this.taskId,\n          leaderId: this.leaderId\n        };\n        this.$store.dispatch('storeProcess/taskDetail', params); //获取操作按钮\n      } else if (this.instId) {\n        if ('start' != this.type) {\n          this.isView = false;\n        }\n        //查看我发起的，也使用发起流程的表单。只不过把编辑和必填权限改成只读\n        if ('request' == this.type || 'myRequest' == this.myReadType) {\n          form.getFormAndBO({\n            proInstId: this.instId\n          }, handler);\n        } else if ('read' == this.type || this.myReadType) {\n          var this_ = this;\n          if (this.readId) {\n            //知会待办\n            //根据待办知会任务主键ID获取任务ID\n            this.$store.dispatch('storeProcess/getBpmTaskNoticeById', this_.readId).then(function (row) {\n              if (row.taskId) {\n                //根据任务Id获取审批历史数据（只有一条）\n                _this2.$store.dispatch('storeProcess/getTaskKeyByTaskId', row.taskId).then(function (res) {\n                  if (res.formData) {\n                    this_.formData = res.formData;\n                  }\n                  var isIncludData = res.formData ? false : true;\n                  form.getInstFormAndBO({\n                    instId: this_.instId,\n                    nodeId: res.taskKey,\n                    includData: isIncludData\n                  }, handler);\n                });\n              } else if (row.nodeId) {\n                var data = {\n                  nodeId: row.nodeId,\n                  instId: this_.instId\n                };\n                //根据任务节点ID和流程实例ID获取审批历史数据（只有一条）\n                _this2.$store.dispatch('storeProcess/getTaskKeyByNodeId', data).then(function (res) {\n                  if (res.formData) {\n                    this_.formData = res.formData;\n                  }\n                  var isIncludData = res.formData ? false : true;\n                  form.getInstFormAndBO({\n                    instId: this_.instId,\n                    nodeId: res.taskKey,\n                    includData: isIncludData\n                  }, handler);\n                });\n              } else {\n                //查看我发起的，也使用发起流程的表单\n                form.getFormAndBO({\n                  proInstId: _this2.instId\n                }, handler);\n                // form.getInstFormAndBO(this_.instId, handler);\n              }\n            });\n          } else if (this.readDoneId) {\n            //知会已办\n            //根据已办知会任务主键ID获取任务ID\n            this.$store.dispatch('storeProcess/getBpmTaskNoticeDoneById', this_.readDoneId).then(function (row) {\n              if (row.taskId) {\n                //根据任务Id获取审批历史数据（只有一条）\n                _this2.$store.dispatch('storeProcess/getTaskKeyByTaskId', row.taskId).then(function (res) {\n                  if (res.formData) {\n                    this_.formData = res.formData;\n                  }\n                  var isIncludData = res.formData ? false : true;\n                  form.getInstFormAndBO({\n                    instId: this_.instId,\n                    nodeId: res.taskKey,\n                    includData: isIncludData\n                  }, handler);\n                });\n              } else if (row.taskKey) {\n                var data = {\n                  nodeId: row.taskKey,\n                  instId: this_.instId\n                };\n                //根据任务节点ID和流程实例ID获取审批历史数据（只有一条）\n                _this2.$store.dispatch('storeProcess/getTaskKeyByNodeId', data).then(function (res) {\n                  if (res.formData) {\n                    this_.formData = res.formData;\n                  }\n                  var isIncludData = res.formData ? false : true;\n                  form.getInstFormAndBO({\n                    instId: this_.instId,\n                    nodeId: res.taskKey,\n                    includData: isIncludData\n                  }, handler);\n                });\n              } else {\n                //查看我发起的，也使用发起流程的表单\n                form.getFormAndBO({\n                  proInstId: _this2.instId\n                }, handler);\n                // form.getInstFormAndBO(this.instId, handler);\n              }\n            });\n          } else {\n            //查看我发起的，也使用发起流程的表单\n            form.getFormAndBO({\n              proInstId: this.instId\n            }, handler);\n            // form.getInstFormAndBO(this.instId, handler);\n          }\n        } else {\n          //查看我发起的，也使用发起流程的表单\n          form.getFormAndBO({\n            proInstId: this.instId\n          }, handler);\n          // form.getInstFormAndBO(this.instId, handler);\n        }\n      } else if (this.defId) {\n        var data = {};\n        if (this.proInstId != undefined) {\n          data = {\n            defId: this.defId,\n            proInstId: this.proInstId\n          };\n        } else if (this.copyInstId) {\n          data = {\n            defId: this.defId,\n            copyInstId: this.copyInstId\n          };\n        } else {\n          data = {\n            defId: this.defId\n          };\n        }\n        form.getFormAndBO(data, handler);\n      }\n    },\n    sendData: function sendData() {\n      this.$refs.iframe.contentWindow.postMessage({\n        params: this.relationData\n      });\n    },\n    getFlowKey: function getFlowKey() {\n      if (this.defId || this.instId || this.taskId) {\n        var url = '${bpmRunTime}/runtime/instance/v1/getFlowKey';\n        if (this.defId) {\n          url = url + '?defId=' + this.defId;\n        } else if (this.instId) {\n          url = url + '?procInstId=' + this.instId;\n        } else if (this.taskId) {\n          url = url + '?taskId=' + this.taskId;\n        }\n        var _me = this;\n        try {\n          _me.$http.get(url, 'json', false).then(function (resp) {\n            var rep = resp.data;\n            if (rep.state) {\n              _me.flowKey = rep.value;\n            }\n          });\n        } catch (error) {}\n      }\n    }\n  },\n  computed: {\n    urgentStateValue: function urgentStateValue() {\n      return this.urgentStateConf.value;\n    },\n    isPlmeformPage: function isPlmeformPage() {\n      return this.$route.query.hasOwnProperty('plmeform');\n    }\n  },\n  components: {\n    OnlineForm: OnlineForm,\n    FilePreview: FilePreview\n  }\n};",null]}