From 4b1304917b0b16b09dd50191fab59d96933c0cf3 Mon Sep 17 00:00:00 2001
From: 曹睿 <360930172@qq.com>
Date: 星期二, 17 六月 2025 17:31:11 +0800
Subject: [PATCH] feat: 6月15日任务完90%
---
src/views/procurementManagement/procurementInvoiceLedger/index.vue | 331 +++++++++++++++++++++++++++++++++++++------------------
1 files changed, 222 insertions(+), 109 deletions(-)
diff --git a/src/views/procurementManagement/procurementInvoiceLedger/index.vue b/src/views/procurementManagement/procurementInvoiceLedger/index.vue
index ff9af3b..6ae4766 100644
--- a/src/views/procurementManagement/procurementInvoiceLedger/index.vue
+++ b/src/views/procurementManagement/procurementInvoiceLedger/index.vue
@@ -4,193 +4,306 @@
<div>
<span class="search_title">閲囪喘鍚堝悓鍙凤細</span>
<el-input
- v-model="searchForm.purchaseContractNumber"
- style="width: 240px"
- placeholder="璇疯緭鍏�"
- @change="handleQuery"
- clearable
- :prefix-icon="Search"
+ v-model="searchForm.purchaseContractNumber"
+ style="width: 240px"
+ placeholder="璇疯緭鍏�"
+ @change="handleQuery"
+ clearable
+ :prefix-icon="Search"
/>
<span class="search_title" style="margin-left: 10px">渚涘簲鍟嗭細</span>
<el-input
- v-model="searchForm.supplierName"
- style="width: 240px"
- placeholder="璇疯緭鍏�"
- @change="handleQuery"
- clearable
- :prefix-icon="Search"
+ v-model="searchForm.supplierName"
+ style="width: 240px"
+ placeholder="璇疯緭鍏�"
+ @change="handleQuery"
+ clearable
+ :prefix-icon="Search"
/>
<span class="search_title" style="margin-left: 10px">鏉ョエ鏃ユ湡锛�</span>
<el-date-picker
- style="width: 240px"
- v-model="searchForm.issueDate"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- type="date"
- placeholder="璇烽�夋嫨"
- clearable
+ style="width: 240px"
+ v-model="searchForm.issueDate"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="daterange"
+ start-placeholder="寮�濮嬫椂闂�"
+ end-placeholder="缁撴潫鏃堕棿"
+ clearable
+ @change="changeDateRange"
+ @clear="clearRange"
/>
- <el-button type="primary" @click="handleQuery" style="margin-left: 10px">鎼滅储</el-button>
+ <el-button type="primary" @click="handleQuery" style="margin-left: 10px"
+ >鎼滅储</el-button
+ >
</div>
<div>
<el-button @click="handleOut">瀵煎嚭</el-button>
</div>
</div>
<div class="table_list">
- <el-table :data="tableData" border v-loading="tableLoading"
- :expand-row-keys="expandedRowKeys" :row-key="row => row.id" show-summary :summary-method="summarizeMainTable"
- @expand-change="expandChange" height="calc(100vh - 18.5em)">
- <el-table-column align="center" label="搴忓彿" type="index" width="55" />
+ <el-table
+ :data="tableData"
+ border
+ v-loading="tableLoading"
+ :expand-row-keys="expandedRowKeys"
+ :row-key="(row) => row.id"
+ show-summary
+ :summary-method="summarizeMainTable"
+ @expand-change="expandChange"
+ height="calc(100vh - 18.5em)"
+ >
+ <el-table-column align="center" label="搴忓彿" type="index" width="55" />
<el-table-column type="expand">
<template #default="props">
- <el-table :data="props.row.children" border show-summary :summary-method="summarizeChildrenTable">
- <el-table-column align="center" label="搴忓彿" type="index" width="60" />
+ <el-table
+ :data="props.row.children"
+ border
+ show-summary
+ :summary-method="summarizeChildrenTable"
+ >
+ <el-table-column
+ align="center"
+ label="搴忓彿"
+ type="index"
+ width="60"
+ />
<el-table-column label="浜у搧澶х被" prop="productCategory" />
<el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" />
<el-table-column label="鍗曚綅" prop="unit" />
<el-table-column label="鏁伴噺" prop="quantity" />
<el-table-column label="绋庣巼(%)" prop="taxRate" />
- <el-table-column label="鍚◣鍗曚环(鍏�)" prop="taxInclusiveUnitPrice" :formatter="formattedNumber" />
- <el-table-column label="鍚◣鎬讳环(鍏�)" prop="taxInclusiveTotalPrice" :formatter="formattedNumber" />
- <el-table-column label="涓嶅惈绋庢�讳环(鍏�)" prop="taxExclusiveTotalPrice" :formatter="formattedNumber" />
+ <el-table-column
+ label="鍚◣鍗曚环(鍏�)"
+ prop="taxInclusiveUnitPrice"
+ :formatter="formattedNumber"
+ />
+ <el-table-column
+ label="鍚◣鎬讳环(鍏�)"
+ prop="taxInclusiveTotalPrice"
+ :formatter="formattedNumber"
+ />
+ <el-table-column
+ label="涓嶅惈绋庢�讳环(鍏�)"
+ prop="taxExclusiveTotalPrice"
+ :formatter="formattedNumber"
+ />
<el-table-column label="鏈鏉ョエ鏁�" prop="ticketsNum" />
- <el-table-column label="鏈鏉ョエ閲戦(鍏�)" prop="ticketsAmount" :formatter="formattedNumber" />
+ <el-table-column
+ label="鏈鏉ョエ閲戦(鍏�)"
+ prop="ticketsAmount"
+ :formatter="formattedNumber"
+ />
<el-table-column label="鏈潵绁ㄦ暟" prop="futureTickets" />
- <el-table-column label="鏈潵绁ㄩ噾棰�(鍏�)" prop="futureTicketsAmount" :formatter="formattedNumber" />
+ <el-table-column
+ label="鏈潵绁ㄩ噾棰�(鍏�)"
+ prop="futureTicketsAmount"
+ :formatter="formattedNumber"
+ />
</el-table>
</template>
</el-table-column>
- <el-table-column label="閲囪喘鍚堝悓鍙�" prop="purchaseContractNumber" show-overflow-tooltip />
- <el-table-column label="閿�鍞悎鍚屽彿" prop="salesContractNo" show-overflow-tooltip />
- <el-table-column label="渚涘簲鍟嗗悕绉�" prop="supplierName" show-overflow-tooltip />
- <el-table-column label="鍙戠エ鍙�" prop="invoiceNumber" show-overflow-tooltip />
- <el-table-column label="鍚堝悓閲戦(鍏�)" prop="invoiceAmount" show-overflow-tooltip :formatter="formattedNumber" />
+ <el-table-column
+ label="閲囪喘鍚堝悓鍙�"
+ prop="purchaseContractNumber"
+ show-overflow-tooltip
+ />
+ <el-table-column
+ label="閿�鍞悎鍚屽彿"
+ prop="salesContractNo"
+ show-overflow-tooltip
+ />
+ <el-table-column
+ label="渚涘簲鍟嗗悕绉�"
+ prop="supplierName"
+ show-overflow-tooltip
+ />
+ <el-table-column
+ label="鍙戠エ鍙�"
+ prop="invoiceNumber"
+ show-overflow-tooltip
+ />
+ <el-table-column
+ label="鍚堝悓閲戦(鍏�)"
+ prop="invoiceAmount"
+ show-overflow-tooltip
+ :formatter="formattedNumber"
+ />
<el-table-column label="寮�绁ㄤ汉" prop="issUer" show-overflow-tooltip />
- <el-table-column label="寮�绁ㄦ棩鏈�" prop="issueDate" show-overflow-tooltip />
+ <el-table-column
+ label="寮�绁ㄦ棩鏈�"
+ prop="issueDate"
+ show-overflow-tooltip
+ />
</el-table>
- <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper"
- :page="page.current" :limit="page.size" @pagination="paginationChange" />
+ <pagination
+ v-show="total > 0"
+ :total="total"
+ layout="total, sizes, prev, pager, next, jumper"
+ :page="page.current"
+ :limit="page.size"
+ @pagination="paginationChange"
+ />
</div>
</div>
</template>
<script setup>
-import pagination from '@/components/PIMTable/Pagination.vue'
-import { ref } from 'vue'
-import {Search} from "@element-plus/icons-vue";
-import {ElMessageBox } from "element-plus";
-import {productRecordList} from "@/api/procurementManagement/procurementInvoiceLedger.js";
-import {
- invoiceListPage
-} from "@/api/procurementManagement/procurementInvoiceLedger.js";
-const { proxy } = getCurrentInstance()
-const tableData = ref([])
-const tableLoading = ref(false)
+import pagination from "@/components/PIMTable/Pagination.vue";
+import { ref } from "vue";
+import { Search } from "@element-plus/icons-vue";
+import { ElMessageBox } from "element-plus";
+import { productRecordList } from "@/api/procurementManagement/procurementInvoiceLedger.js";
+import { invoiceListPage } from "@/api/procurementManagement/procurementInvoiceLedger.js";
+import dayjs from "dayjs";
+
+const { proxy } = getCurrentInstance();
+const tableData = ref([]);
+const tableLoading = ref(false);
const page = reactive({
current: 1,
size: 100,
-})
-const total = ref(0)
+});
+const total = ref(0);
// 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
- const data = reactive({
+const data = reactive({
searchForm: {
- purchaseContractNumber: '',
- supplierName: '',
- issueDate:''
+ purchaseContractNumber: "",
+ supplierName: "",
+ issueDate: [
+ dayjs().startOf("month").format("YYYY-MM-DD"),
+ dayjs().endOf("month").format("YYYY-MM-DD"),
+ ],
+ issueDateStart: dayjs().startOf("month").format("YYYY-MM-DD"),
+ issueDateEnd: dayjs().endOf("month").format("YYYY-MM-DD"),
},
form: {
- issueDate:"",// 寮�绁ㄦ棩鏈�
- purchaseLedgerId: '',
- purchaseLedgerNo: '',
- issUerId: '', // 寮�绁ㄤ汉id
- issUer: '' ,// 寮�绁ㄤ汉濮撳悕
+ issueDate: "", // 寮�绁ㄦ棩鏈�
+ purchaseLedgerId: "",
+ purchaseLedgerNo: "",
+ issUerId: "", // 寮�绁ㄤ汉id
+ issUer: "", // 寮�绁ㄤ汉濮撳悕
},
rules: {
- purchaseLedgerId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- }
-})
-const { searchForm } = toRefs(data)
+ purchaseLedgerId: [
+ { required: true, message: "璇烽�夋嫨", trigger: "change" },
+ ],
+ },
+});
+const { searchForm } = toRefs(data);
// 鏌ヨ鍒楄〃
/** 鎼滅储鎸夐挳鎿嶄綔 */
const handleQuery = () => {
- page.current = 1
- getList()
-}
+ page.current = 1;
+ getList();
+};
const paginationChange = (obj) => {
page.current = obj.page;
page.size = obj.limit;
- getList()
-}
+ getList();
+};
const getList = () => {
- tableLoading.value = true
- invoiceListPage({ ...searchForm.value, ...page }).then(res => {
- tableLoading.value = false
- tableData.value = res.records
- tableData.value.map(item => {
- item.children = []
+ tableLoading.value = true;
+ const { issueDate, ...rest } = searchForm.value;
+ invoiceListPage({ ...rest, ...page })
+ .then((res) => {
+ tableLoading.value = false;
+ tableData.value = res.records;
+ tableData.value.map((item) => {
+ item.children = [];
+ });
+ total.value = res.total;
+ expandedRowKeys.value = [];
})
- total.value = res.total
- expandedRowKeys.value = []
- }).catch(() => {
- tableLoading.value = false
- })
-}
+ .catch(() => {
+ tableLoading.value = false;
+ });
+};
const formattedNumber = (row, column, cellValue) => {
return parseFloat(cellValue).toFixed(2);
};
// 琛ㄦ牸閫夋嫨鏁版嵁
-const expandedRowKeys = ref([])
+const expandedRowKeys = ref([]);
// 灞曞紑琛�
const expandChange = (row, expandedRows) => {
if (expandedRows.length > 0) {
- expandedRowKeys.value = []
+ expandedRowKeys.value = [];
try {
- productRecordList({ id: row.id }).then(res => {
- const index = tableData.value.findIndex(item => item.id === row.id);
+ productRecordList({ id: row.id }).then((res) => {
+ const index = tableData.value.findIndex((item) => item.id === row.id);
if (index > -1) {
tableData.value[index].children = res;
}
- expandedRowKeys.value.push(row.id)
- })
+ expandedRowKeys.value.push(row.id);
+ });
} catch (error) {
- console.log(error)
+ console.log(error);
}
} else {
- expandedRowKeys.value = []
+ expandedRowKeys.value = [];
}
-}
+};
// 涓昏〃鍚堣鏂规硶
const summarizeMainTable = (param) => {
- return proxy.summarizeTable(param, ['invoiceAmount'], {
+ return proxy.summarizeTable(param, ["invoiceAmount"], {
ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
});
};
// 瀛愯〃鍚堣鏂规硶
const summarizeChildrenTable = (param) => {
- return proxy.summarizeTable(param, ['taxInclusiveUnitPrice', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice', 'ticketsNum', 'ticketsAmount', 'futureTickets', 'futureTicketsAmount'], {
- ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
- futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
- });
+ return proxy.summarizeTable(
+ param,
+ [
+ "taxInclusiveUnitPrice",
+ "taxInclusiveTotalPrice",
+ "taxExclusiveTotalPrice",
+ "ticketsNum",
+ "ticketsAmount",
+ "futureTickets",
+ "futureTicketsAmount",
+ ],
+ {
+ ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+ futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+ }
+ );
};
// 瀵煎嚭
const handleOut = () => {
- ElMessageBox.confirm(
- '閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�',
- '瀵煎嚭', {
- confirmButtonText: '纭',
- cancelButtonText: '鍙栨秷',
- type: 'warning',
- }
- ).then(() => {
- proxy.download("/purchase/registration/export", {}, '鏉ョエ鐧昏.xlsx')
- }).catch(() => {
- proxy.$modal.msg("宸插彇娑�")
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
})
-}
-getList()
+ .then(() => {
+ proxy.download("/purchase/registration/export", {}, "鏉ョエ鐧昏.xlsx");
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+};
+
+const changeDateRange = (date) => {
+ if (date) {
+ searchForm.receiptPaymentDateStart = date[0];
+ searchForm.receiptPaymentDateEnd = date[1];
+ getList();
+ }
+};
+
+const clearRange = () => {
+ searchForm.value.issueDate = [];
+ searchForm.value.issueDateStart = undefined;
+ searchForm.value.issueDateEnd = undefined;
+ getList();
+};
+
+onMounted(() => {
+ getList();
+});
</script>
<style scoped lang="scss"></style>
--
Gitblit v1.9.3