อัพเดตทะเบียนประวัติ

This commit is contained in:
Warunee Tamkoo 2024-02-05 11:32:54 +07:00
parent 71461d6e79
commit ee80528296
2 changed files with 236 additions and 143 deletions

View file

@ -1502,7 +1502,7 @@ const clickSaveDeceased = async () => {
watch( watch(
() => profileStore.isLoad, () => profileStore.isLoad,
() => { () => {
const num = profileType.value === 'officer' ? 33:employeeClass.value === 'temp' ? 30:32 const num = profileType.value === 'officer' ? 32:employeeClass.value === 'temp' ? 29:31
profileStore.isLoad >= num && hideLoader(); profileStore.isLoad >= num && hideLoader();
} }
); );

View file

@ -83,7 +83,7 @@
<q-separator /> <q-separator />
<q-card-section class="q-pa-sm bg-grey-1"> <q-card-section class="q-pa-sm bg-grey-1">
<div class="row col-12 q-col-gutter-sm"> <div class="row col-12 q-col-gutter-sm">
<div class="col-xs-12 col-sm-5 row"> <!-- <div class="col-xs-12 col-sm-5 row">
<q-card flat bordered class="fit q-pa-sm"> <q-card flat bordered class="fit q-pa-sm">
<q-scroll-area visible style="height: 70vh"> <q-scroll-area visible style="height: 70vh">
<q-input <q-input
@ -136,12 +136,45 @@
</q-tree> </q-tree>
</q-scroll-area> </q-scroll-area>
</q-card> </q-card>
</div> </div> -->
<div class="col-xs-12 col-sm-7"> <div class="col-xs-12 col-sm-12">
<q-card flat bordered class="fit q-pa-sm"> <q-card flat bordered class="fit q-pa-sm">
<q-scroll-area visible style="height: 70vh"> <q-scroll-area visible style="height: 70vh">
<div class="row col-12 q-col-gutter-xs"> <div class="row col-12 q-col-gutter-xs">
<div class="col-xs-12 col-sm-12 col-md-12"></div> <div class="col-xs-12 col-sm-12 col-md-12"></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="orgName"
hide-bottom-space
:label="`${'หน่วยงาน'}`"
:rules="[(val: string) => !!val || `${'กรุณากรอกหน่วยงาน'}`]"
@update:modelValue="clickEditRow"
>
</q-input>
</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="agencyName"
hide-bottom-space
:label="`${'ส่วนราชการ'}`"
:rules="[(val: string) => !!val || `${'กรุณากรอกส่วนราชการ'}`]"
@update:modelValue="clickEditRow"
>
</q-input>
</div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<datepicker <datepicker
menu-class-name="modalfix" menu-class-name="modalfix"
@ -238,7 +271,7 @@
lazy-rules lazy-rules
:readonly="!edit" :readonly="!edit"
:borderless="!edit" :borderless="!edit"
v-model="positionId" v-model="positionName"
:rules="[(val: string) => !!val || `${'กรุณาเลือกตำแหน่ง'}`]" :rules="[(val: string) => !!val || `${'กรุณาเลือกตำแหน่ง'}`]"
:label="`${'ตำแหน่ง'}`" :label="`${'ตำแหน่ง'}`"
@update:modelValue="clickEditRow" @update:modelValue="clickEditRow"
@ -264,23 +297,24 @@
lazy-rules lazy-rules
:readonly="!edit" :readonly="!edit"
:borderless="!edit" :borderless="!edit"
v-model="positionPathSideId" v-model="positionLineName"
:label="`${'ด้าน/สาขา'}`" :rules="[(val: string) => !!val || `${'กรุณาเลือกสายงาน'}`]"
:label="`${'สายงาน'}`"
@update:modelValue="clickEditRow" @update:modelValue="clickEditRow"
emit-value emit-value
map-options map-options
option-label="name" option-label="name"
:options="positionSideOptions" :options="positionLineOptions"
option-value="id" option-value="id"
hide-bottom-space hide-bottom-space
use-input use-input
input-debounce="0" input-debounce="0"
@filter="(inputValue: any, @filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, '3' doneFn: Function) => filterSelector(inputValue, doneFn, '5'
)" )"
/> />
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-4 col-sm-4 col-md-4">
<selector <selector
:class="getClass(edit)" :class="getClass(edit)"
:outlined="edit" :outlined="edit"
@ -307,32 +341,7 @@
)" )"
/> />
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-4 col-sm-4 col-md-4">
<selector
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="positionLineId"
:rules="[(val: string) => !!val || `${'กรุณาเลือกสายงาน'}`]"
:label="`${'สายงาน'}`"
@update:modelValue="clickEditRow"
emit-value
map-options
option-label="name"
:options="positionLineOptions"
option-value="id"
hide-bottom-space
use-input
input-debounce="0"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, '5'
)"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<selector <selector
:class="getClass(edit)" :class="getClass(edit)"
:outlined="edit" :outlined="edit"
@ -357,15 +366,85 @@
)" )"
/> />
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-4 col-sm-4 col-md-4">
<selector <q-input
:class="getClass(edit)" :class="getClass(edit)"
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
:readonly="!edit" :readonly="!edit"
:borderless="!edit" :borderless="!edit"
v-model="positionExecutiveId" v-model="cLevel"
hide-bottom-space
:label="`${'ระดับซี'}`"
@update:modelValue="clickEditRow"
>
</q-input>
</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="positionPathSideName"
hide-bottom-space
:label="`${'ด้าน/สาขา'}`"
:rules="[(val: string) => !!val || `${'กรุณากรอกด้าน/สาขา'}`]"
@update:modelValue="clickEditRow"
>
</q-input>
<!-- <selector
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="positionPathSideId"
:label="`${'ด้าน/สาขา'}`"
@update:modelValue="clickEditRow"
emit-value
map-options
option-label="name"
:options="positionSideOptions"
option-value="id"
hide-bottom-space
use-input
input-debounce="0"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, '3'
)"
/> -->
</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="positionExecutiveName"
hide-bottom-space
:label="`${'ตำแหน่งทางการบริหาร'}`"
:rules="[(val: string) => !!val || `${'กรุณากรอกตำแหน่งทางการบริหาร'}`]"
@update:modelValue="clickEditRow"
>
</q-input>
<!-- <selector
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="positionExecutiveName"
:label="`${'ตำแหน่งทางการบริหาร'}`" :label="`${'ตำแหน่งทางการบริหาร'}`"
@update:modelValue="clickEditRow" @update:modelValue="clickEditRow"
emit-value emit-value
@ -379,7 +458,7 @@
@filter="(inputValue: any, @filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, '7' doneFn: Function) => filterSelector(inputValue, doneFn, '7'
)" )"
/> /> -->
</div> </div>
<div class="col-xs-4 col-sm-4 col-md-4"> <div class="col-xs-4 col-sm-4 col-md-4">
<!-- <q-input <!-- <q-input
@ -665,12 +744,18 @@ const amount = ref<number | undefined>(0);
const positionSalaryAmount = ref<number | undefined>(0); const positionSalaryAmount = ref<number | undefined>(0);
const mouthSalaryAmount = ref<number | undefined>(0); const mouthSalaryAmount = ref<number | undefined>(0);
const ocId = ref<string>(); const ocId = ref<string>();
const positionId = ref<string>();
const positionLineId = ref<string>(); //
const positionPathSideId = ref<string>(); const orgName = ref<string>();
const agencyName = ref<string>();
const cLevel = ref<string>();
const positionName = ref<string>();
const positionLineName = ref<string>();
const positionPathSideName = ref<string>();
const positionTypeId = ref<string>(); const positionTypeId = ref<string>();
const positionLevelId = ref<string>(); const positionLevelId = ref<string>();
const positionExecutiveId = ref<string>(); const positionExecutiveName = ref<string>();
const positionExecutiveSideId = ref<string>(); const positionExecutiveSideId = ref<string>();
const posNoId = ref<string>(); const posNoId = ref<string>();
const posNo = ref<string>(); const posNo = ref<string>();
@ -1414,7 +1499,7 @@ watch(visibleColumns, async (count: String[], prevCount: String[]) => {
onMounted(async () => { onMounted(async () => {
await fetchPosition(); await fetchPosition();
await nodeTree(); // await nodeTree();
await fetchData(); await fetchData();
}); });
@ -1483,24 +1568,24 @@ const filterSelector = (val: any, update: Function, filtername: string) => {
} }
}; };
const nodeTree = async () => { // const nodeTree = async () => {
showLoader(); // showLoader();
await http // await http
.get(config.API.profileOrganizRoot) // .get(config.API.profileOrganizRoot)
.then((res: any) => { // .then((res: any) => {
const data = res.data.result; // const data = res.data.result;
nodesTree.value = data; // nodesTree.value = data;
if (data.length > 0) { // if (data.length > 0) {
expanded.value = [data[0].id]; // expanded.value = [data[0].id];
} // }
}) // })
.catch((e) => { // .catch((e) => {
messageError($q, e); // messageError($q, e);
}) // })
.finally(() => { // .finally(() => {
store.isLoad++; // store.isLoad++;
}); // });
}; // };
/** /**
* get รายการ ตำแหน * get รายการ ตำแหน
@ -1719,14 +1804,14 @@ const getData = async () => {
mouthSalaryAmount.value = row.mouthSalaryAmount; mouthSalaryAmount.value = row.mouthSalaryAmount;
await onSelected(row.ocId); await onSelected(row.ocId);
selected.value = row.ocId; selected.value = row.ocId;
positionId.value = row.positionId; positionName.value = row.positionId;
posNoId.value = row.posNoId; posNoId.value = row.posNoId;
posNo.value = row.posNo; posNo.value = row.posNo;
positionLineId.value = row.positionLineId; positionLineName.value = row.positionLineId;
positionPathSideId.value = row.positionPathSideId; positionPathSideName.value = row.positionPathSideId;
positionTypeId.value = row.positionTypeId; positionTypeId.value = row.positionTypeId;
positionLevelId.value = row.positionLevelId; positionLevelId.value = row.positionLevelId;
positionExecutiveId.value = row.positionExecutiveId; positionExecutiveName.value = row.positionExecutiveId;
positionExecutiveSideId.value = row.positionExecutiveSideId; positionExecutiveSideId.value = row.positionExecutiveSideId;
salaryClass.value = row.salaryClass; salaryClass.value = row.salaryClass;
salaryRef.value = row.salaryRef; salaryRef.value = row.salaryRef;
@ -1770,65 +1855,65 @@ const clickAdd = async () => {
/** /**
* gen ตำแหน (รายละเอยด) * gen ตำแหน (รายละเอยด)
*/ */
const templateDetail = async () => { // const templateDetail = async () => {
await fetchOrganization(selected.value); // await fetchOrganization(selected.value);
salaryClass.value = ""; // salaryClass.value = "";
if (ocId.value != "") { // if (ocId.value != "") {
salaryClass.value = salaryClass.value + `สังกัด${ocId.value} `; // salaryClass.value = salaryClass.value + `${ocId.value} `;
} // }
const positionF = positionOptions.value.filter( // const positionF = positionOptions.value.filter(
(r: DataOption) => r.id == positionId.value // (r: DataOption) => r.id == positionId.value
); // );
if (positionF.length > 0) { // if (positionF.length > 0) {
salaryClass.value = salaryClass.value + `ตำแหน่ง${positionF[0].name} `; // salaryClass.value = salaryClass.value + `${positionF[0].name} `;
} // }
// const posNoF = posNoOptions.value.filter( // // const posNoF = posNoOptions.value.filter(
// (r: DataOption) => r.id == posNoId.value // // (r: DataOption) => r.id == posNoId.value
// ); // // );
// if (posNoF.length > 0) { // // if (posNoF.length > 0) {
// salaryClass.value = salaryClass.value + `${posNoF[0].name} `; // // salaryClass.value = salaryClass.value + `${posNoF[0].name} `;
// } // // }
const positionLineF = positionLineOptions.value.filter( // const positionLineF = positionLineOptions.value.filter(
(r: DataOption) => r.id == positionLineId.value // (r: DataOption) => r.id == positionLineId.value
); // );
if (positionLineF.length > 0) { // if (positionLineF.length > 0) {
salaryClass.value = salaryClass.value + `สายงาน${positionLineF[0].name} `; // salaryClass.value = salaryClass.value + `${positionLineF[0].name} `;
} // }
const positionPathSideF = positionSideOptions.value.filter( // const positionPathSideF = positionSideOptions.value.filter(
(r: DataOption) => r.id == positionPathSideId.value // (r: DataOption) => r.id == positionPathSideId.value
); // );
if (positionPathSideF.length > 0) { // if (positionPathSideF.length > 0) {
salaryClass.value = // salaryClass.value =
salaryClass.value + `ด้าน/สาขา${positionPathSideF[0].name} `; // salaryClass.value + `/${positionPathSideF[0].name} `;
} // }
const positionTypeF = positionTypeOptions.value.filter( // const positionTypeF = positionTypeOptions.value.filter(
(r: DataOption) => r.id == positionTypeId.value // (r: DataOption) => r.id == positionTypeId.value
); // );
if (positionTypeF.length > 0) { // if (positionTypeF.length > 0) {
salaryClass.value = // salaryClass.value =
salaryClass.value + `ตำแหน่งประเภท${positionTypeF[0].name} `; // salaryClass.value + `${positionTypeF[0].name} `;
} // }
const positionLevelF = positionLevelOptions.value.filter( // const positionLevelF = positionLevelOptions.value.filter(
(r: DataOption) => r.id == positionLevelId.value // (r: DataOption) => r.id == positionLevelId.value
); // );
if (positionLevelF.length > 0) { // if (positionLevelF.length > 0) {
salaryClass.value = salaryClass.value + `ระดับ${positionLevelF[0].name} `; // salaryClass.value = salaryClass.value + `${positionLevelF[0].name} `;
} // }
const positionExecutiveF = positionExecutiveOptions.value.filter( // const positionExecutiveF = positionExecutiveOptions.value.filter(
(r: DataOption) => r.id == positionExecutiveId.value // (r: DataOption) => r.id == positionExecutiveId.value
); // );
if (positionExecutiveF.length > 0) { // if (positionExecutiveF.length > 0) {
salaryClass.value = // salaryClass.value =
salaryClass.value + `ตำแหน่งทางการบริหาร${positionExecutiveF[0].name} `; // salaryClass.value + `${positionExecutiveF[0].name} `;
} // }
}; // };
/** /**
* กดบนทกใน dialog * กดบนทกใน dialog
@ -1879,17 +1964,20 @@ const saveData = async () => {
amount: amount.value, amount: amount.value,
positionSalaryAmount: positionSalaryAmount.value, positionSalaryAmount: positionSalaryAmount.value,
mouthSalaryAmount: mouthSalaryAmount.value, mouthSalaryAmount: mouthSalaryAmount.value,
ocId: selected.value, // ocId: selected.value,
positionId: positionId.value, orgName: orgName.value,
posNoId: posNoId.value, agencyName: agencyName.value,
cLevel: cLevel.value,
positionName: positionName.value,
// posNoId: posNoId.value,
posNo: posNo.value, posNo: posNo.value,
positionLineId: positionLineId.value, positionLineName: positionLineName.value,
positionPathSideId: positionPathSideId.value, positionPathSideName: positionPathSideName.value,
positionTypeId: positionTypeId.value, positionTypeId: positionTypeId.value,
positionLevelId: positionLevelId.value, positionLevelId: positionLevelId.value,
positionExecutiveId: positionExecutiveId.value, positionExecutiveName: positionExecutiveName.value,
positionExecutiveSideId: positionExecutiveSideId.value, // positionExecutiveSideId: positionExecutiveSideId.value,
salaryClass: salaryClass.value, // salaryClass: salaryClass.value,
salaryRef: salaryRef.value, salaryRef: salaryRef.value,
refCommandNo: refCommandNo.value, refCommandNo: refCommandNo.value,
}) })
@ -1918,16 +2006,16 @@ const editData = async () => {
positionSalaryAmount: positionSalaryAmount.value, positionSalaryAmount: positionSalaryAmount.value,
mouthSalaryAmount: mouthSalaryAmount.value, mouthSalaryAmount: mouthSalaryAmount.value,
ocId: selected.value, ocId: selected.value,
positionId: positionId.value, positionName: positionName.value,
posNoId: posNoId.value, // posNoId: posNoId.value,
posNo: posNo.value, posNo: posNo.value,
positionLineId: positionLineId.value, positionLineName: positionLineName.value,
positionPathSideId: positionPathSideId.value, positionPathSideName: positionPathSideName.value,
positionTypeId: positionTypeId.value, positionTypeId: positionTypeId.value,
positionLevelId: positionLevelId.value, positionLevelId: positionLevelId.value,
positionExecutiveId: positionExecutiveId.value, positionExecutiveName: positionExecutiveName.value,
positionExecutiveSideId: positionExecutiveSideId.value, // positionExecutiveSideId: positionExecutiveSideId.value,
salaryClass: salaryClass.value, // salaryClass: salaryClass.value,
salaryRef: salaryRef.value, salaryRef: salaryRef.value,
refCommandNo: refCommandNo.value, refCommandNo: refCommandNo.value,
}) })
@ -2013,14 +2101,14 @@ const selectData = async (props: DataProps) => {
mouthSalaryAmount.value = props.row.mouthSalaryAmount; mouthSalaryAmount.value = props.row.mouthSalaryAmount;
// await onSelected(props.row.ocId); // await onSelected(props.row.ocId);
selected.value = props.row.ocId; selected.value = props.row.ocId;
positionId.value = props.row.positionId; positionName.value = props.row.positionId;
posNoId.value = props.row.posNoId; posNoId.value = props.row.posNoId;
posNo.value = props.row.posNo; posNo.value = props.row.posNo;
positionLineId.value = props.row.positionLineId; positionLineName.value = props.row.positionLineId;
positionPathSideId.value = props.row.positionPathSideId; positionPathSideName.value = props.row.positionPathSideId;
positionTypeId.value = props.row.positionTypeId; positionTypeId.value = props.row.positionTypeId;
positionLevelId.value = props.row.positionLevelId; positionLevelId.value = props.row.positionLevelId;
positionExecutiveId.value = props.row.positionExecutiveId; positionExecutiveName.value = props.row.positionExecutiveId;
positionExecutiveSideId.value = props.row.positionExecutiveSideId; positionExecutiveSideId.value = props.row.positionExecutiveSideId;
salaryClass.value = props.row.salaryClass; salaryClass.value = props.row.salaryClass;
salaryRef.value = props.row.salaryRef; salaryRef.value = props.row.salaryRef;
@ -2037,20 +2125,25 @@ const addData = () => {
modalEdit.value = false; modalEdit.value = false;
modal.value = true; modal.value = true;
edit.value = true; edit.value = true;
date.value = new Date();
//
orgName.value = "";
agencyName.value = "";
cLevel.value = "";
date.value = new Date(); date.value = new Date();
amount.value = undefined; amount.value = undefined;
positionSalaryAmount.value = undefined; positionSalaryAmount.value = undefined;
mouthSalaryAmount.value = undefined; mouthSalaryAmount.value = undefined;
ocId.value = ""; ocId.value = "";
positionId.value = ""; positionName.value = "";
posNoId.value = ""; posNoId.value = "";
posNo.value = ""; posNo.value = "";
positionLineId.value = ""; positionLineName.value = "";
positionPathSideId.value = ""; positionPathSideName.value = "";
positionTypeId.value = ""; positionTypeId.value = "";
positionLevelId.value = ""; positionLevelId.value = "";
positionExecutiveId.value = ""; positionExecutiveName.value = "";
positionExecutiveSideId.value = ""; positionExecutiveSideId.value = "";
salaryClass.value = ""; salaryClass.value = "";
refSelected.value = null; refSelected.value = null;