ทะเบียนประวัติลูกจ้าง popup กำหนดตำแหน่ง
This commit is contained in:
parent
1b4465bf36
commit
1a4163e76a
5 changed files with 366 additions and 20 deletions
|
|
@ -10,7 +10,7 @@ import env from "../index";
|
|||
const organizationPath = `${env.API_URI_ORG_SERVICE}/Organization/`;
|
||||
const postionMasterPath = `${env.API_URI_ORG_SERVICE}/PositionMaster`;
|
||||
const organizationPosition = `${env.API_URI_ORG_SERVICE}/OrganizationPosition/`;
|
||||
const organizationEmployeePosition = `${env.API_URI_ORG_EMPLOYEE_SERVICE}/organization-employee/`;
|
||||
const organizationEmployee = `${env.API_URI_ORG_EMPLOYEE_SERVICE}/organization-employee/`;
|
||||
|
||||
const report = `${env.API_URI}/report/organization/`;
|
||||
|
||||
|
|
@ -84,7 +84,9 @@ export default {
|
|||
getPositionNumberIdByOcId: (OcId: string) =>
|
||||
`${postionMasterPath}/position-number/Oc/${OcId}`,
|
||||
|
||||
organizationEmployeePosition: `${organizationEmployeePosition}`,
|
||||
organizationEmployeePositionId: (id: string) =>
|
||||
`${organizationEmployeePosition}${id}`,
|
||||
organizationEmployee: `${organizationEmployee}`,
|
||||
organizationEmployeeId: (id: string) => `${organizationEmployee}${id}`,
|
||||
|
||||
organizationEmployeePositionId: (profileId: string) =>
|
||||
`${organizationEmployee}position/${profileId}`,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -908,7 +908,7 @@ onMounted(async () => {
|
|||
const fetchData = async () => {
|
||||
loaderPage(true);
|
||||
await http
|
||||
.get(config.API.organizationEmployeePosition)
|
||||
.get(config.API.organizationEmployee)
|
||||
.then((res) => {
|
||||
let data = res.data.result;
|
||||
rows.value = [];
|
||||
|
|
@ -1311,7 +1311,7 @@ const saveData = async () => {
|
|||
modal.value = false;
|
||||
loaderPage(true);
|
||||
await http
|
||||
.post(config.API.organizationEmployeePosition, {
|
||||
.post(config.API.organizationEmployee, {
|
||||
organizationOrganizationId: organizationOrganizationId.value,
|
||||
organizationShortNameId: organizationGovernmentCode.value,
|
||||
organizationTypeId: organizationTypeId.value,
|
||||
|
|
@ -1363,7 +1363,7 @@ const editData = async () => {
|
|||
modal.value = false;
|
||||
loaderPage(true);
|
||||
await http
|
||||
.put(config.API.organizationEmployeePositionId(id.value), {
|
||||
.put(config.API.organizationEmployeeId(id.value), {
|
||||
organizationOrganizationId: organizationOrganizationId.value,
|
||||
organizationShortNameId: organizationGovernmentCode.value,
|
||||
organizationTypeId: organizationTypeId.value,
|
||||
|
|
@ -1428,7 +1428,7 @@ const clickDelete = (id: string) => {
|
|||
const deleteData = async (id: string) => {
|
||||
loaderPage(true);
|
||||
await http
|
||||
.delete(config.API.organizationEmployeePositionId(id))
|
||||
.delete(config.API.organizationEmployeeId(id))
|
||||
.then((res) => {
|
||||
success($q, "ลบข้อมูลสำเร็จ");
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1 +1,50 @@
|
|||
export type {};
|
||||
interface ObjectNameId {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
interface employeePosition {
|
||||
id: string;
|
||||
agency: string;
|
||||
conditionNote: string;
|
||||
department: string;
|
||||
government: string;
|
||||
isActive: boolean;
|
||||
isCondition: boolean;
|
||||
isDirector: boolean;
|
||||
organizationUserNote: string;
|
||||
qualification: string;
|
||||
pile: string;
|
||||
posNo: string;
|
||||
positionCondition: string;
|
||||
positionMasterUserNote: string;
|
||||
organizationOrder: string;
|
||||
organizationFaxId: string;
|
||||
organizationLevelId: string;
|
||||
organizationOrganizationId: string;
|
||||
organizationTelExternalId: string;
|
||||
organizationTelInternalId: string;
|
||||
organizationTypeId: string;
|
||||
positionEmployeeStatusId: string;
|
||||
positionEmployeeLineId: string;
|
||||
positionEmployeePositionId: string;
|
||||
organizationAgencyId: string;
|
||||
organizationGovernmentAgencyId: string;
|
||||
organizationShortNameId: string;
|
||||
organizationFaxName: string;
|
||||
organizationLevelName: string;
|
||||
organizationOrganizationName: string;
|
||||
organizationTelExternalName: string;
|
||||
organizationTelInternalName: string;
|
||||
organizationTypeName: string;
|
||||
positionEmployeeStatusName: string;
|
||||
positionEmployeeLineName: string;
|
||||
positionEmployeePositionName: string;
|
||||
organizationAgencyName: string;
|
||||
organizationGovernmentAgencyName: string;
|
||||
organizationShortNameName: string;
|
||||
positionEmployeeLevels: ObjectNameId[];
|
||||
positionEmployeePositionSides: ObjectNameId[];
|
||||
use: boolean;
|
||||
}
|
||||
|
||||
export type { employeePosition };
|
||||
|
|
|
|||
|
|
@ -195,7 +195,42 @@
|
|||
</div>
|
||||
</q-card>
|
||||
<q-dialog v-model="modal" persistent>
|
||||
<q-card flat bordered class="col-12 q-mt-sm q-pt-sm q-pa-md"> </q-card>
|
||||
<q-card style="width: 70vw; max-width: 70vw">
|
||||
<DialogHeader tittle="กำหนดตำแหน่ง" :close="modalOpenClose" />
|
||||
<q-separator />
|
||||
<q-card-section class="q-pa-sm">
|
||||
<d-table
|
||||
:rows="rowsPosition"
|
||||
:columns="columnsPosition"
|
||||
row-key="id"
|
||||
selection="single"
|
||||
v-model:selected="selectedPosition"
|
||||
:visible-columns="visibleColumnsPosition"
|
||||
>
|
||||
<template v-slot:body-selection="scope">
|
||||
<q-checkbox
|
||||
keep-color
|
||||
color="primary"
|
||||
dense
|
||||
v-model="scope.selected"
|
||||
/>
|
||||
</template>
|
||||
</d-table>
|
||||
</q-card-section>
|
||||
<q-separator />
|
||||
<q-card-actions align="right">
|
||||
<q-btn
|
||||
dense
|
||||
unelevated
|
||||
label="บันทึก"
|
||||
color="public"
|
||||
@click="checkSave"
|
||||
class="q-px-md"
|
||||
><!-- icon="mdi-content-save-outline"
|
||||
<q-tooltip>บันทึก</q-tooltip> -->
|
||||
</q-btn>
|
||||
</q-card-actions>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
</template>
|
||||
|
||||
|
|
@ -212,7 +247,7 @@ import {
|
|||
FormRegistryEmployee,
|
||||
ResponseEmployeeTemp,
|
||||
} from "@/modules/08_registryEmployee/request/Main.ts";
|
||||
import { useDataStore } from "@/stores/data";
|
||||
import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue";
|
||||
|
||||
const props = defineProps({
|
||||
next: {
|
||||
|
|
@ -227,16 +262,23 @@ const props = defineProps({
|
|||
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง
|
||||
const { typeRetire, success, messageError, showLoader, hideLoader, date2Thai } =
|
||||
mixin;
|
||||
const dataStore = useDataStore();
|
||||
const { loaderPage } = dataStore;
|
||||
const {
|
||||
typeRetire,
|
||||
success,
|
||||
messageError,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
date2Thai,
|
||||
dialogMessage,
|
||||
} = mixin;
|
||||
|
||||
const router = useRouter();
|
||||
const myForm = ref<QForm>();
|
||||
const filterRef = ref<QInput>();
|
||||
const filter = ref<string>("");
|
||||
const selected = ref<string>("");
|
||||
const modal = ref<boolean>(false);
|
||||
const id = ref<string>("");
|
||||
const visibleColumnsModal = ref<String[]>(["no", "positionNum", "name"]);
|
||||
const columnsModal = [
|
||||
{ name: "no", align: "left", label: "ลำดับ", field: "no", sortable: true },
|
||||
|
|
@ -529,10 +571,258 @@ const columns = ref<QTableProps["columns"]>([
|
|||
},
|
||||
]);
|
||||
const rows = ref<FormRegistryEmployee[]>([]);
|
||||
|
||||
const selectedPosition = ref<any[]>([]);
|
||||
const visibleColumnsPosition = ref<String[]>([
|
||||
"organizationOrganizationName",
|
||||
"organizationAgencyName",
|
||||
"organizationGovernmentAgencyName",
|
||||
"organizationShortNameName",
|
||||
"organizationTypeName",
|
||||
"organizationLevelName",
|
||||
"positionEmployeeLineName",
|
||||
"positionEmployeePositionName",
|
||||
"posNo",
|
||||
]);
|
||||
|
||||
const columnsPosition = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "organizationOrganizationName",
|
||||
align: "left",
|
||||
label: "หน่วยงาน",
|
||||
sortable: true,
|
||||
field: "organizationOrganizationName",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "organizationAgencyName",
|
||||
align: "left",
|
||||
label: "รหัสหน่วยงาน",
|
||||
sortable: true,
|
||||
field: "organizationAgencyName",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "organizationGovernmentAgencyName",
|
||||
align: "left",
|
||||
label: "รหัสส่วนราชการ",
|
||||
sortable: true,
|
||||
field: "organizationGovernmentAgencyName",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "organizationShortNameName",
|
||||
align: "left",
|
||||
label: "ชื่อย่อหน่วยงาน",
|
||||
sortable: true,
|
||||
field: "organizationShortNameName",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "organizationTypeName",
|
||||
align: "left",
|
||||
label: "ประเภทหน่วยงาน",
|
||||
sortable: true,
|
||||
field: "organizationTypeName",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "organizationLevelName",
|
||||
align: "left",
|
||||
label: "ระดับหน่วยงาน",
|
||||
sortable: true,
|
||||
field: "organizationLevelName",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "positionEmployeeLineName",
|
||||
align: "left",
|
||||
label: "สายงาน",
|
||||
sortable: true,
|
||||
field: "positionEmployeeLineName",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "positionEmployeePositionName",
|
||||
align: "left",
|
||||
label: "ตำแหน่ง",
|
||||
sortable: true,
|
||||
field: "positionEmployeePositionName",
|
||||
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" }),
|
||||
},
|
||||
]);
|
||||
const rowsPosition = ref<any>([]);
|
||||
|
||||
onMounted(async () => {
|
||||
await nodeTree();
|
||||
});
|
||||
|
||||
const checkNull = (text: string) =>
|
||||
text == null
|
||||
? ""
|
||||
: text == "00000000-0000-0000-0000-000000000000"
|
||||
? ""
|
||||
: text;
|
||||
|
||||
const getPosition = async (id: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.organizationEmployeePositionId(id))
|
||||
.then((res) => {
|
||||
const { result } = res.data;
|
||||
let data: any[] = [];
|
||||
result.map((r: any) => {
|
||||
data.push({
|
||||
id: checkNull(r.id),
|
||||
agency: checkNull(r.agency),
|
||||
conditionNote: checkNull(r.conditionNote),
|
||||
department: checkNull(r.department),
|
||||
government: checkNull(r.government),
|
||||
isActive: r.isActive,
|
||||
isCondition: r.isCondition,
|
||||
isDirector: r.isDirector,
|
||||
organizationUserNote: checkNull(r.organizationUserNote),
|
||||
qualification: checkNull(r.qualification),
|
||||
pile: checkNull(r.pile),
|
||||
posNo: checkNull(r.posNo),
|
||||
positionCondition: checkNull(r.positionCondition),
|
||||
positionMasterUserNote: checkNull(r.positionMasterUserNote),
|
||||
organizationOrder: checkNull(r.organizationOrder),
|
||||
organizationFaxId: checkNull(r.organizationFaxId),
|
||||
organizationLevelId: checkNull(r.organizationLevelId),
|
||||
organizationOrganizationId: checkNull(r.organizationOrganizationId),
|
||||
organizationTelExternalId: checkNull(r.organizationTelExternalId),
|
||||
organizationTelInternalId: checkNull(r.organizationTelInternalId),
|
||||
organizationTypeId: checkNull(r.organizationTypeId),
|
||||
positionEmployeeStatusId: checkNull(r.positionEmployeeStatusId),
|
||||
positionEmployeeLineId: checkNull(r.positionEmployeeLineId),
|
||||
positionEmployeePositionId: checkNull(r.positionEmployeePositionId),
|
||||
organizationAgencyId: checkNull(r.organizationAgencyId),
|
||||
organizationGovernmentAgencyId: checkNull(
|
||||
r.organizationGovernmentAgencyId
|
||||
),
|
||||
organizationShortNameId: checkNull(r.organizationShortNameId),
|
||||
organizationFaxName: checkNull(r.organizationFaxName),
|
||||
organizationLevelName: checkNull(r.organizationLevelName),
|
||||
organizationOrganizationName: checkNull(
|
||||
r.organizationOrganizationName
|
||||
),
|
||||
organizationTelExternalName: checkNull(r.organizationTelExternalName),
|
||||
organizationTelInternalName: checkNull(r.organizationTelInternalName),
|
||||
organizationTypeName: checkNull(r.organizationTypeName),
|
||||
positionEmployeeStatusName: checkNull(r.positionEmployeeStatusName),
|
||||
positionEmployeeLineName: checkNull(r.positionEmployeeLineName),
|
||||
positionEmployeePositionName: checkNull(
|
||||
r.positionEmployeePositionName
|
||||
),
|
||||
organizationAgencyName: checkNull(r.organizationAgencyName),
|
||||
organizationGovernmentAgencyName: checkNull(
|
||||
r.organizationGovernmentAgencyName
|
||||
),
|
||||
organizationShortNameName: checkNull(r.organizationShortNameName),
|
||||
positionEmployeeLevels: r.positionEmployeeLevels,
|
||||
positionEmployeePositionSides: r.positionEmployeePositionSides,
|
||||
use: r.use,
|
||||
});
|
||||
});
|
||||
|
||||
const index = data.findIndex((r: any) => r.use == true);
|
||||
if (index >= 0) {
|
||||
selectedPosition.value = [data[index]];
|
||||
}
|
||||
|
||||
rowsPosition.value = data;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
const checkSave = async () => {
|
||||
if (selectedPosition.value.length == 0) {
|
||||
dialogMessage(
|
||||
$q,
|
||||
"ไม่สามารถบันทึกข้อมูลได้",
|
||||
"กรุณาเลือกตำแหน่ง",
|
||||
"warning",
|
||||
undefined,
|
||||
"orange",
|
||||
undefined,
|
||||
undefined,
|
||||
true
|
||||
);
|
||||
return;
|
||||
} else {
|
||||
await savePosition();
|
||||
}
|
||||
};
|
||||
|
||||
const savePosition = async () => {
|
||||
showLoader();
|
||||
const data = {
|
||||
organizationEmployeeId: selectedPosition.value[0].id,
|
||||
};
|
||||
await http
|
||||
.put(config.API.organizationEmployeePositionId(id.value), data)
|
||||
.then((res) => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
await nodeTree();
|
||||
modalOpenClose();
|
||||
});
|
||||
};
|
||||
|
||||
const modalOpenClose = () => {
|
||||
modal.value = !modal.value;
|
||||
if (!modal.value) {
|
||||
selectedPosition.value = [];
|
||||
rowsPosition.value = [];
|
||||
id.value = "";
|
||||
}
|
||||
};
|
||||
|
||||
const next = (id: string) => {
|
||||
router.push(`/registryEmployee/${id}`);
|
||||
};
|
||||
|
|
@ -583,7 +873,10 @@ const clickAdd = () => {
|
|||
// router.push(`/placement/detail`);
|
||||
};
|
||||
|
||||
const editDetail = (id: string) => {
|
||||
const editDetail = async (row: any) => {
|
||||
await getPosition(row.id);
|
||||
console.log(row);
|
||||
id.value = row.id;
|
||||
modal.value = true;
|
||||
};
|
||||
|
||||
|
|
@ -598,7 +891,7 @@ const clickDelete = (id: string) => {
|
|||
persistent: true,
|
||||
})
|
||||
.onOk(async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.delete(config.API.profileInforId(id))
|
||||
.then((res) => {
|
||||
|
|
@ -609,7 +902,7 @@ const clickDelete = (id: string) => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
})
|
||||
.onCancel(() => {})
|
||||
|
|
@ -649,7 +942,7 @@ const showEmployeeTemp = async () => {
|
|||
});
|
||||
|
||||
if (selected.value == null || selected.value == "") return;
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.searchProfileByOcId(selected.value, "all"), {
|
||||
criterias: cirteria,
|
||||
|
|
@ -691,7 +984,7 @@ const showEmployeeTemp = async () => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -312,6 +312,8 @@ export const useCounterMixin = defineStore("mixin", () => {
|
|||
}
|
||||
|
||||
const messageError = (q: any, e: any = "") => {
|
||||
// q.dialog.hide();
|
||||
console.log("e.response", e.response);
|
||||
if (e.response !== undefined) {
|
||||
if (e.response.data.status !== undefined) {
|
||||
if (e.response.data.status == 401) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue