hrms-mgt/src/modules/04_registry/components/Salary.vue
2023-09-14 09:27:01 +07:00

2158 lines
84 KiB
Vue

<!-- card ตำแหน/เงนเดอน -->
<template>
<q-card flat bordered class="col-12 q-px-lg q-py-md">
<q-form ref="myForm">
<ProfileTable
:rows="rows"
:columns="columns"
:filter="filter"
:visible-columns="visibleColumns"
v-model:inputfilter="filter"
v-model:inputvisible="visibleColumns"
:add="clickAdd"
name="ตำแหน่ง/เงินเดือน"
icon="mdi-cash"
:statusEdit="statusEdit"
>
<template #columns="props">
<q-tr :props="props">
<q-td
v-for="col in props.cols"
:key="col.name"
:props="props"
@click="selectData(props)"
class="cursor-pointer"
>
<div v-if="col.name == 'date'" class="table_ellipsis">
{{ date2Thai(col.value) }}
</div>
<div
v-else-if="
props.row.salaryStatus !== 'DEATH' &&
(col.name == 'positionSalaryAmount' ||
col.name == 'mouthSalaryAmount' ||
col.name == 'amount')
"
class="table_ellipsis"
>
{{ col.value == null ? "" : col.value.toLocaleString("en-US") }}
</div>
<div
v-else-if="
props.row.salaryStatus === 'DEATH' && col.name == 'position'
"
class="table_ellipsis"
>
ถึงแก่กรรม
</div>
<div
v-else-if="
props.row.salaryStatus === 'DEATH' && col.name !== 'salaryRef'
"
class="table_ellipsis"
>
-
</div>
<div v-else class="table_ellipsis">
{{ col.value }}
</div>
</q-td>
<q-td auto-width>
<q-btn
color="info"
flat
dense
round
size="14px"
icon="mdi-history"
@click="clickHistory(props.row)"
>
<q-tooltip>ประวัติแก้ไขตำแหน่ง/เงินเดือน</q-tooltip>
</q-btn>
</q-td>
</q-tr>
</template>
</ProfileTable>
</q-form>
</q-card>
<!-- popup Edit window-->
<q-dialog v-model="modal" persistent full-width>
<q-card>
<q-form ref="myForm">
<DialogHeader tittle="ตำแหน่ง/เงินเดือน" :close="clickClose" />
<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">
<q-card flat bordered class="fit q-pa-sm">
<q-scroll-area visible style="height: 70vh">
<q-input
outlined
dense
v-model="search"
placeholder="ค้นหา"
class="q-mb-sm"
>
<template v-slot:append>
<q-icon name="mdi-magnify" />
</template>
</q-input>
<q-tree
v-if="edit"
:nodes="nodesTree"
dense
node-key="id"
v-model:selected="selected"
v-model:expanded="expanded"
no-selection-unset
selected-color="primary"
@update:selected="onSelected"
default-expand-all
/>
<q-tree
v-else
:nodes="nodesTree"
dense
node-key="id"
v-model:expanded="expanded"
no-selection-unset
selected-color="primary"
@update:selected="onSelected"
default-expand-all
>
<template v-slot:default-header="prop">
<div class="row items-center">
<div
class="text-primary"
v-if="selected == prop.node.id"
>
{{ prop.node.label }}
</div>
<div v-else>
{{ prop.node.label }}
</div>
</div>
</template>
</q-tree>
</q-scroll-area>
</q-card>
</div>
<div class="col-xs-12 col-sm-7">
<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">
<datepicker
menu-class-name="modalfix"
:readonly="!edit"
v-model="date"
:locale="'th'"
autoApply
:enableTimePicker="false"
@update:modelValue="clickEditRow"
week-start="0"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:borderless="!edit"
:model-value="date2Thai(date)"
:rules="[
(val: string) =>
!!val ||
`${'กรุณาเลือกวัน เดือน ปี'}`,
]"
:label="`${'วัน เดือน ปี'}`"
hide-bottom-space
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
:style="
edit
? 'color: var(--q-primary)'
: 'color: var(--q-grey)'
"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</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="posNoId"
:rules="[
(val: string) => !!val || `${'กรุณาเลือกตำแหน่งเลขที่'}`,
]"
:label="`${'ตำแหน่งเลขที่'}`"
@update:modelValue="clickEditRow"
emit-value
map-options
option-label="name"
:options="posNoOptions"
option-value="id"
hide-bottom-space
use-input
input-debounce="0"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, '1'
)"
/>
</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="positionId"
:rules="[(val: string) => !!val || `${'กรุณาเลือกตำแหน่ง'}`]"
:label="`${'ตำแหน่ง'}`"
@update:modelValue="clickEditRow"
emit-value
map-options
option-label="name"
:options="positionOptions"
option-value="id"
hide-bottom-space
use-input
input-debounce="0"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, '2'
)"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<!-- :rules="[(val:string) => !!val || `${'กรุณาเลือกด้าน/สาขา'}`]" -->
<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">
<selector
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="positionTypeId"
:rules="[
(val: string) => !!val || `${'กรุณาเลือกตำแหน่งประเภท'}`,
]"
:label="`${'ตำแหน่งประเภท'}`"
@update:modelValue="clickEditRow"
emit-value
map-options
option-label="name"
:options="positionTypeOptions"
option-value="id"
hide-bottom-space
use-input
input-debounce="0"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, '4'
)"
/>
</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">
<selector
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="positionLevelId"
:rules="[(val: string) => !!val || `${'กรุณาเลือกระดับ'}`]"
:label="`${'ระดับ'}`"
@update:modelValue="clickEditRow"
emit-value
map-options
option-label="name"
:options="positionLevelOptions"
option-value="id"
hide-bottom-space
use-input
input-debounce="0"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, '6'
)"
/>
</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="positionExecutiveId"
:label="`${'ตำแหน่งทางการบริหาร'}`"
@update:modelValue="clickEditRow"
emit-value
map-options
option-label="name"
:options="positionExecutiveOptions"
option-value="id"
hide-bottom-space
use-input
input-debounce="0"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, '7'
)"
/>
</div>
<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="amount"
:rules="[(val: string) => !!val || `${'กรุณากรอกเงินเดือน'}`]"
:label="`${'เงินเดือน'}`"
@update:modelValue="clickEditRow"
type="number"
hide-bottom-space
/> -->
<CurrencyInput
v-model="amount"
:edit="edit"
:options="{
currency: 'THB',
}"
:label="`${'เงินเดือน'}`"
:rules="[(val: number) => !!val || `${'กรุณากรอกเงินเดือน'}`]"
/>
<!-- :rules="[(val: string) => !!val || `${'กรุณากรอกเงินเดือน'}`]" -->
</div>
<div class="col-xs-4 col-sm-4 col-md-4">
<CurrencyInput
v-model="positionSalaryAmount"
:edit="edit"
:options="{
currency: 'THB',
}"
:label="`${'เงินประจำตำแหน่ง'}`"
:rules="[(val: number) => !!val || `${'กรุณากรอกเงินประจำตำแหน่ง'}`]"
/>
<!-- <q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="positionSalaryAmount"
:label="`${'เงินประจำตำแหน่ง'}`"
@update:modelValue="clickEditRow"
type="number"
hide-bottom-space
/> -->
</div>
<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="mouthSalaryAmount"
:label="`${'เงินค่าตอบแทนรายเดือน'}`"
@update:modelValue="clickEditRow"
type="number"
hide-bottom-space
/> -->
<CurrencyInput
v-model="mouthSalaryAmount"
:edit="edit"
:options="{
currency: 'THB',
}"
:label="`${'เงินค่าตอบแทนรายเดือน'}`"
:rules="[(val: number) => !!val || `${'กรุณากรอกเงินค่าตอบแทนรายเดือน'}`]"
/>
</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="refCommandNo"
hide-bottom-space
:label="`${'เลขที่คำสั่ง'}`"
:rules="[(val: string) => !!val || `${'กรุณากรอกเลขที่คำสั่ง'}`]"
@update:modelValue="clickEditRow"
>
<template v-slot:append>
<q-icon
name="mdi-file"
class="cursor-pointer"
@click="resetFilter"
/>
</template>
</q-input>
</div>
<!-- <div class="col-xs-12 col-sm-12 col-md-12">
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="salaryClass"
:rules="[
(val:string) =>
!!val || `${'กรุณากรอกตำแหน่ง (รายละเอียด)'}`,
]"
:label="`${'ตำแหน่ง (รายละเอียด)'}`"
@update:modelValue="clickEditRow"
hide-bottom-space
autogrow
>
<template v-slot:append>
<q-btn
color="info"
flat
dense
round
size="14px"
icon="mdi-plus"
@click="templateDetail"
:disable="!edit"
/>
</template>
</q-input>
</div> -->
<div class="row col-xs-12 col-sm-12 col-md-12">
<selector
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="refSelected"
:label="`${'ต้นแบบ (template) เอกสารอ้างอิง'}`"
@update:modelValue="clickEditRowRef"
option-label="name"
:options="refOptions"
option-value="id"
hide-bottom-space
use-input
input-debounce="0"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, '8'
)"
/>
</div>
<div class="col-xs-12 col-sm-12 col-md-12">
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="salaryRef"
:label="`${'เอกสารอ้างอิง'}`"
@update:modelValue="clickEditRow"
type="textarea"
hide-bottom-space
/>
</div>
</div>
</q-scroll-area>
</q-card>
</div>
</div>
</q-card-section>
<q-separator />
<DialogFooter
:cancel="clickCancel"
:edit="clickEdit"
:save="clickSave"
:validate="validateData"
:clickNext="clickNext"
:clickPrevious="clickPrevious"
:clickDelete="clickDelete"
v-model:editvisible="edit"
v-model:next="next"
v-model:previous="previous"
v-model:modalEdit="modalEdit"
/>
</q-form>
</q-card>
</q-dialog>
<HistoryTable
:rows="rowsHistory"
:columns="columnsHistory"
:filter="filterHistory"
:visible-columns="visibleColumnsHistory"
v-model:modal="modalHistory"
v-model:inputfilter="filterHistory"
v-model:inputvisible="visibleColumnsHistory"
v-model:tittle="tittleHistory"
>
<template #columns="props">
<q-tr :props="props">
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div
v-if="col.name == 'date' || col.name == 'createdAt'"
class="table_ellipsis"
>
{{ date2Thai(col.value) }}
</div>
<div
v-else-if="
col.name == 'positionSalaryAmount' ||
col.name == 'mouthSalaryAmount' ||
col.name == 'amount'
"
class="table_ellipsis"
>
{{ col.value == null ? "" : col.value.toLocaleString("en-US") }}
</div>
<div v-else class="table_ellipsis">
{{ col.value }}
</div>
</q-td>
</q-tr>
</template>
</HistoryTable>
</template>
<script setup lang="ts">
import { onMounted, ref, watch } from "vue";
import { useRoute } from "vue-router";
import { useProfileDataStore } from "@/modules/04_registry/store";
import { useCounterMixin } from "@/stores/mixin";
import CurrencyInput from "@/components/CurruncyInput.vue";
import ProfileTable from "@/modules/04_registry/components/Table.vue";
import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue";
import DialogFooter from "@/modules/04_registry/components/DialogFooter.vue";
import { useQuasar } from "quasar";
import type {
RequestItemsObject,
DataProps,
} from "@/modules/04_registry/interface/request/Salary";
import type { ResponseObject } from "@/modules/04_registry/interface/response/Salary";
import type {
DataOption,
treeTab,
} from "@/modules/04_registry/interface/index/Main";
import HistoryTable from "@/components/TableHistory.vue";
import http from "@/plugins/http";
import config from "@/app.config";
import type { QTableProps } from "quasar";
const props = defineProps({
statusEdit: {
type: Boolean,
required: true,
},
});
const $q = useQuasar();
const store = useProfileDataStore();
const { profileData, changeProfileColumns } = store;
const mixin = useCounterMixin();
const {
date2Thai,
success,
dateToISO,
messageError,
showLoader,
hideLoader,
dialogConfirm,
} = mixin;
const route = useRoute();
const id = ref<string>("");
const date = ref<Date>(new Date());
const amount = ref<number | undefined>(0);
// const salary = ref<number | null>(null);
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 positionTypeId = ref<string>();
const positionLevelId = ref<string>();
const positionExecutiveId = ref<string>();
const positionExecutiveSideId = ref<string>();
const posNoId = ref<string>();
const refCommandNo = ref<string>();
const refCommandDate = ref<Date>(new Date());
const ocOptions = ref<DataOption[]>([]);
const positionOptions = ref<DataOption[]>([]);
const positionLineOptions = ref<DataOption[]>([]);
const positionSideOptions = ref<DataOption[]>([]);
const positionTypeOptions = ref<DataOption[]>([]);
const positionLevelOptions = ref<DataOption[]>([]);
const positionExecutiveOptions = ref<DataOption[]>([]);
const positionExecutiveSideOptions = ref<DataOption[]>([]);
const posNoOptions = ref<DataOption[]>([]);
const ocOptionsFilter = ref<DataOption[]>([]);
const positionOptionsFilter = ref<DataOption[]>([]);
const positionLineOptionsFilter = ref<DataOption[]>([]);
const positionSideOptionsFilter = ref<DataOption[]>([]);
const positionTypeOptionsFilter = ref<DataOption[]>([]);
const positionLevelOptionsFilter = ref<DataOption[]>([]);
const positionExecutiveOptionsFilter = ref<DataOption[]>([]);
const positionExecutiveSideOptionsFilter = ref<DataOption[]>([]);
const posNoOptionsFilter = ref<DataOption[]>([]);
const search = ref<string>("");
const expanded = ref<string[]>([]);
const selected = ref<string>("");
const nodesTree = ref<treeTab[]>([]);
const refSelected = ref<DataOption | null>(null);
const refOptions = ref<DataOption[]>([
{
id: "17",
name: "**************** ข้าราชการสามัญ **********************",
disable: true,
},
{
id: "18",
name: "รักษาการในตำแหน่ง {ตำแหน่ง} ตั้งแต่ {วัน} {เดือน} {พ.ศ.} ถึงวันที่ {วัน} {เดือน} {พ.ศ.} คำสั่ง กทม.ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "19",
name: "ช่วยราชการ หน่วนงาน {สังกัด} ตั้งแต่ {วัน} {เดือน} {พ.ศ.} ถึงวันที่ {วัน} {เดือน} {พ.ศ.} คำสั่ง กทม.ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "20",
name: "รับโอน {ตำแหน่งประเภท} จากตำแหน่ง {ตำแหน่ง} ระดับ {ระดับ} สังกัด {สังกัด} ตำแหน่งเลขที่ {ตำแหน่งเลขที่} เงินเดือน {เงินเดือน} เป็นตำแหน่ง {ตำแหน่ง} ระดับ {ระดับ} สังกัด {สังกัด} ตำแหน่งเลขที่ {ตำแหน่งเลขที่} เงินเดือน {เงินเดือน} คำสั่ง กทม.ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "21",
name: "เลื่อนระดับ {ประเภทตำแหน่ง} จาก ตำแหน่งเลขที่ {ตำแหน่งเลขที่เดิม} ตำแหน่ง {ตำแหน่งเดิม} ระดับ {ระดับเดิม} {สำนักเดิม} เงินเดือน {เงินเดือนเดิม} เป็น ตำแหน่งเลขที่ {ตำแหน่งเลขที่ใหม่} ตำแหน่ง {ตำแหน่งใหม่} ระดับ {ระดับใหม่} {สำนักใหม่} เงินเดือน {เงินเดือนใหม่} คำสั่ง กทม.ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "0",
name: "**************** ครู **********************",
disable: true,
},
{
id: "1",
name: "บรรจุและแต่งตั้งผู้ผ่านการคัดเลือกได้วุฒิ {วุฒิ} คำสั่ง กทม. ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "2",
name: "เลื่อนเงินเดือน (1 ขั้น) คำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{ id: "3", name: "ปรับอัตราเงินเดือนครู บัญชีใหม่ {พ.ศ.}" },
{
id: "4",
name: "ปรับให้เข้าระดับและขั้นเงินเดือนตามบัญชีอัตราเงินเดือนข้าราชการพลเรือน บัญชี ก. ท้ายพระราชบัญญัติระเบียบข้าราชการพลเรือน(ฉบับที่6) พ.ศ.{ปี}",
},
{
id: "5",
name: "ปรับอัตราเงินเดือน ตามบัญชี ข. ท้าย พ.ร.บ.ระเบียบข้าราชการพลเรือน(ฉบับที่ ) พ.ศ.{ปี}",
},
{
id: "6",
name: "ปรับเงินเดือนตาม พ.ร.บ.เงินเดือนฯ (ฉบับที่ ) {พ.ศ.} คำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "7",
name: "ปรับเงินเดือนตาม พ.ร.ฎ.การปรับเงินเดือนขั้นต่ำขั้นสูงของข้าราชการสามัญฯ {พ.ศ.} คำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "8",
name: "ปรับอัตราเงินเดือนตามพระราชกฤษฎีกา การปรับอัตราเงินเดือนของข้าราชการ {พ.ศ.}",
},
{
id: "9",
name: "ปรับอัตราเงินเดือนตามหนังสือ ก.ค.ศ.ด่วนมาก ที่ / ลว. 4 ธ.ค. 2555 (ปรับตามคุณวุฒิ) คำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "10",
name: "แต่งตั้งข้าราชการ คำสั่ง คำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "11",
name: "การแต่งตั้งข้าราชการสามัญ กทม.ฯ ตาม พรฎ.ระเบียบข้าราชการสามัญ กทม. พ.ศ. ดำรงตำแหน่งฯ ตาม พรบ.ระเบียบข้าราชการกทม.ฯ พ.ศ. คำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "12",
name: "แต่งตั้งครูผู้ช่วยให้ดำรงตำแหน่งครู คำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "13",
name: "ได้รับเงินเดือนสูงกว่าหรือต่ำกว่าขั้นต่ำฯ คำสั่ง กทม. ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "14",
name: "ได้รับเงินเดือนสูงกว่าขั้นสูงของอันดับและเลื่อนขั้นเงินเดือน คำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "15",
name: "ให้ข้าราชการสามัญ กทม. มีวิทยฐานะ {วิทยฐานะ} และรับเงินเดือนอันดับ {คศ.} คำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{ id: "16", name: "มาตรา 9 แห่ง พรฎ.ระเบียบข้าราชการสามัญ กทม. {พ.ศ}" },
{
id: "21",
name: "**************** ลูกจ้าง **********************",
disable: true,
},
{
id: "22",
name: "จ้างและแต่งตั้งลูกจ้างประจำ คำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "23",
name: "เลื่อนค่าจ้างตามคำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "24",
name: "ได้รับอัตราค่าจ้างสูงกว่าอัตราค่าจ้างขั้นสูงของตำแหน่งที่ได้รับแต่งตั้งในแต่ละระดับ ตามคำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "25",
name: "แก้ไขคำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "26",
name: "ยกเลิกคำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "27",
name: "แต่งตั้งลูกจ้างประจำตามมาตรฐานกำหนดตำแหน่งฯ ตามคำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "28",
name: "แต่งตั้งลูกจ้างประจำ ตามคำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{ id: "29", name: "ไม่เลื่อนขั้นค่าจ้าง เนื่องจาก" },
{
id: "30",
name: "ได้รับเงินตอบแทนพิเศษร้อยละ {} คำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "31",
name: "ปรับอัตราค่าจ้างลูกจ้างประจำกรุงเทพมหานคร ตามข้อบังคับกรุงเทพมหานครว่าด้วยการกำหนดอัตราค่าจ้างขั้นต่ำสุดและสูงสุดของลูกจ้าง พ.ศ. 2557",
},
{
id: "32",
name: "ปรับอัตราค่าจ้างลูกจ้างประจำกรุงเทพมหานครตามข้อบังคับกรุงเทพมหานครว่าด้วยการกำหนดอัตราค่าจ้างขั้นต่ำสุดและสูงสุดของลูกจ้าง (ฉบับที่ {}) พ.ศ. 2557",
},
{
id: "33",
name: "ปรับอัตราค่าจ้าง ตามหนังสือกระทรวงการคลังฯ ที่ กค 0428/ว 47 ลว. 29 พ.ค. 2558 และข้อบังคับ กทม. ว่าด้วยการกำหนดอัตราค่าจ้างฯ ตั้งแต่วันที่ 1 ธ.ค. 2557 ข้อ {} ตามคำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
]);
const refOptionsFilter = ref<DataOption[]>([
{
id: "17",
name: "**************** ข้าราชการสามัญ **********************",
disable: true,
},
{
id: "18",
name: "รักษาการในตำแหน่ง {ตำแหน่ง} ตั้งแต่ {วัน} {เดือน} {พ.ศ.} ถึงวันที่ {วัน} {เดือน} {พ.ศ.} คำสั่ง กทม.ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "19",
name: "ช่วยราชการ หน่วนงาน {สังกัด} ตั้งแต่ {วัน} {เดือน} {พ.ศ.} ถึงวันที่ {วัน} {เดือน} {พ.ศ.} คำสั่ง กทม.ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "20",
name: "รับโอน {ตำแหน่งประเภท} จากตำแหน่ง {ตำแหน่ง} ระดับ {ระดับ} สังกัด {สังกัด} ตำแหน่งเลขที่ {ตำแหน่งเลขที่} เงินเดือน {เงินเดือน} เป็นตำแหน่ง {ตำแหน่ง} ระดับ {ระดับ} สังกัด {สังกัด} ตำแหน่งเลขที่ {ตำแหน่งเลขที่} เงินเดือน {เงินเดือน} คำสั่ง กทม.ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "0",
name: "**************** ครู **********************",
disable: true,
},
{
id: "1",
name: "บรรจุและแต่งตั้งผู้ผ่านการคัดเลือกได้วุฒิ {วุฒิ} คำสั่ง กทม. ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "2",
name: "เลื่อนเงินเดือน (1 ขั้น) คำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{ id: "3", name: "ปรับอัตราเงินเดือนครู บัญชีใหม่ {พ.ศ.}" },
{
id: "4",
name: "ปรับให้เข้าระดับและขั้นเงินเดือนตามบัญชีอัตราเงินเดือนข้าราชการพลเรือน บัญชี ก. ท้ายพระราชบัญญัติระเบียบข้าราชการพลเรือน(ฉบับที่6) พ.ศ.{ปี}",
},
{
id: "5",
name: "ปรับอัตราเงินเดือน ตามบัญชี ข. ท้าย พ.ร.บ.ระเบียบข้าราชการพลเรือน(ฉบับที่ ) พ.ศ.{ปี}",
},
{
id: "6",
name: "ปรับเงินเดือนตาม พ.ร.บ.เงินเดือนฯ (ฉบับที่ ) {พ.ศ.} คำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "7",
name: "ปรับเงินเดือนตาม พ.ร.ฎ.การปรับเงินเดือนขั้นต่ำขั้นสูงของข้าราชการสามัญฯ {พ.ศ.} คำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "8",
name: "ปรับอัตราเงินเดือนตามพระราชกฤษฎีกา การปรับอัตราเงินเดือนของข้าราชการ {พ.ศ.}",
},
{
id: "9",
name: "ปรับอัตราเงินเดือนตามหนังสือ ก.ค.ศ.ด่วนมาก ที่ / ลว. 4 ธ.ค. 2555 (ปรับตามคุณวุฒิ) คำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "10",
name: "แต่งตั้งข้าราชการ คำสั่ง คำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "11",
name: "การแต่งตั้งข้าราชการสามัญ กทม.ฯ ตาม พรฎ.ระเบียบข้าราชการสามัญ กทม. พ.ศ. ดำรงตำแหน่งฯ ตาม พรบ.ระเบียบข้าราชการกทม.ฯ พ.ศ. คำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "12",
name: "แต่งตั้งครูผู้ช่วยให้ดำรงตำแหน่งครู คำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "13",
name: "ได้รับเงินเดือนสูงกว่าหรือต่ำกว่าขั้นต่ำฯ คำสั่ง กทม. ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "14",
name: "ได้รับเงินเดือนสูงกว่าขั้นสูงของอันดับและเลื่อนขั้นเงินเดือน คำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "15",
name: "ให้ข้าราชการสามัญ กทม. มีวิทยฐานะ {วิทยฐานะ} และรับเงินเดือนอันดับ {คศ.} คำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{ id: "16", name: "มาตรา 9 แห่ง พรฎ.ระเบียบข้าราชการสามัญ กทม. {พ.ศ}" },
{
id: "21",
name: "**************** ลูกจ้าง **********************",
disable: true,
},
{
id: "22",
name: "จ้างและแต่งตั้งลูกจ้างประจำ คำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "23",
name: "เลื่อนค่าจ้างตามคำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "24",
name: "ได้รับอัตราค่าจ้างสูงกว่าอัตราค่าจ้างขั้นสูงของตำแหน่งที่ได้รับแต่งตั้งในแต่ละระดับ ตามคำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "25",
name: "แก้ไขคำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "26",
name: "ยกเลิกคำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "27",
name: "แต่งตั้งลูกจ้างประจำตามมาตรฐานกำหนดตำแหน่งฯ ตามคำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "28",
name: "แต่งตั้งลูกจ้างประจำ ตามคำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{ id: "29", name: "ไม่เลื่อนขั้นค่าจ้าง เนื่องจาก" },
{
id: "30",
name: "ได้รับเงินตอบแทนพิเศษร้อยละ {} คำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "31",
name: "ปรับอัตราค่าจ้างลูกจ้างประจำกรุงเทพมหานคร ตามข้อบังคับกรุงเทพมหานครว่าด้วยการกำหนดอัตราค่าจ้างขั้นต่ำสุดและสูงสุดของลูกจ้าง พ.ศ. 2557",
},
{
id: "32",
name: "ปรับอัตราค่าจ้างลูกจ้างประจำกรุงเทพมหานครตามข้อบังคับกรุงเทพมหานครว่าด้วยการกำหนดอัตราค่าจ้างขั้นต่ำสุดและสูงสุดของลูกจ้าง (ฉบับที่ {}) พ.ศ. 2557",
},
{
id: "33",
name: "ปรับอัตราค่าจ้าง ตามหนังสือกระทรวงการคลังฯ ที่ กค 0428/ว 47 ลว. 29 พ.ค. 2558 และข้อบังคับ กทม. ว่าด้วยการกำหนดอัตราค่าจ้างฯ ตั้งแต่วันที่ 1 ธ.ค. 2557 ข้อ {} ตามคำสั่ง {สนข.} ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
]);
const salaryClass = ref<string>();
const salaryRef = ref<string>();
const myForm = ref<any>(); //form data input
const edit = ref<boolean>(false); //เช็คการกดปุ่มแก้ไขใน dialog
const modal = ref<boolean>(false); //modal add detail
const modalEdit = ref<boolean>(false); //modal ที่แสดงใช้สำหรับแก้ไขหรือไม่
const rawItem = ref<RequestItemsObject>(); //ข้อมูลเดิมที่เลือกใน row นั้น
const rowIndex = ref<number>(0); //indexข้อมูลเดิมที่เลือกใน row นั้น
const previous = ref<boolean>(); //แสดงปุ่มดูข้อมูลก่อนหน้า
const next = ref<boolean>(); //แสดงปุ่มดูข้อมูลต่อไป
const editRow = ref<boolean>(false); //เช็คมีการแก้ไขข้อมูล
const rowsHistory = ref<RequestItemsObject[]>([]); //select data history
const tittleHistory = ref<string>("ประวัติแก้ไขตำแหน่ง/เงินเดือน"); //
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal ประวัติการแก้ไขข้อมูล
const checkValidate = ref<boolean>(false); //validate data ผ่านหรือไม่
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
profileData.salary.columns.length == 0
? (visibleColumns.value = [
"date",
"amount",
"positionSalaryAmount",
"mouthSalaryAmount",
"oc",
"position",
"posNo",
"positionLine",
"positionPathSide",
"positionType",
"positionLevel",
"positionExecutive",
"positionExecutiveSide",
"salaryClass",
"salaryRef",
"refCommandNo",
])
: (visibleColumns.value = profileData.salary.columns);
const columns = ref<QTableProps["columns"]>([
{
name: "date",
align: "left",
label: "วัน เดือน ปี",
sortable: true,
field: "date",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "amount",
align: "left",
label: "เงินเดือน",
sortable: true,
field: "amount",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "positionSalaryAmount",
align: "left",
label: "เงินประจำตำแหน่ง",
sortable: true,
field: "positionSalaryAmount",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "mouthSalaryAmount",
align: "left",
label: "เงินค่าตอบแทนรายเดือน",
sortable: true,
field: "mouthSalaryAmount",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "oc",
align: "left",
label: "สังกัด",
sortable: true,
field: "oc",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "position",
align: "left",
label: "ตำแหน่ง",
sortable: true,
field: "position",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "posNo",
align: "left",
label: "ตำแหน่งเลขที่",
sortable: true,
field: "posNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "positionLine",
align: "left",
label: "สายงาน",
sortable: true,
field: "positionLine",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "positionPathSide",
align: "left",
label: "ด้าน/สาขา",
sortable: true,
field: "positionPathSide",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "positionType",
align: "left",
label: "ตำแหน่งประเภท",
sortable: true,
field: "positionType",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "positionLevel",
align: "left",
label: "ระดับ",
sortable: true,
field: "positionLevel",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "positionExecutive",
align: "left",
label: "ตำแหน่งทางการบริหาร",
sortable: true,
field: "positionExecutive",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "positionExecutiveSide",
align: "left",
label: "ด้านทางการบริหาร",
sortable: true,
field: "positionExecutiveSide",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "salaryClass",
align: "left",
label: "ตำแหน่ง (รายละเอียด)",
sortable: true,
field: "salaryClass",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "salaryRef",
align: "left",
label: "เอกสารอ้างอิง",
sortable: true,
field: "salaryRef",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refCommandNo",
align: "left",
label: "เลขที่คำสั่ง",
sortable: true,
field: "refCommandNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const columnsHistory = ref<QTableProps["columns"]>([
{
name: "date",
align: "left",
label: "วัน เดือน ปี",
sortable: true,
field: "date",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "amount",
align: "left",
label: "เงินเดือน",
sortable: true,
field: "amount",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "positionSalaryAmount",
align: "left",
label: "เงินประจำตำแหน่ง",
sortable: true,
field: "positionSalaryAmount",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "mouthSalaryAmount",
align: "left",
label: "เงินค่าตอบแทนรายเดือน",
sortable: true,
field: "mouthSalaryAmount",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "oc",
align: "left",
label: "สังกัด",
sortable: true,
field: "oc",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "position",
align: "left",
label: "ตำแหน่ง",
sortable: true,
field: "position",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "posNo",
align: "left",
label: "ตำแหน่งเลขที่",
sortable: true,
field: "posNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "positionLine",
align: "left",
label: "สายงาน",
sortable: true,
field: "positionLine",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "positionPathSide",
align: "left",
label: "ด้าน/สาขา",
sortable: true,
field: "positionPathSide",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "positionType",
align: "left",
label: "ตำแหน่งประเภท",
sortable: true,
field: "positionType",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "positionLevel",
align: "left",
label: "ระดับ",
sortable: true,
field: "positionLevel",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "positionExecutive",
align: "left",
label: "ตำแหน่งทางการบริหาร",
sortable: true,
field: "positionExecutive",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "positionExecutiveSide",
align: "left",
label: "ด้านทางการบริหาร",
sortable: true,
field: "positionExecutiveSide",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "salaryClass",
align: "left",
label: "ตำแหน่ง (รายละเอียด)",
sortable: true,
field: "salaryClass",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "salaryRef",
align: "left",
label: "เอกสารอ้างอิง",
sortable: true,
field: "salaryRef",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refCommandNo",
align: "left",
label: "เลขที่คำสั่ง",
sortable: true,
field: "refCommandNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "createdFullName",
align: "left",
label: "ผู้ดำเนินการ",
sortable: true,
field: "createdFullName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "createdAt",
align: "left",
label: "วันที่แก้ไข",
sortable: true,
field: "createdAt",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumnsHistory = ref<String[]>([
"date",
"amount",
"positionSalaryAmount",
"mouthSalaryAmount",
"oc",
"position",
"posNo",
"positionLine",
"positionPathSide",
"positionType",
"positionLevel",
"positionExecutive",
"positionExecutiveSide",
"salaryClass",
"salaryRef",
"refCommandNo",
"createdFullName",
"createdAt",
]);
watch(visibleColumns, async (count: String[], prevCount: String[]) => {
await changeProfileColumns("salary", count);
});
onMounted(async () => {
await fetchPosition();
await nodeTree();
await fetchData();
});
const filterSelector = (val: any, update: Function, filtername: string) => {
switch (filtername) {
case "1":
update(() => {
posNoOptions.value = posNoOptionsFilter.value.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
break;
case "2":
update(() => {
positionOptions.value = positionOptionsFilter.value.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
break;
case "3":
update(() => {
positionSideOptions.value = positionSideOptionsFilter.value.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
break;
case "4":
update(() => {
positionTypeOptions.value = positionTypeOptionsFilter.value.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
break;
case "5":
update(() => {
positionLineOptions.value = positionLineOptionsFilter.value.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
break;
case "6":
update(() => {
positionLevelOptions.value = positionLevelOptionsFilter.value.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
break;
case "7":
update(() => {
positionExecutiveOptions.value =
positionExecutiveOptionsFilter.value.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
break;
case "8":
update(() => {
refOptions.value = refOptionsFilter.value.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
break;
default:
break;
}
};
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(() => {
hideLoader();
});
};
/**
* get รายการ ตำแหน่ง
*/
const fetchPosition = async () => {
showLoader();
await http
.get(config.API.position)
.then((res) => {
const data = res.data.result;
let optionpositionpaths: DataOption[] = [];
data.positionPaths.map((r: any) => {
optionpositionpaths.push({
id: r.id.toString(),
name: r.name.toString(),
});
});
positionOptions.value = optionpositionpaths;
positionOptionsFilter.value = optionpositionpaths;
let optionPositionPathSides: DataOption[] = [];
data.positionPathSides.map((r: any) => {
optionPositionPathSides.push({
id: r.id.toString(),
name: r.name.toString(),
});
});
positionSideOptions.value = optionPositionPathSides;
positionSideOptionsFilter.value = optionPositionPathSides;
let optionPositionTypes: DataOption[] = [];
data.positionTypes.map((r: any) => {
optionPositionTypes.push({
id: r.id.toString(),
name: r.name.toString(),
});
});
positionTypeOptions.value = optionPositionTypes;
positionTypeOptionsFilter.value = optionPositionTypes;
let optionPositionLines: DataOption[] = [];
data.positionLines.map((r: any) => {
optionPositionLines.push({
id: r.id.toString(),
name: r.name.toString(),
});
});
positionLineOptions.value = optionPositionLines;
positionLineOptionsFilter.value = optionPositionLines;
let optionPositionExecutives: DataOption[] = [];
data.positionExecutives.map((r: any) => {
optionPositionExecutives.push({
id: r.id.toString(),
name: r.name.toString(),
});
});
positionExecutiveOptions.value = optionPositionExecutives;
positionExecutiveOptionsFilter.value = optionPositionExecutives;
let optionPositionExecutiveSides: DataOption[] = [];
data.positionExecutiveSides.map((r: any) => {
optionPositionExecutiveSides.push({
id: r.id.toString(),
name: r.name.toString(),
});
});
positionExecutiveSideOptions.value = optionPositionExecutiveSides;
positionExecutiveSideOptionsFilter.value = optionPositionExecutiveSides;
let optionPositionLevels: DataOption[] = [];
data.positionLevels.map((r: any) => {
optionPositionLevels.push({
id: r.id.toString(),
name: r.name.toString(),
});
});
positionLevelOptions.value = optionPositionLevels;
positionLevelOptionsFilter.value = optionPositionLevels;
})
.catch((e: any) => {})
.finally(() => {
hideLoader();
});
};
const fetchData = async () => {
if (profileId.value) {
showLoader();
await http
.get(config.API.profileSalaryId(profileId.value))
.then((res) => {
let data = res.data.result;
console.log(data);
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
date: new Date(e.date),
amount: e.amount,
positionSalaryAmount: e.positionSalaryAmount,
mouthSalaryAmount: e.mouthSalaryAmount,
oc: e.oc,
ocId: e.ocId,
position: e.position,
positionId:
e.positionId !== "00000000-0000-0000-0000-000000000000"
? e.positionId
: "",
posNo: e.posNo,
posNoId:
e.posNoId !== "00000000-0000-0000-0000-000000000000"
? e.posNoId
: "",
positionLine: e.positionLine,
positionLineId: e.positionLineId,
positionPathSide: e.positionPathSide,
positionPathSideId: e.positionPathSideId,
positionType: e.positionType,
positionTypeId: e.positionTypeId,
positionLevel: e.positionLevel,
positionLevelId: e.positionLevelId,
positionExecutive: e.positionExecutive,
positionExecutiveId: e.positionExecutiveId,
positionExecutiveSide: e.positionExecutiveSide,
positionExecutiveSideId: e.positionExecutiveSideId,
salaryClass: e.salaryClass,
salaryRef: e.salaryRef,
salaryStatus: e.salaryStatus,
refCommandNo: e.refCommandNo,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
};
const onSelected = async (id: string) => {
await fetchPositionNumber(id);
};
const fetchOrganization = async (id: string) => {
if (selected.value != "") {
showLoader();
await http
.get(config.API.organizationName(id))
.then((res) => {
let data = res.data.result;
ocId.value = data;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
};
const fetchPositionNumber = async (id: string) => {
showLoader();
await http
.get(config.API.getPositionNumberIdByOcId(id))
.then((res) => {
const data = res.data.result;
let option: DataOption[] = [];
data.map((r: DataOption) => {
option.push({ id: r.id.toString(), name: r.name.toString() });
});
posNoOptions.value = option;
posNoOptionsFilter.value = option;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
/**
* กดดูข้อมูลก่อนหน้า
*/
const clickPrevious = async () => {
edit.value = false;
rowIndex.value -= 1;
await getData();
await checkRowPage();
};
/**
* กดดูข้อมูลต่อไป
*/
const clickNext = async () => {
edit.value = false;
rowIndex.value += 1;
await getData();
await checkRowPage();
};
/**
* กดดูข้อมูลต่อไป
*/
const getData = async () => {
const row = rows.value[rowIndex.value];
date.value = row.date;
amount.value = row.amount;
positionSalaryAmount.value = row.positionSalaryAmount;
mouthSalaryAmount.value = row.mouthSalaryAmount;
await onSelected(row.ocId);
selected.value = row.ocId;
positionId.value = row.positionId;
posNoId.value = row.posNoId;
positionLineId.value = row.positionLineId;
positionPathSideId.value = row.positionPathSideId;
positionTypeId.value = row.positionTypeId;
positionLevelId.value = row.positionLevelId;
positionExecutiveId.value = row.positionExecutiveId;
positionExecutiveSideId.value = row.positionExecutiveSideId;
salaryClass.value = row.salaryClass;
salaryRef.value = row.salaryRef;
refCommandNo.value = row.refCommandNo;
id.value = row.id;
await fetchPositionNumber(row.ocId);
};
/**
* เช็คปุ่มดูข้อมูล ย้อน กับ ต่อไป ว่าต้องแสดงไหม
*/
const checkRowPage = () => {
editRow.value = false;
next.value = true;
previous.value = true;
if (rowIndex.value + 1 >= rows.value.length) {
next.value = false;
}
if (rowIndex.value - 1 < 0) {
previous.value = false;
}
};
/**
* กดปุ่มแก้ไขใน dialog
*/
const clickEdit = () => {
editRow.value = false;
next.value = false;
previous.value = false;
};
/**
* กดปุ่มเพิ่มด้านบน table
*/
const clickAdd = async () => {
editRow.value = false;
await addData();
};
/**
* gen ตำแหน่ง (รายละเอียด)
*/
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 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 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 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} `;
}
};
/**
* กดบันทึกใน dialog
*/
const clickSave = async () => {
// if (amount.value == 0) {
// amount.value = null;
// } else if (positionSalaryAmount.value == 0) {
// positionSalaryAmount.value = null;
// } else if (mouthSalaryAmount.value == 0) {
// mouthSalaryAmount.value = null;
// }
myForm.value.validate().then(async (result: boolean) => {
if (result) {
if (modalEdit.value) {
dialogConfirm(
$q,
async () => {
await editData();
},
"ยืนยันการแก้ไขข้อมูล",
"ต้องการยืนยันการแก้ไขข้อมูลนี้หรือไม่ ?"
);
} else {
dialogConfirm(
$q,
async () => {
await saveData();
},
"ยืนยันการเพิ่มข้อมูล",
"ต้องการยืนยันการเพิ่มข้อมูลนี้หรือไม่ ?"
);
}
}
});
};
/**
* บันทึกเพิ่มข้อมูล
*/
const saveData = async () => {
if (profileId.value) {
showLoader();
await http
.post(config.API.profileSalaryId(profileId.value), {
date: dateToISO(date.value),
amount: amount.value,
positionSalaryAmount: positionSalaryAmount.value,
mouthSalaryAmount: mouthSalaryAmount.value,
ocId: selected.value,
positionId: positionId.value,
posNoId: posNoId.value,
positionLineId: positionLineId.value,
positionPathSideId: positionPathSideId.value,
positionTypeId: positionTypeId.value,
positionLevelId: positionLevelId.value,
positionExecutiveId: positionExecutiveId.value,
positionExecutiveSideId: positionExecutiveSideId.value,
salaryClass: salaryClass.value,
salaryRef: salaryRef.value,
refCommandNo: refCommandNo.value,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
}
};
/**
* บันทึกแก้ไขข้อมูล
*/
const editData = async () => {
showLoader();
await http
.put(config.API.profileSalaryId(id.value), {
date: dateToISO(date.value),
amount: amount.value,
positionSalaryAmount: positionSalaryAmount.value,
mouthSalaryAmount: mouthSalaryAmount.value,
ocId: selected.value,
positionId: positionId.value,
posNoId: posNoId.value,
positionLineId: positionLineId.value,
positionPathSideId: positionPathSideId.value,
positionTypeId: positionTypeId.value,
positionLevelId: positionLevelId.value,
positionExecutiveId: positionExecutiveId.value,
positionExecutiveSideId: positionExecutiveSideId.value,
salaryClass: salaryClass.value,
salaryRef: salaryRef.value,
refCommandNo: refCommandNo.value,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
};
/**
* ลบลบข้อมูล
*/
const clickDelete = async () => {
$q.dialog({
title: `ลบข้อมูล`,
message: `ต้องการทำการลบข้อมูลนี้ใช่หรือไม่?`,
cancel: "ยกเลิก",
ok: "ยืนยัน",
persistent: true,
})
.onOk(async () => {
showLoader();
await http
.delete(config.API.profileSalaryId(id.value))
.then((res) => {
success($q, "ลบข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
})
.onCancel(async () => {
await fetchData();
});
};
/**
* กดปิด dialog
*/
const clickClose = async () => {
if (editRow.value == true) {
$q.dialog({
title: `ข้อมูลมีการแก้ไข`,
message: `ยืนยันที่จะปิดโดยไม่บันทึกใช่หรือไม่?`,
cancel: "ยกเลิก",
ok: "ยืนยัน",
persistent: true,
}).onOk(async () => {
modal.value = false;
next.value = false;
previous.value = false;
});
} else {
modal.value = false;
next.value = false;
previous.value = false;
}
};
/**
* กดเลือกข้อมูลที่จะแก้ไข
* @param props ค่า props ใน row ที่เลือก
*/
const selectData = async (props: DataProps) => {
modalEdit.value = true;
modal.value = true;
edit.value = false;
rawItem.value = props.row;
rowIndex.value = props.rowIndex;
date.value = props.row.date;
amount.value = props.row.amount;
positionSalaryAmount.value = props.row.positionSalaryAmount;
mouthSalaryAmount.value = props.row.mouthSalaryAmount;
await onSelected(props.row.ocId);
selected.value = props.row.ocId;
positionId.value = props.row.positionId;
posNoId.value = props.row.posNoId;
positionLineId.value = props.row.positionLineId;
positionPathSideId.value = props.row.positionPathSideId;
positionTypeId.value = props.row.positionTypeId;
positionLevelId.value = props.row.positionLevelId;
positionExecutiveId.value = props.row.positionExecutiveId;
positionExecutiveSideId.value = props.row.positionExecutiveSideId;
salaryClass.value = props.row.salaryClass;
salaryRef.value = props.row.salaryRef;
refCommandNo.value = props.row.refCommandNo;
id.value = props.row.id;
await checkRowPage();
};
/**
* กดปุ่มเพิ่มบน table
*/
const addData = () => {
selected.value = "";
modalEdit.value = false;
modal.value = true;
edit.value = true;
date.value = new Date();
date.value = new Date();
amount.value = undefined;
positionSalaryAmount.value = undefined;
mouthSalaryAmount.value = undefined;
ocId.value = "";
positionId.value = "";
posNoId.value = "";
positionLineId.value = "";
positionPathSideId.value = "";
positionTypeId.value = "";
positionLevelId.value = "";
positionExecutiveId.value = "";
positionExecutiveSideId.value = "";
salaryClass.value = "";
refSelected.value = null;
salaryRef.value = "";
refCommandNo.value = "";
};
/**
* ฟังก์ชันปุ่มยกเลิกการแก้ไขข้อมูล
*/
const clickCancel = async () => {
if (editRow.value == true) {
$q.dialog({
title: `ข้อมูลมีการแก้ไข`,
message: `ยืนยันยกเลิกการแก้ไขใช่หรือไม่?`,
cancel: "ยกเลิก",
ok: "ยืนยัน",
persistent: true,
}).onOk(async () => {
edit.value = false;
await checkRowPage();
await getData();
});
} else {
edit.value = false;
await checkRowPage();
}
};
/**
* เช็คว่ามีการแก้ไขข้อมูล
*/
const clickEditRow = () => {
editRow.value = true;
};
/**
* เช็คว่ามีการแก้ไขข้อมูล
*/
const clickEditRowRef = () => {
editRow.value = true;
salaryRef.value = refSelected.value?.name;
};
/**
* ฟังชั้นดูข้อมูลประวัติแก้ไขข้อมูลที่เลือก
* @param row ข้อมูล row ที่ดูประวัติการแก้ไข
*/
const clickHistory = async (row: RequestItemsObject) => {
modalHistory.value = true;
showLoader();
await http
.get(config.API.profileSalaryHisId(row.id))
.then((res) => {
let data = res.data.result;
rowsHistory.value = [];
data.map((e: ResponseObject) => {
rowsHistory.value.push({
id: e.id,
date: new Date(e.date),
amount: e.amount,
positionSalaryAmount: e.positionSalaryAmount,
mouthSalaryAmount: e.mouthSalaryAmount,
oc: e.oc,
ocId: e.ocId,
position: e.position,
positionId: e.positionId,
posNo: e.posNo,
posNoId: e.posNoId,
positionLine: e.positionLine,
positionLineId: e.positionLineId,
positionPathSide: e.positionPathSide,
positionPathSideId: e.positionPathSideId,
positionType: e.positionType,
positionTypeId: e.positionTypeId,
positionLevel: e.positionLevel,
positionLevelId: e.positionLevelId,
positionExecutive: e.positionExecutive,
positionExecutiveId: e.positionExecutiveId,
positionExecutiveSide: e.positionExecutiveSide,
positionExecutiveSideId: e.positionExecutiveSideId,
salaryClass: e.salaryClass,
salaryStatus: e.salaryStatus,
salaryRef: e.salaryRef,
refCommandNo: e.refCommandNo,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
/**
* validate input ใน dialog
*/
const validateData = async () => {
checkValidate.value = true;
await myForm.value.validate().then((result: boolean) => {
if (result == false) {
checkValidate.value = false;
}
});
};
/**
* class จัดรูปแบบแสดงระหว่างข้อมูลที่แก้ไขหรือแสดงเฉยๆ
* @param val ข้อมูล input สำหรับแก้ไขหรือไม่
*/
const getClass = (val: boolean) => {
return {
"full-width inputgreen cursor-pointer": val,
"full-width cursor-pointer": !val,
};
};
const resetFilter = () => {};
</script>
<style lang="scss">
.modalfix {
position: fixed !important;
}
</style>