ทะเบียนประวัติ
This commit is contained in:
parent
322106631a
commit
6c1b4b2adb
7 changed files with 531 additions and 288 deletions
|
|
@ -143,7 +143,6 @@ const formFilter = reactive({
|
|||
pageSize: 10,
|
||||
keyword: "",
|
||||
});
|
||||
const maxPage = ref<number>(1);
|
||||
|
||||
const pagination = ref({
|
||||
page: 1,
|
||||
|
|
@ -176,11 +175,17 @@ const salaryId = ref<string>("");
|
|||
const dataLevel = ref<any[]>([]);
|
||||
|
||||
const posNoOptions = ref<DataOption2[]>(store.optionTemplatePos);
|
||||
const positionLineOptions = ref<DataOption2[]>(store.optionTemplatePos);
|
||||
|
||||
const posTypeOptions = ref<DataOption[]>([]);
|
||||
const posTypeOptionsMain = ref<DataOption[]>([]);
|
||||
const posLevelOption = ref<DataOption[]>([]);
|
||||
const posLevelOptionMain = ref<DataOption[]>([]);
|
||||
const positionFielOptiond = ref<DataOption[]>([]);
|
||||
const positionFielOptiondMain = ref<DataOption[]>([]);
|
||||
const positionAreaOptiond = ref<DataOption[]>([]);
|
||||
const positionAreaOptiondMain = ref<DataOption[]>([]);
|
||||
const posExecutiveOption = ref<DataOption[]>([]);
|
||||
const posExecutiveOptionMain = ref<DataOption[]>([]);
|
||||
|
||||
const docOption = ref<DataOption2[]>(store.optionTemplateDoc);
|
||||
|
||||
|
|
@ -219,18 +224,26 @@ async function updateSelectType(val: string, status: boolean = false) {
|
|||
const listLevel = await dataLevel.value.find(
|
||||
(e: any) => e.posTypeName === val
|
||||
);
|
||||
|
||||
if (listLevel) {
|
||||
posLevelOptionMain.value = listLevel.posLevels.map((e: any) => ({
|
||||
id: e.id,
|
||||
name: e.posLevelName,
|
||||
name: e.posLevelName.toString(),
|
||||
}));
|
||||
posLevelOption.value = posLevelOptionMain.value;
|
||||
|
||||
formDataSalary.positionLevel = !status ? "" : formDataSalary.positionLevel;
|
||||
}
|
||||
}
|
||||
|
||||
async function onClickOpenDialog(statusEdit: boolean = false, data: any = []) {
|
||||
dataLevel.value.length === 0 && (await fetchType());
|
||||
if (empType.value === "") {
|
||||
dataLevel.value.length === 0 && fetchType();
|
||||
fetchDataOption();
|
||||
fetchDataOptionExecutive();
|
||||
} else {
|
||||
fetchOptionGroup();
|
||||
}
|
||||
|
||||
setTimeout(async () => {
|
||||
statusEdit && (await updateSelectType(data.positionType, true));
|
||||
isStatusEdit.value = statusEdit;
|
||||
|
|
@ -270,8 +283,8 @@ function filterSelector(val: any, update: Function, filtername: string) {
|
|||
break;
|
||||
case "positionLine":
|
||||
update(() => {
|
||||
positionLineOptions.value = store.optionTemplatePos.filter(
|
||||
(v: DataOption2) => v.name.indexOf(val) > -1
|
||||
positionFielOptiond.value = positionFielOptiondMain.value.filter(
|
||||
(v: DataOption) => v.name.indexOf(val) > -1
|
||||
);
|
||||
});
|
||||
break;
|
||||
|
|
@ -296,6 +309,21 @@ function filterSelector(val: any, update: Function, filtername: string) {
|
|||
);
|
||||
});
|
||||
break;
|
||||
case "positionPathSide":
|
||||
update(() => {
|
||||
positionAreaOptiond.value = positionAreaOptiondMain.value.filter(
|
||||
(v: DataOption) => v.name.indexOf(val) > -1
|
||||
);
|
||||
});
|
||||
break;
|
||||
|
||||
case "positionExecutive":
|
||||
update(() => {
|
||||
posExecutiveOption.value = posExecutiveOptionMain.value.filter(
|
||||
(v: DataOption) => v.name.indexOf(val) > -1
|
||||
);
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
|
@ -318,14 +346,19 @@ function onSubmit() {
|
|||
|
||||
async function submit() {
|
||||
const formData = {
|
||||
profileId: isStatusEdit.value || empType.value !== ''? undefined : profileId.value,
|
||||
profileEmployeeId: empType.value !== "" ? profileId.value : undefined,
|
||||
profileEmployeeId:
|
||||
!isStatusEdit.value && empType.value !== "" ? profileId.value : undefined,
|
||||
profileId:
|
||||
!isStatusEdit.value && empType.value === "" ? profileId.value : undefined,
|
||||
date: formDataSalary.date, // วันที่
|
||||
posNo: formDataSalary.posNo, //เลขที่ตำแหน่ง
|
||||
position: formDataSalary.position, //ตำแหน่ง
|
||||
positionLine: formDataSalary.positionLine, //สายงาน
|
||||
positionPathSide: formDataSalary.positionPathSide, // ด้าน/สาขา
|
||||
positionExecutive: formDataSalary.positionExecutive, //ตำแหน่งทางการบริหาร
|
||||
positionLine:
|
||||
empType.value === "" ? formDataSalary.positionLine : undefined, //สายงาน
|
||||
positionPathSide:
|
||||
empType.value === "" ? formDataSalary.positionPathSide : undefined, // ด้าน/สาขา
|
||||
positionExecutive:
|
||||
empType.value === "" ? formDataSalary.positionExecutive : undefined, //ตำแหน่งทางการบริหาร
|
||||
positionType: formDataSalary.positionType, // ประเภทตำแหน่ง
|
||||
positionLevel: formDataSalary.positionLevel, // ระดับตำแหน่ง
|
||||
amount:
|
||||
|
|
@ -395,6 +428,95 @@ function onClikcHistory(id: string) {
|
|||
modalHistory.value = true;
|
||||
}
|
||||
|
||||
async function fetchDataOption() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.orgPosPosition + `?keyword=&type=ALL`)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
console.log(res);
|
||||
|
||||
const seen = new Set();
|
||||
const seen2 = new Set();
|
||||
|
||||
const listPositionField = data.filter((item: any) => {
|
||||
if (seen.has(item.positionField)) {
|
||||
return false;
|
||||
} else {
|
||||
seen.add(item.positionField);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
positionFielOptiondMain.value = listPositionField.map((e: any) => ({
|
||||
id: e.positionField,
|
||||
name: e.positionField,
|
||||
}));
|
||||
|
||||
const listPositionArea = data.filter((item: any) => {
|
||||
if (
|
||||
item.positionArea === null ||
|
||||
item.positionArea === "" ||
|
||||
item.positionArea === "-" ||
|
||||
seen2.has(item.positionArea)
|
||||
) {
|
||||
return false;
|
||||
} else {
|
||||
seen2.add(item.positionArea);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
positionAreaOptiondMain.value = listPositionArea.map((e: any) => ({
|
||||
id: e.positionArea,
|
||||
name: e.positionArea,
|
||||
}));
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
function fetchDataOptionExecutive() {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.orgPosExecutive)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
posExecutiveOptionMain.value = data.map((e: any) => ({
|
||||
id: e.posExecutiveName,
|
||||
name: e.posExecutiveName,
|
||||
}));
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
async function fetchOptionGroup() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.orgEmployeeType)
|
||||
.then(async (res) => {
|
||||
dataLevel.value = res.data.result;
|
||||
posTypeOptionsMain.value = res.data.result.map((e: any) => ({
|
||||
id: e.id,
|
||||
name: e.posTypeName,
|
||||
}));
|
||||
posTypeOptions.value = posTypeOptionsMain.value;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchListSalary();
|
||||
});
|
||||
|
|
@ -535,7 +657,7 @@ onMounted(() => {
|
|||
</d-table>
|
||||
|
||||
<q-dialog v-model="modalDialogSalary" persistent>
|
||||
<q-card>
|
||||
<q-card style="width: 900px; max-width: 80vw">
|
||||
<q-form greedy @submit.prevent @validation-success="onSubmit">
|
||||
<DialogHeader
|
||||
:tittle="
|
||||
|
|
@ -640,59 +762,6 @@ onMounted(() => {
|
|||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6 col-sm-6 col-md-4">
|
||||
<q-input
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
v-model="formDataSalary.positionLine"
|
||||
hide-bottom-space
|
||||
:label="`${'สายงาน'}`"
|
||||
/>
|
||||
<!-- <q-select
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
borderless
|
||||
v-model="formDataSalary.positionLine"
|
||||
:label="`${'สายงาน'}`"
|
||||
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, 'positionLine'
|
||||
)"
|
||||
/> -->
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6 col-sm-6 col-md-4">
|
||||
<q-input
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
v-model="formDataSalary.positionPathSide"
|
||||
hide-bottom-space
|
||||
:label="`${'ด้าน/สาขา'}`"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-6 col-md-4">
|
||||
<q-input
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
borderless
|
||||
v-model="formDataSalary.positionExecutive"
|
||||
hide-bottom-space
|
||||
:label="`${'ตำแหน่งทางการบริหาร'}`"
|
||||
>
|
||||
</q-input>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6 col-sm-6 col-md-4">
|
||||
<q-select
|
||||
ref="positionType Ref"
|
||||
|
|
@ -701,7 +770,7 @@ onMounted(() => {
|
|||
lazy-rules
|
||||
borderless
|
||||
v-model="formDataSalary.positionType"
|
||||
:label="`${'ตำแหน่งประเภท'}`"
|
||||
:label="empType == '' ? 'ตำแหน่งประเภท' : 'กลุ่มงาน'"
|
||||
emit-value
|
||||
map-options
|
||||
option-label="name"
|
||||
|
|
@ -711,7 +780,7 @@ onMounted(() => {
|
|||
use-input
|
||||
input-debounce="0"
|
||||
@update:model-value="updateSelectType"
|
||||
:rules="[(val: string) => !!val || `${'กรุณาเลือกตำแหน่งประเภท'}`]"
|
||||
:rules="empType == '' ? [(val: string) => !!val || 'กรุณาเลือกตำแหน่งประเภท' ]:[(val: string) => !!val || 'กรุณาเลือกกลุ่มงาน' ]"
|
||||
@filter="(inputValue: any,
|
||||
doneFn: Function) => filterSelector(inputValue, doneFn, 'posType'
|
||||
)"
|
||||
|
|
@ -726,8 +795,8 @@ onMounted(() => {
|
|||
lazy-rules
|
||||
borderless
|
||||
v-model="formDataSalary.positionLevel"
|
||||
:rules="[(val: string) => !!val || `${'กรุณาเลือกระดับตำแหน่ง'}`]"
|
||||
:label="`${'ระดับตำแหน่ง'}`"
|
||||
:rules="empType == '' ? [(val: string) => !!val || 'กรุณาเลือกระดับตำแหน่ง' ] : [(val: string) => !!val || 'กรุณาเลือกระดับชั้นงาน']"
|
||||
:label="empType == '' ? 'ระดับตำแหน่ง' : 'ระดับชั้นงาน'"
|
||||
emit-value
|
||||
map-options
|
||||
option-label="name"
|
||||
|
|
@ -742,6 +811,76 @@ onMounted(() => {
|
|||
/>
|
||||
</div>
|
||||
<div class="col-md-4"></div>
|
||||
|
||||
<div class="col-xs-6 col-sm-6 col-md-4" v-if="empType == ''">
|
||||
<q-select
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
borderless
|
||||
v-model="formDataSalary.positionLine"
|
||||
:label="`${'สายงาน'}`"
|
||||
emit-value
|
||||
map-options
|
||||
option-label="name"
|
||||
:options="positionFielOptiond"
|
||||
option-value="id"
|
||||
hide-bottom-space
|
||||
use-input
|
||||
clearable
|
||||
input-debounce="0"
|
||||
@filter="(inputValue: any,
|
||||
doneFn: Function) => filterSelector(inputValue, doneFn, 'positionLine'
|
||||
)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6 col-sm-6 col-md-4" v-if="empType == ''">
|
||||
<q-select
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
borderless
|
||||
v-model="formDataSalary.positionPathSide"
|
||||
:label="`${'ด้าน/สาขา'}`"
|
||||
emit-value
|
||||
map-options
|
||||
option-label="name"
|
||||
:options="positionAreaOptiond"
|
||||
option-value="id"
|
||||
hide-bottom-space
|
||||
use-input
|
||||
clearable
|
||||
input-debounce="0"
|
||||
@filter="(inputValue: any,
|
||||
doneFn: Function) => filterSelector(inputValue, doneFn, 'positionPathSide'
|
||||
)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6 col-sm-6 col-md-4" v-if="empType == ''">
|
||||
<q-select
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
borderless
|
||||
v-model="formDataSalary.positionExecutive"
|
||||
:label="`${'ตำแหน่งทางการบริหาร'}`"
|
||||
emit-value
|
||||
map-options
|
||||
option-label="name"
|
||||
:options="posExecutiveOption"
|
||||
option-value="id"
|
||||
hide-bottom-space
|
||||
use-input
|
||||
input-debounce="0"
|
||||
clearable
|
||||
@filter="(inputValue: any,
|
||||
doneFn: Function) => filterSelector(inputValue, doneFn, 'positionExecutive'
|
||||
)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6 col-sm-6 col-md-4">
|
||||
<q-input
|
||||
ref="salaryRef"
|
||||
|
|
@ -771,6 +910,7 @@ onMounted(() => {
|
|||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6 col-sm-6 col-md-4">
|
||||
<q-input
|
||||
ref="amountRef"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue