Merge branch 'develop' into devTee

This commit is contained in:
STW_TTTY\stwtt 2024-08-16 14:42:36 +07:00
commit 911bed1148
34 changed files with 690 additions and 680 deletions

View file

@ -133,10 +133,9 @@ function saveSelectEdit() {
};
await http
.put(url, body)
.then(() => {
success($q, "เพิ่มข้อมูลสำเร็จ");
props.getData?.();
.then(async () => {
await props.getData?.();
await success($q, "เพิ่มข้อมูลสำเร็จ");
close();
})
.catch((err) => {
@ -192,10 +191,12 @@ function onSubmitSelectEdit() {
await http
.post(url, body)
.then(() => {
success($q, "เพิ่มข้อมูลสำเร็จ");
props.emitSearch?.(formPositionSelect.positionName, "positionName");
.then(async () => {
await props.emitSearch?.(
formPositionSelect.positionName,
"positionName"
);
await success($q, "เพิ่มข้อมูลสำเร็จ");
close();
})
.catch((err) => {
@ -241,7 +242,12 @@ function inputEdit(val: boolean) {
};
}
/**
* function เลอกประเภทตำแหน
* @param val id ประเภทตำแหน
*/
function updateSelectType(val: string) {
//
const listLevel = dataLevel.value.find((e: any) => e.id === val);
levelOpsMain.value = listLevel.posLevels.map((e: OptionLevel) => ({
id: e.id,
@ -257,8 +263,7 @@ function close() {
}
async function fetchType() {
showLoader();
await http
http
.get(config.API.orgPosType)
.then((res) => {
dataLevel.value = res.data.result;
@ -270,16 +275,12 @@ async function fetchType() {
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/** function เรียกรายการตำแหน่งทางการบริหาร */
async function fetchExecutive() {
showLoader();
await http
function fetchExecutive() {
http
.get(config.API.orgPosExecutive)
.then((res) => {
executiveOpsMain.value = res.data.result.map((e: OptionExecutive) => ({
@ -290,9 +291,6 @@ async function fetchExecutive() {
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
@ -300,8 +298,9 @@ watch(
() => modal.value,
async () => {
if (modal.value === true) {
await fetchType();
await fetchExecutive();
showLoader();
await Promise.all([fetchType(), fetchExecutive()]);
hideLoader();
if (props.data) {
const dataList = props.data;

View file

@ -149,13 +149,14 @@ function onSubmit() {
formData.responsibility != null ? formData.responsibility : "",
};
//
if (actionType.value === "ADD") {
await http
.post(config.API.createOrgLevel(type.toLocaleLowerCase()), body)
.then(() => {
props.fetchDataTree(store.draftId);
success($q, "บันทึกข้อมูลสำเร็จ");
closeClear();
.then(async () => {
await props.fetchDataTree(store.draftId);
await success($q, "บันทึกข้อมูลสำเร็จ");
await closeClear();
})
.catch((err) => {
messageError($q, err);
@ -164,6 +165,7 @@ function onSubmit() {
hideLoader();
});
} else {
//
props.dataNode &&
(await http
.put(
@ -173,32 +175,35 @@ function onSubmit() {
),
body
)
.then(() => {
props.fetchDataTree(store.draftId);
props.edit?.(
.then(async () => {
await props.fetchDataTree(store.draftId);
await props.edit?.(
props.dataNode?.orgTreeId,
type,
body,
props.dataNode?.orgRootCode
);
closeClear();
props.fetchDataTable(
await props.fetchDataTable(
props?.dataNode?.orgTreeId,
props?.dataNode?.orgLevel,
false
);
success($q, "บันทึกข้อมูลสำเร็จ");
await success($q, "บันทึกข้อมูลสำเร็จ");
await closeClear();
})
.catch((err) => {
messageError($q, err);
})
.finally(async () => {
.finally(() => {
hideLoader();
}));
}
});
}
/**
* function เช formdata กลบไปคาวาง และป popup
*/
function closeClear() {
formData.orgName = "";
formData.orgShortName = "";
@ -211,14 +216,14 @@ function closeClear() {
props.close?.();
}
/**
* callback function ทำงานเมอมการเป popup
*/
watch(
() => props.modal,
() => {
if (props.modal === true) {
if (actionType.value === "ADD") {
// console.log(props.dataNode);
// console.log(level.value);
if (props.dataNode) {
formData.orgCode =
props?.dataNode?.orgLevel !== 0
@ -261,6 +266,9 @@ watch(
}
);
/**
* title ของ popup
*/
const tittleName = computed(() => {
let name = "";
if (actionType.value === "ADD") {
@ -272,6 +280,11 @@ const tittleName = computed(() => {
return name;
});
/**
* function เลอกระดบของสวนราชการ
* @param val
* @param status
*/
function selectOrgLevele(val: string, status: boolean = true) {
formData.orgLevelSub = status ? "" : formData.orgLevelSub;
switch (val) {

View file

@ -1,7 +1,6 @@
<script setup lang="ts">
import { ref, reactive, watch } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
@ -27,7 +26,7 @@ import type { FilterMaster } from "@/modules/02_organization/interface/request/o
* importComponents
*/
import DialogHeader from "@/components/DialogHeader.vue";
import DialogAddPosition from "@/modules/02_organization/components/DialogAddPosition.vue";
import DialogAddPosition from "@/modules/02_organization/components/DialogAddPosition.vue"; //
/**
* importStore
@ -224,6 +223,10 @@ const visibleColumns = ref<string[]>([
"positionArea",
]);
/**
* function fetch อมลอตรากำล
* @param id ตรากำล
*/
async function fetchPosition(id: string) {
showLoader();
await http
@ -249,7 +252,7 @@ async function fetchPosition(id: string) {
const dataLevel = ref<any>();
/** function เรียกรายการประเภทตำแหน่ง */
async function fetchType() {
showLoader();
// showLoader();
await http
.get(config.API.orgPosType)
.then((res) => {
@ -264,13 +267,13 @@ async function fetchType() {
messageError($q, err);
})
.finally(() => {
hideLoader();
// hideLoader();
});
}
/** function เรียกรายการตำแหน่งทางการบริหาร */
async function fetchExecutive() {
showLoader();
// showLoader();
await http
.get(config.API.orgPosExecutive)
.then((res) => {
@ -284,7 +287,7 @@ async function fetchExecutive() {
messageError($q, err);
})
.finally(() => {
hideLoader();
// hideLoader();
});
}
@ -336,7 +339,6 @@ function onSubmit() {
orgChild3Id: props.orgLevel === 3 ? props.treeId : null,
orgChild4Id: props.orgLevel === 4 ? props.treeId : null,
positions: positionsData,
// succession: succession.value,
};
showLoader();
@ -435,10 +437,11 @@ function inputEdit(val: boolean) {
watch(
() => props.modal,
() => {
async () => {
if (props.modal === true) {
fetchType();
fetchExecutive();
props.actionType === "ADD" && showLoader();
await Promise.all([fetchType(), fetchExecutive()]);
props.actionType === "ADD" && hideLoader();
if (props.actionType === "ADD") {
rowsPositionSelect.value = [];
@ -474,30 +477,41 @@ async function addPosition(data: RowDetailPositions) {
}
}
/**
* function ลบขอมลอตรากำล
* @param id อมลอตรากำล
*/
function deleteData(id: string) {
const dataRow = rows.value;
const updatedRows = dataRow.filter((item: any) => item.id !== id);
rows.value = updatedRows;
}
/**
* function ลบตำแหน
* @param id ตำแหน
*/
function deletePos(id: string) {
dialogRemove($q, () => {
showLoader();
http
.delete(config.API.orgPosPositionById(id))
.then(() => {
success($q, "ลบข้อมูลสำเร็จ");
.then(async () => {
await searchInput();
await success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
searchInput();
hideLoader();
});
});
}
/**
* function เคลยร formData
*/
async function clearFormPositionSelect() {
isDisValidate.value = await true;
formPositionSelect.positionId = "";
@ -514,9 +528,12 @@ async function clearFormPositionSelect() {
}, 1000);
}
/**
* function popup
*/
function close() {
props.close?.();
clearFormPositionSelect();
props.close?.();
isPosition.value = false;
}
@ -648,8 +665,7 @@ async function emitSearch(keyword: string, typeSelect: string) {
<q-btn
flat
dense
icon="mdi-delete"
class="q-pa-none q-ml-xs"
icon="delete"
color="red"
@click="deleteData(props.row.id)"
>
@ -821,11 +837,14 @@ async function emitSearch(keyword: string, typeSelect: string) {
<q-btn
flat
dense
icon="mdi-dots-vertical"
class="q-pa-none q-ml-xs"
color="grey-13"
color="secondary"
icon="mdi-dots-horizontal-circle-outline"
round
>
<q-menu anchor="bottom middle" self="top middle">
<q-menu
transition-show="jump-down"
transition-hide="jump-up"
>
<q-list
dense
v-for="(item, index) in listMenu"
@ -842,11 +861,14 @@ async function emitSearch(keyword: string, typeSelect: string) {
: deletePos(props.row.id)
"
>
<q-item-section avatar>
<q-item-section
avatar
style="min-width: 0px"
>
<q-icon
:color="item.color"
:name="item.icon"
size="sm"
size="xs"
/>
</q-item-section>
<q-item-section>{{
@ -910,6 +932,8 @@ async function emitSearch(keyword: string, typeSelect: string) {
</form>
</q-card>
</q-dialog>
<!-- เพมขอมลตำแหน -->
<DialogAddPosition
v-model:modalAdd="modalAdd"
:emitSearch="emitSearch"

View file

@ -128,10 +128,10 @@ function onClickMovePos() {
showLoader();
await http
.post(config.API.orgPosMove, body)
.then(() => {
props.fetchDataTree?.(store.draftId);
.then(async () => {
await props.fetchDataTree?.(store.draftId);
await success($q, "ย้ายตำแหน่งสำเร็จ");
modal.value = false;
success($q, "ย้ายตำแหน่งสำเร็จ");
})
.catch((err) => {
messageError($q, err);

View file

@ -112,21 +112,21 @@ function onSubmit() {
showLoader();
http
.post(config.API.createOrganization, formData)
.then((res) => {
.then(async (res) => {
await props.fetchActive();
status.value = true;
store.typeOrganizational = "draft";
store.draftId = res.data.result.id;
store.statusView = "list";
success($q, "บันทึกข้อมูลสำเร็จ");
props.fetchActive();
})
.catch((err) => {
messageError($q, err);
})
.finally(async () => {
modal.value = await false;
await close();
await hideLoader();
.finally(() => {
modal.value = false;
hideLoader();
close();
});
},
"ยืนยันการเพิ่มโครงสร้าง",

View file

@ -56,7 +56,6 @@ async function fetchTree() {
await http
.get(config.API.orgByid(id))
.then((res) => {
console.log(res);
nodeTree.value = res.data.result;
})
.catch((err) => {
@ -164,7 +163,6 @@ function onClickConfirm() {
dialogConfirm(
$q,
async () => {
console.log(props.rowId, selectedPos.value[0].id);
const body: Inherit = {
draftPositionId: props.rowId,
publishPositionId: selectedPos.value[0].id,

View file

@ -297,15 +297,15 @@ async function onClickEdit(node: OrgTree) {
* @param id ID โครงสราง
* @param rootId RootID
*/
async function onClickDel(type: number, id: string, rootId: string) {
function onClickDel(type: number, id: string, rootId: string) {
const level = store.checkLevel(type);
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgLevelByid(level.toLocaleLowerCase(), id))
.then(() => {
success($q, "ลบข้อมูลสำเร็จ");
deleteUpdate(rootId, id);
.then(async () => {
await deleteUpdate(rootId, id);
await success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
@ -321,7 +321,7 @@ async function onClickDel(type: number, id: string, rootId: string) {
* @param id ID โครงสราง
* @param level ระดบโครงสราง
*/
async function onClickSort(id: string, level: number) {
function onClickSort(id: string, level: number) {
type.value = level;
modalSortAgency.value = true;
if (id) {

View file

@ -19,13 +19,13 @@ import type {
import type { DataPosition } from "@/modules/02_organization/interface/index/organizational";
/** importComponents*/
import DialogFormPosotion from "@/modules/02_organization/components/DialogFormPosition.vue";
import DialogPositionDetail from "@/modules/02_organization/components/DialogPositionDetail.vue";
import DialogSort from "@/modules/02_organization/components/DialogSortPosition.vue";
import DialogMovePos from "@/modules/02_organization/components/DialogMovePos.vue";
import DialogHistoryPos from "@/modules/02_organization/components/DialogHistoryPos.vue";
import DialogSelectPerson from "@/modules/02_organization/components/DialogSelectPerson.vue";
import DialogSuccession from "@/modules/02_organization/components/DialogSuccession.vue";
import DialogFormPosotion from "@/modules/02_organization/components/DialogFormPosition.vue"; //
import DialogPositionDetail from "@/modules/02_organization/components/DialogPositionDetail.vue"; //
import DialogSort from "@/modules/02_organization/components/DialogSortPosition.vue"; //
import DialogMovePos from "@/modules/02_organization/components/DialogMovePos.vue"; //
import DialogHistoryPos from "@/modules/02_organization/components/DialogHistoryPos.vue"; //
import DialogSelectPerson from "@/modules/02_organization/components/DialogSelectPerson.vue"; //
import DialogSuccession from "@/modules/02_organization/components/DialogSuccession.vue"; //
/** importStore*/
import { useOrganizational } from "@/modules/02_organization/store/organizational";
@ -291,10 +291,17 @@ function onClickDelete(id: string) {
showLoader();
await http
.delete(config.API.orgPosMasterById(id))
.then(() => {
success($q, "ลบข้อมูลสำเร็จ");
props.fetchDataTable?.(reqMaster.value.id, reqMaster.value.type, false);
getSummary();
.then(async () => {
await Promise.all([
props.fetchDataTable?.(
reqMaster.value.id,
reqMaster.value.type,
false
),
getSummary(),
]);
await success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
@ -357,14 +364,16 @@ function removePerson(id: string) {
showLoader();
await http
.post(config.API.orgDeleteProfile(id))
.then(() => {
success($q, "ลบข้อมูลสำเร็จ");
props.fetchDataTable?.(
reqMaster.value.id,
reqMaster.value.type,
false
);
getSummary();
.then(async () => {
await Promise.all([
props.fetchDataTable?.(
reqMaster.value.id,
reqMaster.value.type,
false
),
getSummary(),
]);
await success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
@ -571,7 +580,7 @@ watch(
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" >
<q-tr :props="props">
<q-td>
<q-btn
v-if="store.typeOrganizational === 'draft'"

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, reactive, watch, onMounted } from "vue";
import { ref, reactive, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
@ -11,7 +11,6 @@ import DialogHeader from "@/components/DialogHeader.vue";
import { useQuasar } from "quasar";
import type { QTableProps } from "quasar";
import { useRoute } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
@ -72,126 +71,14 @@ const workDateRef = ref<object | null>(null);
const reasonSameDateRef = ref<object | null>(null);
const visibleColumnsHistory = ref<String[]>([
// "oc",
// "position",
// "positionPathSide",
// "posNo",
// "positionLine",
// "positionType",
// "positionLevel",
// "positionExecutive",
// "positionExecutiveSide",
"dateAppoint",
"dateStart",
// "retireDate",
// "govAge",
// "govAgeAbsent",
// "govAgePlus",
"reasonSameDate",
"lastUpdateFullName",
"lastUpdatedAt",
]);
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",
@ -216,51 +103,6 @@ const columnsHistory = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
// {
// name: "retireDate",
// align: "left",
// label: "",
// sortable: true,
// field: "retireDate",
// format: (v) => date2Thai(v),
// 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",
@ -297,7 +139,9 @@ const columnsHistory = ref<QTableProps["columns"]>([
},
]);
/** เปิด dialog */
/**
* เป dialog *
*/
function openDialogEdit() {
modalEdit.value = true;
containDate.value = formMain.containDate ? formMain.containDate : null;
@ -307,12 +151,18 @@ function openDialogEdit() {
: null;
}
/**
* เป dialog ประวแกไขขอมลราชการ
*/
function openDialogHistory() {
modalHistory.value = true;
filterKeyword.value = "";
getDataHistory();
}
/** ปิด dialog */
/**
* dialog
*/
function closeDialog() {
modalEdit.value = false;
containDate.value = null;
@ -320,6 +170,9 @@ function closeDialog() {
reasonSameDate.value = null;
}
/**
* function นยนการบนทกขอมลราชการ
*/
function onSubmit() {
dialogConfirm($q, () => {
showLoader();
@ -336,9 +189,9 @@ function onSubmit() {
: reasonSameDate.value,
}
)
.then(() => {
getData();
success($q, "บันทึกข้อมูลสำเร็จ");
.then(async () => {
await getData();
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((e) => {
@ -350,7 +203,9 @@ function onSubmit() {
});
}
/** ดึงข้อมูลราชการ */
/**
* งขอมลราชการ
*/
function getData() {
showLoader();
http
@ -384,7 +239,9 @@ function getData() {
});
}
/** ดึงข้อมูลประวัติ */
/**
* งขอมลประว
*/
function getDataHistory() {
showLoader();
http
@ -852,7 +709,7 @@ onMounted(() => {
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-tr :props="props">
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div>
{{ col.value ? col.value : "-" }}

View file

@ -28,7 +28,6 @@ const {
messageError,
success,
pathRegistryEmp,
dialogRemove,
} = mixin;
const profileId = ref<string>(
@ -60,14 +59,10 @@ const formFilter = reactive<FormFilter>({
isShowRetire: false,
isProbation: false,
});
const currentPage = ref<number>(1);
const maxPage = ref<number>(1);
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
const visibleColumns = ref<String[]>([
"level",
"detail",
@ -199,6 +194,12 @@ const OpsFilter = ref<any>({
],
});
/**
* function นหา คำใน option
* @param val คำคนหา
* @param update function
* @param refData type select
*/
function filterSelector(val: string, update: Function, refData: string) {
switch (refData) {
case "levelOptions":
@ -213,7 +214,9 @@ function filterSelector(val: string, update: Function, refData: string) {
}
}
/** ปิด dialog */
/**
* dialog อมลว
*/
function closeDialog() {
modal.value = false;
edit.value = false;
@ -225,15 +228,21 @@ function closeDialog() {
disciplineData.refCommandDate = null;
}
/**
* เป dialog อมลว
*/
function openDialogAdd() {
modal.value = true;
}
async function fetchData(id: string) {
/**
* function fetch อมลรายการว
*/
function fetchData(id: string) {
showLoader();
await http
http
.get(config.API.profileNewDisciplineByProfileId(id, empType.value))
.then(async (res) => {
.then((res) => {
rows.value = res.data.result;
})
.catch((err) => {
@ -244,7 +253,11 @@ async function fetchData(id: string) {
});
}
async function addData() {
/**
* funciton เพมชอมลว
*/
function addData() {
showLoader();
const body = {
date: disciplineData.date,
level: disciplineData.level,
@ -256,11 +269,12 @@ async function addData() {
empType.value !== "" ? disciplineData.profileId : undefined,
refCommandDate: disciplineData.refCommandDate,
};
await http
http
.post(config.API.profileNewDiscipline(empType.value), body)
.then(() => {
fetchData(profileId.value);
success($q, "บันทึกข้อมูลสำเร็จ");
.then(async () => {
await fetchData(profileId.value);
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((err) => {
messageError($q, err);
@ -270,8 +284,12 @@ async function addData() {
});
}
async function editData(idData: string) {
await http
/**
* funciton นทกแกไขชอมลว
*/
function editData(idData: string) {
showLoader();
http
.patch(
config.API.profileNewDisciplineByDisciplineId(idData, empType.value),
{
@ -279,9 +297,10 @@ async function editData(idData: string) {
profileId: undefined,
}
)
.then(() => {
fetchData(profileId.value);
success($q, "บันทึกข้อมูลสำเร็จ");
.then(async () => {
await fetchData(profileId.value);
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((err) => {
messageError($q, err);
@ -291,22 +310,6 @@ async function editData(idData: string) {
});
}
// function deleteData(idData: string) {
// dialogRemove($q, () =>
// http
// .delete(config.API.profileNewDisciplineByDisciplineId(idData))
// .then(() => {
// fetchData(profileId.value);
// success($q, "");
// })
// .catch((err) => {
// messageError($q, err);
// })
// .finally(() => {
// hideLoader();
// })
// );
// }
/**
* กดเลอกขอมลทจะแกไข
* @param props props ใน row เลอก
@ -323,25 +326,31 @@ function openDialogEdit(props: RequestItemsObject) {
disciplineData.refCommandDate = props.refCommandDate;
}
/**
* function ประวการแไขรายการว
* @param idOrder
*/
function openDialogHistory(idOrder: string) {
modalHistory.value = true;
id.value = idOrder;
}
async function onSubmit() {
/**
* function นยนการบนทกขอม
*/
function onSubmit() {
dialogConfirm(
$q,
async () => {
() => {
edit.value ? editData(id.value) : addData();
closeDialog();
},
"ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
);
}
onMounted(async () => {
await fetchData(profileId.value);
onMounted(() => {
fetchData(profileId.value);
});
</script>
<template>

View file

@ -8,10 +8,7 @@ import { useRoute } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import type {
RequestItemsObject,
FormFilter,
} from "@/modules/04_registryPerson/interface/index/discipline";
import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/index/discipline";
const modal = defineModel<boolean>("modal", { required: true });
const id = defineModel<string>("id", { required: true });
@ -23,23 +20,9 @@ const { showLoader, hideLoader, messageError, date2Thai, pathRegistryEmp } =
mixin;
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const currentPage = ref<number>(1);
const maxPage = ref<number>(1);
const filterKeyword = ref<string>("");
const rows = ref<RequestItemsObject[]>([]); //select data history
const formFilter = reactive<FormFilter>({
page: 1,
pageSize: 12,
keyword: "",
type: "",
posType: "",
posLevel: "",
retireYear: "",
rangeYear: { min: 0, max: 60 },
isShowRetire: false,
isProbation: false,
});
const historyPagination = ref({
page: 1,
rowsPerPage: 10,
@ -150,6 +133,9 @@ const columns = ref<QTableProps["columns"]>([
},
]);
/**
* fetch อมลประวการแกไขขอมลว
*/
function getHistory() {
showLoader();
http
@ -262,14 +248,7 @@ watch(modal, (status) => {
<template v-slot:body="props">
<q-tr :props="props">
<q-td v-for="col in props.cols" :key="col.id">
<div v-if="col.name === 'no'">
{{
(formFilter.page - 1) * formFilter.pageSize +
props.rowIndex +
1
}}
</div>
<div v-else>
<div>
{{ col.value ? col.value : "-" }}
</div>
</q-td>

View file

@ -9,11 +9,9 @@ import { useCounterMixin } from "@/stores/mixin";
import DialogHeader from "@/components/DialogHeader.vue";
import type {
DetailData,
FormFilter,
DataOptionLeave,
DataOption,
ResponseTotalObject,
MyObjectRef,
} from "@/modules/04_registryPerson/interface/index/leave";
import DialogHistory from "@/modules/04_registryPerson/components/detail/GovernmentInformation/03_LeaveHistory.vue";
@ -48,21 +46,8 @@ const pagination = ref({
});
const mode = ref<string>("table");
const filterKeyword = ref<string>("");
const currentPage = ref<number>(1);
const maxPage = ref<number>(1);
const rows = ref<DetailData[]>([]);
const formFilter = reactive<FormFilter>({
page: 1,
pageSize: 12,
keyword: "",
type: "",
posType: "",
posLevel: "",
retireYear: "",
rangeYear: { min: 0, max: 60 },
isShowRetire: false,
isProbation: false,
});
const modal = ref<boolean>(false);
const edit = ref<boolean>(false);
@ -114,19 +99,6 @@ const clickEditRowType = () => {
}
};
const typeLeaveRef = ref<object | null>(null);
const dateRangeRef = ref<object | null>(null);
const numLeaveRef = ref<object | null>(null);
const statLeaveRef = ref<object | null>(null);
const reasonRef = ref<object | null>(null);
const objectRef: MyObjectRef = {
typeLeave: typeLeaveRef,
dateRange: dateRangeRef,
numLeave: numLeaveRef,
statLeave: statLeaveRef,
reason: reasonRef,
};
const visibleColumns = ref<String[]>([
"no",
"typeLeave",
@ -205,6 +177,9 @@ const columns = ref<QTableProps["columns"]>([
},
]);
/**
* function เป dialog อมลการลา
*/
function openDialogAdd() {
modal.value = true;
edit.value = false;
@ -255,6 +230,9 @@ function clickTotal() {
});
}
/**
* function เป dialog แกไขขอมลการลา
*/
function openDialogEdit(props: DetailData) {
edit.value = true;
modal.value = true;
@ -286,11 +264,12 @@ function openDialogEdit(props: DetailData) {
}
}
/** ปิด dialog */
/**
* dialog อมลการลา
*/
function closeDialog() {
modal.value = false;
edit.value = false;
id.value = "";
typeLeave.value = "";
statLeave.value = "";
@ -300,6 +279,12 @@ function closeDialog() {
numUsedLeave.value = 0;
}
/**
* function นหา คำใน option
* @param val คำคนหา
* @param update function
* @param filtername type select
*/
function filterSelector(val: any, update: Function, filtername: string) {
switch (filtername) {
case "typeLeaveOption":
@ -345,27 +330,17 @@ function openDialogHistory(idOrder: string) {
id.value = idOrder;
}
/** validate check*/
function validateForm() {
const hasError = [];
for (const key in objectRef) {
if (Object.prototype.hasOwnProperty.call(objectRef, key)) {
const property = objectRef[key];
if (property.value && typeof property.value.validate === "function") {
const isValid = property.value.validate();
hasError.push(isValid);
}
/**
* function นยนการบนทกขอม
*/
function onSubmit() {
dialogConfirm($q, async () => {
if (edit.value == false) {
saveData();
} else {
editData();
}
}
if (hasError.every((result) => result === true)) {
dialogConfirm($q, async () => {
if (edit.value == false) {
saveData();
} else {
editData();
}
});
}
});
}
/**
@ -373,7 +348,6 @@ function validateForm() {
*/
function saveData() {
showLoader();
http
.post(config.API.profileNewLeave(empType.value), {
leaveTypeId: typeLeave.value.id,
@ -387,15 +361,16 @@ function saveData() {
profileId: empType.value === "" ? profileId.value : undefined,
profileEmployeeId: empType.value !== "" ? profileId.value : undefined,
})
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
.then(async () => {
await getData();
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
getData();
hideLoader();
});
}
@ -415,18 +390,22 @@ const editData = async () => {
status: statLeave.value,
reason: reason.value,
})
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
.then(async () => {
await getData();
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
getData();
hideLoader();
});
};
/**
* function fetch อมลรายการว
*/
function getData() {
showLoader();
http
@ -594,9 +573,7 @@ onMounted(() => {
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div v-if="col.name === 'no'">
{{
(formFilter.page - 1) * formFilter.pageSize + props.rowIndex + 1
}}
{{ props.rowIndex + 1 }}
</div>
<div v-else-if="col.name == 'dateLeave'">
{{
@ -684,7 +661,7 @@ onMounted(() => {
<!-- dialog add edit -->
<q-dialog v-model="modal" persistent>
<q-card>
<form @submit.prevent="validateForm">
<q-form @submit.prevent greedy @validation-success="onSubmit()">
<DialogHeader
:tittle="edit ? 'แก้ไขข้อมูลการลา' : 'เพิ่มข้อมูลการลา'"
:close="closeDialog"
@ -814,7 +791,7 @@ onMounted(() => {
<q-tooltip>นทกขอม</q-tooltip>
</q-btn>
</q-card-actions>
</form>
</q-form>
</q-card>
</q-dialog>

View file

@ -146,6 +146,10 @@ const columns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
/**
* function fetch อมลประวการแกไขการลา
*/
function getHistory() {
showLoader();
http
@ -172,7 +176,7 @@ function getHistory() {
});
})
.catch((e) => {
// messageError($q, e);
messageError($q, e);
})
.finally(() => {
hideLoader();
@ -192,6 +196,10 @@ function dateThaiRange(val: [Date, Date]) {
}
}
/**
* function convertStatus
* @param val
*/
function statusLeave(val: string) {
switch (val) {
case "waitting":

View file

@ -42,11 +42,6 @@ const modalHistory = ref<boolean>(false);
const id = ref<string>("");
const dateStartRef = ref<object | null>(null);
const dateEndRef = ref<object | null>(null);
const detailRef = ref<object | null>(null);
const referenceRef = ref<object | null>(null);
const dutyData = reactive<RequestItemsObject>({
profileId: profileId.value,
dateStart: new Date(),
@ -78,9 +73,6 @@ const formFilter = reactive<FormFilter>({
isProbation: false,
});
const currentPage = ref<number>(1);
const maxPage = ref<number>(1);
const visibleColumns = ref<String[]>([
"dateStart",
"dateEnd",
@ -201,10 +193,12 @@ function closeDialog() {
dutyData.refCommandDate = null;
}
/** fetch ข้อมูล */
async function fetchData(id: string) {
/**
* fetch อมลรายการพเศษ
*/
function fetchData(id: string) {
showLoader();
await http
http
.get(config.API.profileNewDutyByProfileId(id, empType.value))
.then(async (res) => {
rows.value = res.data.result;
@ -217,9 +211,11 @@ async function fetchData(id: string) {
});
}
/** เพิ่มข้อมูล */
async function addData() {
/**
* functoin นทกการเพมขอม
*/
function addData() {
showLoader();
const body = {
profileId: empType.value === "" ? profileId.value : undefined,
profileEmployeeId: empType.value !== "" ? profileId.value : undefined,
@ -230,11 +226,12 @@ async function addData() {
refCommandNo: dutyData.refCommandNo,
refCommandDate: dutyData.refCommandDate,
};
await http
http
.post(config.API.profileNewDuty(empType.value), body)
.then(() => {
fetchData(profileId.value);
success($q, "บันทึกข้อมูลสำเร็จ");
.then(async () => {
await fetchData(profileId.value);
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((err) => {
messageError($q, err);
@ -244,17 +241,20 @@ async function addData() {
});
}
/** แก้ไขข้อมูล */
async function editData(idData: string) {
await http
/**
* functoin นทกการแกไขขอม
*/
function editData(idData: string) {
showLoader();
http
.patch(config.API.profileNewDutyByDutyId(idData, empType.value), {
...dutyData,
profileId: undefined,
})
.then(() => {
fetchData(profileId.value);
success($q, "บันทึกข้อมูลสำเร็จ");
.then(async () => {
await fetchData(profileId.value);
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((err) => {
messageError($q, err);
@ -264,41 +264,22 @@ async function editData(idData: string) {
});
}
/** ลบข้อมูล */
// function deleteData(idData: string) {
// dialogRemove($q, () =>
// http
// .delete(config.API.profileNewDutyByDutyId(idData))
// .then(() => {
// fetchData(profileId.value);
// success($q, "");
// })
// .catch((err) => {
// messageError($q, err);
// })
// .finally(() => {
// hideLoader();
// })
// );
// }
/** กด Submit */
async function onSubmit() {
/**
* นยนการบนทกขอม
*/
function onSubmit() {
dialogConfirm(
$q,
async () => {
() => {
edit.value ? editData(id.value) : addData();
closeDialog();
},
"ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
);
}
onMounted(async () => {
await fetchData(profileId.value);
onMounted(() => {
fetchData(profileId.value);
});
</script>
<template>
@ -547,6 +528,7 @@ onMounted(async () => {
autoApply
:enableTimePicker="false"
week-start="0"
:max-date="dutyData.dateEnd"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{

View file

@ -24,22 +24,8 @@ const { showLoader, hideLoader, messageError, date2Thai, pathRegistryEmp } =
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const currentPage = ref<number>(1);
const maxPage = ref<number>(1);
const filterKeyword = ref<string>("");
const rows = ref<ResponseObject[]>([]); //select data history
const formFilter = reactive<FormFilter>({
page: 1,
pageSize: 12,
keyword: "",
type: "",
posType: "",
posLevel: "",
retireYear: "",
rangeYear: { min: 0, max: 60 },
isShowRetire: false,
isProbation: false,
});
const historyPagination = ref({
page: 1,
@ -149,6 +135,10 @@ const columns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
/**
* function fetch อมลประวตการแกไขขอม
*/
function getHistory() {
showLoader();
http
@ -264,14 +254,7 @@ watch(modal, (status) => {
<template v-slot:body="props">
<q-tr :props="props">
<q-td v-for="col in props.cols" :key="col.id">
<div v-if="col.name === 'no'">
{{
(formFilter.page - 1) * formFilter.pageSize +
props.rowIndex +
1
}}
</div>
<div v-else class="table_ellipsis">
<div class="table_ellipsis">
{{ col.value ? col.value : "-" }}
</div>
</q-td>

View file

@ -345,10 +345,10 @@ function onSubmit() {
route.name === "registry-employeeId" ? "TEMP" : undefined,
})
.then(async () => {
await getData();
await props.fetchDataPersonal?.();
await getData();
modal.value = false;
success($q, "บันทึกข้อมูลสำเร็จ");
await success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);

View file

@ -331,7 +331,7 @@ async function uploadProfile(id: string) {
.catch((err) => {
messageError($q, err);
hideLoader();
})
});
}
async function uploadFileURL(uploadUrl: string, file: any) {
@ -576,16 +576,7 @@ watch(
>
<q-tooltip>เพมขอม</q-tooltip></q-btn
>
<!-- <q-btn
flat
dense
round
icon="mdi-history"
color="deep-purple"
@click="() => (fetchHistoryData(props.row.id), (historyDialog = true))"
>
<q-tooltip>ประวการเปลยนช-นามสก</q-tooltip>
</q-btn> -->
<q-space />
<q-input
dense
@ -632,15 +623,21 @@ watch(
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th auto-width />
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
<q-th auto-width />
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props">
<q-td v-for="(col, index) in props.cols" :key="col.name">
<div class="table_ellipsis">
{{ col.value }}
</div>
</q-td>
<q-td auto-width>
<q-btn
color="green"
@ -652,27 +649,6 @@ watch(
>
<q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>
<!-- <q-btn
v-if="checkPermission($route)?.attrIsUpdate"
flat
dense
round
color="edit"
icon="edit"
clickable
@click="
() => {
editForm(props.row);
}
"
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn> -->
</q-td>
<q-td v-for="(col, index) in props.cols" :key="col.name">
<div class="table_ellipsis">
{{ col.value }}
</div>
</q-td>
</q-tr>
</template>
@ -706,24 +682,6 @@ watch(
/>
</div>
</div>
<!-- <q-select
class="inputgreen"
outlined
v-model="changeNameData.status"
:options="statusOption"
label="สถานะการเปลี่ยนชื่อ"
use-input
hide-bottom-space
input-debounce="0"
:rules="[
(val) => !!val || `${'กรุณาเลือกสถานะการเปลี่ยนชื่อ'}`,
]"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'statusOptions'
) "
dense
/> -->
</div>
</div>
<div class="row q-gutter-sm q-mb-md">

View file

@ -40,8 +40,6 @@ const profileId = ref<string>(
);
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const currentPage = ref<number>(1);
const maxPage = ref<number>(1);
const modal = ref<boolean>(false);
const modalHistory = ref<boolean>(false);
const rowsHistory = ref<ResponseObject[]>([]);
@ -375,9 +373,9 @@ async function editData() {
...formData,
id: undefined,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
fetchAll();
.then(async (res) => {
await fetchAll();
await success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {

View file

@ -169,6 +169,9 @@ const fromData = reactive({
statusMarital: "",
});
/**
* function fetch อมลบดา
*/
function fetchDataFather() {
showLoader();
http
@ -194,6 +197,10 @@ function fetchDataFather() {
hideLoader();
});
}
/**
* function fetch อมลมารดา
*/
function fetchDataMother() {
showLoader();
http
@ -218,6 +225,10 @@ function fetchDataMother() {
hideLoader();
});
}
/**
* function fetch อมลคสมรส
*/
function fetchDataCouple() {
showLoader();
http
@ -244,6 +255,10 @@ function fetchDataCouple() {
hideLoader();
});
}
/**
* function fetch อมลบตร
*/
function fetchDataChildren() {
showLoader();
http
@ -263,6 +278,10 @@ function fetchDataChildren() {
});
}
/**
* function นทกขอม
* @param type ประเภทของขอม
*/
function onSubmit(type: string) {
dialogConfirm($q, async () => {
showLoader();
@ -288,14 +307,14 @@ function onSubmit(type: string) {
const method = isEdit.value && type === "children" ? "patch" : "post";
try {
await http[method](url, formBody);
success($q, "บันทึกข้อมูลสำเร็จ");
type === "father"
? fetchDataFather()
? await fetchDataFather()
: type === "mother"
? fetchDataMother()
? await fetchDataMother()
: type === "couple"
? fetchDataCouple()
: fetchDataChildren();
? await fetchDataCouple()
: await fetchDataChildren();
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
} catch (e) {
messageError($q, e);
@ -305,9 +324,13 @@ function onSubmit(type: string) {
});
}
/**
* function popup
*/
function closeDialog() {
modal.value = false;
modalHistory.value = false;
// formData
fromData.isLive = 1;
fromData.citizenId = "";
fromData.prefix = "";
@ -318,6 +341,12 @@ function closeDialog() {
fromData.statusMarital = "";
}
/**
* function แกไขขอม
* @param type ประเภทของบคคล
* @param isStatusEdit สถานะแกไข
* @param data อมลเด
*/
function onOpenDialogForm(
type: string,
isStatusEdit: boolean = false,
@ -326,11 +355,9 @@ function onOpenDialogForm(
modal.value = true;
typeForm.value = type;
isEdit.value = isStatusEdit;
console.log(data);
if (type === "father") {
titleForm.value = "บิดา";
console.log(fatherData);
fromData.isLive =
fatherData.isLive === null ? 1 : fatherData.isLive ? 1 : 0;
@ -351,9 +378,11 @@ function onOpenDialogForm(
fromData.job = motherData.job;
} else if (type === "couple") {
titleForm.value = "คู่สมรส";
fromData.isLive = 1;
} else if (type === "children") {
titleForm.value = "บุตร";
if (isStatusEdit) {
childernId.value = data.id;
fromData.isLive =
@ -367,6 +396,11 @@ function onOpenDialogForm(
}
}
/**
* function ประวการแกไขขอม
* @param type ประเภทของบคคล
* @param id
*/
function onOpenDialogHistory(type: string, id: string = "") {
modalHistory.value = true;
typeForm.value = type;
@ -374,6 +408,9 @@ function onOpenDialogHistory(type: string, id: string = "") {
fetchHistory(historyId, type);
}
/**
* function fetch อมลความสมพนธ
*/
function fetchDataRelationship() {
showLoader();
http
@ -393,14 +430,24 @@ function fetchDataRelationship() {
});
}
const filterSelectorRelation = (val: any, update: Function) => {
/**
* function นหาขอมลใน select
* @param val คำคนหา
* @param update function
*/
function filterSelectorRelation(val: any, update: Function) {
update(() => {
optionRelationship.value = optionRelationshipMain.value.filter(
(v: any) => v.name.indexOf(val) > -1
);
});
};
}
/**
* function fetch อมลประวการแกไขขอม
* @param id
* @param type
*/
function fetchHistory(id: string, type: string) {
hideLoader();
http
@ -426,11 +473,13 @@ function fetchHistory(id: string, type: string) {
}
onMounted(() => {
fetchDataFather();
fetchDataMother();
fetchDataCouple();
fetchDataChildren();
fetchDataRelationship();
Promise.all([
fetchDataFather(),
fetchDataMother(),
fetchDataCouple(),
fetchDataChildren(),
fetchDataRelationship(),
]);
});
</script>

View file

@ -495,18 +495,26 @@ const historyVisibleColumns = ref<string[]>([
"lastUpdatedAt",
]);
async function onSubmit() {
/**
* function นยนการบนทกขอม
*/
function onSubmit() {
dialogConfirm(
$q,
async () => {
() => {
dialogStatus.value === "create" ? addData() : editData(editId.value);
closeDialog();
},
"ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
);
}
/**
* function นหา คำใน option
* @param val คำคนหา
* @param update function
* @param refData type select
*/
function filterSelector(val: string, update: Function, refData: string) {
switch (refData) {
case "educationOption":
@ -528,6 +536,9 @@ function filterSelector(val: string, update: Function, refData: string) {
}
}
/**
* function เคลยร formData
*/
function clearForm() {
isDate.value = "false";
educationData.educationLevel = "";
@ -549,6 +560,10 @@ function clearForm() {
educationData.note = "";
}
/**
* function แกไขขอมลประวการศกษา
* @param row อมลประวการศกษา
*/
function editForm(row: any) {
dialogStatus.value = "edit";
editId.value = row.id;
@ -579,19 +594,30 @@ function editForm(row: any) {
dialog.value = true;
}
/**
* function popup ลประวการศกษา
*/
function closeDialog() {
clearForm();
dialog.value = false;
}
/**
* funcitob popup ประวการศกษา
*/
function closeHistoryDialog() {
historyDialog.value = false;
}
async function fetchData(id: string) {
/**
* function fetch อมลประวการศกษา
* @param id คคล
*/
function fetchData(id: string) {
showLoader();
await http
http
.get(config.API.profileNewEducationByProfileId(id, empType.value))
.then(async (res) => {
.then((res) => {
rows.value = res.data.result;
})
.catch((err) => {
@ -602,9 +628,11 @@ async function fetchData(id: string) {
});
}
async function fetchEducationLevel() {
showLoader();
await http
/**
* function fetch อมลระดบการศกษา
*/
function fetchEducationLevel() {
http
.get(config.API.orgEducationLevel)
.then(async (res) => {
res.data.result.map((r: any) => {
@ -617,15 +645,16 @@ async function fetchEducationLevel() {
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
async function fetchHistoryData(id: string) {
/**
* function fetch ประวการแกไขประวการศกษา
* @param id ประวการศกษา
*/
function fetchHistoryData(id: string) {
showLoader();
await http
http
.get(config.API.profileNewEducationHisByEducationId(id, empType.value))
.then(async (res) => {
historyRows.value = res.data.result;
@ -638,8 +667,12 @@ async function fetchHistoryData(id: string) {
});
}
async function addData() {
await http
/**
* function เพมขอมลประวการศกษา
*/
function addData() {
showLoader();
http
.post(config.API.profileNewEducation(empType.value), {
...educationData,
startYear: undefined,
@ -648,9 +681,10 @@ async function addData() {
profileId: empType.value === "" ? id.value : undefined,
profileEmployeeId: empType.value !== "" ? id.value : undefined,
})
.then(() => {
fetchData(id.value);
success($q, "บันทึกข้อมูลสำเร็จ");
.then(async () => {
await fetchData(id.value);
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((err) => {
messageError($q, err);
@ -660,9 +694,12 @@ async function addData() {
});
}
/**
* function นทกการแกไขขอม
* @param idData ประวการศกษา
*/
function editData(idData: string) {
console.log(educationData);
showLoader();
http
.patch(config.API.profileNewEducationByEducationId(idData, empType.value), {
...educationData,
@ -673,9 +710,10 @@ function editData(idData: string) {
durationYear:
educationData.durationYear === "" ? null : educationData.durationYear,
})
.then(() => {
fetchData(id.value);
success($q, "บันทึกข้อมูลสำเร็จ");
.then(async () => {
await fetchData(id.value);
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((err) => {
messageError($q, err);
@ -685,23 +723,6 @@ function editData(idData: string) {
});
}
// function deleteData(idData: string) {
// dialogRemove($q, () =>
// http
// .delete(config.API.profileNewEducationByEducationId(idData))
// .then(() => {
// fetchData(id.value);
// success($q, "");
// })
// .catch((err) => {
// messageError($q, err);
// })
// .finally(() => {
// hideLoader();
// })
// );
// }
onMounted(async () => {
await fetchData(id.value);
fetchEducationLevel();

View file

@ -15,7 +15,6 @@ const mixin = useCounterMixin();
const $q = useQuasar();
const mode = ref<string>("table");
const {
dialogRemove,
dialogConfirm,
showLoader,
hideLoader,
@ -189,6 +188,7 @@ const historyVisibleColumns = ref<string[]>([
"lastUpdateFullName",
"lastUpdatedAt",
]);
function closeDialog() {
dialog.value = false;
}
@ -197,18 +197,23 @@ function closeHistoryDialog() {
historyDialog.value = false;
}
async function onSubmit() {
/**
* function นยนการบนทกขอม
*/
function onSubmit() {
dialogConfirm(
$q,
async () => {
() => {
dialogStatus.value === "create" ? addData() : editData(editId.value);
closeDialog();
},
"ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
);
}
/**
* function เคลยร formData
*/
function clearForm() {
specialSkill.detail = "";
specialSkill.field = "";
@ -216,6 +221,10 @@ function clearForm() {
specialSkill.remark = "";
}
/**
* function
* @param row อมลความสามารถพเศษ
*/
function editForm(row: any) {
dialogStatus.value = "edit";
editId.value = row.id;
@ -226,11 +235,14 @@ function editForm(row: any) {
dialog.value = true;
}
async function fetchData(id: string) {
/**
* function fetch อมลความสามรรถพเศษ
*/
function fetchData(id: string) {
showLoader();
await http
http
.get(config.API.profileNewAbilityByProfileId(id, empType.value))
.then(async (res) => {
.then((res) => {
rows.value = res.data.result;
})
.catch((err) => {
@ -241,11 +253,15 @@ async function fetchData(id: string) {
});
}
async function fetchHistoryData(id: string) {
/**
* function fetch ประวการแกไขความสามรรถพเศษ
* @param id ความสามรรถพเศษ
*/
function fetchHistoryData(id: string) {
showLoader();
await http
http
.get(config.API.profileNewAbilityHisByAbilityId(id, empType.value))
.then(async (res) => {
.then((res) => {
historyRows.value = res.data.result;
})
.catch((err) => {
@ -256,8 +272,12 @@ async function fetchHistoryData(id: string) {
});
}
async function addData() {
await http
/**
* function เพมขอมลความสามรรถพเศษ
*/
function addData() {
showLoader();
http
.post(config.API.profileNewAbility(empType.value), {
...specialSkill,
dateStart: null,
@ -265,9 +285,10 @@ async function addData() {
profileId: empType.value === "" ? id.value : undefined,
profileEmployeeId: empType.value !== "" ? id.value : undefined,
})
.then(() => {
fetchData(id.value);
success($q, "บันทึกข้อมูลสำเร็จ");
.then(async () => {
await fetchData(id.value);
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((err) => {
messageError($q, err);
@ -277,17 +298,23 @@ async function addData() {
});
}
async function editData(idData: string) {
await http
/**
* function นทกการแกไขขอม
* @param idData ความสามรรถพเศษ
*/
function editData(idData: string) {
showLoader();
http
.patch(config.API.profileNewAbilityByAbilityId(idData, empType.value), {
...specialSkill,
dateStart: null,
dateEnd: null,
profileId: undefined,
})
.then(() => {
fetchData(id.value);
success($q, "บันทึกข้อมูลสำเร็จ");
.then(async () => {
await fetchData(id.value);
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((err) => {
messageError($q, err);
@ -297,25 +324,8 @@ async function editData(idData: string) {
});
}
async function deleteData(idData: string) {
dialogRemove($q, () =>
http
.delete(config.API.profileNewAbilityByAbilityId(idData, empType.value))
.then(() => {
fetchData(id.value);
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
})
);
}
onMounted(async () => {
await fetchData(id.value);
onMounted(() => {
fetchData(id.value);
});
</script>
<template>

View file

@ -44,6 +44,9 @@ const statusOptionMain = ref<DataOption[]>(
);
const statusOption = ref<DataOption[]>(statusOptionMain.value);
/**
* function นทกรายการคำรอง
*/
function onSubmit() {
dialogConfirm($q, () => {
showLoader();
@ -64,6 +67,9 @@ function onSubmit() {
});
}
/**
* function popup
*/
function closeDialog() {
modal.value = false;
formData.status = "";
@ -77,6 +83,11 @@ function classInput(val: boolean) {
};
}
/**
* function นหาคำใน select สถานะคำรอง
* @param val คำค
* @param update Function
*/
function filterOption(val: string, update: Function) {
update(() => {
statusOption.value = statusOptionMain.value.filter(
@ -85,6 +96,9 @@ function filterOption(val: string, update: Function) {
});
}
/**
* function fetch อมลคำรองแกไข
*/
function fetchDataRequest() {
showLoader();
http

View file

@ -10,7 +10,11 @@ interface DataOption2 {
id: number;
name: string;
}
interface DataOptionSys {
id: string;
name: string;
system: string;
}
interface DataOptionInsignia {
id: string;
name: string;
@ -55,4 +59,5 @@ export type {
InformationOps,
AddressOps,
InsigniaOps,
DataOptionSys,
};

View file

@ -1,6 +1,10 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
import {
checkPermission,
checkPermissionCreate,
checkPermissionList,
} from "@/utils/permissions";
import { useRoute, useRouter } from "vue-router";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
@ -9,7 +13,10 @@ import axios from "axios";
/**
* importType
*/
import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main";
import type {
DataOption,
DataOptionSys,
} from "@/modules/04_registryPerson/interface/index/Main";
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/Profile";
/**
@ -57,41 +64,49 @@ const profileId = ref<string>(route.params.id.toString());
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const formDetail = ref<ResponseObject>();
const itemsMenu = ref<DataOption[]>([
const itemsMenu = ref<DataOptionSys[]>([
{
id: "1",
name: "ช่วยราชการ",
system: "SYS_TEMPDUTY",
},
{
id: "2",
name: "ส่งตัวกลับ",
system: "SYS_TEMPDUTY2",
},
{
id: "3",
name: "แต่งตั้ง-เลื่อน-ย้าย",
system: "SYS_PROMOTION_OFFICER",
},
{
id: "4",
name: "ถึงแก่กรรม",
system: "SYS_PASSAWAY",
},
{
id: "5",
name: "ให้ออกจากราชการ",
system: "SYS_DISMISS",
},
{
id: "6",
name: "อื่นๆ",
system: "SYS_PLACEMENT_OTHER",
},
]);
const itemsMenuEmployee = ref<DataOption[]>([
const itemsMenuEmployee = ref<DataOptionSys[]>([
{
id: "1",
name: "ปรับระดับชั้นงาน - ย้าย",
system: "SYS_PROMOTION_EMP",
},
{
id: "2",
name: "ถึงแก่กรรม",
system: "SYS_PASSAWAY",
},
]);
@ -573,9 +588,9 @@ function selectAvatarHistory() {
http
.get(config.API.orgProfileAvatar + `/select/${profileId.value}/${data.id}`)
.then(async () => {
closeImage();
await fetchDataPersonal();
await fetchProfile(profileId.value);
closeImage();
})
.catch((e) => {
messageError($q, e);
@ -634,7 +649,20 @@ onMounted(async () => {
}}
</div>
<q-space />
<!-- list menu ของขาราชการฯ -->
<q-btn-dropdown
v-if="
empType === '' &&
checkPermissionList([
'SYS_TEMPDUTY',
'SYS_TEMPDUTY2',
'SYS_PROMOTION_OFFICER',
'SYS_PASSAWAY',
'SYS_DISMISS',
'SYS_PLACEMENT_OTHER',
])
"
size="md"
rounded
unelevated
@ -643,12 +671,9 @@ onMounted(async () => {
icon="mdi-home-export-outline"
dropdown-icon="mdi-chevron-down"
>
<q-list
v-if="empType === ''"
v-for="(item, index) in itemsMenu"
:key="index"
>
<q-list v-for="(item, index) in itemsMenu" :key="index">
<q-item
v-if="checkPermissionCreate(item.system)"
clickable
@click="
item.name == 'ช่วยราชการ'
@ -670,8 +695,25 @@ onMounted(async () => {
<q-item-section>{{ item.name }}</q-item-section>
</q-item>
</q-list>
<q-list v-else v-for="(item, index) in itemsMenuEmployee" :key="item.id">
</q-btn-dropdown>
<!-- list menu ของลกจางประจำ -->
<q-btn-dropdown
v-if="
empType === '-employee' &&
checkPermissionList(['SYS_PROMOTION_EMP', 'SYS_PASSAWAY'])
"
size="md"
rounded
unelevated
color="grey-4"
text-color="red"
icon="mdi-home-export-outline"
dropdown-icon="mdi-chevron-down"
>
<q-list v-for="item in itemsMenuEmployee" :key="item.id">
<q-item
v-if="checkPermissionCreate(item.system)"
clickable
@click="
item.name == 'ปรับระดับชั้นงาน - ย้าย'
@ -942,19 +984,6 @@ onMounted(async () => {
:src="n.downloadUrl"
:class="imageClass(n)"
>
<!-- <div
class="absolute-top bg-transparent cursor-pointer text-right"
style="padding: 5px"
>
<q-btn
icon="delete"
unelevated
round
dense
@click="deletePhoto"
style="color: #ff8080"
/>
</div> -->
<div
class="absolute-bottom col-12 cursor-pointer flex justify-between items-center"
style="padding: 5px"

View file

@ -132,6 +132,9 @@ const statusOption = ref<DataOption[]>(store.optionStatus);
const modalStatus = ref<boolean>(false);
const requestId = ref<string>("");
/**
* function fetch รายการคำรองขอแกไขทะเบยนประว
*/
function fetchListRequset() {
showLoader();
http
@ -157,16 +160,28 @@ function fetchListRequset() {
});
}
/**
* function เลอกสถานะคำรอง
*/
function updateStatusValue() {
page.value = 1;
// fetch
fetchListRequset();
}
/**
* function เคลยร สถานะคำรอง
*/
function clearStatus() {
status.value = "";
statusOption.value = store.optionStatus;
}
/**
* function นหาคำใน select สถานะคำรอง
* @param val คำค
* @param update Function
*/
function filterOption(val: string, update: Function) {
update(() => {
status.value = val ? "" : status.value;
@ -176,11 +191,19 @@ function filterOption(val: string, update: Function) {
});
}
/**
* funciton แกไขคำรอง
* @param id รายการคำรอง
*/
function onclickEdit(id: string) {
modalStatus.value = true;
requestId.value = id;
}
/**
* function เลอกแถวตอหน
* @param newPagination
*/
function updatePageSizePagination(newPagination: Pagination) {
page.value = 1;
pageSize.value = newPagination.rowsPerPage;
@ -200,9 +223,9 @@ function onDownloadFile(id: string) {
id
)
)
.then((res) => {
.then(async (res) => {
if (res.data.length !== 0) {
downloadUrl(id, res.data[0].fileName);
await downloadUrl(id, res.data[0].fileName);
} else {
hideLoader();
}

View file

@ -223,9 +223,13 @@ function onSubmit() {
? config.API.orgPosMasterEmp
: config.API.orgPosMasterByIdEmp(props.rowId);
await http[props.actionType === "ADD" ? "post" : "put"](url, body);
success($q, "บันทีกข้อมูลสำเร็จ");
props.getSummary?.();
props.fetchDataTable?.(reqMaster.value.id, reqMaster.value.type, false);
await props.getSummary?.();
await props.fetchDataTable?.(
reqMaster.value.id,
reqMaster.value.type,
false
);
await success($q, "บันทีกข้อมูลสำเร็จ");
close();
} catch (err) {
messageError($q, err);
@ -296,9 +300,9 @@ function deletePos(id: string) {
showLoader();
http
.delete(config.API.orgEmployeePosById(id))
.then(() => {
success($q, "ลบข้อมูลสำเร็จ");
searchInput();
.then(async () => {
await searchInput();
await success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
@ -629,11 +633,14 @@ watch(
<q-btn
flat
dense
icon="mdi-dots-vertical"
class="q-pa-none q-ml-xs"
color="grey-13"
color="secondary"
icon="mdi-dots-horizontal-circle-outline"
round
>
<q-menu anchor="bottom middle" self="top middle">
<q-menu
transition-show="jump-down"
transition-hide="jump-up"
>
<q-list
dense
v-for="(item, index) in listMenu"
@ -650,11 +657,14 @@ watch(
: deletePos(props.row.id)
"
>
<q-item-section avatar>
<q-item-section
avatar
style="min-width: 0px"
>
<q-icon
:color="item.color"
:name="item.icon"
size="sm"
size="xs"
/>
</q-item-section>
<q-item-section>{{

View file

@ -123,10 +123,10 @@ function onClickMovePos() {
showLoader();
await http
.post(config.API.orgPosMoveEmp, body)
.then(() => {
props.fetchDataTree?.(store.activeId);
.then(async () => {
await props.fetchDataTree?.(store.activeId);
await success($q, "ย้ายตำแหน่งสำเร็จ");
modal.value = false;
success($q, "ย้ายตำแหน่งสำเร็จ");
})
.catch((err) => {
messageError($q, err);

View file

@ -4,7 +4,7 @@ import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
/**
/**
* importType
*/
import type { QTableProps } from "quasar";
@ -279,10 +279,10 @@ function onSubmit() {
showLoader();
http
.post(config.API.orgProfileEmp, body)
.then(() => {
props.fetchDataTable?.(store.treeId, store.level, false);
props.getSummary();
success($q, "บันทึกข้อมูลสำเร็จ");
.then(async () => {
await props.fetchDataTable?.(store.treeId, store.level, false);
await props.getSummary();
await success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);

View file

@ -193,10 +193,14 @@ function onClickDelete(id: string) {
showLoader();
await http
.delete(config.API.orgPosMasterByIdEmp(id))
.then(() => {
.then(async () => {
await props.fetchDataTable?.(
reqMaster.value.id,
reqMaster.value.type,
false
);
await getSummary();
success($q, "ลบข้อมูลสำเร็จ");
props.fetchDataTable?.(reqMaster.value.id, reqMaster.value.type, false);
getSummary();
})
.catch((err) => {
messageError($q, err);
@ -262,14 +266,14 @@ function removePerson(id: string) {
showLoader();
await http
.post(config.API.orgDeleteProfileEmp(id))
.then(() => {
success($q, "ลบข้อมูลสำเร็จ");
props.fetchDataTable?.(
.then(async () => {
await props.fetchDataTable?.(
reqMaster.value.id,
reqMaster.value.type,
false
);
getSummary();
await getSummary();
await success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);

View file

@ -67,8 +67,13 @@ function fetchOrganization(id: string) {
});
}
/**
* function เลอกตำแหนงทจะใหกษาการ
* @param data อมลตำแหน
*/
async function updateSelected(data: PosMaster) {
posmasterId.value = data.posmasterId;
// function fetch ,fetch
await Promise.all([fetchPosMaster(), fetchListAct()]);
}
@ -165,6 +170,10 @@ function fetchPosMaster() {
});
}
/**
* function แสดงตำแหนงทงหมด
* @param val แสดงตำแหนงทงหมด
*/
function updateIsAll(val: boolean) {
isAll.value = val;
fetchPosMaster();
@ -241,6 +250,7 @@ function onDelete(id: string) {
http
.delete(config.API.orgPosAct + `/${id}`)
.then(async () => {
// function fetch ,fetch
await Promise.all([fetchPosMaster(), fetchListAct()]);
})
.catch((err) => {