| | |
| | | <!-- 动态生成多个条形码的容器 --> |
| | | <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> |
| | |
| | | <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> |
| | |
| | | name: "Sampling", |
| | | data() { |
| | | return { |
| | | msg: "", |
| | | getNumbr: null, |
| | | list: [], |
| | | selectList: [], |
| | | selectedRows: [], |
| | |
| | | }, |
| | | created() { |
| | | // this.getNowTime(); |
| | | |
| | | getTxmmccd().then((res) => { |
| | | this.msg = Number(res.msg); |
| | | }); |
| | | this.getdate(); |
| | | }, |
| | | mounted() { |
| | |
| | | }, |
| | | |
| | | 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" }; |
| | |
| | | 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); |
| | |
| | | this.resetForm("form"); |
| | | }, |
| | | hb() { |
| | | // console.log(this.queryParams.tjNum); |
| | | if (this.queryParams.tjNum != null) { |
| | | this.handleQuery(); |
| | | } |
| | |
| | | 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 = []; |
| | |
| | | }); |
| | | }, |
| | | |
| | | /* 点击合并按钮 */ |
| | | /* 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() { |
| | | // 检查是否选中了数据 |
| | |
| | | |
| | | mergeCaiYang(data).then((response) => { |
| | | this.$message.success("合并成功。"); |
| | | console.log("合并的行:", this.selectedRows); |
| | | // console.log("合并的行:", this.selectedRows); |
| | | // this.getList(); |
| | | this.fetchData(this.selectedRows[0].cusId); |
| | | }); |
| | |
| | | return; |
| | | } |
| | | |
| | | console.log("撤销的已合并项目ID:", data); |
| | | // console.log("撤销的已合并项目ID:", data); |
| | | |
| | | // 调用撤销采样的接口 |
| | | chexiaoCaiYang(data) |
| | |
| | | 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 更新 |
| | | |
| | |
| | | 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; |
| | |
| | | padding: 0; |
| | | font-size: 18px; |
| | | width: 70%; |
| | | font-family: "Arial Black", sans-serif; /* 设置黑体 */ |
| | | } |
| | | p { |
| | | margin: 0; |
| | |
| | | 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; |
| | |
| | | } |
| | | }, |
| | | |
| | | // 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]) { |
| | |
| | | }, |
| | | |
| | | handleChange(selection) { |
| | | console.log(selection); |
| | | // console.log(selection); |
| | | |
| | | this.selectList = selection; |
| | | |
| | |
| | | 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(); |
| | | }); |
| | | }, |
| | | |
| | | // 单选按钮 |