qx
2025-05-23 392133f4cda2641a2c4297656a50fc75f45b6971
Merge branch 'master' of http://101.42.27.146:5001/r/ltkj_peisweb_region
4个文件已修改
3个文件已添加
856 ■■■■ 已修改文件
src/api/hosp/biaoben.js 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/hosp/part.js 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/jianqianwenzhen/index.vue 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/doctor/checkAll/index.vue 48 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/hosp/biaoben/index.vue 320 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/hosp/part/index.vue 335 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/zhiye/index.vue 77 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/hosp/biaoben.js
New file
@@ -0,0 +1,30 @@
import request from '@/utils/request'
// 查询体检项目建议规则新表列表
export function searchBiaoben(query) {
    return request({
        url: '/hosp/project/getProListByBblx',
        method: 'get',
        params: query
    })
}
// 删除
export function delBiaoben(query) {
    return request({
        url: '/hosp/project/delProByBblx',
        method: 'get',
        params: query
    })
}
export function editBiaoben(data) {
  const formData = new FormData();
  data.proIds.forEach(proId => {
    formData.append('proIds', proId);
  });
  formData.append('bblx', data.bblx);
  return request({
    url: '/hosp/project/updateProByBblx',
    method: 'post',
    data: formData
  });
}
src/api/hosp/part.js
New file
@@ -0,0 +1,30 @@
import request from '@/utils/request'
// 查询体检项目建议规则新表列表
export function searchPart(query) {
    return request({
        url: '/hosp/project/getProListByBwwh',
        method: 'get',
        params: query
    })
}
// 删除
export function delPart(query) {
    return request({
        url: '/hosp/project/delProByBbwwh',
        method: 'get',
        params: query
    })
}
export function editPart(data) {
  const formData = new FormData();
  data.proIds.forEach(proId => {
    formData.append('proIds', proId);
  });
  formData.append('bw', data.bw);
  return request({
    url: '/hosp/project/updateProByBwwh',
    method: 'post',
    data: formData
  });
}
src/components/jianqianwenzhen/index.vue
@@ -79,12 +79,12 @@
            </el-form-item>
            <el-form-item
              label="接触有害物工龄"
              prop="zgongLing"
              prop="jhgl"
              label-width="150px"
            >
              <!-- <el-input v-model="form.cusName" placeholder="请输入工龄" style="width: 150px" />年 -->
              <el-input-number
                v-model="form.zgongLing"
                v-model="form.jhgl"
                label="请输入接触有害物工龄"
              ></el-input-number
              >年
@@ -99,10 +99,10 @@
              <el-input @focus="change" type="textarea" rows="4" v-model="form.contactPoison" placeholder="请输入接触毒物"
                style="width: 700px" />
            </el-form-item> -->
            <el-form-item label="体检危害因素" prop="tjwhyx">
            <el-form-item label="体检危害因素" prop="tjwhys">
              <el-select
                filterable
                v-model="form.tjwhyx"
                v-model="form.tjwhys"
                placeholder="请选择体检危害因素"
                clearable
                style="width: 180px"
@@ -117,12 +117,12 @@
            </el-form-item>
            <el-form-item
              label="接触危害因素"
              prop="tcwhyx"
              prop="jcwhys"
              style="margin-left: 30px"
            >
              <el-select
                filterable
                v-model="form.tcwhyx"
                v-model="form.jcwhys"
                placeholder="请选择接触危害因素"
                clearable
                style="width: 180px"
@@ -836,13 +836,15 @@
        dwmc: "",
        ygdw: "",
        gongLing: "",
        zgongLing: "",
        jhgl: "",
        yjsfyc: "", // 是否异常
        ycms: "", // 异常描述
        xiyan: "",
        xiyanpinlv: "",
        xiyanyear: "",
        yinjiu: "",
        jcwhys:"",
        tjwhys:"",
        yinjiupinlv: "",
        yinjiuyear: "",
        qita: "",
src/views/doctor/checkAll/index.vue
@@ -1,6 +1,7 @@
<template>
  <div class="mainbox">
    <el-form :model="queryParams" ref="tableList" :inline="true" label-width="76px" style="margin-top: 10px" v-if="tjStatus == 0">
    <el-form :model="queryParams" ref="tableList" :inline="true" label-width="76px" style="margin-top: 10px"
      v-if="tjStatus == 0">
      <el-form-item label="姓名" prop="name">
        <el-input v-model="queryParams.name" style="width: 120px" placeholder="请输入姓名" clearable
          @keyup.enter.native="submitForm"></el-input>
