优化智能气阀状态中文展示

列表和详情统一显示中文状态,状态弹窗区分当前状态与目标状态并排除原状态,同时保留服务端业务校验,补充专项检查和中文文档。
This commit is contained in:
czl231
2026-08-13 22:17:16 +08:00
parent e5289e8f8a
commit 457bcfb450
7 changed files with 167 additions and 9 deletions

View File

@@ -0,0 +1,39 @@
/**
* 功能:检查智能气阀状态的中文展示和目标状态选择规则。
* 版本v1.0.0
*/
import { readFile } from 'node:fs/promises';
import { fileURLToPath } from 'node:url';
const resources = await readFile(
fileURLToPath(new URL('../src/api/resources.ts', import.meta.url)),
'utf8',
);
const dialog = await readFile(
fileURLToPath(
new URL('../src/views/resource/ResourceActionDialog.vue', import.meta.url),
),
'utf8',
);
const rules = await readFile(
fileURLToPath(new URL('../src/api/resource-page-rules.ts', import.meta.url)),
'utf8',
);
const checks = [
[resources, "f('product_status', { type: 'select', options: productStatusOptions"],
[resources, "label: '目标状态'"],
[resources, "placeholder: '请选择目标状态'"],
[rules, "createHiddenKeys: ['product_status']"],
[dialog, '当前状态:{{ currentProductStatusLabel }}'],
[dialog, "option.value) !== String(props.record.product_status)"],
[dialog, ':fields="actionFields"'],
];
for (const [source, fragment] of checks) {
if (!source.includes(fragment)) {
throw new Error(`智能气阀状态展示检查缺少实现:${fragment}`);
}
}
console.log('智能气阀状态展示检查通过:中文展示当前状态,目标选项排除原状态。');