ปรับโครงสร้าง
This commit is contained in:
parent
21b79e5fd0
commit
8a91cf97d6
6 changed files with 190 additions and 37 deletions
|
|
@ -104,7 +104,7 @@ async function fetchInformation(id: string) {
|
||||||
)
|
)
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const data = await res.data.result;
|
const data = await res.data.result;
|
||||||
imformation.prefix = data.rank ? data.rank : data.prefix;
|
imformation.prefix = data.prefix ? data.prefix : "-";
|
||||||
imformation.citizenId = data.citizenId ? data.citizenId : "-";
|
imformation.citizenId = data.citizenId ? data.citizenId : "-";
|
||||||
imformation.firstName = data.firstName ? data.firstName : "-";
|
imformation.firstName = data.firstName ? data.firstName : "-";
|
||||||
imformation.lastName = data.lastName ? data.lastName : "-";
|
imformation.lastName = data.lastName ? data.lastName : "-";
|
||||||
|
|
@ -112,7 +112,7 @@ async function fetchInformation(id: string) {
|
||||||
imformation.age = data.birthDate ? calculateAge(data.birthDate) : "-";
|
imformation.age = data.birthDate ? calculateAge(data.birthDate) : "-";
|
||||||
imformation.gender = data.gender ?? "-";
|
imformation.gender = data.gender ?? "-";
|
||||||
|
|
||||||
avatar.fullname = `${data.rank ? data.rank : data.prefix}${data.firstName} ${data.lastName}`;
|
avatar.fullname = `${data.prefix}${data.firstName} ${data.lastName}`;
|
||||||
|
|
||||||
avatar.position = data.position ? data.position : "-";
|
avatar.position = data.position ? data.position : "-";
|
||||||
if (data.avatarName) {
|
if (data.avatarName) {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ interface Roles {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FilterReqMaster {
|
interface FilterReqMaster {
|
||||||
id: string;
|
id: string | null;
|
||||||
type: number;
|
type: number;
|
||||||
isAll: boolean;
|
isAll: boolean;
|
||||||
isBlank: boolean;
|
isBlank: boolean;
|
||||||
|
|
|
||||||
|
|
@ -47,13 +47,15 @@ interface NodeTree {
|
||||||
totalRootPositionCurrentVacant: number;
|
totalRootPositionCurrentVacant: number;
|
||||||
totalRootPositionNextUse: number;
|
totalRootPositionNextUse: number;
|
||||||
totalRootPositionNextVacant: number;
|
totalRootPositionNextVacant: number;
|
||||||
children: NodeTree;
|
children: NodeTree[];
|
||||||
isOfficer: boolean;
|
isOfficer: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PosMaster {
|
interface PosMaster {
|
||||||
fullNameCurrentHolder: null | string;
|
fullNameCurrentHolder: null | string;
|
||||||
fullNameNextHolder: string;
|
fullNameNextHolder: string;
|
||||||
|
profileIdCurrentHolder: string;
|
||||||
|
profileIdNextHolder: string;
|
||||||
id: string;
|
id: string;
|
||||||
isSit: boolean;
|
isSit: boolean;
|
||||||
isSpecial: boolean;
|
isSpecial: boolean;
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import type {
|
||||||
|
|
||||||
/** importComponents*/
|
/** importComponents*/
|
||||||
import DialogAdd from "@/modules/02_users/components/Permissions/DialogAdd.vue";
|
import DialogAdd from "@/modules/02_users/components/Permissions/DialogAdd.vue";
|
||||||
|
import PopupPersonal from "@/modules/02_users/components/RoleOrganization/DialogPersonal.vue";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* use
|
* use
|
||||||
|
|
@ -30,7 +31,39 @@ const { showLoader, hideLoader, messageError, success, dialogRemove } =
|
||||||
|
|
||||||
/** Tree*/
|
/** Tree*/
|
||||||
const filter = ref<string>(""); // ค้นหาข้อมูลโครงาสร้าง
|
const filter = ref<string>(""); // ค้นหาข้อมูลโครงาสร้าง
|
||||||
const nodes = ref<Array<NodeTree[]>>([]); // ข้อมูลโครงสร้าง
|
const nodes = ref<Array<NodeTree>>([
|
||||||
|
{
|
||||||
|
labelName: "",
|
||||||
|
orgCode: "",
|
||||||
|
orgLevel: 0,
|
||||||
|
orgName: "",
|
||||||
|
orgRevisionId: "",
|
||||||
|
orgRootName: "",
|
||||||
|
orgTreeCode: "",
|
||||||
|
orgTreeFax: "",
|
||||||
|
orgTreeId: "",
|
||||||
|
orgTreeName: "หน่วยงานทั้งหมด",
|
||||||
|
orgTreeOrder: 0,
|
||||||
|
orgTreePhoneEx: "",
|
||||||
|
orgTreePhoneIn: "",
|
||||||
|
orgTreeRank: "",
|
||||||
|
orgTreeRankSub: "",
|
||||||
|
orgTreeShortName: "",
|
||||||
|
responsibility: "",
|
||||||
|
totalPosition: 0,
|
||||||
|
totalPositionCurrentUse: 0,
|
||||||
|
totalPositionCurrentVacant: 0,
|
||||||
|
totalPositionNextUse: 0,
|
||||||
|
totalPositionNextVacant: 0,
|
||||||
|
totalRootPosition: 0,
|
||||||
|
totalRootPositionCurrentUse: 0,
|
||||||
|
totalRootPositionCurrentVacant: 0,
|
||||||
|
totalRootPositionNextUse: 0,
|
||||||
|
totalRootPositionNextVacant: 0,
|
||||||
|
children: [] as NodeTree[],
|
||||||
|
isOfficer: false,
|
||||||
|
},
|
||||||
|
]); // ข้อมูลโครงสร้าง
|
||||||
const lazy = ref(nodes);
|
const lazy = ref(nodes);
|
||||||
const expanded = ref<string[]>([]); // แสดงข้อมูลในโหนดที่เลือก
|
const expanded = ref<string[]>([]); // แสดงข้อมูลในโหนดที่เลือก
|
||||||
const nodeId = ref<string>(""); // id โหนด
|
const nodeId = ref<string>(""); // id โหนด
|
||||||
|
|
@ -191,7 +224,7 @@ const columnsExpand = ref<QTableProps["columns"]>([
|
||||||
]);
|
]);
|
||||||
// ฟอร์มค้นหาตำแหน่ง
|
// ฟอร์มค้นหาตำแหน่ง
|
||||||
const reqMaster = reactive<FilterReqMaster>({
|
const reqMaster = reactive<FilterReqMaster>({
|
||||||
id: "",
|
id: null,
|
||||||
type: 0,
|
type: 0,
|
||||||
isAll: false,
|
isAll: false,
|
||||||
isBlank: false,
|
isBlank: false,
|
||||||
|
|
@ -249,7 +282,9 @@ async function fetchDataTree(id: string) {
|
||||||
.get(config.API.orgByid(id.toString()))
|
.get(config.API.orgByid(id.toString()))
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const data = await res.data.result;
|
const data = await res.data.result;
|
||||||
nodes.value = data;
|
nodes.value.push(...data);
|
||||||
|
nodes.value[0].orgRevisionId = id;
|
||||||
|
await fetchDataTable(reqMaster.id, id, reqMaster.type);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
|
|
@ -264,9 +299,13 @@ async function fetchDataTree(id: string) {
|
||||||
* @param id idTree
|
* @param id idTree
|
||||||
* @param level levelTree
|
* @param level levelTree
|
||||||
*/
|
*/
|
||||||
async function fetchDataTable(id: string, revisionId: string, level: number) {
|
async function fetchDataTable(
|
||||||
|
id: string | null,
|
||||||
|
revisionId: string,
|
||||||
|
level: number
|
||||||
|
) {
|
||||||
showLoader();
|
showLoader();
|
||||||
reqMaster.id = id;
|
reqMaster.id = id === "" ? null : id;
|
||||||
reqMaster.revisionId = revisionId;
|
reqMaster.revisionId = revisionId;
|
||||||
reqMaster.type = level;
|
reqMaster.type = level;
|
||||||
await http
|
await http
|
||||||
|
|
@ -354,22 +393,34 @@ function onDeleteRole(id: string) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const modalPersonal = ref<boolean>(false);
|
||||||
|
const personId = ref<string>("");
|
||||||
|
|
||||||
|
function onOpenModalPersonal(id: string) {
|
||||||
|
personId.value = id;
|
||||||
|
modalPersonal.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function updatemodalPersonal(modal: boolean) {
|
||||||
|
modalPersonal.value = modal;
|
||||||
|
}
|
||||||
|
|
||||||
/** callblck function ทำการ fetch ข้อมูล tree เมื่อมีการเปลี่ยน Tab ปัจจับัน,แบบร่าง*/
|
/** callblck function ทำการ fetch ข้อมูล tree เมื่อมีการเปลี่ยน Tab ปัจจับัน,แบบร่าง*/
|
||||||
watch(
|
watch(
|
||||||
() => store.typeOrganizational,
|
() => store.typeOrganizational,
|
||||||
() => {
|
async () => {
|
||||||
const id =
|
const id =
|
||||||
store.typeOrganizational === "current" ? store.activeId : store.draftId;
|
store.typeOrganizational === "current" ? store.activeId : store.draftId;
|
||||||
nodeId.value = "";
|
nodeId.value = "";
|
||||||
posMaster.value = [];
|
posMaster.value = [];
|
||||||
reqMaster.id = "";
|
reqMaster.id = null;
|
||||||
reqMaster.type = 0;
|
reqMaster.type = 0;
|
||||||
reqMaster.isAll = false;
|
reqMaster.isAll = false;
|
||||||
reqMaster.page = 1;
|
reqMaster.page = 1;
|
||||||
reqMaster.pageSize = 10;
|
reqMaster.pageSize = 10;
|
||||||
reqMaster.keyword = "";
|
reqMaster.keyword = "";
|
||||||
reqMaster.revisionId = "";
|
reqMaster.revisionId = "";
|
||||||
fetchDataTree(id);
|
await fetchDataTree(id);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -613,7 +664,27 @@ onMounted(() => {
|
||||||
:key="col.name"
|
:key="col.name"
|
||||||
:props="props"
|
:props="props"
|
||||||
>
|
>
|
||||||
<div>
|
<div v-if="col.name === 'positionIsSelected'">
|
||||||
|
{{ col.value ? col.value : "-" }}
|
||||||
|
<q-btn
|
||||||
|
v-if="col.value !== 'ว่าง'"
|
||||||
|
flat
|
||||||
|
dense
|
||||||
|
color="info"
|
||||||
|
icon="info"
|
||||||
|
round
|
||||||
|
@click.prevent="
|
||||||
|
onOpenModalPersonal(
|
||||||
|
store.typeOrganizational === 'draft'
|
||||||
|
? props.row.profileIdNextHolder
|
||||||
|
: props.row.profileIdCurrentHolder
|
||||||
|
)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<q-tooltip>ดูข้อมูล</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
{{ col.value ? col.value : "-" }}
|
{{ col.value ? col.value : "-" }}
|
||||||
</div>
|
</div>
|
||||||
</q-td>
|
</q-td>
|
||||||
|
|
@ -774,6 +845,12 @@ onMounted(() => {
|
||||||
:dataPosMaster="dataPosMaster as PosMaster"
|
:dataPosMaster="dataPosMaster as PosMaster"
|
||||||
:fetchDataTable="fetchDataTable"
|
:fetchDataTable="fetchDataTable"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<PopupPersonal
|
||||||
|
:modal="modalPersonal"
|
||||||
|
:id="personId"
|
||||||
|
@update:modal="updatemodalPersonal"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
||||||
|
|
@ -113,8 +113,7 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "ชื่อ-นามสกุล",
|
label: "ชื่อ-นามสกุล",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: (row) =>
|
field: (row) => `${row.prefix}${row.firstName} ${row.lastName}`,
|
||||||
`${row.rank ? row.rank : row.prefix}${row.firstName} ${row.lastName}`,
|
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
|
|
@ -386,7 +385,6 @@ onMounted(async () => {
|
||||||
>
|
>
|
||||||
<span class="text-weight-medium">{{ col.label }}</span>
|
<span class="text-weight-medium">{{ col.label }}</span>
|
||||||
</q-th>
|
</q-th>
|
||||||
<q-th auto-width />
|
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:body="props">
|
<template v-slot:body="props">
|
||||||
|
|
@ -408,25 +406,27 @@ onMounted(async () => {
|
||||||
:key="col.name"
|
:key="col.name"
|
||||||
:props="props"
|
:props="props"
|
||||||
>
|
>
|
||||||
<div>
|
<div v-if="col.name === 'fullName'">
|
||||||
|
{{ col.value ? col.value : "-" }}
|
||||||
|
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
dense
|
||||||
|
color="info"
|
||||||
|
icon="info"
|
||||||
|
round
|
||||||
|
@click.pervent="
|
||||||
|
onOpenModalPersonal(props.row.profileId)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<q-tooltip>ดูข้อมูล</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else>
|
||||||
{{ col.value ? col.value : "-" }}
|
{{ col.value ? col.value : "-" }}
|
||||||
</div>
|
</div>
|
||||||
</q-td>
|
</q-td>
|
||||||
|
|
||||||
<q-td auto-width>
|
|
||||||
<q-btn
|
|
||||||
flat
|
|
||||||
dense
|
|
||||||
color="info"
|
|
||||||
icon="info"
|
|
||||||
round
|
|
||||||
@click.pervent="
|
|
||||||
onOpenModalPersonal(props.row.profileId)
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<q-tooltip>ดูข้อมูล</q-tooltip>
|
|
||||||
</q-btn>
|
|
||||||
</q-td>
|
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:pagination="scope">
|
<template v-slot:pagination="scope">
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import type {
|
||||||
|
|
||||||
/** importComponents*/
|
/** importComponents*/
|
||||||
import DialogResponsibilities from "@/modules/02_users/components/05_responsIbilities/DialogResponsibilities.vue";
|
import DialogResponsibilities from "@/modules/02_users/components/05_responsIbilities/DialogResponsibilities.vue";
|
||||||
|
import PopupPersonal from "@/modules/02_users/components/RoleOrganization/DialogPersonal.vue";
|
||||||
|
|
||||||
/** use*/
|
/** use*/
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
@ -27,7 +27,39 @@ const { showLoader, hideLoader, messageError, success, dialogRemove } =
|
||||||
|
|
||||||
/** Tree*/
|
/** Tree*/
|
||||||
const filter = ref<string>(""); // ค้นหาข้อมูลโครงาสร้าง
|
const filter = ref<string>(""); // ค้นหาข้อมูลโครงาสร้าง
|
||||||
const nodes = ref<Array<NodeTree[]>>([]); // ข้อมูลโครงสร้าง
|
const nodes = ref<Array<NodeTree>>([
|
||||||
|
{
|
||||||
|
labelName: "",
|
||||||
|
orgCode: "",
|
||||||
|
orgLevel: 0,
|
||||||
|
orgName: "",
|
||||||
|
orgRevisionId: "",
|
||||||
|
orgRootName: "",
|
||||||
|
orgTreeCode: "",
|
||||||
|
orgTreeFax: "",
|
||||||
|
orgTreeId: "",
|
||||||
|
orgTreeName: "หน่วยงานทั้งหมด",
|
||||||
|
orgTreeOrder: 0,
|
||||||
|
orgTreePhoneEx: "",
|
||||||
|
orgTreePhoneIn: "",
|
||||||
|
orgTreeRank: "",
|
||||||
|
orgTreeRankSub: "",
|
||||||
|
orgTreeShortName: "",
|
||||||
|
responsibility: "",
|
||||||
|
totalPosition: 0,
|
||||||
|
totalPositionCurrentUse: 0,
|
||||||
|
totalPositionCurrentVacant: 0,
|
||||||
|
totalPositionNextUse: 0,
|
||||||
|
totalPositionNextVacant: 0,
|
||||||
|
totalRootPosition: 0,
|
||||||
|
totalRootPositionCurrentUse: 0,
|
||||||
|
totalRootPositionCurrentVacant: 0,
|
||||||
|
totalRootPositionNextUse: 0,
|
||||||
|
totalRootPositionNextVacant: 0,
|
||||||
|
children: [] as NodeTree[],
|
||||||
|
isOfficer: false,
|
||||||
|
},
|
||||||
|
]); // ข้อมูลโครงสร้าง
|
||||||
const lazy = ref(nodes);
|
const lazy = ref(nodes);
|
||||||
const expanded = ref<string[]>([]); // แสดงข้อมูลในโหนดที่เลือก
|
const expanded = ref<string[]>([]); // แสดงข้อมูลในโหนดที่เลือก
|
||||||
const nodeId = ref<string>(""); // id โหนด
|
const nodeId = ref<string>(""); // id โหนด
|
||||||
|
|
@ -233,7 +265,9 @@ async function fetchDataTree(id: string) {
|
||||||
.get(config.API.orgByid(id.toString()))
|
.get(config.API.orgByid(id.toString()))
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const data = await res.data.result;
|
const data = await res.data.result;
|
||||||
nodes.value = data;
|
nodes.value.push(...data);
|
||||||
|
nodes.value[0].orgRevisionId = id;
|
||||||
|
await fetchDataTable(reqMaster.id, id, reqMaster.type);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
|
|
@ -248,10 +282,14 @@ async function fetchDataTree(id: string) {
|
||||||
* @param id idTree
|
* @param id idTree
|
||||||
* @param level levelTree
|
* @param level levelTree
|
||||||
*/
|
*/
|
||||||
async function fetchDataTable(id: string, revisionId: string, level: number) {
|
async function fetchDataTable(
|
||||||
|
id: string | null,
|
||||||
|
revisionId: string,
|
||||||
|
level: number
|
||||||
|
) {
|
||||||
showLoader();
|
showLoader();
|
||||||
posMaster.value = [];
|
posMaster.value = [];
|
||||||
reqMaster.id = id;
|
reqMaster.id = id === "" ? null : id;
|
||||||
reqMaster.revisionId = revisionId;
|
reqMaster.revisionId = revisionId;
|
||||||
reqMaster.type = level;
|
reqMaster.type = level;
|
||||||
|
|
||||||
|
|
@ -335,6 +373,18 @@ function onDelete(id: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const modalPersonal = ref<boolean>(false);
|
||||||
|
const personId = ref<string>("");
|
||||||
|
|
||||||
|
function onOpenModalPersonal(id: string) {
|
||||||
|
personId.value = id;
|
||||||
|
modalPersonal.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function updatemodalPersonal(modal: boolean) {
|
||||||
|
modalPersonal.value = modal;
|
||||||
|
}
|
||||||
|
|
||||||
/** callblck function ทำการ fetch ข้อมูล Table เมื่อมีการเปลี่ยนหน้า*/
|
/** callblck function ทำการ fetch ข้อมูล Table เมื่อมีการเปลี่ยนหน้า*/
|
||||||
watch([() => reqMaster.pageSize], () => {
|
watch([() => reqMaster.pageSize], () => {
|
||||||
fetchDataTable(reqMaster.id, reqMaster.revisionId, reqMaster.type);
|
fetchDataTable(reqMaster.id, reqMaster.revisionId, reqMaster.type);
|
||||||
|
|
@ -567,6 +617,24 @@ onMounted(() => {
|
||||||
size="sm"
|
size="sm"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else-if="col.name === 'positionIsSelected'">
|
||||||
|
{{ col.value ? col.value : "-" }}
|
||||||
|
<q-btn
|
||||||
|
v-if="col.value !== 'ว่าง'"
|
||||||
|
flat
|
||||||
|
dense
|
||||||
|
color="info"
|
||||||
|
icon="info"
|
||||||
|
round
|
||||||
|
@click.prevent="
|
||||||
|
onOpenModalPersonal(
|
||||||
|
props.row.profileIdCurrentHolder
|
||||||
|
)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<q-tooltip>ดูข้อมูล</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
{{ col.value ? col.value : "-" }}
|
{{ col.value ? col.value : "-" }}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -720,6 +788,12 @@ onMounted(() => {
|
||||||
:fetchDataTable="fetchDataTable"
|
:fetchDataTable="fetchDataTable"
|
||||||
:reqMaster="reqMaster"
|
:reqMaster="reqMaster"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<PopupPersonal
|
||||||
|
:modal="modalPersonal"
|
||||||
|
:id="personId"
|
||||||
|
@update:modal="updatemodalPersonal"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue