|
|
@@ -892,8 +892,7 @@ import { getDraftDetail, getDraftCostComparison, getDraftWorkflowProgress } from
|
|
892
|
892
|
import { buildWorkflowChatCardMessage, mapRegistrationBatchDetail } from '@/utils/registration-batch.js'
|
|
893
|
893
|
import {
|
|
894
|
894
|
markEnterpriseCertSkipped,
|
|
895
|
|
- clearEnterpriseCertSkipped,
|
|
896
|
|
- syncStepProcessPanel
|
|
|
895
|
+ clearEnterpriseCertSkipped
|
|
897
|
896
|
} from '@/utils/process-card.js'
|
|
898
|
897
|
import {
|
|
899
|
898
|
getNewChatGreeting,
|
|
|
@@ -1130,7 +1129,7 @@ export default {
|
|
1130
|
1129
|
this.user = s.user
|
|
1131
|
1130
|
this.enterprise = s.enterprise
|
|
1132
|
1131
|
await this.fetchSessions({ autoLoad: true })
|
|
1133
|
|
- this.refreshWorkflowProcessPanels()
|
|
|
1132
|
+ await this.refreshWorkflowProcessPanels()
|
|
1134
|
1133
|
})().finally(() => {
|
|
1135
|
1134
|
this._initHomePromise = null
|
|
1136
|
1135
|
})
|
|
|
@@ -2045,7 +2044,7 @@ export default {
|
|
2045
|
2044
|
silent: true
|
|
2046
|
2045
|
})
|
|
2047
|
2046
|
}
|
|
2048
|
|
- this.refreshWorkflowProcessPanels()
|
|
|
2047
|
+ await this.refreshWorkflowProcessPanels()
|
|
2049
|
2048
|
},
|
|
2050
|
2049
|
/**
|
|
2051
|
2050
|
* 汇总需要展示进度卡的草稿 id:已确认草稿卡 / card_order / 会话进度列表
|
|
|
@@ -2660,48 +2659,68 @@ export default {
|
|
2660
|
2659
|
this.$set(msg.workflow, 'stepIndex', stepIdx)
|
|
2661
|
2660
|
},
|
|
2662
|
2661
|
/**
|
|
2663
|
|
- * 从登记页返回:轻量同步企业认证面板。
|
|
2664
|
|
- * 接口 steps 为 active 时不得被本地 registered 盖成 done。
|
|
|
2662
|
+ * 操作前拉 workflow-progress,用最新步骤 status 做门禁
|
|
|
2663
|
+ * @returns {{ msgIdx: number, msg: object, step: object }|null}
|
|
2665
|
2664
|
*/
|
|
2666
|
|
- refreshWorkflowProcessPanels() {
|
|
2667
|
|
- const registered = store.isEnterpriseRegistered()
|
|
2668
|
|
- if (registered) clearEnterpriseCertSkipped()
|
|
|
2665
|
+ async resolveWorkflowStepFromApi(msgIdx, stepIdx, expectedCardType) {
|
|
|
2666
|
+ const msg0 = this.messages[msgIdx]
|
|
|
2667
|
+ if (!msg0 || msg0.type !== 'workflow' || !msg0.workflow) return null
|
|
|
2668
|
+ const draftId = msg0.draftId != null ? msg0.draftId : msg0.workflow.draftId
|
|
|
2669
|
+ if (draftId != null && draftId !== '') {
|
|
|
2670
|
+ await this.refreshWorkflowCardByDraftId(draftId)
|
|
|
2671
|
+ }
|
|
|
2672
|
+ let nextIdx = msgIdx
|
|
|
2673
|
+ for (let i = this.messages.length - 1; i >= 0; i--) {
|
|
|
2674
|
+ const m = this.messages[i]
|
|
|
2675
|
+ if (!m || m.type !== 'workflow') continue
|
|
|
2676
|
+ const id = m.draftId != null ? m.draftId : (m.workflow && m.workflow.draftId)
|
|
|
2677
|
+ if (draftId != null && draftId !== '' && String(id) === String(draftId)) {
|
|
|
2678
|
+ nextIdx = i
|
|
|
2679
|
+ break
|
|
|
2680
|
+ }
|
|
|
2681
|
+ }
|
|
|
2682
|
+ const msg = this.messages[nextIdx]
|
|
|
2683
|
+ if (!msg || !msg.workflow || !msg.workflow.steps) return null
|
|
|
2684
|
+ let step = msg.workflow.steps[stepIdx]
|
|
|
2685
|
+ if (expectedCardType && (!step || !step.processPanel || step.processPanel.cardType !== expectedCardType)) {
|
|
|
2686
|
+ step = msg.workflow.steps.find((s) => s
|
|
|
2687
|
+ && s.processPanel
|
|
|
2688
|
+ && s.processPanel.cardType === expectedCardType) || null
|
|
|
2689
|
+ }
|
|
|
2690
|
+ if (!step) return null
|
|
|
2691
|
+ return { msgIdx: nextIdx, msg, step }
|
|
|
2692
|
+ },
|
|
|
2693
|
+ /**
|
|
|
2694
|
+ * 从登记页返回:按流程接口重拉进度卡(不再用本地态改写 status)
|
|
|
2695
|
+ */
|
|
|
2696
|
+ async refreshWorkflowProcessPanels() {
|
|
|
2697
|
+ if (store.isEnterpriseRegistered()) clearEnterpriseCertSkipped()
|
|
|
2698
|
+ const ids = []
|
|
|
2699
|
+ const seen = {}
|
|
2669
|
2700
|
for (let i = 0; i < this.messages.length; i++) {
|
|
2670
|
2701
|
const msg = this.messages[i]
|
|
2671
|
|
- if (!msg || msg.type !== 'workflow' || !msg.workflow || !msg.workflow.steps) continue
|
|
2672
|
|
- const steps = msg.workflow.steps
|
|
2673
|
|
- for (let s = 0; s < steps.length; s++) {
|
|
2674
|
|
- const step = steps[s]
|
|
2675
|
|
- if (!step || !step.hasProcessPanel || !step.processPanel) continue
|
|
2676
|
|
- if (step.processPanel.cardType !== 'enterprise_cert') continue
|
|
2677
|
|
- let nextStatus = step.status || 'pending'
|
|
2678
|
|
- // 仅 pending → done;active/done 保持卡片已有状态(来自 workflow-progress)
|
|
2679
|
|
- if (registered && nextStatus === 'pending') {
|
|
2680
|
|
- nextStatus = 'done'
|
|
2681
|
|
- this.$set(step, 'status', 'done')
|
|
2682
|
|
- this.$set(step, 'statusLabel', '已完成')
|
|
2683
|
|
- this.$set(step, 'nodeIcon', '✓')
|
|
2684
|
|
- this.$set(step, 'nodeClass', 'fe-stepper__node fe-stepper__node--done')
|
|
2685
|
|
- this.$set(step, 'labelClass', 'fe-stepper__label fe-stepper__label--done')
|
|
2686
|
|
- this.$set(step, 'rootClass', 'fe-workflow-step fe-workflow-step--process fe-workflow-step--done')
|
|
2687
|
|
- }
|
|
2688
|
|
- syncStepProcessPanel(step, nextStatus, {
|
|
2689
|
|
- skipped: !registered && step.processPanel.processStatus === 'skipped'
|
|
2690
|
|
- })
|
|
2691
|
|
- this.$set(steps, s, step)
|
|
2692
|
|
- }
|
|
2693
|
|
- this.$set(this.messages, i, msg)
|
|
|
2702
|
+ if (!msg || msg.type !== 'workflow' || !msg.workflow) continue
|
|
|
2703
|
+ const id = msg.draftId != null ? msg.draftId : msg.workflow.draftId
|
|
|
2704
|
+ if (id == null || id === '' || seen[String(id)]) continue
|
|
|
2705
|
+ seen[String(id)] = true
|
|
|
2706
|
+ ids.push(id)
|
|
|
2707
|
+ }
|
|
|
2708
|
+ for (let i = 0; i < ids.length; i++) {
|
|
|
2709
|
+ await this.refreshWorkflowCardByDraftId(ids[i])
|
|
2694
|
2710
|
}
|
|
2695
|
2711
|
},
|
|
2696
|
|
- goWorkflowCertByIndex(msgIdx, stepIdx) {
|
|
2697
|
|
- const msg = this.messages[msgIdx]
|
|
2698
|
|
- if (!msg || msg.type !== 'workflow') return
|
|
2699
|
|
- const step = msg.workflow && msg.workflow.steps && msg.workflow.steps[stepIdx]
|
|
2700
|
|
- if (!step || !step.processPanel || step.processPanel.cardType !== 'enterprise_cert') return
|
|
|
2712
|
+ async goWorkflowCertByIndex(msgIdx, stepIdx) {
|
|
|
2713
|
+ const resolved = await this.resolveWorkflowStepFromApi(msgIdx, stepIdx, 'enterprise_cert')
|
|
|
2714
|
+ if (!resolved) return
|
|
|
2715
|
+ const { msg, step } = resolved
|
|
|
2716
|
+ if (!step.processPanel || step.processPanel.cardType !== 'enterprise_cert') return
|
|
|
2717
|
+ if (this.isWorkflowActionBlocked(step)) {
|
|
|
2718
|
+ showToast((step.processPanel && step.processPanel.lockHint) || '当前步骤尚未开始')
|
|
|
2719
|
+ return
|
|
|
2720
|
+ }
|
|
2701
|
2721
|
const draftId = msg.draftId != null
|
|
2702
|
2722
|
? msg.draftId
|
|
2703
|
2723
|
: (msg.workflow && msg.workflow.draftId)
|
|
2704
|
|
- // 以流程步骤为准:active=未完成本单认证需提交;done=仅查看
|
|
2705
|
2724
|
const isDone = step.status === 'done'
|
|
2706
|
2725
|
|| (step.processPanel && step.processPanel.processStatus === 'done')
|
|
2707
|
2726
|
const readonly = !!isDone
|
|
|
@@ -2722,29 +2741,25 @@ export default {
|
|
2722
|
2741
|
// 忽略:仍按本地已登记状态刷新进度卡
|
|
2723
|
2742
|
}
|
|
2724
|
2743
|
if (store.isEnterpriseRegistered()) clearEnterpriseCertSkipped()
|
|
2725
|
|
- // 重建进度卡步骤条(门禁/连线/面板一并更新)
|
|
2726
|
2744
|
if (draftId != null && draftId !== '') {
|
|
2727
|
2745
|
await this.refreshWorkflowCardByDraftId(draftId)
|
|
2728
|
2746
|
} else {
|
|
2729
|
|
- this.refreshWorkflowProcessPanels()
|
|
|
2747
|
+ await this.refreshWorkflowProcessPanels()
|
|
2730
|
2748
|
}
|
|
2731
|
2749
|
this.ensureChatBottom()
|
|
2732
|
2750
|
},
|
|
|
2751
|
+ /** 门禁:登记/招聘不看 pending;其余 done 可查看、active 可操作、pending 禁用 */
|
|
2733
|
2752
|
isWorkflowActionBlocked(step) {
|
|
2734
|
2753
|
if (!step || !step.processPanel) return true
|
|
2735
|
2754
|
const panel = step.processPanel
|
|
2736
|
|
- // 已完成:仍可进弹层查看
|
|
2737
|
|
- if (step.status === 'done' || panel.processStatus === 'done' || panel.viewOnly) return false
|
|
2738
|
|
- // 登记/招聘:方案确认后可点,不因接口仍 pending 拦截
|
|
2739
|
|
- const isStaffingPanel = panel.cardType === 'registration_qr'
|
|
2740
|
|
- || panel.cardType === 'worker_recruitment'
|
|
2741
|
|
- if (isStaffingPanel) {
|
|
2742
|
|
- return panel.actionDisabled === true || panel.actionLocked === true
|
|
|
2755
|
+ // 人员登记 / 临时工招聘:始终可进
|
|
|
2756
|
+ if (panel.cardType === 'registration_qr' || panel.cardType === 'worker_recruitment') {
|
|
|
2757
|
+ return false
|
|
2743
|
2758
|
}
|
|
2744
|
|
- if (panel.actionDisabled === true || panel.actionLocked === true) return true
|
|
2745
|
|
- if (panel.processStatus === 'pending' || step.status === 'pending') return true
|
|
2746
|
|
- if (panel.processStatus !== 'current' && step.status !== 'active') return true
|
|
2747
|
|
- return false
|
|
|
2759
|
+ if (step.status === 'done' || panel.processStatus === 'done' || panel.viewOnly) return false
|
|
|
2760
|
+ if (step.status === 'active' || panel.processStatus === 'current') return false
|
|
|
2761
|
+ if (panel.processStatus === 'skipped') return false
|
|
|
2762
|
+ return true
|
|
2748
|
2763
|
},
|
|
2749
|
2764
|
isWorkflowStepViewOnly(step) {
|
|
2750
|
2765
|
if (!step || !step.processPanel) return false
|
|
|
@@ -2752,15 +2767,17 @@ export default {
|
|
2752
|
2767
|
|| step.processPanel.processStatus === 'done'
|
|
2753
|
2768
|
|| step.processPanel.viewOnly === true
|
|
2754
|
2769
|
},
|
|
2755
|
|
- goWorkflowRecruitByIndex(msgIdx, stepIdx) {
|
|
2756
|
|
- const msg = this.messages[msgIdx]
|
|
2757
|
|
- if (!msg || msg.type !== 'workflow' || !msg.workflow) return
|
|
2758
|
|
- const step = msg.workflow.steps && msg.workflow.steps[stepIdx]
|
|
2759
|
|
- if (!step || !step.processPanel || step.processPanel.cardType !== 'worker_recruitment') return
|
|
2760
|
|
- if (this.isWorkflowActionBlocked(step)) return
|
|
|
2770
|
+ async goWorkflowRecruitByIndex(msgIdx, stepIdx) {
|
|
|
2771
|
+ const resolved = await this.resolveWorkflowStepFromApi(msgIdx, stepIdx, 'worker_recruitment')
|
|
|
2772
|
+ if (!resolved) return
|
|
|
2773
|
+ const { msg, step } = resolved
|
|
|
2774
|
+ if (!step.processPanel || step.processPanel.cardType !== 'worker_recruitment') return
|
|
|
2775
|
+ if (this.isWorkflowActionBlocked(step)) {
|
|
|
2776
|
+ showToast((step.processPanel && step.processPanel.lockHint) || '当前步骤尚未开始')
|
|
|
2777
|
+ return
|
|
|
2778
|
+ }
|
|
2761
|
2779
|
const draftId = msg.draftId != null ? msg.draftId : msg.workflow.draftId
|
|
2762
|
2780
|
const panel = step.processPanel
|
|
2763
|
|
- // 查看招聘:与人员登记进度弹层同一套内容,仅标题改为「临时工招聘」
|
|
2764
|
2781
|
const isViewRecruit = this.isWorkflowStepViewOnly(step)
|
|
2765
|
2782
|
|| panel.viewOnly === true
|
|
2766
|
2783
|
|| panel.primaryLabel === '查看招聘'
|
|
|
@@ -2786,12 +2803,15 @@ export default {
|
|
2786
|
2803
|
}
|
|
2787
|
2804
|
this.ensureChatBottom()
|
|
2788
|
2805
|
},
|
|
2789
|
|
- goWorkflowTaskPublishByIndex(msgIdx, stepIdx) {
|
|
2790
|
|
- const msg = this.messages[msgIdx]
|
|
2791
|
|
- if (!msg || msg.type !== 'workflow' || !msg.workflow) return
|
|
2792
|
|
- const step = msg.workflow.steps && msg.workflow.steps[stepIdx]
|
|
2793
|
|
- if (!step || !step.processPanel || step.processPanel.cardType !== 'task_publish') return
|
|
2794
|
|
- if (this.isWorkflowActionBlocked(step)) return
|
|
|
2806
|
+ async goWorkflowTaskPublishByIndex(msgIdx, stepIdx) {
|
|
|
2807
|
+ const resolved = await this.resolveWorkflowStepFromApi(msgIdx, stepIdx, 'task_publish')
|
|
|
2808
|
+ if (!resolved) return
|
|
|
2809
|
+ const { msg, step } = resolved
|
|
|
2810
|
+ if (!step.processPanel || step.processPanel.cardType !== 'task_publish') return
|
|
|
2811
|
+ if (this.isWorkflowActionBlocked(step)) {
|
|
|
2812
|
+ showToast((step.processPanel && step.processPanel.lockHint) || '当前步骤尚未开始')
|
|
|
2813
|
+ return
|
|
|
2814
|
+ }
|
|
2795
|
2815
|
const draftId = msg.draftId != null ? msg.draftId : msg.workflow.draftId
|
|
2796
|
2816
|
const detail = msg.workflow.detail || {}
|
|
2797
|
2817
|
const orderId = detail.orderId || detail.order_id || null
|
|
|
@@ -2814,12 +2834,15 @@ export default {
|
|
2814
|
2834
|
}
|
|
2815
|
2835
|
this.ensureChatBottom()
|
|
2816
|
2836
|
},
|
|
2817
|
|
- goWorkflowSettlementByIndex(msgIdx, stepIdx) {
|
|
2818
|
|
- const msg = this.messages[msgIdx]
|
|
2819
|
|
- if (!msg || msg.type !== 'workflow' || !msg.workflow) return
|
|
2820
|
|
- const step = msg.workflow.steps && msg.workflow.steps[stepIdx]
|
|
2821
|
|
- if (!step || !step.processPanel || step.processPanel.cardType !== 'settlement') return
|
|
2822
|
|
- if (this.isWorkflowActionBlocked(step)) return
|
|
|
2837
|
+ async goWorkflowSettlementByIndex(msgIdx, stepIdx) {
|
|
|
2838
|
+ const resolved = await this.resolveWorkflowStepFromApi(msgIdx, stepIdx, 'settlement')
|
|
|
2839
|
+ if (!resolved) return
|
|
|
2840
|
+ const { msg, step } = resolved
|
|
|
2841
|
+ if (!step.processPanel || step.processPanel.cardType !== 'settlement') return
|
|
|
2842
|
+ if (this.isWorkflowActionBlocked(step)) {
|
|
|
2843
|
+ showToast((step.processPanel && step.processPanel.lockHint) || '当前步骤尚未开始')
|
|
|
2844
|
+ return
|
|
|
2845
|
+ }
|
|
2823
|
2846
|
const detail = msg.workflow.detail || {}
|
|
2824
|
2847
|
const orderId = detail.orderId || detail.order_id || ''
|
|
2825
|
2848
|
const draftId = msg.draftId != null ? msg.draftId : msg.workflow.draftId
|
|
|
@@ -2830,12 +2853,15 @@ export default {
|
|
2830
|
2853
|
}
|
|
2831
|
2854
|
this.openProgressDetail(draftId)
|
|
2832
|
2855
|
},
|
|
2833
|
|
- goWorkflowInvoiceByIndex(msgIdx, stepIdx) {
|
|
2834
|
|
- const msg = this.messages[msgIdx]
|
|
2835
|
|
- if (!msg || msg.type !== 'workflow' || !msg.workflow) return
|
|
2836
|
|
- const step = msg.workflow.steps && msg.workflow.steps[stepIdx]
|
|
2837
|
|
- if (!step || !step.processPanel || step.processPanel.cardType !== 'invoice_archive') return
|
|
2838
|
|
- if (this.isWorkflowActionBlocked(step)) return
|
|
|
2856
|
+ async goWorkflowInvoiceByIndex(msgIdx, stepIdx) {
|
|
|
2857
|
+ const resolved = await this.resolveWorkflowStepFromApi(msgIdx, stepIdx, 'invoice_archive')
|
|
|
2858
|
+ if (!resolved) return
|
|
|
2859
|
+ const { msg, step } = resolved
|
|
|
2860
|
+ if (!step.processPanel || step.processPanel.cardType !== 'invoice_archive') return
|
|
|
2861
|
+ if (this.isWorkflowActionBlocked(step)) {
|
|
|
2862
|
+ showToast((step.processPanel && step.processPanel.lockHint) || '当前步骤尚未开始')
|
|
|
2863
|
+ return
|
|
|
2864
|
+ }
|
|
2839
|
2865
|
const detail = msg.workflow.detail || {}
|
|
2840
|
2866
|
const draftId = msg.draftId != null ? msg.draftId : msg.workflow.draftId
|
|
2841
|
2867
|
const orderId = detail.orderId || detail.order_id || null
|
|
|
@@ -2994,12 +3020,12 @@ export default {
|
|
2994
|
3020
|
},
|
|
2995
|
3021
|
/** 人员登记:查看/分享(数据来自 workflow-progress) */
|
|
2996
|
3022
|
async openWorkflowQrByIndex(msgIdx, stepIdx) {
|
|
2997
|
|
- const msg = this.messages[msgIdx]
|
|
2998
|
|
- if (!msg || msg.type !== 'workflow' || !msg.workflow) return
|
|
2999
|
|
- const step = msg.workflow.steps && msg.workflow.steps[stepIdx]
|
|
3000
|
|
- if (!step || !step.processPanel || step.processPanel.cardType !== 'registration_qr') return
|
|
3001
|
|
- if (step.processPanel.actionDisabled) {
|
|
3002
|
|
- showToast(step.processPanel.lockHint || '当前步骤尚未开始')
|
|
|
3023
|
+ const resolved = await this.resolveWorkflowStepFromApi(msgIdx, stepIdx, 'registration_qr')
|
|
|
3024
|
+ if (!resolved) return
|
|
|
3025
|
+ const { msg, step } = resolved
|
|
|
3026
|
+ if (!step.processPanel || step.processPanel.cardType !== 'registration_qr') return
|
|
|
3027
|
+ if (this.isWorkflowActionBlocked(step)) {
|
|
|
3028
|
+ showToast((step.processPanel && step.processPanel.lockHint) || '当前步骤尚未开始')
|
|
3003
|
3029
|
return
|
|
3004
|
3030
|
}
|
|
3005
|
3031
|
const draftId = msg.draftId != null ? msg.draftId : msg.workflow.draftId
|
|
|
@@ -3046,13 +3072,13 @@ export default {
|
|
3046
|
3072
|
}
|
|
3047
|
3073
|
},
|
|
3048
|
3074
|
/** 人员登记:查看进度(FeProgressSheet 走 workflow-progress) */
|
|
3049
|
|
- openWorkflowQrProgressByIndex(msgIdx, stepIdx) {
|
|
3050
|
|
- const msg = this.messages[msgIdx]
|
|
3051
|
|
- if (!msg || msg.type !== 'workflow') return
|
|
3052
|
|
- const step = msg.workflow && msg.workflow.steps && msg.workflow.steps[stepIdx]
|
|
3053
|
|
- if (!step || !step.processPanel || step.processPanel.cardType !== 'registration_qr') return
|
|
3054
|
|
- if (step.processPanel.actionDisabled) {
|
|
3055
|
|
- showToast(step.processPanel.lockHint || '当前步骤尚未开始')
|
|
|
3075
|
+ async openWorkflowQrProgressByIndex(msgIdx, stepIdx) {
|
|
|
3076
|
+ const resolved = await this.resolveWorkflowStepFromApi(msgIdx, stepIdx, 'registration_qr')
|
|
|
3077
|
+ if (!resolved) return
|
|
|
3078
|
+ const { msg, step } = resolved
|
|
|
3079
|
+ if (!step.processPanel || step.processPanel.cardType !== 'registration_qr') return
|
|
|
3080
|
+ if (this.isWorkflowActionBlocked(step)) {
|
|
|
3081
|
+ showToast((step.processPanel && step.processPanel.lockHint) || '当前步骤尚未开始')
|
|
3056
|
3082
|
return
|
|
3057
|
3083
|
}
|
|
3058
|
3084
|
this.openProgressDetail(msg.draftId || (msg.workflow && msg.workflow.draftId))
|