Showing
5 changed files
with
93 additions
and
16 deletions
| ... | ... | @@ -33,4 +33,13 @@ export function getFlowLinkByInstanceIdApi(params) { |
| 33 | 33 | method: 'get', |
| 34 | 34 | params |
| 35 | 35 | }) |
| 36 | +} | |
| 37 | + | |
| 38 | +// 根据业务ID获取流程实例 | |
| 39 | +export function getInstanceByBusinessIdApi(params) { | |
| 40 | + return request({ | |
| 41 | + url: `/flow/instance/getByBusinessId`, | |
| 42 | + method: 'get', | |
| 43 | + params | |
| 44 | + }) | |
| 36 | 45 | } |
| \ No newline at end of file | ... | ... |
| ... | ... | @@ -195,16 +195,14 @@ |
| 195 | 195 | }) |
| 196 | 196 | }, |
| 197 | 197 | onAuditDetail() { |
| 198 | - uni.showToast({ | |
| 199 | - title: '审核详情', | |
| 200 | - icon: 'none' | |
| 201 | - }) | |
| 198 | + const CACHE_KEY = 'sourceBusinessId'; | |
| 199 | + uni.setStorageSync(CACHE_KEY, this.form.id) | |
| 200 | + uni.navigateTo({ url: '/pages/flow/audit_detail' }) | |
| 202 | 201 | }, |
| 203 | 202 | onAudit() { |
| 204 | - uni.showToast({ | |
| 205 | - title: '审核', | |
| 206 | - icon: 'none' | |
| 207 | - }) | |
| 203 | + const CACHE_KEY = 'sourceBusinessId'; | |
| 204 | + uni.setStorageSync(CACHE_KEY, this.form.id); | |
| 205 | + uni.navigateTo({ url: '/pages/flow/audit' }) | |
| 208 | 206 | }, |
| 209 | 207 | onCancel() { |
| 210 | 208 | const id = this.form && (this.form.id || this.form.code) || '' | ... | ... |
| ... | ... | @@ -249,7 +249,6 @@ export default { |
| 249 | 249 | }) |
| 250 | 250 | }, |
| 251 | 251 | onGoDetail(item) { |
| 252 | - const CACHE_KEY = 'FLOW_AUDIT_CACHE'; | |
| 253 | 252 | console.log('onGoDetail___item', item) |
| 254 | 253 | const _ext = JSON.parse(item.ext || '{}'); |
| 255 | 254 | const payload = { |
| ... | ... | @@ -258,11 +257,10 @@ export default { |
| 258 | 257 | businessId: item.businessId || '', |
| 259 | 258 | bizFlag: _ext.bizFlag || '' |
| 260 | 259 | } |
| 261 | - uni.setStorageSync(CACHE_KEY, payload) | |
| 260 | + uni.setStorageSync('FLOW_AUDIT_CACHE', payload) | |
| 262 | 261 | uni.navigateTo({ url: '/pages/flow/audit_detail' }) |
| 263 | 262 | }, |
| 264 | 263 | onGoAudit(item) { |
| 265 | - const CACHE_KEY = 'FLOW_AUDIT_CACHE'; | |
| 266 | 264 | console.log('onGoAudit___item', item) |
| 267 | 265 | const _ext = JSON.parse(item.ext || '{}'); |
| 268 | 266 | // todo 审批 在bizFlag值后面拼 _EDIT,这个配置一个新的审核组件 |
| ... | ... | @@ -274,7 +272,7 @@ export default { |
| 274 | 272 | businessId: item.businessId || '', |
| 275 | 273 | bizFlag: _ext.bizFlag + '_EDIT' |
| 276 | 274 | } |
| 277 | - uni.setStorageSync(CACHE_KEY, payload) | |
| 275 | + uni.setStorageSync('FLOW_AUDIT_CACHE', payload) | |
| 278 | 276 | uni.navigateTo({ url: '/pages/flow/audit' }) |
| 279 | 277 | }, |
| 280 | 278 | getDicName: getDicName, | ... | ... |
| ... | ... | @@ -68,14 +68,50 @@ export default { |
| 68 | 68 | } |
| 69 | 69 | }, |
| 70 | 70 | onLoad() { |
| 71 | - const CACHE_KEY = 'FLOW_AUDIT_CACHE' | |
| 71 | + const CACHE_KEY_2 = 'sourceBusinessId'; // 业务列表 跳转过来的数据存储key | |
| 72 | + const _sourceBusinessId = uni.getStorageSync(CACHE_KEY_2) || ''; | |
| 73 | + // 流程模块 (合同那边 一个业务id 可以绑定多个流程实例) | |
| 74 | + const _contractType = uni.getStorageSync('contractType') || ''; | |
| 75 | + console.log('审核详情__sourceBusinessId', _sourceBusinessId) | |
| 76 | + if (_sourceBusinessId) { | |
| 77 | + const params = { | |
| 78 | + businessId: _sourceBusinessId, | |
| 79 | + // 是审核时 | |
| 80 | + operateType: 'AUDIT', // 原有的第二个参数 | |
| 81 | + }; | |
| 82 | + if (_contractType) { | |
| 83 | + params.mode = _contractType; | |
| 84 | + } | |
| 85 | + getInstanceByBusinessIdApi(params).then(res => { | |
| 86 | + console.log('审核详情__getInstanceByBusinessIdApi', res) | |
| 87 | + const _data = res && res.data ? res.data : {}; | |
| 88 | + const _ext = JSON.parse(_data.ext || '{}'); | |
| 89 | + this.auditCtx = { | |
| 90 | + taskId: _data.taskId || '', | |
| 91 | + instanceId: _data.id || '', | |
| 92 | + businessId: _data.businessId || '', | |
| 93 | + bizFlag: _ext.bizFlag || '' | |
| 94 | + } | |
| 95 | + if (this.auditCtx && this.auditCtx.instanceId) { | |
| 96 | + this.loadFlowLinkByInstanceId(this.auditCtx.instanceId) | |
| 97 | + } | |
| 98 | + }).catch(() => { }) | |
| 99 | + } | |
| 100 | + const CACHE_KEY = 'FLOW_AUDIT_CACHE'; // 流程中心、我发起的 跳转过来的数据存储key | |
| 72 | 101 | const cache = uni.getStorageSync(CACHE_KEY) || {}; |
| 73 | - console.log('审核__cache', cache) | |
| 102 | + console.log('审核详情__cache', cache) | |
| 74 | 103 | this.auditCtx = cache; |
| 75 | 104 | if (this.auditCtx && this.auditCtx.instanceId) { |
| 76 | 105 | this.loadFlowLinkByInstanceId(this.auditCtx.instanceId) |
| 77 | 106 | } |
| 78 | 107 | }, |
| 108 | + onUnload() { | |
| 109 | + try { | |
| 110 | + uni.removeStorageSync('FLOW_AUDIT_CACHE'); // 流程中心、我发起的 跳转过来的数据存储key | |
| 111 | + uni.removeStorageSync('sourceBusinessId'); // 业务列表 跳转过来的数据存储key | |
| 112 | + uni.removeStorageSync('contractType'); // 流程模块 (合同那边 一个业务id 可以绑定多个流程实例) | |
| 113 | + } catch (e) { } | |
| 114 | + }, | |
| 79 | 115 | methods: { |
| 80 | 116 | loadFlowLinkByInstanceId(instanceId) { |
| 81 | 117 | getFlowLinkByInstanceIdApi({ instanceId }).then(res => { | ... | ... |
| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 | <script> |
| 20 | 20 | import FlowTimeline from '@/components/flow-timeline/index.vue' |
| 21 | 21 | import { getSysFlowComponentPath } from '@/utils/flow-components.js' |
| 22 | -import { getFlowLinkByInstanceIdApi } from '@/api/flow.js' | |
| 22 | +import { getFlowLinkByInstanceIdApi, getInstanceByBusinessIdApi } from '@/api/flow.js' | |
| 23 | 23 | export default { |
| 24 | 24 | components: { |
| 25 | 25 | FlowTimeline |
| ... | ... | @@ -44,7 +44,36 @@ export default { |
| 44 | 44 | } |
| 45 | 45 | }, |
| 46 | 46 | onLoad() { |
| 47 | - const CACHE_KEY = 'FLOW_AUDIT_CACHE' | |
| 47 | + const CACHE_KEY_2 = 'sourceBusinessId'; // 业务列表 跳转过来的数据存储key | |
| 48 | + const _sourceBusinessId = uni.getStorageSync(CACHE_KEY_2) || ''; | |
| 49 | + // 流程模块 (合同那边 一个业务id 可以绑定多个流程实例) | |
| 50 | + const _contractType = uni.getStorageSync('contractType') || ''; | |
| 51 | + console.log('审核详情__sourceBusinessId', _sourceBusinessId) | |
| 52 | + if (_sourceBusinessId) { | |
| 53 | + const params = { | |
| 54 | + businessId: _sourceBusinessId, | |
| 55 | + // 是审核时 | |
| 56 | + operateType: 'VIEW', // 原有的第二个参数 | |
| 57 | + }; | |
| 58 | + if (_contractType) { | |
| 59 | + params.mode = _contractType; | |
| 60 | + } | |
| 61 | + getInstanceByBusinessIdApi(params).then(res => { | |
| 62 | + console.log('审核详情__getInstanceByBusinessIdApi', res) | |
| 63 | + const _data = res && res.data ? res.data : {}; | |
| 64 | + const _ext = JSON.parse(_data.ext || '{}'); | |
| 65 | + this.auditCtx = { | |
| 66 | + taskId: _data.taskId || '', | |
| 67 | + instanceId: _data.id || '', | |
| 68 | + businessId: _data.businessId || '', | |
| 69 | + bizFlag: _ext.bizFlag || '' | |
| 70 | + } | |
| 71 | + if (this.auditCtx && this.auditCtx.instanceId) { | |
| 72 | + this.loadFlowLinkByInstanceId(this.auditCtx.instanceId) | |
| 73 | + } | |
| 74 | + }).catch(() => { }) | |
| 75 | + } | |
| 76 | + const CACHE_KEY = 'FLOW_AUDIT_CACHE'; // 流程中心、我发起的 跳转过来的数据存储key | |
| 48 | 77 | const cache = uni.getStorageSync(CACHE_KEY) || {}; |
| 49 | 78 | console.log('审核详情__cache', cache) |
| 50 | 79 | this.auditCtx = cache; |
| ... | ... | @@ -52,6 +81,13 @@ export default { |
| 52 | 81 | this.loadFlowLinkByInstanceId(this.auditCtx.instanceId) |
| 53 | 82 | } |
| 54 | 83 | }, |
| 84 | + onUnload() { | |
| 85 | + try { | |
| 86 | + uni.removeStorageSync('FLOW_AUDIT_CACHE'); // 流程中心、我发起的 跳转过来的数据存储key | |
| 87 | + uni.removeStorageSync('sourceBusinessId'); // 业务列表 跳转过来的数据存储key | |
| 88 | + uni.removeStorageSync('contractType'); // 流程模块 (合同那边 一个业务id 可以绑定多个流程实例) | |
| 89 | + } catch (e) { } | |
| 90 | + }, | |
| 55 | 91 | methods: { |
| 56 | 92 | loadFlowLinkByInstanceId(instanceId) { |
| 57 | 93 | getFlowLinkByInstanceIdApi({ instanceId }).then(res => { | ... | ... |