WXL (wul)
5 天以前 39c8b288ec8294e026459dfb1955f0bbc49ebb52
src/views/patient/archives/maternalHealth/index.vue
@@ -48,13 +48,13 @@
          <el-tag :type="scope.row.subType === 'pregnancy' ? 'success' : 'warning'">{{ scope.row.subTypeLabel }}</el-tag>
        </template>
      </el-table-column>
      <el-table-column label="孕周" align="center" width="70">
        <template slot-scope="scope">{{ scope.row.subType === 'pregnancy' ? (scope.row.archiveForm.gestationalWeek || '-') : '-' }}</template>
      <el-table-column label="妊娠情况" align="center" width="120" show-overflow-tooltip>
        <template slot-scope="scope">{{ scope.row.subType === 'pregnancy' ? (scope.row.pregnancyStatus || '-') : '-' }}</template>
      </el-table-column>
      <el-table-column label="KMI评分" align="center" width="90">
        <template slot-scope="scope">{{ scope.row.subType === 'menopause' ? (scope.row.archiveForm.kmiScore || '-') : '-' }}</template>
      <el-table-column label="随访周期" align="center" width="110" show-overflow-tooltip>
        <template slot-scope="scope">{{ scope.row.subType === 'menopause' ? (scope.row.followupCycles || '-') : '-' }}</template>
      </el-table-column>
      <el-table-column label="建档医生" align="center" prop="archiveForm.doctorName" width="100" />
      <el-table-column label="登记人员" align="center" prop="registrant" width="100" />
      <el-table-column label="建档时间" align="center" width="160">
        <template slot-scope="scope">{{ scope.row.createTime ? scope.row.createTime.substring(0, 10) : '-' }}</template>
      </el-table-column>
@@ -85,13 +85,14 @@
<script>
import ArchiveDialog from "@/views/patient/archives/components/ArchiveDialog.vue";
import { listArchivesByModule, removeArchiveList } from "../apiAdapter";
export default {
  name: "MaternalHealthArchive",
  components: { ArchiveDialog },
  data() {
    return {
      loading: false, showSearch: true, multiple: true, ids: [], dateRange: [], total: 0, allList: [], displayList: [],
      loading: false, showSearch: true, multiple: true, ids: [], selectedRows: [], dateRange: [], total: 0, allList: [], displayList: [],
      createDialogVisible: false,
      queryParams: { pageNum: 1, pageSize: 10, patname: "", subType: "", deptname: "" },
    };
@@ -100,38 +101,43 @@
  methods: {
    getList() {
      this.loading = true;
      const all = JSON.parse(localStorage.getItem("patientArchives") || "[]");
      this.allList = all.filter((item) => item.mainCategory === "maternal");
      let filtered = [...this.allList];
      if (this.queryParams.patname) filtered = filtered.filter((item) => item.patname && item.patname.includes(this.queryParams.patname));
      if (this.queryParams.subType) filtered = filtered.filter((item) => item.subType === this.queryParams.subType);
      if (this.queryParams.deptname) filtered = filtered.filter((item) => item.deptname && item.deptname.includes(this.queryParams.deptname));
      if (this.dateRange && this.dateRange.length === 2) {
        filtered = filtered.filter((item) => {
          const d = (item.createTime || "").substring(0, 10);
          return d >= this.dateRange[0] && d <= this.dateRange[1];
        });
      const params = { pageNum: this.queryParams.pageNum, pageSize: this.queryParams.pageSize };
      if (this.queryParams.patname) params.patname = this.queryParams.patname;
      if (this.queryParams.deptname) params.deptname = this.queryParams.deptname;
      // 专案类型:转成后端 archiveType(妇科 1-早孕关爱 2-围绝经期MHI)
      if (this.queryParams.subType) {
        params.archiveType = this.queryParams.subType === "pregnancy" ? "1" : "2";
      }
      this.total = filtered.length;
      const start = (this.queryParams.pageNum - 1) * this.queryParams.pageSize;
      this.displayList = filtered.slice(start, start + this.queryParams.pageSize);
      this.loading = false;
      if (this.dateRange && this.dateRange.length === 2) {
        params.params = { beginTime: this.dateRange[0], endTime: this.dateRange[1] };
      }
      listArchivesByModule("maternal", params)
        .then((res) => {
          this.allList = res.rows || [];
          this.displayList = this.allList;
          this.total = res.total || 0;
        })
        .catch(() => { this.displayList = []; this.total = 0; })
        .finally(() => { this.loading = false; });
    },
    handleQuery() { this.queryParams.pageNum = 1; this.getList(); },
    resetQuery() { this.dateRange = []; this.queryParams = { pageNum: 1, pageSize: 10, patname: "", subType: "", deptname: "" }; this.getList(); },
    handleSelectionChange(s) { this.ids = s.map(i => i.id); this.multiple = !s.length; },
    handleSelectionChange(s) {
      this.selectedRows = s;
      this.ids = s.map(i => i.id);
      this.multiple = !s.length;
    },
    handleDelete() {
      if (this.ids.length === 0) { this.$modal.msgWarning("请至少选择一条"); return; }
      this.$modal.confirm("确认删除选中档案?").then(() => {
        const all = JSON.parse(localStorage.getItem("patientArchives") || "[]");
        const remaining = all.filter((item) => !this.ids.includes(item.id));
        localStorage.setItem("patientArchives", JSON.stringify(remaining));
        return removeArchiveList(this.selectedRows).then(() => {
        this.$modal.msgSuccess("删除成功"); this.getList();
        });
      }).catch(() => {});
    },
    handleSingleDelete(row) { this.ids = [row.id]; this.handleDelete(); },
    handleSingleDelete(row) { this.selectedRows = [row]; this.ids = [row.id]; this.handleDelete(); },
    handleCreateStandalone() { this.createDialogVisible = true; },
    goDetail(row) { this.$router.push({ path: "/filing/maternalDetail", query: { id: row.id } }); },
    goDetail(row) { this.$router.push({ path: "/filing/maternalDetail", query: { id: row.id, type: row.subType, detailId: row.detailId || "" } }); },
  },
};
</script>