const assert = require("assert");
const fs = require("fs");
const path = require("path");

const componentPath = path.resolve(
  __dirname,
  "../../src/views/ccdiBaseStaff/index.vue"
);
const source = fs.readFileSync(componentPath, "utf8");

[
  "年收入",
  "v-model=\"form.annualIncome\"",
  "employeeDetail.annualIncome",
  "<el-dialog :title=\"title\" :visible.sync=\"open\" width=\"80%\"",
  "<el-dialog title=\"员工详情\" :visible.sync=\"detailOpen\" width=\"80%\"",
  "资产信息",
  "新增资产",
  "handleAddAsset()",
  "handleRemoveAsset(index)",
  "createEmptyAssetRow(defaultPersonId = \"\")",
  "暂无资产信息，请点击新增资产",
  "新增、编辑时无需填写实际持有人身份证号",
  "系统会默认带入并保留已有归属信息",
  "暂无资产信息",
  "ownerType",
  "prop=\"assetInfoList\"",
  "assetStatusOptions",
  "<el-select v-model=\"scope.row.assetStatus\" placeholder=\"请选择资产状态\">",
  "<el-option",
].forEach((token) => {
  assert(
    source.includes(token),
    `员工资产维护弹窗缺少关键结构: ${token}`
  );
});

[
  "placeholder=\"请输入资产实际持有人身份证号\"",
  "v-model=\"scope.row.personId\"",
].forEach((token) => {
  assert(
    !source.includes(token),
    `员工资产维护弹窗不应继续展示字段: ${token}`
  );
});

console.log("employee-asset-maintenance-layout test passed");
