clearable

This commit is contained in:
setthawutttty 2024-02-12 14:34:29 +07:00
parent 5a7622a0c7
commit 447cbc7b27
6 changed files with 63 additions and 9 deletions

View file

@ -203,6 +203,13 @@
> >
</q-icon> </q-icon>
</template> </template>
<template v-if="refCommandDate && edit" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="refCommandDate = null"
class="cursor-pointer"
/>
</template>
</q-input> </q-input>
</template> </template>
</datepicker> </datepicker>
@ -302,7 +309,7 @@ const issuer = ref<string>();
const detail = ref<string>(); const detail = ref<string>();
const issueDate = ref<Date>(new Date()); const issueDate = ref<Date>(new Date());
const refCommandNo = ref<string>(); const refCommandNo = ref<string>();
const refCommandDate = ref<Date | null|string>(new Date()); const refCommandDate = ref<Date | null | string>(new Date());
const myForm = ref<any>(); //form data input const myForm = ref<any>(); //form data input
const edit = ref<boolean>(false); // dialog const edit = ref<boolean>(false); // dialog
const modal = ref<boolean>(false); //modal add detail const modal = ref<boolean>(false); //modal add detail
@ -500,9 +507,9 @@ const fetchData = async () => {
issuer: e.issuer, issuer: e.issuer,
detail: e.detail, detail: e.detail,
issueDate: new Date(e.issueDate), issueDate: new Date(e.issueDate),
refCommandNo: e.refCommandNo == '' ? '-':e.refCommandNo, refCommandNo: e.refCommandNo == "" ? "-" : e.refCommandNo,
refCommandDate: refCommandDate:
e.refCommandDate == null ? '-' : new Date(e.refCommandDate), e.refCommandDate == null ? "-" : new Date(e.refCommandDate),
createdAt: new Date(e.createdAt), createdAt: new Date(e.createdAt),
createdFullName: e.createdFullName, createdFullName: e.createdFullName,
}); });
@ -611,7 +618,9 @@ const saveData = async () => {
issueDate: dateToISO(issueDate.value), issueDate: dateToISO(issueDate.value),
refCommandNo: refCommandNo.value, refCommandNo: refCommandNo.value,
refCommandDate: refCommandDate:
refCommandDate.value == null ? null : dateToISO(refCommandDate.value as Date), refCommandDate.value == null
? null
: dateToISO(refCommandDate.value as Date),
}) })
.then((res) => { .then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ"); success($q, "บันทึกข้อมูลสำเร็จ");
@ -639,7 +648,9 @@ const editData = async () => {
issueDate: dateToISO(issueDate.value), issueDate: dateToISO(issueDate.value),
refCommandNo: refCommandNo.value, refCommandNo: refCommandNo.value,
refCommandDate: refCommandDate:
refCommandDate.value == null ? null : dateToISO(refCommandDate.value as Date), refCommandDate.value == null
? null
: dateToISO(refCommandDate.value as Date),
}) })
.then((res) => { .then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ"); success($q, "บันทึกข้อมูลสำเร็จ");

View file

@ -219,6 +219,13 @@
> >
</q-icon> </q-icon>
</template> </template>
<template v-if="refCommandDate && edit" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="refCommandDate = null"
class="cursor-pointer"
/>
</template>
</q-input> </q-input>
</template> </template>
</datepicker> </datepicker>

View file

@ -369,7 +369,7 @@
> >
</q-icon> </q-icon>
</template> </template>
<template v-if="finishDate" v-slot:append> <template v-if="finishDate && edit" v-slot:append>
<q-icon <q-icon
name="cancel" name="cancel"
@click.stop.prevent="finishDate = null" @click.stop.prevent="finishDate = null"
@ -381,7 +381,6 @@
</datepicker> </datepicker>
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
{{ isEducation }}
<selector <selector
:class="getClass(edit)" :class="getClass(edit)"
:outlined="edit" :outlined="edit"
@ -395,7 +394,6 @@
@update:modelValue="clickEditRow" @update:modelValue="clickEditRow"
emit-value emit-value
map-options map-options
clearable
option-label="name" option-label="name"
:options="Ops.positionPathOptions" :options="Ops.positionPathOptions"
option-value="id" option-value="id"
@ -404,7 +402,15 @@
@filter="(inputValue:any, @filter="(inputValue:any,
doneFn:Function) => filterSelector(inputValue, doneFn,'positionPathOptions' doneFn:Function) => filterSelector(inputValue, doneFn,'positionPathOptions'
) " ) "
/> >
<template v-if="isEducation !== null && edit" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="isEducation = null"
class="cursor-pointer"
/>
</template>
</selector>
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<q-input <q-input

View file

@ -330,6 +330,13 @@
> >
</q-icon> </q-icon>
</template> </template>
<template v-if="dateAnnounce && edit" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="dateAnnounce = null"
class="cursor-pointer"
/>
</template>
</q-input> </q-input>
</template> </template>
</datepicker> </datepicker>
@ -396,6 +403,13 @@
> >
</q-icon> </q-icon>
</template> </template>
<template v-if="refCommandDate && edit" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="refCommandDate = null"
class="cursor-pointer"
/>
</template>
</q-input> </q-input>
</template> </template>
</datepicker> </datepicker>

View file

@ -201,6 +201,13 @@
> >
</q-icon> </q-icon>
</template> </template>
<template v-if="refCommandDate && edit" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="refCommandDate = null"
class="cursor-pointer"
/>
</template>
</q-input> </q-input>
</template> </template>
</datepicker> </datepicker>

View file

@ -244,8 +244,17 @@
> >
</q-icon> </q-icon>
</template> </template>
<template v-if="refCommandDate && edit" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="refCommandDate = null"
class="cursor-pointer"
/>
</template>
</q-input> </q-input>
</template> </template>
</datepicker> </datepicker>
</div> </div>
</div> </div>