แก้ ที่อยู่ รับโอน component ทะเบียนบ้างส่วนประวัติ
This commit is contained in:
parent
e64b68c017
commit
8c1a5d9b23
17 changed files with 5864 additions and 25 deletions
875
src/components/information/Address.vue
Normal file
875
src/components/information/Address.vue
Normal file
|
|
@ -0,0 +1,875 @@
|
||||||
|
<template>
|
||||||
|
<q-card flat bordered class="col-12 q-px-lg q-py-md q-mt-md">
|
||||||
|
<HeaderTop
|
||||||
|
v-model:edit="edit"
|
||||||
|
header="ข้อมูลที่อยู่"
|
||||||
|
icon="mdi-map-marker"
|
||||||
|
:save="saveData"
|
||||||
|
:history="!statusAdd()"
|
||||||
|
:changeBtn="changeBtn"
|
||||||
|
:disable="statusEdit"
|
||||||
|
:cancel="refreshData"
|
||||||
|
:historyClick="clickHistory"
|
||||||
|
:addEmployee="statusAdd()"
|
||||||
|
/>
|
||||||
|
<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.address"
|
||||||
|
: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.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.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.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="codep"
|
||||||
|
: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.same"
|
||||||
|
checked-icon="task_alt"
|
||||||
|
unchecked-icon="panorama_fish_eye"
|
||||||
|
val="1"
|
||||||
|
label="ใช่"
|
||||||
|
dense
|
||||||
|
:disable="!edit"
|
||||||
|
/>
|
||||||
|
<q-radio
|
||||||
|
v-model="addressData.same"
|
||||||
|
checked-icon="task_alt"
|
||||||
|
unchecked-icon="panorama_fish_eye"
|
||||||
|
val="0"
|
||||||
|
label="ไม่"
|
||||||
|
dense
|
||||||
|
:disable="!edit"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xs-12" v-if="addressData.same == '0'">
|
||||||
|
<q-input
|
||||||
|
:class="getClass(edit)"
|
||||||
|
hide-bottom-space
|
||||||
|
:outlined="edit"
|
||||||
|
dense
|
||||||
|
lazy-rules
|
||||||
|
type="textarea"
|
||||||
|
autogrow
|
||||||
|
:readonly="!edit"
|
||||||
|
:borderless="!edit"
|
||||||
|
v-model="addressData.addressC"
|
||||||
|
:rules="[(val:string) => !!val || `${'กรุณากรอก ที่อยู่ปัจจุบัน'}`]"
|
||||||
|
:label="`${'ที่อยู่ปัจจุบัน'}`"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6 col-sm-3 col-md-3" v-if="addressData.same == '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.provinceIdC"
|
||||||
|
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.same == '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.districtIdC"
|
||||||
|
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.same == '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.subdistrictIdC"
|
||||||
|
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.same == '0'">
|
||||||
|
<q-input
|
||||||
|
:class="getClass(edit)"
|
||||||
|
hide-bottom-space
|
||||||
|
dense
|
||||||
|
lazy-rules
|
||||||
|
readonly
|
||||||
|
borderless
|
||||||
|
v-model="codec"
|
||||||
|
:style="!edit ? '' : 'padding:0 12px;'"
|
||||||
|
:label="`${'รหัสไปรษณีย์'}`"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</q-form>
|
||||||
|
</q-card>
|
||||||
|
<HistoryTable
|
||||||
|
:rows="rowsHistory"
|
||||||
|
:columns="columnsHistory"
|
||||||
|
:filter="filterHistory"
|
||||||
|
:visible-columns="visibleColumnsHistory"
|
||||||
|
v-model:modal="modalHistory"
|
||||||
|
v-model:inputfilter="filterHistory"
|
||||||
|
v-model:inputvisible="visibleColumnsHistory"
|
||||||
|
v-model:tittle="tittleHistory"
|
||||||
|
>
|
||||||
|
<template #columns="props">
|
||||||
|
<q-tr :props="props">
|
||||||
|
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
||||||
|
<div v-if="col.name == 'createdAt'" class="table_ellipsis">
|
||||||
|
{{ date2Thai(col.value) }}
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-else-if="col.name == 'registrationSame'"
|
||||||
|
class="table_ellipsis"
|
||||||
|
>
|
||||||
|
{{ col.value ? "ใช่" : "ไม่" }}
|
||||||
|
</div>
|
||||||
|
<div v-else class="table_ellipsis">
|
||||||
|
{{ col.value }}
|
||||||
|
</div>
|
||||||
|
</q-td>
|
||||||
|
</q-tr>
|
||||||
|
</template>
|
||||||
|
</HistoryTable>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, onMounted } from "vue";
|
||||||
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
import { useDataStore } from "@/stores/data";
|
||||||
|
import { useQuasar } from "quasar";
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
import config from "@/app.config";
|
||||||
|
import type {
|
||||||
|
Address,
|
||||||
|
DataOption,
|
||||||
|
zipCodeOption,
|
||||||
|
} from "@/modules/04_registry/components/profileType";
|
||||||
|
import { defaultAddress } from "@/modules/04_registry/components/profileType";
|
||||||
|
import HeaderTop from "@/modules/04_registry/components/Information/top.vue";
|
||||||
|
import type { RequestItemsHistoryObject } from "@/modules/04_registry/interface/request/Address";
|
||||||
|
import type { ResponseObject } from "@/modules/04_registry/interface/response/Address";
|
||||||
|
import HistoryTable from "@/components/TableHistory.vue";
|
||||||
|
import { useRoute } from "vue-router";
|
||||||
|
import type { AddressOps } from "@/modules/04_registry/interface/index/Main";
|
||||||
|
import type { QTableProps } from "quasar";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
statusEdit: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
statusAdd: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const emit = defineEmits(["update:statusEdit"]);
|
||||||
|
|
||||||
|
const route = useRoute();
|
||||||
|
const $q = useQuasar();
|
||||||
|
const dataStore = useDataStore();
|
||||||
|
const { loaderPage } = dataStore;
|
||||||
|
const mixin = useCounterMixin();
|
||||||
|
const { date2Thai, success, messageError } = mixin;
|
||||||
|
const edit = ref<boolean>(false);
|
||||||
|
const addressData = ref<Address>(defaultAddress);
|
||||||
|
const myform = ref<any>();
|
||||||
|
const codep = ref<string>("");
|
||||||
|
const codec = ref<string>("");
|
||||||
|
const rowsHistory = ref<RequestItemsHistoryObject[]>([]); //select data history
|
||||||
|
const tittleHistory = ref<string>("ประวัติแก้ไขข้อมูลที่อยู่"); //
|
||||||
|
const filterHistory = ref<string>(""); //search data table history
|
||||||
|
const modalHistory = ref<boolean>(false); //modal ประวัติการแก้ไขข้อมูล
|
||||||
|
const Ops = ref<AddressOps>({
|
||||||
|
provinceOps: [],
|
||||||
|
districtOps: [],
|
||||||
|
districtCOps: [],
|
||||||
|
subdistrictOps: [],
|
||||||
|
subdistrictCOps: [],
|
||||||
|
});
|
||||||
|
const OpsFilter = ref<AddressOps>({
|
||||||
|
provinceOps: [],
|
||||||
|
districtOps: [],
|
||||||
|
districtCOps: [],
|
||||||
|
subdistrictOps: [],
|
||||||
|
subdistrictCOps: [],
|
||||||
|
});
|
||||||
|
const columnsHistory = ref<QTableProps["columns"]>([
|
||||||
|
{
|
||||||
|
name: "registrationAddress",
|
||||||
|
align: "left",
|
||||||
|
label: "ที่อยู่ตามทะเบียนบ้าน",
|
||||||
|
sortable: true,
|
||||||
|
field: "registrationAddress",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "registrationProvince",
|
||||||
|
align: "left",
|
||||||
|
label: "จังหวัดตามทะเบียนบ้าน",
|
||||||
|
sortable: true,
|
||||||
|
field: "registrationProvince",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "registrationDistrict",
|
||||||
|
align: "left",
|
||||||
|
label: "เขต/อำเภอตามทะเบียนบ้าน",
|
||||||
|
sortable: true,
|
||||||
|
field: "registrationDistrict",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "registrationSubDistrict",
|
||||||
|
align: "left",
|
||||||
|
label: "ตำบล/แขวงตามทะเบียนบ้าน",
|
||||||
|
sortable: true,
|
||||||
|
field: "registrationSubDistrict",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "registrationZipCode",
|
||||||
|
align: "left",
|
||||||
|
label: "รหัสไปรษณีย์ตามทะเบียนบ้าน",
|
||||||
|
sortable: true,
|
||||||
|
field: "registrationZipCode",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "registrationSame",
|
||||||
|
align: "left",
|
||||||
|
label: "ที่อยู่ปัจจุบันตรงกับที่อยู่ตามทะเบียนบ้าน",
|
||||||
|
sortable: true,
|
||||||
|
field: "registrationSame",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "currentAddress",
|
||||||
|
align: "left",
|
||||||
|
label: "ที่อยู่ปัจจุบัน",
|
||||||
|
sortable: true,
|
||||||
|
field: "currentAddress",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "currentProvince",
|
||||||
|
align: "left",
|
||||||
|
label: "จังหวัดปัจจุบัน",
|
||||||
|
sortable: true,
|
||||||
|
field: "currentProvince",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "currentDistrict",
|
||||||
|
align: "left",
|
||||||
|
label: "เขต/อำเภอปัจจุบัน",
|
||||||
|
sortable: true,
|
||||||
|
field: "currentDistrict",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "currentSubDistrict",
|
||||||
|
align: "left",
|
||||||
|
label: "ตำบล/แขวงปัจจุบัน",
|
||||||
|
sortable: true,
|
||||||
|
field: "currentSubDistrict",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "currentZipCode",
|
||||||
|
align: "left",
|
||||||
|
label: "รหัสไปรษณีย์ปัจจุบัน",
|
||||||
|
sortable: true,
|
||||||
|
field: "currentZipCode",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "createdFullName",
|
||||||
|
align: "left",
|
||||||
|
label: "ผู้ดำเนินการ",
|
||||||
|
sortable: true,
|
||||||
|
field: "createdFullName",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "createdAt",
|
||||||
|
align: "left",
|
||||||
|
label: "วันที่แก้ไข",
|
||||||
|
sortable: true,
|
||||||
|
field: "createdAt",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
const visibleColumnsHistory = ref<String[]>([
|
||||||
|
"currentAddress",
|
||||||
|
"currentDistrict",
|
||||||
|
"currentProvince",
|
||||||
|
"currentSubDistrict",
|
||||||
|
"currentZipCode",
|
||||||
|
"registrationAddress",
|
||||||
|
"registrationDistrict",
|
||||||
|
"registrationProvince",
|
||||||
|
"registrationSame",
|
||||||
|
"registrationSubDistrict",
|
||||||
|
"registrationZipCode",
|
||||||
|
"createdFullName",
|
||||||
|
"createdAt",
|
||||||
|
]);
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
await getNewData();
|
||||||
|
emit("update:statusEdit", false);
|
||||||
|
defaultAdd();
|
||||||
|
});
|
||||||
|
|
||||||
|
const statusAdd = () => props.statusAdd;
|
||||||
|
|
||||||
|
const defaultAdd = () => {
|
||||||
|
if (props.statusAdd) {
|
||||||
|
edit.value = props.statusAdd;
|
||||||
|
addressData.value = {
|
||||||
|
address: null,
|
||||||
|
provinceId: null,
|
||||||
|
districtId: null,
|
||||||
|
subdistrictId: null,
|
||||||
|
addressC: null,
|
||||||
|
provinceIdC: null,
|
||||||
|
districtIdC: null,
|
||||||
|
subdistrictIdC: null,
|
||||||
|
same: "0",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const filterSelector = (val: any, update: Function, refData: string) => {
|
||||||
|
switch (refData) {
|
||||||
|
case "provinceOps":
|
||||||
|
update(() => {
|
||||||
|
Ops.value.provinceOps = OpsFilter.value.provinceOps.filter(
|
||||||
|
(v: DataOption) => v.name.indexOf(val) > -1
|
||||||
|
);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case "districtOps":
|
||||||
|
update(() => {
|
||||||
|
Ops.value.districtOps = OpsFilter.value.districtOps.filter(
|
||||||
|
(v: DataOption) => v.name.indexOf(val) > -1
|
||||||
|
);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case "districtCOps":
|
||||||
|
update(() => {
|
||||||
|
Ops.value.districtCOps = OpsFilter.value.districtCOps.filter(
|
||||||
|
(v: DataOption) => v.name.indexOf(val) > -1
|
||||||
|
);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case "subdistrictOps":
|
||||||
|
update(() => {
|
||||||
|
Ops.value.subdistrictOps = OpsFilter.value.subdistrictOps.filter(
|
||||||
|
(v: DataOption) => v.name.indexOf(val) > -1
|
||||||
|
);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case "subdistrictCOps":
|
||||||
|
update(() => {
|
||||||
|
Ops.value.subdistrictCOps = OpsFilter.value.subdistrictCOps.filter(
|
||||||
|
(v: DataOption) => v.name.indexOf(val) > -1
|
||||||
|
);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ฟังชั้นดูข้อมูลประวัติแก้ไขข้อมูลที่เลือก
|
||||||
|
*/
|
||||||
|
const clickHistory = async () => {
|
||||||
|
modalHistory.value = true;
|
||||||
|
loaderPage(true);
|
||||||
|
await http
|
||||||
|
.get(config.API.profileAdrsHisId(route.params.id.toString()))
|
||||||
|
.then((res) => {
|
||||||
|
let data = res.data.result;
|
||||||
|
rowsHistory.value = [];
|
||||||
|
data.map((e: RequestItemsHistoryObject) => {
|
||||||
|
rowsHistory.value.push({
|
||||||
|
currentAddress: e.currentAddress,
|
||||||
|
currentDistrict: e.currentDistrict,
|
||||||
|
currentProvince: e.currentProvince,
|
||||||
|
currentSubDistrict: e.currentSubDistrict,
|
||||||
|
currentZipCode: e.currentZipCode,
|
||||||
|
registrationSame: e.registrationSame,
|
||||||
|
registrationAddress: e.registrationAddress,
|
||||||
|
registrationDistrict: e.registrationDistrict,
|
||||||
|
registrationProvince: e.registrationProvince,
|
||||||
|
registrationSubDistrict: e.registrationSubDistrict,
|
||||||
|
registrationZipCode: e.registrationZipCode,
|
||||||
|
createdFullName: e.createdFullName,
|
||||||
|
createdAt: new Date(e.createdAt),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loaderPage(false);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const refreshData = async () => {
|
||||||
|
myform.value.reset();
|
||||||
|
await getNewData();
|
||||||
|
};
|
||||||
|
|
||||||
|
const getNewData = async () => {
|
||||||
|
await fetchData();
|
||||||
|
await fetchProvince();
|
||||||
|
await fetchDistrict(addressData.value.provinceId, "1");
|
||||||
|
await fetchDistrict(addressData.value.provinceIdC, "2");
|
||||||
|
await fetchSubDistrict(addressData.value.districtId, "1");
|
||||||
|
await fetchSubDistrict(addressData.value.districtIdC, "2");
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchData = async () => {
|
||||||
|
if (route.params.id) {
|
||||||
|
loaderPage(true);
|
||||||
|
await http
|
||||||
|
.get(config.API.profileAdrsId(route.params.id.toString()))
|
||||||
|
.then((res) => {
|
||||||
|
const data: ResponseObject = res.data.result;
|
||||||
|
addressData.value.address = data.registrationAddress;
|
||||||
|
addressData.value.addressC = data.currentAddress;
|
||||||
|
addressData.value.districtId = data.registrationDistrictId;
|
||||||
|
addressData.value.districtIdC = data.currentDistrictId;
|
||||||
|
addressData.value.provinceId = data.registrationProvinceId;
|
||||||
|
addressData.value.provinceIdC = data.currentProvinceId;
|
||||||
|
addressData.value.subdistrictId = data.registrationSubDistrictId;
|
||||||
|
addressData.value.subdistrictIdC = data.currentSubDistrictId;
|
||||||
|
addressData.value.same = data.registrationSame ? "1" : "0";
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loaderPage(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const editData = async () => {
|
||||||
|
const body: ResponseObject = {
|
||||||
|
registrationSame: addressData.value.same == "1",
|
||||||
|
registrationAddress: addressData.value.address,
|
||||||
|
registrationSubDistrictId: addressData.value.subdistrictId,
|
||||||
|
registrationDistrictId: addressData.value.districtId,
|
||||||
|
registrationProvinceId: addressData.value.provinceId,
|
||||||
|
registrationZipCode: codep.value,
|
||||||
|
currentAddress:
|
||||||
|
addressData.value.same == "1"
|
||||||
|
? addressData.value.address
|
||||||
|
: addressData.value.addressC,
|
||||||
|
currentSubDistrictId:
|
||||||
|
addressData.value.same == "1"
|
||||||
|
? addressData.value.subdistrictId
|
||||||
|
: addressData.value.subdistrictIdC,
|
||||||
|
currentDistrictId:
|
||||||
|
addressData.value.same == "1"
|
||||||
|
? addressData.value.districtId
|
||||||
|
: addressData.value.districtIdC,
|
||||||
|
currentProvinceId:
|
||||||
|
addressData.value.same == "1"
|
||||||
|
? addressData.value.provinceId
|
||||||
|
: addressData.value.provinceIdC,
|
||||||
|
currentZipCode: addressData.value.same == "1" ? codep.value : codec.value,
|
||||||
|
createdAt: new Date(),
|
||||||
|
createdFullName: "-",
|
||||||
|
};
|
||||||
|
loaderPage(true);
|
||||||
|
await http
|
||||||
|
.put(config.API.profileAdrsId(route.params.id.toString()), body)
|
||||||
|
.then((res) => {
|
||||||
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(async () => {
|
||||||
|
edit.value = false;
|
||||||
|
emit("update:statusEdit", false);
|
||||||
|
await getNewData();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const addData = async () => {
|
||||||
|
// loaderPage(true);
|
||||||
|
// await http
|
||||||
|
// .put(config.API.profileInforId(route.params.id.toString()), body)
|
||||||
|
// .then((res) => {
|
||||||
|
// success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
|
// })
|
||||||
|
// .catch((e) => {
|
||||||
|
// messageError($q, e);
|
||||||
|
// })
|
||||||
|
// .finally(async () => {
|
||||||
|
// edit.value = false;
|
||||||
|
// emit("update:statusEdit", false);
|
||||||
|
// await fetchData();
|
||||||
|
// await changeBirth(informaData.value.birthDate ?? new Date());
|
||||||
|
// });
|
||||||
|
};
|
||||||
|
|
||||||
|
const saveData = async () => {
|
||||||
|
await myform.value.validate().then(async (success: boolean) => {
|
||||||
|
if (success) {
|
||||||
|
if (props.statusAdd) {
|
||||||
|
await addData();
|
||||||
|
} else {
|
||||||
|
await editData();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const selectProvince = async (e: string | null, name: string) => {
|
||||||
|
if (e != null) {
|
||||||
|
if (name == "1") {
|
||||||
|
addressData.value.districtId = "";
|
||||||
|
addressData.value.subdistrictId = "";
|
||||||
|
codep.value = "";
|
||||||
|
} else {
|
||||||
|
addressData.value.districtIdC = "";
|
||||||
|
addressData.value.subdistrictIdC = "";
|
||||||
|
codec.value = "";
|
||||||
|
}
|
||||||
|
myform.value.resetValidation();
|
||||||
|
await fetchDistrict(e, name);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const selectDistrict = async (e: string | null, name: string) => {
|
||||||
|
if (e != null) {
|
||||||
|
if (name == "1") {
|
||||||
|
addressData.value.subdistrictId = "";
|
||||||
|
codep.value = "";
|
||||||
|
} else {
|
||||||
|
addressData.value.subdistrictIdC = "";
|
||||||
|
codec.value = "";
|
||||||
|
}
|
||||||
|
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 : "";
|
||||||
|
codep.value = namecode;
|
||||||
|
} else {
|
||||||
|
const findcode = Ops.value.subdistrictCOps.filter((r) => r.id == e);
|
||||||
|
const namecode = findcode.length > 0 ? findcode[0].zipCode : "";
|
||||||
|
codec.value = namecode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchProvince = async () => {
|
||||||
|
loaderPage(true);
|
||||||
|
await http
|
||||||
|
.get(config.API.province)
|
||||||
|
.then((res) => {
|
||||||
|
const data = res.data.result;
|
||||||
|
let option: DataOption[] = [];
|
||||||
|
data.map((r: any) => {
|
||||||
|
option.push({ id: r.id.toString(), name: r.name.toString() });
|
||||||
|
});
|
||||||
|
Ops.value.provinceOps = option;
|
||||||
|
OpsFilter.value.provinceOps = option;
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loaderPage(false);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchDistrict = async (id: string | null, position: string) => {
|
||||||
|
if (id != null && id != "") {
|
||||||
|
loaderPage(true);
|
||||||
|
await http
|
||||||
|
.get(config.API.listDistrict(id))
|
||||||
|
.then((res) => {
|
||||||
|
const data = res.data.result;
|
||||||
|
let option: DataOption[] = [];
|
||||||
|
data.map((r: any) => {
|
||||||
|
option.push({ id: r.id.toString(), name: r.name.toString() });
|
||||||
|
});
|
||||||
|
if (position == "1") {
|
||||||
|
Ops.value.districtOps = option;
|
||||||
|
OpsFilter.value.districtOps = option;
|
||||||
|
} else {
|
||||||
|
Ops.value.districtCOps = option;
|
||||||
|
OpsFilter.value.districtCOps = option;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loaderPage(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchSubDistrict = async (id: string | null, position: string) => {
|
||||||
|
if (id != null && id != "") {
|
||||||
|
loaderPage(true);
|
||||||
|
await http
|
||||||
|
.get(config.API.listSubDistrict(id))
|
||||||
|
.then((res) => {
|
||||||
|
const data = res.data.result;
|
||||||
|
let option: zipCodeOption[] = [];
|
||||||
|
data.map((r: any) => {
|
||||||
|
option.push({
|
||||||
|
id: r.id.toString(),
|
||||||
|
name: r.name.toString(),
|
||||||
|
zipCode: r.zipCode.toString(),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
if (position == "1") {
|
||||||
|
Ops.value.subdistrictOps = option;
|
||||||
|
OpsFilter.value.subdistrictOps = option;
|
||||||
|
} else {
|
||||||
|
Ops.value.subdistrictCOps = option;
|
||||||
|
OpsFilter.value.subdistrictCOps = option;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loaderPage(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const changeBtn = async () => {
|
||||||
|
if (edit.value == true) {
|
||||||
|
if (props.statusEdit === true) {
|
||||||
|
edit.value = false;
|
||||||
|
} else {
|
||||||
|
emit("update:statusEdit", true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
emit("update:statusEdit", false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const getClass = (val: boolean) => {
|
||||||
|
return {
|
||||||
|
"full-width inputgreen cursor-pointer": val,
|
||||||
|
"full-width cursor-pointer": !val,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
</script>
|
||||||
830
src/components/information/Certicate.vue
Normal file
830
src/components/information/Certicate.vue
Normal file
|
|
@ -0,0 +1,830 @@
|
||||||
|
<!-- card ใบอนุญาตประกอบอาชีพ -->
|
||||||
|
<template>
|
||||||
|
<q-card flat bordered class="col-12 q-px-lg q-py-md q-mt-md">
|
||||||
|
<q-form ref="myForm">
|
||||||
|
<ProfileTable
|
||||||
|
:rows="rows"
|
||||||
|
:columns="columns"
|
||||||
|
:filter="filter"
|
||||||
|
:visible-columns="visibleColumns"
|
||||||
|
v-model:inputfilter="filter"
|
||||||
|
v-model:inputvisible="visibleColumns"
|
||||||
|
:add="clickAdd"
|
||||||
|
:name="
|
||||||
|
profileType == 'employee'
|
||||||
|
? 'ใบอนุญาตของลูกจ้าง'
|
||||||
|
: 'ใบอนุญาตประกอบอาชีพ'
|
||||||
|
"
|
||||||
|
icon="mdi-book"
|
||||||
|
:statusEdit="statusEdit"
|
||||||
|
>
|
||||||
|
<template #columns="props">
|
||||||
|
<q-tr :props="props">
|
||||||
|
<q-td
|
||||||
|
v-for="col in props.cols"
|
||||||
|
:key="col.name"
|
||||||
|
:props="props"
|
||||||
|
@click="selectData(props)"
|
||||||
|
class="cursor-pointer"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
v-if="col.name == 'issueDate' || col.name == 'expireDate'"
|
||||||
|
class="table_ellipsis"
|
||||||
|
>
|
||||||
|
{{ date2Thai(col.value) }}
|
||||||
|
</div>
|
||||||
|
<div v-else class="table_ellipsis">
|
||||||
|
{{ col.value }}
|
||||||
|
</div>
|
||||||
|
</q-td>
|
||||||
|
<q-td auto-width>
|
||||||
|
<q-btn
|
||||||
|
color="info"
|
||||||
|
flat
|
||||||
|
dense
|
||||||
|
round
|
||||||
|
size="14px"
|
||||||
|
icon="mdi-history"
|
||||||
|
@click="clickHistory(props.row)"
|
||||||
|
/>
|
||||||
|
</q-td>
|
||||||
|
</q-tr>
|
||||||
|
</template>
|
||||||
|
</ProfileTable>
|
||||||
|
</q-form>
|
||||||
|
</q-card>
|
||||||
|
<!-- popup Edit window-->
|
||||||
|
<q-dialog v-model="modal" persistent>
|
||||||
|
<q-card style="width: 600px">
|
||||||
|
<q-form ref="myForm">
|
||||||
|
<DialogHeader
|
||||||
|
:tittle="
|
||||||
|
profileType == 'employee'
|
||||||
|
? 'ใบอนุญาตของลูกจ้าง'
|
||||||
|
: 'ใบอนุญาตประกอบอาชีพ'
|
||||||
|
"
|
||||||
|
:close="clickClose"
|
||||||
|
/>
|
||||||
|
<q-separator />
|
||||||
|
<q-card-section class="q-p-sm">
|
||||||
|
<div
|
||||||
|
class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs"
|
||||||
|
>
|
||||||
|
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||||
|
<q-input
|
||||||
|
:class="getClass(edit)"
|
||||||
|
:outlined="edit"
|
||||||
|
dense
|
||||||
|
lazy-rules
|
||||||
|
:readonly="!edit"
|
||||||
|
:borderless="!edit"
|
||||||
|
v-model="certificateType"
|
||||||
|
:rules="[(val) => !!val || `${'กรุณากรอกชื่อใบอนุญาต'}`]"
|
||||||
|
hide-bottom-space
|
||||||
|
:label="`${'ชื่อใบอนุญาต'}`"
|
||||||
|
@update:modelValue="clickEditRow"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||||
|
<q-input
|
||||||
|
:class="getClass(edit)"
|
||||||
|
:outlined="edit"
|
||||||
|
dense
|
||||||
|
lazy-rules
|
||||||
|
:readonly="!edit"
|
||||||
|
:borderless="!edit"
|
||||||
|
v-model="issuer"
|
||||||
|
:rules="[
|
||||||
|
(val) => !!val || `${'กรุณากรอกหน่วยงานผู้ออกใบอนุญาต'}`,
|
||||||
|
]"
|
||||||
|
hide-bottom-space
|
||||||
|
:label="`${'หน่วยงานผู้ออกใบอนุญาต'}`"
|
||||||
|
@update:modelValue="clickEditRow"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||||
|
<q-input
|
||||||
|
:class="getClass(edit)"
|
||||||
|
:outlined="edit"
|
||||||
|
dense
|
||||||
|
lazy-rules
|
||||||
|
:readonly="!edit"
|
||||||
|
:borderless="!edit"
|
||||||
|
v-model="certificateNo"
|
||||||
|
:rules="[(val) => !!val || `${'กรุณากรอกเลขที่ใบอนุญาต'}`]"
|
||||||
|
hide-bottom-space
|
||||||
|
:label="`${'เลขที่ใบอนุญาต'}`"
|
||||||
|
@update:modelValue="clickEditRow"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||||
|
<datepicker
|
||||||
|
menu-class-name="modalfix"
|
||||||
|
:readonly="!edit"
|
||||||
|
v-model="issueDate"
|
||||||
|
:locale="'th'"
|
||||||
|
autoApply
|
||||||
|
:enableTimePicker="false"
|
||||||
|
@update:modelValue="clickEditRow"
|
||||||
|
week-start="0"
|
||||||
|
>
|
||||||
|
<template #year="{ year }">{{ year + 543 }}</template>
|
||||||
|
<template #year-overlay-value="{ value }">{{
|
||||||
|
parseInt(value + 543)
|
||||||
|
}}</template>
|
||||||
|
<template #trigger>
|
||||||
|
<q-input
|
||||||
|
:class="getClass(edit)"
|
||||||
|
:outlined="edit"
|
||||||
|
dense
|
||||||
|
lazy-rules
|
||||||
|
:borderless="!edit"
|
||||||
|
:model-value="date2Thai(issueDate)"
|
||||||
|
:rules="[
|
||||||
|
(val) => !!val || `${'กรุณาเลือกวันที่ออกใบอนุญาต'}`,
|
||||||
|
]"
|
||||||
|
hide-bottom-space
|
||||||
|
:label="`${'วันที่ออกใบอนุญาต'}`"
|
||||||
|
>
|
||||||
|
<template v-slot:prepend>
|
||||||
|
<q-icon
|
||||||
|
name="event"
|
||||||
|
class="cursor-pointer"
|
||||||
|
:style="
|
||||||
|
edit
|
||||||
|
? 'color: var(--q-primary)'
|
||||||
|
: 'color: var(--q-grey)'
|
||||||
|
"
|
||||||
|
>
|
||||||
|
</q-icon>
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
|
</template>
|
||||||
|
</datepicker>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||||
|
<datepicker
|
||||||
|
menu-class-name="modalfix"
|
||||||
|
v-model="expireDate"
|
||||||
|
:locale="'th'"
|
||||||
|
autoApply
|
||||||
|
:enableTimePicker="false"
|
||||||
|
:min-date="minDate"
|
||||||
|
:readonly="!edit"
|
||||||
|
@update:modelValue="clickEditRow"
|
||||||
|
week-start="0"
|
||||||
|
>
|
||||||
|
<template #year="{ year }">{{ year + 543 }}</template>
|
||||||
|
<template #year-overlay-value="{ value }">{{
|
||||||
|
parseInt(value + 543)
|
||||||
|
}}</template>
|
||||||
|
<template #trigger>
|
||||||
|
<q-input
|
||||||
|
:class="getClass(edit)"
|
||||||
|
:outlined="edit"
|
||||||
|
dense
|
||||||
|
lazy-rules
|
||||||
|
:borderless="!edit"
|
||||||
|
:model-value="date2Thai(expireDate)"
|
||||||
|
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่หมดอายุ'}`]"
|
||||||
|
hide-bottom-space
|
||||||
|
:label="`${'วันที่หมดอายุ'}`"
|
||||||
|
>
|
||||||
|
<template v-slot:prepend>
|
||||||
|
<q-icon
|
||||||
|
name="event"
|
||||||
|
class="cursor-pointer"
|
||||||
|
:style="
|
||||||
|
edit
|
||||||
|
? 'color: var(--q-primary)'
|
||||||
|
: 'color: var(--q-grey)'
|
||||||
|
"
|
||||||
|
>
|
||||||
|
</q-icon>
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
|
</template>
|
||||||
|
</datepicker>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</q-card-section>
|
||||||
|
<q-separator />
|
||||||
|
<DialogFooter
|
||||||
|
:cancel="clickCancel"
|
||||||
|
:edit="clickEdit"
|
||||||
|
:save="clickSave"
|
||||||
|
:validate="validateData"
|
||||||
|
:clickNext="clickNext"
|
||||||
|
:clickPrevious="clickPrevious"
|
||||||
|
:clickDelete="clickDelete"
|
||||||
|
v-model:editvisible="edit"
|
||||||
|
v-model:next="next"
|
||||||
|
v-model:previous="previous"
|
||||||
|
v-model:modalEdit="modalEdit"
|
||||||
|
/>
|
||||||
|
</q-form>
|
||||||
|
</q-card>
|
||||||
|
</q-dialog>
|
||||||
|
<HistoryTable
|
||||||
|
:rows="rowsHistory"
|
||||||
|
:columns="columnsHistory"
|
||||||
|
:filter="filterHistory"
|
||||||
|
:visible-columns="visibleColumnsHistory"
|
||||||
|
v-model:modal="modalHistory"
|
||||||
|
v-model:inputfilter="filterHistory"
|
||||||
|
v-model:inputvisible="visibleColumnsHistory"
|
||||||
|
v-model:tittle="tittleHistory"
|
||||||
|
>
|
||||||
|
<template #columns="props">
|
||||||
|
<q-tr :props="props">
|
||||||
|
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
||||||
|
<div
|
||||||
|
v-if="
|
||||||
|
col.name == 'expireDate' ||
|
||||||
|
col.name == 'issueDate' ||
|
||||||
|
col.name == 'createdAt'
|
||||||
|
"
|
||||||
|
class="table_ellipsis"
|
||||||
|
>
|
||||||
|
{{ date2Thai(col.value) }}
|
||||||
|
</div>
|
||||||
|
<div v-else class="table_ellipsis">
|
||||||
|
{{ col.value }}
|
||||||
|
</div>
|
||||||
|
</q-td>
|
||||||
|
</q-tr>
|
||||||
|
</template>
|
||||||
|
</HistoryTable>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { onMounted, ref, watch } from "vue";
|
||||||
|
import { useRoute } from "vue-router";
|
||||||
|
import { useProfileDataStore } from "@/modules/04_registry/store";
|
||||||
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
import { useDataStore } from "@/stores/data";
|
||||||
|
import ProfileTable from "@/modules/04_registry/components/Table.vue";
|
||||||
|
import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue";
|
||||||
|
import DialogFooter from "@/modules/04_registry/components/DialogFooter.vue";
|
||||||
|
import { useQuasar } from "quasar";
|
||||||
|
import type {
|
||||||
|
RequestItemsObject,
|
||||||
|
DataProps,
|
||||||
|
} from "@/modules/04_registry/interface/request/Certificate";
|
||||||
|
import type { ResponseObject } from "@/modules/04_registry/interface/response/Certificate";
|
||||||
|
import HistoryTable from "@/components/TableHistory.vue";
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
import config from "@/app.config";
|
||||||
|
import type { QTableProps } from "quasar";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
statusEdit: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
profileType: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const $q = useQuasar();
|
||||||
|
const store = useProfileDataStore();
|
||||||
|
const { profileData, changeProfileColumns } = store;
|
||||||
|
const dataStore = useDataStore();
|
||||||
|
const { loaderPage } = dataStore;
|
||||||
|
const mixin = useCounterMixin();
|
||||||
|
const { date2Thai, success, dateToISO, messageError } = mixin;
|
||||||
|
const route = useRoute();
|
||||||
|
const id = ref<string>("");
|
||||||
|
const certificateNo = ref<string>();
|
||||||
|
const issuer = ref<string>();
|
||||||
|
const issueDate = ref<Date>(new Date());
|
||||||
|
const expireDate = ref<Date>(new Date());
|
||||||
|
const certificateType = ref<string>();
|
||||||
|
const minDate = ref<Date>();
|
||||||
|
const myForm = ref<any>(); //form data input
|
||||||
|
const edit = ref<boolean>(false); //เช็คการกดปุ่มแก้ไขใน dialog
|
||||||
|
const modal = ref<boolean>(false); //modal add detail
|
||||||
|
const modalEdit = ref<boolean>(false); //modal ที่แสดงใช้สำหรับแก้ไขหรือไม่
|
||||||
|
const rawItem = ref<RequestItemsObject>(); //ข้อมูลเดิมที่เลือกใน row นั้น
|
||||||
|
const rowIndex = ref<number>(0); //indexข้อมูลเดิมที่เลือกใน row นั้น
|
||||||
|
const previous = ref<boolean>(); //แสดงปุ่มดูข้อมูลก่อนหน้า
|
||||||
|
const next = ref<boolean>(); //แสดงปุ่มดูข้อมูลต่อไป
|
||||||
|
const editRow = ref<boolean>(false); //เช็คมีการแก้ไขข้อมูล
|
||||||
|
const rowsHistory = ref<RequestItemsObject[]>([]); //select data history
|
||||||
|
const tittleHistory = ref<string>("ประวัติแก้ไขใบอนุญาตประกอบอาชีพ"); //
|
||||||
|
const filterHistory = ref<string>(""); //search data table history
|
||||||
|
const modalHistory = ref<boolean>(false); //modal ประวัติการแก้ไขข้อมูล
|
||||||
|
const checkValidate = ref<boolean>(false); //validate data ผ่านหรือไม่
|
||||||
|
const profileId = ref<string>(
|
||||||
|
route.params.id ? route.params.id.toString() : ""
|
||||||
|
);
|
||||||
|
const rows = ref<RequestItemsObject[]>([]);
|
||||||
|
const filter = ref<string>(""); //search data table
|
||||||
|
const visibleColumns = ref<String[]>([]);
|
||||||
|
profileData.certicate.columns.length == 0
|
||||||
|
? (visibleColumns.value = [
|
||||||
|
"certificateType",
|
||||||
|
"certificateNo",
|
||||||
|
"issuer",
|
||||||
|
"issueDate",
|
||||||
|
"expireDate",
|
||||||
|
])
|
||||||
|
: (visibleColumns.value = profileData.certicate.columns);
|
||||||
|
const columns = ref<QTableProps["columns"]>([
|
||||||
|
{
|
||||||
|
name: "certificateType",
|
||||||
|
align: "left",
|
||||||
|
label: "ชื่อใบอนุญาต",
|
||||||
|
sortable: true,
|
||||||
|
field: "certificateType",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "issuer",
|
||||||
|
align: "left",
|
||||||
|
label: "หน่วยงานผู้ออกใบอนุญาต",
|
||||||
|
sortable: true,
|
||||||
|
field: "issuer",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "certificateNo",
|
||||||
|
align: "left",
|
||||||
|
label: "เลขที่ใบอนุญาต",
|
||||||
|
sortable: true,
|
||||||
|
field: "certificateNo",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "issueDate",
|
||||||
|
align: "left",
|
||||||
|
label: "วันที่ออกใบอนุญาต",
|
||||||
|
sortable: true,
|
||||||
|
field: "issueDate",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "expireDate",
|
||||||
|
align: "left",
|
||||||
|
label: "วันที่หมดอายุ",
|
||||||
|
sortable: true,
|
||||||
|
field: "expireDate",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
const columnsHistory = ref<QTableProps["columns"]>([
|
||||||
|
{
|
||||||
|
name: "certificateType",
|
||||||
|
align: "left",
|
||||||
|
label: "ชื่อใบอนุญาต",
|
||||||
|
sortable: true,
|
||||||
|
field: "certificateType",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "issuer",
|
||||||
|
align: "left",
|
||||||
|
label: "หน่วยงานผู้ออกใบอนุญาต",
|
||||||
|
sortable: true,
|
||||||
|
field: "issuer",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "certificateNo",
|
||||||
|
align: "left",
|
||||||
|
label: "เลขที่ใบอนุญาต",
|
||||||
|
sortable: true,
|
||||||
|
field: "certificateNo",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "issueDate",
|
||||||
|
align: "left",
|
||||||
|
label: "วันที่ออกใบอนุญาต",
|
||||||
|
sortable: true,
|
||||||
|
field: "issueDate",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "expireDate",
|
||||||
|
align: "left",
|
||||||
|
label: "วันที่หมดอายุ",
|
||||||
|
sortable: true,
|
||||||
|
field: "expireDate",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "createdFullName",
|
||||||
|
align: "left",
|
||||||
|
label: "ผู้ดำเนินการ",
|
||||||
|
sortable: true,
|
||||||
|
field: "createdFullName",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "createdAt",
|
||||||
|
align: "left",
|
||||||
|
label: "วันที่แก้ไข",
|
||||||
|
sortable: true,
|
||||||
|
field: "createdAt",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
const visibleColumnsHistory = ref<String[]>([
|
||||||
|
"certificateType",
|
||||||
|
"certificateNo",
|
||||||
|
"issuer",
|
||||||
|
"issueDate",
|
||||||
|
"expireDate",
|
||||||
|
"createdFullName",
|
||||||
|
"createdAt",
|
||||||
|
]);
|
||||||
|
|
||||||
|
watch(visibleColumns, async (count: String[], prevCount: String[]) => {
|
||||||
|
await changeProfileColumns("certicate", count);
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
await fetchData();
|
||||||
|
});
|
||||||
|
|
||||||
|
const fetchData = async () => {
|
||||||
|
if (profileId.value) {
|
||||||
|
loaderPage(true);
|
||||||
|
await http
|
||||||
|
.get(config.API.profileCertId(profileId.value))
|
||||||
|
.then((res) => {
|
||||||
|
let data = res.data.result;
|
||||||
|
rows.value = [];
|
||||||
|
data.map((e: ResponseObject) => {
|
||||||
|
rows.value.push({
|
||||||
|
id: e.id,
|
||||||
|
certificateNo: e.certificateNo,
|
||||||
|
issuer: e.issuer,
|
||||||
|
issueDate: new Date(e.issueDate),
|
||||||
|
expireDate: new Date(e.expireDate),
|
||||||
|
certificateType: e.certificateType,
|
||||||
|
createdFullName: e.createdFullName,
|
||||||
|
createdAt: new Date(e.createdAt),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loaderPage(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* กดดูข้อมูลก่อนหน้า
|
||||||
|
*/
|
||||||
|
const clickPrevious = async () => {
|
||||||
|
edit.value = false;
|
||||||
|
rowIndex.value -= 1;
|
||||||
|
await getData();
|
||||||
|
await checkRowPage();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* กดดูข้อมูลต่อไป
|
||||||
|
*/
|
||||||
|
const clickNext = async () => {
|
||||||
|
edit.value = false;
|
||||||
|
rowIndex.value += 1;
|
||||||
|
await getData();
|
||||||
|
await checkRowPage();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* กดดูข้อมูลต่อไป
|
||||||
|
*/
|
||||||
|
const getData = () => {
|
||||||
|
const row = rows.value[rowIndex.value];
|
||||||
|
certificateNo.value = row.certificateNo;
|
||||||
|
issuer.value = row.issuer;
|
||||||
|
issueDate.value = row.issueDate;
|
||||||
|
expireDate.value = row.expireDate;
|
||||||
|
certificateType.value = row.certificateType;
|
||||||
|
id.value = row.id;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* เช็คปุ่มดูข้อมูล ย้อน กับ ต่อไป ว่าต้องแสดงไหม
|
||||||
|
*/
|
||||||
|
const checkRowPage = () => {
|
||||||
|
editRow.value = false;
|
||||||
|
next.value = true;
|
||||||
|
previous.value = true;
|
||||||
|
if (rowIndex.value + 1 >= rows.value.length) {
|
||||||
|
next.value = false;
|
||||||
|
}
|
||||||
|
if (rowIndex.value - 1 < 0) {
|
||||||
|
previous.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* กดปุ่มแก้ไขใน dialog
|
||||||
|
*/
|
||||||
|
const clickEdit = () => {
|
||||||
|
editRow.value = false;
|
||||||
|
next.value = false;
|
||||||
|
previous.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* กดปุ่มเพิ่มด้านบน table
|
||||||
|
*/
|
||||||
|
const clickAdd = async () => {
|
||||||
|
editRow.value = false;
|
||||||
|
await addData();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* กดบันทึกใน dialog
|
||||||
|
*/
|
||||||
|
const clickSave = async () => {
|
||||||
|
myForm.value.validate().then(async (result: boolean) => {
|
||||||
|
if (result) {
|
||||||
|
if (modalEdit.value) {
|
||||||
|
await editData();
|
||||||
|
} else {
|
||||||
|
await saveData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* บันทึกเพิ่มข้อมูล
|
||||||
|
*/
|
||||||
|
const saveData = async () => {
|
||||||
|
loaderPage(true);
|
||||||
|
await http
|
||||||
|
.post(config.API.profileCertId(profileId.value), {
|
||||||
|
id: id.value,
|
||||||
|
certificateNo: certificateNo.value,
|
||||||
|
issuer: issuer.value,
|
||||||
|
issueDate: dateToISO(issueDate.value),
|
||||||
|
expireDate: dateToISO(expireDate.value),
|
||||||
|
certificateType: certificateType.value,
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
|
modal.value = false;
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(async () => {
|
||||||
|
await fetchData();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* บันทึกแก้ไขข้อมูล
|
||||||
|
*/
|
||||||
|
const editData = async () => {
|
||||||
|
loaderPage(true);
|
||||||
|
await http
|
||||||
|
.put(config.API.profileCertId(id.value), {
|
||||||
|
id: id.value,
|
||||||
|
certificateNo: certificateNo.value,
|
||||||
|
issuer: issuer.value,
|
||||||
|
issueDate: dateToISO(issueDate.value),
|
||||||
|
expireDate: dateToISO(expireDate.value),
|
||||||
|
certificateType: certificateType.value,
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
|
modal.value = false;
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(async () => {
|
||||||
|
await fetchData();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ลบลบข้อมูล
|
||||||
|
*/
|
||||||
|
const clickDelete = async () => {
|
||||||
|
$q.dialog({
|
||||||
|
title: `ลบข้อมูล`,
|
||||||
|
message: `ต้องการทำการลบข้อมูลนี้ใช่หรือไม่?`,
|
||||||
|
cancel: "ยกเลิก",
|
||||||
|
ok: "ยืนยัน",
|
||||||
|
persistent: true,
|
||||||
|
})
|
||||||
|
.onOk(async () => {
|
||||||
|
loaderPage(true);
|
||||||
|
await http
|
||||||
|
.delete(config.API.profileCertId(id.value))
|
||||||
|
.then((res) => {
|
||||||
|
success($q, "ลบข้อมูลสำเร็จ");
|
||||||
|
modal.value = false;
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(async () => {
|
||||||
|
await fetchData();
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.onCancel(async () => {
|
||||||
|
await fetchData();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* กดปิด dialog
|
||||||
|
*/
|
||||||
|
const clickClose = async () => {
|
||||||
|
if (editRow.value == true) {
|
||||||
|
$q.dialog({
|
||||||
|
title: `ข้อมูลมีการแก้ไข`,
|
||||||
|
message: `ยืนยันที่จะปิดโดยไม่บันทึกใช่หรือไม่?`,
|
||||||
|
cancel: "ยกเลิก",
|
||||||
|
ok: "ยืนยัน",
|
||||||
|
persistent: true,
|
||||||
|
}).onOk(async () => {
|
||||||
|
modal.value = false;
|
||||||
|
next.value = false;
|
||||||
|
previous.value = false;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
modal.value = false;
|
||||||
|
next.value = false;
|
||||||
|
previous.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* กดเลือกข้อมูลที่จะแก้ไข
|
||||||
|
* @param props ค่า props ใน row ที่เลือก
|
||||||
|
*/
|
||||||
|
const selectData = async (props: DataProps) => {
|
||||||
|
modalEdit.value = true; //กดสำหรับแก้ไขข้อมูล
|
||||||
|
modal.value = true; //modal ที่เด้งขึ้นมา
|
||||||
|
edit.value = false; //ปุ่ม edit ใน modal
|
||||||
|
rawItem.value = props.row;
|
||||||
|
rowIndex.value = props.rowIndex;
|
||||||
|
certificateNo.value = props.row.certificateNo;
|
||||||
|
issuer.value = props.row.issuer;
|
||||||
|
issueDate.value = props.row.issueDate;
|
||||||
|
expireDate.value = props.row.expireDate;
|
||||||
|
certificateType.value = props.row.certificateType;
|
||||||
|
id.value = props.row.id;
|
||||||
|
await checkRowPage();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* กดปุ่มเพิ่มบน table
|
||||||
|
*/
|
||||||
|
const addData = () => {
|
||||||
|
modalEdit.value = false;
|
||||||
|
modal.value = true;
|
||||||
|
edit.value = true;
|
||||||
|
certificateNo.value = "";
|
||||||
|
issuer.value = "";
|
||||||
|
issueDate.value = new Date();
|
||||||
|
expireDate.value = new Date();
|
||||||
|
certificateType.value = "";
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ฟังก์ชันปุ่มยกเลิกการแก้ไขข้อมูล
|
||||||
|
*/
|
||||||
|
const clickCancel = async () => {
|
||||||
|
if (editRow.value == true) {
|
||||||
|
$q.dialog({
|
||||||
|
title: `ข้อมูลมีการแก้ไข`,
|
||||||
|
message: `ยืนยันยกเลิกการแก้ไขใช่หรือไม่?`,
|
||||||
|
cancel: "ยกเลิก",
|
||||||
|
ok: "ยืนยัน",
|
||||||
|
persistent: true,
|
||||||
|
}).onOk(async () => {
|
||||||
|
edit.value = false;
|
||||||
|
await checkRowPage();
|
||||||
|
await getData();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
edit.value = false;
|
||||||
|
await checkRowPage();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* เช็คว่ามีการแก้ไขข้อมูล
|
||||||
|
*/
|
||||||
|
const clickEditRow = () => {
|
||||||
|
editRow.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ฟังชั้นดูข้อมูลประวัติแก้ไขข้อมูลที่เลือก
|
||||||
|
* @param row ข้อมูล row ที่ดูประวัติการแก้ไข
|
||||||
|
*/
|
||||||
|
const clickHistory = async (row: RequestItemsObject) => {
|
||||||
|
tittleHistory.value =
|
||||||
|
props.profileType == "employee"
|
||||||
|
? "ประวัติแก้ไขใบอนุญาตของลูกจ้าง"
|
||||||
|
: "ประวัติแก้ไขใบอนุญาตประกอบอาชีพ";
|
||||||
|
modalHistory.value = true;
|
||||||
|
loaderPage(true);
|
||||||
|
await http
|
||||||
|
.get(config.API.profileCertHisId(row.id))
|
||||||
|
.then((res) => {
|
||||||
|
let data = res.data.result;
|
||||||
|
rowsHistory.value = [];
|
||||||
|
data.map((e: ResponseObject) => {
|
||||||
|
rowsHistory.value.push({
|
||||||
|
id: e.id,
|
||||||
|
certificateNo: e.certificateNo,
|
||||||
|
issuer: e.issuer,
|
||||||
|
issueDate: new Date(e.issueDate),
|
||||||
|
expireDate: new Date(e.expireDate),
|
||||||
|
certificateType: e.certificateType,
|
||||||
|
createdFullName: e.createdFullName,
|
||||||
|
createdAt: new Date(e.createdAt),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loaderPage(false);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* validate input ใน dialog
|
||||||
|
*/
|
||||||
|
const validateData = async () => {
|
||||||
|
checkValidate.value = true;
|
||||||
|
await myForm.value.validate().then((result: boolean) => {
|
||||||
|
if (result == false) {
|
||||||
|
checkValidate.value = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* class จัดรูปแบบแสดงระหว่างข้อมูลที่แก้ไขหรือแสดงเฉยๆ
|
||||||
|
* @param val ข้อมูล input สำหรับแก้ไขหรือไม่
|
||||||
|
*/
|
||||||
|
const getClass = (val: boolean) => {
|
||||||
|
return {
|
||||||
|
"full-width inputgreen cursor-pointer": val,
|
||||||
|
"full-width cursor-pointer": !val,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss">
|
||||||
|
.modalfix {
|
||||||
|
position: fixed !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
1514
src/components/information/Family.vue
Normal file
1514
src/components/information/Family.vue
Normal file
File diff suppressed because it is too large
Load diff
763
src/components/information/Government.vue
Normal file
763
src/components/information/Government.vue
Normal file
|
|
@ -0,0 +1,763 @@
|
||||||
|
<template>
|
||||||
|
<q-card flat bordered class="col-12 q-px-lg q-py-md q-mt-md">
|
||||||
|
<HeaderTop
|
||||||
|
v-model:edit="edit"
|
||||||
|
header="ข้อมูลราชการ"
|
||||||
|
icon="mdi-account-tie"
|
||||||
|
:save="saveData"
|
||||||
|
:history="true"
|
||||||
|
:changeBtn="changeBtn"
|
||||||
|
:disable="statusEdit"
|
||||||
|
:cancel="refreshData"
|
||||||
|
:historyClick="clickHistory"
|
||||||
|
/>
|
||||||
|
<q-form ref="myform" class="col-12">
|
||||||
|
<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(false)"
|
||||||
|
hide-bottom-space
|
||||||
|
dense
|
||||||
|
lazy-rules
|
||||||
|
readonly
|
||||||
|
borderless
|
||||||
|
:model-value="govermentData.ocId"
|
||||||
|
:label="`${'สังกัด'}`"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6 col-sm-3 col-md-3" v-if="employeeClass != 'temp'">
|
||||||
|
<q-input
|
||||||
|
:class="getClass(false)"
|
||||||
|
hide-bottom-space
|
||||||
|
dense
|
||||||
|
lazy-rules
|
||||||
|
readonly
|
||||||
|
borderless
|
||||||
|
:model-value="govermentData.numberId"
|
||||||
|
:label="`${'ตำแหน่งเลขที่'}`"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||||
|
<q-input
|
||||||
|
:class="getClass(false)"
|
||||||
|
hide-bottom-space
|
||||||
|
dense
|
||||||
|
lazy-rules
|
||||||
|
readonly
|
||||||
|
borderless
|
||||||
|
:model-value="govermentData.positionId"
|
||||||
|
:label="`${'ตำแหน่ง'}`"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||||
|
<q-input
|
||||||
|
:class="getClass(false)"
|
||||||
|
hide-bottom-space
|
||||||
|
dense
|
||||||
|
lazy-rules
|
||||||
|
readonly
|
||||||
|
borderless
|
||||||
|
:model-value="govermentData.positionPathSide"
|
||||||
|
:label="`${'ด้าน/สาขา'}`"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||||
|
<q-input
|
||||||
|
:class="getClass(false)"
|
||||||
|
hide-bottom-space
|
||||||
|
dense
|
||||||
|
lazy-rules
|
||||||
|
readonly
|
||||||
|
borderless
|
||||||
|
:model-value="govermentData.positionLine"
|
||||||
|
:label="`${'สายงาน'}`"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||||
|
<q-input
|
||||||
|
:class="getClass(false)"
|
||||||
|
hide-bottom-space
|
||||||
|
dense
|
||||||
|
lazy-rules
|
||||||
|
readonly
|
||||||
|
borderless
|
||||||
|
:model-value="govermentData.positionType"
|
||||||
|
:label="`${'ประเภท'}`"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6 col-sm-3 col-md-3" v-if="employeeClass != 'temp'">
|
||||||
|
<q-input
|
||||||
|
:class="getClass(false)"
|
||||||
|
hide-bottom-space
|
||||||
|
dense
|
||||||
|
lazy-rules
|
||||||
|
readonly
|
||||||
|
borderless
|
||||||
|
:model-value="govermentData.positionLevel"
|
||||||
|
:label="`${'ระดับ'}`"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||||
|
<q-input
|
||||||
|
:class="getClass(false)"
|
||||||
|
hide-bottom-space
|
||||||
|
dense
|
||||||
|
lazy-rules
|
||||||
|
readonly
|
||||||
|
borderless
|
||||||
|
:model-value="govermentData.positionExecutive"
|
||||||
|
:label="`${'ตำแหน่งทางการบริหาร'}`"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||||
|
<q-input
|
||||||
|
:class="getClass(false)"
|
||||||
|
hide-bottom-space
|
||||||
|
dense
|
||||||
|
lazy-rules
|
||||||
|
readonly
|
||||||
|
borderless
|
||||||
|
:model-value="govermentData.positionExecutiveSide"
|
||||||
|
:label="`${'ด้านตำแหน่งทางการบริหาร'}`"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 q-py-md"><q-separator /></div>
|
||||||
|
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||||
|
<datepicker
|
||||||
|
v-model="govermentData.containDate"
|
||||||
|
:locale="'th'"
|
||||||
|
autoApply
|
||||||
|
:enableTimePicker="false"
|
||||||
|
week-start="0"
|
||||||
|
:max-date="new Date()"
|
||||||
|
:disabled="!edit"
|
||||||
|
@update:model-value="handleDate"
|
||||||
|
>
|
||||||
|
<template #year="{ year }">
|
||||||
|
{{ year + 543 }}
|
||||||
|
</template>
|
||||||
|
<template #year-overlay-value="{ value }">
|
||||||
|
{{ parseInt(value + 543) }}
|
||||||
|
</template>
|
||||||
|
<template #trigger>
|
||||||
|
<q-input
|
||||||
|
:class="getClass(edit)"
|
||||||
|
hide-bottom-space
|
||||||
|
:outlined="edit"
|
||||||
|
dense
|
||||||
|
lazy-rules
|
||||||
|
:readonly="!edit"
|
||||||
|
:borderless="!edit"
|
||||||
|
:model-value="date2Thai(new Date(govermentData.containDate))"
|
||||||
|
:rules="[
|
||||||
|
(val) =>
|
||||||
|
!!val ||
|
||||||
|
`${
|
||||||
|
profileType == 'officer'
|
||||||
|
? 'กรุณาเลือกวันที่บรรจุ'
|
||||||
|
: 'กรุณาเลือกวันที่แต่งตั้ง'
|
||||||
|
}`,
|
||||||
|
]"
|
||||||
|
:label="`${
|
||||||
|
profileType == 'officer' ? 'วันที่บรรจุ' : 'วันที่แต่งตั้ง'
|
||||||
|
}`"
|
||||||
|
>
|
||||||
|
<template v-slot:prepend>
|
||||||
|
<q-icon
|
||||||
|
name="event"
|
||||||
|
class="cursor-pointer"
|
||||||
|
:style="
|
||||||
|
edit ? 'color: var(--q-primary)' : 'color: var(--q-grey)'
|
||||||
|
"
|
||||||
|
>
|
||||||
|
</q-icon>
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
|
</template>
|
||||||
|
</datepicker>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||||
|
<datepicker
|
||||||
|
v-model="govermentData.workDate"
|
||||||
|
:locale="'th'"
|
||||||
|
autoApply
|
||||||
|
:enableTimePicker="false"
|
||||||
|
week-start="0"
|
||||||
|
:max-date="new Date()"
|
||||||
|
:disabled="!edit"
|
||||||
|
>
|
||||||
|
<template #year="{ year }">
|
||||||
|
{{ year + 543 }}
|
||||||
|
</template>
|
||||||
|
<template #year-overlay-value="{ value }">
|
||||||
|
{{ parseInt(value + 543) }}
|
||||||
|
</template>
|
||||||
|
<template #trigger>
|
||||||
|
<q-input
|
||||||
|
:class="getClass(edit)"
|
||||||
|
hide-bottom-space
|
||||||
|
:outlined="edit"
|
||||||
|
dense
|
||||||
|
lazy-rules
|
||||||
|
:readonly="!edit"
|
||||||
|
:borderless="!edit"
|
||||||
|
:model-value="date2Thai(new Date(govermentData.workDate))"
|
||||||
|
:rules="[
|
||||||
|
(val) =>
|
||||||
|
!!val ||
|
||||||
|
`${
|
||||||
|
profileType == 'officer'
|
||||||
|
? 'กรุณาเลือกเริ่มปฎิบัติราชการ'
|
||||||
|
: 'กรุณาเลือกวันที่จ้างและแต่งตั้งมีผล'
|
||||||
|
}`,
|
||||||
|
]"
|
||||||
|
:label="`${
|
||||||
|
profileType == 'officer'
|
||||||
|
? 'เริ่มปฎิบัติราชการ'
|
||||||
|
: 'วันที่จ้างและแต่งตั้งมีผล'
|
||||||
|
}`"
|
||||||
|
>
|
||||||
|
<template v-slot:prepend>
|
||||||
|
<q-icon
|
||||||
|
name="event"
|
||||||
|
class="cursor-pointer"
|
||||||
|
:style="
|
||||||
|
edit ? 'color: var(--q-primary)' : 'color: var(--q-grey)'
|
||||||
|
"
|
||||||
|
>
|
||||||
|
</q-icon>
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
|
</template>
|
||||||
|
</datepicker>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6 col-sm-6 col-md-6" v-if="profileType == 'officer'">
|
||||||
|
<q-input
|
||||||
|
:class="getClass(edit)"
|
||||||
|
hide-bottom-space
|
||||||
|
:outlined="edit"
|
||||||
|
dense
|
||||||
|
lazy-rules
|
||||||
|
stack-label
|
||||||
|
:readonly="!edit"
|
||||||
|
:borderless="!edit"
|
||||||
|
v-model="govermentData.reasonSameDate"
|
||||||
|
:label="`${'เหตุผลกรณีไม่ตรงวัน'}`"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||||
|
<q-input
|
||||||
|
:class="getClass(false)"
|
||||||
|
hide-bottom-space
|
||||||
|
dense
|
||||||
|
lazy-rules
|
||||||
|
readonly
|
||||||
|
borderless
|
||||||
|
:model-value="govermentData.retireDate"
|
||||||
|
:label="`${'วันเกษียณอายุ'}`"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||||
|
<q-input
|
||||||
|
:class="getClass(false)"
|
||||||
|
hide-bottom-space
|
||||||
|
dense
|
||||||
|
lazy-rules
|
||||||
|
readonly
|
||||||
|
borderless
|
||||||
|
:model-value="govermentData.ageAll"
|
||||||
|
:label="`${'อายุราชการ'}`"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||||
|
<q-input
|
||||||
|
:class="getClass(false)"
|
||||||
|
hide-bottom-space
|
||||||
|
dense
|
||||||
|
lazy-rules
|
||||||
|
readonly
|
||||||
|
borderless
|
||||||
|
:model-value="govermentData.absent"
|
||||||
|
:label="`${'ขาดราชการ'}`"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||||
|
<q-input
|
||||||
|
:class="getClass(false)"
|
||||||
|
hide-bottom-space
|
||||||
|
dense
|
||||||
|
lazy-rules
|
||||||
|
readonly
|
||||||
|
borderless
|
||||||
|
:model-value="govermentData.age"
|
||||||
|
:label="`${'อายุราชการเกื้อกูล'}`"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</q-form>
|
||||||
|
</q-card>
|
||||||
|
<HistoryTable
|
||||||
|
:rows="rowsHistory"
|
||||||
|
:columns="columnsHistory"
|
||||||
|
:filter="filterHistory"
|
||||||
|
:visible-columns="visibleColumnsHistory"
|
||||||
|
v-model:modal="modalHistory"
|
||||||
|
v-model:inputfilter="filterHistory"
|
||||||
|
v-model:inputvisible="visibleColumnsHistory"
|
||||||
|
v-model:tittle="tittleHistory"
|
||||||
|
>
|
||||||
|
<template #columns="props">
|
||||||
|
<q-tr :props="props">
|
||||||
|
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
||||||
|
<div
|
||||||
|
v-if="
|
||||||
|
col.name == 'dateStart' ||
|
||||||
|
col.name == 'dateAppoint' ||
|
||||||
|
col.name == 'createdAt'
|
||||||
|
"
|
||||||
|
class="table_ellipsis"
|
||||||
|
>
|
||||||
|
{{ date2Thai(col.value) }}
|
||||||
|
</div>
|
||||||
|
<div v-else class="table_ellipsis">
|
||||||
|
{{ col.value }}
|
||||||
|
</div>
|
||||||
|
</q-td>
|
||||||
|
</q-tr>
|
||||||
|
</template>
|
||||||
|
</HistoryTable>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { onMounted, ref, watch } from "vue";
|
||||||
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
import { useDataStore } from "@/stores/data";
|
||||||
|
import { useQuasar } from "quasar";
|
||||||
|
import type { Goverment } from "@/modules/04_registry/components/profileType";
|
||||||
|
import { defaultGoverment } from "@/modules/04_registry/components/profileType";
|
||||||
|
import HeaderTop from "@/modules/04_registry/components/Information/top.vue";
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
import config from "@/app.config";
|
||||||
|
import HistoryTable from "@/components/TableHistory.vue";
|
||||||
|
import type { RequestItemsHistoryObject } from "@/modules/04_registry/interface/request/Government";
|
||||||
|
import type { ResponseObject } from "@/modules/04_registry/interface/response/Government";
|
||||||
|
import { useRoute } from "vue-router";
|
||||||
|
import { useProfileDataStore } from "@/modules/04_registry/store";
|
||||||
|
import { storeToRefs } from "pinia";
|
||||||
|
import type { QTableProps } from "quasar";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
statusEdit: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
profileType: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
employeeClass: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const emit = defineEmits(["update:statusEdit"]);
|
||||||
|
|
||||||
|
const route = useRoute();
|
||||||
|
const $q = useQuasar();
|
||||||
|
const dataStore = useDataStore();
|
||||||
|
const { loaderPage } = dataStore;
|
||||||
|
const mixin = useCounterMixin();
|
||||||
|
const { date2Thai, success, dateToISO, messageError } = mixin;
|
||||||
|
const profileStore = useProfileDataStore();
|
||||||
|
const { birthDate, retireText } = storeToRefs(profileStore);
|
||||||
|
const edit = ref<boolean>(false);
|
||||||
|
const govermentData = ref<Goverment>(defaultGoverment);
|
||||||
|
const myform = ref<any>();
|
||||||
|
const rowsHistory = ref<RequestItemsHistoryObject[]>([]); //select data history
|
||||||
|
const tittleHistory = ref<string>("ประวัติแก้ไขข้อมูลราชการ"); //
|
||||||
|
const filterHistory = ref<string>(""); //search data table history
|
||||||
|
const modalHistory = ref<boolean>(false); //modal ประวัติการแก้ไขข้อมูล
|
||||||
|
const columnsHistory = ref<QTableProps["columns"]>([
|
||||||
|
{
|
||||||
|
name: "oc",
|
||||||
|
align: "left",
|
||||||
|
label: "สังกัด",
|
||||||
|
sortable: true,
|
||||||
|
field: "oc",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "positionPathSide",
|
||||||
|
align: "left",
|
||||||
|
label: "ตำแหน่ง",
|
||||||
|
sortable: true,
|
||||||
|
field: "positionPathSide",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "position",
|
||||||
|
align: "left",
|
||||||
|
label: "ด้าน/สาขา",
|
||||||
|
sortable: true,
|
||||||
|
field: "position",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "posNo",
|
||||||
|
align: "left",
|
||||||
|
label: "ตำแหน่งเลขที่",
|
||||||
|
sortable: true,
|
||||||
|
field: "posNo",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "positionLine",
|
||||||
|
align: "left",
|
||||||
|
label: "สายงาน",
|
||||||
|
sortable: true,
|
||||||
|
field: "positionLine",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "positionType",
|
||||||
|
align: "left",
|
||||||
|
label: "ประเภท",
|
||||||
|
sortable: true,
|
||||||
|
field: "positionType",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "positionLevel",
|
||||||
|
align: "left",
|
||||||
|
label: "ระดับ",
|
||||||
|
sortable: true,
|
||||||
|
field: "positionLevel",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "positionExecutive",
|
||||||
|
align: "left",
|
||||||
|
label: "ตำแหน่งทางการบริหาร",
|
||||||
|
sortable: true,
|
||||||
|
field: "positionExecutive",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "positionExecutiveSide",
|
||||||
|
align: "left",
|
||||||
|
label: "ด้านทางการบริหาร",
|
||||||
|
sortable: true,
|
||||||
|
field: "positionExecutiveSide",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "dateAppoint",
|
||||||
|
align: "left",
|
||||||
|
label: "วันที่บรรจุ",
|
||||||
|
sortable: true,
|
||||||
|
field: "dateAppoint",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "dateStart",
|
||||||
|
align: "left",
|
||||||
|
label: "เริ่มปฎิบัติราชการ",
|
||||||
|
sortable: true,
|
||||||
|
field: "dateStart",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "retireDate",
|
||||||
|
align: "left",
|
||||||
|
label: "วันเกษียณอายุ",
|
||||||
|
sortable: true,
|
||||||
|
field: "retireDate",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "govAge",
|
||||||
|
align: "left",
|
||||||
|
label: "อายุราชการ",
|
||||||
|
sortable: true,
|
||||||
|
field: "govAge",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "govAgeAbsent",
|
||||||
|
align: "left",
|
||||||
|
label: "ขาดราชการ",
|
||||||
|
sortable: true,
|
||||||
|
field: "govAgeAbsent",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "govAgePlus",
|
||||||
|
align: "left",
|
||||||
|
label: "อายุราชการเกื้อกูล",
|
||||||
|
sortable: true,
|
||||||
|
field: "govAgePlus",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "reasonSameDate",
|
||||||
|
align: "left",
|
||||||
|
label: "เหตุผลกรณีไม่ตรงวัน",
|
||||||
|
sortable: true,
|
||||||
|
field: "reasonSameDate",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "createdFullName",
|
||||||
|
align: "left",
|
||||||
|
label: "ผู้ดำเนินการ",
|
||||||
|
sortable: true,
|
||||||
|
field: "createdFullName",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "createdAt",
|
||||||
|
align: "left",
|
||||||
|
label: "วันที่แก้ไข",
|
||||||
|
sortable: true,
|
||||||
|
field: "createdAt",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
const visibleColumnsHistory = ref<String[]>([
|
||||||
|
"oc",
|
||||||
|
"position",
|
||||||
|
"positionPathSide",
|
||||||
|
"posNo",
|
||||||
|
"positionLine",
|
||||||
|
"positionType",
|
||||||
|
"positionLevel",
|
||||||
|
"positionexecutive",
|
||||||
|
"positionExecutiveSide",
|
||||||
|
"dateAppoint",
|
||||||
|
"dateStart",
|
||||||
|
"retireDate",
|
||||||
|
"govAge",
|
||||||
|
"govAgeAbsent",
|
||||||
|
"govAgePlus",
|
||||||
|
"reasonSameDate",
|
||||||
|
"createdFullName",
|
||||||
|
"createdAt",
|
||||||
|
]);
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
await fetchData();
|
||||||
|
emit("update:statusEdit", false);
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(birthDate, async () => {
|
||||||
|
await fetchData();
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(retireText, async () => {
|
||||||
|
govermentData.value.retireDate = retireText.value;
|
||||||
|
});
|
||||||
|
|
||||||
|
const fetchData = async () => {
|
||||||
|
loaderPage(true);
|
||||||
|
await http
|
||||||
|
.get(config.API.profileGovId(route.params.id.toString()))
|
||||||
|
.then((res) => {
|
||||||
|
const data: ResponseObject = res.data.result;
|
||||||
|
govermentData.value.ocId = data.oc;
|
||||||
|
govermentData.value.positionId = data.position;
|
||||||
|
govermentData.value.positionPathSide = data.positionPathSide;
|
||||||
|
govermentData.value.positionLine = data.positionLine;
|
||||||
|
govermentData.value.positionType = data.positionType;
|
||||||
|
govermentData.value.positionLevel = data.positionLevel;
|
||||||
|
govermentData.value.numberId = data.posNo;
|
||||||
|
govermentData.value.positionExecutive = data.positionExecutive;
|
||||||
|
govermentData.value.positionExecutiveSide = data.positionExecutiveSide;
|
||||||
|
govermentData.value.containDate = new Date(data.dateAppoint);
|
||||||
|
govermentData.value.workDate = new Date(data.dateStart);
|
||||||
|
govermentData.value.retireDate = data.retireDate;
|
||||||
|
govermentData.value.absent = data.govAgeAbsent;
|
||||||
|
govermentData.value.age = data.govAgePlus;
|
||||||
|
govermentData.value.ageAll = data.govAge;
|
||||||
|
govermentData.value.reasonSameDate = data.reasonSameDate;
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(async () => {
|
||||||
|
loaderPage(false);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const refreshData = async () => {
|
||||||
|
myform.value.reset();
|
||||||
|
await fetchData();
|
||||||
|
};
|
||||||
|
|
||||||
|
const editData = async () => {
|
||||||
|
loaderPage(true);
|
||||||
|
await http
|
||||||
|
.put(config.API.profileGovId(route.params.id.toString()), {
|
||||||
|
dateAppoint: dateToISO(govermentData.value.containDate),
|
||||||
|
dateStart: dateToISO(govermentData.value.workDate),
|
||||||
|
reasonSameDate: govermentData.value.reasonSameDate,
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(async () => {
|
||||||
|
emit("update:statusEdit", false);
|
||||||
|
edit.value = false;
|
||||||
|
await refreshData();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const saveData = async () => {
|
||||||
|
await myform.value.validate().then(async (success: boolean) => {
|
||||||
|
if (success) {
|
||||||
|
await editData();
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDate = async (modelData: Date) => {
|
||||||
|
govermentData.value.containDate = modelData;
|
||||||
|
await fetchCalAgeGov(modelData);
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchCalAgeGov = async (date: Date) => {
|
||||||
|
loaderPage(true);
|
||||||
|
const body = {
|
||||||
|
dateAppoint: date,
|
||||||
|
};
|
||||||
|
await http
|
||||||
|
.post(config.API.profileCalGovId(route.params.id.toString()), body)
|
||||||
|
.then((res) => {
|
||||||
|
const result = res.data.result;
|
||||||
|
govermentData.value.ageAll = result;
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(async () => {
|
||||||
|
loaderPage(false);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ฟังชั้นดูข้อมูลประวัติแก้ไขข้อมูลที่เลือก
|
||||||
|
*/
|
||||||
|
const clickHistory = async () => {
|
||||||
|
modalHistory.value = true;
|
||||||
|
loaderPage(true);
|
||||||
|
await http
|
||||||
|
.get(config.API.profileGovHisId(route.params.id.toString()))
|
||||||
|
.then((res) => {
|
||||||
|
let data = res.data.result;
|
||||||
|
rowsHistory.value = [];
|
||||||
|
data.map((e: RequestItemsHistoryObject) => {
|
||||||
|
rowsHistory.value.push({
|
||||||
|
oc: e.oc,
|
||||||
|
position: e.position,
|
||||||
|
positionPathSide: e.positionPathSide,
|
||||||
|
posNo: e.posNo,
|
||||||
|
positionLine: e.positionLine,
|
||||||
|
positionType: e.positionType,
|
||||||
|
positionLevel: e.positionLevel,
|
||||||
|
positionExecutive: e.positionExecutive,
|
||||||
|
positionExecutiveSide: e.positionExecutiveSide,
|
||||||
|
dateAppoint: new Date(e.dateAppoint),
|
||||||
|
dateStart: new Date(e.dateStart),
|
||||||
|
retireDate: e.retireDate,
|
||||||
|
govAge: e.govAge,
|
||||||
|
govAgeAbsent: e.govAgeAbsent,
|
||||||
|
govAgePlus: e.govAgePlus,
|
||||||
|
reasonSameDate: e.reasonSameDate,
|
||||||
|
createdFullName: e.createdFullName,
|
||||||
|
createdAt: new Date(e.createdAt),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loaderPage(false);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const changeBtn = async () => {
|
||||||
|
if (edit.value == true) {
|
||||||
|
if (props.statusEdit === true) {
|
||||||
|
edit.value = false;
|
||||||
|
} else {
|
||||||
|
emit("update:statusEdit", true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
emit("update:statusEdit", false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const getClass = (val: boolean) => {
|
||||||
|
return {
|
||||||
|
"full-width inputgreen cursor-pointer": val,
|
||||||
|
"full-width cursor-pointer": !val,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
</script>
|
||||||
365
src/components/information/Image.vue
Normal file
365
src/components/information/Image.vue
Normal file
|
|
@ -0,0 +1,365 @@
|
||||||
|
<template>
|
||||||
|
<q-page-sticky
|
||||||
|
position="top"
|
||||||
|
expand
|
||||||
|
class="bg-grey-2 text-white"
|
||||||
|
style="z-index: 99; padding: 0% 1% 0% 1%"
|
||||||
|
>
|
||||||
|
<div class="row col-12 q-gutter-sm q-pb-sm text-dark no-wrap items-center">
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
class="bg-teal-1 full-height"
|
||||||
|
color="primary"
|
||||||
|
icon="mdi-chevron-left"
|
||||||
|
dense
|
||||||
|
@click="router.go(-1)"
|
||||||
|
>
|
||||||
|
</q-btn>
|
||||||
|
<q-avatar
|
||||||
|
v-if="imageUrl == null"
|
||||||
|
size="65px"
|
||||||
|
rounded
|
||||||
|
class="containerimage"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src="@/assets/avatar_user.jpg"
|
||||||
|
class="bg-grey-3"
|
||||||
|
style="object-fit: cover"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="overlay absolute-bottom text-subtitle2 text-center cursor-pointer"
|
||||||
|
@click="clickImage()"
|
||||||
|
>
|
||||||
|
<q-icon name="mdi-camera" size="18px" color="blue">
|
||||||
|
<q-tooltip>อัปเดตรูปภาพ</q-tooltip>
|
||||||
|
</q-icon>
|
||||||
|
|
||||||
|
<input
|
||||||
|
type="file"
|
||||||
|
style="display: none"
|
||||||
|
ref="inputImage"
|
||||||
|
accept="image/*"
|
||||||
|
@change="uploadImage"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</q-avatar>
|
||||||
|
<q-avatar v-else size="65px" rounded class="containerimage">
|
||||||
|
<img :src="imageUrl" class="bg-grey-3" style="object-fit: cover" />
|
||||||
|
<div
|
||||||
|
class="overlay absolute-bottom text-subtitle2 text-center cursor-pointer"
|
||||||
|
@click="clickImage()"
|
||||||
|
>
|
||||||
|
<q-icon name="mdi-camera" size="18px" color="blue">
|
||||||
|
<q-tooltip>อัปเดตรูปภาพ</q-tooltip>
|
||||||
|
</q-icon>
|
||||||
|
|
||||||
|
<input
|
||||||
|
type="file"
|
||||||
|
style="display: none"
|
||||||
|
ref="inputImage"
|
||||||
|
accept="image/*"
|
||||||
|
@change="uploadImage"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</q-avatar>
|
||||||
|
<div class="row items-center text-dark q-ml-md">
|
||||||
|
<div class="column">
|
||||||
|
<div class="text-bold q-pb-xs text-name">
|
||||||
|
{{ props.fullName }}
|
||||||
|
</div>
|
||||||
|
<div>{{ props.position }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<q-space />
|
||||||
|
|
||||||
|
<slot name="button-right" />
|
||||||
|
</div>
|
||||||
|
</q-page-sticky>
|
||||||
|
<!---------------------------------------- Dialog เลือก Image ---------------------------------------->
|
||||||
|
<q-dialog v-model="dialogImage" persistent>
|
||||||
|
<q-card style="width: 100vw; max-width: 60vw">
|
||||||
|
<q-card-section class="q-py-sm row">
|
||||||
|
<div class="text-h6">เลือกรูปภาพ</div>
|
||||||
|
<q-space />
|
||||||
|
<q-btn
|
||||||
|
icon="close"
|
||||||
|
unelevated
|
||||||
|
round
|
||||||
|
dense
|
||||||
|
@click="closeImage"
|
||||||
|
style="color: #ff8080; background-color: #ffdede"
|
||||||
|
>
|
||||||
|
<q-tooltip>ปิดหน้านี้</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
</q-card-section>
|
||||||
|
<q-separator />
|
||||||
|
<q-card-section class="col-12 row">
|
||||||
|
<div
|
||||||
|
class="row wrap items-start col-12 q-col-gutter-sm"
|
||||||
|
style="height: 320px; overflow: auto"
|
||||||
|
>
|
||||||
|
<div class="col-3" @click="addNewImage">
|
||||||
|
<div
|
||||||
|
style="
|
||||||
|
height: 160px;
|
||||||
|
max-width: 15vw;
|
||||||
|
display: flex !important;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
"
|
||||||
|
class="column rounded-borders cursor-pointer bg-active-image text-white"
|
||||||
|
>
|
||||||
|
<q-icon name="add" size="60px" color="white" />
|
||||||
|
<strong>อัปโหลดรูปภาพ</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-for="n in images"
|
||||||
|
:key="n"
|
||||||
|
class="col-3"
|
||||||
|
@click="imageActive(n)"
|
||||||
|
>
|
||||||
|
<div :class="getClass(n)">
|
||||||
|
<q-img
|
||||||
|
v-if="n.avatar != null"
|
||||||
|
:src="n.avatar"
|
||||||
|
:class="imageClass(n)"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="absolute-bottom col-12 cursor-pointer flex justify-between items-center"
|
||||||
|
style="padding: 5px"
|
||||||
|
>
|
||||||
|
{{ date2Thai(n.createdDate) }}
|
||||||
|
|
||||||
|
<q-btn
|
||||||
|
v-if="!n.isActive"
|
||||||
|
icon="delete"
|
||||||
|
unelevated
|
||||||
|
dense
|
||||||
|
@click="deletePhoto(n.id)"
|
||||||
|
class="bg-white"
|
||||||
|
style="color: #ff8080"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</q-img>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</q-card-section>
|
||||||
|
<q-separator />
|
||||||
|
<q-card-actions align="right">
|
||||||
|
<q-btn
|
||||||
|
icon="check"
|
||||||
|
dense
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
@click="selectAvatarHistory"
|
||||||
|
color="positive"
|
||||||
|
>
|
||||||
|
<q-tooltip>เลือกรูปภาพ</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
</q-card-actions>
|
||||||
|
</q-card>
|
||||||
|
</q-dialog>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from "vue";
|
||||||
|
import { useRoute, useRouter } from "vue-router";
|
||||||
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
import { useQuasar } from "quasar";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
fullName: {
|
||||||
|
type: String,
|
||||||
|
default: "ชื่อ สกุล",
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
position: {
|
||||||
|
type: String,
|
||||||
|
default: "ตำแหน่ง",
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
fetchData: {
|
||||||
|
type: Function,
|
||||||
|
default: () => console.log("not function"),
|
||||||
|
},
|
||||||
|
fetchSave: {
|
||||||
|
type: Function,
|
||||||
|
default: () => console.log("not function"),
|
||||||
|
},
|
||||||
|
fetchDelete: {
|
||||||
|
type: Function,
|
||||||
|
default: () => console.log("not function"),
|
||||||
|
},
|
||||||
|
fetchUpload: {
|
||||||
|
type: Function,
|
||||||
|
default: () => console.log("not function"),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const $q = useQuasar();
|
||||||
|
const mixin = useCounterMixin();
|
||||||
|
const { date2Thai, dateToISO, messageError, dialogMessage, success } = mixin;
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
const imageUrl = ref<any>(null);
|
||||||
|
const inputImage = ref<any>(null);
|
||||||
|
const dialogImage = ref<boolean>(false);
|
||||||
|
const images = ref<any>([]);
|
||||||
|
const activeImage = ref<any | null>(null);
|
||||||
|
const profileId = ref<string>("");
|
||||||
|
|
||||||
|
const closeImage = () => {
|
||||||
|
dialogImage.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const clickImage = async () => {
|
||||||
|
// ***************************************************************************************************
|
||||||
|
// ****************** fetch data รูปภาพทั้งหมด ******************
|
||||||
|
// ***************************************************************************************************
|
||||||
|
|
||||||
|
dialogImage.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const uploadImage = async (e: any) => {
|
||||||
|
let input = e.target.files;
|
||||||
|
if (input.length > 0) {
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append("FileData", input[0]);
|
||||||
|
await props.fetchUpload(profileId.value, formData).then(async () => {
|
||||||
|
await props.fetchData();
|
||||||
|
closeImage();
|
||||||
|
});
|
||||||
|
// ***************************************************************************************************
|
||||||
|
// ****************** ต้องทำ function props รับ formData กลับ ******************
|
||||||
|
// ****************** finally ทำการ fetch data,dialogImage.value = false ******************
|
||||||
|
// ***************************************************************************************************
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const selectAvatarHistory = async () => {
|
||||||
|
if (activeImage.value == null) {
|
||||||
|
dialogMessage(
|
||||||
|
$q,
|
||||||
|
"ไม่สามารถเปลี่ยนรูปได้",
|
||||||
|
"กรุณาเลือกรูปที่ต้องการเปลี่ยน",
|
||||||
|
"warning",
|
||||||
|
undefined,
|
||||||
|
"orange",
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await props.fetchSave(profileId.value);
|
||||||
|
// ***************************************************************************************************
|
||||||
|
// ****************** fetch data เปลี่ยนรูปภาพ ส่ง ID กลับ******************
|
||||||
|
// ***************************************************************************************************
|
||||||
|
};
|
||||||
|
|
||||||
|
const imageActive = (n: any) => {
|
||||||
|
activeImage.value = n;
|
||||||
|
};
|
||||||
|
|
||||||
|
const addNewImage = () => {
|
||||||
|
inputImage.value.click();
|
||||||
|
imageActive(null);
|
||||||
|
};
|
||||||
|
|
||||||
|
const deletePhoto = async (id: string) => {
|
||||||
|
dialogMessage(
|
||||||
|
$q,
|
||||||
|
"ลบข้อมูล",
|
||||||
|
"ต้องการทำการลบข้อมูลนี้ใช่หรือไม่",
|
||||||
|
"delete",
|
||||||
|
undefined,
|
||||||
|
"red",
|
||||||
|
async () => await fetchDataDelete(id),
|
||||||
|
undefined,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchDataDelete = async (id: string) => {
|
||||||
|
await props.fetchDelete(id).then(async () => {
|
||||||
|
await props.fetchData();
|
||||||
|
await clickImage();
|
||||||
|
});
|
||||||
|
// ***************************************************************************************************
|
||||||
|
// ****************** fetch delete รูปภาพ ******************
|
||||||
|
// ****************** finally ทำการ fetch data,clickImage() ******************
|
||||||
|
// ***************************************************************************************************
|
||||||
|
};
|
||||||
|
|
||||||
|
const imageClass = (n: any) => {
|
||||||
|
const val = n == activeImage.value;
|
||||||
|
return {
|
||||||
|
"rounded-borders bg-grey-2 image-size-default": val,
|
||||||
|
"rounded-borders bg-grey-2 image-size-full": !val,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const getClass = (n: any) => {
|
||||||
|
const val = n == activeImage.value;
|
||||||
|
return {
|
||||||
|
"rounded-borders border-green shadow-1": val,
|
||||||
|
"rounded-borders shadow-1": !val,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.image-size-default {
|
||||||
|
height: 150px;
|
||||||
|
max-width: 15vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-size-full {
|
||||||
|
height: 160px;
|
||||||
|
max-width: 15vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.border-green {
|
||||||
|
border: 5px solid #52c688;
|
||||||
|
}
|
||||||
|
|
||||||
|
.area-div {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-header {
|
||||||
|
font-size: 1.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.containerimage {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.containerimage:hover .overlay {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.overlay {
|
||||||
|
background-color: #e4f2ffd2 !important;
|
||||||
|
opacity: 0;
|
||||||
|
padding: 2px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.information:target {
|
||||||
|
padding-top: 84px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.border-custom {
|
||||||
|
border: 0.5px solid #c3c3c3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-active-image {
|
||||||
|
background-color: #52c688;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-name {
|
||||||
|
font-size: 1.25em;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
1129
src/components/information/Information.vue
Normal file
1129
src/components/information/Information.vue
Normal file
File diff suppressed because it is too large
Load diff
20
src/components/information/interface/store/main.ts
Normal file
20
src/components/information/interface/store/main.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
interface Profile {
|
||||||
|
main: { columns: String[] };
|
||||||
|
education: { columns: String[] };
|
||||||
|
oldName: { columns: String[] };
|
||||||
|
certicate: { columns: String[] };
|
||||||
|
train: { columns: String[] };
|
||||||
|
insignia: { columns: String[] };
|
||||||
|
coined: { columns: String[] };
|
||||||
|
assessment: { columns: String[] };
|
||||||
|
salary: { columns: String[] };
|
||||||
|
discipline: { columns: String[] };
|
||||||
|
leave: { columns: String[] };
|
||||||
|
talent: { columns: String[] };
|
||||||
|
work: { columns: String[] };
|
||||||
|
record: { columns: String[] };
|
||||||
|
other: { columns: String[] };
|
||||||
|
document: { columns: String[] };
|
||||||
|
}
|
||||||
|
|
||||||
|
export type { Profile };
|
||||||
70
src/components/information/store/store.ts
Normal file
70
src/components/information/store/store.ts
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
import { ref } from "vue";
|
||||||
|
import { defineStore } from "pinia";
|
||||||
|
import type { Profile } from "@/components/information/interface/store/main";
|
||||||
|
|
||||||
|
export const useComponentProfileDataStore = defineStore(
|
||||||
|
"componentProfile",
|
||||||
|
() => {
|
||||||
|
const profile = "profile";
|
||||||
|
const birthDate = ref<Date>(new Date());
|
||||||
|
const retireText = ref<string | null>(null);
|
||||||
|
const profileData = ref<Profile>({
|
||||||
|
main: { columns: [] },
|
||||||
|
education: { columns: [] },
|
||||||
|
oldName: { columns: [] },
|
||||||
|
certicate: { columns: [] },
|
||||||
|
train: { columns: [] },
|
||||||
|
insignia: { columns: [] },
|
||||||
|
coined: { columns: [] },
|
||||||
|
assessment: { columns: [] },
|
||||||
|
salary: { columns: [] },
|
||||||
|
discipline: { columns: [] },
|
||||||
|
leave: { columns: [] },
|
||||||
|
talent: { columns: [] },
|
||||||
|
work: { columns: [] },
|
||||||
|
record: { columns: [] },
|
||||||
|
other: { columns: [] },
|
||||||
|
document: { columns: [] },
|
||||||
|
});
|
||||||
|
|
||||||
|
const changeRetireText = (val: string | null) => {
|
||||||
|
retireText.value = val;
|
||||||
|
};
|
||||||
|
const changeBirth = (val: Date) => {
|
||||||
|
birthDate.value = val;
|
||||||
|
};
|
||||||
|
|
||||||
|
const changeProfileColumns = (system: String, val: String[]) => {
|
||||||
|
if (system == "main") profileData.value.main.columns = val;
|
||||||
|
if (system == "education") profileData.value.education.columns = val;
|
||||||
|
if (system == "oldName") profileData.value.oldName.columns = val;
|
||||||
|
if (system == "certicate") profileData.value.certicate.columns = val;
|
||||||
|
if (system == "train") profileData.value.train.columns = val;
|
||||||
|
if (system == "insignia") profileData.value.insignia.columns = val;
|
||||||
|
if (system == "coined") profileData.value.coined.columns = val;
|
||||||
|
if (system == "assessment") profileData.value.assessment.columns = val;
|
||||||
|
if (system == "salary") profileData.value.salary.columns = val;
|
||||||
|
if (system == "discipline") profileData.value.discipline.columns = val;
|
||||||
|
if (system == "leave") profileData.value.leave.columns = val;
|
||||||
|
if (system == "talent") profileData.value.talent.columns = val;
|
||||||
|
if (system == "work") profileData.value.work.columns = val;
|
||||||
|
if (system == "record") profileData.value.record.columns = val;
|
||||||
|
if (system == "other") profileData.value.other.columns = val;
|
||||||
|
if (system == "document") profileData.value.document.columns = val;
|
||||||
|
localStorage.setItem(profile, JSON.stringify(profileData.value));
|
||||||
|
};
|
||||||
|
|
||||||
|
if (localStorage.getItem(profile) !== null) {
|
||||||
|
profileData.value = JSON.parse(localStorage.getItem(profile) || "{}");
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
profileData,
|
||||||
|
changeProfileColumns,
|
||||||
|
birthDate,
|
||||||
|
changeBirth,
|
||||||
|
retireText,
|
||||||
|
changeRetireText,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
199
src/components/information/top.vue
Normal file
199
src/components/information/top.vue
Normal file
|
|
@ -0,0 +1,199 @@
|
||||||
|
<template>
|
||||||
|
<div class="flex items-center">
|
||||||
|
<div class="flex items-center">
|
||||||
|
<q-icon
|
||||||
|
:name="icon"
|
||||||
|
size="1.5em"
|
||||||
|
color="grey-5"
|
||||||
|
class="q-mr-md"
|
||||||
|
v-if="icon != ''"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="text-bold text-subtitle2 col-12 row items-center"
|
||||||
|
v-if="header != ''"
|
||||||
|
>
|
||||||
|
{{ header }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="q-gutter-sm q-mx-sm" v-if="addData == false">
|
||||||
|
<q-btn
|
||||||
|
size="12px"
|
||||||
|
v-if="!edit"
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
:disabled="disable"
|
||||||
|
:color="edit ? 'grey-7' : 'primary'"
|
||||||
|
@click="ClickEdit"
|
||||||
|
icon="mdi-pencil-outline"
|
||||||
|
>
|
||||||
|
<q-tooltip>แก้ไขข้อมูล</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
<q-btn
|
||||||
|
size="12px"
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
v-if="edit"
|
||||||
|
:color="!edit ? 'grey-7' : 'public'"
|
||||||
|
@click="save"
|
||||||
|
icon="mdi-content-save-outline"
|
||||||
|
>
|
||||||
|
<q-tooltip>บันทึกข้อมูล</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
<q-btn
|
||||||
|
size="12px"
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
v-if="edit && !addEmployee"
|
||||||
|
:color="!edit ? 'grey-7' : 'red'"
|
||||||
|
@click="ClickCancel"
|
||||||
|
icon="mdi-undo"
|
||||||
|
>
|
||||||
|
<q-tooltip>ยกเลิก</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
</div>
|
||||||
|
<div class="q-pl-sm" v-else-if="iconAdd != '' && iconAdd != null">
|
||||||
|
<q-btn
|
||||||
|
size="12px"
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
color="add"
|
||||||
|
@click="addleave"
|
||||||
|
icon="mdi-plus"
|
||||||
|
>
|
||||||
|
<q-tooltip>เพิ่มข้อมูล</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
<q-btn size="12px" flat round color="add" @click="add" :icon="iconAdd">
|
||||||
|
<q-tooltip>สรุปวันลา</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="q-pl-sm" v-else>
|
||||||
|
<q-btn
|
||||||
|
size="12px"
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
:disabled="disable"
|
||||||
|
color="add"
|
||||||
|
@click="add"
|
||||||
|
icon="mdi-plus"
|
||||||
|
>
|
||||||
|
<q-tooltip>เพิ่มข้อมูล</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
</div>
|
||||||
|
<q-space />
|
||||||
|
<q-btn
|
||||||
|
color="info"
|
||||||
|
flat
|
||||||
|
dense
|
||||||
|
round
|
||||||
|
size="14px"
|
||||||
|
icon="mdi-history"
|
||||||
|
v-if="history"
|
||||||
|
@click="historyClick"
|
||||||
|
>
|
||||||
|
<q-tooltip>ประวัติ{{ header }}</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
const props = defineProps({
|
||||||
|
header: {
|
||||||
|
type: String,
|
||||||
|
default: "ข้อความ",
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
iconAdd: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
icon: {
|
||||||
|
type: String,
|
||||||
|
default: "mdi-help",
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
edit: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
history: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
addData: {
|
||||||
|
type: Boolean,
|
||||||
|
defualt: false,
|
||||||
|
},
|
||||||
|
disable: {
|
||||||
|
type: Boolean,
|
||||||
|
defualt: false,
|
||||||
|
},
|
||||||
|
historyClick: {
|
||||||
|
type: Function,
|
||||||
|
default: () => console.log("not function"),
|
||||||
|
},
|
||||||
|
add: {
|
||||||
|
type: Function,
|
||||||
|
default: () => console.log("not function"),
|
||||||
|
},
|
||||||
|
addleave: {
|
||||||
|
type: Function,
|
||||||
|
default: () => console.log("not function"),
|
||||||
|
},
|
||||||
|
save: {
|
||||||
|
type: Function,
|
||||||
|
default: () => console.log("not function"),
|
||||||
|
},
|
||||||
|
deleted: {
|
||||||
|
type: Function,
|
||||||
|
default: () => console.log("not function"),
|
||||||
|
},
|
||||||
|
cancel: {
|
||||||
|
type: Function,
|
||||||
|
default: () => console.log("not function"),
|
||||||
|
},
|
||||||
|
changeBtn: {
|
||||||
|
type: Function,
|
||||||
|
default: () => console.log("not function"),
|
||||||
|
},
|
||||||
|
addEmployee: {
|
||||||
|
type: Boolean,
|
||||||
|
defualt: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits(["update:edit"]);
|
||||||
|
|
||||||
|
const updateEdit = (value: any) => {
|
||||||
|
emit("update:edit", value);
|
||||||
|
};
|
||||||
|
|
||||||
|
const ClickEdit = () => {
|
||||||
|
updateEdit(!props.edit);
|
||||||
|
props.changeBtn();
|
||||||
|
};
|
||||||
|
|
||||||
|
const historyClick = async () => {
|
||||||
|
await props.historyClick();
|
||||||
|
};
|
||||||
|
|
||||||
|
const ClickCancel = () => {
|
||||||
|
updateEdit(!props.edit);
|
||||||
|
props.cancel();
|
||||||
|
props.changeBtn();
|
||||||
|
};
|
||||||
|
|
||||||
|
const save = () => {
|
||||||
|
props.save();
|
||||||
|
};
|
||||||
|
|
||||||
|
const add = () => {
|
||||||
|
props.add();
|
||||||
|
};
|
||||||
|
|
||||||
|
const addleave = () => {
|
||||||
|
props.addleave();
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style scoped></style>
|
||||||
|
|
@ -1062,7 +1062,7 @@ const fetchProvince = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchDistrict = async (id: string | null) => {
|
const fetchDistrict = async (id: string | null) => {
|
||||||
if (id !== null) {
|
if (id !== null && id != "") {
|
||||||
loaderPage(true);
|
loaderPage(true);
|
||||||
await http
|
await http
|
||||||
.get(config.API.listDistrict(id))
|
.get(config.API.listDistrict(id))
|
||||||
|
|
@ -1084,7 +1084,7 @@ const fetchDistrict = async (id: string | null) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchSubDistrict = async (id: string | null) => {
|
const fetchSubDistrict = async (id: string | null) => {
|
||||||
if (id !== null) {
|
if (id !== null && id != "") {
|
||||||
loaderPage(true);
|
loaderPage(true);
|
||||||
await http
|
await http
|
||||||
.get(config.API.listSubDistrict(id))
|
.get(config.API.listSubDistrict(id))
|
||||||
|
|
|
||||||
|
|
@ -626,8 +626,6 @@ const getNewData = async () => {
|
||||||
await fetchDistrict(addressData.value.provinceIdC, "2");
|
await fetchDistrict(addressData.value.provinceIdC, "2");
|
||||||
await fetchSubDistrict(addressData.value.districtId, "1");
|
await fetchSubDistrict(addressData.value.districtId, "1");
|
||||||
await fetchSubDistrict(addressData.value.districtIdC, "2");
|
await fetchSubDistrict(addressData.value.districtIdC, "2");
|
||||||
await selectSubDistrict(addressData.value.subdistrictId, "1");
|
|
||||||
await selectSubDistrict(addressData.value.subdistrictIdC, "2");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
|
|
@ -797,7 +795,7 @@ const fetchProvince = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchDistrict = async (id: string | null, position: string) => {
|
const fetchDistrict = async (id: string | null, position: string) => {
|
||||||
if (id != null) {
|
if (id != null && id != "") {
|
||||||
loaderPage(true);
|
loaderPage(true);
|
||||||
await http
|
await http
|
||||||
.get(config.API.listDistrict(id))
|
.get(config.API.listDistrict(id))
|
||||||
|
|
@ -825,7 +823,7 @@ const fetchDistrict = async (id: string | null, position: string) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchSubDistrict = async (id: string | null, position: string) => {
|
const fetchSubDistrict = async (id: string | null, position: string) => {
|
||||||
if (id != null) {
|
if (id != null && id != "") {
|
||||||
loaderPage(true);
|
loaderPage(true);
|
||||||
await http
|
await http
|
||||||
.get(config.API.listSubDistrict(id))
|
.get(config.API.listSubDistrict(id))
|
||||||
|
|
|
||||||
|
|
@ -155,10 +155,6 @@
|
||||||
<q-space />
|
<q-space />
|
||||||
|
|
||||||
<q-btn round flat color="pink-5" icon="mdi-file-document">
|
<q-btn round flat color="pink-5" icon="mdi-file-document">
|
||||||
<!-- <q-tooltip>{{
|
|
||||||
reasonStatus ? "การกลับเข้ารับราชการ" : "การออกจากราชการ"
|
|
||||||
}}</q-tooltip> -->
|
|
||||||
|
|
||||||
<q-menu transition-show="jump-down" transition-hide="jump-up">
|
<q-menu transition-show="jump-down" transition-hide="jump-up">
|
||||||
<q-list dense style="min-width: 160px">
|
<q-list dense style="min-width: 160px">
|
||||||
<q-item clickable v-close-popup @click="clickPassaway">
|
<q-item clickable v-close-popup @click="clickPassaway">
|
||||||
|
|
|
||||||
|
|
@ -123,8 +123,6 @@ const getNewData = async () => {
|
||||||
await fetchDistrict(addressData.value.currentProvinceId, "2");
|
await fetchDistrict(addressData.value.currentProvinceId, "2");
|
||||||
await fetchSubDistrict(addressData.value.registDistrictId, "1");
|
await fetchSubDistrict(addressData.value.registDistrictId, "1");
|
||||||
await fetchSubDistrict(addressData.value.currentDistrictId, "2");
|
await fetchSubDistrict(addressData.value.currentDistrictId, "2");
|
||||||
await selectSubDistrict(addressData.value.registSubDistrictId, "1");
|
|
||||||
await selectSubDistrict(addressData.value.currentSubDistrictId, "2");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const editData = async () => {
|
const editData = async () => {
|
||||||
|
|
@ -247,7 +245,7 @@ const fetchProvince = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchDistrict = async (id: string | null, position: string) => {
|
const fetchDistrict = async (id: string | null, position: string) => {
|
||||||
if (id != null) {
|
if (id != null && id != "") {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.listDistrict(id))
|
.get(config.API.listDistrict(id))
|
||||||
|
|
@ -275,7 +273,7 @@ const fetchDistrict = async (id: string | null, position: string) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchSubDistrict = async (id: string | null, position: string) => {
|
const fetchSubDistrict = async (id: string | null, position: string) => {
|
||||||
if (id != null) {
|
if (id != null && id != "") {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.listSubDistrict(id))
|
.get(config.API.listSubDistrict(id))
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
<template>
|
||||||
|
<div class="col-12 row">
|
||||||
|
<div class="row col-12" style="padding-top: 80px">
|
||||||
|
<div id="information" name="1" class="row col-12 information">
|
||||||
|
<Information v-model:statusEdit="statusEdit" :statusAdd="false" />
|
||||||
|
</div>
|
||||||
|
<div id="government" name="16" class="row col-12 q-mt-md">
|
||||||
|
<Government v-model:statusEdit="statusEdit" :statusAdd="false" />
|
||||||
|
</div>
|
||||||
|
<div id="address" name="17" class="row col-12 q-mt-md">
|
||||||
|
<Address v-model:statusEdit="statusEdit" :statusAdd="false" />
|
||||||
|
</div>
|
||||||
|
<div id="family" name="18" class="row col-12 q-mt-md">
|
||||||
|
<Family v-model:statusEdit="statusEdit" :statusAdd="false" />
|
||||||
|
</div>
|
||||||
|
<div id="certicate" name="15" class="row col-12 q-mt-md">
|
||||||
|
<Certicate />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Image />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from "vue";
|
||||||
|
import Image from "@/components/information/Image.vue";
|
||||||
|
import Information from "@/components/information/Information.vue";
|
||||||
|
import Government from "@/components/information/Government.vue";
|
||||||
|
import Address from "@/components/information/Address.vue";
|
||||||
|
import Family from "@/components/information/Family.vue";
|
||||||
|
import Certicate from "@/components/information/Certicate.vue";
|
||||||
|
|
||||||
|
const statusEdit = ref<boolean>(false);
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.information:target {
|
||||||
|
padding-top: 84px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
>
|
||||||
|
|
@ -292,6 +292,10 @@ const closeModalTree = async () => {
|
||||||
// await getTable();
|
// await getTable();
|
||||||
modalTree.value = false;
|
modalTree.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const nextPage = (id: string) => {
|
||||||
|
router.push(`/receive/${id}`);
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="toptitle text-dark col-12 row items-center">รายการรับโอน</div>
|
<div class="toptitle text-dark col-12 row items-center">รายการรับโอน</div>
|
||||||
|
|
@ -367,25 +371,53 @@ const closeModalTree = async () => {
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:body="props">
|
<template v-slot:body="props">
|
||||||
<q-tr :props="props" class="cursor-pointer">
|
<q-tr :props="props" class="cursor-pointer">
|
||||||
<q-td key="no" :props="props">
|
<q-td
|
||||||
|
key="no"
|
||||||
|
:props="props"
|
||||||
|
@click="nextPage(props.row.personalId)"
|
||||||
|
>
|
||||||
{{ props.rowIndex + 1 }}
|
{{ props.rowIndex + 1 }}
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td key="fullname" :props="props">
|
<q-td
|
||||||
|
key="fullname"
|
||||||
|
:props="props"
|
||||||
|
@click="nextPage(props.row.personalId)"
|
||||||
|
>
|
||||||
{{ props.row.fullname }}
|
{{ props.row.fullname }}
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td key="position" :props="props">
|
<q-td
|
||||||
|
key="position"
|
||||||
|
:props="props"
|
||||||
|
@click="nextPage(props.row.personalId)"
|
||||||
|
>
|
||||||
{{ props.row.position }}
|
{{ props.row.position }}
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td key="positionLevel" :props="props">
|
<q-td
|
||||||
|
key="positionLevel"
|
||||||
|
:props="props"
|
||||||
|
@click="nextPage(props.row.personalId)"
|
||||||
|
>
|
||||||
{{ props.row.positionLevel }}
|
{{ props.row.positionLevel }}
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td key="oc" :props="props">
|
<q-td
|
||||||
|
key="oc"
|
||||||
|
:props="props"
|
||||||
|
@click="nextPage(props.row.personalId)"
|
||||||
|
>
|
||||||
{{ props.row.oc }}
|
{{ props.row.oc }}
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td key="agency" :props="props">
|
<q-td
|
||||||
|
key="agency"
|
||||||
|
:props="props"
|
||||||
|
@click="nextPage(props.row.personalId)"
|
||||||
|
>
|
||||||
{{ props.row.agency }}
|
{{ props.row.agency }}
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td key="status" :props="props">
|
<q-td
|
||||||
|
key="status"
|
||||||
|
:props="props"
|
||||||
|
@click="nextPage(props.row.personalId)"
|
||||||
|
>
|
||||||
{{ props.row.status }}
|
{{ props.row.status }}
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td auto-width>
|
<q-td auto-width>
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,9 @@ const RepatriationOrderAdd = () =>
|
||||||
const receiveMain = () =>
|
const receiveMain = () =>
|
||||||
import("@/modules/05_placement/components/Receive/receiveMain.vue");
|
import("@/modules/05_placement/components/Receive/receiveMain.vue");
|
||||||
|
|
||||||
|
const receiveDetail = () =>
|
||||||
|
import("@/modules/05_placement/components/Receive/receiveDetail.vue");
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
path: "/placement",
|
path: "/placement",
|
||||||
|
|
@ -221,4 +224,14 @@ export default [
|
||||||
Role: "placement",
|
Role: "placement",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/receive/:id",
|
||||||
|
name: "receiveDetail",
|
||||||
|
component: receiveDetail,
|
||||||
|
meta: {
|
||||||
|
Auth: true,
|
||||||
|
Key: [6.3],
|
||||||
|
Role: "placement",
|
||||||
|
},
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -626,8 +626,6 @@ const getNewData = async () => {
|
||||||
await fetchDistrict(addressData.value.provinceIdC, "2");
|
await fetchDistrict(addressData.value.provinceIdC, "2");
|
||||||
await fetchSubDistrict(addressData.value.districtId, "1");
|
await fetchSubDistrict(addressData.value.districtId, "1");
|
||||||
await fetchSubDistrict(addressData.value.districtIdC, "2");
|
await fetchSubDistrict(addressData.value.districtIdC, "2");
|
||||||
await selectSubDistrict(addressData.value.subdistrictId, "1");
|
|
||||||
await selectSubDistrict(addressData.value.subdistrictIdC, "2");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
|
|
@ -797,7 +795,7 @@ const fetchProvince = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchDistrict = async (id: string | null, position: string) => {
|
const fetchDistrict = async (id: string | null, position: string) => {
|
||||||
if (id != null) {
|
if (id != null && id != "") {
|
||||||
loaderPage(true);
|
loaderPage(true);
|
||||||
await http
|
await http
|
||||||
.get(config.API.listDistrict(id))
|
.get(config.API.listDistrict(id))
|
||||||
|
|
@ -825,7 +823,7 @@ const fetchDistrict = async (id: string | null, position: string) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchSubDistrict = async (id: string | null, position: string) => {
|
const fetchSubDistrict = async (id: string | null, position: string) => {
|
||||||
if (id != null) {
|
if (id != null && id != "") {
|
||||||
loaderPage(true);
|
loaderPage(true);
|
||||||
await http
|
await http
|
||||||
.get(config.API.listSubDistrict(id))
|
.get(config.API.listSubDistrict(id))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue