const assert = require("assert"); const fs = require("fs"); const path = require("path"); const editDialogPath = path.resolve( __dirname, "../../src/views/ccdiIntermediary/components/EditDialog.vue" ); const detailDialogPath = path.resolve( __dirname, "../../src/views/ccdiIntermediary/components/DetailDialog.vue" ); const editDialogSource = fs.readFileSync(editDialogPath, "utf8"); const detailDialogSource = fs.readFileSync(detailDialogPath, "utf8"); [ 'label="中介子类型"', 'v-model="form.personSubType"', 'v-for="item in personSubTypeOptions"', "label: '个人'", "handlePersonSubTypeChange" ].forEach((token) => { assert( editDialogSource.includes(token), `个人中介编辑弹窗缺少中介子类型改造: ${token}` ); }); [ 'label="关联关系"', 'v-model="form.relationType" placeholder="请选择关联关系"' ].forEach((token) => { assert( !editDialogSource.includes(token), `个人中介编辑弹窗不应继续单独展示关联关系字段: ${token}` ); }); [ 'label="中介子类型"', "detailData.personSubType || detailData.relationType || '-'" ].forEach((token) => { assert( detailDialogSource.includes(token), `个人中介详情缺少中介子类型展示调整: ${token}` ); }); assert( !detailDialogSource.includes('label="关系类型"'), "个人中介详情不应继续展示单独的关系类型字段" ); console.log("intermediary-person-edit-ui test passed");