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

const componentPath = path.resolve(
  __dirname,
  "../../src/views/ccdiProject/components/detail/UploadData.vue"
);
const source = fs.readFileSync(componentPath, "utf8");

assert(
  /<el-button[\s\S]*?:disabled="isProjectTagging \|\| isProjectArchived"[\s\S]*?@click="handleOpenBatchUploadDialog"[\s\S]*?>\s*上传流水\s*<\/el-button>/.test(
    source
  ),
  "头部上传流水按钮应在项目打标中或已归档时禁用"
);

["uploadCards:", "syncUploadCardDisabledState()", "handleUploadClick(key)", 'class="upload-section"'].forEach((token) => {
  assert(!source.includes(token), `旧上传卡片逻辑未清理: ${token}`);
});

console.log("upload-data-disabled-cards test passed");
