Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6781b309d4 | ||
|
|
eb7cb6b5eb | ||
|
|
845853c68a | ||
|
|
955869b5f5 | ||
|
|
49de6f8045 |
@@ -2,8 +2,8 @@
|
||||
generated: true (请先修改 Gitea Wiki,禁止直接编辑本文件)
|
||||
wiki_page: Business-Rules-and-Glossary
|
||||
wiki_url: https://git.ilapage.cn/OPC/goauto/wiki/Business-Rules-and-Glossary.-
|
||||
wiki_revision: 81cec55e15c968efcc2cb4c4e5babcd17a40a3f4
|
||||
synchronized_at: 2026-10-06T10:02:05Z
|
||||
wiki_revision: d9b2a343e790c7d90354d47e1a977f134a72a760
|
||||
synchronized_at: 2026-10-07T03:28:45Z
|
||||
<!-- gitea-wiki-mirror:end -->
|
||||
|
||||
<!-- gitea-wiki-mirror:start -->
|
||||
@@ -339,6 +339,8 @@ Admin 的「创建时间」范围按 SYB 货运单列表的 `t_stock.created`(
|
||||
|
||||
## SYB 档口入库码导入、匹配与回写
|
||||
|
||||
- 页面分页(#363,实现绑定 `955869b`,2026-10-07 已合并 main `eb7cb6b` 并发布至 122.228.200.167):仅档口入库码页首次进入或刷新默认第 1 页、每页 200 条,保留 20/50/100/200 条选项;搜索和清空筛选保持当前选定条数。其他页面、公共分页组件及后端未传 pageSize 时默认 100 的行为不变;当前页全选仍仅限当前页,匹配、删除和回写的资格与确认规则不变。
|
||||
|
||||
- 只接受不超过 10 MB、最多 5000 条非空数据行且包含“标签入库码映射”工作表的 Excel。一次文件只能包含一个营业日期;同日单件入库码必须唯一,同一业务键按营业日期、订单号、档口和规范化规格合并并保留 Excel 顺序。
|
||||
- 导入事务提交后自动创建并启动只读匹配任务,手动批量重匹配入口见 #350 的版本绑定规则。再次导入同日数据只允许整体替换仍处于等待匹配的数据;存在匹配或回写证据时拒绝覆盖。
|
||||
- 匹配必须按精确订单号取得唯一货运单,再以规格、原始 SKU 和档口证据确定唯一商品;歧义、冲突或数量不一致均不猜测。匹配阶段不能调用任何 SYB 写接口。
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
generated: true (请先修改 Gitea Wiki,禁止直接编辑本文件)
|
||||
wiki_page: Deployment-and-Operations
|
||||
wiki_url: https://git.ilapage.cn/OPC/goauto/wiki/Deployment-and-Operations.-
|
||||
wiki_revision: 8be38ac192b9e1930fdc3d998c23027fda17e8f3
|
||||
synchronized_at: 2026-10-06T03:27:28Z
|
||||
wiki_revision: 21e8ed0578212b84a77af537e13be6d10c8b5463
|
||||
synchronized_at: 2026-10-07T03:28:51Z
|
||||
<!-- gitea-wiki-mirror:end -->
|
||||
|
||||
<!-- gitea-wiki-mirror:start -->
|
||||
@@ -276,3 +276,11 @@ Provider 故障日志只允许记录调用关联 ID、操作类型、耗时、
|
||||
- 服务端 SHA256:`a4cf6c7028a2bbbfd86a1d657ad9c3daad7b4d08445405d8ca9a778adc584760`;远端校验一致。
|
||||
- 发布验收:公网 `/`、`/index.html`、`/syb-products/index` 与发布 dist/index.html 字节相同,10 项入口 JS/CSS 和 `/api/v1/health` 均正常;日志无 panic/fatal/缺表缺字段错误。合并后的 #358 合成解析/导入/重解析及 task/purchase 规格键定向回归通过。未将健康验证视为历史数据已纠正。
|
||||
- 回滚目标 `/home/goauto/releases/20261006-0a79c83-356` 保留,需按执行中任务检查后切回并重启;不通过恢复数据库覆盖后续业务数据。
|
||||
## #363 档口入库码默认 200 条的 Web 发布(2026-10-07)
|
||||
|
||||
- 用户授权合并 main 和线上发布;main `eb7cb6b5eb9a57041429c3dfb1d88dc8236d32f3` 已推送,发布目录 `/home/goauto/releases/20261007-eb7cb6b-363`。仅本页初始化 pageSize 改为 200,选项仍为20/50/100/200;后端缺省100不变,没有迁移、权限或业务数据修改。
|
||||
- 对比上一线上源码 `e76de6f`,Server 无差异,复用原二进制并逐字节验证;Web 从合并提交重建。沿用原 config、环境、static/temp/var 的真实目录;新 dist 保留上版不同哈希 JS/CSS,避免已打开页面的延迟加载失效。
|
||||
- 发布检查发现有采购任务执行中,未停止或重置任务。核验 Nginx root 及运行进程 GOAUTO_WEB_DIST 均指向 `/home/goauto/current/dist`,代码在请求时读取文件且没有提前解析软链接。因此本次只原子切换 current,不重启 GoAuto/Nginx;进程 PID 43738 前后一致且 active。此方式仅适用于后端二进制、配置与持久资源路径均不变的纯 Web 发布,不能推广为后端发布免重启。
|
||||
- 公网首页、index.html、login、档口入库码路由均与新 dist/index.html 字节一致;10 项入口 JS/CSS 与健康接口正常,日志检查无 panic/fatal/1146/1054。真实 Chrome 已认证只读检查:首次默认 page=1/pageSize=200、当天空态与200条/页正常;清除日期后200行渲染通过,查询至渲染约987ms。未发起匹配、删除或回写,未保存原始生产数据或截图。
|
||||
- Web包 SHA256 `a6b4429280fae37e46e81bd21a594941cfee3b5e8c48c105a09254314af32311`;Server SHA256 `a4cf6c7028a2bbbfd86a1d657ad9c3daad7b4d08445405d8ca9a778adc584760`(未变)。
|
||||
- 回滚目录 `/home/goauto/releases/20261006-e76de6f-358` 保留。对本次纯 Web 变更可将 current 原子切回,不需要恢复数据库、删除文件或中断任务;若此后已升级后端,不能复用这一免重启结论。
|
||||
|
||||
@@ -68,7 +68,7 @@ import { createRequestId } from '@/utils/request-id'
|
||||
export default {
|
||||
name: 'GoAutoSybInnerCodes',
|
||||
setup() { return { FolderOpened, RefreshLeft, Search, Upload } },
|
||||
data() { const now = new Date(); const today = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}`; return { loading: false, importing: false, busy: false, matchSubmitting: false, loadError: '', items: [], total: 0, selected: [], selectedFile: null, dateRange: [today, today], rowActionId: 0, pollTimer: null, activeJob: null, activeBatch: null, query: { page: 1, pageSize: 100, dateFrom: today, dateTo: today, keyword: '' }, applyDialog: { open: false, loading: false, saving: false, ready: false, error: '', ids: [], selectedCount: 0, preview: {}}, deleteDialog: { open: false, saving: false }, detail: { open: false, loading: false, item: null }} },
|
||||
data() { const now = new Date(); const today = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}`; return { loading: false, importing: false, busy: false, matchSubmitting: false, loadError: '', items: [], total: 0, selected: [], selectedFile: null, dateRange: [today, today], rowActionId: 0, pollTimer: null, activeJob: null, activeBatch: null, query: { page: 1, pageSize: 200, dateFrom: today, dateTo: today, keyword: '' }, applyDialog: { open: false, loading: false, saving: false, ready: false, error: '', ids: [], selectedCount: 0, preview: {}}, deleteDialog: { open: false, saving: false }, detail: { open: false, loading: false, item: null }} },
|
||||
computed: {
|
||||
matchingBusy() { return this.matchSubmitting || ['pending', 'running'].includes(this.activeJob?.status) },
|
||||
matchEligibleRows() { const ids = new Set(this.selected.map(item => item.id)); return this.items.filter(item => ids.has(item.id) && ['pending', 'failed', 'skipped'].includes(item.status)) },
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
import { expect, test } from '@playwright/test'
|
||||
|
||||
test('page-local 200 default, pagination, filters, selection and other-page isolation', async ({ page, context }) => {
|
||||
await page.setViewportSize({ width: 1920, height: 1080 })
|
||||
await context.addCookies([{ name: 'Admin-Token', value: 'isolated-test-token', domain: 'localhost', path: '/' }])
|
||||
const lists: URL[] = []; const shopLists: URL[] = []; const previews: number[][] = []; const writes: string[] = []
|
||||
const rows = Array.from({ length: 205 }, (_, i) => ({ id: i + 1, businessDate: '2026-10-07', orderNumber: `MOCK-${i + 1}`, status: 'ready', specRaw: '模拟规格', items: [{ ordinal: 1, code: `CODE-${i + 1}` }] }))
|
||||
await page.route('**/api/**', async route => {
|
||||
const request = route.request(); const url = new URL(request.url()); const path = url.pathname
|
||||
if (path.startsWith('/src/api/')) return route.continue()
|
||||
const reply = (data: unknown) => route.fulfill({ json: { code: 200, data } })
|
||||
if (path.endsWith('/api/v1/getinfo')) return reply({ roles: ['purchaser'], name: '模拟采购员', avatar: '', permissions: [] })
|
||||
if (path.endsWith('/api/v1/menurole')) return reply([{ path: '/workbench', component: 'Layout', menuName: 'Workbench', title: '工作台', visible: '0', children: [
|
||||
{ path: '/syb-inner-codes', component: '/goauto/syb-inner-codes/index', menuName: 'GoAutoSybInnerCodes', title: '档口入库码', visible: '0' },
|
||||
{ path: '/syb-shops', component: '/goauto/syb-shops/index', menuName: 'GoAutoSybShops', title: '店铺管理', visible: '0' }
|
||||
] }])
|
||||
if (path.endsWith('/syb-inner-codes') && request.method() === 'GET') {
|
||||
lists.push(url)
|
||||
const pageNo = Number(url.searchParams.get('page')); const size = Number(url.searchParams.get('pageSize'))
|
||||
const filtered = url.searchParams.get('keyword') === 'empty' ? [] : rows
|
||||
return reply({ items: filtered.slice((pageNo - 1) * size, pageNo * size), total: filtered.length, page: pageNo, pageSize: size })
|
||||
}
|
||||
if (path.endsWith('/apply-preview')) {
|
||||
const ids = request.postDataJSON().ids; previews.push(ids)
|
||||
return reply({ records: ids.length, inboundCodes: ids.length, placeholderDetails: 0, replaceOldCodes: 0, blocked: [] })
|
||||
}
|
||||
if (path.endsWith('/syb-shops') && request.method() === 'GET') { shopLists.push(url); return reply({ items: [], total: 0 }) }
|
||||
if (request.method() !== 'GET') writes.push(path)
|
||||
return reply({ items: [], total: 0 })
|
||||
})
|
||||
const tableRows = page.locator('.el-table__body-wrapper tbody tr')
|
||||
const pagination = page.locator('.pagination-container')
|
||||
const started = Date.now()
|
||||
await page.goto('/#/syb-inner-codes')
|
||||
await expect(tableRows).toHaveCount(200)
|
||||
console.log(`mock 200-row initial navigation and render: ${Date.now() - started}ms`)
|
||||
expect(lists[0].searchParams.get('page')).toBe('1')
|
||||
expect(lists[0].searchParams.get('pageSize')).toBe('200')
|
||||
await expect(pagination.locator('.el-select')).toContainText('200')
|
||||
|
||||
await page.locator('.el-table__header-wrapper .el-checkbox').first().click()
|
||||
await page.getByRole('button', { name: '回写(200)', exact: true }).click()
|
||||
await expect.poll(() => previews.length).toBe(1)
|
||||
expect(previews[0]).toEqual(rows.slice(0, 200).map(row => row.id))
|
||||
await page.getByRole('dialog').getByRole('button', { name: '取消', exact: true }).click()
|
||||
expect(writes).toEqual([])
|
||||
|
||||
await pagination.locator('.btn-next').click()
|
||||
await expect(tableRows).toHaveCount(5)
|
||||
await expect(page.getByRole('cell', { name: 'MOCK-201', exact: true })).toBeVisible()
|
||||
expect(lists.at(-1)!.searchParams.get('page')).toBe('2')
|
||||
await expect(page.getByRole('button', { name: '回写(0)', exact: true })).toBeDisabled()
|
||||
await page.getByRole('button', { name: '搜索', exact: true }).click()
|
||||
await expect(tableRows).toHaveCount(200)
|
||||
|
||||
for (const size of [20, 50, 100, 200]) {
|
||||
await pagination.locator('.el-select').click()
|
||||
await page.getByRole('option', { name: new RegExp(`^${size}\\s*条/页$`) }).click()
|
||||
await expect(tableRows).toHaveCount(size)
|
||||
expect(lists.at(-1)!.searchParams.get('pageSize')).toBe(String(size))
|
||||
for (const name of ['搜索', '清除']) {
|
||||
const before = lists.length
|
||||
await page.getByRole('button', { name, exact: true }).click()
|
||||
await expect.poll(() => lists.length).toBeGreaterThan(before)
|
||||
expect(lists.at(-1)!.searchParams.get('pageSize')).toBe(String(size))
|
||||
}
|
||||
}
|
||||
|
||||
await page.getByPlaceholder('订单号或入库码').fill('empty')
|
||||
await page.getByRole('button', { name: '搜索', exact: true }).click()
|
||||
await expect(tableRows).toHaveCount(0)
|
||||
await expect(pagination).not.toBeVisible()
|
||||
await page.reload()
|
||||
await expect(tableRows).toHaveCount(200)
|
||||
expect(lists.at(-1)!.searchParams.get('pageSize')).toBe('200')
|
||||
|
||||
await page.goto('/#/syb-shops')
|
||||
await expect.poll(() => shopLists.length).toBeGreaterThan(0)
|
||||
expect(shopLists[0].searchParams.get('pageSize')).toBe('20')
|
||||
expect(writes).toEqual([])
|
||||
})
|
||||
@@ -0,0 +1,40 @@
|
||||
const { test } = require('node:test')
|
||||
const assert = require('node:assert/strict')
|
||||
const fs = require('node:fs')
|
||||
const path = require('node:path')
|
||||
|
||||
const page = fs.readFileSync(path.join(__dirname, '../../src/views/goauto/syb-inner-codes/index.vue'), 'utf8')
|
||||
const source = page.split('<script>')[1].split('</script>')[0].replace(/^import .*$/gm, '').replace('export default', 'return')
|
||||
const options = new Function(source)()
|
||||
|
||||
test('inner code page defaults to 200 and keeps a manual size through search and clear', async () => {
|
||||
const vm = { ...options.data(), ...options.methods }
|
||||
const requests = []
|
||||
vm.load = async () => { requests.push({ ...vm.query }) }
|
||||
|
||||
const now = new Date()
|
||||
const today = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}`
|
||||
assert.equal(vm.query.page, 1)
|
||||
assert.equal(vm.query.pageSize, 200)
|
||||
assert.deepEqual(vm.dateRange, [today, today])
|
||||
assert.match(page, /:page-sizes="\[20, 50, 100, 200\]"/)
|
||||
|
||||
vm.query.pageSize = 50
|
||||
vm.query.page = 4
|
||||
vm.query.keyword = 'code'
|
||||
vm.dateRange = ['2026-10-01', '2026-10-02']
|
||||
await vm.search()
|
||||
assert.equal(requests[0].page, 1)
|
||||
assert.equal(requests[0].pageSize, 50)
|
||||
|
||||
vm.query.page = 3
|
||||
await vm.clearFilters()
|
||||
assert.equal(requests[1].page, 1)
|
||||
assert.equal(requests[1].pageSize, 50)
|
||||
assert.equal(requests[1].keyword, '')
|
||||
assert.equal(requests[1].dateFrom, '')
|
||||
assert.equal(requests[1].dateTo, '')
|
||||
|
||||
const freshVm = { ...options.data() }
|
||||
assert.equal(freshVm.query.pageSize, 200)
|
||||
})
|
||||
Reference in New Issue
Block a user