From d6d452d9a68b0a6a7ce45879c46eb756e88017b8 Mon Sep 17 00:00:00 2001 From: dyy <807692433@qq.com> Date: Thu, 10 Mar 2022 10:49:25 +0800 Subject: [PATCH] =?UTF-8?q?app2.0=EF=BC=9A=E6=B5=81=E7=A8=8B=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/nworkflow/myflow/single.vue | 100 ++++++++---------- 1 file changed, 46 insertions(+), 54 deletions(-) diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/nworkflow/myflow/single.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/nworkflow/myflow/single.vue index 219f237f4..a6521be89 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/nworkflow/myflow/single.vue +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/nworkflow/myflow/single.vue @@ -2,12 +2,10 @@ - - + + - @@ -31,20 +30,18 @@ import workflowFormMixins from '../workflow.js' export default { data() { return { + tab: 0, editMode: false, type: 'view', ready: false, - code: null, currentTask: null, taskId: null, processList: [], - processId: null, processInfo: null, currentNode: null, - scheme: [], formValue: {}, rel: {} @@ -52,17 +49,14 @@ export default { }, mixins: [workflowFormMixins], - async onLoad({ type }) { await this.init(type) }, - // 小程序专有,分享任务到聊天 // #ifdef MP onShareAppMessage() { const props = ['F_Id', 'F_Title', 'F_TaskId', 'F_ProcessId', 'F_IsStart', 'F_IsFinished', 'F_EnabledMark'] const taskInfo = { ...pick(this.currentTask, props), mark: 'pre' } - // 获取页面参数 const queryString = this.MP_SHARE_ENCODE(taskInfo, { type: this.type }) return { @@ -72,27 +66,26 @@ export default { } }, // #endif - methods: { // 页面初始化 async init(type = 'view') { // type 表示打开方式:view=查看普通流程,child=子流程,refer=审阅 // 当前任务相关信息用 GET_PARAM 获取 - // 需要字段: F_Title、F_Id、F_TaskId、F_ProcessId、F_IsFinished、F_IsStart、F_EnabledMark // 需要字段: mark (是 my 或者不是,表示是否自「我的」列打开) - this.type = type this.currentTask = this.GET_PARAM() - + console.log(this.type,this.currentTask); this.LOADING('加载表单中…') this.SET_TITLE(this.currentTask.F_Title) - // 未完成的子流程,可以编辑 if (get(this.currentTask, 'mark') !== 'maked' && this.type === 'child') { this.editMode = true } - + // 如果是代办任务是可编辑的 + if (get(this.currentTask, 'mark') === 'pre' ) { + this.editMode = true + } // 获得流程信息 this.processId = this.currentTask.F_Id this.taskId = this.currentTask.F_TaskId @@ -100,34 +93,49 @@ export default { processId: this.processId, taskId: this.taskId }) - + console.log(this.processInfo) this.currentNode = this.getCurrentNode(this.processInfo) + console.log(this.currentNode) this.processList = get(this.processInfo, 'info.TaskLogList', []) - + console.log(this.processList) // wfForms 的数组成员 t,表示表单数据项(TAB页) // t.formId 使用表单,根据这个 formId 来获取 scheme 等信息 // t.appurl 使用移动页面,直接跳转到本地的页面;表单结构等均写死在页面里 const { wfForms } = this.currentNode + console.log(wfForms); // 处理没有有效表单的情况,停止加载 - if (!wfForms || wfForms.every(t => !t.formId && !t.appurl)) { - this.HIDE_LOADING() - this.TOAST('移动表单数据(wfForms)中无有效表单') - return - } + //if (!wfForms || wfForms.every(t => !t.formId && !t.appurl)) { + //this.HIDE_LOADING() + //this.TOAST('移动表单数据(wfForms)中无有效表单') + //return + //} + //2022-02-14修改 + if (this.type !== 'child') { + if (!wfForms || wfForms.every(t => !t.formId && !t.appurl)) { + this.HIDE_LOADING() + this.TOAST('移动表单数据(wfForms)中无有效表单') + //return + } + } + //2022-02-14修改end // 处理移动端本地表单(也就是系统表单)的情况,直接跳转过去 - const appSysPage = wfForms.find(t => t.appurl) + //const appSysPage = wfForms.find(t => t.appurl) + //2022-02-14修改 + var appSysPage = null + if(wfForms && wfForms.every(t => t.formId && t.appurl)){ + appSysPage = wfForms.find(t => t.appurl) + } + //2022-02-14修改end if (this.type !== 'child' && appSysPage) { this.sysFormJump(appSysPage.appurl, { currentNode: this.currentNode, currentTask: this.currentTask, logList: this.processList }) - return } - if (this.type === 'child') { // 发起子流程的场合 // 获取子流程的流程信息,提取出时间线和表单模板 code @@ -138,7 +146,6 @@ export default { // 提取出子流程 Id;因为是发起新的流程,所以 processInfo 只传入表单模板 code const childProcessId = this.processInfo.info.childProcessId const childCurrentNode = this.getCurrentNode(await this.fetchProcessInfo({ code: this.code })) - // 处理系统表单跳转,使用子流程相关信息 if (appSysPage) { this.sysFormJump(appSysPage.appurl, { @@ -147,10 +154,8 @@ export default { parentProcessId: this.processId, logList: this.processList }) - return } - const schemeData = await this.fetchSchemeData(childCurrentNode) const formData = await this.fetchFormData(childCurrentNode, childProcessId) const { formValue, scheme, rel, options } = await this.getCustomForm({ @@ -168,7 +173,8 @@ export default { // 不是子流程,可以直接渲染 const schemeData = await this.fetchSchemeData(this.currentNode) const formData = await this.fetchFormData(this.currentNode, this.processId) - + console.log(schemeData) + console.log(formData) const { formValue, scheme, rel } = await this.getCustomForm({ formData, schemeData, @@ -176,14 +182,14 @@ export default { processId: this.processId, code: null }) - this.scheme = scheme + console.log(scheme) this.formValue = formValue this.rel = rel } - this.ready = true this.HIDE_LOADING() + }, // 跳转到系统表单页面 @@ -198,51 +204,45 @@ export default { this.JUMP_TO(`${pagePath}?type=${this.type}`, param, true) }, - // 点击操作按钮(非审批类按钮) - async atcion(taskType) { - switch (actionType) { + async action(taskType) { + switch (taskType) { // 点击「催办」/「撤销流程」/「标记已阅」按钮 case 'urge': case 'revoke': case 'refer': - const actionText = { urge: '催办', revoke: '撤销', refer: '已阅' }[actionType] - const actionUrl = { urge: '/urge', revoke: '/revoke', refer: '/refer' }[actionType] + const actionText = { urge: '催办', revoke: '撤销', refer: '已阅' }[taskType] + const actionUrl = { urge: '/urge', revoke: '/revoke', refer: '/refer' }[taskType] let actionData = this.processId - if (actionType === 'refer') { + if (taskType === 'refer') { actionData = { processId: this.processId, taskId: this.taskId } } if (!(await this.CONFIRM(`${actionText}确认`, `确定要提交${actionText}吗?`, true))) { return } - this.LOADING(`提交${actionText}中…`) - this.HTTP_POST(`/newwf${actionUrl}`, actionData, `提交${actionText}失败`).then(success => { + this.HTTP_POST(`/learun/adms/newwf${actionUrl}`, actionData, `提交${actionText}失败`).then(success => { this.HIDE_LOADING() if (success) { this.EMIT('task-list-change') this.TOAST(`成功提交${actionText}`, 'success') - - if (actionType === 'revoke') { + if (taskType === 'revoke') { this.NAV_BACK() } } }) break - // 点击「提交草稿」按钮 case 'draft': if (!(await this.CONFIRM('提交确认', '确定要提交草稿吗?', true))) { return } - this.LOADING('正在提交…') const draftFormValue = this.$refs.form.getFormValue() const draftPostData = await this.getPostData(draftFormValue, this.scheme) - - this.HTTP_POST('/newwf​/draft', draftPostData, '提交草稿失败').then(success => { + this.HTTP_POST('learun/adms/newwf/draft', draftPostData, '提交草稿失败').then(success => { this.HIDE_LOADING() if (success) { this.EMIT('task-list-change') @@ -251,7 +251,6 @@ export default { } }) break - // 点击「发起流程」按钮 case 'submit': const verifyResult = this.$refs.form.verifyValue() @@ -259,11 +258,9 @@ export default { this.CONFIRM('表单验证失败', verifyResult.join('\n')) return } - if (!(await this.CONFIRM('提交确认', '确定要发起流程吗?', true))) { return } - this.LOADING('正在提交…') const formValue = this.$refs.form.getFormValue() const postData = await this.getPostData(formValue, this.scheme) @@ -273,9 +270,8 @@ export default { postData.parentProcessId = this.processId postData.parentTaskId = this.taskId } - const errorTips = '流程发起失败' - this.HTTP_POST('/newwf/createchildflow', postData, errorTips).then(success => { + this.HTTP_POST('learun/adms/newwf/childcreate', postData, errorTips).then(success => { this.HIDE_LOADING() if (success) { this.EMIT('task-list-change') @@ -284,7 +280,6 @@ export default { } }) break - default: break } @@ -295,7 +290,6 @@ export default { this.LOADING('加载中…') const currentTask = this.processInfo.task.find(t => t.F_NodeId === this.currentNode.id) const postData = await this.getPostData(this.formValue, this.scheme) - const pageParam = { type: 'sign', processId: currentTask.F_ProcessId, @@ -303,7 +297,6 @@ export default { formreq: postData.formreq, taskName: this.currentTask.F_Title } - // 不是加签 if (action.code !== '__sign__') { Object.assign(pageParam, action) @@ -311,7 +304,6 @@ export default { pageParam.auditors = JSON.stringify({}) pageParam.isFromSignAudit = Number(this.currentTask.F_TaskType) === 3 } - this.HIDE_LOADING() this.NAV_TO('./sign', pageParam, true) }