qx
qx
2025-04-03 1901de2a3138adeabf118aa80303b520200960c7
qx
2个文件已修改
335 ■■■■ 已修改文件
src/views/sampling/sampling/index.vue 159 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/comp/index.vue 176 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sampling/sampling/index.vue
@@ -249,7 +249,7 @@
      piliangList: [],
      msg: "",
      getNumbr: null,
      valueUrl: "ws://127.0.0.1:6789/websocket",
      valueUrl: "ws://127.0.0.1/websocket",
      webSocket: null,
      list: [],
      selectList: [],
@@ -532,40 +532,42 @@
      return ""; // 如果 applicationTime 无效,返回空字符串
    },
    /** 查询体检采样管理列表 */
    getList() {
      this.queryParams.compId = this.CheckBox.drugManufacturerId;
      this.loading1 = true;
      this.queryParams.isSignFor = this.tjStatus;
    /** 查询体检采样管理列表 */
getList() {
  this.queryParams.compId = this.CheckBox.drugManufacturerId;
  this.loading1 = true;
  this.queryParams.isSignFor = this.tjStatus;
      if (this.createTimeList) {
        this.queryParams.beginTime = this.createTimeList[0];
        this.queryParams.endTime = this.createTimeList[1];
      } else {
        this.queryParams.beginTime = null;
        this.queryParams.endTime = null;
  if (this.createTimeList) {
    this.queryParams.beginTime = this.createTimeList[0];
    this.queryParams.endTime = this.createTimeList[1];
  } else {
    this.queryParams.beginTime = null;
    this.queryParams.endTime = null;
  }
  getList(this.queryParams).then((response) => {
    this.loading1 = false;
    if (response.data && response.data.list && response.data.list.length > 0) {
      this.samplingList = response.data.list;
      this.total = response.data.total;
      // 移除默认选中第一行的逻辑
      // this.$nextTick(() => {
      //   this.$refs.tb.toggleRowSelection(this.samplingList[0], true); // 默认选中第一行
      //   this.fetchData(this.samplingList[0].tjNumber); // 刷新右侧表格
      // });
    } else {
      this.samplingList = [];
      this.tableList = [];
      this.selectList = []; // 清空 selectList
      this.ids = []; // 清空 ids
      if (this.$refs.tab1) {
        this.$refs.tab1.clearSelection(); // 清空右侧表格选中状态
      }
      getList(this.queryParams).then((response) => {
        this.loading1 = false;
        if (response.data && response.data.list && response.data.list.length > 0) {
          this.samplingList = response.data.list;
          this.total = response.data.total;
          this.$nextTick(() => {
            this.$refs.tb.toggleRowSelection(this.samplingList[0], true); // 默认选中第一行
            this.fetchData(this.samplingList[0].tjNumber); // 刷新右侧表格
          });
        } else {
          this.samplingList = [];
          this.tableList = [];
          this.selectList = []; // 清空 selectList
          this.ids = []; // 清空 ids
          if (this.$refs.tab1) {
            this.$refs.tab1.clearSelection(); // 清空右侧表格选中状态
          }
        }
        this.loading1 = false;
      });
    },
    }
    this.loading1 = false;
  });
},
    // 取消按钮
    cancel() {
      this.open = false;
@@ -602,8 +604,19 @@
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.createTimeList = [];
      this.handleQuery();
      this.createTimeList = []; // 清空日期范围
      this.queryParams.tjNumber = null; // 清空体检号
      this.queryParams.name = null; // 清空姓名
      this.queryParams.tjCompName = null; // 清空单位名称
      this.selectList = []; // 清空右侧选中项
      this.selectedRows = []; // 清空左侧选中项
      this.tableList = []; // 清空右侧表格数据
      this.ids = []; // 清空选中的 ID
      this.$refs.tb.clearSelection(); // 清空左侧表格选中状态
      if (this.$refs.tab1) {
        this.$refs.tab1.clearSelection(); // 清空右侧表格选中状态
      }
      this.handleQuery(); // 重新查询
    },
    handleSelectionChange(selection) {
@@ -657,9 +670,9 @@
            if (response.data) {
              this.tableList = response.data;
              this.$nextTick(() => {
                this.$refs.elTable.doLayout(); // 通过 ref 调用表格方法
                if (this.$refs.tab1) {
                  this.$refs.tab1.clearSelection(); // 清空之前的选中状态
                  this.$refs.tab1.doLayout(); // 修改为正确的 ref 名称
                  this.$refs.tab1.clearSelection(); // 清空选中状态
                }
              });
              resolve(this.tableList);
@@ -910,6 +923,7 @@
      };
      websocket.onopen = () => {
        this.websocket = websocket;
        console.log(this.selectList, "this.selectList")
        this.dayinData = this.selectList.map((item) => ({
          jyxh: item.jyxh,
          proName: item.proName,
@@ -919,6 +933,8 @@
          cardId: item.cardId,
          tjTime: item.createTime,
        }));
        // 连接设备
        this.jsonObj = {
          type: "3",
@@ -927,7 +943,12 @@
          },
        };
        var jStr = JSON.stringify(this.jsonObj);
        console.log(jStr, "jStr");
        this.websocket.send(jStr);
        this.$refs.tab1.clearSelection(); // 清除右侧表格的选中状态
        this.selectList = []; // 清空 selectList
        this.ids = []; // 清空 ids
        this.jsonObj = {};
        // this.dialogVisible = false;
      };
@@ -945,9 +966,7 @@
        .then((res) => {
          if (res.code === 200) {
            this.buda(); // 打印条码
            this.$refs.tab1.clearSelection(); // 清除右侧表格的选中状态
            this.selectList = []; // 清空 selectList
            this.ids = []; // 清空 ids
            this.getList(); // 刷新左侧表格
            console.log("采样后 - selectList:", this.selectList, "qiehuan:", this.qiehuan);
          } else {
@@ -978,35 +997,37 @@
        });
    },
    // 单选按钮
    radioChange(value) {
      this.loading = true;
      this.queryParams.isSignFor = value;
      getList(this.queryParams).then((response) => {
        if (response.data) {
          if (response.data.list == null) {
            this.samplingList = [];
            this.tableList = [];
            this.loading = false;
          } else {
            this.samplingList = response.data.list;
            this.loading = false;
            if (this.samplingList.length != 0) {
              this.$nextTick(() => {
                this.$refs.tb.toggleRowSelection(this.samplingList[0], true);
              });
            } else {
              this.$refs.tb.clearSelection();
            }
          }
          this.total = response.data.total;
          this.loading = false;
        } else {
          this.samplingList = [];
          this.tableList = [];
          this.loading = false;
        }
      });
    },
   // 单选按钮
radioChange(value) {
  this.loading = true;
  this.queryParams.isSignFor = value;
  getList(this.queryParams).then((response) => {
    if (response.data) {
      if (response.data.list == null) {
        this.samplingList = [];
        this.tableList = [];
        this.loading = false;
      } else {
        this.samplingList = response.data.list;
        this.loading = false;
        // 移除默认选中第一行的逻辑
        // if (this.samplingList.length != 0) {
        //   this.$nextTick(() => {
        //     this.$refs.tb.toggleRowSelection(this.samplingList[0], true);
        //   });
        // } else {
        //   this.$refs.tb.clearSelection();
        // }
      }
      this.total = response.data.total;
      this.loading = false;
    } else {
      this.samplingList = [];
      this.tableList = [];
      this.loading = false;
    }
  });
},
    // 默认接受四个值 { 当前行的值, 当前列的值, 行的下标, 列的下标 }
    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
src/views/system/comp/index.vue
@@ -1,45 +1,27 @@
<template>
  <div class="app-container">
    <el-dialog title="选择套餐" :visible.sync="taocan" width="70%" height="700px" :close-on-click-modal="false">
  <!-- <el-form :model="queryParam" ref="queryForm" size="small" :inline="true" label-width="auto">
    <el-form-item label="套餐名称" prop="pacName">
      <el-input
        v-model="queryParam.pacName"
        placeholder="请输入套餐名称"
        clearable
        @keyup.enter.native="handle"
        style="width: 200px"
      />
    </el-form-item>
    <el-form-item>
      <el-button
        type="primary"
        icon="el-icon-search"
        size="mini"
        @click="handle"
      >搜索</el-button>
    </el-form-item>
  </el-form> -->
  <el-table
    v-loading="loading"
    element-loading-text="正在加载中..."
    element-loading-spinner="el-icon-loading"
    border
    :data="newpacName1"
    @selection-change="handleSelectionChange1"
    height="450px"
    ref="tb"
  >
    <el-table-column type="selection" width="40px" align="center" label="选择" />
    <el-table-column label="套餐名称" align="center" prop="pacName" width="120px" />
    <el-table-column label="套餐价格" align="center" prop="price" width="120px" />
    <el-table-column label="套餐明细" align="center" prop="allProName" :show-overflow-tooltip="true" />
  </el-table>
  <span slot="footer" class="dialog-footer">
    <el-button @click="cancel1">取 消</el-button>
    <el-button type="primary" @click="submit">确 定</el-button>
  </span>
</el-dialog>
      <!-- <el-form :model="queryParam" ref="queryForm" size="small" :inline="true" label-width="auto">
        <el-form-item label="套餐名称" prop="pacName">
          <el-input v-model="queryParam.pacName" placeholder="请输入套餐名称" clearable @keyup.enter.native="handle"
            style="width: 200px" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" size="mini" @click="handle">搜索</el-button>
        </el-form-item>
      </el-form> -->
      <el-table v-loading="loading" element-loading-text="正在加载中..." element-loading-spinner="el-icon-loading" border
        :data="newpacName1" @selection-change="handleSelectionChange1" height="450px" ref="tb">
        <el-table-column type="selection" width="40px" align="center" label="选择" />
        <el-table-column label="套餐名称" align="center" prop="pacName" width="120px" />
        <el-table-column label="套餐价格" align="center" prop="price" width="120px" />
        <el-table-column label="套餐明细" align="center" prop="allProName" :show-overflow-tooltip="true" />
      </el-table>
      <span slot="footer" class="dialog-footer">
        <el-button @click="cancel1">取 消</el-button>
        <el-button type="primary" @click="submit">确 定</el-button>
      </span>
    </el-dialog>
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"
      @submit.native.prevent>
      <el-form-item label="单位名称" prop="cnName">
@@ -331,7 +313,7 @@
            </el-table>
            <div style="font-size: 16px;margin-top: 10px;">当前项目条数:<span style="font-weight: 700;">{{
              OnenewpacName.length
            }}</span>条</div>
                }}</span>条</div>
          </el-col>
          <el-col :span="2" :xs="24">
