From c7b33db117fd2893d7d1c93bf5d46e87d33e44d0 Mon Sep 17 00:00:00 2001 From: lkk <364857242@qq.com> Date: 星期一, 16 十二月 2024 16:08:51 +0800 Subject: [PATCH] 初审结果查询 --- src/views/sampling/sampling/index.vue | 942 ++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 768 insertions(+), 174 deletions(-) diff --git a/src/views/sampling/sampling/index.vue b/src/views/sampling/sampling/index.vue index ef9aba1..ba8ecc1 100644 --- a/src/views/sampling/sampling/index.vue +++ b/src/views/sampling/sampling/index.vue @@ -8,12 +8,14 @@ v-show="showSearch" label-width="68px" > - <el-form-item label="浣撴鍙�" prop="tjNum"> + <el-form-item label="浣撴鍙�" prop="tjNumber"> <el-input - v-model="queryParams.tjNum" + ref="inputName" + v-model="queryParams.tjNumber" placeholder="璇疯緭鍏ヤ綋妫�鍙�" clearable @keyup.enter.native="handleQuery" + @blur="hb" style="width: 170px" /> </el-form-item> @@ -30,8 +32,9 @@ <el-date-picker v-model="createTimeList" @change="dateChangebirthday1" - style="width: 240px" - value-format="yyyy-MM-dd" + :default-time="['00:00:00', '23:00:00']" + format="yyyy-MM-dd HH:mm:ss" + value-format="yyyy-MM-dd HH:mm:ss" type="daterange" range-separator="-" start-placeholder="寮�濮嬫棩鏈�" @@ -64,33 +67,77 @@ @click="handleQuery" >鏌ヨ</el-button > - <el-button + <!-- <el-button type="primary" icon="el-icon-thumb" - size="mini" + size="mini" style="margin:0 15px;" @click="Confirmreceipt" >纭閲囨牱</el-button - > + > --> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery" >閲嶇疆</el-button > </el-form-item> </el-form> - - <el-radio-group - v-model="tjStatus" - @input="radioChange" - style="margin: 10px 15px" - > - <el-radio-button label="1">鏈噰鏍�</el-radio-button> - <el-radio-button label="0">宸查噰鏍�</el-radio-button> - </el-radio-group> + <el-row :gutter="10" class="mb8"> + <el-col :span="10"> + <el-radio-group + v-model="tjStatus" + @input="radioChange" + style="margin: 10px 15px" + > + <el-radio-button label="1" :disabled="qiehuan && disabledId === 0" + >鏈噰鏍�</el-radio-button + > + <el-radio-button label="0" :disabled="qiehuan && disabledId === 1" + >宸查噰鏍�</el-radio-button + > + </el-radio-group> + </el-col> + <el-col + :span="12" + style="margin: 10px 15px" + v-if="samplingList.length > 0 && tjStatus == 1" + > + <el-button type="primary" @click="Merging">鍚堝苟椤圭洰</el-button> + <!-- <el-button + type="primary" + icon="el-icon-thumb" + style="margin: 0 15px" + v-hasPermi="['hosp:detail:add']" + @click="Confirmreceipt" + >纭閲囨牱</el-button + > --> + <el-button type="primary" :disabled="!disabled" @click="Cancellation" + >鎾ら攢鍚堝苟</el-button + > + <el-button + type="primary" + @click="Confirmreceipt" + :disabled="!selectList.length" + >閲囨牱鎵撶爜</el-button + > + </el-col> + <el-col + :span="12" + style="margin: 10px 15px" + v-show="samplingList.length > 0 && tjStatus == 0" + > + <el-button type="primary" :disabled="!selectList.length" @click="buda" + >琛ユ墦鏉$爜</el-button + > + <!-- @click="Collection" --> + <el-button type="primary" :disabled="!disabled" @click="Cancellation" + >鎾ら攢鍚堝苟</el-button + > + </el-col> + </el-row> <div style="width: 100%; margin-left: 10px; display: flex"> <div style="width: 40%; margin-right: 20px"> <el-table id="ta" - v-loading="loading" + v-loading="loading1" ref="tb" :data="samplingList" @selection-change="handleSelectionChange" @@ -102,55 +149,59 @@ <el-table-column label="浣撴鍙�" align="center" - prop="customer.tjNumber" + prop="tjNumber" width="160px" /> <el-table-column label="濮撳悕" align="center" - prop="customer.cusName" + prop="cusName" width="80px" /> <el-table-column label="鎬у埆" align="center" - prop="customer.cusSex" + prop="cusSex" width="60px" > - <template slot-scope="scope"> - <!-- {{scope.row.customer.cusSex}} --> + <!-- <template slot-scope="scope"> {{ scope.row.customer.cusSex === 0 ? "鐢�" : "濂�" }} - <!-- <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.cusSex " /> --> + </template> --> + <template slot-scope="scope"> + <span v-if="scope.row.cusSex == '0'">鐢�</span> + <span v-if="scope.row.cusSex == '1'">濂�</span> + <span v-if="scope.row.cusSex == '2'">鏈煡</span> </template> </el-table-column> <el-table-column label="鎵嬫満鍙�" align="center" - prop="customer.cusPhone" + prop="cusPhone" width="120px" /> <el-table-column label="鐢宠鏃堕棿" align="center" - prop="customer.applicationTime" + prop="applicationTime" width="210" > <template slot-scope="scope"> - <span>{{ parseTime(scope.row.customer.applicationTime) }}</span> + <span>{{ parseTime(scope.row.applicationTime) }}</span> </template> </el-table-column> </el-table> </div> <div style="width: 50%"> + <!-- v-if="this.rightTabShow" --> <el-table v-loading="loading" :data="tableList" - :span-method="objectSpanMethod" @selection-change="handleChange" - border - height="520px" + :span-method="objectSpanMethod" ref="tab1" :row-class-name="tableRowClassName" + border + height="520px" > <el-table-column type="selection" width="40" align="center" /> <!-- :selectable="selectEnable" --> @@ -160,31 +211,55 @@ <span>{{ parseTime(scope.row.tjTime, '{y}-{m}-{d}') }}</span> </template> </el-table-column> --> - <el-table-column label="鏍囨湰绫诲瀷" align="center" prop="specimenType" width="120"> - <template slot-scope="scope"> - <dict-tag - :options="dict.type.sys_dict_specimen" - :value="scope.row.specimenType" - /> - </template> + <el-table-column + label="鏍囨湰绫诲瀷" + align="center" + prop="specimenType" + width="120" + > </el-table-column> - <el-table-column label="椤圭洰鍚嶇О" align="center" prop="proName" /> - <el-table-column label="鎬у埆" align="center" prop="proSex" width="90" /> - <el-table-column label="绌鸿吂" align="center" prop="isEat" width="90" /> <el-table-column label="閲囨牱缂栧彿" align="center" - prop="samplingNumber" - :show-overflow-tooltip="true" width="120" + prop="jyxh" + :show-overflow-tooltip="true" + width="120" /> - <el-table-column label="閲囨牱鐘舵��" align="center" prop="isSignFor" width="90"> + <el-table-column label="椤圭洰鍚嶇О" align="center" prop="proName" /> + <!-- <el-table-column + label="鎬у埆" + align="center" + prop="proSex" + width="90" + /> --> + <el-table-column + label="鏄惁鍚堝苟" + align="center" + prop="isMerge" + width="90" + > + <template slot-scope="scope"> + <span + :style="{ color: scope.row.isMerge === 0 ? '' : '#409EFF' }" + > + {{ scope.row.isMerge === 0 ? "鏈悎骞�" : "宸插悎骞�" }} + </span> + </template> + </el-table-column> + + <!-- <el-table-column + label="閲囨牱鐘舵��" + align="center" + prop="isSignFor" + width="90" + > <template slot-scope="scope"> <dict-tag :options="dict.type.sampling_type" :value="scope.row.isSignFor" /> </template> - </el-table-column> + </el-table-column> --> <!-- <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> <template slot-scope="scope"> <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" @@ -196,6 +271,38 @@ </template> </el-table-column> --> </el-table> + </div> + + <div id="printSection" style="display: none"> + <!-- 鍔ㄦ�佺敓鎴愬涓潯褰㈢爜鐨勫鍣� --> + <div v-for="(item, index) in selectList" :key="index"> + <svg :id="'barcode' + index"></svg> + <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> + <span>{{ item.customer.cusSex == 0 ? "鐢�" : "濂�" }}</span> + <span>{{ item.customer.age }}</span> + </div> + </div> + <div class="tj"> + <span>浣撴涓績</span> + <!-- <span>{{ item.cardId.slice(0, 14) }}</span> --> + <!-- <span>{{ item.cardId }}</span> --> + <span>{{ item.cardId ? item.cardId.substring(0, 14) : "" }}</span> + </div> + <div class="tj"> + <span>{{ item.jyxh }}</span> + <span>{{ formatDate(item.applicationTime) }}</span> + </div> + </div> </div> </div> <!-- @@ -249,7 +356,14 @@ addSampling, updateSampling, confirmSampling, + getCusCyList, + mergeCaiYang, + chexiaoCaiYang, + getTxmmccd, + getTxmkd, } from "@/api/sampling/sampling"; +import { getNewDateList } from "@/api/hosp/order"; +import moment from "moment"; export default { dicts: [ @@ -262,15 +376,24 @@ name: "Sampling", data() { return { + msg: "", + getNumbr: null, + valueUrl: "ws://127.0.0.1:6789/websocket", + webSocket: null, list: [], - selectList: "", + selectList: [], + selectedRows: [], createTimeList: [], // 閬僵灞� loading: true, + loading1: true, // 閫変腑鏁扮粍 ids: [], // 缁戝畾鍗曢�夋寜閽� tjStatus: "1", + dayinData: [], + jsonObj: {}, + // 闈炲崟涓鐢� single: true, // 闈炲涓鐢� @@ -295,7 +418,7 @@ pageNum: 1, pageSize: 20, name: null, - tjNum: null, + tjNumber: null, applicationTime: null, isSignFor: null, tjTime: null, @@ -339,13 +462,82 @@ form: {}, // 琛ㄥ崟鏍¢獙 rules: {}, + // rightTabShow: false }; }, created() { - this.getNowTime(); - this.getList(); + // this.getNowTime(); + getTxmmccd().then((res) => { + this.msg = Number(res.msg); + console.log(res, 444); + }); + this.getdate(); }, + mounted() { + this.$nextTick(() => { + this.$refs.inputName.focus(); + }); + }, + computed: { + disabled() { + return ( + this.selectList.length > 0 && + this.selectList[this.selectList.length - 1].isMerge === 1 + ); + }, + qiehuan() { + return this.selectList.length > 0; + }, + disabledId() { + return this.tjStatus == "1" ? 1 : 0; + }, + }, + methods: { + getTruncatedName(proName) { + // 鍘绘帀鎵�鏈夌┖鏍� + const trimmedProName = proName.replace(/\s+/g, ""); + + const number = this.msg; + + const truncated = + trimmedProName.length > number + ? trimmedProName.slice(0, number) + : trimmedProName; + let remaining = + trimmedProName.length > number ? trimmedProName.slice(number) : ""; + + if (remaining.length > number) { + remaining = remaining.slice(0, number) + "..."; + } + 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 new Date(date).toLocaleDateString(undefined, options); + }, + getdate() { + getNewDateList().then((res) => { + this.createTimeList = [ + moment(res.data).format("YYYY-MM-DD 00:00:00"), + moment(res.data).format("YYYY-MM-DD 23:59:00"), + ]; + this.getList(); + }); + }, handleSizeChange(val) { this.size = val; this.page = 1; @@ -377,15 +569,538 @@ dateChangebirthday1(val) { this.createTimeList = val; }, + formatDate(applicationTime) { + // 纭繚 applicationTime 鏄湁鏁堢殑瀛楃涓� + if (applicationTime) { + return applicationTime.split(" ")[0]; // 閫氳繃绌烘牸鍒嗛殧鏃ユ湡鍜屾椂闂达紝鍙繑鍥炴棩鏈熼儴鍒� + } + return ""; // 濡傛灉 applicationTime 鏃犳晥锛岃繑鍥炵┖瀛楃涓� + }, /** 鏌ヨ浣撴閲囨牱绠$悊鍒楄〃 */ getList() { - this.loading = true; + this.loading1 = true; this.queryParams.isSignFor = this.tjStatus; - this.queryParams.beginTime = this.createTimeList[0]; - this.queryParams.endTime = this.createTimeList[1]; + + if (this.createTimeList) { + this.queryParams.beginTime = this.createTimeList[0]; + this.queryParams.endTime = this.createTimeList[1]; + } else if (this.createTimeList == null) { + this.queryParams.beginTime = null; + this.queryParams.endTime = null; + } + getList(this.queryParams).then((response) => { + this.loading1 = false; + if (response.data) { + if (!response.data.list || response.data.list.length === 0) { + this.samplingList = []; + this.tableList = []; + this.loading1 = false; + this.loading = false; + return; + } else { + this.samplingList = response.data.list; + // console.log(this.samplingList, 888); + // 鍒ゆ柇鏄惁闇�瑕佸埛鏂板彸杈硅〃鏍� + this.$nextTick(() => { + this.$refs.tb.toggleRowSelection(this.samplingList[0], true); + // this.fetchData(this.samplingList[0].tjNumber); + // ddddddddddddddd + // this.rightTabShow = true + }); + } + this.total = response.data.total; + this.loading1 = false; + } else { + this.samplingList = []; + this.tableList = []; + this.loading1 = false; + } + }); + + /* 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; + console.log(this.samplingList,888); + + 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; + } + }); */ + }, + // 鍙栨秷鎸夐挳 + cancel() { + this.open = false; + this.reset(); + }, + // 琛ㄥ崟閲嶇疆 + reset() { + this.form = { + id: null, + samplingNumber: null, + tjNumber: null, + applicationTime: null, + isSignFor: null, + tjTime: null, + specimenType: null, + proId: null, + proName: null, + createBy: null, + createTime: null, + updateBy: null, + updateTime: null, + deleted: null, + }; + }, + hb() { + if (this.queryParams.tjNumber != null) { + this.handleQuery(); + } + }, + /** 鎼滅储鎸夐挳鎿嶄綔 */ + handleQuery() { + this.queryParams.pageNum = 1; + this.getList(); + }, + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + resetQuery() { + this.createTimeList = []; + this.handleQuery(); + }, + // 鍗曢�夋閫変腑鏁版嵁 + /* handleSelectionChange(selection) { + this.selectList = selection; + selection.forEach((element) => { + this.tableList = element.list; + console.log(this.tableList, 111); + + if (this.tableList.length != 0) { + this.$nextTick(() => { + this.$refs.tab1.toggleAllSelection(this.tableList, true); + }); + } else { + this.$refs.tab1.clearSelection(); + } + }); + // this.ids = selection.map(item => item.id) + if (selection.length > 1) { + let del_row = selection.shift(); + this.$refs.tb.toggleRowSelection(del_row, false); //璁剧疆杩欎竴琛屽彇娑堥�変腑 + } + this.single = selection.length !== 1; + this.multiple = !selection.length; + }, */ + + handleSelectionChange(selection) { + // 娓呯┖鍙充晶琛ㄦ牸鐨勬暟鎹� + this.tableList = []; + + // 鍙湁涓�涓汉琚�変腑鏃惰繘琛屾搷浣� + if (selection.length === 1) { + const selectedPerson = selection[0]; // 鑾峰彇閫変腑鐨勯偅涓汉 + const tjNumber = selectedPerson.tjNumber; + console.log(selectedPerson.tjNumber, 6363); + + this.fetchData(tjNumber); + } else { + // 濡傛灉閫変腑澶氫汉锛屽垯鍙栨秷閫変腑 + if (selection.length > 1) { + let del_row = selection.shift(); + this.$refs.tb.toggleRowSelection(del_row, false); // 璁剧疆杩欎竴琛屽彇娑堥�変腑 + } + } + + // 鏇存柊閫夋嫨鐘舵�� + this.single = selection.length === 1; + this.multiple = selection.length === 0; + + this.selectedRows = selection; + }, + + fetchData(tjNumber) { + this.loading = true; // 鏄剧ず鍔犺浇鐘舵�� + + getCusCyList(tjNumber, this.tjStatus) // 璋冪敤API鑾峰彇鏁版嵁 + .then((response) => { + if (response.data) { + console.log(response, 2525); + + this.tableList = response.data; // 纭 list 瀛樺湪鍚庡啀杩涜璧嬪�� + } else { + // 濡傛灉娌℃湁鏁版嵁鎴� list 涓虹┖锛屾竻绌鸿〃鏍煎苟鎻愮ず + this.tableList = []; + } + }) + .catch((error) => { + console.error("Error fetching data:", error); + }) + .finally(() => { + this.loading = false; // 闅愯棌鍔犺浇鐘舵�� + }); + }, + + /* 鐐瑰嚮鍚堝苟鎸夐挳 */ + Merging() { + // 妫�鏌ユ槸鍚﹂�変腑浜嗘暟鎹� + if (this.selectedRows.length === 0) { + this.$message.error("鑷冲皯閫変腑涓�涓汉"); + return; + } + if (this.selectList.length === 0) { + this.$message.error("璇烽�夋嫨瑕佸悎骞堕」鐩�"); + return; + } + if (this.selectList.every((item) => item.isMerge === 0)) { + const baseSpecimenTypeCode = this.selectList[0].specimenTypeCode; + + // 妫�鏌� specimenTypeCode 鏄惁涓�鑷� + const canMergeBySpecimenTypeCode = this.selectList.every( + (row) => row.specimenTypeCode === baseSpecimenTypeCode + ); + + // 鏍规嵁 canMergeBySpecimenTypeCode 鍒ゆ柇鏄惁鍚堝苟 + if (canMergeBySpecimenTypeCode) { + let data = this.ids; + + mergeCaiYang(data).then((response) => { + this.$message.success("鍚堝苟鎴愬姛銆�"); + // console.log("鍚堝苟鐨勮:", this.selectedRows); + // this.getList(); + this.fetchData(this.selectedRows[0].tjNumber); + }); + } else { + this.$message.error("鏍囨湰绫诲瀷涓嶄竴鑷达紝鏃犳硶鍚堝苟锛�"); + } + } else { + this.$message.error("璇ラ」鐩凡鍚堝苟"); + } + }, + + /** 鐐瑰嚮鎾ら攢鎸夐挳 **/ + Cancellation() { + let data = this.ids; + console.log("鎾ら攢"); + if (data.length === 0) { + // 濡傛灉娌℃湁宸插悎骞剁殑椤圭洰锛岀粰鍑烘彁绀轰俊鎭� + this.$message.error("娌℃湁宸插悎骞剁殑椤圭洰鍙互鎾ら攢锛�"); + return; + } + + // console.log("鎾ら攢鐨勫凡鍚堝苟椤圭洰ID:", data); + + // 璋冪敤鎾ら攢閲囨牱鐨勬帴鍙� + chexiaoCaiYang(data) + .then((res) => { + if (res && res.code === 200) { + this.$message.success("鎾ら攢鎴愬姛锛�"); + // 鍒锋柊鏁版嵁鍒楄〃鎴栬繘琛屽叾浠栨搷浣� + // this.getList(); + this.fetchData(this.selectedRows[0].tjNumber); + } else { + this.$message.error(res.msg || "鎾ら攢澶辫触锛岃閲嶈瘯锛�"); + } + }) + .catch((error) => { + this.$message.error("璇锋眰澶辫触锛岃閲嶈瘯锛�"); + }); + }, + + /** 鐐瑰嚮琛ユ墦鏉$爜鎸夐挳 **/ + async Collection() { + const jyxh = this.selectList.map((item) => item.jyxh); + console.log("jyxh:", jyxh); + try { + // 璇锋眰鎺ュ彛骞惰幏鍙栧搴﹀�� + const widthResponse = await getTxmkd(); + const barcodeWidth = `${Number(widthResponse.msg)}%` || "70%"; // 鑾峰彇瀹藉害鍊硷紝榛樿浣跨敤 70% + + 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}`); // 璋冭瘯杈撳嚭 + } + }); + + // await this.$nextTick(); + + const barcodeElements = jyxh.map((_, index) => + document.querySelector(`#barcode${index}`) + ); + + if (barcodeElements) { + barcodeElements.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; /* 浣垮唴杈硅窛鍜岃竟妗嗗寘鍚湪鍏冪礌鐨勬�诲搴﹀拰楂樺害鍐� */ + } + .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; + } + .barcode-container { + // width: 100%; /* 鏍规嵁闇�瑕佽皟鏁� */ + // text-align: center; /* 纭繚鏉″舰鐮佸眳涓� */ + } + .name, .name1 { + padding: 0; + font-size: 18px; + width: 70%; + font-family: "Arial Black", sans-serif; /* 璁剧疆榛戜綋 */ + } + p { + margin: 0; + padding: 0; + } + svg { + display: block; + width: ${barcodeWidth}; /* 浣跨敤浠庢帴鍙h幏鍙栫殑瀹藉害 */ + margin-left: 10mm; + height: auto; + margin-bottom: 0; + } + .last { + width: 66%; + display: flex; + font-size: 19px; + justify-content: space-between; + // font-weight: bold; + // font-family: "Arial Black", sans-serif !important; + } + .last div span { + // font-weight: bold; + margin-left: 10px; + // font-family: "Arial Black", sans-serif !important; + } + .last p { + // font-weight: bold; + margin-left: 1px; + // font-family: "Arial Black", sans-serif !important; + } + p { + margin-left: 1px; + // font-weight: bold; + // font-family: "Arial Black", sans-serif !important; + } + .tj { + width: 70%; + display: flex; + font-size: 19px; + justify-content: space-between; + // font-weight: bold; + font-family: "Arial Black", sans-serif !important; + } + .tj span { + margin-left: 1px; + } + } + </style> + </head> + <body>${printContents}</body> + </html> + `); + newWindow.document.close(); + newWindow.focus(); + newWindow.print(); + newWindow.close(); + } catch (error) { + console.error("鑾峰彇瀹藉害鏃跺嚭閿�:", error); // 鎹曡幏閿欒 + } + }, + + tableRowClassName({ row, rowIndex }) { + for (let i = 0; i < this.selectList.length; i++) { + if (row === this.selectList[i]) { + return "warning-row"; + } + } + }, + + handleChange(selection) { + // console.log(selection); + + this.selectList = selection; + console.log(this.selectList, 9977); + var array = selection; + + this.ids = array.map((item) => item.id); + }, + + // 纭畾鎸夐挳 + submitForm() {}, + + buda() { + var websocket = null; + var url = this.valueUrl; + if ("WebSocket" in window) { + websocket = new WebSocket(url); + } else if ("MozWebSocket" in window) { + websocket = new MozWebSocket(url); + } + if (websocket == null) { + alert("鍒涘缓WebSocket瀵硅薄澶辫触"); + } + websocket.onerror = function () { + alert("璇锋鏌ヨ鍗″櫒杩炴帴鏄惁姝e父"); + }; + websocket.onopen = () => { + this.websocket = websocket; + this.dayinData = this.selectList.map((item) => ({ + jyxh: item.jyxh, + proName: item.proName, + cusName: item.cusName, + cusSex: item.customer.cusSex, + age: item.customer.age, + cardId: item.cardId, + tjTime: item.createTime, + })); + console.log(this.dayinData, 2222); + + // 杩炴帴璁惧 + this.jsonObj = { + type: "3", + array: { + data: this.dayinData, + }, + }; + var jStr = JSON.stringify(this.jsonObj); + this.websocket.send(jStr); + this.jsonObj = {}; + // this.dialogVisible = false; + }; + // this.getList(); + }, + + // 纭閲囨牱 + Confirmreceipt() { + console.log(this.selectList, 999); + + console.log(1111); + + const loadingInstance = this.$loading({ + lock: true, // 閿佸畾灞忓箷 + text: "鍔犺浇涓�...", // 鍔犺浇鏂囨湰 + spinner: "el-icon-loading", // 鑷畾涔夊姞杞藉浘鏍� + background: "rgba(255, 255, 255, 0.7)", // 鑳屾櫙棰滆壊 + }); + confirmSampling(this.ids) + .then((res) => { + console.log(this.selectList, 2222); + + if (res.code === 200) { + // var websocket = null; + this.buda(); + + /* var url = this.valueUrl; + if ("WebSocket" in window) { + websocket = new WebSocket(url); + } else if ("MozWebSocket" in window) { + websocket = new MozWebSocket(url); + } + if (websocket == null) { + alert("鍒涘缓WebSocket瀵硅薄澶辫触"); + } + websocket.onerror = function () { + alert("璇锋鏌ヨ鍗″櫒杩炴帴鏄惁姝e父"); + }; + websocket.onopen = () => { + this.websocket = websocket; + var list = this.selectList; + var data = list.map((item) => ({ + jyxh: item.jyxh, + proName: item.proName, + cusName: item.cusName, + cusSex: item.customer.cusSex, + age: item.customer.age, + cardId: item.cardId, + tjTime: item.createTime, + })); + + // 杩炴帴璁惧 + var jsonObj = { + type: "3", + array: { + data: data, + }, + }; + var jStr = JSON.stringify(jsonObj); + this.websocket.send(jStr); + var jsonObj = {}; + this.dialogVisible = false; + }; + websocket.onmessage = (event) => { + var resultObj = eval("(" + event.data + ")"); + console.log(resultObj, 9988); + }; */ + + // this.Collection(); + this.getList(); + } else { + this.$message.error(res.msg); + } + // this.getList(); + }) + .catch((error) => { + // this.$message.error("閲囨牱澶辫触"); + }) + .finally(() => { + loadingInstance.close(); + }); + }, + + // 鍗曢�夋寜閽� + radioChange(value) { + this.loading = true; + this.queryParams.isSignFor = value; getList(this.queryParams).then((response) => { if (response.data) { - if (response.data.list == null) { + if (response.data.list == null) { this.samplingList = []; this.tableList = []; this.loading = false; @@ -406,128 +1121,6 @@ this.samplingList = []; this.tableList = []; this.loading = false; - } - }); - }, - - // 鍙栨秷鎸夐挳 - cancel() { - this.open = false; - this.reset(); - }, - // 琛ㄥ崟閲嶇疆 - reset() { - this.form = { - id: null, - samplingNumber: null, - cusId: null, - applicationTime: null, - isSignFor: null, - tjTime: null, - specimenType: null, - proId: null, - proName: null, - createBy: null, - createTime: null, - updateBy: null, - updateTime: null, - deleted: null, - }; - this.resetForm("form"); - }, - /** 鎼滅储鎸夐挳鎿嶄綔 */ - handleQuery() { - this.queryParams.pageNum = 1; - this.getList(); - }, - /** 閲嶇疆鎸夐挳鎿嶄綔 */ - resetQuery() { - this.resetForm("queryForm"); - this.handleQuery(); - }, - // 鍗曢�夋閫変腑鏁版嵁 - handleSelectionChange(selection) { - this.selectList = selection; - selection.forEach((element) => { - this.tableList = element.list; - if (this.tableList.length != 0) { - this.$nextTick(() => { - this.$refs.tab1.toggleAllSelection(this.tableList, true); - }); - } else { - this.$refs.tab1.clearSelection(); - } - }); - // this.ids = selection.map(item => item.id) - if (selection.length > 1) { - let del_row = selection.shift(); - this.$refs.tb.toggleRowSelection(del_row, false); //璁剧疆杩欎竴琛屽彇娑堥�変腑 - } - this.single = selection.length !== 1; - this.multiple = !selection.length; - }, - tableRowClassName({ row, rowIndex }) { - for (let i = 0; i < this.selectList.length; i++) { - if (row === this.selectList[i]) { - return "warning-row"; - } - } - }, - - handleChange(selection) { - this.selectList = selection; - this.ids = selection.map((item) => item.id); - }, - - // 绂侀�� - // selectEnable(row, rowIndex) { - // if(row.isSignFor === "0"){ - // return false - // }else{ - // return true - // } - // }, - - // 纭畾鎸夐挳 - submitForm() {}, - - // 纭閲囨牱 - Confirmreceipt() { - let data = this.ids; - confirmSampling(data).then((res) => { - this.$modal.msgSuccess("閲囨牱鎴愬姛"); - this.getList(); - }); - }, - - // 鍗曢�夋寜閽� - 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; } }); }, @@ -565,6 +1158,7 @@ } .el-table .warning-row { - background: #e5f3ff !important; + background-color: #e5f3ff !important; + /* font-weight: bold; */ } </style> -- Gitblit v1.8.0