@@ -21,6 +22,13 @@
          <el-option v-for="dict in CompanyList" :key="dict.drugManufacturerId" :label="dict.cnName" :value="dict" />
        </el-select>
      </el-form-item>
      <el-form-item label="体检类别">
        <el-select style="width: 200px" v-model="queryParams.tjCategory" placeholder="请选择体检类别">
          <el-option v-for="dict in dict.type.dict_tjtype" :key="dict.value" :label="dict.label"
            :value="dict.value"></el-option>
        </el-select>
        <!-- <el-input v-model="form.category" placeholder="请输入体检类别" /> -->
      </el-form-item>
      <el-form-item>
        <el-button type="primary" size="mini" @click="submitForm" style="margin-right: 15px">搜索</el-button>
        <el-button size="mini" @click="resetQuery">重置</el-button>
@@ -28,7 +36,8 @@
    </el-form>
    <el-form :model="queryParams" ref="tableList" :inline="true" label-width="76px" style="margin-top: 10px" v-if="tjStatus == 1">
    <el-form :model="queryParams" ref="tableList" :inline="true" label-width="76px" style="margin-top: 10px"
      v-if="tjStatus == 1">
      <el-form-item label="姓名" prop="name">
        <el-input v-model="queryParams.name" style="width: 120px" placeholder="请输入姓名" clearable
          @keyup.enter.native="submitForm"></el-input>
@@ -47,6 +56,13 @@
       <el-form-item label="审核医师" prop="shys">
        <el-input ref="inputName" v-model="queryParams.shys" style="width: 180px" placeholder="请输入审核医师" clearable
          @keyup.enter.native="submitForm"></el-input>
      </el-form-item>
       <el-form-item label="体检类别">
        <el-select style="width: 200px" v-model="queryParams.tjCategory" placeholder="请选择体检类别">
          <el-option v-for="dict in dict.type.dict_tjtype" :key="dict.value" :label="dict.label"
            :value="dict.value"></el-option>
        </el-select>
        <!-- <el-input v-model="form.category" placeholder="请输入体检类别" /> -->
      </el-form-item>
      <el-form-item>
        <el-button type="primary" size="mini" @click="submitForm" style="margin-right: 15px">搜索</el-button>
@@ -94,7 +110,8 @@
        <el-table-column label="电话" align="center" prop="cusPhone" :show-overflow-tooltip="true" width="130px" />
        <el-table-column label="审核时间" align="center" prop="shsj" :show-overflow-tooltip="true" width="180px" />
        <el-table-column label="完成时间" align="center" prop="finishTime" :show-overflow-tooltip="true" width="160px" />
        <el-table-column label="状态" align="center" prop="tjStatus" :show-overflow-tooltip="true" width="120px" v-if="tjStatus == 0">
        <el-table-column label="状态" align="center" prop="tjStatus" :show-overflow-tooltip="true" width="120px"
          v-if="tjStatus == 0">
          <template slot-scope="scope" v-if="tjStatus == 0">
            <span>{{ scope.row.tjStatus == "1" ? "已审核" : "未审核" }}</span>
          </template>
