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

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

[
  "查看亲属资产导入失败记录",
  "assetImportPollingTimer",
  "assetCurrentTaskId",
  "assetFailureDialogVisible",
  "staff_fmy_asset_import_last_task",
  "亲属资产导入失败记录",
  "viewAssetImportFailures()",
  "startAssetImportStatusPolling(taskId)",
  "getAssetFailureList()",
  "clearAssetImportHistory()",
  'from "@/api/ccdiAssetInfo"',
  "relationTaskId",
  "assetTaskId",
  "模板包含“员工亲属关系信息”和“亲属资产信息”两个Sheet，可单独填写其中一个，也可同时填写两个。",
  "/ccdi/staffFmyRelation/importData",
  "ccdi/staffFmyRelation/importTemplate",
  "员工亲属关系维护导入模板_",
].forEach((token) => {
  assert(source.includes(token), `亲属资产导入 UI 缺少关键结构或状态: ${token}`);
});

[
  ">亲属资产信息</el-divider>",
  "暂无亲属资产信息",
  "detail-assets-table",
  ":disabled=\"!isAdd\"",
].forEach((token) => {
  assert(source.includes(token), `详情展示或禁改逻辑缺少关键结构: ${token}`);
});

[
  "导入亲属资产信息",
  "assetUpload",
  "handleAssetImport()",
  "handleAssetFileSuccess(response)",
  "submitAssetFileForm()",
  "handleAssetImportDialogClose()",
  "/ccdi/assetInfo/importData",
  "ccdi/assetInfo/importTemplate",
  "亲属资产信息模板_",
  "@/api/ccdiBaseStaffAsset",
  "/ccdi/baseStaff/asset/importData",
  "ccdi/baseStaff/asset/importTemplate",
  "下载员工资产模板",
].forEach((token) => {
  assert(
    !source.includes(token),
    `亲属资产导入 UI 不应引用员工资产导入实现: ${token}`
  );
});

console.log("staff-family-asset-detail-import-ui test passed");
