แก้ไขตำแหน่งเงินเดือน
This commit is contained in:
parent
e03d2a84a5
commit
cc0c600174
8 changed files with 255 additions and 108 deletions
|
|
@ -8,6 +8,15 @@ import http from "@/plugins/http";
|
|||
import config from "@/app.config";
|
||||
|
||||
import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main";
|
||||
import type { DataPosition } from "@/modules/04_registryPerson/interface/response/Edit";
|
||||
import type { FormDataSalary } from "@/modules/04_registryPerson/interface/request/Edit";
|
||||
import type {
|
||||
DataCommandCode,
|
||||
DataPosType,
|
||||
DataPosLevel,
|
||||
DataPosPosition,
|
||||
DataPosExecutive,
|
||||
} from "@/modules/04_registryPerson/interface/response/Position";
|
||||
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
import FormPosition from "@/modules/04_registryPerson/views/edit/components/FormPosition.vue";
|
||||
|
|
@ -19,21 +28,20 @@ const {
|
|||
hideLoader,
|
||||
messageError,
|
||||
success,
|
||||
|
||||
convertDateToAPI,
|
||||
} = useCounterMixin();
|
||||
const store = useEditPosDataStore();
|
||||
|
||||
const modal = defineModel<boolean>("modal", { required: true });
|
||||
const empType = defineModel<string>("empType", { required: true });
|
||||
const rowData = defineModel<any[]>("rowData", { required: true });
|
||||
const rowData = defineModel<DataPosition[]>("rowData", { required: true });
|
||||
const rowIndex = defineModel<number>("rowIndex", { required: true });
|
||||
|
||||
const props = defineProps({
|
||||
fetchData: { type: Function, required: true },
|
||||
});
|
||||
|
||||
const formData = reactive({
|
||||
const formData = reactive<FormDataSalary>({
|
||||
commandCode: "", //ประเภทคำสั่ง
|
||||
commandNo: "", //เลขที่คำสั่ง
|
||||
commandYear: null, //ปี
|
||||
|
|
@ -59,7 +67,7 @@ const formData = reactive({
|
|||
orgChild4: "", //ส่วนราชการระดับ 4
|
||||
remark: "", //หมายเหตุ
|
||||
});
|
||||
const formReadonly = reactive({
|
||||
const formReadonly = reactive<FormDataSalary>({
|
||||
commandCode: "", //ประเภทคำสั่ง
|
||||
commandNo: "", //เลขที่คำสั่ง
|
||||
commandYear: null, //ปี
|
||||
|
|
@ -86,7 +94,7 @@ const formReadonly = reactive({
|
|||
remark: "", //หมายเหตุ
|
||||
});
|
||||
|
||||
const dataLevel = ref<any[]>([]); //รายการ ตำแหน่งเงินเดือน
|
||||
const dataLevel = ref<DataPosType[]>([]); //รายการ ตำแหน่งเงินเดือน
|
||||
const commandCodeOptions = ref<DataOption[]>(store.commandCodeData); //รายการปรเภทคำสั่ง
|
||||
const posTypeOptions = ref<DataOption[]>(store.posTypeData); //รายการประเภทตำแหน่ง | กลุ่มงาน
|
||||
const posLevelOptions = ref<DataOption[]>(store.posLevelData); //รายการระดับตำแหน่ง | ระดับชั้นงาน
|
||||
|
|
@ -98,12 +106,15 @@ const salaryId = ref<string>("");
|
|||
|
||||
async function fetchDataPosition() {
|
||||
try {
|
||||
showLoader();
|
||||
const res = await http.get(
|
||||
config.API.salaryTemp + `/get/${salaryId.value}`
|
||||
);
|
||||
return res.data.result;
|
||||
} catch (err) {
|
||||
messageError($q, err);
|
||||
} finally {
|
||||
hideLoader();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -115,7 +126,7 @@ async function fetchDataCommandCode() {
|
|||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
|
||||
store.commandCodeData = data.map((e: any) => ({
|
||||
store.commandCodeData = data.map((e: DataCommandCode) => ({
|
||||
id: e.code.toString(),
|
||||
name: e.name,
|
||||
}));
|
||||
|
|
@ -133,7 +144,7 @@ async function fetchType() {
|
|||
.get(config.API.orgPosType)
|
||||
.then((res) => {
|
||||
dataLevel.value = res.data.result;
|
||||
store.posTypeData = res.data.result.map((e: any) => ({
|
||||
store.posTypeData = res.data.result.map((e: DataPosType) => ({
|
||||
id: e.id,
|
||||
name: e.posTypeName,
|
||||
}));
|
||||
|
|
@ -150,7 +161,7 @@ async function fetchOptionGroup() {
|
|||
.get(config.API.orgEmployeeType)
|
||||
.then((res) => {
|
||||
dataLevel.value = res.data.result;
|
||||
store.posTypeData = res.data.result.map((e: any) => ({
|
||||
store.posTypeData = res.data.result.map((e: DataPosType) => ({
|
||||
id: e.id,
|
||||
name: e.posTypeName,
|
||||
}));
|
||||
|
|
@ -174,7 +185,7 @@ async function fetchDataOption() {
|
|||
const seen = new Set();
|
||||
const seen2 = new Set();
|
||||
|
||||
const listPositionField = data.filter((item: any) => {
|
||||
const listPositionField = data.filter((item: DataPosPosition) => {
|
||||
if (seen.has(item.positionField)) {
|
||||
return false;
|
||||
} else {
|
||||
|
|
@ -182,12 +193,12 @@ async function fetchDataOption() {
|
|||
return true;
|
||||
}
|
||||
});
|
||||
store.posLineData = listPositionField.map((e: any) => ({
|
||||
store.posLineData = listPositionField.map((e: DataPosPosition) => ({
|
||||
id: e.positionField,
|
||||
name: e.positionField,
|
||||
}));
|
||||
|
||||
const listPositionArea = data.filter((item: any) => {
|
||||
const listPositionArea = data.filter((item: DataPosPosition) => {
|
||||
if (
|
||||
item.positionArea === null ||
|
||||
item.positionArea === "" ||
|
||||
|
|
@ -200,7 +211,7 @@ async function fetchDataOption() {
|
|||
return true;
|
||||
}
|
||||
});
|
||||
store.posPathSideData = listPositionArea.map((e: any) => ({
|
||||
store.posPathSideData = listPositionArea.map((e: DataPosPosition) => ({
|
||||
id: e.positionArea,
|
||||
name: e.positionArea,
|
||||
}));
|
||||
|
|
@ -216,7 +227,7 @@ async function fetchDataOptionExecutive() {
|
|||
.get(config.API.orgPosExecutive)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
store.posExecutiveData = data.map((e: any) => ({
|
||||
store.posExecutiveData = data.map((e: DataPosExecutive) => ({
|
||||
id: e.posExecutiveName,
|
||||
name: e.posExecutiveName,
|
||||
}));
|
||||
|
|
@ -233,11 +244,11 @@ async function fetchDataOptionExecutive() {
|
|||
*/
|
||||
async function updateSelectType(val: string, status: boolean = false) {
|
||||
const listLevel = val
|
||||
? dataLevel.value.find((e: any) => e.posTypeName === val)
|
||||
? dataLevel.value.find((e: DataPosType) => e.posTypeName === val)
|
||||
: null;
|
||||
|
||||
if (listLevel) {
|
||||
store.posLevelData = listLevel.posLevels.map((e: any) => ({
|
||||
store.posLevelData = listLevel.posLevels.map((e: DataPosLevel) => ({
|
||||
id: e.id,
|
||||
name:
|
||||
empType.value === "officer"
|
||||
|
|
@ -393,7 +404,7 @@ onMounted(async () => {
|
|||
<q-card>
|
||||
<q-form greedy @submit.prevent @validation-success="onSubmit">
|
||||
<DialogHeader
|
||||
:tittle="'แก้ไขตำแหน่งเงินเดือนเงินเดือน'"
|
||||
:tittle="'แก้ไขตำแหน่ง/เงินเดือน'"
|
||||
:close="onClickCloseDialog"
|
||||
/>
|
||||
<q-separator />
|
||||
|
|
@ -402,18 +413,32 @@ onMounted(async () => {
|
|||
<div class="col-12 row">
|
||||
<div class="col-xs-12 col-md-6 row no-wrap">
|
||||
<div class="col-12 q-pa-md">
|
||||
<FormPosition
|
||||
:is-readonly="true"
|
||||
:form-data="formReadonly"
|
||||
:command-code-options="commandCodeOptions"
|
||||
:pos-type-options="posTypeOptions"
|
||||
:pos-level-options="posLevelOptions"
|
||||
:pos-line-options="posLineOptions"
|
||||
:pos-path-side-options="posPathSideOptions"
|
||||
:pos-executive-options="posExecutiveOptions"
|
||||
:emp-type="empType"
|
||||
:update-select-type="updateSelectType"
|
||||
/>
|
||||
<q-card
|
||||
bordered
|
||||
class="col-12"
|
||||
style="border: 1px solid #d6dee1"
|
||||
>
|
||||
<div
|
||||
class="col-12 text-weight-medium bg-grey-1 q-py-xs q-px-md"
|
||||
>
|
||||
ข้อมูลปัจุบัน
|
||||
</div>
|
||||
<div class="col-12"><q-separator /></div>
|
||||
<q-card-section>
|
||||
<FormPosition
|
||||
:is-readonly="true"
|
||||
:form-data="formReadonly"
|
||||
:command-code-options="commandCodeOptions"
|
||||
:pos-type-options="posTypeOptions"
|
||||
:pos-level-options="posLevelOptions"
|
||||
:pos-line-options="posLineOptions"
|
||||
:pos-path-side-options="posPathSideOptions"
|
||||
:pos-executive-options="posExecutiveOptions"
|
||||
:emp-type="empType"
|
||||
:update-select-type="updateSelectType"
|
||||
/>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</div>
|
||||
<div class="col-12 row">
|
||||
<q-separator :vertical="!$q.screen.lt.md" />
|
||||
|
|
@ -422,18 +447,34 @@ onMounted(async () => {
|
|||
|
||||
<div class="col-xs-12 col-md-6 row">
|
||||
<div class="col-12 q-pa-md">
|
||||
<FormPosition
|
||||
:is-readonly="false"
|
||||
v-model:form-data="formData"
|
||||
v-model:command-code-options="commandCodeOptions"
|
||||
v-model:pos-type-options="posTypeOptions"
|
||||
v-model:pos-level-options="posLevelOptions"
|
||||
v-model:pos-line-options="posLineOptions"
|
||||
v-model:pos-path-side-options="posPathSideOptions"
|
||||
v-model:pos-executive-options="posExecutiveOptions"
|
||||
:emp-type="empType"
|
||||
:update-select-type="updateSelectType"
|
||||
/>
|
||||
<q-card
|
||||
bordered
|
||||
class="col-12"
|
||||
style="border: 1px solid #d6dee1"
|
||||
>
|
||||
<div
|
||||
class="col-12 text-weight-medium bg-grey-1 q-py-xs q-px-md"
|
||||
>
|
||||
ข้อมูลที่แก้ไข
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<q-separator />
|
||||
<q-card-section>
|
||||
<FormPosition
|
||||
:is-readonly="false"
|
||||
v-model:form-data="formData"
|
||||
v-model:command-code-options="commandCodeOptions"
|
||||
v-model:pos-type-options="posTypeOptions"
|
||||
v-model:pos-level-options="posLevelOptions"
|
||||
v-model:pos-line-options="posLineOptions"
|
||||
v-model:pos-path-side-options="posPathSideOptions"
|
||||
v-model:pos-executive-options="posExecutiveOptions"
|
||||
:emp-type="empType"
|
||||
:update-select-type="updateSelectType"
|
||||
/>
|
||||
</q-card-section>
|
||||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -442,26 +483,29 @@ onMounted(async () => {
|
|||
<q-separator />
|
||||
|
||||
<q-card-actions align="right">
|
||||
<q-btn label="บันทึก" id="onSubmit" type="submit" color="public">
|
||||
<q-tooltip>บันทึกข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
:disable="rowIndex === 0"
|
||||
label="ก่อนหน้า"
|
||||
color="public"
|
||||
icon="mdi-arrow-left"
|
||||
:color="rowIndex === 0 ? 'grey' : 'public'"
|
||||
icon="mdi-chevron-left"
|
||||
@click.stop.pervent="onNavigateRow('previous')"
|
||||
>
|
||||
<q-tooltip>บันทึกข้อมูล</q-tooltip>
|
||||
<q-tooltip>ข้อมูลก่อนหน้า</q-tooltip>
|
||||
</q-btn>
|
||||
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
:disable="rowIndex + 1 === rowData.length"
|
||||
label="ถัดไป"
|
||||
color="public"
|
||||
icon-right="mdi-arrow-right"
|
||||
:color="rowIndex + 1 === rowData.length ? 'grey' : 'public'"
|
||||
icon="mdi-chevron-right"
|
||||
@click.stop.pervent="onNavigateRow('next')"
|
||||
>
|
||||
<q-tooltip>ข้อมูลถัดไป</q-tooltip>
|
||||
</q-btn>
|
||||
|
||||
<q-btn label="บันทึก" id="onSubmit" type="submit" color="public">
|
||||
<q-tooltip>บันทึกข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
</q-card-actions>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue