40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
|
|
/**
|
|||
|
|
* 功能:检查智能气阀状态的中文展示和目标状态选择规则。
|
|||
|
|
* 版本: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('智能气阀状态展示检查通过:中文展示当前状态,目标选项排除原状态。');
|