แก้ไข get เเละ put temp-information

This commit is contained in:
AnandaTon 2023-09-01 20:04:26 +07:00
parent f194efe064
commit 267f863205
2 changed files with 86 additions and 47 deletions

View file

@ -148,6 +148,19 @@ const defaultInformation: Information = {
profileType: null,
};
const defaultTempInformation: any = {
employeeMoneyIncrease: null,
employeeMoneyAllowance: null,
employeeMoneyEmployee: null,
employeeMoneyEmployer: null,
positionEmployeeGroupId: null,
positionEmployeePositionId: null,
positionEmployeeLineId: null,
employeeTypeIndividual: null,
employeeOc: null,
employeeWage: null,
};
const defaultFamily: Family = {
prefixC: null,
prefixIdC: null,
@ -175,7 +188,13 @@ const defaultFamily: Family = {
childrens: [],
};
export { defaultInformation, defaultFamily, defaultAddress, defaultGoverment };
export {
defaultInformation,
defaultFamily,
defaultAddress,
defaultGoverment,
defaultTempInformation,
};
export type {
ChangeActive,
Information,

View file

@ -22,7 +22,7 @@
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="positionEmployeeGroupId"
v-model="informaTempData.positionEmployeeGroupId"
:label="`${'กลุ่มงาน'}`"
@update:modelValue="!edit"
emit-value
@ -44,7 +44,7 @@
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="positionEmployeeLineId"
v-model="informaTempData.positionEmployeeLineId"
:label="`${'สายงาน'}`"
@update:modelValue="!edit"
emit-value
@ -66,7 +66,7 @@
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="positionEmployeePositionId"
v-model="informaTempData.positionEmployeePositionId"
:label="`${'ชื่อตำแหน่งทางสายงาน'}`"
@update:modelValue="!edit"
emit-value
@ -89,7 +89,7 @@
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="employeeOc"
v-model="informaTempData.employeeOc"
:style="!edit ? '' : 'padding:0 12px;'"
:label="`${'สังกัด'}`"
/>
@ -104,14 +104,14 @@
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="employeeTypeIndividual"
v-model="informaTempData.employeeTypeIndividual"
:style="!edit ? '' : 'padding:0 12px;'"
:label="`${'ประเภทบุคคล'}`"
/>
</div>
<div class="col-xs-6 col-sm-3 col-md-3">
<CurrencyInput
v-model="employeeWage"
v-model="informaTempData.employeeWage"
:edit="edit"
:options="{
currency: 'THB',
@ -121,7 +121,7 @@
</div>
<div class="col-xs-6 col-sm-3 col-md-3">
<CurrencyInput
v-model="employeeMoneyIncrease"
v-model="informaTempData.employeeMoneyIncrease"
:edit="edit"
:options="{
currency: 'THB',
@ -131,7 +131,7 @@
</div>
<div class="col-xs-6 col-sm-3 col-md-3">
<CurrencyInput
v-model="employeeMoneyAllowance"
v-model="informaTempData.employeeMoneyAllowance"
:edit="edit"
:options="{
currency: 'THB',
@ -141,7 +141,7 @@
</div>
<div class="col-xs-6 col-sm-3 col-md-3">
<CurrencyInput
v-model="employeeMoneyEmployee"
v-model="informaTempData.employeeMoneyEmployee"
:edit="edit"
:options="{
currency: 'THB',
@ -151,7 +151,7 @@
</div>
<div class="col-xs-6 col-sm-3 col-md-3">
<CurrencyInput
v-model="employeeMoneyEmployer"
v-model="informaTempData.employeeMoneyEmployer"
:edit="edit"
:options="{
currency: 'THB',
@ -199,17 +199,11 @@ import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import type {
Address,
DataOption,
zipCodeOption,
} from "@/modules/04_registry/components/profileType";
import { defaultAddress } from "@/modules/04_registry/components/profileType";
import type { DataOption } from "@/modules/04_registry/components/profileType";
import { defaultTempInformation } from "@/modules/04_registry/components/profileType";
import HeaderTop from "@/modules/04_registry/components/Information/top.vue";
import type { ResponseObject } from "@/modules/04_registry/interface/response/Address";
import HistoryTable from "@/components/TableHistory.vue";
import { useRoute } from "vue-router";
import type { AddressOps } from "@/modules/04_registry/interface/index/Main";
import type { QTableProps } from "quasar";
import CurrencyInput from "@/components/CurruncyInput.vue";
@ -218,6 +212,10 @@ const props = defineProps({
type: Boolean,
required: true,
},
fetchDataProfile: {
type: Function,
default: () => console.log("not function"),
},
statusAdd: {
type: Boolean,
default: false,
@ -254,6 +252,8 @@ const employeeMoneyIncrease = ref<number>(0);
const employeeMoneyAllowance = ref<number>(0);
const employeeMoneyEmployee = ref<number>(0);
const employeeMoneyEmployer = ref<number>(0);
const informaTempData = ref<any>(defaultTempInformation);
const rowsHistory = ref<any[]>([]); //select data history
const tittleHistory = ref<string>("ประวัติแก้ไขข้อมูลที่อยู่"); //
const filterHistory = ref<string>(""); //search data table history
@ -403,8 +403,6 @@ const visibleColumnsHistory = ref<String[]>([
"employeeTypeIndividual",
"employeeOc",
"employeeWage",
"createdFullName",
"createdAt",
]);
onMounted(async () => {
@ -471,28 +469,49 @@ const fetchData = async () => {
await http
.get(config.API.profileEmployeeTempId(route.params.id.toString()))
.then((res) => {
// const data: any = res.data.result;
// rows.value = [];
// data.map((e: any) => {
// rows.value.push({
// employeeMoneyIncrease: e.employeeMoneyIncrease,
// employeeMoneyAllowance: e.employeeMoneyAllowance,
// employeeMoneyEmployee: e.employeeMoneyEmployee,
// employeeMoneyEmployer: e.employeeMoneyEmployer,
// positionEmployeeGroupId: e.positionEmployeeGroupId,
// positionEmployeePositionId: e.positionEmployeePositionId,
// positionEmployeeLineId: e.positionEmployeeLineId,
// employeeTypeIndividual: e.employeeTypeIndividual,
// employeeOc: e.employeeOc,
// employeeWage: e.employeeWage,
// });
// console.log(res);
// });
const data: any = res.data.result;
rows.value = [];
data.map((e: any) => {
rows.value.push({
EmployeeMoneyIncrease: e.employeeMoneyIncrease,
EmployeeMoneyAllowance: e.employeeMoneyAllowance,
EmployeeMoneyEmployee: e.employeeMoneyEmployee,
EmployeeMoneyEmployer: e.employeeMoneyEmployer,
PositionEmployeeGroupId: e.positionEmployeeGroupId,
PositionEmployeePositionId: e.positionEmployeePositionId,
PositionEmployeeLineId: e.positionEmployeeLineId,
EmployeeTypeIndividual: e.employeeTypeIndividual,
EmployeeOc: e.employeeOc,
EmployeeWage: e.employeeWage,
});
});
informaTempData.value.employeeMoneyIncrease =
data.employeeMoneyIncrease;
informaTempData.value.employeeMoneyAllowance =
data.employeeMoneyAllowance;
informaTempData.value.employeeMoneyEmployee =
data.employeeMoneyEmployee;
informaTempData.value.employeeMoneyEmployer =
data.employeeMoneyEmployer;
informaTempData.value.positionEmployeeGroupId =
data.positionEmployeeGroupId;
informaTempData.value.positionEmployeePositionId =
data.positionEmployeePositionId;
informaTempData.value.positionEmployeeLineId =
data.positionEmployeeLineId;
informaTempData.value.employeeTypeIndividual =
data.employeeTypeIndividual;
informaTempData.value.employeeOc = data.employeeOc;
informaTempData.value.employeeWage = data.employeeWage;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
.finally(async () => {
hideLoader();
await props.fetchDataProfile();
});
}
};
@ -553,16 +572,17 @@ const fetchPositionEmployeePosition = async () => {
const editData = async () => {
const body: any = {
employeeMoneyIncrease: employeeMoneyIncrease.value,
employeeMoneyAllowance: employeeMoneyAllowance.value,
employeeMoneyEmployee: employeeMoneyEmployee.value,
employeeMoneyEmployer: employeeMoneyEmployer.value,
positionEmployeeGroupId: positionEmployeeGroupId.value,
positionEmployeePositionId: positionEmployeePositionId.value,
positionEmployeeLineId: positionEmployeeLineId.value,
employeeTypeIndividual: employeeTypeIndividual.value,
employeeOc: employeeOc.value,
employeeWage: employeeWage.value,
employeeMoneyIncrease: informaTempData.value.employeeMoneyIncrease,
employeeMoneyAllowance: informaTempData.value.employeeMoneyAllowance,
employeeMoneyEmployee: informaTempData.value.employeeMoneyEmployee,
employeeMoneyEmployer: informaTempData.value.employeeMoneyEmployer,
positionEmployeeGroupId: informaTempData.value.positionEmployeeGroupId,
positionEmployeePositionId:
informaTempData.value.positionEmployeePositionId,
positionEmployeeLineId: informaTempData.value.positionEmployeeLineId,
employeeTypeIndividual: informaTempData.value.employeeTypeIndividual,
employeeOc: informaTempData.value.employeeOc,
employeeWage: informaTempData.value.employeeWage,
};
showLoader();
await http