From 93b79b3a68e19cc36a8feb3bfea4e08ae76ec233 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期二, 06 一月 2026 21:14:34 +0800
Subject: [PATCH] 代码调整9
---
src/views/equipmentManagement/ledger/index.vue | 177 ++++++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 127 insertions(+), 50 deletions(-)
diff --git a/src/views/equipmentManagement/ledger/index.vue b/src/views/equipmentManagement/ledger/index.vue
index ba17f7e..6136760 100644
--- a/src/views/equipmentManagement/ledger/index.vue
+++ b/src/views/equipmentManagement/ledger/index.vue
@@ -1,47 +1,52 @@
<template>
<div class="app-container">
+ <!-- 椤甸潰鍔熻兘璇存槑锛屼粎浣滀负鎻忚堪锛屼笉浣滀负鍏蜂綋瀛楁 -->
<el-form :model="filters" :inline="true">
- <el-form-item label="璁惧鍚嶇О">
+ <!-- 鐩戞帶璁惧鍩虹淇℃伅绛涢�� -->
+ <el-form-item label="鐩戞帶璁惧鍚嶇О">
<el-input
v-model="filters.deviceName"
style="width: 240px"
- placeholder="璇疯緭鍏ヨ澶囧悕绉�"
+ placeholder="璇疯緭鍏ョ洃鎺ц澶囧悕绉�"
clearable
:prefix-icon="Search"
@change="getTableData"
/>
</el-form-item>
- <el-form-item label="瑙勬牸鍨嬪彿">
+ <!-- 娓╁害鐩戞祴瀛楁锛堣嫳鏂囧瓧娈� deviceModel 涓嶅彉锛� -->
+ <el-form-item label="娓╁害鐩戞祴鍙傛暟">
<el-input
v-model="filters.deviceModel"
style="width: 240px"
- placeholder="璇疯緭鍏ヨ鏍煎瀷鍙�"
+ placeholder="璇疯緭鍏ユ俯搴︾浉鍏崇洃娴嬪弬鏁�"
clearable
:prefix-icon="Search"
@change="getTableData"
/>
</el-form-item>
- <el-form-item label="渚涘簲鍟�">
+ <!-- 鍘嬪姏鐩戞祴瀛楁锛堣嫳鏂囧瓧娈� supplierName 涓嶅彉锛� -->
+ <el-form-item label="鍘嬪姏鐩戞祴鍙傛暟">
<el-input
v-model="filters.supplierName"
style="width: 240px"
- placeholder="璇疯緭鍏ヤ緵搴斿晢"
+ placeholder="璇疯緭鍏ュ帇鍔涚浉鍏崇洃娴嬪弬鏁�"
clearable
:prefix-icon="Search"
@change="getTableData"
/>
</el-form-item>
- <el-form-item label="鍗曚綅">
+ <!-- 鑳借�楃洃娴嬪瓧娈碉紙鑻辨枃瀛楁 unit 涓嶅彉锛� -->
+ <el-form-item label="鑳借�楃洃娴嬪弬鏁�">
<el-input
v-model="filters.unit"
style="width: 240px"
- placeholder="璇疯緭鍏ュ崟浣�"
+ placeholder="璇疯緭鍏ヨ兘鑰楃浉鍏崇洃娴嬪弬鏁�"
clearable
:prefix-icon="Search"
@change="getTableData"
/>
</el-form-item>
- <el-form-item label="褰曞叆鏃ユ湡:">
+ <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>
@@ -55,7 +60,7 @@
<div></div>
<div>
<el-button type="primary" @click="add" icon="Plus"> 鏂板 </el-button>
- <el-button @click="handleOut" icon="download">瀵煎嚭</el-button>
+ <!-- <el-button @click="handleOut" icon="download">瀵煎嚭</el-button> -->
<el-button
type="danger"
icon="Delete"
@@ -76,25 +81,22 @@
size: pagination.pageSize,
total: pagination.total,
}"
+ :isShowSummary="true"
+ :summaryMethod="summaryMethod"
@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>
@@ -106,15 +108,24 @@
import Modal from "./Modal.vue";
import { ElMessageBox, ElMessage } from "element-plus";
import dayjs from "dayjs";
+import QRCode from "qrcode";
+import { ref } from "vue";
+import { summarizeTable } from "@/utils/summarizeTable";
+import {Search} from "@element-plus/icons-vue";
defineOptions({
- name: "璁惧鍙拌处",
+ // 椤甸潰鍔熻兘锛氳澶囪繙绋嬬洃鎺�
+ name: "璁惧杩滅▼鐩戞帶",
});
// 琛ㄦ牸澶氶�夋閫変腑椤�
const multipleList = ref([]);
const { proxy } = getCurrentInstance();
const modalRef = ref();
+const qrDialogVisible = ref(false);
+const qrCodeUrl = ref("");
+const qrRowData = ref(null);
+
const {
filters,
columns,
@@ -126,26 +137,34 @@
} = usePaginationApi(
getLedgerPage,
{
- searchText: undefined,
+ deviceName: undefined,
+ deviceModel: undefined,
+ supplierName: undefined,
+ unit: undefined,
+ entryDateStart: undefined,
+ entryDateEnd: undefined,
},
[
{
- label: "璁惧鍚嶇О",
+ label: "鐩戞帶璁惧鍚嶇О",
align: "center",
prop: "deviceName",
},
{
- label: "瑙勬牸鍨嬪彿",
+ // 浣跨敤 deviceModel 瀛楁鎵胯浇娓╁害鐩戞祴鐩稿叧鍙傛暟
+ label: "娓╁害鐩戞祴鍙傛暟",
align: "center",
prop: "deviceModel",
},
{
- label: "渚涘簲鍟�",
+ // 浣跨敤 supplierName 瀛楁鎵胯浇鍘嬪姏鐩戞祴鐩稿叧鍙傛暟
+ label: "鍘嬪姏鐩戞祴鍙傛暟",
align: "center",
prop: "supplierName",
},
{
- label: "鍗曚綅",
+ // 浣跨敤 unit 瀛楁鎵胯浇鑳借�楃洃娴嬬浉鍏冲弬鏁�
+ label: "鑳借�楃洃娴嬪弬鏁�",
align: "center",
prop: "unit",
},
@@ -155,43 +174,62 @@
prop: "number",
},
{
- label: "鍚◣鍗曚环",
+ // 浣跨敤 taxIncludingPriceUnit 瀛楁鎵胯浇鐩戞帶闃堝�间笂闄�
+ label: "鐩戞帶闃堝�间笂闄�",
align: "center",
prop: "taxIncludingPriceUnit",
},
{
- label: "鍚◣鎬讳环",
+ // 浣跨敤 taxIncludingPriceTotal 瀛楁鎵胯浇鐩戞帶闃堝�间笅闄�
+ label: "鐩戞帶闃堝�间笅闄�",
align: "center",
prop: "taxIncludingPriceTotal",
},
{
- label: "绋庣巼",
+ // 浣跨敤 taxRate 瀛楁鍛堢幇瀹炴椂鐩戞祴鍊�/褰撳墠璇绘暟
+ label: "瀹炴椂鐩戞祴鍊�",
align: "center",
prop: "taxRate",
},
{
- label: "涓嶅惈绋庢�讳环",
+ // 浣跨敤 unTaxIncludingPriceTotal 瀛楁鎵胯浇绱鑳借��/鐩戞帶缁熻鍊�
+ label: "绱鑳借��",
align: "center",
prop: "unTaxIncludingPriceTotal",
},
{
- label: "褰曞叆浜�",
+ label: "鐩戞帶浜�",
align: "center",
prop: "createUser",
},
{
- label: "褰曞叆鏃ユ湡",
+ label: "鐩戞帶鏃ユ湡",
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)
+ // },
+ // },
+ ],
+ },
]
);
@@ -211,6 +249,20 @@
pagination.pageSize = limit;
onCurrentChange(page);
};
+
+// 鍚堣鏂规硶
+const summaryMethod = (param) => {
+ return summarizeTable(
+ param,
+ ['number', 'taxIncludingPriceTotal', 'unTaxIncludingPriceTotal', 'taxIncludingPriceUnit'],
+ {
+ number: { noDecimal: true },
+ taxIncludingPriceTotal: { decimalPlaces: 2 },
+ unTaxIncludingPriceTotal: { decimalPlaces: 2 }
+ }
+ );
+};
+
const deleteRow = (id) => {
ElMessageBox.confirm("姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?", "鎻愮ず", {
confirmButtonText: "纭畾",
@@ -246,20 +298,36 @@
type: "warning",
})
.then(() => {
- proxy.download(`/device/ledger/export`, {}, "璁惧鍙拌处妗f.xlsx");
+ // 瀵煎嚭鏂囦欢鍚嶆敼涓鸿澶囪繙绋嬬洃鎺�
+ proxy.download(`/device/ledger/export`, {}, "璁惧杩滅▼鐩戞帶.xlsx");
})
.catch(() => {
proxy.$modal.msg("宸插彇娑�");
});
};
+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")
+ // 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>
@@ -273,4 +341,13 @@
justify-content: space-between;
margin-bottom: 10px;
}
+
+.feature-desc {
+ margin-bottom: 16px;
+ padding: 10px 12px;
+ background: #f5f7fa;
+ border-radius: 4px;
+ color: #606266;
+ font-size: 13px;
+}
</style>
--
Gitblit v1.9.3