恢复账单明细入口并完善采购状态展示

This commit is contained in:
2026-10-30 18:50:56 +08:00
parent 119b4d6d66
commit 63193d04de
6 changed files with 52 additions and 12 deletions
@@ -6,6 +6,7 @@ import { runInNewContext } from 'node:vm'
import ts from 'typescript'
import * as vue from 'vue'
import { parse, compileScript } from 'vue/compiler-sfc'
import { renderToString } from 'vue/server-renderer'
const { default: Schema } = createRequire(import.meta.resolve('element-plus'))('async-validator')
@@ -63,6 +64,27 @@ test('new requests get unique keys without restoring stored submissions', () =>
class ApiError extends Error { constructor(message, code, status) { super(message); this.code = code; this.status = status } }
const flush = async () => { await vue.nextTick(); await new Promise(resolve => setImmediate(resolve)); await vue.nextTick() }
test('shows only the active procurement rejection, hiding it after reupload, resubmission and confirmation', async () => {
const source = readFileSync(new URL('./views/ProcurementView.vue', import.meta.url), 'utf8')
const template = source.match(/<el-alert\b[^>]*title="采购结果驳回原因"[^>]*\/>/)?.[0]
assert.ok(template)
for (const [status, photosNeedUpdate, rejectionReason, visible] of [
['RECEIVING', true, '照片不清晰', true],
['RECEIVING', false, '照片不清晰', true],
['RECEIVING', false, null, false],
['WAIT_CUSTOMER_CONFIRM', true, '照片不清晰', false],
['CONFIRMED', true, '照片不清晰', false],
['RECEIVING', true, null, false],
]) {
const app = vue.createSSRApp({ render: vue.compile(template), setup: () => ({ workflow: { status, photosNeedUpdate, rejectionReason } }) })
app.component('ElAlert', { props: ['title', 'description'], setup: props => () => vue.h('aside', `${props.title} ${props.description}`) })
const html = await renderToString(app)
assert.equal(html.includes('采购结果驳回原因'), visible, `${status}, photosNeedUpdate=${photosNeedUpdate}`)
assert.equal(html.includes('照片不清晰'), visible)
}
})
function viewHarness({ createPage = false, detailPage = false, api = {}, storage = new Map() } = {}) {
const props = vue.reactive({ createPage, detailPage })
const route = vue.reactive({ params: { orderNo: detailPage ? 'PO-1' : '' } })