Merge branch 'Nice' into develop
This commit is contained in:
commit
d50f7ddf8e
4 changed files with 171 additions and 34 deletions
|
|
@ -21,6 +21,7 @@ interface FormDataSalary {
|
|||
positionLine: string; // สายงาน
|
||||
positionPathSide: string; //ด้าน/สาขา
|
||||
positionExecutive: string; //ตำแหน่งทางการบริหาร
|
||||
positionExecutiveField: string; //ด้านทางการบริหาร
|
||||
amount: number | null; //เงินเดือน
|
||||
amountSpecial: number | null; //เงินค่าตอบแทนพิเศษ
|
||||
positionSalaryAmount: number | null; //เงินประจำตำแหน่ง
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
import { ref, reactive, onMounted, nextTick, watch } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import { useRoute } from "vue-router";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useEditPosDataStore } from "@/modules/04_registryPerson/stores/Edit";
|
||||
import http from "@/plugins/http";
|
||||
|
|
@ -22,6 +23,7 @@ import DialogHeader from "@/components/DialogHeader.vue";
|
|||
import FormPosition from "@/modules/04_registryPerson/views/edit/components/FormPosition.vue";
|
||||
|
||||
const $q = useQuasar();
|
||||
const route = useRoute();
|
||||
const {
|
||||
dialogConfirm,
|
||||
showLoader,
|
||||
|
|
@ -32,10 +34,13 @@ const {
|
|||
} = useCounterMixin();
|
||||
const store = useEditPosDataStore();
|
||||
|
||||
const profileId = ref<string>(route.params.id.toString());
|
||||
|
||||
const modal = defineModel<boolean>("modal", { required: true });
|
||||
const empType = defineModel<string>("empType", { required: true });
|
||||
const rowData = defineModel<DataPosition[]>("rowData", { required: true });
|
||||
const rowIndex = defineModel<number>("rowIndex", { required: true });
|
||||
const isAddPosition = defineModel<boolean>("isAddPosition", { required: true });
|
||||
|
||||
const props = defineProps({
|
||||
fetchData: { type: Function, required: true },
|
||||
|
|
@ -56,6 +61,7 @@ const formData = reactive<FormDataSalary>({
|
|||
positionLine: "", // สายงาน
|
||||
positionPathSide: "", //ด้าน/สาขา
|
||||
positionExecutive: "", //ตำแหน่งทางการบริหาร
|
||||
positionExecutiveField: "", //ด้านทางการบริหาร
|
||||
amount: null, //เงินเดือน
|
||||
amountSpecial: null, //เงินค่าตอบแทนพิเศษ
|
||||
positionSalaryAmount: null, //เงินประจำตำแหน่ง
|
||||
|
|
@ -84,6 +90,7 @@ const formReadonly = reactive<FormDataSalary>({
|
|||
positionLine: "", // สายงาน
|
||||
positionPathSide: "", //ด้าน/สาขา
|
||||
positionExecutive: "", //ตำแหน่งทางการบริหาร
|
||||
positionExecutiveField: "", //ด้านทางการบริหาร
|
||||
amount: null, //เงินเดือน
|
||||
amountSpecial: null, //เงินค่าตอบแทนพิเศษ
|
||||
positionSalaryAmount: null, //เงินประจำตำแหน่ง
|
||||
|
|
@ -249,14 +256,10 @@ async function fetchDataOptionExecutive() {
|
|||
* @param status แก่ไข , เพิ่ม
|
||||
*/
|
||||
async function updateSelectType(val: string, status: boolean = false) {
|
||||
console.log(val);
|
||||
console.log(dataLevel.value);
|
||||
|
||||
const listLevel = val
|
||||
? dataLevel.value.find((e: DataPosType) => e.posTypeName === val)
|
||||
: null;
|
||||
|
||||
console.log("เช็คประเภทตำแหน่งงาน", listLevel);
|
||||
// เช็คประเภทตำแหน่งงาน
|
||||
if (listLevel) {
|
||||
store.posLevelData = listLevel.posLevels.map((e: DataPosLevel) => ({
|
||||
|
|
@ -308,6 +311,7 @@ async function onDefineData(index: number) {
|
|||
formData.positionLine = salaryNew.positionLine;
|
||||
formData.positionPathSide = salaryNew.positionPathSide;
|
||||
formData.positionExecutive = salaryNew.positionExecutive;
|
||||
formData.positionExecutiveField = salaryNew.positionExecutiveField;
|
||||
formData.amount = salaryNew.amount;
|
||||
formData.amountSpecial = salaryNew.amountSpecial;
|
||||
formData.positionSalaryAmount = salaryNew.positionSalaryAmount;
|
||||
|
|
@ -335,6 +339,7 @@ async function onDefineData(index: number) {
|
|||
formReadonly.positionLine = salaryOld.positionLine;
|
||||
formReadonly.positionPathSide = salaryOld.positionPathSide;
|
||||
formReadonly.positionExecutive = salaryOld.positionExecutive;
|
||||
formReadonly.positionExecutiveField = salaryOld.positionExecutiveField;
|
||||
formReadonly.amount = salaryOld.amount;
|
||||
formReadonly.positionSalaryAmount = salaryOld.positionSalaryAmount;
|
||||
formReadonly.mouthSalaryAmount = salaryOld.mouthSalaryAmount;
|
||||
|
|
@ -357,31 +362,95 @@ async function onNavigateRow(action: string) {
|
|||
|
||||
function onClickCloseDialog() {
|
||||
modal.value = false;
|
||||
formData.commandCode = "";
|
||||
formData.commandNo = "";
|
||||
formData.commandYear = null;
|
||||
formData.commandDateAffect = null;
|
||||
formData.commandDateSign = null;
|
||||
formData.posNoAbb = "";
|
||||
formData.posNo = "";
|
||||
formData.positionName = "";
|
||||
formData.positionType = "";
|
||||
formData.positionLevel = "";
|
||||
formData.positionCee = "";
|
||||
formData.positionLine = "";
|
||||
formData.positionPathSide = "";
|
||||
formData.positionExecutive = "";
|
||||
formData.positionExecutiveField = "";
|
||||
formData.amount = null;
|
||||
formData.amountSpecial = null;
|
||||
formData.positionSalaryAmount = null;
|
||||
formData.mouthSalaryAmount = null;
|
||||
formData.orgRoot = "";
|
||||
formData.orgChild1 = "";
|
||||
formData.orgChild2 = "";
|
||||
formData.orgChild3 = "";
|
||||
formData.orgChild4 = "";
|
||||
formData.remark = "";
|
||||
formData.posNumCodeSit = "";
|
||||
formData.posNumCodeSitAbb = "";
|
||||
|
||||
formReadonly.commandCode = "";
|
||||
formReadonly.commandNo = "";
|
||||
formReadonly.commandYear = null;
|
||||
formReadonly.commandDateAffect = null;
|
||||
formReadonly.commandDateSign = null;
|
||||
formReadonly.posNoAbb = "";
|
||||
formReadonly.posNo = "";
|
||||
formReadonly.positionName = "";
|
||||
formReadonly.positionType = "";
|
||||
formReadonly.positionLevel = "";
|
||||
formReadonly.positionCee = "";
|
||||
formReadonly.positionLine = "";
|
||||
formReadonly.positionPathSide = "";
|
||||
formReadonly.positionExecutive = "";
|
||||
formReadonly.positionExecutiveField = "";
|
||||
formReadonly.amount = null;
|
||||
formReadonly.positionSalaryAmount = null;
|
||||
formReadonly.mouthSalaryAmount = null;
|
||||
formReadonly.orgRoot = "";
|
||||
formReadonly.orgChild1 = "";
|
||||
formReadonly.orgChild2 = "";
|
||||
formReadonly.orgChild3 = "";
|
||||
formReadonly.orgChild4 = "";
|
||||
formReadonly.remark = "";
|
||||
formReadonly.posNumCodeSit = "";
|
||||
formReadonly.posNumCodeSitAbb = "";
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
console.log(formData);
|
||||
dialogConfirm($q, async () => {
|
||||
showLoader();
|
||||
await http
|
||||
.patch(config.API.salaryTemp + `/${salaryId.value}`, {
|
||||
...formData,
|
||||
type: empType.value?.toLocaleUpperCase(),
|
||||
commandDateAffect: convertDateToAPI(formData.commandDateAffect),
|
||||
commandDateSign: convertDateToAPI(formData.commandDateSign),
|
||||
amount: formData.amount
|
||||
? Number(String(formData.amount)?.replace(/,/g, ""))
|
||||
: null,
|
||||
amountSpecial: formData.amountSpecial
|
||||
? Number(String(formData.amountSpecial)?.replace(/,/g, ""))
|
||||
: null,
|
||||
positionSalaryAmount: formData.positionSalaryAmount
|
||||
? Number(String(formData.positionSalaryAmount)?.replace(/,/g, ""))
|
||||
: null,
|
||||
mouthSalaryAmount: formData.mouthSalaryAmount
|
||||
? Number(String(formData.mouthSalaryAmount)?.replace(/,/g, ""))
|
||||
: null,
|
||||
})
|
||||
const path = isAddPosition.value
|
||||
? config.API.salaryTemp
|
||||
: config.API.salaryTemp + `/${salaryId.value}`;
|
||||
const method = isAddPosition.value ? "post" : "patch";
|
||||
await http[method](path, {
|
||||
...formData,
|
||||
profileId:
|
||||
isAddPosition.value && empType.value === "officer"
|
||||
? profileId.value
|
||||
: undefined,
|
||||
profileEmployeeId:
|
||||
isAddPosition.value && empType.value !== "officer"
|
||||
? profileId.value
|
||||
: undefined,
|
||||
type: empType.value?.toLocaleUpperCase(),
|
||||
commandDateAffect: convertDateToAPI(formData.commandDateAffect),
|
||||
commandDateSign: convertDateToAPI(formData.commandDateSign),
|
||||
amount: formData.amount
|
||||
? Number(String(formData.amount)?.replace(/,/g, ""))
|
||||
: null,
|
||||
amountSpecial: formData.amountSpecial
|
||||
? Number(String(formData.amountSpecial)?.replace(/,/g, ""))
|
||||
: null,
|
||||
positionSalaryAmount: formData.positionSalaryAmount
|
||||
? Number(String(formData.positionSalaryAmount)?.replace(/,/g, ""))
|
||||
: null,
|
||||
mouthSalaryAmount: formData.mouthSalaryAmount
|
||||
? Number(String(formData.mouthSalaryAmount)?.replace(/,/g, ""))
|
||||
: null,
|
||||
})
|
||||
.then(async () => {
|
||||
await props.fetchData?.();
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
|
|
@ -415,7 +484,7 @@ watch(modal, async (val) => {
|
|||
posLineOptions.value = store.posLineData;
|
||||
posPathSideOptions.value = store.posPathSideData;
|
||||
posExecutiveOptions.value = store.posExecutiveData;
|
||||
await onDefineData(rowIndex.value);
|
||||
!isAddPosition.value && (await onDefineData(rowIndex.value));
|
||||
hideLoader();
|
||||
}
|
||||
});
|
||||
|
|
@ -426,17 +495,19 @@ onMounted(async () => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<q-dialog v-model="modal" persistent full-width>
|
||||
<q-card>
|
||||
<q-dialog v-model="modal" persistent :full-width="!isAddPosition">
|
||||
<q-card style="min-width: 50%">
|
||||
<q-form greedy @submit.prevent @validation-success="onSubmit">
|
||||
<DialogHeader
|
||||
:tittle="'แก้ไขตำแหน่ง/เงินเดือน'"
|
||||
:tittle="`${
|
||||
isAddPosition ? 'เพิ่มตำแหน่ง/เงินเดือน' : 'แก้ไขตำแหน่ง/เงินเดือน'
|
||||
}`"
|
||||
:close="onClickCloseDialog"
|
||||
/>
|
||||
<q-separator />
|
||||
|
||||
<q-card-section style="padding: 0px">
|
||||
<div class="col-12 row">
|
||||
<div class="col-12 row" v-if="!isAddPosition">
|
||||
<div class="col-xs-12 col-md-6 row no-wrap">
|
||||
<div class="col-12 q-pa-md">
|
||||
<q-card
|
||||
|
|
@ -504,12 +575,29 @@ onMounted(async () => {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12 q-pa-md" v-else>
|
||||
<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"
|
||||
:is-add-position="isAddPosition"
|
||||
/>
|
||||
</div>
|
||||
</q-card-section>
|
||||
|
||||
<q-separator />
|
||||
|
||||
<q-card-actions align="right">
|
||||
<q-btn
|
||||
v-if="!isAddPosition"
|
||||
flat
|
||||
round
|
||||
:disable="rowIndex === 0"
|
||||
|
|
@ -521,6 +609,7 @@ onMounted(async () => {
|
|||
</q-btn>
|
||||
|
||||
<q-btn
|
||||
v-if="!isAddPosition"
|
||||
flat
|
||||
round
|
||||
:disable="rowIndex + 1 === rowData.length"
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ const { date2Thai } = useCounterMixin();
|
|||
const store = useEditPosDataStore();
|
||||
|
||||
const isReadonly = defineModel<boolean>("isReadonly", { required: true });
|
||||
const isAddPosition = defineModel<boolean>("isAddPosition", { default: false });
|
||||
const empType = defineModel<string>("empType", { required: true });
|
||||
const formData = defineModel<FormDataSalary>("formData", { required: true });
|
||||
const commandCodeOptions = defineModel<DataOption[]>("commandCodeOptions", {
|
||||
|
|
@ -106,7 +107,6 @@ function classInput(val: boolean) {
|
|||
<template>
|
||||
<div class="row col-12 q-col-gutter-sm">
|
||||
<div class="col-xs-12 col-sm-6 col-md-8">
|
||||
<!-- :rules="[(val: string) => !!val || 'กรุณาเลือกประเภทคำสั่ง']" -->
|
||||
<q-select
|
||||
outlined
|
||||
:class="classInput(isReadonly)"
|
||||
|
|
@ -120,6 +120,7 @@ function classInput(val: boolean) {
|
|||
map-options
|
||||
option-label="name"
|
||||
:options="commandCodeOptions"
|
||||
:rules="isAddPosition ? [(val: string) => !!val || 'กรุณาเลือกประเภทคำสั่ง'] : []"
|
||||
option-value="id"
|
||||
hide-bottom-space
|
||||
use-input
|
||||
|
|
@ -140,7 +141,6 @@ function classInput(val: boolean) {
|
|||
</div>
|
||||
|
||||
<div class="col-xs-12 col-sm-6 col-md-4">
|
||||
<!-- :rules="[ (val: string) => !!val || `${'กรุณาเลือกวันที่คำสั่งมีผล'}`, ]" -->
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
:readonly="isReadonly"
|
||||
|
|
@ -167,6 +167,7 @@ function classInput(val: boolean) {
|
|||
: null
|
||||
"
|
||||
:label="`${'วันที่คำสั่งมีผล'}`"
|
||||
:rules="isAddPosition ? [ (val: string) => !!val || `${'กรุณาเลือกวันที่คำสั่งมีผล'}`, ] : []"
|
||||
hide-bottom-space
|
||||
clearable
|
||||
@clear="formData.commandDateAffect = null"
|
||||
|
|
@ -222,11 +223,11 @@ function classInput(val: boolean) {
|
|||
v-model="formData.commandNo"
|
||||
hide-bottom-space
|
||||
:label="`${'เลขที่คำสั่ง'}`"
|
||||
:rules="isAddPosition ? [ (val: string) => !!val || `${'กรุณากรอกเลขที่คำสั่ง'}`, ] : []"
|
||||
/>
|
||||
</div>
|
||||
<label class="col-1 flex justify-center items-center">/</label>
|
||||
<div class="col-5">
|
||||
<!-- :rules="[(val:string) => !!val || `${'กรุณากรอก พ.ศ.'}`]" -->
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="formData.commandYear"
|
||||
|
|
@ -253,6 +254,7 @@ function classInput(val: boolean) {
|
|||
: formData.commandYear + 543
|
||||
"
|
||||
:label="`${'พ.ศ.'}`"
|
||||
:rules="isAddPosition ? [(val:string) => !!val || `${'กรุณากรอก พ.ศ.'}`] : []"
|
||||
clearable
|
||||
@clear="formData.commandYear = null"
|
||||
>
|
||||
|
|
@ -272,7 +274,6 @@ function classInput(val: boolean) {
|
|||
</div>
|
||||
|
||||
<div class="col-xs-6 col-sm-6 col-md-4">
|
||||
<!-- :rules="[ (val: string) => !!val || `${'กรุณาเลือก วันที่ลงนาม'}`,]" -->
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="formData.commandDateSign"
|
||||
|
|
@ -299,6 +300,7 @@ function classInput(val: boolean) {
|
|||
: null
|
||||
"
|
||||
:label="`${'วันที่ลงนาม'}`"
|
||||
:rules="isAddPosition ? [ (val: string) => !!val || `${'กรุณาเลือกวันที่ลงนาม'}`, ] : []"
|
||||
hide-bottom-space
|
||||
clearable
|
||||
@clear="formData.commandDateSign = null"
|
||||
|
|
@ -358,6 +360,7 @@ function classInput(val: boolean) {
|
|||
borderless
|
||||
v-model="formData.positionName"
|
||||
:label="empType === 'officer' ? 'ตำแหน่งในสายงาน' : 'ตำแหน่ง'"
|
||||
:rules="isAddPosition ? [(val: string) => !!val || `${empType === 'officer' ? 'ตำแหน่งในสายงาน' : 'ตำแหน่ง'}` ] :[]"
|
||||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
|
|
@ -577,6 +580,20 @@ function classInput(val: boolean) {
|
|||
</q-select> -->
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6 col-sm-6 col-md-4" v-if="empType === 'officer'">
|
||||
<q-input
|
||||
:class="classInput(isReadonly)"
|
||||
:readonly="isReadonly"
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
borderless
|
||||
v-model="formData.positionExecutiveField"
|
||||
hide-bottom-space
|
||||
:label="`${'ด้านทางการบริหาร'}`"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<div class="row q-col-gutter-sm">
|
||||
<div class="col-xs-6 col-sm-6 col-md-4">
|
||||
|
|
|
|||
|
|
@ -118,6 +118,15 @@ const baseColumns = ref<QTableColumn[]>([
|
|||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "positionExecutiveField",
|
||||
align: "left",
|
||||
label: "ด้านทางการบริหาร",
|
||||
sortable: false,
|
||||
field: "positionExecutiveField",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "amount",
|
||||
align: "left",
|
||||
|
|
@ -259,6 +268,7 @@ const visibleColumns = ref<string[]>([
|
|||
"positionType",
|
||||
"positionLevel",
|
||||
"positionExecutive",
|
||||
"positionExecutiveField",
|
||||
"amount",
|
||||
"mouthSalaryAmount",
|
||||
"positionSalaryAmount",
|
||||
|
|
@ -276,7 +286,9 @@ const columns = computed<QTableColumn[]>(() => {
|
|||
return baseColumns.value.filter(
|
||||
(column) =>
|
||||
column.name !== "positionSalaryAmount" &&
|
||||
column.name !== "mouthSalaryAmount"
|
||||
column.name !== "mouthSalaryAmount" &&
|
||||
column.name !== "positionExecutive" &&
|
||||
column.name !== "positionExecutivefield"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -285,6 +297,7 @@ const columns = computed<QTableColumn[]>(() => {
|
|||
|
||||
const modal = ref<boolean>(false);
|
||||
const modalSort = ref<boolean>(false);
|
||||
const isAddPosition = ref<boolean>(true); // สถานะการเพิ่มตำแหน่ง
|
||||
|
||||
/** function fetch ข้อมูลรายการตำแหน่งเงินเดือน*/
|
||||
async function fetchData() {
|
||||
|
|
@ -327,6 +340,8 @@ function serchDataTable() {
|
|||
function onEditData(index: number) {
|
||||
rowIndex.value = index;
|
||||
modal.value = true;
|
||||
isAddPosition.value = index === -1; // ถ้า index เป็น -1 แสดงว่าเป็นการเพิ่มข้อมูลใหม่
|
||||
console.log(`isAddPosition: ${isAddPosition.value}`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -739,6 +754,20 @@ onMounted(async () => {
|
|||
<div class="row q-col-gutter-sm">
|
||||
<div class="col-12">
|
||||
<div class="row q-col-gutter-sm items-center">
|
||||
<q-btn
|
||||
v-if="
|
||||
tabs === 'PENDING' && statusCheckEdit == 'PENDING' && isConfirmEdit
|
||||
"
|
||||
class="q-ml-sm"
|
||||
round
|
||||
flat
|
||||
dense
|
||||
color="primary"
|
||||
icon="add"
|
||||
@click.stop.prevent="onEditData(-1)"
|
||||
>
|
||||
<q-tooltip>จัดลำดับข้อมูล</q-tooltip></q-btn
|
||||
>
|
||||
<q-btn
|
||||
v-if="
|
||||
tabs === 'PENDING' && statusCheckEdit == 'PENDING' && isConfirmEdit
|
||||
|
|
@ -1393,6 +1422,7 @@ onMounted(async () => {
|
|||
:emp-type="empType"
|
||||
:row-data="rows"
|
||||
:fetch-data="fetchData"
|
||||
:is-add-position="isAddPosition"
|
||||
/>
|
||||
|
||||
<DialogSort
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue