update =>คำร้องขอแก้ไขทะเบียนประวัติ
This commit is contained in:
parent
8dadcb450a
commit
4b473d34ba
1 changed files with 102 additions and 60 deletions
|
|
@ -17,8 +17,14 @@ const $q = useQuasar();
|
|||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const store = useRequestEditStore();
|
||||
const { date2Thai, showLoader, hideLoader, messageError, success } =
|
||||
useCounterMixin();
|
||||
const {
|
||||
dialogConfirm,
|
||||
date2Thai,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
messageError,
|
||||
success,
|
||||
} = useCounterMixin();
|
||||
|
||||
const requestId = ref<string>(route.params.id.toString());
|
||||
const dataRequest = ref<any>({
|
||||
|
|
@ -55,13 +61,13 @@ async function fetchDataRequest() {
|
|||
detail: data.detail,
|
||||
};
|
||||
|
||||
// formData.status = data.status;
|
||||
// formData.remark = data.remark;
|
||||
// if (data.status !== "PENDING") {
|
||||
// isReadOnly.value = true;
|
||||
// } else {
|
||||
// isReadOnly.value = false;
|
||||
// }
|
||||
formData.status = data.status;
|
||||
formData.remark = data.remark;
|
||||
if (data.status !== "PENDING") {
|
||||
isReadOnly.value = true;
|
||||
} else {
|
||||
isReadOnly.value = false;
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -71,6 +77,28 @@ async function fetchDataRequest() {
|
|||
});
|
||||
}
|
||||
|
||||
/** function บันทึกรายการคำร้อง*/
|
||||
function onSubmit() {
|
||||
dialogConfirm($q, async () => {
|
||||
showLoader();
|
||||
await http
|
||||
.patch(config.API.requestEdit + `${requestId.value}`, {
|
||||
status: formData.status,
|
||||
remark: formData.remark,
|
||||
})
|
||||
.then(async () => {
|
||||
await fetchDataRequest();
|
||||
await success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function ค้นหาคำใน select สถานะคำร้อง
|
||||
* @param val คำค้น
|
||||
|
|
@ -203,64 +231,78 @@ onMounted(async () => {
|
|||
</q-card>
|
||||
|
||||
<!-- แก้ไขสถานะคำร้อง -->
|
||||
<q-card bordered class="row col-12">
|
||||
<div class="bg-grey-1 q-pa-sm col-12 row items-center">
|
||||
<div class="q-pl-sm text-weight-bold text-dark">
|
||||
แก้ไขสถานะคำร้อง
|
||||
<q-form
|
||||
class="col-12"
|
||||
greedy
|
||||
@submit.prevent
|
||||
@validation-success="onSubmit"
|
||||
>
|
||||
<q-card bordered class="row col-12">
|
||||
<div class="bg-grey-1 q-pa-sm col-12 row items-center">
|
||||
<div class="q-pl-sm text-weight-bold text-dark">
|
||||
แก้ไขสถานะคำร้อง
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12"><q-separator /></div>
|
||||
<q-card-section class="col-12">
|
||||
<div class="row q-col-gutter-sm">
|
||||
<div class="col-xs-12 col-md-12">
|
||||
<q-select
|
||||
:class="classInput(isReadOnly)"
|
||||
:readonly="isReadOnly"
|
||||
v-model="formData.status"
|
||||
label="สถานะ"
|
||||
dense
|
||||
outlined
|
||||
emit-value
|
||||
map-options
|
||||
:options="statusOption"
|
||||
:rules="[(val:string) => !!val || `${'กรุณาเลือกสถานะ'}`]"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
use-input
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
@filter="(inputValue:string,
|
||||
<div class="col-12"><q-separator /></div>
|
||||
<q-card-section class="col-12">
|
||||
<div class="row q-col-gutter-sm">
|
||||
<div class="col-xs-12 col-md-12">
|
||||
<q-select
|
||||
:class="classInput(isReadOnly)"
|
||||
:readonly="isReadOnly"
|
||||
v-model="formData.status"
|
||||
label="สถานะ"
|
||||
dense
|
||||
outlined
|
||||
emit-value
|
||||
map-options
|
||||
:options="statusOption"
|
||||
:rules="[(val:string) => !!val || `${'กรุณาเลือกสถานะ'}`]"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
use-input
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
@filter="(inputValue:string,
|
||||
doneFn:Function) => filterOption(inputValue, doneFn
|
||||
) "
|
||||
>
|
||||
<template v-slot:no-option>
|
||||
<q-item>
|
||||
<q-item-section class="text-grey">
|
||||
ไม่มีข้อมูล
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</template>
|
||||
</q-select>
|
||||
</div>
|
||||
>
|
||||
<template v-slot:no-option>
|
||||
<q-item>
|
||||
<q-item-section class="text-grey">
|
||||
ไม่มีข้อมูล
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</template>
|
||||
</q-select>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-md-12">
|
||||
<q-input
|
||||
:class="classInput(isReadOnly)"
|
||||
:readonly="isReadOnly"
|
||||
v-model="formData.remark"
|
||||
label="หมายเหตุ"
|
||||
dense
|
||||
outlined
|
||||
type="textarea"
|
||||
hide-bottom-space
|
||||
/>
|
||||
<div class="col-xs-12 col-md-12">
|
||||
<q-input
|
||||
:class="classInput(isReadOnly)"
|
||||
:readonly="isReadOnly"
|
||||
v-model="formData.remark"
|
||||
label="หมายเหตุ"
|
||||
dense
|
||||
outlined
|
||||
type="textarea"
|
||||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="row col-12 justify-end" v-if="!isReadOnly">
|
||||
<q-btn label="บันทึก" color="secondary" type="submit"
|
||||
><q-tooltip>บันทึก</q-tooltip></q-btn
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</q-card-section>
|
||||
<q-separator />
|
||||
</q-card>
|
||||
</q-form>
|
||||
|
||||
<div class="col-12">
|
||||
<Workflow :id="requestId" sys-name=" REGISTRY_PROFILE" />
|
||||
<Workflow :id="requestId" sys-name="REGISTRY_PROFILE" />
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue