{"remainingRequest":"D:\\jenkins\\workspace\\yhxt-web\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\yhxt-web\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\yhxt-web\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!D:\\jenkins\\workspace\\yhxt-web\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\yhxt-web\\src\\components\\flow\\taskFlowComponents\\startFlow.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\yhxt-web\\src\\components\\flow\\taskFlowComponents\\startFlow.vue","mtime":1667326394279},{"path":"D:\\jenkins\\workspace\\yhxt-web\\babel.config.js","mtime":1667326389982},{"path":"D:\\jenkins\\workspace\\yhxt-web\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\yhxt-web\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\yhxt-web\\node_modules\\babel-loader\\lib\\index.js","mtime":456789000000},{"path":"D:\\jenkins\\workspace\\yhxt-web\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\yhxt-web\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/es6.regexp.replace\";\nimport _typeof from \"D:/jenkins/workspace/yhxt-web/node_modules/@babel/runtime/helpers/esm/typeof.js\";\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\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 req from '@/request.js';\nimport { mapState } from 'vuex';\nimport FormContent from '@/components/flow/taskFlowComponents/formContent.vue';\nimport TaskSelectDestination from '@/components/flow/task/taskSelectDestination.vue';\nimport utils from '@/utils.js';\nimport { Base64 } from 'js-base64';\nexport default {\n name: 'start',\n components: {\n FormContent: FormContent,\n TaskSelectDestination: TaskSelectDestination\n },\n props: ['defId', 'instId', 'leaderId', 'copyInstId', 'relationData'],\n data: function data() {\n return {\n dialogTableVisible: false,\n tableData: [],\n dialogVisible: false,\n disabled: true,\n nodeDef: {},\n flowId: '',\n isShowStartBtn: true,\n isMyRequest: false,\n defName: '',\n initFillData: false,\n reloadForm: false,\n btnAlias: '',\n data: null,\n show: false,\n localInstId: this.instId,\n isFirst: true,\n startDisabled: false\n };\n },\n computed: mapState({\n curOrgPost: function curOrgPost(state) {\n return state.user.postCharge;\n }\n }),\n beforeRouteEnter: function beforeRouteEnter(to, from, next) {\n next(function (vm) {\n //判断用户是否具有流程启动权限\n var userId = vm.$store.state.login.currentUser.userId,\n instId = to.params.instId,\n defId = to.params.defId,\n leadId = to.params.leaderId;\n var url = \"\".concat(window.context.bpmModel, \"/flow/defAuthorize/v1/startRight?userId=\").concat(userId, \"&defId=\").concat(defId, \"&leadId=\").concat(leadId);\n // 发起的是流程草稿时\n if (instId) {\n url = \"\".concat(url, \"&instId=\").concat(instId);\n }\n req.get(url).then(function (resp) {\n if (!resp.data || !resp.data.state || !resp.data.value) {\n vm.$alert('您没有该流程的启动权限', '无权限', {\n confirmButtonText: '返回主页',\n callback: function callback(action) {\n vm.$router.push('/home');\n }\n });\n } else {\n vm.show = true;\n }\n });\n });\n },\n mounted: function mounted() {\n var _this = this;\n //如果该字段的校验受另一个字段影响。则监听另一个字段控件发布的值改变事件\n this.$root.$on('startFlowBtnChange', function (value) {\n _this.isShowStartBtn = value;\n });\n //监听表单加载完成发布事件\n this.$root.$on('formLoading', function (value) {\n _this.disabled = value;\n });\n this.checkAuth();\n },\n methods: {\n checkAuth: function checkAuth() {\n var _this2 = this;\n var userId = this.$store.state.login.currentUser.userId,\n instId = this.instId,\n defId = this.defId,\n leadId = this.leaderId;\n var url = \"\".concat(window.context.bpmModel, \"/flow/defAuthorize/v1/startRight?userId=\").concat(userId, \"&defId=\").concat(defId, \"&leadId=\").concat(leadId);\n // 发起的是流程草稿时\n if (instId) {\n url = \"\".concat(url, \"&instId=\").concat(instId);\n }\n req.get(url).then(function (resp) {\n if (!resp.data || !resp.data.state || !resp.data.value) {\n _this2.$alert('您没有该流程的启动权限', '无权限', {\n confirmButtonText: '返回',\n callback: function callback(action) {\n _this2.$emit('closeTaskFlow');\n }\n });\n } else {\n _this2.show = true;\n }\n });\n },\n //处理任务\n handleTask: function handleTask(row) {\n this.$router.push('/task/' + row.id + '/0');\n },\n // 准备数据\n handleData: function handleData(formDataStr) {\n var data = {\n defId: this.defId\n };\n if (formDataStr) {\n // URL表单\n if (formDataStr.constructor == Object) {\n data.formType = 'frame';\n if (formDataStr.businessKey) {\n data.businessKey = formDataStr.businessKey;\n }\n if (formDataStr.sysCode) {\n data.sysCode = formDataStr.sysCode;\n }\n if (formDataStr.vars) {\n data.vars = formDataStr.vars;\n }\n } else if (formDataStr.constructor == String) {\n data.data = Base64.encode(formDataStr);\n data.formType = 'inner';\n }\n }\n data.supportMobile = 0;\n if (this.instId) {\n data.proInstId = this.instId;\n }\n if (this.curOrgPost && this.curOrgPost.org) {\n data.startOrgId = this.curOrgPost.org.id;\n }\n if (window.urgentStateValue) {\n data.urgentStateValue = window.urgentStateValue;\n }\n if (this.leaderId && this.leaderId != 0) {\n data.agentLeaderId = this.leaderId;\n }\n return data;\n },\n //启动\n start: function start() {\n var _this3 = this;\n this.btnAlias = 'startFlow';\n var _this = this;\n //获取VUE表单实例(判断是否是在线表单)\n if (document.getElementsByName('online-form')[0]) {\n var tables = document.getElementsByName('online-form')[0].__vue__.permission.table; //获取子表权限\n var boData = document.getElementsByName('online-form')[0].__vue__.data; //获取表单bo对象\n var zData = {};\n for (var k in boData) {\n zData = boData[k];\n }\n for (var key in tables) {\n //如果有导入属性,则表明不是子表而是数据报表,不做必填校验\n if (tables[key] && tables[key].hasOwnProperty('export')) {\n continue;\n }\n if ((tables[key].required == true || tables[key].required == 'true') && zData['sub_' + key] && zData['sub_' + key].length == 0) {\n this.$message({\n message: '子表必填一条记录',\n type: 'warning'\n });\n return;\n }\n }\n }\n this.startDisabled = true;\n this.$message.info('请稍等验证中...');\n utils.getOnlineFormData(true).then(function (formDataStr) {\n //执行按钮前置脚本\n if (_typeof(formDataStr) === 'object' && (formDataStr.hasOwnProperty('businessKey') || formDataStr.hasOwnProperty('sysCode'))) {\n _this3.data = formDataStr;\n } else {\n _this3.data = JSON.parse(formDataStr);\n }\n var scriptResult = _this3.runBeforeScript();\n _this3.startDisabled = false;\n if (scriptResult === false) return;\n if (scriptResult.then && typeof scriptResult.then == 'function') {\n scriptResult.then(function () {\n //接口返回成功则正常执行按钮操作\n _this.startNext();\n }, function (fail) {\n //接口返回失败则终止按钮操作,并给与提示\n _this.$message.warning(fail);\n return;\n });\n } else {\n //执行前置脚本返回true时正常执行按钮操作\n _this.startNext();\n }\n }).catch(function (reason) {\n utils.handleGetFormDataReject(reason, true).then(function () {\n setTimeout(function () {\n _this3.startDisabled = false;\n }, 5000);\n // if (!this.startDisabled) {\n _this3.processStart();\n // }\n }).catch(function () {\n _this3.startDisabled = false;\n });\n });\n },\n //执行前置脚本\n runBeforeScript: function runBeforeScript() {\n var _this = this;\n var item = utils.indexOfList(_this.$refs.formContent.buttons, 'alias', _this.btnAlias);\n return _this.tempScript(item.beforeScript);\n },\n //执行前置脚本\n tempScript: function tempScript(script) {\n var _this = this.$refs.formContent;\n var _req = req;\n var boData = this.$refs.formContent.data;\n var tempScript = 'var tempFunction = function(_req,data,_this){ ' + script + '};';\n var result = eval(tempScript + 'tempFunction(_req,boData,_this);');\n if (result && result.then && typeof result.then == 'function') {\n return result;\n }\n if (result === false) return false;\n return true;\n },\n startNext: function startNext() {\n var _this4 = this;\n utils.getOnlineFormData(false).then(function (formDataStr) {\n console.log(formDataStr);\n utils.closeAllNotification();\n if (!_this4.nodeDef.localProperties.jumpType && !_this4.nodeDef.localProperties.choiceExcutor) {\n _this4.processStart(formDataStr);\n } else {\n _this4.$store.dispatch('storeProcess/getAfterJumpNodes', {\n taskId: '',\n data: Base64.encode(formDataStr),\n defId: _this4.defId || '',\n instId: _this4.instId || ''\n }).then(function (data) {\n if (data.afterNodes.length == 0 || data.afterNodes.length == 1 && data.afterNodes[0].excutorList != undefined && data.afterNodes[0].excutorList.length == 1) {\n _this4.processStart(formDataStr);\n } else {\n var formData = {};\n if (formDataStr.constructor == Object) {\n formData = formDataStr;\n formData.data = '';\n } else if (formDataStr.constructor == String) {\n formData.data = Base64.encode(formDataStr);\n }\n _this4.$refs.taskSelectDestination.showDialog(formData, '', ''); //父组件调用子组件方法\n }\n });\n }\n });\n },\n //流程发起\n processStart: function processStart(formDataStr) {\n var _this5 = this;\n // debugger\n // if (!this.isFirst) {\n // return false\n // }\n var formKey = this.$refs.formContent.formKey;\n var data = this.handleData(formDataStr);\n if (sessionStorage.getItem('formImportTempJson')) {\n data.updateSubTableJson = sessionStorage.getItem('formImportTempJson');\n }\n this.disabled = true;\n this.$store.dispatch('storeProcess/start', data).then(function (row) {\n if (row.curBoPkVal) {\n sessionStorage.setItem('formImportTempRefId', row.curBoPkVal);\n }\n sessionStorage.removeItem('formImportTempJson');\n if (row.tasks && row.tasks.length > 0) {\n if (row.tasks.length == 1) {\n _this5.$router.push('/task/' + row.tasks[0].id + '/0');\n } else {\n //弹出窗口让用户自己选择去哪个待办\n _this5.tableData = row.tasks;\n _this5.dialogVisible = true;\n }\n } else {\n // 回到上一页\n if (row.inst.status != 'end') {\n _this5.$emit('closeTaskFlow'); //关闭流程\n // this.$router.go(-1)\n // this.$router.push(\n // '/inst/' + row.instId + '/request'\n // )\n } else {\n _this5.$emit('closeTaskFlow');\n // this.$router.go(-1)\n // this.$router.push(\n // '/instRead/' + row.instId + '/myRequest'\n // )\n }\n }\n // this.$store\n // .dispatch(\"storeProcess/getInstanceByInstId\", row.instId)\n // .then((insts) => {\n\n // if (insts.status != \"end\") {\n // this.$router.push(\"/inst/\" + row.instId + \"/request\");\n // } else {\n // this.$router.push(\"/instRead/\" + row.instId + \"/myRequest\");\n // }\n // });\n }).finally(function () {\n _this5.disabled = false;\n _this5.isFirst = false;\n });\n },\n //保存\n saveDraft: function saveDraft() {\n var _this6 = this;\n this.btnAlias = 'saveDraft';\n var scriptResult = this.runBeforeScript();\n var formKey = this.$refs.formContent.formKey;\n this.disabled = true;\n var this_ = this;\n utils.getOnlineFormData(false).then(function (formDataStr) {\n utils.closeAllNotification();\n var data = this_.handleData(formDataStr);\n data.formKey = formKey;\n if (sessionStorage.getItem('formImportTempJson')) {\n data.updateSubTableJson = sessionStorage.getItem('formImportTempJson');\n }\n this_.$store.dispatch('storeProcess/saveDraft', data).then(function (row) {\n if (row.curBoPkVal) {\n sessionStorage.setItem('formImportTempRefId', row.curBoPkVal);\n }\n sessionStorage.removeItem('formImportTempJson');\n this_.isMyRequest = true;\n this_.localInstId = row.instId;\n this_.$router.replace('/start/' + this_.defId + '/' + row.instId);\n }).finally(function () {\n //保存完成后,需要重新加载bo数据,不然第二次保存的时候会因为版本号不同而导致保存失败\n _this6.$refs.formContent.init(true);\n });\n }).catch(function (reason) {\n _this6.disabled = false;\n utils.handleGetFormDataReject(reason);\n });\n },\n //返回\n back: function back() {\n utils.closeAllNotification();\n if (this.instId) {\n this.$router.push('/v-flow/v-request');\n } else {\n if (JSON.stringify(this.$route.query) == '{}') {\n // this.$router.push(\"/v-flow/v-flowList\");\n this.$emit('closeTaskFlow');\n } else {\n this.$emit('closeTaskFlow');\n }\n }\n },\n toMyTodo: function toMyTodo() {\n this.$router.push('/v-flow/v-todo');\n },\n isMaskShow: function isMaskShow(data) {\n this.dialogTableVisible = data.isMaskShow;\n if (data.isMaskShow) {\n //当子页面弹框开时\n //父页面外部滚动条隐藏\n // document.getElementsByClassName('indexCon')[0].style.overflow =\n // 'hidden'\n //将子页面iframe页面层级提升\n document.getElementById('parentDiv').style.position = 'relative';\n document.getElementById('parentDiv').style.zIndex = 20000000;\n document.getElementById('frmFrame').style.position = 'absolute';\n document.getElementById('frmFrame').style.zIndex = 20000000;\n } else {\n //当子页面弹框关时\n //恢复\n // document.getElementsByClassName('indexCon')[0].style.overflow =\n // 'auto'\n document.getElementById('parentDiv').style.position = 'unset';\n document.getElementById('frmFrame').style.position = 'unset';\n document.getElementById('frmFrame').style.zIndex = 'unset';\n }\n }\n },\n created: function created() {\n var _this7 = this;\n console.log(this.defId, 'defId流程id');\n //监听表单数据请求完成\n var _this = this;\n //取发起节点的属性用于判断是否可以选择路径跳转\n window.agentLeaderId = this.leaderId;\n this.$store.dispatch('storeProcess/getCurNodeProperties', {\n defId: this.defId || '',\n instId: this.instId || '',\n taskId: ''\n }).then(function (NodeDef) {\n _this7.nodeDef = NodeDef;\n if (NodeDef.nodeProperties && NodeDef.nodeProperties.length > 0 && NodeDef.nodeProperties[0].initFillData) {\n _this.initFillData = NodeDef.nodeProperties[0].initFillData;\n _this.$refs['formContent'].setInitFillData(_this.initFillData);\n }\n });\n //获取流程信息\n req.get(window.context.bpmModel + '/flow/def/v1/defGet?defId=' + this.defId).then(function (res) {\n _this7.defName = res.data.name;\n });\n //监听主页面postmessage\n window.addEventListener('message', function (event) {\n var data = event.data;\n _this7[data.handlerType] && _this7[data.handlerType](data.params);\n }, false);\n }\n};",null]}