From efd849238664cfd1e72cc741432c2b8e2e1aab81 Mon Sep 17 00:00:00 2001 From: lixiaolong <702156524@qq.com> Date: Tue, 20 Oct 2026 16:06:03 +0800 Subject: [PATCH] =?UTF-8?q?refactor(assistant):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=8A=A5=E4=BB=B7=E9=A2=84=E8=A7=88=E7=BB=84=E4=BB=B6=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 为quoteFields中的id字段添加只读属性配置 - 添加newPrice和newAmount计算函数统一处理价格显示逻辑 - 重构模板中的价格和金额显示,使用新的计算函数替代内联表达式 - 更新测试用例以验证恢复处理后的状态显示正确性 --- .../components/BusinessAssistant/AssistantQuotePreview.vue | 6 ++++-- .../tests/runtime/assistant-quotation-review.spec.js | 4 ++++ ruoyi-ui-vue3/tests/ui/assistant-draft-review.html | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ruoyi-ui-vue3/src/components/BusinessAssistant/AssistantQuotePreview.vue b/ruoyi-ui-vue3/src/components/BusinessAssistant/AssistantQuotePreview.vue index 13b79c9..69b906b 100644 --- a/ruoyi-ui-vue3/src/components/BusinessAssistant/AssistantQuotePreview.vue +++ b/ruoyi-ui-vue3/src/components/BusinessAssistant/AssistantQuotePreview.vue @@ -10,9 +10,9 @@ - + - + @@ -30,6 +30,8 @@ const page = ref(1), pageRows = computed(() => props.rows.slice((page.value - 1) const correction = computed(() => props.rows.some(row => Object.hasOwn(row, 'newAmount'))) const canSkip = computed(() => correction.value && props.rows.some(row => row._canSkip)) const reviewState = assistantQuotationReviewState +function newPrice(row) { const state = reviewState(row); return correction.value ? state.skipped ? '本次跳过' : state.pending ? '待重新校验' : row.unitPrice : row.skipped ? '留空不变' : row.unitPrice } +function newAmount(row) { const state = reviewState(row); return state.skipped ? '不修改' : state.pending ? '待重新校验' : row.newAmount } function toggleSkip(row) { if (props.busy) return; const change = assistantQuotationSkipChange(row); if (change) emit('skip', change) } watch(() => props.rows, () => { page.value = 1 }) diff --git a/ruoyi-ui-vue3/tests/runtime/assistant-quotation-review.spec.js b/ruoyi-ui-vue3/tests/runtime/assistant-quotation-review.spec.js index 075fc2a..fee56b4 100644 --- a/ruoyi-ui-vue3/tests/runtime/assistant-quotation-review.spec.js +++ b/ruoyi-ui-vue3/tests/runtime/assistant-quotation-review.spec.js @@ -46,6 +46,10 @@ describe('unmatched PDF quotations have a visible escape without deleting source expect(wrapper.find('button[aria-label="第24项恢复处理"]').element.disabled).toBe(true) await wrapper.find('button[aria-label="第24项恢复处理"]').trigger('click') expect(wrapper.emitted('skip')).toBeUndefined() + await wrapper.setProps({ busy: false, rows: [{ ...missing()._quotePreview[0], _draftRowId: 'pdf-line-24', _canSkip: true, _skipSelected: false, skipped: true }] }) + expect(wrapper.text()).toContain('已恢复处理,请重新校验预览') + expect(wrapper.text()).not.toContain('本次跳过,不修改采购') + expect(wrapper.findAll('.assistant-quote-new').length).toBe(0) } finally { wrapper.unmount() } }) it('purchase import drafts expose removal and restoration without editing or deleting business records', async () => { diff --git a/ruoyi-ui-vue3/tests/ui/assistant-draft-review.html b/ruoyi-ui-vue3/tests/ui/assistant-draft-review.html index 205d368..1da2fa2 100644 --- a/ruoyi-ui-vue3/tests/ui/assistant-draft-review.html +++ b/ruoyi-ui-vue3/tests/ui/assistant-draft-review.html @@ -9,7 +9,7 @@ import {assistantApplyDraftChanges} from '../../src/utils/assistant-draft-edit.j import {assistantExcludeDraftRows,assistantRestoreDraftRow} from '../../src/utils/assistant-draft-exclusions.js' createApp({components:{Draft},setup(){ const mode=ref('quote'),rows=ref([]),excluded=ref([]),draft=ref({}),message=ref(''),action={allowed:true,query:false} - const quoteFields=[{key:'id',ref:'purchase',label:'采购明细'},{key:'finalUnitPrice',type:'decimal',label:'新报价'},{key:'skipCorrection',type:'boolean',label:'本项暂不更正'}] + const quoteFields=[{key:'id',ref:'purchase',label:'采购明细',readonly:true},{key:'finalUnitPrice',type:'decimal',label:'新报价'},{key:'skipCorrection',type:'boolean',label:'本项暂不更正'}] const purchaseFields=[{key:'materialName',label:'物品名称'},{key:'quantity',label:'数量',type:'decimal'}] function reset(value){mode.value=value;excluded.value=[];message.value=''; rows.value=value==='quote'?[{_rowId:'quote-1',id:7,finalUnitPrice:88,_quotePreview:[{line:1,name:'模拟水泵',quantity:2,previousPrice:60,unitPrice:88,newAmount:176,notice:'模拟匹配成功'}]},