1
lkk
2025-04-11 5c8adc16e9b0c0e71998d3cefc35170fa4a60900
src/components/public/index.vue
@@ -17,7 +17,7 @@
        :inline="true"
        label-width="68px"
      > -->
      <!-- <el-form-item label="病种名称" prop="bingzhong">
        <!-- <el-form-item label="病种名称" prop="bingzhong">
          <el-input
            v-model="queryParams.bingzhong"
            placeholder="请输入简称"
@@ -44,22 +44,21 @@
            >搜索</el-button
          >
        </el-form-item> -->
      <!-- <el-form-item>
        <!-- <el-form-item>
          <h3 >{{ queryParams.proName  || '暂无项目名称'  }}</h3>
        </el-form-item> -->
      <!-- <el-form-item>
        <!-- <el-form-item>
          <h3 style="margin-left: 160px">已选项目</h3>
        </el-form-item> -->
      <!-- </el-form> -->
      <h2 style="text-align: center; margin-top: -30px">
        {{ queryParams.proName || "暂无项目名称" }}
      </h2>
      <h2 style="text-align: center;margin-top: -30px;">{{ queryParams.proName  || '暂无项目名称'  }}</h2>
      <div style="display: flex; width: 100%">
        <div style="width: 50%; margin-right: 40px">
          <el-table
            :data="dataList"
            ref="multipleTable"
            v-loading="loading"
            row-key="aid"
            @selection-change="handleSelectionChange"
            border
            height="420px"
@@ -159,10 +158,6 @@
      type: Array,
      default: () => [],
    },
    proSex: {
      type: String,
      default: "2"
    }
  },
  data() {
    return {
@@ -170,7 +165,7 @@
      // 弹出层标题
      title: "",
      yxbx: "",
      proName: "",
      proName:'',
      //   lastDesc: "",
      total: 0,
      dataList: [],
@@ -183,8 +178,8 @@
      queryParams: {
        bingzhong: "",
        bzPinyin: "",
        proId: "",
        proSex: "2",
        proId:"",
      //   proName:"",
        pageNum: 1,
        pageSize: 10,
      },
@@ -209,24 +204,15 @@
        if (newVal && newVal.length > 0) {
          const firstProject = newVal[0]; // 你也可以遍历所有项目,看你业务需求
          this.queryParams.proId = firstProject.proId; // 假设项目中叫 id
          this.proName = firstProject.proName;
          // this.queryParams.proName = firstProject.proName;
          this.proName = firstProject.proName
        }
      },
    },
    proSex: {
      handler(newVal) {
        this.queryParams.proSex = newVal;
        this.getList();
      },
      immediate: true
    }
  },
  mounted() {},
  created() {
    this.queryParams.proSex = this.proSex;
    this.getList();
  },
  created() {},
  methods: {
    async getList() {
      try {
@@ -251,6 +237,9 @@
      if (!this.fList?.rulesList?.length) return;
      await this.$nextTick();
      // 先清除所有选择
      this.$refs.multipleTable?.clearSelection();
      // 再进行选择
      this.dataList.forEach((item) => {
        const shouldSelect = this.fList.rulesList.some(
          (rule) => rule.aid === item.aid
@@ -279,8 +268,8 @@
    },
    handleSelectionChange(selection) {
      // this.list = selection;
      this.list = [...selection];
      console.log('Selection changed:', selection);
      this.list = [...selection]; // 使用展开运算符创建新数组
      this.updateFormContent(selection);
    },
@@ -295,8 +284,9 @@
      this.form.desc = "";
      this.form.jcsj = "";
      // 使用map和join替代forEach和字符串拼接
      // 只有在有选中项时才进行拼接
      if (selection.length > 0) {
        // 使用map和join替代forEach和字符串拼接
        this.form.desc = selection
          .map((item) => item.bingzhong || item.ruleStr)
          .filter(Boolean)