后端新增票据夹端点、数据模型和服务模块,优化 OCR 端点 Schema 和附件操作逻辑,完善员工行为画像服务和辅助函数, 前端新增票据夹视图和服务层,优化文档中心样式和侧边栏导 航,完善员工画像详情弹窗和权限控制,补充单元测试。
76 lines
2.9 KiB
JavaScript
76 lines
2.9 KiB
JavaScript
import assert from 'node:assert/strict'
|
|
import { readFileSync } from 'node:fs'
|
|
import { join } from 'node:path'
|
|
|
|
const root = process.cwd()
|
|
|
|
function readProjectFile(path) {
|
|
return readFileSync(join(root, path), 'utf8')
|
|
}
|
|
|
|
function testReceiptFolderViewSurface() {
|
|
const view = readProjectFile('web/src/views/ReceiptFolderView.vue')
|
|
|
|
assert.match(view, /未关联票据/)
|
|
assert.match(view, /已关联票据/)
|
|
assert.match(view, /一键关联票据/)
|
|
assert.match(view, /基本票据信息/)
|
|
assert.match(view, /原始文件/)
|
|
assert.match(view, /返回列表/)
|
|
assert.match(view, /删除票据/)
|
|
assert.match(view, /ElCheckboxGroup/)
|
|
assert.match(view, /fetchReceiptFolderItems\('all'\)/)
|
|
assert.match(view, /buildReceiptFile\(item\)/)
|
|
assert.match(view, /source: selectedDraft \? 'detail' : 'receipt-folder'/)
|
|
assert.match(view, /emit\('open-assistant'/)
|
|
}
|
|
|
|
function testReceiptFolderServiceContract() {
|
|
const service = readProjectFile('web/src/services/receiptFolder.js')
|
|
const ocrService = readProjectFile('web/src/services/ocr.js')
|
|
const reimbursementService = readProjectFile('web/src/services/reimbursements.js')
|
|
|
|
assert.match(service, /\/receipt-folder\$\{buildStatusQuery\(status\)\}/)
|
|
assert.match(service, /\/receipt-folder\/\$\{encodeURIComponent/)
|
|
assert.match(service, /responseType: 'blob'/)
|
|
assert.match(service, /new File\(\[blob\], fileName/)
|
|
assert.match(service, /receiptId/)
|
|
assert.match(ocrService, /formData\.append\('receipt_ids'/)
|
|
assert.match(reimbursementService, /formData\.append\('receipt_id'/)
|
|
}
|
|
|
|
function testAppShellWiresReceiptFolder() {
|
|
const shell = readProjectFile('web/src/views/AppShellRouteView.vue')
|
|
|
|
assert.match(shell, /activeView === 'receiptFolder'/)
|
|
assert.match(shell, /ReceiptFolderView/)
|
|
assert.match(shell, /@open-assistant="openSmartEntry"/)
|
|
assert.match(shell, /receipt-folder-workarea/)
|
|
}
|
|
|
|
function testSharedDocumentListStyleReuse() {
|
|
const receiptView = readProjectFile('web/src/views/ReceiptFolderView.vue')
|
|
const documentView = readProjectFile('web/src/views/DocumentsCenterView.vue')
|
|
const receiptStyles = readProjectFile('web/src/assets/styles/views/receipt-folder-view.css')
|
|
const sharedStyles = readProjectFile('web/src/assets/styles/components/document-list-shared.css')
|
|
|
|
assert.match(receiptView, /document-list-shared\.css/)
|
|
assert.match(documentView, /document-list-shared\.css/)
|
|
assert.match(sharedStyles, /\.table-wrap\b/)
|
|
assert.match(sharedStyles, /\.doc-kind-tag\b/)
|
|
assert.match(sharedStyles, /\.list-foot\b/)
|
|
assert.doesNotMatch(receiptStyles, /\.table-wrap\b/)
|
|
assert.doesNotMatch(receiptStyles, /\.doc-kind-tag\b/)
|
|
assert.doesNotMatch(receiptStyles, /\.list-foot\b/)
|
|
}
|
|
|
|
function run() {
|
|
testReceiptFolderViewSurface()
|
|
testReceiptFolderServiceContract()
|
|
testAppShellWiresReceiptFolder()
|
|
testSharedDocumentListStyleReuse()
|
|
console.log('receipt folder view tests passed')
|
|
}
|
|
|
|
run()
|