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

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(
() => 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();
}
);

View file

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