lkk
2024-10-30 42474a7ce3521994560ef7810f670ec4c0411619
10.30
3个文件已修改
355 ■■■■ 已修改文件
src/api/system/dyjl.js 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sampling/sampling/index.vue 304 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/dzcx/index.vue 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/system/dyjl.js
@@ -42,3 +42,11 @@
        method: 'delete'
    })
}
// 删除体检导检单打印记录
export function exportDyjl() {
    return request({
        url: '/system/dyjl/export',
        method: 'post'
    })
}
src/views/sampling/sampling/index.vue
@@ -274,12 +274,14 @@
        <!-- 动态生成多个条形码的容器 -->
        <div v-for="(item, index) in selectList" :key="index">
          <svg :id="'barcode' + index"></svg>
          <!-- <div class="name">{{ item.proName }}</div>
          <div class="name1">{{ item.proName }}</div> -->
          <div class="name">{{ getTruncatedName(item.proName).truncated }}</div>
          <div class="name1">
            {{ getTruncatedName(item.proName).remaining }}
          </div>
          <!-- <div class="name">{{ item.proName.slice(0, msg) }}</div>
          <div class="name1">
            {{ item.proName.slice(msg) }}
          </div> -->
          <div class="last">
            <p>{{ item.cusName }}</p>
            <div>
@@ -290,6 +292,7 @@
          <div class="tj">
            <span>体检中心</span>
            <span>{{ item.cardId.substring(0, 14) }}</span>
            <!-- <span>{{ item.cardId ? item.cardId.substring(0, 14) : '' }}</span> -->
          </div>
          <div class="tj">
            <span>{{ item.jyxh }}</span>
