From f139849fb65e7264d173bc46f45d70409e559504 Mon Sep 17 00:00:00 2001 From: maven <2163098428@qq.com> Date: 星期五, 08 八月 2025 15:26:59 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev_ai' into dev_ai --- src/views/equipmentManagement/ledger/index.vue | 98 ++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 76 insertions(+), 22 deletions(-) diff --git a/src/views/equipmentManagement/ledger/index.vue b/src/views/equipmentManagement/ledger/index.vue index 7fa970b..16fbbc6 100644 --- a/src/views/equipmentManagement/ledger/index.vue +++ b/src/views/equipmentManagement/ledger/index.vue @@ -41,6 +41,10 @@ @change="getTableData" /> </el-form-item> + <el-form-item label="褰曞叆鏃ユ湡:"> + <el-date-picker v-model="filters.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="daterange" + placeholder="璇烽�夋嫨" clearable @change="changeDaterange" /> + </el-form-item> <el-form-item> <el-button type="primary" @click="getTableData">鎼滅储</el-button> <el-button @click="resetFilters">閲嶇疆</el-button> @@ -75,22 +79,17 @@ @selection-change="handleSelectionChange" @pagination="changePage" > - <template #operation="{ row }"> - <el-button type="primary" text @click="edit(row.id)" icon="editPen"> - 缂栬緫 - </el-button> - <el-button - type="danger" - text - icon="delete" - @click="deleteRow(row.id)" - > - 鍒犻櫎 - </el-button> - </template> </PIMTable> </div> <Modal ref="modalRef" @success="getTableData"></Modal> + <el-dialog v-model="qrDialogVisible" title="浜岀淮鐮�" width="300px"> + <div style="text-align:center;"> + <img :src="qrCodeUrl" alt="浜岀淮鐮�" style="width:200px;height:200px;" /> + <div style="margin:10px 0;"> + <el-button type="primary" @click="downloadQRCode">涓嬭浇浜岀淮鐮佸浘鐗�</el-button> + </div> + </div> + </el-dialog> </div> </template> @@ -101,6 +100,9 @@ import { onMounted, getCurrentInstance } from "vue"; import Modal from "./Modal.vue"; import { ElMessageBox, ElMessage } from "element-plus"; +import dayjs from "dayjs"; +import QRCode from "qrcode"; +import { ref } from "vue"; defineOptions({ name: "璁惧鍙拌处", @@ -110,6 +112,10 @@ const multipleList = ref([]); const { proxy } = getCurrentInstance(); const modalRef = ref(); +const qrDialogVisible = ref(false); +const qrCodeUrl = ref(""); +const qrRowData = ref(null); + const { filters, columns, @@ -179,14 +185,29 @@ align: "center", prop: "createTime", }, - { - fixed: "right", - label: "鎿嶄綔", - dataType: "slot", - slot: "operation", - align: "center", - width: "200px", - }, + { + dataType: "action", + label: "鎿嶄綔", + align: "center", + fixed: 'right', + width: 140, + operation: [ + { + name: "缂栬緫", + type: "text", + clickFun: (row) => { + edit(row.id) + }, + }, + { + name: "鐢熸垚浜岀淮鐮�", + type: "text", + clickFun: (row) => { + showQRCode(row) + }, + }, + ], + }, ] ); @@ -201,8 +222,9 @@ const edit = (id) => { modalRef.value.loadForm(id); }; -const changePage = ({ page }) => { +const changePage = ({ page, limit }) => { pagination.currentPage = page; + pagination.pageSize = limit; onCurrentChange(page); }; const deleteRow = (id) => { @@ -222,6 +244,17 @@ }); }; +const changeDaterange = (value) => { + if (value) { + filters.entryDateStart = dayjs(value[0]).format("YYYY-MM-DD"); + filters.entryDateEnd = dayjs(value[1]).format("YYYY-MM-DD"); + } else { + filters.entryDateStart = undefined; + filters.entryDateEnd = undefined; + } + getTableData(); +}; + const handleOut = () => { ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", { confirmButtonText: "纭", @@ -236,7 +269,28 @@ }); }; +const showQRCode = async (row) => { + // 浣犲彲浠ヨ嚜瀹氫箟浜岀淮鐮佸唴瀹癸紝姣斿 row.id 鎴� row.deviceName + const qrContent = JSON.stringify(row); // 鎴� `${row.id}` + qrCodeUrl.value = await QRCode.toDataURL(qrContent); + qrRowData.value = row; + qrDialogVisible.value = true; +}; + +const downloadQRCode = () => { + const a = document.createElement("a"); + a.href = qrCodeUrl.value; + a.download = `${qrRowData.value.deviceName || "浜岀淮鐮�"}.png`; + a.click(); +}; + onMounted(() => { + filters.entryDate = [ + dayjs().format("YYYY-MM-DD"), + dayjs().add(1, "day").format("YYYY-MM-DD"), + ] + filters.entryDateStart = dayjs().format("YYYY-MM-DD") + filters.entryDateEnd = dayjs().add(1, "day").format("YYYY-MM-DD") getTableData(); }); </script> -- Gitblit v1.9.3