28 lines
915 B
JavaScript
28 lines
915 B
JavaScript
/**
|
||
* 功能:检查智能气阀归属弹窗保留互斥选择和提交防御。
|
||
* 版本:v1.0.0
|
||
*/
|
||
import { readFile } from 'node:fs/promises';
|
||
import { fileURLToPath } from 'node:url';
|
||
|
||
const componentUrl = new URL(
|
||
'../src/views/resource/ResourceActionDialog.vue',
|
||
import.meta.url,
|
||
);
|
||
const source = await readFile(fileURLToPath(componentUrl), 'utf8');
|
||
const requiredFragments = [
|
||
'@change-relation="changeRelation"',
|
||
'ownershipKeys.includes(field.key)',
|
||
'if (key !== field.key) form[key] = undefined',
|
||
"Message.warning('智能气阀只能选择一个当前归属')",
|
||
"payload[key] = String(form[key] ?? '')",
|
||
];
|
||
|
||
for (const fragment of requiredFragments) {
|
||
if (!source.includes(fragment)) {
|
||
throw new Error(`智能气阀归属互斥检查缺少实现:${fragment}`);
|
||
}
|
||
}
|
||
|
||
console.log('智能气阀归属互斥检查通过:选择时自动清空,提交时保留防御校验。');
|