<script lang="ts" setup>
|
import { reactive } from 'vue';
|
|
import { useVbenModal } from '@vben/common-ui';
|
|
import { Form, FormItem, Input, message } from 'ant-design-vue';
|
|
import { confirmTechConfirmByCustomer } from '#/api/mes/pd/tech-confirm';
|
|
const emit = defineEmits(['success']);
|
|
const formData = reactive({
|
id: 0,
|
confirmNo: '',
|
customerName: '',
|
customerConfirmUser: '',
|
});
|
|
const [Modal, modalApi] = useVbenModal({
|
async onConfirm() {
|
if (!formData.customerConfirmUser.trim()) {
|
message.warning('请输入客户确认人');
|
return;
|
}
|
modalApi.lock();
|
try {
|
await confirmTechConfirmByCustomer(
|
formData.id,
|
formData.customerConfirmUser.trim(),
|
);
|
await modalApi.close();
|
emit('success');
|
message.success('客户确认成功');
|
} finally {
|
modalApi.unlock();
|
}
|
},
|
onOpenChange(isOpen: boolean) {
|
if (!isOpen) {
|
return;
|
}
|
const data = modalApi.getData<{
|
customerName?: string;
|
confirmNo?: string;
|
id: number;
|
}>();
|
formData.id = data.id;
|
formData.confirmNo = data.confirmNo ?? '';
|
formData.customerName = data.customerName ?? '';
|
// 默认带入客户名称作为确认人,客户对接人姓名可由业务员修正
|
formData.customerConfirmUser = data.customerName ?? '';
|
},
|
});
|
</script>
|
|
<template>
|
<Modal class="w-1/3" title="客户确认">
|
<Form :label-col="{ style: { width: '100px' } }">
|
<FormItem label="确认函编号">
|
{{ formData.confirmNo }}
|
</FormItem>
|
<FormItem label="客户名称">
|
{{ formData.customerName }}
|
</FormItem>
|
<FormItem label="客户确认人" required>
|
<Input
|
v-model:value="formData.customerConfirmUser"
|
:maxlength="64"
|
placeholder="请输入客户确认人姓名"
|
/>
|
</FormItem>
|
</Form>
|
</Modal>
|
</template>
|