fix แสดงประวัติคนครอง
This commit is contained in:
parent
9f3ef65f13
commit
da98c579fc
4 changed files with 94 additions and 50 deletions
|
|
@ -52,6 +52,7 @@ export default {
|
||||||
|
|
||||||
orgPosExecutiveById: (id: string) => `${orgPos}/executive/${id}`,
|
orgPosExecutiveById: (id: string) => `${orgPos}/executive/${id}`,
|
||||||
orgPosHistory: (id: string) => `${orgPos}/history/${id}`,
|
orgPosHistory: (id: string) => `${orgPos}/history/${id}`,
|
||||||
|
orgPosHistoryUpdate: (id: string) => `${orgPos}/history-update/${id}`,
|
||||||
|
|
||||||
orgSalaryPosition: `${orgPos}/position?keyword=&type=ALL`,
|
orgSalaryPosition: `${orgPos}/position?keyword=&type=ALL`,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch } from "vue";
|
import { ref, watch, computed } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
|
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
|
|
@ -13,9 +13,7 @@ import { useOrganizational } from "@/modules/02_organization/store/organizationa
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
import type { HistoryPos } from "@/modules/02_organization/interface/response/organizational";
|
import type { HistoryPos } from "@/modules/02_organization/interface/response/organizational";
|
||||||
|
|
||||||
/**
|
/** import Components*/
|
||||||
* import Components
|
|
||||||
*/
|
|
||||||
import Header from "@/components/DialogHeader.vue";
|
import Header from "@/components/DialogHeader.vue";
|
||||||
|
|
||||||
/** Use*/
|
/** Use*/
|
||||||
|
|
@ -23,21 +21,20 @@ const $q = useQuasar();
|
||||||
const store = useOrganizational();
|
const store = useOrganizational();
|
||||||
const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin();
|
const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin();
|
||||||
|
|
||||||
/**
|
/** props*/
|
||||||
* props
|
|
||||||
*/
|
|
||||||
const modal = defineModel<boolean>("modal", { required: true });
|
const modal = defineModel<boolean>("modal", { required: true });
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
historyType: {
|
||||||
|
type: String,
|
||||||
|
default: "HISTORY",
|
||||||
|
},
|
||||||
rowId: {
|
rowId: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* ข้อมูล Table
|
|
||||||
*/
|
|
||||||
const rows = ref<HistoryPos[]>([]); //ข้อมูลรายการประวัติตำแหน่ง
|
const rows = ref<HistoryPos[]>([]); //ข้อมูลรายการประวัติตำแหน่ง
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const baseColumns = ref<QTableProps["columns"]>([
|
||||||
{
|
{
|
||||||
name: "no",
|
name: "no",
|
||||||
align: "left",
|
align: "left",
|
||||||
|
|
@ -47,17 +44,17 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// name: "fullname",
|
name: "fullname",
|
||||||
// align: "left",
|
align: "left",
|
||||||
// label: "ชื่อคนครอง",
|
label: "ชื่อคนครอง",
|
||||||
// sortable: true,
|
sortable: true,
|
||||||
// field: "fullname",
|
field: "fullname",
|
||||||
// headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
// style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
// sort: (a: string, b: string) =>
|
sort: (a: string, b: string) =>
|
||||||
// a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
name: "orgShortName",
|
name: "orgShortName",
|
||||||
align: "left",
|
align: "left",
|
||||||
|
|
@ -165,15 +162,33 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
const pagination = ref<QTableProps["pagination"]>({
|
||||||
|
page: 1,
|
||||||
|
rowsPerPage: 10,
|
||||||
|
});
|
||||||
|
|
||||||
|
const columns = computed(() =>
|
||||||
|
props.historyType === "HISTORY"
|
||||||
|
? (baseColumns.value || []).filter((col: any) => col.name !== "fullname")
|
||||||
|
: baseColumns.value || []
|
||||||
|
);
|
||||||
|
|
||||||
|
const titleName = computed(() =>
|
||||||
|
props.historyType === "HISTORY" ? "ประวัติตำแหน่ง" : "ประวัติคนครอง"
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function เรียกข้อมูลประวัติตำแหน่ง
|
* function เรียกข้อมูลประวัติตำแหน่ง
|
||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
function fetchHistoryPos(id: string) {
|
async function fetchHistoryPos(id: string) {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
const pathAPI =
|
||||||
.get(config.API.orgPosHistory(id))
|
props.historyType === "HISTORY"
|
||||||
|
? config.API.orgPosHistory(id)
|
||||||
|
: config.API.orgPosHistoryUpdate(id);
|
||||||
|
await http
|
||||||
|
.get(pathAPI)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const data = res.data.result;
|
const data = res.data.result;
|
||||||
rows.value = data;
|
rows.value = data;
|
||||||
|
|
@ -198,7 +213,7 @@ watch(
|
||||||
<q-dialog v-model="modal" persistent>
|
<q-dialog v-model="modal" persistent>
|
||||||
<q-card style="min-width: 80%">
|
<q-card style="min-width: 80%">
|
||||||
<Header
|
<Header
|
||||||
:tittle="'ประวัติตำแหน่ง'"
|
:tittle="titleName"
|
||||||
:close="
|
:close="
|
||||||
() => {
|
() => {
|
||||||
modal = false;
|
modal = false;
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,12 @@ const listMenu = ref<ListMenu[]>([
|
||||||
type: "CONDITION",
|
type: "CONDITION",
|
||||||
color: "deep-orange",
|
color: "deep-orange",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "ประวัติคนครอง",
|
||||||
|
icon: "history",
|
||||||
|
type: "OWNER_HISTORY",
|
||||||
|
color: "deep-purple",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "ประวัติตำแหน่ง",
|
label: "ประวัติตำแหน่ง",
|
||||||
icon: "history",
|
icon: "history",
|
||||||
|
|
@ -367,12 +373,12 @@ function onClickCopyPosition(
|
||||||
}
|
}
|
||||||
|
|
||||||
const dialogDetail = ref<boolean>(false); //ดูรายละเอียดประวัติตำแหน่ง
|
const dialogDetail = ref<boolean>(false); //ดูรายละเอียดประวัติตำแหน่ง
|
||||||
const dataDetailPos = ref<DataPosition[]>([]); //รายละเอียดตำแหน่ง
|
const dataDetailPos = ref<PosMaster2>(); //รายละเอียดตำแหน่ง
|
||||||
/**
|
/**
|
||||||
* function ดูรายละเอียดประวัติตำแหน่ง
|
* function ดูรายละเอียดประวัติตำแหน่ง
|
||||||
* @param data ข้อมูล ประวัติตำแหน่ง
|
* @param data ข้อมูล ประวัติตำแหน่ง
|
||||||
*/
|
*/
|
||||||
function onClickViewDetail(data: DataPosition[]) {
|
function onClickViewDetail(data: PosMaster2) {
|
||||||
dialogDetail.value = !dialogDetail.value;
|
dialogDetail.value = !dialogDetail.value;
|
||||||
dataDetailPos.value = data;
|
dataDetailPos.value = data;
|
||||||
}
|
}
|
||||||
|
|
@ -432,13 +438,15 @@ function onClickMovePos(id: string, type: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const modalDialogHistoryPos = ref<boolean>(false);
|
const modalDialogHistoryPos = ref<boolean>(false);
|
||||||
|
const historyType = ref<string>("HISTORY");
|
||||||
/**
|
/**
|
||||||
* function ดูประวัติตำแหน่ง
|
* function ดูประวัติตำแหน่ง
|
||||||
* @param id ID ตำแหน่ง
|
* @param id ID ตำแหน่ง
|
||||||
*/
|
*/
|
||||||
function onClickHistoryPos(id: string) {
|
function onClickHistoryPos(id: string, type: string = "HISTORY") {
|
||||||
modalDialogHistoryPos.value = !modalDialogHistoryPos.value;
|
modalDialogHistoryPos.value = !modalDialogHistoryPos.value;
|
||||||
rowId.value = id;
|
rowId.value = id;
|
||||||
|
historyType.value = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -454,7 +462,7 @@ function updatePagination(newPagination: NewPagination) {
|
||||||
* function เปิด pop เลือกตนครอง
|
* function เปิด pop เลือกตนครอง
|
||||||
* @param data ข้อมูลตำแหน่งที่ต้องการเพิ่มคนครอง
|
* @param data ข้อมูลตำแหน่งที่ต้องการเพิ่มคนครอง
|
||||||
*/
|
*/
|
||||||
function openSelectPerson(data: DataPosition[]) {
|
function openSelectPerson(data: PosMaster2) {
|
||||||
modalSelectPerson.value = true;
|
modalSelectPerson.value = true;
|
||||||
dataDetailPos.value = data;
|
dataDetailPos.value = data;
|
||||||
}
|
}
|
||||||
|
|
@ -591,6 +599,39 @@ async function fetchDataCondition() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onClickAction(type: string, data: PosMaster2) {
|
||||||
|
console.log(data);
|
||||||
|
switch (type) {
|
||||||
|
case "EDIT":
|
||||||
|
onClickPosition(type, data.id, data);
|
||||||
|
break;
|
||||||
|
case "COPY":
|
||||||
|
onClickCopyPosition(type, data.id, data);
|
||||||
|
break;
|
||||||
|
case "DEL":
|
||||||
|
onClickDelete(data.id || "");
|
||||||
|
break;
|
||||||
|
case "MOVE":
|
||||||
|
onClickMovePos(data.id || "", "SINGER");
|
||||||
|
break;
|
||||||
|
case "INHERIT":
|
||||||
|
onClickInherit(data.id || "");
|
||||||
|
break;
|
||||||
|
case "CONDITION":
|
||||||
|
onClickCodition(data);
|
||||||
|
break;
|
||||||
|
case "OWNER_HISTORY":
|
||||||
|
onClickHistoryPos(data.ancestorDNA || "", type);
|
||||||
|
break;
|
||||||
|
case "HISTORY":
|
||||||
|
onClickHistoryPos(data.id || "");
|
||||||
|
break;
|
||||||
|
case "VIEW":
|
||||||
|
onClickViewDetail(data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const pagination = ref({
|
const pagination = ref({
|
||||||
page: reqMaster.value.page,
|
page: reqMaster.value.page,
|
||||||
rowsPerPage: reqMaster.value.pageSize,
|
rowsPerPage: reqMaster.value.pageSize,
|
||||||
|
|
@ -789,25 +830,7 @@ watch(
|
||||||
:key="index"
|
:key="index"
|
||||||
clickable
|
clickable
|
||||||
v-close-popup
|
v-close-popup
|
||||||
@click="
|
@click="onClickAction(item.type, props.row)"
|
||||||
item.type === 'EDIT'
|
|
||||||
? onClickPosition('EDIT', props.row.id, props.row)
|
|
||||||
: item.type === 'DEL'
|
|
||||||
? onClickDelete(props.row.id)
|
|
||||||
: item.type === 'MOVE'
|
|
||||||
? onClickMovePos(props.row.id, 'SINGER')
|
|
||||||
: item.type === 'HISTORY'
|
|
||||||
? onClickHistoryPos(props.row.id)
|
|
||||||
: item.type === 'INHERIT'
|
|
||||||
? onClickInherit(props.row.id)
|
|
||||||
: item.type === 'COPY'
|
|
||||||
? onClickCopyPosition('COPY', props.row.id, props.row)
|
|
||||||
: item.type === 'CONDITION'
|
|
||||||
? onClickCodition(props.row)
|
|
||||||
: item.type === 'VIEW'
|
|
||||||
? onClickViewDetail(props.row)
|
|
||||||
: null
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
<div class="row items-center">
|
<div class="row items-center">
|
||||||
|
|
@ -1077,7 +1100,11 @@ watch(
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- ประวัติตำแหน่ง -->
|
<!-- ประวัติตำแหน่ง -->
|
||||||
<DialogHistoryPos v-model:modal="modalDialogHistoryPos" :rowId="rowId" />
|
<DialogHistoryPos
|
||||||
|
v-model:modal="modalDialogHistoryPos"
|
||||||
|
:rowId="rowId"
|
||||||
|
:history-type="historyType"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- เลือกคนครอง -->
|
<!-- เลือกคนครอง -->
|
||||||
<DialogSelectPerson
|
<DialogSelectPerson
|
||||||
|
|
|
||||||
|
|
@ -162,6 +162,7 @@ interface PosMaster2 {
|
||||||
current_holderId?: string;
|
current_holderId?: string;
|
||||||
next_holderId?: string;
|
next_holderId?: string;
|
||||||
isSit?: boolean;
|
isSit?: boolean;
|
||||||
|
ancestorDNA: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface HistoryPos {
|
interface HistoryPos {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue