|
|
|
|
@ -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
|
|
|
|
|
|