From c104bf2b4ecf604245b38590bf1e8119530de10b Mon Sep 17 00:00:00 2001 From: yaowanxin <3588231647@qq.com> Date: 星期二, 12 八月 2025 16:26:55 +0800 Subject: [PATCH] Merge branch 'ywx' of http://114.132.189.42:9002/r/product-inventory-management into dev_ai --- src/views/energyManagement/waterManagement/waterBill.vue | 181 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 181 insertions(+), 0 deletions(-) diff --git a/src/views/energyManagement/waterManagement/waterBill.vue b/src/views/energyManagement/waterManagement/waterBill.vue new file mode 100644 index 0000000..ea382f0 --- /dev/null +++ b/src/views/energyManagement/waterManagement/waterBill.vue @@ -0,0 +1,181 @@ +<template> + <div class="app-container"> + <div class="search_form"> + <div> + <span class="search_title">璁惧鍚嶇О锛�</span> + <el-input + v-model="searchForm.name" + style="width: 240px" + placeholder="璇疯緭鍏�" + @change="handleQuery" + clearable + :prefix-icon="Search" + /> + <el-button type="primary" @click="handleQuery" style="margin-left: 10px" + >鎼滅储</el-button + > + </div> + <div> + <el-button type="primary" @click="openForm('add')">鏂板</el-button> + <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button> + </div> + </div> + <div class="table_list"> + <PIMTable + rowKey="id" + :column="tableColumn" + :tableData="tableData" + :page="page" + :isSelection="true" + @selection-change="handleSelectionChange" + :tableLoading="tableLoading" + @pagination="pagination" + ></PIMTable> + </div> + <form-dia ref="formDia" @close="handleQuery"></form-dia> + </div> +</template> + +<script setup> +import {Search} from "@element-plus/icons-vue"; +import {onMounted, ref, reactive, nextTick} from "vue"; +import FormDia from "@/views/energyManagement/waterManagement/components/waterBillForm.vue"; +import {ElMessageBox} from "element-plus"; +import {waterBillDelete, waterBillListPage} from "@/api/energyManagement/waterManagement.js"; +const { proxy } = getCurrentInstance(); + +const data = reactive({ + searchForm: { + name: "", + }, +}); +const { searchForm } = toRefs(data); + +const selectedRows = ref([]); +const tableColumn = ref([ + { + label: "璁惧鍚嶇О", + prop: "name", + width: 200, + }, + { + label: "瑙勬牸鍨嬪彿", + prop: "code", + width: 200, + }, + { + label: "鐢ㄦ按閲�", + prop: "waterConsumption", + }, + { + label: "姘磋垂鍗曚环", + prop: "waterPrice", + }, + { + label: "姘磋垂閲戦", + prop: "waterBill", + width:150 + }, + { + label: "璁¤垂鏃ユ湡", + prop: "billDate", + width: 150, + }, + { + label: "鐢ㄦ按绫诲瀷", + prop: "waterType", + width:120 + }, + { + dataType: "action", + label: "鎿嶄綔", + align: "center", + fixed: 'right', + operation: [ + { + name: "缂栬緫", + type: "text", + clickFun: (row) => { + openForm("edit", row); + }, + }, + ], + }, +]); +const tableData = ref([]); +const tableLoading = ref(false); +const page = reactive({ + current: 1, + size: 100, + total: 0, +}); +// 琛ㄦ牸閫夋嫨鏁版嵁 +const handleSelectionChange = (selection) => { + selectedRows.value = selection; +}; +const formDia = ref() + +// 鏌ヨ鍒楄〃 +/** 鎼滅储鎸夐挳鎿嶄綔 */ +const handleQuery = () => { + page.current = 1; + getList(); +}; +const pagination = (obj) => { + page.current = obj.page; + page.size = obj.limit; + getList(); +}; + +const getList = () => { + tableLoading.value = true; + waterBillListPage({ ...searchForm.value, ...page }).then((res) => { + tableLoading.value = false; + tableData.value = res.data.records; + page.total = res.data.total; + }); +}; + +// 鎵撳紑寮规 +const openForm = (type, row) => { + nextTick(() => { + formDia.value?.openDialog(type, row) + }) +}; + +const handleDelete = () => { + let ids = []; + if (selectedRows.value.length > 0) { + ids = selectedRows.value.map((item) => item.id); + } else { + proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁"); + return; + } + ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず", { + confirmButtonText: "纭", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + tableLoading.value = true; + waterBillDelete(ids) + .then((res) => { + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + getList(); + }) + .finally(() => { + tableLoading.value = false; + }); + }) + .catch(() => { + proxy.$modal.msg("宸插彇娑�"); + }); +}; +onMounted(() => { + getList(); +}); +</script> + +<style scoped> + +</style> -- Gitblit v1.9.3