ผังบัญชีค่าจ้างลูกจ้างประจำ => fix bug
This commit is contained in:
parent
7ab0dcd8e6
commit
2c32b6d064
3 changed files with 172 additions and 41 deletions
|
|
@ -32,9 +32,11 @@ const props = defineProps({
|
|||
});
|
||||
|
||||
const posTypeOp = ref<DataOptions[]>([]);
|
||||
const posTypeOpMain = ref<DataOptions[]>([]);
|
||||
const posNameOp = ref<DataOptions[]>([]);
|
||||
const posNameOpMain = ref<DataOptions[]>([]);
|
||||
const groupOldOp = ref<DataOptions[]>([]);
|
||||
const groupOldOpMain = ref<DataOptions[]>([]);
|
||||
const posLevelOp = ref<any[]>([]);
|
||||
const posNameListOp = ref<DataListOptions[]>([]);
|
||||
|
||||
|
|
@ -123,10 +125,12 @@ function getPosType() {
|
|||
.get(config.API.salaryEmployeePosType())
|
||||
.then((res) => {
|
||||
const dataOp = res.data.result;
|
||||
posTypeOp.value = dataOp.map((item: any) => ({
|
||||
const option = dataOp.map((item: any) => ({
|
||||
id: item.id,
|
||||
name: item.posTypeName,
|
||||
}));
|
||||
posTypeOpMain.value = option;
|
||||
posTypeOp.value = option;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
@ -138,29 +142,31 @@ function getPosType() {
|
|||
|
||||
/** ดึงข้อมูล ตำแหน่ง */
|
||||
function getPosName() {
|
||||
formData.posName = "";
|
||||
formData.posLevel = "";
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.salaryEmployeePositionType(formData.posType.name))
|
||||
.then((res) => {
|
||||
const dataOp = res.data.result;
|
||||
posNameListOp.value = res.data.result;
|
||||
posNameOpMain.value = [
|
||||
...new Map(
|
||||
dataOp.map((i: DataListOptions) => [i.posDictName, i])
|
||||
).values(),
|
||||
].map((i: any) => ({
|
||||
id: i.id,
|
||||
name: i.posDictName,
|
||||
}));
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
if (formData.posType) {
|
||||
formData.posName = "";
|
||||
formData.posLevel = "";
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.salaryEmployeePositionType(formData.posType.name))
|
||||
.then((res) => {
|
||||
const dataOp = res.data.result;
|
||||
posNameListOp.value = res.data.result;
|
||||
posNameOpMain.value = [
|
||||
...new Map(
|
||||
dataOp.map((i: DataListOptions) => [i.posDictName, i])
|
||||
).values(),
|
||||
].map((i: any) => ({
|
||||
id: i.id,
|
||||
name: i.posDictName,
|
||||
}));
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/** ดึงข้อมูล ตำแหน่ง */
|
||||
|
|
@ -218,10 +224,12 @@ function getSalaryGroup() {
|
|||
.then((res) => {
|
||||
const list = res.data.result;
|
||||
const data = list.sort((a: any, b: any) => a.group - b.group);
|
||||
groupOldOp.value = data.map((item: any) => ({
|
||||
const option = data.map((item: any) => ({
|
||||
id: item.id,
|
||||
name: `กลุ่มที่ ${item.group}`,
|
||||
}));
|
||||
groupOldOp.value = option;
|
||||
groupOldOpMain.value = option;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
@ -272,13 +280,47 @@ watch(
|
|||
* @param update อัพเดทค่า
|
||||
* @param refData ดาต้าที่ต้องการฟิลเตอร์
|
||||
*/
|
||||
function filterOption(val: any, update: Function) {
|
||||
update(() => {
|
||||
posNameOp.value = posNameOpMain.value.filter(
|
||||
(v: any) => v.name.indexOf(val) > -1
|
||||
);
|
||||
});
|
||||
function filterOption(val: any, update: Function, type: string) {
|
||||
switch (type) {
|
||||
case "group":
|
||||
update(() => {
|
||||
formData.posType = "";
|
||||
posTypeOp.value = posTypeOpMain.value.filter(
|
||||
(v: any) => v.name.indexOf(val) > -1
|
||||
);
|
||||
});
|
||||
break;
|
||||
case "pos":
|
||||
update(() => {
|
||||
formData.posName = "";
|
||||
posNameOp.value = posNameOpMain.value.filter(
|
||||
(v: any) => v.name.indexOf(val) > -1
|
||||
);
|
||||
});
|
||||
break;
|
||||
case "groupOld":
|
||||
update(() => {
|
||||
groupOldOp.value = groupOldOpMain.value.filter(
|
||||
(v: any) => v.name.indexOf(val) > -1
|
||||
);
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* class จัดรูปแบบแสดงระหว่างข้อมูลที่แก้ไขหรือแสดงเฉยๆ
|
||||
* @param val ข้อมูล input สำหรับแก้ไขหรือไม่
|
||||
*/
|
||||
const getClass = (val: boolean) => {
|
||||
return {
|
||||
"full-width inputgreen cursor-pointer": val,
|
||||
"full-width cursor-pointer": !val,
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -296,6 +338,7 @@ function filterOption(val: any, update: Function) {
|
|||
<div class="col-4">
|
||||
<q-select
|
||||
ref="posTypeRef"
|
||||
:class="getClass(true)"
|
||||
dense
|
||||
outlined
|
||||
v-model="formData.posType"
|
||||
|
|
@ -307,12 +350,23 @@ function filterOption(val: any, update: Function) {
|
|||
map-options
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
use-input
|
||||
@update:model-value="getPosName()"
|
||||
/>
|
||||
@filter="(inputValue:string,doneFn:Function) => filterOption(inputValue, doneFn,'group') "
|
||||
>
|
||||
<template v-slot:no-option>
|
||||
<q-item>
|
||||
<q-item-section class="text-grey">
|
||||
ไม่มีข้อมูล
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</template></q-select
|
||||
>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<q-select
|
||||
ref="posNameRef"
|
||||
:class="getClass(true)"
|
||||
dense
|
||||
:readonly="formData.posType"
|
||||
outlined
|
||||
|
|
@ -325,7 +379,7 @@ function filterOption(val: any, update: Function) {
|
|||
emit-value
|
||||
lazy-rules
|
||||
use-input
|
||||
@filter="(inputValue:any,doneFn:Function) => filterOption(inputValue, doneFn) "
|
||||
@filter="(inputValue:string,doneFn:Function) => filterOption(inputValue, doneFn,'pos')"
|
||||
hide-bottom-space
|
||||
@update:model-value="getPosLevel()"
|
||||
>
|
||||
|
|
@ -341,6 +395,7 @@ function filterOption(val: any, update: Function) {
|
|||
<div class="col-4">
|
||||
<q-select
|
||||
:readonly="formData.posName"
|
||||
:class="getClass(true)"
|
||||
ref="posLevelRef"
|
||||
dense
|
||||
outlined
|
||||
|
|
@ -353,11 +408,20 @@ function filterOption(val: any, update: Function) {
|
|||
:rules="[(val) => !!val || 'กรุณาเลือกระดับชั้นงาน']"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
/>
|
||||
>
|
||||
<template v-slot:no-option>
|
||||
<q-item>
|
||||
<q-item-section class="text-grey">
|
||||
ไม่มีข้อมูล
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</template>
|
||||
</q-select>
|
||||
</div>
|
||||
|
||||
<div class="col-8">
|
||||
<q-input
|
||||
:class="getClass(true)"
|
||||
dense
|
||||
outlined
|
||||
v-model="formData.reson"
|
||||
|
|
@ -368,12 +432,13 @@ function filterOption(val: any, update: Function) {
|
|||
<div class="col-12 text-bold">อัตราค่าจ้าง</div>
|
||||
<div class="col-4">
|
||||
<q-input
|
||||
:class="getClass(true)"
|
||||
ref="rateOldMinRef"
|
||||
dense
|
||||
outlined
|
||||
v-model="formData.rateOldMin"
|
||||
label="ขั้นต่ำสุด"
|
||||
mask="###,###,###,###"
|
||||
mask="###,###,###,###,###,###,###,###"
|
||||
reverse-fill-mask
|
||||
:rules="[
|
||||
(val) => !!val || `${'กรุณากรอกอัตราค่าจ้าง ขั้นต่ำสุด'}`,
|
||||
|
|
@ -384,6 +449,7 @@ function filterOption(val: any, update: Function) {
|
|||
</div>
|
||||
<div class="col-4">
|
||||
<q-select
|
||||
:class="getClass(true)"
|
||||
ref="groupOldRef"
|
||||
dense
|
||||
outlined
|
||||
|
|
@ -401,16 +467,27 @@ function filterOption(val: any, update: Function) {
|
|||
option-value="id"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
/>
|
||||
use-input
|
||||
@filter="(inputValue:string,doneFn:Function) => filterOption(inputValue, doneFn,'groupOld')"
|
||||
>
|
||||
<template v-slot:no-option>
|
||||
<q-item>
|
||||
<q-item-section class="text-grey">
|
||||
ไม่มีข้อมูล
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</template>
|
||||
</q-select>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<q-input
|
||||
:class="getClass(true)"
|
||||
ref="rateMaxOldRef"
|
||||
dense
|
||||
outlined
|
||||
v-model="formData.rateMaxOld"
|
||||
label="ขั้นสูงสุดเดิม"
|
||||
mask="###,###,###,###"
|
||||
mask="###,###,###,###,###,###,###,###"
|
||||
reverse-fill-mask
|
||||
:rules="[
|
||||
(val) =>
|
||||
|
|
@ -426,6 +503,7 @@ function filterOption(val: any, update: Function) {
|
|||
</div>
|
||||
<div class="col-4">
|
||||
<q-select
|
||||
:class="getClass(true)"
|
||||
ref="groupRateHighRef"
|
||||
dense
|
||||
outlined
|
||||
|
|
@ -441,16 +519,27 @@ function filterOption(val: any, update: Function) {
|
|||
option-value="id"
|
||||
emit-value
|
||||
hide-bottom-space
|
||||
/>
|
||||
use-input
|
||||
@filter="(inputValue:string,doneFn:Function) => filterOption(inputValue, doneFn,'groupOld')"
|
||||
>
|
||||
<template v-slot:no-option>
|
||||
<q-item>
|
||||
<q-item-section class="text-grey">
|
||||
ไม่มีข้อมูล
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</template>
|
||||
</q-select>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<q-input
|
||||
:class="getClass(true)"
|
||||
ref="rateHighMaxRef"
|
||||
dense
|
||||
outlined
|
||||
v-model="formData.rateHighMax"
|
||||
label="อัตราค่าจ้างขั้นสูงใหม่"
|
||||
mask="###,###,###,###"
|
||||
mask="###,###,###,###,###,###,###,###"
|
||||
reverse-fill-mask
|
||||
:rules="[
|
||||
(val) => !!val || `${'กรุณากรอกอัตราค่าจ้างขั้นสูงใหม่'}`,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue