From 9d496497c8f4b9fea9609efd20b96b44016c305d Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 03 十一月 2025 17:43:00 +0800
Subject: [PATCH] 付款流水-添加采购合同号筛选
---
src/views/procurementManagement/paymentEntry/index.vue | 318 +++++++++++++++++++++++++++++++++++++---------------
1 files changed, 224 insertions(+), 94 deletions(-)
diff --git a/src/views/procurementManagement/paymentEntry/index.vue b/src/views/procurementManagement/paymentEntry/index.vue
index 0190dd5..238c487 100644
--- a/src/views/procurementManagement/paymentEntry/index.vue
+++ b/src/views/procurementManagement/paymentEntry/index.vue
@@ -27,38 +27,17 @@
</el-col>
<el-col :span="4">
<el-form-item style="float: right; margin-right: unset">
+ <el-button @click="handleExport" style="margin-right: 10px">瀵煎嚭</el-button>
<el-button type="primary" @click="openForm('add')">
鏂板浠樻
</el-button>
- <el-button type="danger" plain @click="handleDelete">
- 鍒犻櫎
- </el-button>
+<!-- <el-button type="danger" plain @click="handleDelete">-->
+<!-- 鍒犻櫎-->
+<!-- </el-button>-->
</el-form-item>
</el-col>
</el-row>
</el-form>
- <!-- <div>
- <span class="search_title">渚涘簲鍟嗗悕绉�/鍚堝悓鍙凤細</span>
- <el-input
- v-model="searchForm.supplierNameOrContractNo"
- 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
@@ -66,14 +45,90 @@
:column="tableColumn"
:tableData="tableData"
:page="page"
+ :expandRowKeys="expandedRowKeys"
:isSelection="true"
:isShowSummary="isShowSummarySon"
:summaryMethod="summarizeMainTable1"
@selection-change="handleSelectionChange"
+ @expand-change="expandChange"
:tableLoading="tableLoading"
@pagination="pagination"
:total="page.total"
- ></PIMTable>
+ >
+ <template #expand="{ row }">
+ <el-table
+ :data="expandData"
+ border
+ show-summary
+ v-loading="childrenLoading"
+ :summary-method="summarizeMainTable2"
+ >
+ <el-table-column
+ align="center"
+ label="搴忓彿"
+ type="index"
+ width="60"
+ />
+ <el-table-column label="浠樻鏃ユ湡" prop="paymentDate" />
+ <el-table-column label="浠樻閲戦" prop="currentPaymentAmount">
+ <template #default="scope">
+ <el-input-number :step="0.01" :min="0" style="width: 100%"
+ v-model="scope.row.currentPaymentAmount"
+ :disabled="!scope.row.editType"
+ :precision="2"
+ placeholder="璇疯緭鍏�"
+ clearable
+ />
+ </template>
+ </el-table-column>
+ <el-table-column label="浠樻鏂瑰紡" prop="paymentMethod">
+ <template #default="scope">
+ <el-select
+ :disabled="!scope.row.editType"
+ v-model="scope.row.paymentMethod"
+ placeholder="璇烽�夋嫨"
+ clearable
+ >
+ <el-option label="鐢垫眹" value="鐢垫眹" />
+ <el-option label="鎵垮厬" value="鎵垮厬" />
+ </el-select>
+ </template>
+ </el-table-column>
+ <el-table-column label="鐧昏浜�" prop="registrant" />
+ <el-table-column label="鐧昏鏃ユ湡" prop="registrationtDate" />
+ <el-table-column label="鎿嶄綔" width="150">
+ <template #default="scope">
+ <el-button
+ link
+ type="primary"
+ size="small"
+ @click="changeEditType(scope.row)"
+ v-if="!scope.row.editType"
+ :disabled="scope.row.registrant !== userStore.nickName"
+ >缂栬緫</el-button
+ >
+ <el-button
+ link
+ type="primary"
+ size="small"
+ @click="saveReceiptPayment(scope.row)"
+ v-if="scope.row.editType"
+ :disabled="scope.row.registrant !== userStore.nickName"
+ >淇濆瓨</el-button
+ >
+ <el-button
+ link
+ type="primary"
+ size="small"
+ @click="handleDelete(scope.row)"
+ :disabled="scope.row.registrant !== userStore.nickName"
+ >鍒犻櫎</el-button
+ >
+ </template>
+ </el-table-column>
+ </el-table>
+ </template>
+ </PIMTable>
</div>
<el-dialog
v-model="dialogFormVisible"
@@ -146,6 +201,7 @@
<el-col :span="12">
<el-form-item label="鏈浠樻閲戦锛�" prop="currentPaymentAmount">
<el-input-number :step="0.01" :min="0" style="width: 100%"
+ :precision="2"
v-model="form.currentPaymentAmount"
placeholder="璇疯緭鍏�"
clearable
@@ -166,31 +222,31 @@
</el-select>
</el-form-item>
</el-col>
- <el-col :span="12">
- <el-form-item label="鐧昏浜猴細" prop="registrant">
- <el-input
- v-model="form.registrant"
- placeholder="璇疯緭鍏�"
- clearable
- disabled
- />
- </el-form-item>
- </el-col>
+ <el-col :span="12">
+ <el-form-item label="浠樻鏃ユ湡锛�" prop="paymentDate">
+ <el-date-picker
+ style="width: 100%"
+ v-model="form.paymentDate"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable
+ />
+ </el-form-item>
+ </el-col>
</el-row>
<el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="浠樻鏃ユ湡锛�" prop="paymentDate">
- <el-date-picker
- style="width: 100%"
- v-model="form.paymentDate"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- type="date"
- placeholder="璇烽�夋嫨"
- clearable
- />
- </el-form-item>
- </el-col>
+ <el-col :span="12">
+ <el-form-item label="鐧昏浜猴細" prop="registrant">
+ <el-input
+ v-model="form.registrant"
+ placeholder="璇疯緭鍏�"
+ clearable
+ disabled
+ />
+ </el-form-item>
+ </el-col>
<el-col :span="12">
<el-form-item label="鐧昏鏃ユ湡锛�" prop="registrationtDate">
<el-input
@@ -214,7 +270,7 @@
</template>
<script setup>
-import { ref } from "vue";
+import { ref, reactive, toRefs, getCurrentInstance, nextTick, onMounted } from "vue";
import { Search } from "@element-plus/icons-vue";
import { ElMessageBox } from "element-plus";
import useUserStore from "@/store/modules/user.js";
@@ -225,11 +281,21 @@
paymentRegistrationEdit,
getTicketNo,
} from "@/api/procurementManagement/paymentEntry.js";
-import { invoiceListPage } from "@/api/procurementManagement/procurementInvoiceLedger.js";
+import {
+ delPaymentRegistration,
+ invoiceListPage,
+ registrationListPageGetById,
+ updatePaymentRegistration
+} from "@/api/procurementManagement/procurementInvoiceLedger.js";
import useFormData from "@/hooks/useFormData";
const { proxy } = getCurrentInstance();
const tableColumn = ref([
+ {
+ type: "expand",
+ dataType: "slot",
+ slot: "expand",
+ },
{
label: "閲囪喘鍚堝悓鍙�",
prop: "purchaseContractNumber",
@@ -243,6 +309,20 @@
prop: "supplierName",
width:240
},
+ {
+ label: "浠樻鐘舵��",
+ prop: "statusName",
+ dataType: "tag",
+ formatType: (params) => {
+ if (params == '鏈畬鎴愪粯娆�') {
+ return "danger";
+ } else if (params == '宸插畬鎴愪粯娆�') {
+ return "success";
+ } else {
+ return null;
+ }
+ },
+ },
{
label: "鍙戠エ鍙�",
prop: "invoiceNumber",
@@ -269,11 +349,16 @@
return params ? parseFloat(params).toFixed(2) : 0;
},
},
+ {
+ label: "褰曞叆浜�",
+ prop: "issUer",
+ },
]);
const tableData = ref([]);
+const expandData = ref([]);
const selectedRows = ref([]);
const tableLoading = ref(false);
-const invoiceNumberList = ref([]);
+const childrenLoading = ref(false);
const userStore = useUserStore();
const page = reactive({
current: 1,
@@ -320,7 +405,13 @@
const { form, rules } = toRefs(data);
const { form: searchForm, resetForm } = useFormData(data.searchForm);
const isShowSummarySon = ref(true);
+const expandedRowKeys = ref([]);
+const getStatusTagType = (statusName = '') => {
+ const normalized = statusName.trim();
+ if (!normalized) return 'info';
+ return normalized === '鏈畬鎴愪粯娆�' ? 'danger' : 'success';
+};
// 瀛愯〃鍚堣鏂规硶
const summarizeMainTable1 = (param) => {
return proxy.summarizeTable(
@@ -331,6 +422,13 @@
futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
}
);
+};
+// 瀛愯〃鍚堣鏂规硶
+const summarizeMainTable2 = (param) => {
+ return proxy.summarizeTable(param, ["currentPaymentAmount"], {
+ ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+ futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+ });
};
// 鏌ヨ鍒楄〃
/** 鎼滅储鎸夐挳鎿嶄綔 */
@@ -349,7 +447,56 @@
tableLoading.value = false;
tableData.value = res.records;
page.total = res.total;
+ if (expandedRowKeys.value.length > 0) {
+ const arr = []
+ const index = tableData.value.findIndex(item => item.id === expandedRowKeys.value[0]);
+ if (index > -1) {
+ arr.push(tableData.value[index]);
+ expandChange(tableData.value[index], arr)
+ }
+ }
});
+};
+// 灞曞紑琛�
+const expandChange = (row, expandedRows) => {
+ if (expandedRows.length > 0) {
+ nextTick(() => {
+ expandedRowKeys.value = [];
+ try {
+ childrenLoading.value = true;
+ registrationListPageGetById({ id: row.id }).then((res) => {
+ childrenLoading.value = false;
+ const index = tableData.value.findIndex((item) => item.id === row.id);
+ if (index > -1) {
+ expandData.value = res;
+ }
+ expandedRowKeys.value.push(row.id);
+ });
+ } catch (error) {
+ childrenLoading.value = false;
+ console.log(error);
+ }
+ })
+ } else {
+ expandedRowKeys.value = [];
+ }
+};
+// 缂栬緫淇敼鐘舵��
+const changeEditType = (row) => {
+ row.editType = !row.editType;
+};
+// 淇濆瓨鍥炴璁板綍
+const saveReceiptPayment = (row) => {
+ let updateData = {
+ id: row.id,
+ currentPaymentAmount: row.currentPaymentAmount,
+ paymentMethod: row.paymentMethod,
+ };
+ updatePaymentRegistration(updateData).then((res) => {
+ row.editType = !row.editType;
+ getList();
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ });
};
// 琛ㄦ牸閫夋嫨鏁版嵁
const handleSelectionChange = (selection) => {
@@ -361,6 +508,10 @@
proxy.$message.error("璇烽�夋嫨涓�鏉″彂绁ㄦ暟鎹�");
return;
}
+ if (selectedRows.value[0].unPaymentAmountTotal == 0) {
+ proxy.$message.warning("鏃犻渶鍐嶄粯娆�");
+ return;
+ }
operationType.value = type;
form.value = {};
form.value = { ...selectedRows.value[0] };
@@ -371,38 +522,6 @@
form.value.paymentDate = getCurrentDate();
form.value.registrant = userStore.name;
dialogFormVisible.value = true;
-};
-// 閫夋嫨鍙戠エ鍙蜂互鍚庣粰鍙戠エ閲戦璧嬪��
-const setInvoiceAmount = (value) => {
- if (value) {
- invoiceNumberList.value.forEach((item) => {
- if (item.invoiceNumber === value) {
- form.value.invoiceAmount = item.invoiceAmount;
- form.value.ticketRegistrationId = item.id;
- }
- });
- } else {
- form.value.invoiceAmount = "";
- }
-};
-// 閫夋嫨閲囪喘鍚堝悓鍙疯祴鍊�
-const setInfo = (value) => {
- getTicketNo({ id: value }).then((res) => {
- invoiceNumberList.value = res.data;
- });
- if (value) {
- byPurchaseId(value).then((res) => {
- form.value.salesContractNo = res.data.salesContractNo;
- form.value.supplierName = res.data.supplierName;
- form.value.taxRate = res.data.taxRate;
- form.value.supplierId = res.data.supplierId;
- });
- } else {
- form.value.salesContractNo = "";
- form.value.supplierName = "";
- form.value.taxRate = "";
- form.value.supplierId = "";
- }
};
// 鎻愪氦琛ㄥ崟
const submitForm = () => {
@@ -438,14 +557,7 @@
dialogFormVisible.value = false;
};
// 鍒犻櫎
-const handleDelete = () => {
- let ids = [];
- if (selectedRows.value.length > 0) {
- ids = selectedRows.value.map((item) => item.id);
- } else {
- proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
- return;
- }
+const handleDelete = (row) => {
ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず", {
confirmButtonText: "纭",
cancelButtonText: "鍙栨秷",
@@ -453,7 +565,7 @@
})
.then(() => {
tableLoading.value = true;
- paymentRegistrationDel(ids)
+ delPaymentRegistration(row.id)
.then((res) => {
proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
getList();
@@ -474,7 +586,25 @@
const day = String(today.getDate()).padStart(2, "0");
return `${year}-${month}-${day}`;
}
-getList();
+
+// 瀵煎嚭
+const handleExport = () => {
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ proxy.download("/purchase/registration/exportOne", { ...searchForm, ...page }, "浠樻鐧昏.xlsx");
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+};
+
+onMounted(() => {
+ getList();
+});
</script>
<style scoped lang="scss">
--
Gitblit v1.9.3