@@ -835,6 +852,7 @@
    Prescription,
  },
  dicts: [
    "dict_team",
    "dict_tjtype",
    "sys_user_sex",
    "sys_yes_no",
@@ -849,7 +867,7 @@
  data() {
    return {
      zhiyeJl: '', // 初始化检查结论为空
      zhiyeJg: '未发现目标性疾病', // 初始化体检结果为默认值
      zhiyeJg: '', // 初始化体检结果为默认值
      selectedAdvice: null,
      activeAdviceIndex: 0,
      advicerulesList: [],
@@ -974,6 +992,7 @@
        name: null,
        checkStatus: null,
        shys: null,
        tjCategory: null
      },
      formobj: {},
      yichangList: [],
@@ -1014,7 +1033,6 @@
    this.getConfigKey();
    this.getdate();
  },
  mounted() {
    this.$nextTick(() => {
      this.$refs.inputName.focus();
@@ -1825,6 +1843,18 @@
    resetQuery() {
      this.startTime = [];
      this.queryParams = {
        page: 1,
        pageSize: 10,
        tjNumber: "",
        beginTime: null,
        endTime: null,
        compId: null,
        name: null,
        checkStatus: null,
        shys: null,
        tjCategory: null
      },
      this.resetForm("tableList");
      this.submitForm();
    },
@@ -1891,8 +1921,8 @@
                        this.remark = this.changedate[i].remark;
                      }
                      // 回显 zhiyeJl 和 zhiyeJg
                      this.zhiyeJl = response.data.zhiyeJl || '';
                      this.zhiyeJg = response.data.zhiyeJg || '未发现目标性疾病';
                      this.zhiyeJl = this.changedate[0].zhiyejl || '';
                      this.zhiyeJg = this.changedate[0].zhiyejg || '未发现目标性疾病';
                    } else {
                      this.$message({
                        type: "warning",
@@ -1936,8 +1966,8 @@
                            this.textarea1 = item.checkAdvice || "";
                          });
                          // 回显 zhiyeJl 和 zhiyeJg
                          this.zhiyeJl = response.data.zhiyeJl || '';
                          this.zhiyeJg = response.data.zhiyeJg || '未发现目标性疾病';
                          this.zhiyeJl = this.changedate[0].zhiyejl || '';
                          this.zhiyeJg = this.changedate[0].zhiyejg || '未发现目标性疾病';
                        } else {
                          this.$message({
                            type: "warning",
src/views/hosp/biaoben/index.vue
New file
@@ -0,0 +1,320 @@
<template>
  <div class="app-container">
    <el-row :gutter="24">
      <!-- 第一列:单选标本 -->
      <el-col :span="8" :xs="24">
        <el-form
          :model="queryParams"
          ref="queryForm"
          size="small"
          :inline="true"
          label-width="68px"
          style="height: 45px"
          @submit.native.prevent
        >
          <el-form-item label="项目名称" prop="tjh">
            <el-input
              v-model="queryParams.tjh"
              placeholder="请输入项目名称"
              clearable
              @keyup.enter.native="handleManual"
            />
          </el-form-item>
          <el-form-item>
            <el-button type="primary" size="mini" @click="handleManual">查询</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
          </el-form-item>
        </el-form>
        <!-- 标本单选表格(带多选框样式) -->
        <el-table
          border
          v-loading="loading"
          :data="filteredSpecimenData"
          height="478"
          style="width: 100%"
          ref="specimenTable"
          :row-key="row => row.value"
          @select="handleSpecimenSelect"
        >
          <el-table-column type="selection" width="40px" align="center" />
          <el-table-column label="序号" align="center" type="index" width="50px" />
          <el-table-column label="标本名称" align="center" prop="label" show-overflow-tooltip />
        </el-table>
      </el-col>
      <!-- 第二列:中间选中项目列表 -->
      <el-col :span="8" :xs="24">
        <el-form :model="form" size="small" :inline="true" label-width="68px" style="height: 45px" @submit.native.prevent />
        <el-table
          border
          v-loading="loading"
          :data="OnenewpacName"
          height="478"
          style="width: 100%"
        >
          <el-table-column label="已选项目列表" align="center" prop="proName" />
          <el-table-column label="操作" align="center" width="85">
            <template slot-scope="scope">
              <el-button size="mini" type="text" icon="el-icon-delete" @click="handledbelete(scope.row)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
        <div class="dialog-footer1" style="margin-top: 60px; text-align: center;">
          <el-button type="primary" @click="submitrighr">确认并保存</el-button>
          <el-button @click="cancell">取 消</el-button>
        </div>
      </el-col>
      <!-- 第三列:搜索 + 项目选择 -->
      <el-col :span="8" :xs="24">
        <el-form
          :model="queryParams1"
          ref="queryForm"
          size="small"
          :inline="true"
          v-show="showSearch"
          label-width="68px"
          style="height: 45px"
          @submit.native.prevent
        >
          <el-form-item label="项目名称" prop="proName">
            <el-input
              ref="inputName"
              v-model="queryParams1.proName"
              placeholder="请输入项目名称"
              clearable
              @keyup.enter.native="handleSearchFor"
              style="width: 140px"
            />
          </el-form-item>
          <el-form-item>
            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchFor">搜索</el-button>
          </el-form-item>
        </el-form>
        <el-table
          border
          v-loading="loading"
          ref="tre"
          :data="Treedata"
          @selection-change="handleChangesingle"
          height="478"
          style="width: 100%"
        >
          <el-table-column type="selection" width="40px" align="center" />
          <el-table-column label="项目名称" align="center" prop="proName" show-overflow-tooltip />
        </el-table>
      </el-col>
    </el-row>
  </div>
</template>
<script>
import { searchBiaoben, delBiaoben, editBiaoben } from "@/api/hosp/biaoben";
import { debounce } from 'lodash';
export default {
  name: "Part",
  data() {
    return {
      loading: false,
      OnenewpacName: [],
      Treedata: [],
      originalTreedata: [],
      queryParams: {
        tjh: '',
        tjCategory: null,
      },
      queryParams1: {
        proName: '',
      },
      form: {
        price: '',
      },
      showSearch: true,
      filteredSpecimenData: [],
      originalSpecimenData: [],
    };
  },
  dicts: ["sys_dict_specimen"],
  created() {
    this.fetchInitialBiaobenData();
    this.initializeSpecimenData();
    this.debouncedFetchBiaobenData = debounce(this.fetchBiaobenData, 300);
  },
  watch: {
    'dict.type.sys_dict_specimen': {
      handler(newVal) {
        if (newVal && newVal.length > 0) {
          console.log('标本字典数据加载:', newVal);
          this.originalSpecimenData = [...newVal];
          this.filteredSpecimenData = [...newVal];
        } else {
          console.warn('标本字典数据为空或未加载');
        }
      },
      deep: true,
      immediate: true,
    },
  },
  methods: {
    initializeSpecimenData() {
      if (this.dict?.type?.sys_dict_specimen) {
        this.originalSpecimenData = [...this.dict.type.sys_dict_specimen];
        this.filteredSpecimenData = [...this.originalSpecimenData];
        console.log('初始化标本数据:', this.originalSpecimenData);
      } else {
        this.$message.warning('标本数据未加载,请检查字典配置');
        this.originalSpecimenData = [];
        this.filteredSpecimenData = [];
      }
    },
    handleSearchFor() {
      const searchText = this.queryParams1.proName?.trim().toLowerCase() || '';
      if (searchText) {
        this.Treedata = this.originalTreedata.filter(item =>
          item.proName.toLowerCase().includes(searchText)
        );
        this.Treedata.length
          ? this.$message.success('查询成功')
          : this.$message.warning('未找到匹配的项目');
      } else {
        this.Treedata = [...this.originalTreedata];
        this.$message.info('已显示所有项目');
      }
      this.$refs.tre.clearSelection();
    },
    resetQuery() {
      this.$refs.queryForm.resetFields();
      this.queryParams.tjh = '';
      this.queryParams.tjCategory = null;
      this.OnenewpacName = [];
      this.filteredSpecimenData = [...this.originalSpecimenData];
      this.$refs.specimenTable.clearSelection();
      this.$message.success('已重置查询条件和标本数据');
    },
    handleManual() {
      const searchText = this.queryParams.tjh?.trim().toLowerCase() || '';
      this.filteredSpecimenData = searchText
        ? this.originalSpecimenData.filter(item => item.label.toLowerCase().includes(searchText))
        : [...this.originalSpecimenData];
      this.queryParams.tjCategory = null;
      this.OnenewpacName = [];
      this.$refs.specimenTable.clearSelection();
      this.$message[this.filteredSpecimenData.length ? 'success' : 'warning'](
        this.filteredSpecimenData.length ? '查询成功' : '未找到匹配的标本'
      );
    },
    handleSpecimenSelect(selection, row) {
      console.log('标本选择触发:', { selection, row });
      this.$refs.specimenTable.clearSelection();
      if (selection.includes(row)) {
        this.$refs.specimenTable.toggleRowSelection(row, true);
        if (this.queryParams.tjCategory !== row.value) {
          this.queryParams.tjCategory = row.value;
          console.log('选中的标本 value:', this.queryParams.tjCategory);
          this.debouncedFetchBiaobenData(row.value);
        }
      } else {
        this.queryParams.tjCategory = null;
        this.OnenewpacName = [];
        console.log('标本选择已清空');
      }
    },
    handleChangesingle(selection) {
      if (selection.length > 0) {
        selection.forEach(item => {
          if (!this.OnenewpacName.some(existing => existing.proId === item.proId)) {
            this.OnenewpacName.push({ ...item });
          }
        });
        this.$refs.tre.clearSelection();
      }
    },
    cancell() {
      this.openOne = false;
    },
    submitrighr() {
      if (!this.queryParams.tjCategory) {
        this.$message.error('请先选择一个标本');
        return;
      }
      if (!this.OnenewpacName.length) {
        this.$message.error('请至少选择一个项目');
        return;
      }
      const proIds = this.OnenewpacName.map(item => item.proId);
      const bblx = this.queryParams.tjCategory;
      this.loading = true;
      editBiaoben({ proIds, bblx })
        .then(() => {
          this.$message.success('保存成功');
          this.OnenewpacName = [];
          this.queryParams.tjCategory = null;
          this.$refs.specimenTable.clearSelection();
          this.loading = false;
        })
        .catch(error => {
          this.$message.error('保存失败');
          console.error(error);
          this.loading = false;
        });
    },
    handledbelete(row) {
      this.loading = true;
      delBiaoben({ proId: row.proId })
        .then(() => {
          this.OnenewpacName = this.OnenewpacName.filter(item => item.proId !== row.proId);
          this.$message.success('删除成功');
          this.loading = false;
        })
        .catch(error => {
          this.$message.error('删除失败');
          console.error(error);
          this.loading = false;
        });
    },
    fetchBiaobenData(bblx) {
      console.log('调用 searchBiaoben(中间表格),参数:', { bblx });
      this.loading = true;
      searchBiaoben({ bblx })
        .then(response => {
          this.OnenewpacName = response.data || [];
          this.loading = false;
        })
        .catch(error => {
          this.$message.error('获取标本数据失败');
          console.error(error);
          this.loading = false;
        });
    },
    fetchInitialBiaobenData() {
      console.log('调用 searchBiaoben(初始加载,右侧表格),参数: {}');
      this.loading = true;
      searchBiaoben({})
        .then(response => {
          this.originalTreedata = response.data || [];
          this.Treedata = [...this.originalTreedata];
          this.loading = false;
        })
        .catch(error => {
          this.$message.error('获取初始项目数据失败');
          console.error(error);
          this.loading = false;
        });
    },
  },
};
</script>
<style scoped>
.app-container {
  padding: 20px;
}
.dialog-footer1 {
  margin-top: 60px;
  text-align: center;
}
</style>
src/views/hosp/part/index.vue
@@ -1,123 +1,320 @@
<template>
    <div class="app-container">
        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
    <el-row :gutter="24">
      <!-- 第一列:单选标本 -->
      <el-col :span="8" :xs="24">
        <el-form
          :model="queryParams"
          ref="queryForm"
          size="small"
          :inline="true"
          label-width="68px"
          style="height: 45px"
          @submit.native.prevent
        >
            <el-form-item label="项目名称" prop="tjh">
                <el-input v-model="queryParams.tjh" placeholder="请输入项目名称" clearable />
            <el-input
              v-model="queryParams.tjh"
              placeholder="请输入项目名称"
              clearable
              @keyup.enter.native="handleManual"
            />
            </el-form-item>
            <el-form-item>
                <el-button type="primary" size="mini" @click="handleManual">查询</el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
            </el-form-item>
        </el-form>
        <el-table border v-loading="loading" :data="partList" height="350">
        <!-- 标本单选表格(带多选框样式) -->
        <el-table
          border
          v-loading="loading"
          :data="filteredSpecimenData"
          height="478"
          style="width: 100%"
          ref="specimenTable"
          :row-key="row => row.value"
          @select="handleSpecimenSelect"
        >
            <el-table-column type="selection" width="40px" align="center" />
            <el-table-column label="序号" align="center" prop="newID" width="50px" />
            <el-table-column label="项目名称" align="center" prop="groupingName" />
          <el-table-column label="序号" align="center" type="index" width="50px" />
          <el-table-column label="标本名称" align="center" prop="label" show-overflow-tooltip />
        </el-table>
      </el-col>
        <el-dialog :title="title" :visible.sync="openOne" width="1400px" append-to-body :close-on-click-modal="false">
            <el-row :gutter="24">
                <el-col :span="15" :xs="24">
                    <el-form :model="form" ref="queryForm" size="small" :inline="true" label-width="46px"
                        style="height: 35px" @submit.native.prevent>
                        <el-form-item label="标本类型">
                            <el-input ref="inputName" v-model="form.price" placeholder="标本类型" clearable
                                style="width: 140px" />
                        </el-form-item>
                        <el-form-item>
                            <el-button icon="el-icon-refresh" size="mini" @click="resetQuerys">重置</el-button>
                        </el-form-item>
                    </el-form>
                    <el-table border v-loading="loading" :data="OnenewpacName" :row-class-name="tableRowClassName"
                        height="478">
                        <el-table-column label="原价" align="center" prop="proPrice" width="85"></el-table-column>
      <!-- 第二列:中间选中项目列表 -->
      <el-col :span="8" :xs="24">
        <el-form :model="form" size="small" :inline="true" label-width="68px" style="height: 45px" @submit.native.prevent />
        <el-table
          border
          v-loading="loading"
          :data="OnenewpacName"
          height="478"
          style="width: 100%"
        >
          <el-table-column label="已选项目列表" align="center" prop="proName" />
                        <el-table-column label="操作" align="center" width="85">
                            <template slot-scope="scope">
                                <el-button size="mini" type="text" icon="el-icon-delete"
                                    @click="handledbelete(scope.row)">删除</el-button>
              <el-button size="mini" type="text" icon="el-icon-delete" @click="handledbelete(scope.row)">删除</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </el-col>
                <el-col :span="7" :xs="24">
                    <el-form :model="queryParams1" ref="queryForm" size="small" :inline="true" v-show="showSearch"
                        label-width="68px" @submit.native.prevent>
                        <el-form-item label="项目名称" prop="proName">
                            <el-input ref="inputName" v-model="queryParams1.proName" placeholder="请输入项目名称" clearable
                                @keyup.enter.native="handleSearchFor" style="width: 140px" />
                        </el-form-item>
                        <el-form-item>
                            <el-button type="primary" icon="el-icon-search" size="mini"
                                @click="handleSearchFor">搜索</el-button>
                        </el-form-item>
                    </el-form>
                    <el-table border v-loading="loading" ref="tre" :data="Treedata"
                        @selection-change="handleChangesingle" height="478" style="width: 100%">
                        <el-table-column type="selection" width="40px" align="center" />
                        <el-table-column label="项目名称" align="center" prop="proName" width="230px" />
                        <el-table-column label="项目价格/元" align="center" prop="proPrice" width="100px" />
                    </el-table>
                </el-col>
            </el-row>
            <div slot="footer" class="dialog-footer1">
        <div class="dialog-footer1" style="margin-top: 60px; text-align: center;">
                <el-button type="primary" @click="submitrighr">确认并保存</el-button>
                <el-button @click="cancell">取 消</el-button>
            </div>
        </el-dialog>
      </el-col>
      <!-- 第三列:搜索 + 项目选择 -->
      <el-col :span="8" :xs="24">
        <el-form
          :model="queryParams1"
          ref="queryForm"
          size="small"
          :inline="true"
          v-show="showSearch"
          label-width="68px"
          style="height: 45px"
          @submit.native.prevent
        >
          <el-form-item label="项目名称" prop="proName">
            <el-input
              ref="inputName"
              v-model="queryParams1.proName"
              placeholder="请输入项目名称"
              clearable
              @keyup.enter.native="handleSearchFor"
              style="width: 140px"
            />
          </el-form-item>
          <el-form-item>
            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchFor">搜索</el-button>
          </el-form-item>
        </el-form>
        <el-table
          border
          v-loading="loading"
          ref="tre"
          :data="Treedata"
          @selection-change="handleChangesingle"
          height="478"
          style="width: 100%"
        >
          <el-table-column type="selection" width="40px" align="center" />
          <el-table-column label="项目名称" align="center" prop="proName" show-overflow-tooltip />
        </el-table>
      </el-col>
    </el-row>
    </div>
</template>
<script>
// import {  } from "@/api/system/menu";
import { searchPart, delPart, editPart } from "@/api/hosp/part";
import { debounce } from 'lodash';
export default {
    name: "Part",
    //   dicts: [
    //     "",
    //   ],
    data() {
        return {
            loading: false,
            openOne: false,
            partList: [],
      OnenewpacName: [],
            Treedata: [],
      originalTreedata: [],
            queryParams: {
        tjh: '',
        tjCategory: null,
            },
            queryParams1: {
        proName: '',
            },
            form: {
        price: '',
            },
      showSearch: true,
      filteredSpecimenData: [],
      originalSpecimenData: [],
    };
  },
  dicts: ["sys_dict_position"],
  created() {
    this.fetchInitialBiaobenData();
    this.initializeSpecimenData();
    this.debouncedFetchBiaobenData = debounce(this.fetchBiaobenData, 300);
  },
  watch: {
    'dict.type.sys_dict_position': {
      handler(newVal) {
        if (newVal && newVal.length > 0) {
          console.log('标本字典数据加载:', newVal);
          this.originalSpecimenData = [...newVal];
          this.filteredSpecimenData = [...newVal];
        } else {
          console.warn('标本字典数据为空或未加载');
        }
    },
    created() {
      deep: true,
      immediate: true,
    },
    },
    methods: {
        getList() {
    initializeSpecimenData() {
      if (this.dict?.type?.sys_dict_position) {
        this.originalSpecimenData = [...this.dict.type.sys_dict_position];
        this.filteredSpecimenData = [...this.originalSpecimenData];
        console.log('初始化标本数据:', this.originalSpecimenData);
      } else {
        this.$message.warning('标本数据未加载,请检查字典配置');
        this.originalSpecimenData = [];
        this.filteredSpecimenData = [];
      }
    },
    handleSearchFor() {
      const searchText = this.queryParams1.proName?.trim().toLowerCase() || '';
      if (searchText) {
        this.Treedata = this.originalTreedata.filter(item =>
          item.proName.toLowerCase().includes(searchText)
        );
        this.Treedata.length
          ? this.$message.success('查询成功')
          : this.$message.warning('未找到匹配的项目');
      } else {
        this.Treedata = [...this.originalTreedata];
        this.$message.info('已显示所有项目');
      }
      this.$refs.tre.clearSelection();
        },
        resetQuery() {
            this.resetForm("queryForm");
      this.$refs.queryForm.resetFields();
      this.queryParams.tjh = '';
      this.queryParams.tjCategory = null;
      this.OnenewpacName = [];
      this.filteredSpecimenData = [...this.originalSpecimenData];
      this.$refs.specimenTable.clearSelection();
      this.$message.success('已重置查询条件和标本数据');
        },
        handleManual() {
      const searchText = this.queryParams.tjh?.trim().toLowerCase() || '';
      this.filteredSpecimenData = searchText
        ? this.originalSpecimenData.filter(item => item.label.toLowerCase().includes(searchText))
        : [...this.originalSpecimenData];
      this.queryParams.tjCategory = null;
      this.OnenewpacName = [];
      this.$refs.specimenTable.clearSelection();
      this.$message[this.filteredSpecimenData.length ? 'success' : 'warning'](
        this.filteredSpecimenData.length ? '查询成功' : '未找到匹配的标本'
      );
    },
    handleSpecimenSelect(selection, row) {
      console.log('标本选择触发:', { selection, row });
      this.$refs.specimenTable.clearSelection();
      if (selection.includes(row)) {
        this.$refs.specimenTable.toggleRowSelection(row, true);
        if (this.queryParams.tjCategory !== row.value) {
          this.queryParams.tjCategory = row.value;
          console.log('选中的标本 value:', this.queryParams.tjCategory);
          this.debouncedFetchBiaobenData(row.value);
        }
      } else {
        this.queryParams.tjCategory = null;
        this.OnenewpacName = [];
        console.log('标本选择已清空');
      }
        },
        handleChangesingle(selection) {
      if (selection.length > 0) {
        selection.forEach(item => {
          if (!this.OnenewpacName.some(existing => existing.proId === item.proId)) {
            this.OnenewpacName.push({ ...item });
          }
        });
        this.$refs.tre.clearSelection();
      }
        },
        cancell() {
            this.openOne = false
      this.openOne = false;
        },
        submitrighr() {
        },
      if (!this.queryParams.tjCategory) {
        this.$message.error('请先选择一个标本');
        return;
    }
      if (!this.OnenewpacName.length) {
        this.$message.error('请至少选择一个项目');
        return;
      }
      const proIds = this.OnenewpacName.map(item => item.proId);
      const bw = this.queryParams.tjCategory;
      this.loading = true;
      editPart({ proIds, bw })
        .then(() => {
          this.$message.success('保存成功');
          this.OnenewpacName = [];
          this.queryParams.tjCategory = null;
          this.$refs.specimenTable.clearSelection();
          this.loading = false;
        })
        .catch(error => {
          this.$message.error('保存失败');
          console.error(error);
          this.loading = false;
        });
    },
    handledbelete(row) {
      this.loading = true;
      delPart({ proId: row.proId })
        .then(() => {
          this.OnenewpacName = this.OnenewpacName.filter(item => item.proId !== row.proId);
          this.$message.success('删除成功');
          this.loading = false;
        })
        .catch(error => {
          this.$message.error('删除失败');
          console.error(error);
          this.loading = false;
        });
    },
    fetchBiaobenData(bw) {
      console.log('调用 searchBiaoben(中间表格),参数:', { bw });
      this.loading = true;
      searchPart({ bw })
        .then(response => {
          this.OnenewpacName = response.data || [];
          this.loading = false;
        })
        .catch(error => {
          this.$message.error('获取标本数据失败');
          console.error(error);
          this.loading = false;
        });
    },
    fetchInitialBiaobenData() {
      console.log('调用 searchBiaoben(初始加载,右侧表格),参数: {}');
      this.loading = true;
      searchPart({})
        .then(response => {
          this.originalTreedata = response.data || [];
          this.Treedata = [...this.originalTreedata];
          this.loading = false;
        })
        .catch(error => {
          this.$message.error('获取初始项目数据失败');
          console.error(error);
          this.loading = false;
        });
    },
  },
};
</script>
<style scoped>
.app-container {
  padding: 20px;
}
.dialog-footer1 {
  margin-top: 60px;
  text-align: center;
}
</style>
src/views/system/zhiye/index.vue
@@ -494,8 +494,8 @@
                <el-input  v-model="form.zhiyeJhgly" style="width: 140px" type="number" />
              </el-form-item>
              <el-form-item label="开始接害日期" prop="zhiyeKsjhrq" label-width="100px">
                <el-date-picker clearable v-model="form.zhiyeKsjhrq" type="date"
                  value-format="yyyy-MM-dd" style="width: 200px" />
                <el-date-picker clearable v-model="form.zhiyeKsjhrq" type="date" value-format="yyyy-MM-dd"
                  style="width: 200px" />
              </el-form-item>
              <el-form-item label="工号" label-width="50px">
                <el-input  v-model="form.zhiyeGh"  />
@@ -550,9 +550,6 @@
                font-size: 16px;
                margin-right: 20px;
              ">
              <span v-if="this.tableData1[0]">{{
                this.tableData1[0].pacName || ""
              }}</span>
              已选项目条数:<span style="font-weight: 700; color: red; margin-right: 5px">{{ this.tableData1.length || 0
                }}</span>条
            </div>
@@ -2394,18 +2391,6 @@
      let cusSex = this.form.cusSex;
      this.datekey = Date.now();
      //全部套餐
      let param = {
        sex: cusSex,
        dwId: this.form.firmId || "",
      };
      if (this.form.tjType == 1) {
        if (!this.form.firmId && !this.form.firmName) {
          this.$message({
            type: "warning",
            message: "请先维护单位!",
          });
        } else if (!this.form.firmId && this.form.firmName) {
          this.taocan = true;
          this.loading = true;
          deptTreeSelect(cusSex).then((response) => {
@@ -2428,56 +2413,7 @@
            } catch (error) { }
            this.loading = false;
          });
        }
        else {
          this.taocan = true;
          this.loading = true;
          tuantiSelect(param).then((res) => {
            this.newpacName = res.data;
            try {
              if (this.tableData1.length >= 1) {
                this.newpacName.forEach((item3) => {
                  this.tableData1.forEach((item4) => {
                    item4.list.forEach((item6) => {
                      if (item6.pacName === item3.pacName) {
                        this.$nextTick(() => {
                          this.$refs.tb.toggleRowSelection(item3, true);
                        });
                        throw Error();
                      }
                    });
                  });
                });
              }
            } catch (error) { }
            this.loading = false;
          });
        }
      } else {
        this.taocan = true;
        this.loading = true;
        deptTreeSelect(cusSex).then((response) => {
          this.newpacName = response.rows;
          try {
            if (this.tableData1.length >= 1) {
              this.newpacName.forEach((item3) => {
                this.tableData1.forEach((item4) => {
                  item4.list.forEach((item6) => {
                    if (item6.pacName === item3.pacName) {
                      this.$nextTick(() => {
                        this.$refs.tb.toggleRowSelection(item3, true);
                      });
                      throw Error();
                    }
                  });
                });
              });
            }
          } catch (error) { }
          this.loading = false;
        });
      }
    },
    // 点击多选框获取选中数据
@@ -2967,6 +2903,15 @@
        });
      }
      // 如果 tjCategory 为 "02",确保选中的套餐被添加到 tableData1
      if (this.tjCategory === "02" && this.tableData.length > 0) {
        this.tableData.forEach((item) => {
          if (!this.tableData1.some((existingItem) => existingItem.pacId === item.pacId)) {
            this.tableData1.push(item);
          }
        });
      }
      this.taocan = false;
      this.defaultKeys = [];
      this.DataLists = [];