This commit is contained in:
2026-08-28 15:30:24 +08:00
parent 17bbde81b2
commit 9a4e0f7c03
16 changed files with 1016 additions and 183 deletions
+47 -10
View File
@@ -137,17 +137,15 @@
<div class="receipt-form-page__actions">
<el-button @click="goBack">取消</el-button>
<el-button v-if="!readonly" type="primary" plain @click="syncReferenceData">同步</el-button>
<el-button
v-if="!readonly && canSave"
type="primary"
plain
@click="saveDraft"
>保存</el-button>
<el-button v-if="!readonly && canSave" type="primary" plain @click="saveDraft"
>保存</el-button
>
<el-button
v-if="!readonly && canSave && hasPermission('invoice_receipt_submit')"
type="primary"
@click="submitForm"
>提交</el-button>
>提交</el-button
>
</div>
</el-form>
@@ -251,7 +249,7 @@ import { mapGetters } from 'vuex';
import * as api from '@/api/payment/invoiceReceipt';
import VehicleAttachmentTable from '@/components/vehicle-attachment-table/main.vue';
const invoicePoolMockRows = [
const invoicePoolMockTemplates = [
{
id: 90000001,
invoiceNo: '25312000000000000101',
@@ -311,6 +309,39 @@ const invoicePoolMockRows = [
},
];
const randomDigits = length =>
Array.from({ length }, () => Math.floor(Math.random() * 10)).join('');
const formatMockDate = date => {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
};
const createInvoicePoolMockRows = () =>
invoicePoolMockTemplates.map((template, index) => {
const invoiceDateValue = new Date();
invoiceDateValue.setDate(invoiceDateValue.getDate() - Math.floor(Math.random() * 15));
const invoiceDate = formatMockDate(invoiceDateValue);
const invoiceAmount = Math.floor(10000 + Math.random() * 190000);
const taxAmount = Number(
(
(invoiceAmount * Number(template.taxRate || 0)) /
(100 + Number(template.taxRate || 0))
).toFixed(2)
);
return {
...template,
id: Date.now() + index * 100 + Math.floor(Math.random() * 100),
invoiceNo: `25${randomDigits(18)}`,
invoiceDate,
invoiceAmount,
taxAmount,
kingdeeBillNo: `KD-FP-${invoiceDate.replaceAll('-', '')}${randomDigits(3)}`,
};
});
const emptyForm = () => ({
id: null,
kingdeeInvoicePoolId: null,
@@ -348,6 +379,7 @@ export default {
return {
Search,
form: emptyForm(),
invoicePoolMockRows: [],
customerEmailOptions: [],
departmentEmailOptions: [],
invoiceDialog: { visible: false, loading: false, keyword: '', rows: [], current: null },
@@ -415,6 +447,7 @@ export default {
.filter(Boolean);
},
async initialize() {
this.invoicePoolMockRows = createInvoicePoolMockRows();
const userInfo = this.$store.getters.userInfo || {};
const userEmail = userInfo.email || '';
this.departmentEmailOptions = userEmail ? [userEmail] : [];
@@ -466,6 +499,7 @@ export default {
async openInvoiceDialog() {
this.invoiceDialog.visible = true;
this.invoiceDialog.keyword = this.form.invoiceNo || '';
if (!this.recordId) this.invoicePoolMockRows = createInvoicePoolMockRows();
await this.loadInvoicePool();
},
async loadInvoicePool() {
@@ -485,8 +519,8 @@ export default {
const normalizedKeyword = String(keyword || '')
.trim()
.toLowerCase();
if (!normalizedKeyword) return invoicePoolMockRows.map(item => ({ ...item }));
return invoicePoolMockRows
if (!normalizedKeyword) return this.invoicePoolMockRows.map(item => ({ ...item }));
return this.invoicePoolMockRows
.filter(item =>
[item.invoiceNo, item.issuerName, item.receiverName].some(value =>
String(value || '')
@@ -705,6 +739,9 @@ export default {
</script>
<style scoped lang="scss">
.receipt-form-page__form {
padding-bottom: 72px;
}
.receipt-form-page__form :deep(.el-form-item) {
margin-bottom: 14px;
}