186 lines
4.6 KiB
JavaScript
186 lines
4.6 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import { readFileSync } from 'node:fs';
|
|
import { join } from 'node:path';
|
|
|
|
const root = new URL('..', import.meta.url).pathname.replace(/^\/([A-Za-z]:)/, '$1');
|
|
const read = (path) => readFileSync(join(root, path), 'utf8');
|
|
|
|
const packageJson = JSON.parse(read('admin/package.json'));
|
|
assert.equal(packageJson.dependencies.vue.startsWith('^3.'), true);
|
|
assert.ok(packageJson.dependencies['element-plus']);
|
|
assert.ok(packageJson.dependencies['@lucide/vue']);
|
|
|
|
const envExample = read('admin/.env.example');
|
|
assert.match(envExample, /https:\/\/api\.txyundm\.cn\/admin-api/);
|
|
assert.doesNotMatch(envExample, /localhost|127\.0\.0\.1|http:\/\//);
|
|
|
|
const vite = read('admin/vite.config.ts');
|
|
assert.match(vite, /base: '\/admin\/'/);
|
|
assert.match(vite, /'\/admin-api'/);
|
|
|
|
const app = read('admin/src/App.vue');
|
|
for (const pattern of [
|
|
'CleaningTasksPanel',
|
|
'CleaningSettlementsPanel',
|
|
'CleaningStatisticsPanel',
|
|
'CleanersPanel',
|
|
'qipai.admin.token',
|
|
'loadTasks',
|
|
'loadSettlements',
|
|
'loadStatistics',
|
|
'loadCleaners',
|
|
'handleSyncTransfer',
|
|
'handleSyncTransferMany',
|
|
'handleCompleteMany',
|
|
'handleRejectMany',
|
|
'运营待处理',
|
|
'jumpToTaskStatus',
|
|
'jumpToSettlementStatus',
|
|
'draftSettlementTotal',
|
|
'settlementFilters.payoutState',
|
|
'待确认结算',
|
|
'待发放金额'
|
|
]) {
|
|
assert.match(app, new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')));
|
|
}
|
|
|
|
const api = read('admin/src/api.ts');
|
|
for (const route of [
|
|
'/cleaning/tasks?',
|
|
'/cleaning/statistics',
|
|
'storeId',
|
|
'cleanerUserId',
|
|
'/users?',
|
|
'/staff',
|
|
'/reset-sessions',
|
|
'/assign',
|
|
'/complete',
|
|
'/reject',
|
|
'/members',
|
|
'/cleaning/reclaim-timeouts',
|
|
'/cleaning/settlements?',
|
|
'/cleaning/settlements',
|
|
'payoutState',
|
|
'/wechat-transfer',
|
|
'/wechat-transfer/preflight',
|
|
'/wechat-transfer/sync',
|
|
'/payout-failure'
|
|
]) {
|
|
assert.match(api, new RegExp(route.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')));
|
|
}
|
|
|
|
const tasks = read('admin/src/components/CleaningTasksPanel.vue');
|
|
for (const pattern of [
|
|
'指派',
|
|
'验收',
|
|
'驳回',
|
|
'回收',
|
|
'成员',
|
|
'保洁任务详情',
|
|
'操作流水',
|
|
'协作分账',
|
|
'listCleaningTaskEvents',
|
|
'listCleaningTaskMembers',
|
|
'loadingEvents',
|
|
'loadingMembers',
|
|
'批量验收',
|
|
'批量驳回',
|
|
'selectedSubmittedTasks',
|
|
'complete-many',
|
|
'reject-many',
|
|
'photo-grid',
|
|
'timeline-grid',
|
|
'el-image',
|
|
'协作者管理',
|
|
'photoUrls',
|
|
'el-select',
|
|
'cleanerLabel',
|
|
'filterDraft',
|
|
'门店 ID',
|
|
'筛选'
|
|
]) {
|
|
assert.match(tasks, new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')));
|
|
}
|
|
|
|
const settlements = read('admin/src/components/CleaningSettlementsPanel.vue');
|
|
for (const pattern of [
|
|
'详情',
|
|
'生成',
|
|
'确认',
|
|
'转账',
|
|
'同步',
|
|
'批量同步',
|
|
'selectedSyncableSettlements',
|
|
'sync-transfer-many',
|
|
'失败',
|
|
'结算单详情',
|
|
'微信确认参数',
|
|
'payoutPackageInfo',
|
|
'getCleaningSettlementDetail',
|
|
'微信转账预检',
|
|
'preflightWechatTransfer',
|
|
'listCleaningSettlementCandidates',
|
|
'candidateDialog',
|
|
'useCandidateFilters',
|
|
'exportSettlements',
|
|
'exportCandidates',
|
|
'downloadCsv',
|
|
'MOCK',
|
|
'el-select',
|
|
'cleanerLabel',
|
|
'filterDraft',
|
|
'payoutStateOptions',
|
|
'转账状态',
|
|
'WAIT_USER_CONFIRM',
|
|
'门店 ID',
|
|
'筛选'
|
|
]) {
|
|
assert.match(settlements, new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')));
|
|
}
|
|
|
|
const statistics = read('admin/src/components/CleaningStatisticsPanel.vue');
|
|
for (const pattern of [
|
|
'今日',
|
|
'近7天',
|
|
'本月',
|
|
'任务状态',
|
|
'结算口径',
|
|
'每日趋势',
|
|
'trendWidth',
|
|
'paidSettlementCents',
|
|
'门店明细',
|
|
'成员分账',
|
|
'pendingSettlementCents',
|
|
'filterDraft.cleanerUserId',
|
|
'cleanerLabel',
|
|
'el-select'
|
|
]) {
|
|
assert.match(statistics, new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')));
|
|
}
|
|
|
|
const cleaners = read('admin/src/components/CleanersPanel.vue');
|
|
for (const pattern of [
|
|
'新增保洁员',
|
|
'门店 ID,逗号分隔',
|
|
'已绑微信',
|
|
'待补资料',
|
|
'profileComplete',
|
|
'会话',
|
|
'status-toggle',
|
|
'reset-sessions'
|
|
]) {
|
|
assert.match(cleaners, new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')));
|
|
}
|
|
|
|
const styles = read('admin/src/styles.css');
|
|
assert.match(styles, /\.cleaner-select/);
|
|
assert.match(styles, /\.option-row/);
|
|
assert.match(styles, /\.filter-select/);
|
|
assert.match(styles, /\.narrow-input/);
|
|
assert.match(styles, /\.action-board/);
|
|
assert.match(styles, /\.action-tile/);
|
|
assert.match(styles, /@media \(max-width: 980px\)/);
|
|
assert.match(styles, /@media \(max-width: 560px\)/);
|
|
|
|
console.log('PASS: M08-B admin cleaning workspace covers task, settlement, transfer and preflight controls.');
|