fix: แก้วิธีเก็บข้อมูลตอนแก้ไข

This commit is contained in:
Net 2024-06-11 12:55:46 +07:00
parent 1aa2e21350
commit f409d06a36

View file

@ -342,7 +342,6 @@ function onCloseBranch() {
} }
function clearForm() { function clearForm() {
customerType.value = 'CORP';
dialogInputForm.value = false; dialogInputForm.value = false;
formData.value = { formData.value = {
status: 'CREATED', status: 'CREATED',
@ -718,7 +717,10 @@ watch(fieldSelectedCustomer, async () => {
v.name === 'CORP' v.name === 'CORP'
? statsCustomerType?.CORP ?? 0 ? statsCustomerType?.CORP ?? 0
: statsCustomerType?.PERS ?? 0, : statsCustomerType?.PERS ?? 0,
label: v.name, label:
v.name === 'CORP'
? 'customerLegalEntity'
: 'customerNaturalPerson',
color: v.name === 'CORP' ? 'purple' : 'green', color: v.name === 'CORP' ? 'purple' : 'green',
})) }))
" "
@ -858,15 +860,22 @@ watch(fieldSelectedCustomer, async () => {
() => { () => {
if (!listCustomer) return; if (!listCustomer) return;
const { branch, ...payload } = i;
currentCustomer = payload;
currentCustomerId = i.id; currentCustomerId = i.id;
assignFormData(i); assignFormData(i);
infoDrawerEdit = true; infoDrawerEdit = true;
openDialogInputForm('INFO', i.id); openDialogInputForm('INFO', i.id);
} }
" "
@view-card=" @view-card="
() => { () => {
const { branch, ...payload } = i;
currentCustomer = payload;
currentCustomerId = i.id; currentCustomerId = i.id;
customerType = i.customerType; customerType = i.customerType;
assignFormData(i); assignFormData(i);
@ -1549,26 +1558,20 @@ watch(fieldSelectedCustomer, async () => {
<div class="q-ma-md"> <div class="q-ma-md">
<AppBox class="surface-1" style="padding: 0"> <AppBox class="surface-1" style="padding: 0">
<UsersDetailCardComponent <UsersDetailCardComponent
v-if="!!currentCustomer"
no-bg no-bg
no-detail no-detail
no-hover no-hover
color="purple" :color="
currentCustomer.customerType === 'CORP' ? 'purple' : 'green'
"
:metadata="{ id: '1', disabled: false }" :metadata="{ id: '1', disabled: false }"
:list="{ :list="{
id: '2', id: '1',
type: 'PERS', type: currentCustomer.customerType,
name: 'เจมส์ บอน', name: currentCustomer.customerName,
imageUrl: currentCustomer.imageUrl,
code: 'HQ006', code: 'HQ006',
detail: [
{
label: 'ชื่อบริษัท/นิติบุคคล ภาษาไทย',
value: 'บริษัทเฟรบเป้',
},
{
label: 'ชื่อบริษัท/นิติบุคคล ภาษาไทย',
value: 'บริษัทเฟรบเป้',
},
],
}" }"
@enter-card="openDialogInputForm" @enter-card="openDialogInputForm"
/> />
@ -1745,26 +1748,20 @@ watch(fieldSelectedCustomer, async () => {
<div class="q-ma-md"> <div class="q-ma-md">
<AppBox class="surface-1" style="padding: 0"> <AppBox class="surface-1" style="padding: 0">
<UsersDetailCardComponent <UsersDetailCardComponent
v-if="!!currentCustomer"
no-bg no-bg
no-detail no-detail
no-hover no-hover
color="purple" :color="
currentCustomer.customerType === 'CORP' ? 'purple' : 'green'
"
:metadata="{ id: '1', disabled: false }" :metadata="{ id: '1', disabled: false }"
:list="{ :list="{
id: '2', id: '1',
type: 'PERS', type: currentCustomer.customerType,
name: 'เจมส์ บอน', name: currentCustomer.customerName,
imageUrl: currentCustomer.imageUrl,
code: 'HQ006', code: 'HQ006',
detail: [
{
label: 'ชื่อบริษัท/นิติบุคคล ภาษาไทย',
value: 'บริษัทเฟรบเป้',
},
{
label: 'ชื่อบริษัท/นิติบุคคล ภาษาไทย',
value: 'บริษัทเฟรบเป้',
},
],
}" }"
@enter-card="openDialogInputForm" @enter-card="openDialogInputForm"
/> />