Commit aad414e9a1b90321b6b995cd8c6f019742917888

Authored by 史婷婷
1 parent 4e32c060

feat: 业务详情-跳转到审核详情和审核-数据处理

@@ -33,4 +33,13 @@ export function getFlowLinkByInstanceIdApi(params) { @@ -33,4 +33,13 @@ export function getFlowLinkByInstanceIdApi(params) {
33 method: 'get', 33 method: 'get',
34 params 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 }
@@ -195,16 +195,14 @@ @@ -195,16 +195,14 @@
195 }) 195 })
196 }, 196 },
197 onAuditDetail() { 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 onAudit() { 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 onCancel() { 207 onCancel() {
210 const id = this.form && (this.form.id || this.form.code) || '' 208 const id = this.form && (this.form.id || this.form.code) || ''
@@ -249,7 +249,6 @@ export default { @@ -249,7 +249,6 @@ export default {
249 }) 249 })
250 }, 250 },
251 onGoDetail(item) { 251 onGoDetail(item) {
252 - const CACHE_KEY = 'FLOW_AUDIT_CACHE';  
253 console.log('onGoDetail___item', item) 252 console.log('onGoDetail___item', item)
254 const _ext = JSON.parse(item.ext || '{}'); 253 const _ext = JSON.parse(item.ext || '{}');
255 const payload = { 254 const payload = {
@@ -258,11 +257,10 @@ export default { @@ -258,11 +257,10 @@ export default {
258 businessId: item.businessId || '', 257 businessId: item.businessId || '',
259 bizFlag: _ext.bizFlag || '' 258 bizFlag: _ext.bizFlag || ''
260 } 259 }
261 - uni.setStorageSync(CACHE_KEY, payload) 260 + uni.setStorageSync('FLOW_AUDIT_CACHE', payload)
262 uni.navigateTo({ url: '/pages/flow/audit_detail' }) 261 uni.navigateTo({ url: '/pages/flow/audit_detail' })
263 }, 262 },
264 onGoAudit(item) { 263 onGoAudit(item) {
265 - const CACHE_KEY = 'FLOW_AUDIT_CACHE';  
266 console.log('onGoAudit___item', item) 264 console.log('onGoAudit___item', item)
267 const _ext = JSON.parse(item.ext || '{}'); 265 const _ext = JSON.parse(item.ext || '{}');
268 // todo 审批 在bizFlag值后面拼 _EDIT,这个配置一个新的审核组件 266 // todo 审批 在bizFlag值后面拼 _EDIT,这个配置一个新的审核组件
@@ -274,7 +272,7 @@ export default { @@ -274,7 +272,7 @@ export default {
274 businessId: item.businessId || '', 272 businessId: item.businessId || '',
275 bizFlag: _ext.bizFlag + '_EDIT' 273 bizFlag: _ext.bizFlag + '_EDIT'
276 } 274 }
277 - uni.setStorageSync(CACHE_KEY, payload) 275 + uni.setStorageSync('FLOW_AUDIT_CACHE', payload)
278 uni.navigateTo({ url: '/pages/flow/audit' }) 276 uni.navigateTo({ url: '/pages/flow/audit' })
279 }, 277 },
280 getDicName: getDicName, 278 getDicName: getDicName,
@@ -68,14 +68,50 @@ export default { @@ -68,14 +68,50 @@ export default {
68 } 68 }
69 }, 69 },
70 onLoad() { 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 const cache = uni.getStorageSync(CACHE_KEY) || {}; 101 const cache = uni.getStorageSync(CACHE_KEY) || {};
73 - console.log('审核__cache', cache) 102 + console.log('审核详情__cache', cache)
74 this.auditCtx = cache; 103 this.auditCtx = cache;
75 if (this.auditCtx && this.auditCtx.instanceId) { 104 if (this.auditCtx && this.auditCtx.instanceId) {
76 this.loadFlowLinkByInstanceId(this.auditCtx.instanceId) 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 methods: { 115 methods: {
80 loadFlowLinkByInstanceId(instanceId) { 116 loadFlowLinkByInstanceId(instanceId) {
81 getFlowLinkByInstanceIdApi({ instanceId }).then(res => { 117 getFlowLinkByInstanceIdApi({ instanceId }).then(res => {
@@ -19,7 +19,7 @@ @@ -19,7 +19,7 @@
19 <script> 19 <script>
20 import FlowTimeline from '@/components/flow-timeline/index.vue' 20 import FlowTimeline from '@/components/flow-timeline/index.vue'
21 import { getSysFlowComponentPath } from '@/utils/flow-components.js' 21 import { getSysFlowComponentPath } from '@/utils/flow-components.js'
22 -import { getFlowLinkByInstanceIdApi } from '@/api/flow.js' 22 +import { getFlowLinkByInstanceIdApi, getInstanceByBusinessIdApi } from '@/api/flow.js'
23 export default { 23 export default {
24 components: { 24 components: {
25 FlowTimeline 25 FlowTimeline
@@ -44,7 +44,36 @@ export default { @@ -44,7 +44,36 @@ export default {
44 } 44 }
45 }, 45 },
46 onLoad() { 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 const cache = uni.getStorageSync(CACHE_KEY) || {}; 77 const cache = uni.getStorageSync(CACHE_KEY) || {};
49 console.log('审核详情__cache', cache) 78 console.log('审核详情__cache', cache)
50 this.auditCtx = cache; 79 this.auditCtx = cache;
@@ -52,6 +81,13 @@ export default { @@ -52,6 +81,13 @@ export default {
52 this.loadFlowLinkByInstanceId(this.auditCtx.instanceId) 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 methods: { 91 methods: {
56 loadFlowLinkByInstanceId(instanceId) { 92 loadFlowLinkByInstanceId(instanceId) {
57 getFlowLinkByInstanceIdApi({ instanceId }).then(res => { 93 getFlowLinkByInstanceIdApi({ instanceId }).then(res => {