From b3af089315a98903163a394a3b1ca0e4c634b9ab Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 14 一月 2026 17:51:37 +0800
Subject: [PATCH] Merge branch 'dev_New' of http://114.132.189.42:9002/r/product-inventory-management into dev_New
---
src/views/procurementManagement/paymentEntry/index.vue | 381 +++++++++++++++++++++++++-----------------------------
1 files changed, 175 insertions(+), 206 deletions(-)
diff --git a/src/views/procurementManagement/paymentEntry/index.vue b/src/views/procurementManagement/paymentEntry/index.vue
index 4da6ac9..89152bf 100644
--- a/src/views/procurementManagement/paymentEntry/index.vue
+++ b/src/views/procurementManagement/paymentEntry/index.vue
@@ -27,10 +27,10 @@
</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 @click="handleExport" style="margin-right: 10px">瀵煎嚭</el-button>
<!-- <el-button type="danger" plain @click="handleDelete">-->
<!-- 鍒犻櫎-->
<!-- </el-button>-->
@@ -104,7 +104,6 @@
size="small"
@click="changeEditType(scope.row)"
v-if="!scope.row.editType"
- :disabled="scope.row.registrant !== userStore.nickName"
>缂栬緫</el-button
>
<el-button
@@ -113,7 +112,6 @@
size="small"
@click="saveReceiptPayment(scope.row)"
v-if="scope.row.editType"
- :disabled="scope.row.registrant !== userStore.nickName"
>淇濆瓨</el-button
>
<el-button
@@ -121,7 +119,6 @@
type="primary"
size="small"
@click="handleDelete(scope.row)"
- :disabled="scope.row.registrant !== userStore.nickName"
>鍒犻櫎</el-button
>
</template>
@@ -130,145 +127,100 @@
</template>
</PIMTable>
</div>
- <el-dialog
+ <FormDialog
v-model="dialogFormVisible"
- :title="operationType === 'add' ? '鏂板浠樻鐧昏' : '缂栬緫浠樻鐧昏'"
- width="60%"
+ title="鏂板浠樻椤甸潰"
+ :width="'90%'"
@close="closeDia"
+ @confirm="submitForm"
+ @cancel="closeDia"
>
- <el-form
- :model="form"
- label-width="140px"
- label-position="top"
- :rules="rules"
- ref="formRef"
+ <el-table
+ v-if="forms.length"
+ :data="forms"
+ border
+ style="width: 100%"
+ size="small"
>
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="閲囪喘鍚堝悓鍙凤細" prop="purchaseContractNumber">
- <el-input
- v-model="form.purchaseContractNumber"
- placeholder="鑷姩濉厖"
- clearable
- disabled
- />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="閿�鍞悎鍚屽彿锛�" prop="salesContractNo">
- <el-input
- v-model="form.salesContractNo"
- placeholder="鑷姩濉厖"
- clearable
- disabled
- />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="渚涘簲鍟嗗悕绉帮細" prop="supplierName">
- <el-input
- v-model="form.supplierName"
- placeholder="鑷姩濉厖"
- clearable
- disabled
- />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="鍙戠エ鍙凤細" prop="invoiceNumber">
- <el-input
- v-model="form.invoiceNumber"
- placeholder="鑷姩濉厖"
- clearable
- disabled
- />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="鍙戠エ閲戦(鍏�)锛�" prop="invoiceAmount">
- <el-input
- v-model="form.invoiceAmount"
- placeholder="鑷姩濉厖"
- clearable
- disabled
- />
- </el-form-item>
- </el-col>
- <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
- />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="浠樻鏂瑰紡锛�" prop="paymentMethod">
- <el-select
- v-model="form.paymentMethod"
- placeholder="璇烽�夋嫨"
- clearable
- >
- <el-option label="鐢垫眹" value="鐢垫眹" />
- <el-option label="鎵垮厬" value="鎵垮厬" />
- </el-select>
- </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="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
- v-model="form.registrationtDate"
- placeholder="璇疯緭鍏�"
- clearable
- />
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <template #footer>
- <div class="dialog-footer">
- <el-button type="primary" @click="submitForm">纭</el-button>
- <el-button @click="closeDia">鍙栨秷</el-button>
- </div>
- </template>
- </el-dialog>
+ <el-table-column type="index" label="搴忓彿" width="50" align="center"/>
+ <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="productCategory"
+ show-overflow-tooltip
+ width="100"
+ />
+ <el-table-column
+ label="瑙勬牸鍨嬪彿"
+ prop="specificationModel"
+ show-overflow-tooltip
+ width="150"
+ />
+ <el-table-column
+ label="寰呬粯娆鹃噾棰�(鍏�)"
+ prop="pendingTicketsTotal"
+ show-overflow-tooltip
+ width="170"
+ >
+ <template #default="{ row, column }">
+ <el-text type="danger">
+ {{ formattedNumber(row, column, row.pendingTicketsTotal) }}
+ </el-text>
+ </template>
+ </el-table-column>
+ <el-table-column label="鏈浠樻閲戦(鍏�)" width="180">
+ <template #default="{ row }">
+ <el-input-number
+ v-model="row.currentPaymentAmount"
+ :step="0.01"
+ :min="0"
+ :max="Number(row.pendingTicketsTotal || 0)"
+ :precision="2"
+ style="width: 100%"
+ placeholder="璇疯緭鍏�"
+ />
+ </template>
+ </el-table-column>
+ <el-table-column label="浠樻鏂瑰紡" width="160">
+ <template #default="{ row }">
+ <el-select v-model="row.paymentMethod" placeholder="璇烽�夋嫨" clearable>
+ <el-option label="鐢垫眹" value="鐢垫眹" />
+ <el-option label="鎵垮厬" value="鎵垮厬" />
+ </el-select>
+ </template>
+ </el-table-column>
+ <el-table-column label="浠樻鏃ユ湡" width="170">
+ <template #default="{ row }">
+ <el-date-picker
+ v-model="row.paymentDate"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ style="width: 100%"
+ />
+ </template>
+ </el-table-column>
+ <el-table-column label="鐧昏浜�" width="140">
+ <template #default="{ row }">
+ <el-input v-model="row.registrant" disabled />
+ </template>
+ </el-table-column>
+ <el-table-column label="鐧昏鏃ユ湡" width="170">
+ <template #default="{ row }">
+ <el-input v-model="row.registrationtDate" />
+ </template>
+ </el-table-column>
+ </el-table>
+ <div v-else class="empty-tip">璇烽�夋嫨闇�瑕佷粯娆剧殑璁板綍</div>
+ </FormDialog>
</div>
</template>
<script setup>
+import FormDialog from '@/components/Dialog/FormDialog.vue';
import { ref, reactive, toRefs, getCurrentInstance, nextTick, onMounted } from "vue";
import { Search } from "@element-plus/icons-vue";
import { ElMessageBox } from "element-plus";
@@ -287,6 +239,7 @@
updatePaymentRegistration
} from "@/api/procurementManagement/procurementInvoiceLedger.js";
import useFormData from "@/hooks/useFormData";
+import { getCurrentDate } from "@/utils/index.js";
const { proxy } = getCurrentInstance();
const tableColumn = ref([
@@ -298,10 +251,12 @@
{
label: "閲囪喘鍚堝悓鍙�",
prop: "purchaseContractNumber",
+ width:160
},
{
label: "閿�鍞悎鍚屽彿",
prop: "salesContractNo",
+ width:160
},
{
label: "渚涘簲鍟嗗悕绉�",
@@ -311,6 +266,7 @@
{
label: "浠樻鐘舵��",
prop: "statusName",
+ width:110,
dataType: "tag",
formatType: (params) => {
if (params == '鏈畬鎴愪粯娆�') {
@@ -322,35 +278,33 @@
}
},
},
- {
- label: "鍙戠エ鍙�",
- prop: "invoiceNumber",
- width:200
- },
- {
- label: "鍙戠エ閲戦(鍏�)",
- prop: "invoiceAmount",
- formatData: (params) => {
- return params ? parseFloat(params).toFixed(2) : 0;
- },
- },
+ {
+ label: "浜у搧澶х被",
+ prop: "productCategory",
+ showOverflowTooltip: true,
+ width: 100
+ },
+ {
+ label: "瑙勬牸鍨嬪彿",
+ prop: "specificationModel",
+ showOverflowTooltip: true,
+ width: 150
+ },
{
label: "宸蹭粯娆鹃噾棰�(鍏�)",
- prop: "paymentAmountTotal",
+ prop: "ticketsTotal",
+ width: 120,
formatData: (params) => {
return params ? parseFloat(params).toFixed(2) : 0;
},
},
{
label: "寰呬粯娆鹃噾棰�(鍏�)",
- prop: "unPaymentAmountTotal",
+ prop: "pendingTicketsTotal",
+ width: 120,
formatData: (params) => {
return params ? parseFloat(params).toFixed(2) : 0;
},
- },
- {
- label: "褰曞叆浜�",
- prop: "issUer",
},
]);
const tableData = ref([]);
@@ -358,6 +312,7 @@
const selectedRows = ref([]);
const tableLoading = ref(false);
const childrenLoading = ref(false);
+const forms = ref([]);
const userStore = useUserStore();
const page = reactive({
current: 1,
@@ -378,8 +333,6 @@
purchaseLedgerId: "",
salesContractNo: "",
supplierName: "",
- invoiceNumber: "",
- invoiceAmount: "",
taxRate: "",
currentPaymentAmount: "",
paymentMethod: "",
@@ -396,9 +349,6 @@
{ required: true, message: "璇疯緭鍏�", trigger: "blur" },
],
paymentMethod: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- invoiceNumber: [
- { required: true, message: "璇烽�夋嫨閲囪喘鍚堝悓鍙�", trigger: "change" },
- ],
},
});
const { form, rules } = toRefs(data);
@@ -411,11 +361,16 @@
if (!normalized) return 'info';
return normalized === '鏈畬鎴愪粯娆�' ? 'danger' : 'success';
};
+
+const formattedNumber = (row, column, cellValue) => {
+ const val = Number(cellValue ?? 0);
+ return Number.isFinite(val) ? val.toFixed(2) : "0.00";
+};
// 瀛愯〃鍚堣鏂规硶
const summarizeMainTable1 = (param) => {
return proxy.summarizeTable(
param,
- ["invoiceAmount", "paymentAmountTotal", "unPaymentAmountTotal"],
+ ["ticketsTotal", "pendingTicketsTotal"],
{
ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
@@ -444,8 +399,8 @@
tableLoading.value = true;
invoiceListPage({ ...searchForm, ...page }).then((res) => {
tableLoading.value = false;
- tableData.value = res.records;
- page.total = res.total;
+ tableData.value = res.data.records;
+ page.total = res.data.total;
if (expandedRowKeys.value.length > 0) {
const arr = []
const index = tableData.value.findIndex(item => item.id === expandedRowKeys.value[0]);
@@ -503,48 +458,66 @@
};
// 鎵撳紑寮规
const openForm = (type, row) => {
- if (selectedRows.value.length !== 1) {
- proxy.$message.error("璇烽�夋嫨涓�鏉″彂绁ㄦ暟鎹�");
+ if (selectedRows.value.length === 0) {
+ proxy.$modal.msgError("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
return;
}
- if (selectedRows.value[0].unPaymentAmountTotal == 0) {
- proxy.$message.warning("鏃犻渶鍐嶄粯娆�");
- return;
- }
- operationType.value = type;
- form.value = {};
- form.value = { ...selectedRows.value[0] };
- form.value.ticketRegistrationId = selectedRows.value[0].id;
- form.value.id = null;
- // 鏌ヨ閲囪喘鍚堝悓鍙�
- form.value.registrationtDate = getCurrentDate();
- form.value.paymentDate = getCurrentDate();
- form.value.registrant = userStore.name;
+ const validRows = selectedRows.value.filter((item) => Number(item.pendingTicketsTotal || 0) !== 0);
+ if (validRows.length === 0) {
+ proxy.$modal.msgWarning("鎵�閫夎褰曞潎鏃犻渶浠樻");
+ return;
+ }
+ forms.value = validRows.map((row) => ({
+ purchaseContractNumber: row.purchaseContractNumber || "",
+ salesContractNo: row.salesContractNo || "",
+ supplierName: row.supplierName || "",
+ supplierId: row.supplierId,
+ productCategory: row.productCategory || "",
+ specificationModel: row.specificationModel || "",
+ pendingTicketsTotal: Number(row.pendingTicketsTotal || 0),
+ currentPaymentAmount: "",
+ paymentMethod: "",
+ paymentDate: "",
+ registrant: userStore.nickName,
+ registrationtDate: getCurrentDate(),
+ ticketRegistrationId: row.id,
+ purchaseLedgerId: row.salesLedgerId,
+ salesLedgerProductId: row.id,
+ }));
dialogFormVisible.value = true;
};
// 鎻愪氦琛ㄥ崟
const submitForm = () => {
- proxy.$refs["formRef"].validate((valid) => {
- if (valid) {
- if (operationType.value === "edit") {
- submitEdit();
- } else {
- submitAdd();
- }
+ if (forms.value.length === 0) {
+ proxy.$modal.msgError("璇烽�夋嫨浠樻璁板綍");
+ return;
+ }
+ for (let i = 0; i < forms.value.length; i++) {
+ const item = forms.value[i];
+ const pendingAmount = Number(item.pendingTicketsTotal || 0);
+ const currentAmount = Number(item.currentPaymentAmount);
+ if (!item.currentPaymentAmount && item.currentPaymentAmount !== 0) {
+ proxy.$modal.msgError(`绗� ${i + 1} 鏉★細璇峰~鍐欎粯娆鹃噾棰漙);
+ return;
}
- });
-};
-// 鎻愪氦鏂板
-const submitAdd = () => {
- paymentRegistrationAdd(form.value).then((res) => {
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- closeDia();
- getList();
- });
-};
-// 鎻愪氦淇敼
-const submitEdit = () => {
- paymentRegistrationEdit(form.value).then((res) => {
+ if (currentAmount > pendingAmount) {
+ proxy.$modal.msgError(
+ `绗� ${i + 1} 鏉★細浠樻閲戦涓嶈兘瓒呰繃寰呬粯娆鹃噾棰濓紙寰呬粯娆撅細${pendingAmount.toFixed(
+ 2
+ )}锛塦
+ );
+ return;
+ }
+ if (!item.paymentMethod) {
+ proxy.$modal.msgError(`绗� ${i + 1} 鏉★細璇烽�夋嫨浠樻鏂瑰紡`);
+ return;
+ }
+ if (!item.paymentDate) {
+ proxy.$modal.msgError(`绗� ${i + 1} 鏉★細璇烽�夋嫨浠樻鏃ユ湡`);
+ return;
+ }
+ }
+ paymentRegistrationAdd(forms.value).then(() => {
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
closeDia();
getList();
@@ -552,7 +525,7 @@
};
// 鍏抽棴寮规
const closeDia = () => {
- proxy.resetForm("formRef");
+ forms.value = [];
dialogFormVisible.value = false;
};
// 鍒犻櫎
@@ -577,15 +550,6 @@
proxy.$modal.msg("宸插彇娑�");
});
};
-// 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD
-function getCurrentDate() {
- const today = new Date();
- const year = today.getFullYear();
- const month = String(today.getMonth() + 1).padStart(2, "0"); // 鏈堜唤浠�0寮�濮�
- const day = String(today.getDate()).padStart(2, "0");
- return `${year}-${month}-${day}`;
-}
-
// 瀵煎嚭
const handleExport = () => {
ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
@@ -613,4 +577,9 @@
::v-deep(.el-checkbox__label) {
font-weight: bold;
}
+.empty-tip {
+ text-align: center;
+ padding: 20px 0;
+ color: #909399;
+}
</style>
--
Gitblit v1.9.3