@@ -417,7 +399,7 @@
            </el-table>
            <div style="font-size: 16px;margin-top: 10px;">当前项目条数:<span style="font-weight: 700;">{{
              OnenewpacName.length
            }}</span>条</div>
                }}</span>条</div>
          </el-col>
          <el-col :span="2" :xs="24">
@@ -512,7 +494,7 @@
            </el-table>
            <div style="font-size: 16px;margin-top: 10px;">当前项目条数:<span style="font-weight: 700;">{{
              OnenewpacName.length
            }}</span>条</div>
                }}</span>条</div>
          </el-col>
          <el-col :span="2" :xs="24">
@@ -640,7 +622,7 @@
  getDetails,
} from "@/api/system/comp";
import { deptTreeSelect, projectGetList, getconfigKey,} from "@/api/system/tijian";
import { deptTreeSelect, projectGetList, getconfigKey, } from "@/api/system/tijian";
import { getInfo } from "@/api/login";
export default {
  name: "Comp",
@@ -662,7 +644,7 @@
      }
    };
    return {
      newpacName1: [],
      taocan: false,
      queryParam: {
@@ -803,60 +785,76 @@
    this.getList();
  },
  methods: {
    handle() {
      this.loading = true;
      deptTreeSelect(this.forms.sex, this.queryParam).then((res) => {
        if (res.rows) {
          this.newpacName1 = res.rows; // 更新套餐列表
        } else {
          this.newpacName1 = [];
        }
        this.loading = false;
      }).catch(() => {
        this.loading = false;
        this.$modal.msgError("搜索失败,请稍后重试");
      });
    },
    handleSelectionChange1(selection) {
  // 实现单选逻辑
  if (selection.length > 1) {
    const lastSelected = selection[selection.length - 1];
    this.$refs.tb.clearSelection();
    this.$refs.tb.toggleRowSelection(lastSelected, true);
    this.selectedPackage = lastSelected;
  } else if (selection.length === 1) {
    this.selectedPackage = selection[0];
  } else {
    this.selectedPackage = null;
  }
},
      // 实现单选逻辑
      if (selection.length > 1) {
        const lastSelected = selection[selection.length - 1];
        this.$refs.tb.clearSelection();
        this.$refs.tb.toggleRowSelection(lastSelected, true);
        this.selectedPackage = lastSelected;
      } else if (selection.length === 1) {
        this.selectedPackage = selection[0];
      } else {
        this.selectedPackage = null;
      }
    },
submit() {
  if (!this.selectedPackage) {
    this.$modal.msgError("请先选择一个套餐");
    return;
  }
    submit() {
      if (!this.selectedPackage) {
        this.$modal.msgError("请先选择一个套餐");
        return;
      }
  // 清空左侧表格
  this.OnenewpacName = [];
      // 清空左侧表格
      this.OnenewpacName = [];
  // 获取选中的套餐项目列表
  const newProjects = this.selectedPackage.tjProjectList || [];
      // 获取选中的套餐项目列表
      const newProjects = this.selectedPackage.tjProjectList || [];
  // 将选中的套餐项目添加到左侧表格
  this.loading = true;
  newProjects.forEach(project => {
    // 为每个项目设置默认折扣和现价
    this.$set(project, 'limits', 10); // 默认折扣 10(即原价)
    this.$set(project, 'ysPrice', project.proPrice); // 现价初始化为原价
    this.OnenewpacName.push(project);
  });
      // 将选中的套餐项目添加到左侧表格
      this.loading = true;
      newProjects.forEach(project => {
        // 为每个项目设置默认折扣和现价
        this.$set(project, 'limits', 10); // 默认折扣 10(即原价)
        this.$set(project, 'ysPrice', project.proPrice); // 现价初始化为原价
        this.OnenewpacName.push(project);
      });
  // 更新总价和现价
  this.queryParams.price = this.OnenewpacName.reduce((sum, item) => {
    return sum + (item.proPrice || 0);
  }, 0);
      // 更新总价和现价
      this.queryParams.price = this.OnenewpacName.reduce((sum, item) => {
        return sum + (item.proPrice || 0);
      }, 0);
  this.queryParams.xianprice = this.OnenewpacName.reduce((sum, item) => {
    return sum + (item.ysPrice || 0);
  }, 0);
      this.queryParams.xianprice = this.OnenewpacName.reduce((sum, item) => {
        return sum + (item.ysPrice || 0);
      }, 0);
  // 更新优惠值
  this.youhui = this.queryParams.price > 0
    ? (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10
    : 0;
      // 更新优惠值
      this.youhui = this.queryParams.price > 0
        ? (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10
        : 0;
  // 关闭对话框
  this.taocan = false;
  this.loading = false;
  this.$modal.msgSuccess("添加成功");
},
      // 关闭对话框
      this.taocan = false;
      this.loading = false;
      this.$modal.msgSuccess("添加成功");
    },
    cancel1() {
      this.taocan = false;
    },