@@ -369,6 +372,8 @@
  name: "Sampling",
  data() {
    return {
      msg: "",
      getNumbr: null,
      list: [],
      selectList: [],
      selectedRows: [],
@@ -452,7 +457,9 @@
  },
  created() {
    // this.getNowTime();
    getTxmmccd().then((res) => {
      this.msg = Number(res.msg);
    });
    this.getdate();
  },
  mounted() {
@@ -470,73 +477,31 @@
  },
  methods: {
    async getTruncatedName(proName) {
      try {
        const res = await getTxmmccd(); // 确保使用 async/await
        console.log(res, 4545);
    getTruncatedName(proName) {
      // 去掉所有空格
      const trimmedProName = proName.replace(/\s+/g, "");
      const number = this.msg;
        // 去掉所有空格
        const trimmedProName = proName.replace(/\s+/g, "");
        // 检查 res 是否有效
        if (res && res.msg) {
          const number = Number(res.msg);
          console.log(number, 4444);
          const truncated =
            trimmedProName.length > number
              ? trimmedProName.slice(0, number)
              : trimmedProName;
          const remaining =
            trimmedProName.length > number ? trimmedProName.slice(number) : "";
          return { truncated, remaining }; // 返回结果
        } else {
          // 如果 res 无效,使用默认值
          const truncated =
            trimmedProName.length > 35
              ? trimmedProName.slice(0, 35)
              : trimmedProName;
          const remaining =
            trimmedProName.length > 35 ? trimmedProName.slice(35) : "";
          return { truncated, remaining }; // 确保返回
        }
      } catch (error) {
        console.error("Error fetching data:", error);
        return { truncated: "", remaining: "" }; // 捕获错误时的返回值
      }
      const truncated =
        trimmedProName.length > number
          ? trimmedProName.slice(0, number)
          : trimmedProName;
      const remaining =
        trimmedProName.length > number ? trimmedProName.slice(number) : "";
      return { truncated, remaining }; // 返回结果
    },
    /* getTruncatedName(proName) {
      getTxmmccd().then((res) => {
        console.log(res, 4545);
        const number = Number(res.msg);
        console.log(number, 4444);
        if (res) {
          const trimmedProName = proName.replace(/\s+/g, ""); // 去掉所有空格
          const truncated =
            trimmedProName.length > res.msg
              ? trimmedProName.slice(0, res.msg)
              : trimmedProName;
          const remaining =
            trimmedProName.length > res.msg
              ? trimmedProName.slice(res.msg)
              : "";
          return { truncated, remaining };
        } else {
          res.msg == "35";
        }
      }); */
    /* const trimmedProName = proName.replace(/\s+/g, ""); // 去掉所有空格
        const truncated =
          trimmedProName.length > 35
            ? trimmedProName.slice(0, 35)
            : trimmedProName;
        const remaining =
          trimmedProName.length > 35 ? trimmedProName.slice(35) : "";
        return { truncated, remaining }; */
    // },
    /* getTruncatedName(proName) {
      const trimmedProName = proName.replace(/\s+/g, ""); // 去掉所有空格
      const truncated =
        trimmedProName.length > 35
          ? trimmedProName.slice(0, 35)
          : trimmedProName;
      const remaining =
        trimmedProName.length > 35 ? trimmedProName.slice(35) : "";
      return { truncated, remaining };
    }, */
    // 示例的日期格式化方法
    formatDate(date) {
      const options = { year: "numeric", month: "2-digit", day: "2-digit" };
@@ -612,7 +577,7 @@
            return;
          } else {
            this.samplingList = response.data.list;
            console.log(this.samplingList, 888);
            // console.log(this.samplingList, 888);
            // 判断是否需要刷新右边表格
            this.$nextTick(() => {
              this.$refs.tb.toggleRowSelection(this.samplingList[0], true);
@@ -682,7 +647,6 @@
      this.resetForm("form");
    },
    hb() {
      // console.log(this.queryParams.tjNum);
      if (this.queryParams.tjNum != null) {
        this.handleQuery();
      }
@@ -750,13 +714,11 @@
    fetchData(cusId) {
      this.loading = true; // 显示加载状态
      console.log(this.tjStatus, 999);
      getCusCyList(cusId, this.tjStatus) // 调用API获取数据
        .then((response) => {
          if (response.data) {
            this.tableList = response.data; // 确认 list 存在后再进行赋值
            console.log(this.tableList, 123);
            // console.log(this.tableList, 123);
          } else {
            // 如果没有数据或 list 为空,清空表格并提示
            this.tableList = [];
@@ -770,35 +732,6 @@
        });
    },
    /* 点击合并按钮 */
    /* Merging() {
      // 检查是否选中了数据
      if (this.selectedRows.length === 0) {
        this.$message.error("至少选中一个人");
        return;
      }
      if (this.selectList.length === 0) {
        this.$message.error("请选择要合并项目");
        return;
      }
      // 获取 tableList 第一行的 specimenTypeCode 作为基准
      const baseSpecimenTypeCode = this.selectList[0].specimenTypeCode;
      // 检查 specimenTypeCode 是否一致
      const canMergeBySpecimenTypeCode = this.selectList.every(
        (row) => row.specimenTypeCode === baseSpecimenTypeCode
      );
      // 根据 canMergeBySpecimenTypeCode 判断是否合并
      if (canMergeBySpecimenTypeCode) {
        this.$message.success("合并成功。");
        console.log("合并的行:", this.selectedRows);
      } else {
        this.$message.error("项目的 不一致,无法合并!");
      }
    }, */
    /* 点击合并按钮 */
    Merging() {
      // 检查是否选中了数据
@@ -824,7 +757,7 @@
          mergeCaiYang(data).then((response) => {
            this.$message.success("合并成功。");
            console.log("合并的行:", this.selectedRows);
            // console.log("合并的行:", this.selectedRows);
            // this.getList();
            this.fetchData(this.selectedRows[0].cusId);
          });
@@ -846,7 +779,7 @@
        return;
      }
      console.log("撤销的已合并项目ID:", data);
      // console.log("撤销的已合并项目ID:", data);
      // 调用撤销采样的接口
      chexiaoCaiYang(data)
@@ -870,11 +803,11 @@
      try {
        // 请求接口并获取宽度值
        const widthResponse = await getTxmkd();
        console.log("从 getTxmkd 返回的响应:", widthResponse); // 打印后端返回值
        // console.log("从 getTxmkd 返回的响应:", widthResponse); // 打印后端返回值
        const barcodeWidth = `${Number(widthResponse.msg)}%` || "70%"; // 获取宽度值,默认使用 70%
        const jyxh = this.selectList.map((item) => item.jyxh);
        console.log(this.selectList, 999);
        // console.log(this.selectList, 999);
        await this.$nextTick(); // 确保 DOM 更新
@@ -923,6 +856,10 @@
                padding: 0; /* 重置所有元素的 margin 和 padding */
                box-sizing: border-box; /* 使内边距和边框包含在元素的总宽度和高度内 */
              }
              .name, .name1, .last, .tj, .last div span, .last p, .tj span {
                font-family: Arial, sans-serif !important; /* 重新指定字体 */
                font-weight: bold !important; /* 强制加粗 */
              }
              body {
                margin: 0;
                padding: 0;
@@ -935,6 +872,7 @@
                padding: 0;
                font-size: 18px;
                width: 70%;
                font-family: "Arial Black", sans-serif; /* 设置黑体 */
              }
              p {
                margin: 0;
@@ -952,20 +890,26 @@
                display: flex;
                font-size: 19px;
                justify-content: space-between;
                 font-family: "Arial Black", sans-serif; /* 设置黑体 */
                // font-family: "Arial Black", sans-serif !important;
              }
              .last div span {
                margin-left: 10px;
                // font-family: "Arial Black", sans-serif !important;
              }
              .last p {
                margin-left: 10px;
                margin-left: 10px;
                // font-family: "Arial Black", sans-serif !important;
              }
                p {
                margin-left: 10px;
                // font-family: "Arial Black", sans-serif !important;
              }
              .tj {
                width: 70%;
                display: flex;
                font-size: 19px;
                justify-content: space-between;
                 font-family: "Arial Black", sans-serif; /* 设置黑体 */
                 font-family: "Arial Black", sans-serif !important;
              }
              .tj span {
                margin-left: 10px;
@@ -985,129 +929,6 @@
      }
    },
    // Collection() {
    // const jyxh = this.selectList.map((item) => item.jyxh);
    // const selectedData = this.selectList.map((item) => ({
    //   jyxh: item.jyxh,
    // }));
    // console.log(this.selectList, 999);
    // console.log(selectedData, 888);
    /* this.$nextTick(() => {
        jyxh.forEach((number, index) => {
          const barcodeContent = number; // 确保 jyxh 是有效的
          if (barcodeContent && barcodeContent !== "未提供体检号") {
            JsBarcode(`#barcode${index}`, barcodeContent, {
              format: "CODE128",
              width: 2,
              height: 50,
              displayValue: false,
            });
          } else {
            console.log(`条形码内容无效: ${barcodeContent}`); // 调试输出
          }
        });
      }); */
    /* this.$nextTick(() => {
        const barcodeElement = document.querySelector("#barcode");
        // const barcodeElements = selectedData.map((_, index) =>
        //   document.querySelector(`#barcode${index}`)
        // );
        if (barcodeElement) {
          barcodeElement.forEach((element) => {
            if (element) {
              console.log(element.innerHTML); // 打印条形码的内容,看看是否生成成功
            }
          });
        } else {
          console.log("条形码元素未找到");
        }
        const newWindow = window.open("", "_blank", "width=800,height=600");
        const printContents = document.getElementById("printSection").innerHTML;
        console.log(printContents); */
    // newWindow.document.write(`
    //  <html>
    //   <head>
    //     <title>Print Barcode</title>
    //     <style>
    //       @media print {
    //        * {
    //            margin: 0;
    //            padding: 0; /* 重置所有元素的 margin 和 padding */
    //            box-sizing: border-box; /* 使内边距和边框包含在元素的总宽度和高度内 */
    //          }
    //          body {
    //             margin: 0;
    //             padding: 0;
    //           }
    //           .barcode-container {
    //             // width: 100%; /* 根据需要调整 */
    //             // text-align: center; /* 确保条形码居中 */
    //           }
    //           .name,.name1 {
    //             padding: 0;
    //             // margin: -5px auto 0;
    //             // padding-left: 20px;
    //             font-size: 18px;
    //             width: 70%;
    //             // max-height: 3.6em;
    //             // display: -webkit-box;
    //             // -webkit-box-orient: vertical;
    //             // -webkit-line-clamp: 2;
    //             // overflow: hidden;
    //             // white-space: normal;
    //           }
    //           p {
    //             margin: 0;
    //             padding: 0;
    //           }
    //           svg {
    //             display: block;
    //             width: 70%;
    //             margin-left: 10mm;
    //             // margin: 0 auto;
    //             height: auto;
    //             margin-bottom: 0;
    //           }
    //           .last {
    //             width: 66%;
    //             display: flex;
    //             font-size: 19px;
    //             // margin-left: 20px;
    //             justify-content: space-between;
    //           }
    //           .last div span{
    //             margin-left: 10px
    //             }
    //             .last p{
    //             margin-left: 10px
    //             }
    //           .tj{
    //             width: 70%;
    //             display: flex;
    //             font-size: 19px;
    //             // margin-left: 10px;
    //             justify-content: space-between;
    //           }
    //           .tj span{
    //             margin-left:10px;
    //           }
    //       }
    //     </style>
    //   </head>
    //   <body>${printContents}</body>
    // </html>
    //   `);
    //     newWindow.document.close();
    //     newWindow.focus();
    //     newWindow.print();
    //     newWindow.close();
    //   });
    // },
    tableRowClassName({ row, rowIndex }) {
      for (let i = 0; i < this.selectList.length; i++) {
        if (row === this.selectList[i]) {
@@ -1117,7 +938,7 @@
    },
    handleChange(selection) {
      console.log(selection);
      // console.log(selection);
      this.selectList = selection;
@@ -1144,10 +965,23 @@
        this.$message.error("没有已合并的项目可以撤销!");
        return;
      }
      confirmSampling(data).then((res) => {
        this.$modal.msgSuccess("采样成功");
        this.getList();
      const loadingInstance = this.$loading({
        lock: true, // 锁定屏幕
        text: "加载中...", // 加载文本
        spinner: "el-icon-loading", // 自定义加载图标
        background: "rgba(255, 255, 255, 0.7)", // 背景颜色
      });
      confirmSampling(data)
        .then((res) => {
          this.$modal.msgSuccess("采样成功");
          this.getList();
        })
        .catch((error) => {
          this.$message.error("采样失败");
        })
        .finally(() => {
          loadingInstance.close();
        });
    },
    // 单选按钮
src/views/system/dzcx/index.vue
@@ -24,7 +24,7 @@
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="登记时间" prop="createTimeList">
      <el-form-item label="打印时间" prop="createTimeList">
        <el-date-picker
          v-model="createTimeList"
          type="datetimerange"
@@ -40,23 +40,7 @@
        >
        </el-date-picker>
      </el-form-item>
    <!--   <el-form-item label="打印时间" prop="dysj">
        <el-date-picker
          clearable
          v-model="createTimeList"
          type="datetimerange"
          align="right"
          :picker-options="pickerOptions"
          style="width: 300px"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          :default-time="['00:00:00', '23:59:00']"
          format="yyyy-MM-dd HH:mm"
          value-format="yyyy-MM-dd HH:mm"
          @change="dateChangebirthday1"
        >
        </el-date-picker>
      </el-form-item> -->
      <el-form-item>
        <el-button
          type="primary"
@@ -212,6 +196,7 @@
  delDyjl,
  addDyjl,
  updateDyjl,
  exportDyjl
} from "@/api/system/dyjl";
import { getNewDateList } from "@/api/hosp/order";
import moment from "moment";
@@ -251,6 +236,7 @@
        deleted: null,
        beginTime: null,
        endTime: null,
        createTime: null,
      },
      // 表单参数
      form: {},
@@ -286,7 +272,7 @@
        ],
      },
      // 表单校验
      rules: {
      /* rules: {
        deleted: [
          {
            required: true,
@@ -294,7 +280,7 @@
            trigger: "blur",
          },
        ],
      },
      }, */
    };
  },
  created() {
@@ -380,6 +366,8 @@
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.startTime = [];
      this.createTimeList = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
@@ -428,9 +416,9 @@
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal
        .confirm('是否确认删除advice编号为"' + ids + '"的数据项?')
        .confirm('是否确认删除?')
        .then(function () {
          return delAdvice(ids);
          return delDyjl(ids);
        })
        .then(() => {
          this.getList();
@@ -440,13 +428,16 @@
    },
    /** 导出按钮操作 */
    handleExport() {
      /* this.download(
        "advice/advice/export",
      console.log(this.ids,5656);
      this.download(
        "system/dyjl/export",
        {
          ...this.queryParams,
          ids:this.ids
        },
        `advice_${new Date().getTime()}.xlsx`
      ); */
        `dyjl_${new Date().getTime()}.xlsx`
      );
    },
  },
};