Merge branch 'nice' into develop
This commit is contained in:
commit
a4a59f8729
2 changed files with 88 additions and 204 deletions
|
|
@ -38,7 +38,15 @@ export const useRegistryNewDataStore = defineStore("registryNew", () => {
|
||||||
id: e.id,
|
id: e.id,
|
||||||
name: e.posLevelName,
|
name: e.posLevelName,
|
||||||
}));
|
}));
|
||||||
posLevelOps.value = list;
|
const seen = new Set();
|
||||||
|
posLevelOps.value = list.filter((item: DataOption) => {
|
||||||
|
if (seen.has(item.name)) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
seen.add(item.name);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
fetchType,
|
fetchType,
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, computed, onMounted, watch } from "vue";
|
import { ref, reactive, computed, onMounted } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
||||||
/** importType*/
|
/** importType*/
|
||||||
import type { QTableColumn } from "quasar";
|
|
||||||
import type { DataOption } from "@/modules/04_registryNew/interface/index/Main";
|
import type { DataOption } from "@/modules/04_registryNew/interface/index/Main";
|
||||||
import type { DataPerson } from "@/modules/04_registryNew/interface/response/Main";
|
import type { DataPerson } from "@/modules/04_registryNew/interface/response/Main";
|
||||||
import type { FormFilter } from "@/modules/04_registryNew/interface/request/Main";
|
import type { FormFilter } from "@/modules/04_registryNew/interface/request/Main";
|
||||||
|
|
@ -64,36 +63,62 @@ const conditionTotal = computed(() => {
|
||||||
|
|
||||||
/** function เรียกข้อมูลประเภทตำแหน่ง*/
|
/** function เรียกข้อมูลประเภทตำแหน่ง*/
|
||||||
function fetchType() {
|
function fetchType() {
|
||||||
if (store.posTypeOps.length === 0) {
|
http
|
||||||
http
|
.get(config.API.orgPosType)
|
||||||
.get(config.API.orgPosType)
|
.then((res) => {
|
||||||
.then((res) => {
|
store.fetchType(res.data.result);
|
||||||
store.fetchType(res.data.result);
|
})
|
||||||
})
|
.catch((err) => {
|
||||||
.catch((err) => {
|
messageError($q, err);
|
||||||
messageError($q, err);
|
})
|
||||||
})
|
.finally(() => {
|
||||||
.finally(() => {
|
hideLoader();
|
||||||
hideLoader();
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function เรียกข้อมูลระดับตำแหน่ง*/
|
/** function เรียกข้อมูลระดับตำแหน่ง*/
|
||||||
function fetchLevel() {
|
function fetchLevel() {
|
||||||
if (store.posLevelOps.length === 0) {
|
http
|
||||||
http
|
.get(config.API.orgPosLevel)
|
||||||
.get(config.API.orgPosLevel)
|
.then((res) => {
|
||||||
.then((res) => {
|
store.fetchLevel(res.data.result);
|
||||||
store.fetchLevel(res.data.result);
|
})
|
||||||
})
|
.catch((err) => {
|
||||||
.catch((err) => {
|
messageError($q, err);
|
||||||
messageError($q, err);
|
})
|
||||||
})
|
.finally(() => {
|
||||||
.finally(() => {
|
hideLoader();
|
||||||
hideLoader();
|
});
|
||||||
});
|
}
|
||||||
}
|
|
||||||
|
function fetchOptionGroup() {
|
||||||
|
showLoader();
|
||||||
|
http
|
||||||
|
.get(config.API.orgEmployeeType)
|
||||||
|
.then((res) => {
|
||||||
|
store.fetchType(res.data.result);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function fetchLevelGroup() {
|
||||||
|
showLoader();
|
||||||
|
http
|
||||||
|
.get(config.API.orgEmployeelevel)
|
||||||
|
.then((res) => {
|
||||||
|
store.fetchLevel(res.data.result);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchYearOption() {
|
function fetchYearOption() {
|
||||||
|
|
@ -146,7 +171,6 @@ async function fetchDataPerson(search: boolean = false) {
|
||||||
queryParams.isRetire = formFilter.isShowRetire;
|
queryParams.isRetire = formFilter.isShowRetire;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check type person empType.value
|
|
||||||
http
|
http
|
||||||
.get(
|
.get(
|
||||||
config.API.registryNew(empType.value !== "officer" ? "-employee" : ""),
|
config.API.registryNew(empType.value !== "officer" ? "-employee" : ""),
|
||||||
|
|
@ -162,9 +186,7 @@ async function fetchDataPerson(search: boolean = false) {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
// setTimeout(() => {
|
|
||||||
hideLoader();
|
hideLoader();
|
||||||
// }, 500);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -195,18 +217,6 @@ function insertAvatar(items: DataPerson[]) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// const convertImageProfile = (id: string) => {
|
|
||||||
// return http
|
|
||||||
// .get(
|
|
||||||
// config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, "profile-" + id)
|
|
||||||
// )
|
|
||||||
// .then((res) => {
|
|
||||||
// return res.data.downloadUrl;
|
|
||||||
// })
|
|
||||||
// .catch(() => {
|
|
||||||
// return avatar;
|
|
||||||
// });
|
|
||||||
// };
|
|
||||||
|
|
||||||
function onClickShowFilter() {
|
function onClickShowFilter() {
|
||||||
isShowFilter.value = !isShowFilter.value;
|
isShowFilter.value = !isShowFilter.value;
|
||||||
|
|
@ -233,6 +243,19 @@ function onclickSearch() {
|
||||||
function selectType(item: DataOption) {
|
function selectType(item: DataOption) {
|
||||||
labelOption.type = item.name;
|
labelOption.type = item.name;
|
||||||
empType.value = item.id;
|
empType.value = item.id;
|
||||||
|
|
||||||
|
labelOption.posType = "ทั้งหมด";
|
||||||
|
labelOption.posLevel = "ทั้งหมด";
|
||||||
|
if (item.id !== "officer") {
|
||||||
|
formFilter.isShowRetire = null;
|
||||||
|
formFilter.isProbation = null;
|
||||||
|
fetchOptionGroup();
|
||||||
|
fetchLevelGroup();
|
||||||
|
} else {
|
||||||
|
fetchType();
|
||||||
|
fetchLevel();
|
||||||
|
}
|
||||||
|
|
||||||
fetchDataPerson();
|
fetchDataPerson();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -246,10 +269,6 @@ function selectPosLevel(item: DataOption) {
|
||||||
fetchDataPerson();
|
fetchDataPerson();
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectRetireYear(item: DataOption) {
|
|
||||||
labelOption.retireYear = item.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
function clearSelect(t: string) {
|
function clearSelect(t: string) {
|
||||||
if (t === "posType") {
|
if (t === "posType") {
|
||||||
labelOption.posType = "ทั้งหมด";
|
labelOption.posType = "ทั้งหมด";
|
||||||
|
|
@ -270,10 +289,6 @@ onMounted(async () => {
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<!-- <div class="toptitle text-dark col-12 row items-center">
|
|
||||||
ข้อมูลทะเบียนประวัติ
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<q-card class="q-mt-md">
|
<q-card class="q-mt-md">
|
||||||
<q-card-section class="card-img q-pb-lg">
|
<q-card-section class="card-img q-pb-lg">
|
||||||
<div class="text-h5 text-center q-py-md text-weight-medium">
|
<div class="text-h5 text-center q-py-md text-weight-medium">
|
||||||
|
|
@ -356,16 +371,6 @@ onMounted(async () => {
|
||||||
>
|
>
|
||||||
<template v-slot:label>
|
<template v-slot:label>
|
||||||
{{ `${labelOption.type}` }}
|
{{ `${labelOption.type}` }}
|
||||||
|
|
||||||
<!-- <q-btn
|
|
||||||
size="10px"
|
|
||||||
flat
|
|
||||||
round
|
|
||||||
color="white"
|
|
||||||
icon="close"
|
|
||||||
v-if="labelOption.type !== 'ประเภททั้งหมด'"
|
|
||||||
@click.stop.prevent="clearSelect('type')"
|
|
||||||
/> -->
|
|
||||||
</template>
|
</template>
|
||||||
<q-list>
|
<q-list>
|
||||||
<q-item
|
<q-item
|
||||||
|
|
@ -391,7 +396,7 @@ onMounted(async () => {
|
||||||
label-color="white"
|
label-color="white"
|
||||||
dropdown-icon="mdi-chevron-down"
|
dropdown-icon="mdi-chevron-down"
|
||||||
class="q-px-sm"
|
class="q-px-sm"
|
||||||
><!-- class="custom-btn" -->
|
>
|
||||||
<template v-slot:label>
|
<template v-slot:label>
|
||||||
{{
|
{{
|
||||||
labelOption.posType !== "ทั้งหมด"
|
labelOption.posType !== "ทั้งหมด"
|
||||||
|
|
@ -434,7 +439,7 @@ onMounted(async () => {
|
||||||
label-color="white"
|
label-color="white"
|
||||||
dropdown-icon="mdi-chevron-down"
|
dropdown-icon="mdi-chevron-down"
|
||||||
class="q-px-sm"
|
class="q-px-sm"
|
||||||
><!-- class="custom-btn" -->
|
>
|
||||||
<template v-slot:label>
|
<template v-slot:label>
|
||||||
{{
|
{{
|
||||||
labelOption.posLevel !== "ทั้งหมด"
|
labelOption.posLevel !== "ทั้งหมด"
|
||||||
|
|
@ -453,7 +458,9 @@ onMounted(async () => {
|
||||||
@click.stop.prevent="clearSelect('posLevel')"
|
@click.stop.prevent="clearSelect('posLevel')"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<q-list style="height: 300px">
|
<q-list
|
||||||
|
:style="store.posLevelOps.length > 9 ? 'height: 450px' : ''"
|
||||||
|
>
|
||||||
<q-item
|
<q-item
|
||||||
v-for="(item, index) in store.posLevelOps"
|
v-for="(item, index) in store.posLevelOps"
|
||||||
:key="index"
|
:key="index"
|
||||||
|
|
@ -468,146 +475,15 @@ onMounted(async () => {
|
||||||
</q-list>
|
</q-list>
|
||||||
</q-btn-dropdown>
|
</q-btn-dropdown>
|
||||||
|
|
||||||
<q-separator inset vertical class="lineFil" />
|
<q-separator
|
||||||
|
inset
|
||||||
<!-- <q-btn-dropdown
|
vertical
|
||||||
flat
|
class="lineFil"
|
||||||
dense
|
v-if="empType === 'officer'"
|
||||||
rounded
|
/>
|
||||||
label-color="white"
|
|
||||||
dropdown-icon="mdi-chevron-down"
|
|
||||||
class="q-px-sm"
|
|
||||||
>
|
|
||||||
<template v-slot:label>
|
|
||||||
{{ `ปีเกษียณ${labelOption.retireYear}` }}
|
|
||||||
<q-btn
|
|
||||||
size="10px"
|
|
||||||
flat
|
|
||||||
round
|
|
||||||
color="white"
|
|
||||||
icon="close"
|
|
||||||
v-if="labelOption.retireYear !== ''"
|
|
||||||
@click.stop.prevent="clearSelect('retireYear')"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<q-list style="height: 300px">
|
|
||||||
<q-item
|
|
||||||
v-for="(item, index) in store.yearOps"
|
|
||||||
:key="index"
|
|
||||||
clickable
|
|
||||||
v-close-popup
|
|
||||||
@click="selectRetireYear(item)"
|
|
||||||
>
|
|
||||||
<q-item-section>
|
|
||||||
<q-item-label>{{ item.name }}</q-item-label>
|
|
||||||
</q-item-section>
|
|
||||||
</q-item>
|
|
||||||
</q-list>
|
|
||||||
</q-btn-dropdown> -->
|
|
||||||
|
|
||||||
<!-- <q-separator inset vertical class="lineFil" /> -->
|
|
||||||
|
|
||||||
<!-- <datepicker
|
|
||||||
menu-class-name="modalfix"
|
|
||||||
v-model="formFilter.retireYear"
|
|
||||||
:locale="'th'"
|
|
||||||
autoApply
|
|
||||||
year-picker
|
|
||||||
:enableTimePicker="false"
|
|
||||||
clearable
|
|
||||||
style="width: 120px"
|
|
||||||
>
|
|
||||||
<template #year="{ year }">{{ year + 543 }}</template>
|
|
||||||
<template #year-overlay-value="{ value }">{{
|
|
||||||
parseInt(value + 543)
|
|
||||||
}}</template>
|
|
||||||
<template #trigger>
|
|
||||||
<q-input
|
|
||||||
class="cursor-pointer custom-select"
|
|
||||||
rounded
|
|
||||||
label-color="white"
|
|
||||||
outlined
|
|
||||||
dense
|
|
||||||
input-style="color:white;"
|
|
||||||
borderless
|
|
||||||
:model-value="
|
|
||||||
formFilter.retireYear === null
|
|
||||||
? null
|
|
||||||
: formFilter.retireYear + 543
|
|
||||||
"
|
|
||||||
:label="`${'ปีเกษียณ'}`"
|
|
||||||
>
|
|
||||||
<template v-slot:append>
|
|
||||||
<q-btn
|
|
||||||
size="10px"
|
|
||||||
flat
|
|
||||||
round
|
|
||||||
color="white"
|
|
||||||
icon="close"
|
|
||||||
v-if="formFilter.retireYear !== null"
|
|
||||||
@click.stop.prevent="clearSelect('retireYear')"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</q-input>
|
|
||||||
</template>
|
|
||||||
</datepicker> -->
|
|
||||||
|
|
||||||
<!-- <q-btn-dropdown
|
|
||||||
flat
|
|
||||||
dense
|
|
||||||
rounded
|
|
||||||
label-color="white"
|
|
||||||
dropdown-icon="mdi-chevron-down"
|
|
||||||
class="q-px-sm"
|
|
||||||
>
|
|
||||||
<template v-slot:label>
|
|
||||||
{{
|
|
||||||
`อายุราชการ (${formFilter.rangeYear.min} - ${formFilter.rangeYear.max} ปี)`
|
|
||||||
}}
|
|
||||||
<q-btn
|
|
||||||
size="10px"
|
|
||||||
flat
|
|
||||||
round
|
|
||||||
color="white"
|
|
||||||
icon="close"
|
|
||||||
v-if="
|
|
||||||
formFilter.rangeYear.min !== 0 ||
|
|
||||||
formFilter.rangeYear.max !== 60
|
|
||||||
"
|
|
||||||
@click.stop.prevent="clearSelect('rangeYear')"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<div class="row justify-center">
|
|
||||||
<div class="col-12 q-pa-md text-center">
|
|
||||||
<div>
|
|
||||||
<span>จำนวนปี</span>
|
|
||||||
<q-badge
|
|
||||||
color="grey-4"
|
|
||||||
text-color="black"
|
|
||||||
class="q-ml-sm"
|
|
||||||
:label="`${formFilter.rangeYear.min}-${formFilter.rangeYear.max}`"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="q-mt-lg">
|
|
||||||
<q-range
|
|
||||||
v-model="formFilter.rangeYear"
|
|
||||||
:min="0"
|
|
||||||
:max="60"
|
|
||||||
:step="1"
|
|
||||||
label
|
|
||||||
color="primary"
|
|
||||||
selection-color="blue"
|
|
||||||
label-color="primary"
|
|
||||||
thumb-color="blue"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</q-btn-dropdown> -->
|
|
||||||
|
|
||||||
<!-- <q-separator inset vertical class="lineFil" /> -->
|
|
||||||
|
|
||||||
<q-btn-dropdown
|
<q-btn-dropdown
|
||||||
|
v-if="empType === 'officer'"
|
||||||
flat
|
flat
|
||||||
dense
|
dense
|
||||||
rounded
|
rounded
|
||||||
|
|
@ -615,7 +491,7 @@ onMounted(async () => {
|
||||||
dropdown-icon="mdi-chevron-down"
|
dropdown-icon="mdi-chevron-down"
|
||||||
:label="`เงื่อนไขอื่นๆ ${conditionTotal}`"
|
:label="`เงื่อนไขอื่นๆ ${conditionTotal}`"
|
||||||
class="q-px-sm"
|
class="q-px-sm"
|
||||||
><!-- class="custom-btn" -->
|
>
|
||||||
<q-list>
|
<q-list>
|
||||||
<q-item clickable v-close-popup>
|
<q-item clickable v-close-popup>
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue