Merge branch 'develop' into devTee

This commit is contained in:
STW_TTTY\stwtt 2024-09-06 13:48:15 +07:00
commit a3214d3fea
13 changed files with 238 additions and 143 deletions

View file

@ -352,9 +352,13 @@ watch(
class="text-weight-medium"
>
{{
`${props.row.prefix ? props.row.prefix : ""}${
props.row.firstName
} ${props.row.lastName}`
`${
props.row.rank
? props.row.rank
: props.row.prefix
? props.row.prefix
: ""
}${props.row.firstName} ${props.row.lastName}`
}}
</div>
<div
@ -367,9 +371,13 @@ watch(
>
<q-tooltip>รายละเอยด</q-tooltip>
{{
`${props.row.prefix ? props.row.prefix : ""}${
props.row.firstName
} ${props.row.lastName}`
`${
props.row.rank
? props.row.rank
: props.row.prefix
? props.row.prefix
: ""
}${props.row.firstName} ${props.row.lastName}`
}}
<q-icon name="mdi-open-in-new" size="xs"></q-icon>
</div>

View file

@ -25,6 +25,7 @@ const route = useRoute();
const store = useProfileDataStore();
const { filterSelector } = store;
const {
date2Thai,
dialogConfirm,
showLoader,
hideLoader,
@ -47,6 +48,8 @@ const visibleColumns = ref<String[]>([
"job",
"isLive",
"lastNameOld",
"lastUpdateFullName",
"lastUpdatedAt",
]);
const columns = ref<QTableProps["columns"]>([
{
@ -114,6 +117,25 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
format: (val) => (val ? "มีชีวิต" : "ถึงแก่กรรม"),
},
{
name: "lastUpdateFullName",
align: "left",
label: "ผู้ดำเนินการ",
sortable: true,
field: "lastUpdateFullName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "lastUpdatedAt",
align: "left",
label: "วันที่แก้ไข",
sortable: true,
field: "lastUpdatedAt",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (val) => date2Thai(val),
},
]);
const rows = ref<any[]>([]);
@ -173,13 +195,12 @@ const fromData = reactive({
* function fetch อมลบดา
*/
async function fetchDataFather() {
showLoader();
await http
.get(
config.API.profileFamily(empType.value, "father") + `/${profileId.value}`
)
.then((res) => {
const data = res.data.result;
.then(async (res) => {
const data = await res.data.result;
if (data) {
fatherData.isLive = data.fatherLive;
@ -192,9 +213,6 @@ async function fetchDataFather() {
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
@ -202,13 +220,12 @@ async function fetchDataFather() {
* function fetch อมลมารดา
*/
async function fetchDataMother() {
showLoader();
await http
.get(
config.API.profileFamily(empType.value, "mother") + `/${profileId.value}`
)
.then((res) => {
const data = res.data.result;
.then(async (res) => {
const data = await res.data.result;
if (data) {
motherData.isLive = data.motherLive;
motherData.citizenId = data.motherCitizenId;
@ -220,9 +237,6 @@ async function fetchDataMother() {
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
@ -230,13 +244,12 @@ async function fetchDataMother() {
* function fetch อมลคสมรส
*/
async function fetchDataCouple() {
showLoader();
await http
.get(
config.API.profileFamily(empType.value, "couple") + `/${profileId.value}`
)
.then((res) => {
const data = res.data.result;
.then(async (res) => {
const data = await res.data.result;
if (data) {
coupleData.isLive = data.coupleLive;
coupleData.citizenId = data.coupleCitizenId;
@ -250,9 +263,6 @@ async function fetchDataCouple() {
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
@ -260,21 +270,17 @@ async function fetchDataCouple() {
* function fetch อมลบตร
*/
async function fetchDataChildren() {
showLoader();
await http
.get(
config.API.profileFamily(empType.value, "children") +
`/${profileId.value}`
)
.then((res) => {
const data = res.data.result;
.then(async (res) => {
const data = await res.data.result;
childData.value = data;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
@ -339,6 +345,7 @@ function closeDialog() {
fromData.job = "";
fromData.lastNameOld = "";
fromData.statusMarital = "";
rows.value = [];
}
/**
@ -412,7 +419,6 @@ function onOpenDialogHistory(type: string, id: string = "") {
* function fetch อมลความสมพนธ
*/
function fetchDataRelationship() {
// showLoader();
http
.get(config.API.orgRelationship)
.then((res) => {
@ -424,11 +430,6 @@ function fetchDataRelationship() {
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
// setTimeout(() => {
// hideLoader();
// }, 2000);
});
}
@ -450,13 +451,13 @@ function filterSelectorRelation(val: any, update: Function) {
* @param id
* @param type
*/
function fetchHistory(id: string, type: string) {
hideLoader();
http
async function fetchHistory(id: string, type: string) {
showLoader();
await http
.get(config.API.profileFamilyHistory(id, empType.value, type))
.then((res) => {
const data = res.data.result;
rows.value = data.map((e: any) => ({
.then(async (res) => {
const data = await res.data.result;
rows.value = await data.map((e: any) => ({
citizenId: e[`${type}CitizenId`],
prefix: e[`${type}Prefix`],
firstName: e[`${type}FirstName`],
@ -464,6 +465,8 @@ function fetchHistory(id: string, type: string) {
job: e[`${type}Career`],
isLive: e[`${type}Live`],
lastNameOld: type === "couple" ? e.coupleLastNameOld : undefined,
lastUpdateFullName: e.lastUpdateFullName,
lastUpdatedAt: e.lastUpdatedAt,
}));
})
.catch((err) => {
@ -482,9 +485,13 @@ onMounted(async () => {
fetchDataCouple(),
fetchDataChildren(),
fetchDataRelationship(),
]).then(() => {
hideLoader();
});
])
.then(() => {
hideLoader();
})
.catch(() => {
hideLoader();
});
});
</script>

View file

@ -3,6 +3,7 @@ interface FormFilter {
pageSize: number;
keyword: string;
type: string;
searchType?: string;
posType: string;
posLevel: string;
retireYear: string | null;

View file

@ -22,6 +22,7 @@ interface DataPerson {
posTypeId: string;
position: string;
prefix: string;
rank?: string;
}
export type { DataType, DataLevel, DataPerson };

View file

@ -64,6 +64,7 @@ export const useRegistryNewDataStore = defineStore("registryNew", () => {
isAll: true,
nodeId: null,
node: null,
searchType: "fullName",
});
const labelOption = reactive({

View file

@ -304,7 +304,10 @@ function onClickDownloadKp7(type: string) {
? empType.value
? config.API.profileReportEmpId(profileId.value)
: config.API.profileReportId(profileId.value)
: empType.value
? config.API.profileKp7ShortEmpId(profileId.value)
: config.API.profileKp7ShortId(profileId.value);
const fileName = type === "FULL" ? "ก.พ.7/ก.ก.1" : "ประวัติแบบย่อ";
http
.get(url, {
@ -746,6 +749,7 @@ onMounted(async () => {
</q-btn-dropdown>
<q-btn
v-if="empType !== '-temp'"
unelevated
round
color="grey-4"

View file

@ -20,9 +20,11 @@ import DialogHeader from "@/components/DialogHeader.vue";
import { useRegistryNewDataStore } from "@/modules/04_registryPerson/store";
import { useCounterMixin } from "@/stores/mixin";
import { useRoute } from "vue-router";
import { useStructureTree } from "@/stores/structureTree";
const $q = useQuasar();
const store = useRegistryNewDataStore();
const { fetchStructureTree } = useStructureTree();
const { showLoader, hideLoader, messageError } = useCounterMixin();
const route = useRoute();
@ -32,7 +34,7 @@ const isShowFilter = ref<boolean>(true);
const isShowBtnFilter = ref<boolean>(false);
const empType = ref<string>("officer"); // officer / employee / perm
const searchType = ref<string>("fullName");
// const searchType = ref<string>("fullName");
const node = ref<any>([]);
const expanded = ref<any>([]);
const maxPage = ref<number>(1);
@ -115,7 +117,7 @@ function fetchDataPerson() {
if (store.formFilter.keyword) {
queryParams = Object.assign({}, queryParams, {
searchField: searchType.value,
searchField: store.formFilter.searchType,
searchKeyword: store.formFilter.keyword,
});
}
@ -262,9 +264,9 @@ async function selectType() {
empType.value === "officer"
? "เลือกหน่วยงาน/ส่วนราชการ"
: "เลือกหน่วยงาน";
store.formFilter.searchType = "fullName";
} else {
// filter
if (
store.formFilter.keyword != "" ||
store.labelOption.posType != "ทั้งหมด" ||
@ -331,36 +333,15 @@ function clearSelect(t: string) {
fetchDataPerson();
}
async function fetchTree(id: string) {
showLoader();
http
.get(config.API.orgByIdSystem(id, route.meta.Key as string))
.then((res) => {
const data = res.data.result;
node.value = data;
store.formFilter.node = nodeData.node;
store.formFilter.nodeId = nodeData.nodeId;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
function fetchActive() {
showLoader();
http
.get(config.API.activeOrganization)
.then((res) => {
const data = res.data.result;
fetchTree(data.activeId);
})
.catch((err) => {
messageError($q, err);
hideLoader();
});
const isLoad = ref<boolean>(false);
async function fetchTree() {
const data = await fetchStructureTree(route.meta.Key as string);
if (data) {
isLoad.value = true;
node.value = data;
store.formFilter.node = nodeData.node;
store.formFilter.nodeId = nodeData.nodeId;
}
}
function sendNode() {
@ -371,15 +352,6 @@ function sendNode() {
fetchDataPerson();
}
watch(
() => selectNode.value,
() => {
if (selectNode.value) {
fetchActive();
}
}
);
function updateSelectedTreeMain(data: any) {
if (nodeData.node === data.orgLevel && nodeData.nodeId === data.orgTreeId) {
store.formFilter.node = null;
@ -395,8 +367,14 @@ function updateSelectedTreeMain(data: any) {
}
}
/** callback function เมื่อมีการเปิด popup*/
watch(selectNode, () => {
isLoad.value && hideLoader();
});
onMounted(async () => {
selectType();
fetchTree();
});
</script>
@ -420,7 +398,7 @@ onMounted(async () => {
<q-select
borderless
bg-color="white"
v-model="searchType"
v-model="store.formFilter.searchType"
:options="store.searchTypeOption"
emit-value
dense
@ -482,7 +460,7 @@ onMounted(async () => {
label-color="white"
dropdown-icon="mdi-chevron-down"
class="q-px-sm"
@click="() => (selectNode = true)"
@click="() => ((selectNode = true), showLoader())"
>
<template v-slot:label>
{{
@ -601,7 +579,7 @@ onMounted(async () => {
inset
vertical
class="lineFil"
v-if="empType !== 'officer'"
v-if="empType !== 'officer' && store.formFilter.nodeId"
/>
<q-toggle

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, reactive, watch } from "vue";
import { ref, reactive, watch, onBeforeMount, onMounted } from "vue";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
@ -19,10 +19,11 @@ import Header from "@/components/DialogHeader.vue";
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
import { asCleanDays } from "@fullcalendar/core/internal";
import { useStructureTree } from "@/stores/structureTree";
/** use*/
const $q = useQuasar();
const { fetchStructureTree } = useStructureTree();
const {
success,
showLoader,
@ -204,47 +205,18 @@ const selectedPos = ref<any[]>([]);
const datePos = ref<Date>(new Date());
const posMasterMain = ref<any>([]);
const orgRevisionId = ref<string>("");
/** function เรียกข้อมูลโครงสร้าง แบบปัจุบันและ แบบร่าง*/
async function fetchOrganizationActive() {
showLoader();
await http
.get(config.API.activeOrganization)
.then((res) => {
const data = res.data.result;
if (data) {
orgRevisionId.value = data.activeId;
fetchDataTree(data.activeId);
}
})
.catch((err) => {
messageError($q, err);
});
}
const isLoad = ref<boolean>(false);
/**
* function fetch อมลของ Tree
* @param id id โครงสราง
*/
async function fetchDataTree(id: string) {
showLoader();
await http
.get(config.API.orgByIdSystem(id, route.meta.Key as string))
.then((res) => {
const data = res.data.result;
if (data) {
nodes.value = data;
filterItemsTaps(data);
}
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
setTimeout(() => {
hideLoader();
}, 1000);
});
async function fetchDataTree() {
const data = await fetchStructureTree(route.meta.Key as string, true);
if (data) {
nodes.value = data;
filterItemsTaps(data);
isLoad.value = true;
}
}
/**
@ -333,7 +305,7 @@ async function fetchPosFind(level: number, id: string) {
await http
.post(config.API.orgPosFind, body)
.then(async (res) => {
const data = res.data.result;
const data = await res.data.result;
expanded.value = data;
nodeId.value = id;
@ -400,7 +372,7 @@ function closePopup() {
}
/** function clearData*/
function clearData() {
async function clearData() {
nodeId.value = "";
expanded.value = [];
positionId.value = "";
@ -441,12 +413,14 @@ watch(
() => modal.value,
async () => {
if (modal.value) {
await fetchOrganizationActive();
showLoader();
await clearData();
if (props?.dataRow?.node !== null && props?.dataRow?.nodeId !== null) {
await fetchPosFind(props?.dataRow?.node, props?.dataRow?.nodeId);
} else {
expanded.value = [];
}
isLoad.value && hideLoader();
}
}
);
@ -468,6 +442,10 @@ watch(
}
}
);
onBeforeMount(async () => {
await fetchDataTree();
});
</script>
<template>

View file

@ -230,7 +230,7 @@ watch(
<template>
<q-dialog v-model="modal">
<q-card style="width: 900px; max-width: 80vw">
<q-card style="min-width: 80%">
<DialogHeader tittle="ส่งรายชื่อไปออกคำสั่ง" :close="closeDialog" />
<q-separator />
<q-card-section class="q-pt-none">

View file

@ -215,14 +215,14 @@ watch(
}
);
function fetchList() {
async function fetchList() {
showLoader();
http
.get(config.API.registryNew("-temp"), { params: queryParams })
.then((res) => {
.then(async (res) => {
rows.value = await res.data.result.data;
maxPage.value = Math.ceil(res.data.result.total / queryParams.pageSize);
total.value = res.data.result.total;
rows.value = res.data.result.data;
})
.catch((err) => {
messageError($q, err);
@ -273,8 +273,8 @@ function onClickSendOrder() {
modalSendOrder.value = true;
}
onMounted(() => {
fetchList();
onMounted(async () => {
await fetchList();
});
</script>
@ -394,16 +394,24 @@ onMounted(() => {
>
<q-btn
v-if="
(props.row.draftOrgEmployeeStatus === null ||
props.row.draftOrgEmployeeStatus === 'WAITTING' ||
props.row.draftOrgEmployeeStatus === 'PENDING') &&
checkPermission($route)?.attrIsUpdate &&
checkPermission($route)?.attrIsGet
"
:disable="
props.row.draftOrgEmployeeStatus !== null &&
props.row.draftOrgEmployeeStatus !== 'WAITTING' &&
props.row.draftOrgEmployeeStatus !== 'PENDING'
"
flat
round
dense
color="blue"
:color="
props.row.draftOrgEmployeeStatus !== null &&
props.row.draftOrgEmployeeStatus !== 'WAITTING' &&
props.row.draftOrgEmployeeStatus !== 'PENDING'
? 'grey-5'
: 'blue'
"
icon="mdi-account-settings"
@click.pervent="onClickSelectPos(props.row)"
>