From d33db115442f28bc8f44f46b3e2172ce7b5f2a6c Mon Sep 17 00:00:00 2001 From: weizong song Date: Mon, 26 Jan 2026 09:49:06 +0800 Subject: [PATCH 1/7] up --- src/components/ContractSignField.vue | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/ContractSignField.vue b/src/components/ContractSignField.vue index bb70f9d..8c9e5e4 100644 --- a/src/components/ContractSignField.vue +++ b/src/components/ContractSignField.vue @@ -503,8 +503,8 @@ export default { // 初始化校验规则 initRules() { // 新建时:只校验到付款方式(包含付款方式) - const baseRules = { - contract_no_without_prefix: [{ required: true, message: "请填写合同编号", trigger: "blur" }], + // 注意:新建时不校验合同编号(不显示红色星号);编辑时仍保持必填校验 + const baseRulesCommon = { title: [{ required: true, message: "请填写合同名称", trigger: "blur" }], main_content: [{ required: true, message: "请填写合同主要内容", trigger: "blur" }], party_a: [{ required: true, message: "请填写甲方", trigger: "blur" }], @@ -547,10 +547,18 @@ export default { // 新建时只校验到付款方式(包含付款方式) if (!this.isEditMode()) { - this.rules = baseRules; + this.rules = { + ...baseRulesCommon, + }; return; } + // 编辑时:合同编号必填 + const baseRules = { + contract_no_without_prefix: [{ required: true, message: "请填写合同编号", trigger: "blur" }], + ...baseRulesCommon, + }; + // 编辑时全量校验(与合同编辑页面对齐) this.rules = { ...baseRules, From 4c4bcaf37e34c8b4b30bc40e5d897fcb69f3d363 Mon Sep 17 00:00:00 2001 From: weizong song Date: Mon, 16 Mar 2026 08:29:09 +0800 Subject: [PATCH 2/7] up --- src/components/BudgetSourcePickerField.vue | 49 ++++- .../components/AddMeetingMinutes.vue | 18 +- src/views/flow/components/RelatedFlows.vue | 185 ++++++++++++++---- src/views/flow/create.vue | 138 +++++++++---- src/views/flow/list.vue | 18 -- 5 files changed, 299 insertions(+), 109 deletions(-) diff --git a/src/components/BudgetSourcePickerField.vue b/src/components/BudgetSourcePickerField.vue index 6f52f7a..0c8440d 100644 --- a/src/components/BudgetSourcePickerField.vue +++ b/src/components/BudgetSourcePickerField.vue @@ -260,8 +260,49 @@ +
+
工会
+ + + {{ node.label }} + + + 预算: + {{ formatAmount(data.budget_amount) }} + + + 已用: + {{ formatAmount(data.used_amount || 0) }} + + + 执行率: + + {{ formatExecutionRate(data.execution_rate || 0) }} + + + + + +
+
暂无数据 @@ -506,6 +547,9 @@ export default { offsetPrepaidTree() { return (this.treeData || []).filter((n) => n?.budget_type === "offset_prepaid"); }, + tradeUnionTree() { + return (this.treeData || []).filter((n) => n?.budget_type === "trade_union"); + }, budgetTypeMap() { return { department: "部门预算", @@ -513,6 +557,7 @@ export default { special_fund: "专项资金", last_year_carryover: "上一年结转资金", offset_prepaid: "抵消预付账款", + trade_union: "工会", }; }, // 分配总额 @@ -670,6 +715,7 @@ export default { this.$refs.specialFundTreeRef, this.$refs.lastYearCarryoverTreeRef, this.$refs.offsetPrepaidTreeRef, + this.$refs.tradeUnionTreeRef, ].filter(Boolean); const nodes = []; refs.forEach((tree) => { @@ -693,6 +739,7 @@ export default { this.$refs.specialFundTreeRef, this.$refs.lastYearCarryoverTreeRef, this.$refs.offsetPrepaidTreeRef, + this.$refs.tradeUnionTreeRef, ].filter(Boolean); refs.forEach((tree) => { if (typeof tree.setCheckedKeys === "function") { diff --git a/src/views/MeetingMinutes/components/AddMeetingMinutes.vue b/src/views/MeetingMinutes/components/AddMeetingMinutes.vue index d139101..bae94a7 100644 --- a/src/views/MeetingMinutes/components/AddMeetingMinutes.vue +++ b/src/views/MeetingMinutes/components/AddMeetingMinutes.vue @@ -99,15 +99,18 @@ - {{ flow.title || flow.no || ('流程' + flow.id) }} + + {{ flow.title || flow.no || ('流程' + flow.id) }} + 【已关联 {{ flow.meeting_minutes_count }} 次】 + {{ flow.no || '' }}
- 提示:可以关联多个上会审议审批流程 + 提示:可以关联多个上会审议审批流程,同一条流程可被多个会议纪要关联
@@ -140,7 +143,7 @@ placeholder="请选择类型" style="width: 100%;" > - + @@ -315,12 +318,7 @@ export default { return // 已经加载过了 } try { - const params = {} - // 如果是编辑模式,传递当前会议纪要ID,允许显示已关联的流程 - if (this.type === 'edit' && this.form.id) { - params.meeting_minute_id = this.form.id - } - const res = await getFlows(params) + const res = await getFlows({}) this.availableFlows = res || [] } catch (err) { console.error('加载流程列表失败:', err) diff --git a/src/views/flow/components/RelatedFlows.vue b/src/views/flow/components/RelatedFlows.vue index 4fafa56..36425c1 100644 --- a/src/views/flow/components/RelatedFlows.vue +++ b/src/views/flow/components/RelatedFlows.vue @@ -63,19 +63,26 @@
已关联的流程({{ selectedFlows.length }})
- - {{ flow.title }} - ({{ flow.no }}) - +
+ + {{ flow.title }} + ({{ flow.no }}) + +
+ 会议纪要: + + {{ mm.title }} + + +
+
@@ -104,6 +111,13 @@ 发起人:{{ flow.creator_name }} {{ formatDate(flow.created_at) }}
+
+ 会议纪要: + + {{ mm.title }} + + +
关联的流程({{ relatedFlows.length }})
- +
- - {{ (getPaymentTemplateElementValue(el, payment) && getPaymentTemplateElementValue(el, payment).title) ? getPaymentTemplateElementValue(el, payment).title : '查看会议纪要' }} - + -
@@ -305,16 +310,20 @@ - - + @@ -782,28 +791,54 @@ /> - +
- - {{ meetingMinutesDetail.title || '-' }} + + {{ meetingMinutesDetail.title || '-' }} - -
-
- {{ it.type || '类型' }}: - {{ it.content || '-' }} + +
+ + {{ flow.title || flow.no || ('流程' + flow.id) }} + ({{ flow.no }}) + +
+ 未关联 +
+ +
+
+ + {{ f.original_name || f.name || '附件' }} + + + 下载 +
- + 无附件
- -
- - {{ f.original_name || f.name || '附件' }} - + +
+
+
+ {{ it.type || '未分类' }} +
+
{{ it.content || '-' }}
+
+ 无内容清单
@@ -962,12 +997,9 @@ export default { return this.getOaCustomModelBindings(expenditureId, field).length > 0; } - // meeting_minutes 类型:仅当有会议纪要ID时才显示 + // meeting_minutes 类型:有至少一条会议纪要时显示(一对多) if (field.element_type === 'meeting_minutes') { - const meetingMinuteId = this.extractMeetingMinuteId( - this.getIndirectFieldValue(expenditureId, this.getTplFieldKey(field)) - ); - return meetingMinuteId !== null && meetingMinuteId !== undefined; + return this.getIndirectMeetingMinutesList(expenditureId, this.getTplFieldKey(field)).length > 0; } // attachment/file 类型:仅当有文件项时才显示 @@ -1049,6 +1081,9 @@ export default { if (el.type === 'form_element' && el.field_type === 'attachment') { return Array.isArray(val) && val.length > 0; } + if (el.type === 'meeting_minutes') { + return this.normalizeMeetingMinutesValue(val).length > 0; + } return !this.isEmptyValue(val); }); }, @@ -1894,6 +1929,33 @@ export default { return null; }, + /** 将会议纪要值归一化为 [{ id, title }, ...],兼容单条与多条 */ + normalizeMeetingMinutesValue(val) { + if (val === null || val === undefined) return []; + if (Array.isArray(val)) { + return val + .map((item) => { + const id = this.extractMeetingMinuteId(item); + if (!id) return null; + const title = (item && typeof item === 'object' && item.title) ? item.title : ''; + return { id, title }; + }) + .filter(Boolean); + } + const id = this.extractMeetingMinuteId(val); + if (!id) return []; + const title = (val && typeof val === 'object' && val.title) ? val.title : ''; + return [{ id, title }]; + }, + + getPaymentMeetingMinutesList(el, payment) { + return this.normalizeMeetingMinutesValue(this.getPaymentTemplateElementValue(el, payment)); + }, + + getIndirectMeetingMinutesList(expenditureId, fieldKey) { + return this.normalizeMeetingMinutesValue(this.getIndirectFieldValue(expenditureId, fieldKey)); + }, + async openFlowDrawer({ flowId, customModelId, title }) { const fid = Number(flowId); if (!fid || Number.isNaN(fid)) return; @@ -1934,7 +1996,7 @@ export default { this.loadingMeetingMinutes = true; try { // meetingMinutesShow 成功时返回 res.data - const detail = await meetingMinutesShow({ id: meetingMinuteId }); + const detail = await meetingMinutesShow({ id: meetingMinuteId, show_relation: ['flows', 'items'] }); this.meetingMinutesDetail = detail || null; this.rightDrawerTitle = detail?.title || '查看会议纪要'; } catch (e) { diff --git a/src/views/flow/list.vue b/src/views/flow/list.vue index 9669e74..bea00e3 100644 --- a/src/views/flow/list.vue +++ b/src/views/flow/list.vue @@ -573,18 +573,6 @@ @click="destroy(row)" >删除 - 支付 @@ -963,6 +1054,8 @@ export default { rightDrawerUrl: '', meetingMinutesDetail: null, loadingMeetingMinutes: false, + contractDrawerDetail: null, + loadingContractDrawer: false, // fill_flow_title 自动填充:专用 watcher(避免 deep watcher oldVal/newVal 引用问题) _unwatchFillFlowTitle: null, }; @@ -1992,6 +2085,7 @@ export default { this.rightDrawerTitle = '查看会议纪要'; this.rightDrawerUrl = ''; this.meetingMinutesDetail = null; + this.contractDrawerDetail = null; this.rightDrawerVisible = true; this.loadingMeetingMinutes = true; try { @@ -2007,6 +2101,29 @@ export default { } }, + async openContractDrawer(contractId, title = '') { + const cid = Number(contractId); + if (!cid || Number.isNaN(cid)) return; + + this.rightDrawerType = 'contract'; + this.rightDrawerTitle = title || '查看合同详情'; + this.rightDrawerUrl = ''; + this.meetingMinutesDetail = null; + this.contractDrawerDetail = null; + this.rightDrawerVisible = true; + this.loadingContractDrawer = true; + try { + const detail = await getBudgetContractDetail(cid); + this.contractDrawerDetail = detail || null; + this.rightDrawerTitle = detail?.title || detail?.contract_no || title || '查看合同详情'; + } catch (e) { + console.error('加载合同详情失败:', e); + this.contractDrawerDetail = null; + } finally { + this.loadingContractDrawer = false; + } + }, + // 通用只读展示 formatReadonlyValue(val) { if (val === undefined || val === null || val === '') return '-'; From dad1afd3d36bd2360122ddbda998876149a1e633 Mon Sep 17 00:00:00 2001 From: weizong song Date: Tue, 7 Apr 2026 13:51:25 +0800 Subject: [PATCH 5/7] up --- src/views/flow/create.vue | 294 ++++++++++++++++++++++++++++++-------- 1 file changed, 234 insertions(+), 60 deletions(-) diff --git a/src/views/flow/create.vue b/src/views/flow/create.vue index b0b5725..0bd8e0b 100644 --- a/src/views/flow/create.vue +++ b/src/views/flow/create.vue @@ -796,8 +796,9 @@ :visible.sync="rightDrawerVisible" :title="rightDrawerTitle" direction="rtl" - size="60%" + :size="$store.getters.device === 'mobile' ? '100%' : (rightDrawerType === 'contract' ? '78%' : '60%')" :with-header="true" + custom-class="flow-detail-drawer" >
@@ -865,72 +866,135 @@
- - - {{ contractDrawerDetail.contract_no || '-' }} - - - {{ contractDrawerDetail.title || '-' }} - - - {{ contractDrawerDetail.party_a || '-' }} - - - {{ contractDrawerDetail.party_b || '-' }} - - - ¥{{ formatAmount(contractDrawerDetail.amount_total) }} - - - {{ contractDrawerDetail.amount_type === 'open' ? '开口' : (contractDrawerDetail.amount_type === 'fixed' ? '闭口' : '-') }} - - - {{ contractDrawerDetail.main_content || '-' }} - - - {{ contractDrawerDetail.sign_date || '-' }} - - - {{ contractDrawerDetail.apply_date || '-' }} - - - {{ contractDrawerDetail.perform_period || '-' }} - - - {{ contractDrawerDetail.pay_method || '-' }} - - - {{ contractDrawerDetail.fund_source || '-' }} - - - {{ contractDrawerDetail.purchase_method || '-' }} - - - - - - - +
+ + + {{ contractDrawerDetail.contract_no || '-' }} + + + {{ contractDrawerDetail.title || '-' }} + + + {{ contractDrawerDetail.main_content || '-' }} + + + {{ contractDrawerDetail.party_a || '-' }} + + + {{ contractDrawerDetail.party_b || '-' }} + + + {{ formatAmount(contractDrawerDetail.amount_total) }} + + + {{ formatAmount(contractDrawerDetail.budget_amount) }} + + + 闭口合同 + 开口合同 + - + + + {{ contractDrawerDetail.amount_description || '-' }} + + + {{ formatDate(contractDrawerDetail.sign_date) || '-' }} + + + {{ formatDate(contractDrawerDetail.apply_date) || '-' }} + + + {{ contractDrawerDetail.perform_period || '-' }} + + + {{ contractDrawerDetail.pay_method || '-' }} + + + {{ getContractBudgetYear(contractDrawerDetail) }} + + + {{ getContractPlanFundSource(contractDrawerDetail) }} + + + {{ formatArrayText(contractDrawerDetail.actual_fund_sources) }} + + + {{ (contractDrawerDetail.contractType && contractDrawerDetail.contractType.name) || '-' }} + + + {{ (contractDrawerDetail.purchaseCategory && contractDrawerDetail.purchaseCategory.name) || '-' }} + + + {{ getContractPurchaseMethod(contractDrawerDetail) }} + + + + + + + {{ contractDrawerDetail.tender_agent || '-' }} + + + {{ contractDrawerDetail.perform_status || '-' }} + + + + + + + {{ formatDepartmentNames(contractDrawerDetail.owner_department_ids || contractDrawerDetail.owner_department_id) }} + + + {{ formatUserNames(contractDrawerDetail.handler_admin_ids) }} + + + {{ formatUserNames(contractDrawerDetail.apply_handler_id) }} + + + {{ formatUserNames(contractDrawerDetail.purchase_handler_id) }} + + + + {{ (contractDrawerDetail.payment_stats && contractDrawerDetail.payment_stats.payment_count) || 0 }} 次 + {{ formatAmount((contractDrawerDetail.payment_stats && contractDrawerDetail.payment_stats.paid_amount) || 0) }} + + + + {{ contractDrawerDetail.remark || '-' }} + + + + - + + -
-
付款计划
- + 付款计划 + - + + + + +
+ 暂无付款计划 +
未获取到合同详情
@@ -1615,6 +1679,80 @@ export default { if (!date) return ''; return this.$moment(date).format('YYYY-MM-DD'); }, + formatArrayText(val) { + if (!val) return '-'; + if (Array.isArray(val)) { + const arr = val.map(item => (item === null || item === undefined ? '' : String(item).trim())).filter(Boolean); + return arr.length ? arr.join(' | ') : '-'; + } + if (typeof val === 'string') { + const s = val.trim(); + return s || '-'; + } + return String(val); + }, + parseIdList(val) { + if (val === null || val === undefined || val === '') return []; + if (Array.isArray(val)) { + return val + .map(item => { + if (item && typeof item === 'object') return item.id || item.value || item.user_id || item.department_id || null; + return item; + }) + .filter(item => item !== null && item !== undefined && item !== ''); + } + if (typeof val === 'number') return [val]; + if (typeof val === 'string') { + return val + .split(',') + .map(item => item.trim()) + .filter(Boolean); + } + if (typeof val === 'object') { + const id = val.id || val.value || val.user_id || val.department_id; + return id ? [id] : []; + } + return []; + }, + formatDepartmentNames(val) { + const ids = this.parseIdList(val); + if (!ids.length) return '-'; + return ids + .map(id => this.simpleDepartmentMap?.[id] || this.simpleDepartmentMap?.[Number(id)] || `部门ID: ${id}`) + .join('、'); + }, + formatUserNames(val) { + const ids = this.parseIdList(val); + if (!ids.length) return '-'; + return ids + .map(id => this.simpleUserMap?.[id] || this.simpleUserMap?.[Number(id)] || `用户ID: ${id}`) + .join('、'); + }, + getContractBudgetYear(detail) { + const year = detail?.fund_source_year?.year || detail?.fundSourceYear?.year || detail?.fund_source_budget_data?.budget_year?.year || detail?.fundSourceBudgetData?.budget_year?.year; + return year ? `${year}年` : '-'; + }, + getContractPlanFundSource(detail) { + return detail?.fund_source_budget_data?.name || detail?.fundSourceBudgetData?.name || detail?.fund_source || '-'; + }, + getContractPurchaseMethod(detail) { + const relationValue = detail && detail.purchaseMethod; + if (relationValue && typeof relationValue === 'object') { + return relationValue.name || relationValue.label || relationValue.title || '-'; + } + + const rawValue = detail && detail.purchase_method; + if (!rawValue) return '-'; + if (typeof rawValue === 'string') return rawValue; + if (typeof rawValue === 'object') { + return rawValue.name || rawValue.label || rawValue.title || rawValue.text || '-'; + } + return String(rawValue); + }, + getContractAttachmentUrl(detail) { + const att = detail?.attachment; + return att?.url || att?.path || att?.file_url || att?.download_url || att?.preview_url || ''; + }, // 格式化日期时间 formatDateTime(dateTime) { if (!dateTime) return ''; @@ -2113,7 +2251,11 @@ export default { this.rightDrawerVisible = true; this.loadingContractDrawer = true; try { - const detail = await getBudgetContractDetail(cid); + const [detail] = await Promise.all([ + getBudgetContractDetail(cid), + this.loadSimpleDepartmentMap(), + this.loadSimpleUserMap(), + ]); this.contractDrawerDetail = detail || null; this.rightDrawerTitle = detail?.title || detail?.contract_no || title || '查看合同详情'; } catch (e) { @@ -2929,6 +3071,38 @@ export default { word-break: break-word; } } + +.contract-drawer { + padding: 20px 24px 28px; +} +.contract-drawer-descriptions { + ::v-deep .el-descriptions__table { + width: 100%; + table-layout: fixed; + } + ::v-deep .el-descriptions-item__label { + width: 160px; + white-space: nowrap; + } + ::v-deep .el-descriptions-item__content { + word-break: break-word; + line-height: 1.7; + } +} +.contract-empty-tip { + padding: 18px 4px 8px; + color: #909399; +} + +::v-deep .flow-detail-drawer > .el-drawer__header { + margin-bottom: 0; + padding: 20px 24px 16px; + border-bottom: 1px solid #ebeef5; +} + +::v-deep .flow-detail-drawer > .el-drawer__body { + overflow-y: auto; +} - diff --git a/src/views/flow/create.vue b/src/views/flow/create.vue index 0bd8e0b..ca09dae 100644 --- a/src/views/flow/create.vue +++ b/src/views/flow/create.vue @@ -19,6 +19,7 @@ @@ -2445,6 +2449,10 @@ export default { const relatedIds = res.flow.related_flows.map(f => f.id).join(','); this.form.related_flow_ids = relatedIds; } + if (res?.flow?.related_meeting_minutes && res.flow.related_meeting_minutes.length > 0) { + const relatedMeetingMinuteIds = res.flow.related_meeting_minutes.map(item => item.id).join(','); + this.form.related_meeting_minute_ids = relatedMeetingMinuteIds; + } // form赋值 const { data } = res?.flow; for (let key in data) { @@ -2567,6 +2575,10 @@ export default { const relatedIds = res.flow.related_flows.map(f => f.id).join(','); this.form.related_flow_ids = relatedIds; } + if (res?.flow?.related_meeting_minutes && res.flow.related_meeting_minutes.length > 0) { + const relatedMeetingMinuteIds = res.flow.related_meeting_minutes.map(item => item.id).join(','); + this.form.related_meeting_minute_ids = relatedMeetingMinuteIds; + } this.handleDefaultJSON(); const { data } = res?.flow; for (let key in data) { @@ -2674,7 +2686,7 @@ export default { let myField = this.fields.find(i => i.name === key) // 保留关联流程ID字段,即使它不在writeableFields中 - if (key === 'related_flow_ids') { + if (key === 'related_flow_ids' || key === 'related_meeting_minute_ids') { continue; } @@ -2703,8 +2715,10 @@ export default { // 确保 related_flow_ids 被包含在提交数据中 // 无论是否有值,都要传递这个字段,以便后端能正确处理 copyForm.related_flow_ids = this.form.related_flow_ids || '' + copyForm.related_meeting_minute_ids = this.form.related_meeting_minute_ids || '' console.log("copyForm",copyForm,this.$refs["desktopForm"].form) console.log("related_flow_ids:", copyForm.related_flow_ids, "form.related_flow_ids:", this.form.related_flow_ids) + console.log("related_meeting_minute_ids:", copyForm.related_meeting_minute_ids, "form.related_meeting_minute_ids:", this.form.related_meeting_minute_ids) // return if (this.$route.query.flow_id) { copyForm.id = this.$route.query.flow_id; From 00b4687091e2b19fc86462a74302fab5e32bfdf6 Mon Sep 17 00:00:00 2001 From: weizong song Date: Mon, 11 May 2026 14:37:28 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E6=B5=81=E7=A8=8B=E9=97=B4=E6=8E=A5?= =?UTF-8?q?=E5=85=B3=E8=81=94=E6=94=AF=E4=BB=98=E6=9C=AA=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D,=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E5=87=BA=E7=8E=B0=E4=B8=8A=E4=BC=A0=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=8E=A7=E4=BB=B6=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/print.js | 10 +++++++++- src/views/dashboard/index.vue | 18 +++++++++++++++--- src/views/flow/create.vue | 29 +++++++++++++++++------------ 3 files changed, 41 insertions(+), 16 deletions(-) diff --git a/src/utils/print.js b/src/utils/print.js index 871440a..eddffd9 100644 --- a/src/utils/print.js +++ b/src/utils/print.js @@ -1,5 +1,13 @@ import store from '@/store' import moment from 'moment' + +function sanitizePrintFieldHtml(html) { + const wrapper = document.createElement('div') + wrapper.innerHTML = html || '' + wrapper.querySelectorAll('input[type="file"], .el-upload__input').forEach(el => el.remove()) + return wrapper.innerHTML +} + /** * @param{string} printJs 打印模版 * @param{boolean} isLog 是否带审批 @@ -78,7 +86,7 @@ export async function print(printJs, isLog, form, logContent) { printStr = printStr.replace(fieldMath,subFormBody) // console.log(fieldMath, printStr) } else { - printStr = printStr.replace(fieldMath,`${value}`) + printStr = printStr.replace(fieldMath,`${sanitizePrintFieldHtml(value)}`) } } } else { diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue index 452223a..375d463 100644 --- a/src/views/dashboard/index.vue +++ b/src/views/dashboard/index.vue @@ -507,7 +507,8 @@ export default { try { await this.getFlows(); const res = await getInfo() - this.usualFlows = res.quick_enter?res.quick_enter:[] + const quickEnterIds = this.normalizeQuickEnter(res.quick_enter) + this.usualFlows = this.flows.filter(flow => quickEnterIds.includes(Number(flow.id))) // const res = await configIndex({ // filter: [ // { @@ -533,16 +534,27 @@ export default { console.error(err); } }, + normalizeQuickEnter(quickEnter) { + if (!quickEnter) return [] + if (!Array.isArray(quickEnter)) return [] + return quickEnter.map(item => { + if (item && typeof item === 'object') { + return Number(item.id) + } + return Number(item) + }).filter(id => Number.isInteger(id) && id > 0) + }, openQucik(){ + const quickEnterIds = this.normalizeQuickEnter(this.usualFlows) this.flows.map(flow => { - const isChecked = this.usualFlows.some(usualFlow => usualFlow.id === flow.id); + const isChecked = quickEnterIds.includes(Number(flow.id)); flow.checked = isChecked }); this.isShowQuick = true }, updatequick(){ this.quickLoading = true - let arr = this.flows.filter((i)=> i.checked===true) + let arr = this.flows.filter((i)=> i.checked===true).map(i => Number(i.id)) saveMyself({ quick_enter:arr }).then(res=>{ diff --git a/src/views/flow/create.vue b/src/views/flow/create.vue index ca09dae..960540a 100644 --- a/src/views/flow/create.vue +++ b/src/views/flow/create.vue @@ -2281,25 +2281,30 @@ export default { // 加载关联的支付信息 async loadRelatedPayments() { if (!this.$route.query.flow_id) { - return; + return } - + this.loadingPayments = true; try { - // request.js 成功时会直接返回 res.data(也就是 payment 对象或 null) - const payment = await getPaymentsByFlowId(this.$route.query.flow_id, { all: true }); - // 接口约定:要么无数据(null),要么唯一的一条记录 - if (payment) { + // request.js 成功时会直接返回 res.data;兼容旧接口单对象和新接口数组。 + const result = await getPaymentsByFlowId(this.$route.query.flow_id, { all: true }) + const payments = Array.isArray(result) ? result : (result ? [result] : []) + if (payments.length > 0) { // 兼容 breadcrumb 为字符串或数组 - if (payment.payment_type_info && payment.payment_type_info.breadcrumb) { - const bc = payment.payment_type_info.breadcrumb; + payments.forEach((payment) => { + if (!payment.payment_type_info || !payment.payment_type_info.breadcrumb) { + return + } + const bc = payment.payment_type_info.breadcrumb if (Array.isArray(bc)) { - payment.payment_type_info.breadcrumb = bc; + payment.payment_type_info.breadcrumb = bc } else if (typeof bc === 'string') { - payment.payment_type_info.breadcrumb = bc.split(/\s*>\s*|\s*\/\s*/).filter(Boolean); + payment.payment_type_info.breadcrumb = bc.split(/\s*>\s*|\s*\/\s*/).filter(Boolean) } - } - this.relatedPayments = [payment]; + }) + this.relatedPayments = payments + + const payment = payments[0] // 支付模板元素(用于展示 fields) await this.loadPaymentTemplateElements(payment);