1.1.19 合同订单台账开票信息添加新增开票按钮,刷新按钮。新增开票按合同ID自动带出项目与合同相关信息

dev
yinq 2 days ago
parent 9eff776e30
commit 50717b7305

@ -321,6 +321,8 @@ import { UserVO } from '@/api/system/user/types';
import ContractSelectDialog from '@/views/oa/components/ContractSelectDialog.vue';
import FileUpload from '@/components/FileUpload/index.vue';
import { checkPermi } from '@/utils/permission';
import { getContractInfo } from '@/api/oa/erp/contractInfo';
import { listProjectInfoByContractId } from '@/api/oa/erp/projectInfo';
const userOptions = ref<UserVO[]>([]);
const deptOptions = ref<DeptTreeVO[]>([]);
@ -549,6 +551,34 @@ const calculateReturnedRate = () => {
}
};
// contractId
const initByContractId = async () => {
const contractId = routeParams.value.contractId as string | number | undefined;
if (!contractId) return;
const [contractRes, projectRes] = await Promise.all([getContractInfo(contractId), listProjectInfoByContractId(contractId)]);
const contract = contractRes?.data;
const projectList = (projectRes?.data || []) as any[];
const routeProjectId = routeParams.value.projectId as string | number | undefined;
const matchedProject =
projectList.find((item) => routeProjectId && String(item.projectId) === String(routeProjectId)) || projectList[0];
Object.assign(form.value, {
contractId,
contractCode: contract?.contractCode,
contractName: contract?.contractName,
customerId: contract?.oneCustomerId,
customerName: contract?.oneCustomerName,
totalPrice: contract?.totalPrice,
projectId: matchedProject?.projectId,
projectCode: matchedProject?.projectCode,
projectName: matchedProject?.projectName,
contractFlag: matchedProject?.contractFlag
});
await getContractPaymentMethods(contractId);
};
const isInitialized = ref(false);
onMounted(async () => {
@ -568,6 +598,7 @@ onMounted(async () => {
} else {
const res = await getBaseInfo();
Object.assign(form.value, res.data);
await initByContractId();
handleAddItem();
}
// true

@ -319,6 +319,10 @@
<span class="section-title">开票信息</span>
<el-tag v-if="invoiceTotal > 0" type="info" size="small" class="count-tag"> {{ invoiceTotal }} </el-tag>
</div>
<div class="header-actions">
<el-button size="default" type="primary" icon="Plus" @click="addInvoiceFromLedger"></el-button>
<el-button size="default" icon="Refresh" @click="loadInvoiceList"></el-button>
</div>
</div>
<el-table :data="invoiceList" size="default" border stripe v-loading="loadingInvoice" class="data-table">
@ -474,7 +478,7 @@ const purchaseQuery = reactive({
spareFlag: undefined as string | undefined
});
const invoiceTotal = ref(0);
const invoiceQuery = reactive({ pageNum: 1, pageSize: 10, projectId: undefined as string | number | undefined, contractId: undefined as string | number | undefined });
const invoiceQuery = reactive({ pageNum: 1, pageSize: 10, contractId: undefined as string | number | undefined });
/** 格式化数字 */
const formatNumber = (num: number) => {
@ -589,6 +593,20 @@ const viewInvoice = (row: FinInvoiceInfoVO) => {
});
};
/** 从台账新增开票,并携带合同信息 */
const addInvoiceFromLedger = () => {
const contractId = orderInfo.value?.contractId ?? contractInfo.value?.contractId;
if (!contractId) {
proxy?.$modal.msgWarning('合同信息未加载完成,请稍后重试');
return;
}
proxy?.$tab.openPage('/fin/finInvoiceInfo/edit', '开票信息', {
type: 'add',
source: 'orderLedger',
contractId
});
};
/** 加载订单基本信息和合同信息 */
const loadOrderAndContract = async () => {
if (!projectId.value) return;
@ -647,16 +665,14 @@ const getPurchaseMaterialRowClass = ({ row }: { row: { unpurchasedAmount?: numbe
/** 加载开票信息 */
const loadInvoiceList = async () => {
if (!projectId.value) {
const contractId = orderInfo.value?.contractId ?? contractInfo.value?.contractId;
if (!contractId) {
invoiceList.value = [];
invoiceTotal.value = 0;
return;
}
// IDVOcontractIdID
const contractId = orderInfo.value?.contractId ?? contractInfo.value?.contractId;
invoiceQuery.projectId = contractId ? undefined : projectId.value;
invoiceQuery.contractId = contractId ? contractId : undefined;
invoiceQuery.contractId = contractId;
loadingInvoice.value = true;
try {

Loading…
Cancel
Save