feat:【antd】【crm】回款的新增/修改的时,正确处理合同

This commit is contained in:
YunaiV
2025-09-30 20:52:00 +08:00
parent 6b0d783564
commit 3708af6738
3 changed files with 11 additions and 7 deletions

View File

@@ -67,8 +67,11 @@ export function useFormSchema(): VbenFormSchema[] {
}, },
placeholder: '请选择客户', placeholder: '请选择客户',
}, },
dependencies: {
triggerFields: ['id'],
disabled: (values) => values.id,
},
}, },
// TODO @AI这里的合同名称不对
{ {
fieldName: 'contractId', fieldName: 'contractId',
label: '合同名称', label: '合同名称',
@@ -76,16 +79,18 @@ export function useFormSchema(): VbenFormSchema[] {
rules: 'required', rules: 'required',
dependencies: { dependencies: {
triggerFields: ['customerId'], triggerFields: ['customerId'],
disabled: (values) => !values.customerId, disabled: (values) => !values.customerId || values.id,
async componentProps(values) { async componentProps(values) {
if (values.customerId) { if (values.customerId) {
values.contractId = undefined; if (!values.id) {
// 特殊:只有在【新增】时,才清空合同编号
values.contractId = undefined;
}
const contracts = await getContractSimpleList(values.customerId); const contracts = await getContractSimpleList(values.customerId);
return { return {
options: contracts.map((item) => ({ options: contracts.map((item) => ({
label: item.name, label: item.name,
value: item.id, value: item.id,
disabled: item.auditStatus !== 20,
})), })),
placeholder: '请选择合同', placeholder: '请选择合同',
} as any; } as any;
@@ -292,7 +297,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{ {
title: '操作', title: '操作',
field: 'actions', field: 'actions',
minWidth: 130, minWidth: 200,
fixed: 'right', fixed: 'right',
slots: { default: 'actions' }, slots: { default: 'actions' },
}, },

View File

@@ -75,7 +75,7 @@ function handleBack() {
/** 编辑收款 */ /** 编辑收款 */
function handleEdit() { function handleEdit() {
formModalApi.setData({ id: receivableId.value }).open(); formModalApi.setData({ receivable: { id: receivableId.value } }).open();
} }
/** 加载数据 */ /** 加载数据 */

View File

@@ -217,7 +217,6 @@ const [Grid, gridApi] = useVbenVxeGrid({
icon: ACTION_ICON.EDIT, icon: ACTION_ICON.EDIT,
auth: ['crm:receivable:update'], auth: ['crm:receivable:update'],
onClick: handleEdit.bind(null, row), onClick: handleEdit.bind(null, row),
ifShow: row.auditStatus === 0,
}, },
{ {
label: '提交审核', label: '提交审核',