From d14994e10797ce5bc0d29668d358f7c5274dcc5b Mon Sep 17 00:00:00 2001
From: wujianwei <wjw@11.com>
Date: 星期三, 15 四月 2026 15:46:17 +0800
Subject: [PATCH] 新增调用外部接口api
---
ui/admin-ui3/src/views/cwgl/payableBillManagement/index.vue | 463 +++++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 410 insertions(+), 53 deletions(-)
diff --git a/ui/admin-ui3/src/views/cwgl/payableBillManagement/index.vue b/ui/admin-ui3/src/views/cwgl/payableBillManagement/index.vue
index 45ba622..3c9336f 100644
--- a/ui/admin-ui3/src/views/cwgl/payableBillManagement/index.vue
+++ b/ui/admin-ui3/src/views/cwgl/payableBillManagement/index.vue
@@ -6,27 +6,103 @@
@search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange"
@size-change="sizeChange" @on-load="onLoad">
<template #menu-left>
- <el-button type="success" icon="Edit" :disabled="pageF.single" v-hasPermi="['cwgl:payableBillManagement:edit']"
+ <!-- <el-button type="success" icon="Edit" :disabled="pageF.single" v-hasPermi="['cwgl:payableBillManagement:edit']"
@click="handleUpdate">淇敼
</el-button>
<el-button type="danger" icon="Delete" :disabled="pageF.multiple" @click="handleDelete"
v-hasPermi="['cwgl:payableBillManagement:remove']">鍒犻櫎
- </el-button>
+ </el-button> -->
<el-button type="warning" plain icon="Download" @click="handleExport"
v-hasPermi="['cwgl:payableBillManagement:export']">瀵煎嚭
</el-button>
</template>
+
+ <template #menu="{ size, row, index }">
+ <el-link class="link-btn" type="primary" v-if="row.status == 0 || row.status == 1" :underline="false" plain
+ :size="size" @click="handleSettle(row)" v-hasPermi="['cwgl:payableBillManagement:receivableBillSettlementDetail']"> 缁撶畻
+ </el-link>
+ <el-link class="link-btn" type="primary" v-if="row.status == 0 || row.status == 1" :underline="false" plain :size="size" @click="makeInvoice(row)"
+ v-hasPermi="['cwgl:payableBillManagement:invoice']"> 寮�绁�
+ </el-link>
+ <el-link class="link-btn" type="primary" v-if="row.status == 0 || row.status == 1" :underline="false" plain :size="size" @click="makeParticulars(row)"
+ v-hasPermi="['cwgl:payableBillManagement:amount']"> 寮�绁ㄦ槑缁�
+ </el-link>
+ <el-link class="link-btn" type="primary" v-if="row.status == 0 || row.status == 1 || row.status == 3"
+ :underline="false" plain :size="size" @click="handleViewHistory(row)"
+ v-hasPermi="['cwgl:payableBillManagement:list']"> 缁撶畻鏄庣粏
+ </el-link>
+ <el-link class="link-btn" v-if="row.auditStatus == 0 || row.auditStatus == 2" type="primary" :underline="false" plain :size="size"
+ @click="handleAuditClick(row)"
+ v-hasPermi="['cwgl:receivableBillManagement:audit']">
+ 瀹℃牳
+ </el-link>
+ <el-link class="link-btn" type="primary" :underline="false" plain :size="size" @click="handleViewFeeDetail(row)"
+ v-hasPermi="['cwgl:payableBillManagement:view']"> 璇︽儏
+ </el-link>
+
+ <el-link class="link-btn" v-if="row.status == 0" type="primary" :underline="false" plain
+ @click="handleInvalid(row)" v-hasPermi="['cwgl:payableBillManagement:invalid']"> 浣滃簾
+ </el-link>
+
+ <el-button type="text" icon="View" @click="handleFlow(row)"
+ v-hasPermi="['cwgl:payableBillManagement:flow']">鏃ュ織</el-button>
+
+ </template>
</avue-crud>
</basicContainer>
+ <SettlementDialog ref="settleDialogRef" :type="currentType" @success="handleRefresh" />
+ <BillSettlementHistory ref="historyRef" :type="activeType" />
+ <NestedDetailDialog ref="feeDetailRef" :type="activeType" />
+ <OperationLogModal ref="logModalRef" />
+ <!-- 寮�绁� -->
+ <makeOutInvoice ref="makeOutInvoiceRef" :type="makeType" :InvoiceDetails="InvoiceDetails" @success="makeOutInvoiceFresh" />
+
+ <el-dialog title="璐﹀崟瀹℃牳" v-model="auditDialogVisible" width="500px" append-to-body>
+ <el-form :model="auditForm" :rules="auditRules" ref="auditFormRef" label-width="100px">
+ <!-- <el-form-item label="璐﹀崟ID" prop="billId">
+ <el-input v-model="auditForm.billId" disabled />
+ </el-form-item> -->
+ <!-- <el-form-item label="璐﹀崟绫诲瀷" prop="billType">
+ <el-select v-model="auditForm.billType" placeholder="璇烽�夋嫨" style="width: 100%" disabled>
+ <el-option label="搴旀敹" :value="0" />
+ <el-option label="搴斾粯" :value="1" />
+ </el-select>
+ </el-form-item> -->
+ <el-form-item label="瀹℃牳缁撴灉" prop="auditResult">
+ <el-radio-group v-model="auditForm.auditResult" @change="handleAuditResultChange" >
+ <el-radio :label="1">閫氳繃</el-radio>
+ <el-radio :label="2">椹冲洖</el-radio>
+ </el-radio-group>
+ </el-form-item>
+ <el-form-item label="瀹℃牳鎰忚" prop="auditComment">
+ <el-input v-model="auditForm.auditComment" type="textarea" :rows="3" placeholder="璇疯緭鍏ュ鏍告剰瑙�" />
+ </el-form-item>
+ </el-form>
+ <template #footer>
+ <span class="dialog-footer">
+ <el-button @click="auditDialogVisible = false">鍙� 娑�</el-button>
+ <el-button type="primary" @click="submitAudit">纭� 瀹�1</el-button>
+ </span>
+ </template>
+ </el-dialog>
</template>
<script setup name="payableBillManagement" lang="ts">
-import { PayableBillManagementI, addPayableBillManagement, delPayableBillManagement, exportPayableBillManagement, getPayableBillManagement, listPayableBillManagement, updatePayableBillManagement } from "@/api/cwgl/payableBillManagement";
+import { payableBillManagementInvoice,invoiceAmount,PayableBillManagementI,payableBillManagementVoid, addPayableBillManagement, delPayableBillManagement, exportPayableBillManagement, getPayableBillManagement, listPayableBillManagement, updatePayableBillManagement,receivableBillManagementAudit } from "@/api/cwgl/payableBillManagement";
import useCurrentInstance from "@/utils/useCurrentInstance";
-import { computed, reactive, ref, toRefs } from "vue";
+import { listPayableInvoiceBusiness,} from "@/api/cwgl/payableInvoiceBusiness";
+
+import { computed, reactive, ref, toRefs,nextTick } from "vue";
import { PagesInterface, PageQueryInterface } from "@/utils/globalInterface";
import { usePagePlus } from "@/hooks/usePagePlus";
import { hasPermission } from "@/utils/permissionUtils";
+import { listPayableBillManagementLog } from "@/api/cwgl/payableBillManagementLog";
+import SettlementDialog from '@/components/SettlementDialog/index.vue';
+import { addPayableBillSettlementDetail, } from "@/api/cwgl/payableBillSettlementDetail";
+import OperationLogModal from '@/components/OperationLogModal/index.vue';
+import BillSettlementHistory from '../../../components/BillSettlementHistory/index.vue';
+import NestedDetailDialog from '../../../components/NestedDetailDialog/index.vue';
+import makeOutInvoice from '@/components/makeOutInvoice/index.vue';
const { proxy } = useCurrentInstance();
const crudRef = ref();
@@ -54,12 +130,21 @@
const option = ref({
pageKey: 'PayableBillManagement',
rowKey: 'id',
+ delBtn: false,
+ addBtn: false,
+ viewBtn: false,
+ editBtn: false,
+ labelWidth: 150,
+ searchLabelWidth: 120,
column: {
- id: {
- label: 'ID',
- },
+ // id: {
+ // label: 'ID',
+ // },
systemNo: {
label: '绯荤粺缂栧彿',
+ minWidth: 150,
+ search: true,
+
rules: [
{
required: true,
@@ -69,6 +154,9 @@
},
billName: {
label: '璐﹀崟鍚嶇О',
+ minWidth: 150,
+ search: true,
+
rules: [
{
required: true,
@@ -78,6 +166,9 @@
},
supplierName: {
label: '渚涘簲鍟嗗悕绉�',
+ minWidth: 150,
+ search: true,
+
rules: [
{
required: true,
@@ -87,42 +178,67 @@
},
isInternalSettlement: {
label: '鏄惁鍐呴儴缁撶畻',
+ minWidth: 120,
+ type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/sys_whether_type',
rules: [
{
required: true,
- message: "鏄惁鍐呴儴缁撶畻涓嶈兘涓虹┖", trigger: "blur"
+ message: "鏄惁鍐呴儴缁撶畻涓嶈兘涓虹┖", trigger: "change"
}
],
},
internalSettlementUnit: {
label: '鍐呴儴缁撶畻鍗曚綅',
+ minWidth: 120,
+
},
documentCount: {
label: '鍗曟嵁鏁伴噺',
+ minWidth: 120,
+
},
totalAmount: {
label: '搴旂粨绠楅噾棰�',
+ minWidth: 120,
+
},
+ // currency: {
+ // label: '甯佸埗',
+
+ // },
currency: {
label: '甯佸埗',
+ minWidth: 120,
+ type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/sys_currency',
+ rules: [
+ {
+ required: true,
+ message: "甯佸埗涓嶈兘涓虹┖", trigger: "change"
+ }
+ ],
},
discountAmount: {
label: '鍑忓厤閲戦',
+ minWidth: 120,
+
},
paidAmount: {
label: '宸蹭粯閲戦',
+ minWidth: 120,
},
pendingAmount: {
label: '寰呬粯閲戦',
+ minWidth: 120,
},
- exchangeRate: {
- label: '姹囩巼',
- },
- cnyAmount: {
- label: '浜烘皯甯侀噾棰�',
- },
+ // exchangeRate: {
+ // label: '姹囩巼',
+ // },
+ // cnyAmount: {
+ // label: '浜烘皯甯侀噾棰�',
+ // },
periodType: {
label: '鍛ㄦ湡绫诲瀷',
+ minWidth: 120,
rules: [
{
required: true,
@@ -130,44 +246,49 @@
}
],
},
- businessStartDate: {
- label: '涓氬姟鏈熼棿寮�濮嬫棩鏈�',
- rules: [
- {
- required: true,
- message: "涓氬姟鏈熼棿寮�濮嬫棩鏈熶笉鑳戒负绌�", trigger: "blur"
+ businessStartDateArray: {
+ label: '涓氬姟鏈熼棿',
+ minWidth: 200,
+ formatter: (row) => {
+ if (row.businessEndDate && row.businessStartDate) {
+ return `${row.businessStartDate} 鑷� ${row.businessEndDate}`;
}
- ],
+ return row.periodType || '-';
+ }
},
- businessEndDate: {
- label: '涓氬姟鏈熼棿缁撴潫鏃ユ湡',
- rules: [
- {
- required: true,
- message: "涓氬姟鏈熼棿缁撴潫鏃ユ湡涓嶈兘涓虹┖", trigger: "blur"
+ businessDateArray: {
+ label: '璐﹀崟鍛ㄦ湡',
+ minWidth: 200,
+
+ formatter: (row) => {
+ if (row.billingStartDate && row.billingEndDate) {
+ return `${row.billingStartDate} 鑷� ${row.billingEndDate}`;
}
- ],
+ return row.periodType || '-';
+ }
},
- billingStartDate: {
- label: '璐︽湡寮�濮嬫棩鏈�',
- rules: [
- {
- required: true,
- message: "璐︽湡寮�濮嬫棩鏈熶笉鑳戒负绌�", trigger: "blur"
- }
- ],
- },
- billingEndDate: {
- label: '璐︽湡缁撴潫鏃ユ湡',
- rules: [
- {
- required: true,
- message: "璐︽湡缁撴潫鏃ユ湡涓嶈兘涓虹┖", trigger: "blur"
- }
- ],
- },
+ // businessStartDate: {
+ // label: '涓氬姟鏈熼棿寮�濮嬫棩鏈�',
+ // rules: [
+ // {
+ // required: true,
+ // message: "涓氬姟鏈熼棿寮�濮嬫棩鏈熶笉鑳戒负绌�", trigger: "blur"
+ // }
+ // ],
+ // },
+ // businessEndDate: {
+ // label: '涓氬姟鏈熼棿缁撴潫鏃ユ湡',
+ // rules: [
+ // {
+ // required: true,
+ // message: "涓氬姟鏈熼棿缁撴潫鏃ユ湡涓嶈兘涓虹┖", trigger: "blur"
+ // }
+ // ],
+ // },
billGenerateDate: {
label: '璐﹀崟鐢熸垚鏃ユ湡',
+ minWidth: 200,
+
rules: [
{
required: true,
@@ -175,11 +296,34 @@
}
],
},
+ // billingStartDate: {
+ // label: '璐︽湡寮�濮嬫棩鏈�',
+ // rules: [
+ // {
+ // required: true,
+ // message: "璐︽湡寮�濮嬫棩鏈熶笉鑳戒负绌�", trigger: "blur"
+ // }
+ // ],
+ // },
+ // billingEndDate: {
+ // label: '璐︽湡缁撴潫鏃ユ湡',
+ // rules: [
+ // {
+ // required: true,
+ // message: "璐︽湡缁撴潫鏃ユ湡涓嶈兘涓虹┖", trigger: "blur"
+ // }
+ // ],
+ // },
+
billSendDate: {
label: '璐﹀崟鍙戦�佹棩鏈�',
+ minWidth: 200,
+
},
billDueDate: {
label: '璐﹀崟鍒版湡鏃ユ湡',
+ minWidth: 200,
+
rules: [
{
required: true,
@@ -189,28 +333,44 @@
},
status: {
label: '鐘舵��',
+ minWidth: 120,
+ fixed: 'right',
+ type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/sys_bill_status',
+ search: true,
+ rules: [
+ {
+ required: true,
+ message: "鐘舵�佷笉鑳戒负绌�", trigger: "blur"
+ }
+ ],
},
- remark: {
- label: '澶囨敞',
- type: 'textarea', minRows: 3, maxRows: 5,
- },
+ // remark: {
+ // label: '澶囨敞',
+ // type: 'textarea', minRows: 3, maxRows: 5,
+ // },
createBy: {
label: '鍒涘缓浜�',
},
createTime: {
label: '鍒涘缓鏃堕棿',
+ minWidth: 200,
+
},
updateBy: {
label: '鏇存柊浜�',
},
updateTime: {
label: '鏇存柊鏃堕棿',
+ minWidth: 200,
+
},
- deleted: {
- label: '鍒犻櫎鏍囪(0:姝e父;1:鍒犻櫎)',
- },
+ // deleted: {
+ // label: '鍒犻櫎鏍囪(0:姝e父;1:鍒犻櫎)',
+ // },
}
})
+
+import { onMounted } from "vue";
const { tableData, pageF, rowSave, rowUpdate, rowDel, beforeOpen, searchChange,
searchReset, selectionChange, onLoad, currentChange, sizeChange, handleDelete, handleExport, handleUpdate, refreshChange } = usePagePlus({
@@ -232,6 +392,203 @@
selectionList.value = selection;
}
})
+/* 缁撶畻 */
+const settleDialogRef = ref()
+const currentType = ref<'receivable' | 'payable'>('receivable')
+const ids = ref('')
+const handleSettle = (row) => {
+ currentType.value = 'payable'
+ ids.value = row.id
+ getPayableBillManagement(row.id).then((res) => {
+ if (res.code === 200) {
+ settleDialogRef.value.open(res.data)
+ }
+ })
+
+}
+const handleRefresh = (data) => {
+ // ids.value
+ data.billId = ids.value
+ addPayableBillSettlementDetail(data).then((res) => {
+ if (res.code == 200) {
+ settleDialogRef.value.openIshpw()
+ proxy.$modal.msgSuccess(res.msg);
+ onLoad(page.value)
+
+ }
+ })
+}
+
+// 缁撶畻鍘嗗彶寮圭獥寮曠敤
+const historyRef = ref();
+const activeType = ref('payable');
+/** 鏌ョ湅缁撶畻璁板綍 */
+const handleViewHistory = (row: any) => {
+ // 鍋囪鐖剁粍浠堕�氳繃鏌愮鏂瑰紡鐭ラ亾褰撳墠鏄簲鏀惰繕鏄簲浠橀�昏緫
+ // 鎴栬�呯洿鎺ヤ粠 row 閲岀殑鏌愪釜瀛楁鍒ゆ柇
+ historyRef.value.open(row);
+};
+const feeDetailRef = ref();
+
+/** 鏌ョ湅璐圭敤鏄庣粏鎸夐挳鐐瑰嚮浜嬩欢 */
+const handleViewFeeDetail = (row: any) => {
+ // 璁剧疆褰撳墠涓氬姟绫诲瀷锛堝簲鏀堕〉闈紶 'receivable'锛屽簲浠橀〉闈紶 'payable'锛�
+ activeType.value = 'payable';
+ feeDetailRef.value.open(row);
+
+};
+
+
+const logModalRef = ref(null);
+const handleFlow = (row: any,) => {
+ // 杩欓噷鍙互浠� row 涓洿鎺ヨ幏鍙栨棩蹇楋紝鎴栬�呰皟鐢ㄥ悗绔帴鍙f煡璇�
+ listPayableBillManagementLog({ billId: row.id }).then((res) => {
+ if (res.code == 200) {
+ logModalRef.value.open(res.rows, 'payable');
+
+ }
+ });
+}
+
+const handleInvalid = (row: any) => {
+ proxy.$modal.confirm(`鏄惁浣滃簾璇ョ郴缁熺紪鍙� 锛�${row.systemNo}?`).then(function () {
+ return payableBillManagementVoid(row.id);
+ }).then((res) => {
+ onLoad(page.value);
+ proxy.$modal.msgSuccess(res.msg);
+ })
+
+}
+
+/* 寮�绁� */
+const makeOutInvoiceRef = ref()
+const makeType = ref<'搴斾粯璐﹀崟寮�绁�' | '搴旀敹璐﹀崟寮�绁�'>('搴斾粯璐﹀崟寮�绁�')
+const InvoiceDetails = ref('')
+
+const makeInvoice =(row) =>{
+ currentType.value = '搴斾粯璐﹀崟寮�绁�'
+ InvoiceDetails.value = '鏈寮�绁ㄤ俊鎭�'
+ ids.value = row.id
+ invoiceAmount(row.id).then((res)=>{
+ if(res.code==200){
+ row.invoicedAmount=res.data
+ makeOutInvoiceRef.value.open(row)
+
+ }
+ })
+
+}
+
+const makeOutInvoiceFresh = (submitData: any) => {
+ payableBillManagementInvoice(submitData,submitData.id).then(res => {
+ if (res.code == 200) {
+ proxy.$modal.msgSuccess(res.msg);
+ makeOutInvoiceRef.value.openIshpw()
+ onLoad(page.value); // 鍒锋柊鍒楄〃
+ }
+ })
+
+}
+
+const makeParticulars =(row) =>{
+ currentType.value = '搴斾粯璐﹀崟寮�绁ㄨ褰�'
+ InvoiceDetails.value = '寮�绁ㄦ槑缁�'
+ ids.value = row.id
+ listPayableInvoiceBusiness({headId: row.id}).then((res) => {
+ if (res.code === 200) {
+ row.recordList=res.rows
+ makeOutInvoiceRef.value.open(row)
+ }
+ })
+}
+
+ const auditDialogVisible = ref(false);
+ const auditFormRef = ref();
+
+ // 瀹℃牳琛ㄥ崟鏁版嵁
+ const auditForm = reactive({
+ billId: null as number | null,
+ billType: null as number | null, // 0:搴旀敹, 1:搴斾粯
+ auditResult: null as number | null, // 1:閫氳繃, 2:椹冲洖
+ auditComment: ''
+ });
+ const getAuditRules = () => {
+ return {
+ billId: [{ required: true, message: '璐﹀崟ID涓嶈兘涓虹┖', trigger: 'blur' }],
+ billType: [{ required: true, message: '璐﹀崟绫诲瀷涓嶈兘涓虹┖', trigger: 'change' }],
+ auditResult: [{ required: true, message: '瀹℃牳缁撴灉涓嶈兘涓虹┖', trigger: 'change' }],
+ // 鍔ㄦ�佽鍒欙細濡傛灉 auditResult 涓� 2 (椹冲洖)锛屽垯蹇呭~
+ auditComment: [
+ {
+ required: auditForm.auditResult === 2,
+ message: '椹冲洖鏃跺繀椤诲~鍐欏鏍告剰瑙�',
+ trigger: 'blur'
+ }
+ ]
+ };
+ };
+ const validateAuditComment = (rule: any, value: any, callback: any) => {
+ if (auditForm.auditResult === 2 && !value) {
+ callback(new Error('椹冲洖鏃跺繀椤诲~鍐欏鏍告剰瑙�'));
+ } else {
+ callback();
+ }
+ };
+ // 琛ㄥ崟鏍¢獙瑙勫垯
+ const auditRules = {
+ billId: [{ required: true, message: '璐﹀崟ID涓嶈兘涓虹┖', trigger: 'blur' }],
+ billType: [{ required: true, message: '璐﹀崟绫诲瀷涓嶈兘涓虹┖', trigger: 'change' }],
+ auditResult: [{ required: true, message: '瀹℃牳缁撴灉涓嶈兘涓虹┖', trigger: 'change' }],
+ auditComment: [{ validator: validateAuditComment, trigger: 'blur' }]
+ };
+ const handleAuditResultChange = (val: number) => {
+ // 褰撳垏鎹㈠鏍哥粨鏋滄椂锛岀珛鍗宠Е鍙戣〃鍗曟牎楠岋紝浠ユ洿鏂板鏍告剰瑙佸瓧娈电殑閿欒鎻愮ず鐘舵��
+ if (auditFormRef.value) {
+ auditFormRef.value.validateField('auditComment');
+ }
+
+ // 鍙�夛細濡傛灉閫夋嫨閫氳繃锛屽彲浠ユ竻绌轰箣鍓嶅~鍐欑殑椹冲洖鎰忚锛屾垨鑰呬繚鐣欑湅涓氬姟闇�姹�
+ // if (val === 1) {
+ // auditForm.auditComment = '';
+ // }
+ };
+ /**
+ * 鐐瑰嚮瀹℃牳鎸夐挳
+ */
+ const handleAuditClick = (row: any) => {
+ // 閲嶇疆琛ㄥ崟
+ auditForm.billId = row.id;
+ auditForm.billType = 1;
+ auditForm.auditResult = null;
+ auditForm.auditComment = '';
+
+ // 閲嶇疆鏍¢獙鐘舵��
+ nextTick(() => {
+ if (auditFormRef.value) {
+ auditFormRef.value.clearValidate();
+ }
+ });
+
+ auditDialogVisible.value = true;
+ };
+
+
+ /**
+ * 鎻愪氦瀹℃牳
+ */
+ const submitAudit = () => {
+ auditFormRef.value.validate((valid: boolean) => {
+ if (valid) {
+ receivableBillManagementAudit(auditForm).then(res => {
+ if (res.code === 200) {
+ proxy.$modal.msgSuccess(res.msg);
+ auditDialogVisible.value = false;
+ onLoad(page.value); // 鍒锋柊鍒楄〃
+ }
+ });
+ }
+ });
+ };
</script>
--
Gitblit v1.8.0