Merge branch 'develop' into dev-tee

This commit is contained in:
setthawutttty 2023-09-21 13:10:10 +07:00
commit f9355e5e27
13 changed files with 326 additions and 432 deletions

View file

@ -1,6 +1,6 @@
<!-- card อมลทอย -->
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { ref, onMounted, reactive } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
@ -16,7 +16,8 @@ import type {
AddressOps,
Address as AddressType,
optionData,
} from "@/modules//05_placement/interface/index/Main";
AddressData,
} from "@/modules/05_placement/interface/index/Main";
import type { PropType } from "vue";
const props = defineProps({
@ -61,6 +62,20 @@ const OpsFilter = ref<AddressOps>({
subdistrictCOps: [],
});
const registAddress = reactive<AddressData>({
subDistrictId: "",
zipCode: "",
districtId: "",
provinceId: "",
})
const currentAddress = reactive<AddressData>({
subDistrictId: "",
zipCode: "",
districtId: "",
provinceId: "",
})
onMounted(async () => {
await getNewData();
emit("update:statusEdit", false);
@ -117,40 +132,37 @@ const refreshData = async () => {
const getNewData = async () => {
await props.fetch();
await fetchProvince();
await fetchDistrict(addressData.value.registProvinceId, "1");
await fetchDistrict(addressData.value.currentProvinceId, "2");
await fetchSubDistrict(addressData.value.registDistrictId, "1");
await fetchSubDistrict(addressData.value.currentDistrictId, "2");
};
//
const editData = async () => {
const body = {
registrationSame: addressData.value.registSame == "1",
registrationAddress: addressData.value.registAddress,
registrationSubDistrictId: addressData.value.registSubDistrictId,
registrationDistrictId: addressData.value.registDistrictId,
registrationProvinceId: addressData.value.registProvinceId,
registrationZipCode: addressData.value.registZipCode,
registrationSubDistrictId: registAddress.subDistrictId,
registrationDistrictId: registAddress.districtId,
registrationProvinceId: registAddress.provinceId,
registrationZipCode: registAddress.provinceId,
currentAddress:
addressData.value.registSame == "1"
? addressData.value.registAddress
: addressData.value.currentAddress,
currentSubDistrictId:
addressData.value.registSame == "1"
? addressData.value.registSubDistrictId
: addressData.value.currentSubDistrictId,
? registAddress.subDistrictId
: currentAddress.subDistrictId,
currentDistrictId:
addressData.value.registSame == "1"
? addressData.value.registDistrictId
: addressData.value.currentDistrictId,
? registAddress.districtId
: currentAddress.districtId,
currentProvinceId:
addressData.value.registSame == "1"
? addressData.value.registProvinceId
: addressData.value.currentProvinceId,
? registAddress.provinceId
: currentAddress.provinceId,
currentZipCode:
addressData.value.registSame == "1"
? addressData.value.registZipCode
: addressData.value.currentZipCode,
? registAddress.zipCode
: currentAddress.zipCode,
};
showLoader();
await http
@ -171,63 +183,68 @@ const editData = async () => {
});
};
//
const saveData = async () => {
await myform.value.validate().then(async (success: boolean) => {
myform.value.validate().then((success: boolean) => {
if (success) {
await editData();
editData();
}
});
};
//
const selectProvince = async (e: string | null, name: string) => {
if (e != null) {
if (name == "1") {
addressData.value.registDistrictId = "";
addressData.value.registSubDistrictId = "";
addressData.value.registZipCode = "";
registAddress.subDistrictId = ""
registAddress.zipCode = ""
registAddress.districtId = ""
} else {
addressData.value.currentDistrictId = "";
addressData.value.currentSubDistrictId = "";
addressData.value.currentZipCode = "";
currentAddress.subDistrictId = ""
currentAddress.zipCode = ""
currentAddress.districtId = ""
}
myform.value.resetValidation();
await fetchDistrict(e, name);
}
};
//
const selectDistrict = async (e: string | null, name: string) => {
if (e != null) {
if (name == "1") {
addressData.value.registSubDistrictId = "";
addressData.value.registZipCode = "";
registAddress.subDistrictId = "";
registAddress.zipCode = "";
} else {
addressData.value.currentSubDistrictId = "";
addressData.value.currentZipCode = "";
currentAddress.subDistrictId = "";
currentAddress.zipCode = "";
}
myform.value.resetValidation();
await fetchSubDistrict(e, name);
}
};
//
const selectSubDistrict = (e: string | null, name: string) => {
if (e != null) {
if (name == "1") {
const findcode = Ops.value.subdistrictOps.filter((r) => r.id == e);
const namecode = findcode.length > 0 ? findcode[0].zipCode : "";
addressData.value.registZipCode = namecode;
registAddress.zipCode = namecode;
} else {
const findcode = Ops.value.subdistrictCOps.filter((r) => r.id == e);
const namecode = findcode.length > 0 ? findcode[0].zipCode : "";
addressData.value.currentZipCode = namecode;
currentAddress.zipCode = namecode;
}
}
};
//
const fetchProvince = async () => {
showLoader();
await http
.get(config.API.province)
.then((res) => {
.then(async (res) => {
const data = res.data.result;
let option: optionData[] = [];
data.map((r: any) => {
@ -235,6 +252,40 @@ const fetchProvince = async () => {
});
Ops.value.provinceOps = option;
OpsFilter.value.provinceOps = option;
const checkRegistProvinceId = await option.find((e: any) => e.id === addressData.value.registProvinceId)
// id
if (addressData.value.registProvinceId == '' || addressData.value.registProvinceId == '00000000-0000-0000-0000-000000000000' || !checkRegistProvinceId) {
registAddress.subDistrictId = ""
registAddress.zipCode = ""
registAddress.districtId = ""
} else {
registAddress.provinceId = await addressData.value.registProvinceId
registAddress.zipCode = await addressData.value.registZipCode
await fetchDistrict(addressData.value.registProvinceId, "1");
if (addressData.value.registDistrictId != null && addressData.value.registDistrictId != '00000000-0000-0000-0000-000000000000') {
await fetchSubDistrict(addressData.value.registDistrictId, "1");
}
}
const checkCurrentProvinceId = await option.find((e: any) => e.id === addressData.value.currentProvinceId)
// id
if (addressData.value.currentProvinceId == '' || addressData.value.currentProvinceId == '00000000-0000-0000-0000-000000000000' || !checkCurrentProvinceId) {
currentAddress.subDistrictId = ""
currentAddress.zipCode = ""
currentAddress.districtId = ""
} else {
currentAddress.provinceId = addressData.value.currentProvinceId
currentAddress.zipCode = addressData.value.currentZipCode
await fetchDistrict(addressData.value.currentProvinceId, "2");
if (addressData.value.currentDistrictId != null && addressData.value.currentDistrictId != '00000000-0000-0000-0000-000000000000') {
await fetchSubDistrict(addressData.value.currentDistrictId, "2");
}
}
})
.catch((e) => {
messageError($q, e);
@ -244,12 +295,13 @@ const fetchProvince = async () => {
});
};
//
const fetchDistrict = async (id: string | null, position: string) => {
if (id != null && id != "") {
showLoader();
await http
.get(config.API.listDistrict(id))
.then((res) => {
.then(async (res) => {
const data = res.data.result;
let option: optionData[] = [];
data.map((r: any) => {
@ -258,9 +310,22 @@ const fetchDistrict = async (id: string | null, position: string) => {
if (position == "1") {
Ops.value.districtOps = option;
OpsFilter.value.districtOps = option;
// id array
const checkRegistDistrictId = option.find((e: any) => e.id === addressData.value.registDistrictId)
if (checkRegistDistrictId) {
registAddress.districtId = addressData.value.registDistrictId
}
} else {
Ops.value.districtCOps = option;
OpsFilter.value.districtCOps = option;
// id array
const checkCurrentDistrictId = await option.find((e: any) => e.id === addressData.value.currentDistrictId)
if (checkCurrentDistrictId) {
currentAddress.districtId = addressData.value.currentDistrictId
}
}
})
.catch((e) => {
@ -272,12 +337,13 @@ const fetchDistrict = async (id: string | null, position: string) => {
}
};
//
const fetchSubDistrict = async (id: string | null, position: string) => {
if (id != null && id != "") {
showLoader();
await http
.get(config.API.listSubDistrict(id))
.then((res) => {
.then(async (res) => {
const data = res.data.result;
let option: zipCodeOption[] = [];
data.map((r: any) => {
@ -290,9 +356,21 @@ const fetchSubDistrict = async (id: string | null, position: string) => {
if (position == "1") {
Ops.value.subdistrictOps = option;
OpsFilter.value.subdistrictOps = option;
// id array
const checkRegistSubDistrictId = await option.find((e: any) => e.id === addressData.value.registSubDistrictId)
if (checkRegistSubDistrictId) {
registAddress.subDistrictId = addressData.value.registSubDistrictId
}
} else {
Ops.value.subdistrictCOps = option;
OpsFilter.value.subdistrictCOps = option;
// id array
const checkCurrentSubDistrictId = await option.find((e: any) => e.id === addressData.value.currentSubDistrictId)
if (checkCurrentSubDistrictId) {
currentAddress.subDistrictId = addressData.value.currentSubDistrictId
}
}
})
.catch((e) => {
@ -324,270 +402,94 @@ const getClass = (val: boolean) => {
};
};
</script>
<template>
<q-card class="col-12 q-px-lg q-py-md q-mt-md no-border">
<HeaderTop
v-model:edit="edit"
header="ข้อมูลที่อยู่"
icon="mdi-map-marker"
:save="saveData"
:history="false"
:changeBtn="changeBtn"
:disable="statusEdit"
:cancel="refreshData"
/>
<HeaderTop v-model:edit="edit" header="ข้อมูลที่อยู่" icon="mdi-map-marker" :save="saveData" :history="false"
:changeBtn="changeBtn" :disable="statusEdit" :cancel="refreshData" />
<q-form ref="myform">
<div class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs">
<div class="col-xs-12">
<q-input
:class="getClass(edit)"
hide-bottom-space
:outlined="edit"
dense
lazy-rules
type="textarea"
autogrow
:readonly="!edit"
:borderless="!edit"
v-model="addressData.registAddress"
:rules="[(val:string) => !!val || `${'กรุณากรอก ที่อยู่ตามทะเบียนบ้าน'}`]"
:label="`${'ที่อยู่ตามทะเบียนบ้าน'}`"
/>
<q-input :class="getClass(edit)" hide-bottom-space :outlined="edit" dense lazy-rules type="textarea" autogrow
:readonly="!edit" :borderless="!edit" v-model="addressData.registAddress"
:rules="[(val: string) => !!val || `${'กรุณากรอก ที่อยู่ตามทะเบียนบ้าน'}`]"
:label="`${'ที่อยู่ตามทะเบียนบ้าน'}`" />
</div>
<div class="col-xs-6 col-sm-3 col-md-3">
<selector
:hide-dropdown-icon="!edit"
hide-bottom-space
:class="getClass(edit)"
:readonly="!edit"
:borderless="!edit"
:rules="[(val:string) => !!val || `${'กรุณาเลือก จังหวัด'}`]"
:outlined="edit"
dense
lazy-rules
v-model="addressData.registProvinceId"
emit-value
map-options
option-label="name"
:options="Ops.provinceOps"
option-value="id"
:label="`${'จังหวัด'}`"
@update:model-value="(value:string) => selectProvince(value, '1')"
use-input
input-debounce="0"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'provinceOps'
) "
/>
<selector :hide-dropdown-icon="!edit" hide-bottom-space :class="getClass(edit)" :readonly="!edit"
:borderless="!edit" :rules="[(val: string) => !!val || `${'กรุณาเลือก จังหวัด'}`]" :outlined="edit" dense
lazy-rules v-model="registAddress.provinceId" emit-value map-options option-label="name"
:options="Ops.provinceOps" option-value="id" :label="`${'จังหวัด'}`"
@update:model-value="(value: string) => selectProvince(value, '1')" use-input input-debounce="0" @filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'provinceOps'
)" />
</div>
<div class="col-xs-6 col-sm-3 col-md-3">
<selector
:hide-dropdown-icon="!edit"
hide-bottom-space
:class="getClass(edit)"
:readonly="!edit"
:borderless="!edit"
:rules="[(val:string) => !!val || `${'กรุณาเลือก เขต / อำเภอ'}`]"
:outlined="edit"
dense
lazy-rules
v-model="addressData.registDistrictId"
emit-value
map-options
option-label="name"
:options="Ops.districtOps"
option-value="id"
:label="`${'เขต / อำเภอ'}`"
@update:model-value="(value:string) => selectDistrict(value, '1')"
use-input
input-debounce="0"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'districtOps'
) "
/>
<selector :hide-dropdown-icon="!edit" hide-bottom-space :class="getClass(edit)" :readonly="!edit"
:borderless="!edit" :rules="[(val: string) => !!val || `${'กรุณาเลือก เขต / อำเภอ'}`]" :outlined="edit" dense
lazy-rules v-model="registAddress.districtId" emit-value map-options option-label="name"
:options="Ops.districtOps" option-value="id" :label="`${'เขต / อำเภอ'}`"
@update:model-value="(value: string) => selectDistrict(value, '1')" use-input input-debounce="0" @filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'districtOps'
)" />
</div>
<div class="col-xs-6 col-sm-3 col-md-3">
<selector
:hide-dropdown-icon="!edit"
hide-bottom-space
:class="getClass(edit)"
:readonly="!edit"
:borderless="!edit"
:rules="[(val:string) => !!val || `${'กรุณาเลือก แขวง / ตำบล '}`]"
:outlined="edit"
dense
lazy-rules
v-model="addressData.registSubDistrictId"
emit-value
map-options
option-label="name"
:options="Ops.subdistrictOps"
option-value="id"
:label="`${'แขวง / ตำบล '}`"
@update:model-value="(value:string) => selectSubDistrict(value, '1')"
use-input
input-debounce="0"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'subdistrictOps'
) "
/>
<selector :hide-dropdown-icon="!edit" hide-bottom-space :class="getClass(edit)" :readonly="!edit"
:borderless="!edit" :rules="[(val: string) => !!val || `${'กรุณาเลือก แขวง / ตำบล '}`]" :outlined="edit" dense
lazy-rules v-model="registAddress.subDistrictId" emit-value map-options option-label="name"
:options="Ops.subdistrictOps" option-value="id" :label="`${'แขวง / ตำบล '}`"
@update:model-value="(value: string) => selectSubDistrict(value, '1')" use-input input-debounce="0" @filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'subdistrictOps'
)" />
</div>
<div class="col-xs-6 col-sm-3 col-md-3">
<q-input
:class="getClass(edit)"
hide-bottom-space
dense
lazy-rules
readonly
borderless
v-model="addressData.registZipCode"
:style="!edit ? '' : 'padding:0 12px;'"
:label="`${'รหัสไปรษณีย์'}`"
/>
<q-input :class="getClass(edit)" hide-bottom-space dense lazy-rules readonly borderless
v-model="registAddress.zipCode" :style="!edit ? '' : 'padding:0 12px;'" :label="`${'รหัสไปรษณีย์'}`" />
</div>
<div class="col-12 q-pt-lg"><q-separator /></div>
<div class="col-xs-12 q-gutter-sm items-center flex q-my-sm">
<label class="text-bold"
>อยจจนตรงกบทอยตามทะเบยนบาน</label
>
<q-radio
v-model="addressData.registSame"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="1"
label="ใช่"
dense
:disable="!edit"
/>
<q-radio
v-model="addressData.registSame"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="0"
label="ไม่"
dense
:disable="!edit"
/>
<label class="text-bold">อยจจนตรงกบทอยตามทะเบยนบาน</label>
<q-radio v-model="addressData.registSame" checked-icon="task_alt" unchecked-icon="panorama_fish_eye" val="1"
label="ใช่" dense :disable="!edit" />
<q-radio v-model="addressData.registSame" checked-icon="task_alt" unchecked-icon="panorama_fish_eye" val="0"
label="ไม่" dense :disable="!edit" />
</div>
<div class="col-xs-12" v-if="addressData.registSame == '0'">
<q-input
:class="getClass(edit)"
hide-bottom-space
:outlined="edit"
dense
lazy-rules
type="textarea"
autogrow
:readonly="!edit"
:borderless="!edit"
v-model="addressData.currentAddress"
:rules="[(val:string) => !!val || `${'กรุณากรอก ที่อยู่ปัจจุบัน'}`]"
:label="`${'ที่อยู่ปัจจุบัน'}`"
/>
<q-input :class="getClass(edit)" hide-bottom-space :outlined="edit" dense lazy-rules type="textarea" autogrow
:readonly="!edit" :borderless="!edit" v-model="addressData.currentAddress"
:rules="[(val: string) => !!val || `${'กรุณากรอก ที่อยู่ปัจจุบัน'}`]" :label="`${'ที่อยู่ปัจจุบัน'}`" />
</div>
<div
class="col-xs-6 col-sm-3 col-md-3"
v-if="addressData.registSame == '0'"
>
<selector
:hide-dropdown-icon="!edit"
hide-bottom-space
:class="getClass(edit)"
:readonly="!edit"
:borderless="!edit"
:rules="[(val:string) => !!val || `${'กรุณาเลือก จังหวัด'}`]"
:outlined="edit"
dense
lazy-rules
v-model="addressData.currentProvinceId"
emit-value
map-options
option-label="name"
:options="Ops.provinceOps"
option-value="id"
:label="`${'จังหวัด'}`"
@update:model-value="(value:string) => selectProvince(value, '2')"
use-input
input-debounce="0"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'provinceOps'
) "
/>
<div class="col-xs-6 col-sm-3 col-md-3" v-if="addressData.registSame == '0'">
<selector :hide-dropdown-icon="!edit" hide-bottom-space :class="getClass(edit)" :readonly="!edit"
:borderless="!edit" :rules="[(val: string) => !!val || `${'กรุณาเลือก จังหวัด'}`]" :outlined="edit" dense
lazy-rules v-model="currentAddress.provinceId" emit-value map-options option-label="name"
:options="Ops.provinceOps" option-value="id" :label="`${'จังหวัด'}`"
@update:model-value="(value: string) => selectProvince(value, '2')" use-input input-debounce="0" @filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'provinceOps'
)" />
</div>
<div
class="col-xs-6 col-sm-3 col-md-3"
v-if="addressData.registSame == '0'"
>
<selector
:hide-dropdown-icon="!edit"
hide-bottom-space
:class="getClass(edit)"
:readonly="!edit"
:borderless="!edit"
:rules="[(val:string) => !!val || `${'กรุณาเลือก เขต / อำเภอ'}`]"
:outlined="edit"
dense
lazy-rules
v-model="addressData.currentDistrictId"
emit-value
map-options
option-label="name"
:options="Ops.districtCOps"
option-value="id"
:label="`${'เขต / อำเภอ'}`"
@update:model-value="(value:string) => selectDistrict(value, '2')"
use-input
input-debounce="0"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'districtCOps'
) "
/>
<div class="col-xs-6 col-sm-3 col-md-3" v-if="addressData.registSame == '0'">
<selector :hide-dropdown-icon="!edit" hide-bottom-space :class="getClass(edit)" :readonly="!edit"
:borderless="!edit" :rules="[(val: string) => !!val || `${'กรุณาเลือก เขต / อำเภอ'}`]" :outlined="edit" dense
lazy-rules v-model="currentAddress.districtId" emit-value map-options option-label="name"
:options="Ops.districtCOps" option-value="id" :label="`${'เขต / อำเภอ'}`"
@update:model-value="(value: string) => selectDistrict(value, '2')" use-input input-debounce="0" @filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'districtCOps'
)" />
</div>
<div
class="col-xs-6 col-sm-3 col-md-3"
v-if="addressData.registSame == '0'"
>
<selector
:hide-dropdown-icon="!edit"
hide-bottom-space
:class="getClass(edit)"
:readonly="!edit"
:borderless="!edit"
:rules="[(val:string) => !!val || `${'กรุณาเลือก แขวง / ตำบล '}`]"
:outlined="edit"
dense
lazy-rules
v-model="addressData.currentSubDistrictId"
emit-value
map-options
option-label="name"
:options="Ops.subdistrictCOps"
option-value="id"
:label="`${'แขวง / ตำบล '}`"
@update:model-value="(value:string) => selectSubDistrict(value, '2')"
use-input
input-debounce="0"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'subdistrictCOps'
) "
/>
<div class="col-xs-6 col-sm-3 col-md-3" v-if="addressData.registSame == '0'">
<selector :hide-dropdown-icon="!edit" hide-bottom-space :class="getClass(edit)" :readonly="!edit"
:borderless="!edit" :rules="[(val: string) => !!val || `${'กรุณาเลือก แขวง / ตำบล '}`]" :outlined="edit" dense
lazy-rules v-model="currentAddress.subDistrictId" emit-value map-options option-label="name"
:options="Ops.subdistrictCOps" option-value="id" :label="`${'แขวง / ตำบล '}`"
@update:model-value="(value: string) => selectSubDistrict(value, '2')" use-input input-debounce="0" @filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'subdistrictCOps'
)" />
</div>
<div
class="col-xs-6 col-sm-3 col-md-3"
v-if="addressData.registSame == '0'"
>
<q-input
:class="getClass(edit)"
hide-bottom-space
dense
lazy-rules
readonly
borderless
v-model="addressData.currentZipCode"
:style="!edit ? '' : 'padding:0 12px;'"
:label="`${'รหัสไปรษณีย์'}`"
/>
<div class="col-xs-6 col-sm-3 col-md-3" v-if="addressData.registSame == '0'">
<q-input :class="getClass(edit)" hide-bottom-space dense lazy-rules readonly borderless
v-model="currentAddress.zipCode" :style="!edit ? '' : 'padding:0 12px;'" :label="`${'รหัสไปรษณีย์'}`" />
</div>
</div>
</q-form>

View file

@ -26,6 +26,8 @@ const myFormPosition = ref<any>();
const selected = ref<string>("");
const selectedFile = ref<string>("");
const dataRespone = ref<any>();
const search = ref<string>("");
const filterRef = ref<any>(null);
// Set form field
let dataForm = reactive({
@ -105,14 +107,6 @@ const fetchplacementPosition = async () => {
});
};
const search = ref<string>("");
//reset Tree Filter
const filterRef = ref<any>(null);
// const resetFilter = () => {
// search.value = "";
// filterRef.value.focus();
// };
const props = defineProps({
personalId: String,
modal: Boolean,
@ -122,10 +116,9 @@ const props = defineProps({
},
personal: Object,
});
// filter
const myFilterMethod = (node: any, filter: string) => {
const filt = filter;
return (
// ((node.name && node.name == null) || !node.name) &&
(node.name && node.name.indexOf(filt) > -1) ||
@ -156,7 +149,7 @@ const validateData = async () => {
}
});
};
//
const saveAppoint = async () => {
myFormPosition.value.validate().then(async (result: boolean) => {
if (result) {
@ -170,31 +163,29 @@ const saveAppoint = async () => {
positionPathSideId: dataForm.positionPathSideId,
positionTypeId: dataForm.positionTypeId,
};
showLoader();
await http
.post(config.API.placementPass(), dataAppoint)
.then(() => {
success($q, "บันทึกสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await closeAndClear();
await fetchPublishFile();
await loadTreeData();
await fetchplacementPosition();
hideLoader();
});
dialogConfirm($q, async () => {
showLoader();
await http
.post(config.API.placementPass(), dataAppoint)
.then(() => {
success($q, "บันทึกสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await closeAndClear();
await fetchPublishFile();
await loadTreeData();
await fetchplacementPosition();
hideLoader();
});
});
}
});
};
const editDataStatus = ref<boolean>(false);
const clickEditRow = () => {
editDataStatus.value = true;
};
const closeModal = () => {
if (editDataStatus.value == true) {
@ -221,7 +212,6 @@ const closeAndClear = async () => {
dataForm.positionLineId = "";
dataForm.positionPathSideId = "";
dataForm.positionTypeId = "";
editDataStatus.value = false;
};
//
const posNoOptions = ref<Object[]>([
@ -265,7 +255,7 @@ const positionLevelOptions = ref<Object[]>([
value: "",
},
]);
//
const selectedPosition = async (data: any) => {
if (data.name == null && selected.value != data.keyId) {
editDataStatus.value = true;
@ -366,7 +356,6 @@ watch(props, () => {
personal.value = data;
});
}
if (
personal.value &&
personal.value.draft === false &&
@ -385,7 +374,7 @@ watch(props, () => {
});
}
});
//
function findByPerson(element: any): any {
if (
element.positionNumId &&
@ -406,6 +395,7 @@ function findByPerson(element: any): any {
}
return null;
}
//
const clearPosition = () => {
dialogConfirm(
$q,
@ -414,6 +404,7 @@ const clearPosition = () => {
"ต้องการยืนยันการคืนตำแหน่งนี้ใช่หรือไม่ ?"
);
};
//
const postClearPosition = async () => {
showLoader();
await http
@ -421,7 +412,6 @@ const postClearPosition = async () => {
.then(() => {
success($q, "คืนตำแหน่งสำเร็จ");
})
.catch((e: Object) => {
messageError($q, e);
})

View file

@ -172,7 +172,7 @@ const columns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
//
const convertBmaOfficer = (val: string) => {
switch (val) {
case "OFFICER":
@ -185,6 +185,7 @@ const convertBmaOfficer = (val: string) => {
return "บุคคลภายนอก";
}
};
//
const convertContainStatus = (val: string) => {
switch (val) {
case "UN-CONTAIN":
@ -199,6 +200,7 @@ const convertContainStatus = (val: string) => {
return "-";
}
};
//
const convertDraft = (val: boolean) => {
switch (val) {
case false:
@ -209,7 +211,7 @@ const convertDraft = (val: boolean) => {
return "-";
}
};
//
const getTable = async () => {
showLoader();
await http
@ -253,10 +255,11 @@ const getTable = async () => {
rowsAll.value.push(rowData);
});
rows.value = roleAdmin
//
rows.value = roleAdmin.value
? rowsAll.value
: rowsAll.value.filter((x: any) => x.statusId != "CONTAIN");
: rowsAll.value.filter((x: any) => x.statusId !== "CONTAIN");
//
rowsFilter.value = rows.value.filter(
(e: any) =>
e.draft == "รอส่งตัว" &&
@ -273,6 +276,7 @@ const getTable = async () => {
};
const appointModal = ref<boolean>(false);
//
const saveDeferment = async () => {
myForm.value.validate().then(async (result: boolean) => {
if (result) {
@ -285,6 +289,7 @@ const saveDeferment = async () => {
}
});
};
// post
const postDeferment = async () => {
const formData = new FormData();
formData.append("personalId", personalId.value);
@ -307,7 +312,7 @@ const postDeferment = async () => {
hideLoader();
});
};
//
const saveDisclaim = async () => {
myForm.value.validate().then(async (result: boolean) => {
if (result) {
@ -320,6 +325,7 @@ const saveDisclaim = async () => {
}
});
};
// post
const postDisclaimf = async () => {
const dataPost = {
note: userNote.value,
@ -353,7 +359,7 @@ const getClass = (val: boolean) => {
"full-width cursor-pointer": !val,
};
};
//
const selectData = (pid: string) => {
if (roleAdmin.value === true) {
personalId.value = pid;
@ -367,7 +373,7 @@ const dataInfo = reactive({
reason: "",
reliefDoc: "",
});
//
const editDetail = (
props: PartialTableName,
action: "disclaim" | "deferment" | "defermentInfo" | "disclaimInfo"
@ -446,7 +452,6 @@ const clickCloseSendModal = () => {
const clickClose = async () => {
userNote.value = "";
if (editRow.value == true) {
dialogConfirm(
$q,
@ -501,6 +506,7 @@ const selected = ref<any>([]);
const personal_selected = ref<any>([]);
const filterlistAdd = ref<string>("");
const paging = ref<boolean>(true);
//
const savelist = () => {
selected.value.map((e: any) => {
personal_selected.value.push(e.personalId);
@ -528,16 +534,17 @@ const savelist = () => {
);
}
};
// popup
const handleModalAddListUpdate = (val: boolean) => {
modaladdlist.value = val;
(selected.value = []), (personal_selected.value = []);
};
//
const checkSelected = computed(() => {
if (selected.value.length === 0) {
return true;
}
});
const paginationLabel = (start: number, end: number, total: number) => {
if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
else return start + "-" + end + " ใน " + total;
@ -821,7 +828,7 @@ const pagination = ref({
:validate="validateData"
/>
</q-form>
<q-dialog v-model="modalDefermentDisclaim" persistent>
<q-card style="width: 800px">
<q-form ref="myForm">

View file

@ -2,7 +2,6 @@
import { ref, watch } from "vue";
import DialogHeader from "@/modules/05_placement/components/PersonalList/DialogHeader.vue";
import { useQuasar } from "quasar";
import DialogFooter from "@/modules/05_placement/components/PersonalList/DialogFooter.vue";
import type { QTableProps } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";

View file

@ -1,6 +1,6 @@
<script setup lang="ts">
import { ref, useAttrs } from "vue";
import { useQuasar } from "quasar";
import { QTooltip, useQuasar } from "quasar";
const $q = useQuasar();
const attrs = ref<any>(useAttrs());
const paging = ref<boolean>(true);
@ -106,10 +106,6 @@ const paginationLabel = (start: string, end: string, total: string) => {
else return start + "-" + end + " ใน " + total;
};
const refresh = () => props.refresh();
const initialPagination = ref<any>({
// descending: false,
rowsPerPage: props.paging == true ? 25 : 0,
});
const emit = defineEmits([
"update:inputfilter",
@ -161,7 +157,9 @@ const updateModaladdlist = () => {
icon="mdi-account-arrow-right"
@click="updateModaladdlist"
v-if="displayAdd"
/>
>
<q-tooltip>งรายชอไปยงหนวยงาน</q-tooltip>
</q-btn>
</div>
<q-space />
<div class="items-center" style="display: flex">

View file

@ -141,6 +141,13 @@ interface Address {
registSame: string;
}
interface AddressData {
subDistrictId: string;
zipCode: string;
districtId: string;
provinceId: string;
}
interface Certificate {
id: string;
certificateNo: string;
@ -223,6 +230,7 @@ export type {
optionData,
Certificate,
Assign,
AddressData,
};
export { AddressDataDefualt, FamilyDataDefualt };