Merge branch 'nice_dev' into develop
This commit is contained in:
commit
5debc893e6
7 changed files with 26 additions and 539 deletions
|
|
@ -78,4 +78,6 @@ export default {
|
||||||
orgPosMasterListEmp: `${orgEmployeePos}/master/list`,
|
orgPosMasterListEmp: `${orgEmployeePos}/master/list`,
|
||||||
orgPosMasterEmp: `${orgEmployeePos}/master`,
|
orgPosMasterEmp: `${orgEmployeePos}/master`,
|
||||||
orgPosSortEmp: `${orgEmployeePos}/sort`,
|
orgPosSortEmp: `${orgEmployeePos}/sort`,
|
||||||
|
orgPosPositionEmpById: (id: string) => `${orgEmployeePos}/position/${id}`,
|
||||||
|
orgPosMoveEmp: `${orgEmployeePos}/move`,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ const visibleColumns = ref<string[]>([
|
||||||
async function fetchPosition(id: string) {
|
async function fetchPosition(id: string) {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.orgPosPositionById(id))
|
.get(config.API.orgPosPositionEmpById(id))
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const data = res.data.result;
|
const data = res.data.result;
|
||||||
formData.prefixNo = data.posMasterNoPrefix;
|
formData.prefixNo = data.posMasterNoPrefix;
|
||||||
|
|
|
||||||
|
|
@ -101,9 +101,9 @@ function onClickMovePos() {
|
||||||
};
|
};
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.post(config.API.orgPosMove, body)
|
.post(config.API.orgPosMoveEmp, body)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
props.fetchDataTree?.(store.draftId);
|
props.fetchDataTree?.(store.activeId);
|
||||||
modal.value = false;
|
modal.value = false;
|
||||||
success($q, "ย้ายตำแหน่งสำเร็จ");
|
success($q, "ย้ายตำแหน่งสำเร็จ");
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -40,57 +40,12 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
/** ListMenuTree*/
|
|
||||||
const listAdd = ref<ListMenu[]>([
|
|
||||||
{
|
|
||||||
label: "เพิ่ม",
|
|
||||||
icon: "add",
|
|
||||||
type: "ADD",
|
|
||||||
color: "primary",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "แก้ไข",
|
|
||||||
icon: "edit",
|
|
||||||
type: "EDIT",
|
|
||||||
color: "edit",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "ลบ",
|
|
||||||
icon: "delete",
|
|
||||||
type: "DEL",
|
|
||||||
color: "red",
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
label: "ประวัติ",
|
|
||||||
icon: "history",
|
|
||||||
type: "HISTORY",
|
|
||||||
color: "purple",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "จัดลำดับ",
|
|
||||||
icon: "mdi-sort",
|
|
||||||
type: "SORT",
|
|
||||||
color: "blue-6",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "ดูรายละเอียด",
|
|
||||||
icon: "mdi-eye",
|
|
||||||
type: "DETAIL",
|
|
||||||
color: "blue-9",
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
const filter = ref<string>("");
|
const filter = ref<string>("");
|
||||||
const nodes = ref<Array<OrgTree>>([]);
|
const nodes = ref<Array<OrgTree>>([]);
|
||||||
const dataSort = ref<Array<any>>([]);
|
|
||||||
const lazy = ref(nodes);
|
const lazy = ref(nodes);
|
||||||
const expanded = ref<Array<any>>([]);
|
const expanded = ref<Array<any>>([]);
|
||||||
const notFound = ref<string>("ไม่พบข้อมูลที่ค้นหา");
|
const notFound = ref<string>("ไม่พบข้อมูลที่ค้นหา");
|
||||||
const noData = ref<string>("ไม่มีข้อมูล");
|
const noData = ref<string>("ไม่มีข้อมูล");
|
||||||
const orgLevel = ref<number>(0);
|
|
||||||
const type = ref<number>(0);
|
|
||||||
const orgId = ref<string>("");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* funtion เลือกข้อมูล Tree
|
* funtion เลือกข้อมูล Tree
|
||||||
|
|
@ -134,236 +89,6 @@ function updateSelected(data: DataTree) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const breakLoop = ref<boolean>(false);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* function แก้ไขโครสร้าง
|
|
||||||
* @param id ID โครงสร้าง
|
|
||||||
* @param type ละดับโครงสร้าง
|
|
||||||
* @param data ข้อมูลโครงสร้าง
|
|
||||||
* @param orgRootCode
|
|
||||||
*/
|
|
||||||
async function edit(id: string, type: string, data: any, orgRootCode: string) {
|
|
||||||
breakLoop.value = false;
|
|
||||||
const targetNodeId = id;
|
|
||||||
|
|
||||||
for (let index = 0; index < nodes.value.length; index++) {
|
|
||||||
const element = nodes.value[index];
|
|
||||||
|
|
||||||
searchAndReplace(element, targetNodeId, data, type, orgRootCode);
|
|
||||||
|
|
||||||
if (breakLoop.value) break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* function แก้ไขโครสร้าง
|
|
||||||
* @param treeNode
|
|
||||||
* @param organizationId ID โครงสร้าง
|
|
||||||
* @param data ข้อมูลโครงสร้าง
|
|
||||||
* @param type ละดับโครงสร้าง
|
|
||||||
* @param orgRootCode
|
|
||||||
*/
|
|
||||||
function searchAndReplace(
|
|
||||||
treeNode: any,
|
|
||||||
organizationId: string,
|
|
||||||
data: any,
|
|
||||||
type: string,
|
|
||||||
orgRootCode: string
|
|
||||||
) {
|
|
||||||
if (treeNode.orgTreeId === organizationId) {
|
|
||||||
let newData = {
|
|
||||||
...treeNode,
|
|
||||||
orgTreeName: data[`org${type}Name`],
|
|
||||||
orgTreeShortName: data[`org${type}ShortName`],
|
|
||||||
orgCode:
|
|
||||||
data.orgRootRank == "DEPARTMENT"
|
|
||||||
? data[`org${type}Code`] + "00"
|
|
||||||
: orgRootCode + data[`org${type}Code`],
|
|
||||||
orgTreeCode: data[`org${type}Code`],
|
|
||||||
orgTreePhoneEx: data[`org${type}PhoneEx`],
|
|
||||||
orgTreePhoneIn: data[`org${type}PhoneIn`],
|
|
||||||
orgTreeFax: data[`org${type}Fax`],
|
|
||||||
orgTreeRank: data[`org${type}Rank`],
|
|
||||||
};
|
|
||||||
|
|
||||||
Object.assign(treeNode, newData);
|
|
||||||
breakLoop.value = true;
|
|
||||||
} else if (treeNode.children) {
|
|
||||||
for (const child of treeNode.children) {
|
|
||||||
searchAndReplace(child, organizationId, data, type, orgRootCode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* function ลบข้อมูลโครงสร้าง
|
|
||||||
* @param rootId RootID
|
|
||||||
* @param treeId TreeID
|
|
||||||
*/
|
|
||||||
async function deleteUpdate(rootId: string, treeId: string) {
|
|
||||||
breakLoop.value = false;
|
|
||||||
if (rootId) {
|
|
||||||
for (let index = 0; index < nodes.value.length; index++) {
|
|
||||||
const element = nodes.value[index];
|
|
||||||
deleteNode(element, rootId, treeId);
|
|
||||||
|
|
||||||
if (breakLoop.value) break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
nodes.value = nodes.value.filter((x: any) => x.orgTreeId != treeId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* function ลบข้อมูลโครงสร้าง
|
|
||||||
* @param treeNode ข้อมูล Tree
|
|
||||||
* @param rootId RootID
|
|
||||||
* @param treeId TreeID
|
|
||||||
*/
|
|
||||||
function deleteNode(treeNode: any, rootId: string, treeId: string): boolean {
|
|
||||||
if (treeNode.orgTreeId === rootId) {
|
|
||||||
const childrenNew = treeNode.children.filter(
|
|
||||||
(x: any) => x.orgTreeId != treeId
|
|
||||||
);
|
|
||||||
let newData = {
|
|
||||||
...treeNode,
|
|
||||||
children: childrenNew,
|
|
||||||
};
|
|
||||||
Object.assign(treeNode, newData);
|
|
||||||
|
|
||||||
breakLoop.value = true;
|
|
||||||
} else if (treeNode.children) {
|
|
||||||
for (const child of treeNode.children) {
|
|
||||||
deleteNode(child, rootId, treeId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const modalHistory = ref<boolean>(false);
|
|
||||||
const modalSortAgency = ref<boolean>(false);
|
|
||||||
const dialogAgency = ref<boolean>(false);
|
|
||||||
const actionType = ref<string>("");
|
|
||||||
const dataNode = ref<any>();
|
|
||||||
const treeId = ref<string>("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* funcion openPopup เพิ่มหน่วยงาน
|
|
||||||
* @param level ระดับโครงสร้าง
|
|
||||||
* @param node ข้อมูล โครงสร้าง
|
|
||||||
*/
|
|
||||||
function onClickAgency(level: number, node: OrgTree | {}) {
|
|
||||||
dialogAgency.value = !dialogAgency.value;
|
|
||||||
orgLevel.value = level;
|
|
||||||
dataNode.value = node;
|
|
||||||
actionType.value = "ADD";
|
|
||||||
}
|
|
||||||
|
|
||||||
const dialogDetail = ref<boolean>(false);
|
|
||||||
/**
|
|
||||||
* funtion ดูรายละเอียดโครงสร้าง
|
|
||||||
* @param id ID โครงสร้าง
|
|
||||||
* @param level ระดับโครงสร้าง
|
|
||||||
*/
|
|
||||||
function onClickDetail(id: string, level: number) {
|
|
||||||
showLoader();
|
|
||||||
treeId.value = id;
|
|
||||||
dialogDetail.value = !dialogDetail.value;
|
|
||||||
orgLevel.value = level;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* function openPopup แก้ไขข้อมูลโครงสร้าง
|
|
||||||
* @param node ข้อมูล โครงสร้าง
|
|
||||||
*/
|
|
||||||
async function onClickEdit(node: OrgTree) {
|
|
||||||
console.log(node);
|
|
||||||
|
|
||||||
dialogAgency.value = !dialogAgency.value;
|
|
||||||
actionType.value = "EDIT";
|
|
||||||
orgLevel.value = node.orgLevel;
|
|
||||||
dataNode.value = node;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* function ยื่นยันการลบโครงสร้าง
|
|
||||||
* @param type ระดับโครงสร้าง
|
|
||||||
* @param id ID โครงสร้าง
|
|
||||||
* @param rootId RootID
|
|
||||||
*/
|
|
||||||
async function onClickDel(type: number, id: string, rootId: string) {
|
|
||||||
const level = store.checkLevel(type);
|
|
||||||
dialogRemove($q, async () => {
|
|
||||||
showLoader();
|
|
||||||
await http
|
|
||||||
.delete(config.API.orgLevelByid(level.toLocaleLowerCase(), id))
|
|
||||||
.then(() => {
|
|
||||||
success($q, "ลบข้อมูลสำเร็จ");
|
|
||||||
deleteUpdate(rootId, id);
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
messageError($q, err);
|
|
||||||
})
|
|
||||||
.finally(async () => {
|
|
||||||
hideLoader();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* function การจัดลำดับโครงสร้าง
|
|
||||||
* @param id ID โครงสร้าง
|
|
||||||
* @param level ระดับโครงสร้าง
|
|
||||||
*/
|
|
||||||
async function onClickSort(id: string, level: number) {
|
|
||||||
type.value = level;
|
|
||||||
modalSortAgency.value = true;
|
|
||||||
if (id) {
|
|
||||||
breakLoop.value = false;
|
|
||||||
const orgId = id;
|
|
||||||
for (let index = 0; index < nodes.value.length; index++) {
|
|
||||||
const data = nodes.value[index];
|
|
||||||
searchAndReplace(data, orgId);
|
|
||||||
if (breakLoop.value) break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
const dataList = nodes.value;
|
|
||||||
const dataMap = dataList.map((item: any) => ({
|
|
||||||
orgTreeId: item.orgTreeId,
|
|
||||||
orgLevel: item.orgLevel,
|
|
||||||
orgTreeName: item.orgTreeName,
|
|
||||||
orgTreeShortName: item.orgTreeShortName,
|
|
||||||
orgRevisionId: item.orgRevisionId,
|
|
||||||
}));
|
|
||||||
|
|
||||||
dataSort.value = dataMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
function searchAndReplace(data: any, id: string) {
|
|
||||||
if (data.orgTreeId === id) {
|
|
||||||
dataSort.value = data.children;
|
|
||||||
breakLoop.value = true;
|
|
||||||
} else if (data.children) {
|
|
||||||
for (const child of data.children) {
|
|
||||||
searchAndReplace(child, id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* function ดูประวัดโครงสร้าง
|
|
||||||
* @param level ระดับโครงสร้าง
|
|
||||||
* @param id ID โครงสร้าง
|
|
||||||
*/
|
|
||||||
function onClickHistory(level: number, id: string) {
|
|
||||||
type.value = level;
|
|
||||||
orgId.value = id;
|
|
||||||
modalHistory.value = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => nodeTEST.value,
|
() => nodeTEST.value,
|
||||||
() => {
|
() => {
|
||||||
|
|
@ -376,22 +101,7 @@ watch(
|
||||||
<div class="col-12 q-py-sm q-px-sm">
|
<div class="col-12 q-py-sm q-px-sm">
|
||||||
<div class="q-gutter-sm">
|
<div class="q-gutter-sm">
|
||||||
<div class="row q-col-gutter-sm q-pl-sm">
|
<div class="row q-col-gutter-sm q-pl-sm">
|
||||||
<div class="col-2" v-if="store.typeOrganizational === 'draft'">
|
<div class="col-12">
|
||||||
<q-btn
|
|
||||||
dense
|
|
||||||
flat
|
|
||||||
round
|
|
||||||
color="primary"
|
|
||||||
icon="add"
|
|
||||||
@click="onClickAgency(0, {})"
|
|
||||||
>
|
|
||||||
<q-tooltip>เพิ่มหน่วยงาน</q-tooltip>
|
|
||||||
</q-btn>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
|
||||||
:class="store.typeOrganizational === 'draft' ? 'col-10' : 'col-12'"
|
|
||||||
>
|
|
||||||
<q-input dense outlined v-model="filter" label="ค้นหา">
|
<q-input dense outlined v-model="filter" label="ค้นหา">
|
||||||
<template v-slot:append>
|
<template v-slot:append>
|
||||||
<q-icon
|
<q-icon
|
||||||
|
|
@ -439,172 +149,12 @@ watch(
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<q-btn
|
|
||||||
v-if="store.typeOrganizational === 'draft'"
|
|
||||||
flat
|
|
||||||
dense
|
|
||||||
icon="mdi-dots-vertical"
|
|
||||||
class="q-ml-xs"
|
|
||||||
color="grey-13"
|
|
||||||
size="12px"
|
|
||||||
round
|
|
||||||
>
|
|
||||||
<q-menu>
|
|
||||||
<q-list
|
|
||||||
dense
|
|
||||||
v-for="(item, index) in prop.node.orgLevel === 4
|
|
||||||
? listAdd.slice(1, 6)
|
|
||||||
: listAdd"
|
|
||||||
:key="index"
|
|
||||||
style="min-width: 100px"
|
|
||||||
>
|
|
||||||
<q-item
|
|
||||||
clickable
|
|
||||||
v-close-popup
|
|
||||||
@click="
|
|
||||||
item.type === 'EDIT'
|
|
||||||
? onClickEdit(prop.node)
|
|
||||||
: item.type === 'ADD'
|
|
||||||
? onClickAgency(prop.node.orgLevel + 1, prop.node)
|
|
||||||
: item.type === 'DETAIL'
|
|
||||||
? onClickDetail(
|
|
||||||
prop.node.orgTreeId,
|
|
||||||
prop.node.orgLevel
|
|
||||||
)
|
|
||||||
: item.type === 'DEL'
|
|
||||||
? onClickDel(
|
|
||||||
prop.node.orgLevel,
|
|
||||||
prop.node.orgTreeId,
|
|
||||||
prop.node.orgRootId
|
|
||||||
)
|
|
||||||
: item.type === 'SORT'
|
|
||||||
? onClickSort(prop.node.orgRootId, prop.node.orgLevel)
|
|
||||||
: item.type === 'HISTORY'
|
|
||||||
? onClickHistory(
|
|
||||||
prop.node.orgLevel,
|
|
||||||
prop.node.orgTreeId
|
|
||||||
)
|
|
||||||
: null
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<q-item-section avatar style="min-width: 20px">
|
|
||||||
<q-icon
|
|
||||||
size="17px"
|
|
||||||
:color="item.color"
|
|
||||||
:name="item.icon"
|
|
||||||
/>
|
|
||||||
</q-item-section>
|
|
||||||
<div v-if="prop.node.orgLevel === 0">
|
|
||||||
<q-item-section
|
|
||||||
v-if="
|
|
||||||
item.type === 'EDIT' ||
|
|
||||||
item.type === 'DEL' ||
|
|
||||||
item.type === 'HISTORY' ||
|
|
||||||
item.type === 'SORT'
|
|
||||||
"
|
|
||||||
>
|
|
||||||
{{ item.label }}หน่วยงาน
|
|
||||||
</q-item-section>
|
|
||||||
<q-item-section v-else-if="item.type === 'ADD'">
|
|
||||||
{{ item.label }}ส่วนราชการ
|
|
||||||
</q-item-section>
|
|
||||||
<q-item-section v-else>
|
|
||||||
{{ item.label }}
|
|
||||||
</q-item-section>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-else>
|
|
||||||
<q-item-section
|
|
||||||
v-if="
|
|
||||||
item.type === 'ADD' ||
|
|
||||||
item.type === 'EDIT' ||
|
|
||||||
item.type === 'DEL' ||
|
|
||||||
item.type === 'HISTORY' ||
|
|
||||||
item.type === 'SORT'
|
|
||||||
"
|
|
||||||
>{{ item.label }}ส่วนราชการ</q-item-section
|
|
||||||
>
|
|
||||||
<q-item-section v-else>{{ item.label }}</q-item-section>
|
|
||||||
</div>
|
|
||||||
</q-item>
|
|
||||||
</q-list>
|
|
||||||
</q-menu>
|
|
||||||
</q-btn>
|
|
||||||
|
|
||||||
<q-btn
|
|
||||||
v-else
|
|
||||||
flat
|
|
||||||
dense
|
|
||||||
icon="mdi-dots-vertical"
|
|
||||||
class="q-pa-none q-ml-xs"
|
|
||||||
color="grey-13"
|
|
||||||
size="12px"
|
|
||||||
round
|
|
||||||
>
|
|
||||||
<q-menu>
|
|
||||||
<q-list
|
|
||||||
dense
|
|
||||||
v-for="(item, index) in listAdd.slice(5, 6)"
|
|
||||||
:key="index"
|
|
||||||
style="min-width: 100px"
|
|
||||||
>
|
|
||||||
<q-item
|
|
||||||
clickable
|
|
||||||
v-close-popup
|
|
||||||
@click="
|
|
||||||
onClickDetail(prop.node.orgTreeId, prop.node.orgLevel)
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<q-item-section avatar style="min-width: 20px">
|
|
||||||
<q-icon
|
|
||||||
size="17px"
|
|
||||||
:color="item.color"
|
|
||||||
:name="item.icon"
|
|
||||||
/>
|
|
||||||
</q-item-section>
|
|
||||||
<q-item-section>{{ item.label }}</q-item-section>
|
|
||||||
</q-item>
|
|
||||||
</q-list>
|
|
||||||
</q-menu>
|
|
||||||
</q-btn>
|
|
||||||
</q-item>
|
</q-item>
|
||||||
</template>
|
</template>
|
||||||
</q-tree>
|
</q-tree>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- เพิ่มหน่วยงาน -->
|
|
||||||
<DialogAgency
|
|
||||||
:modal="dialogAgency"
|
|
||||||
:close="onClickAgency"
|
|
||||||
v-model:orgLevel="orgLevel"
|
|
||||||
:fetchDataTree="props.fetchDataTree"
|
|
||||||
:fetchDataTable="props.fetchDataTable"
|
|
||||||
v-model:actionType="actionType"
|
|
||||||
:dataNode="dataNode"
|
|
||||||
:edit="edit"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- รายละเอียดโครงสร้าง -->
|
|
||||||
<DialogStructureDetail
|
|
||||||
v-model:structure-detail="dialogDetail"
|
|
||||||
v-model:treeId="treeId"
|
|
||||||
v-model:orgLevel="orgLevel"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<DialogSortAgency
|
|
||||||
v-model:sort-agency="modalSortAgency"
|
|
||||||
v-model:data="dataSort"
|
|
||||||
:fetchDataTree="props.fetchDataTree"
|
|
||||||
v-model:type="type"
|
|
||||||
/>
|
|
||||||
<DialogHistory
|
|
||||||
v-model:history="modalHistory"
|
|
||||||
v-model:type="type"
|
|
||||||
v-model:org-id="orgId"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
||||||
|
|
@ -86,18 +86,18 @@ const listMenu = ref<ListMenu[]>([
|
||||||
type: "MOVE",
|
type: "MOVE",
|
||||||
color: "blue-10",
|
color: "blue-10",
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
label: "สืบทอดตำแหน่ง",
|
// label: "สืบทอดตำแหน่ง",
|
||||||
icon: "mdi-account-multiple-outline",
|
// icon: "mdi-account-multiple-outline",
|
||||||
type: "INHERIT",
|
// type: "INHERIT",
|
||||||
color: "deep-orange",
|
// color: "deep-orange",
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
label: "ประวัติตำแหน่ง",
|
// label: "ประวัติตำแหน่ง",
|
||||||
icon: "history",
|
// icon: "history",
|
||||||
type: "HISTORY",
|
// type: "HISTORY",
|
||||||
color: "deep-purple",
|
// color: "deep-purple",
|
||||||
},
|
// },
|
||||||
]);
|
]);
|
||||||
const document = ref<any>([
|
const document = ref<any>([
|
||||||
{
|
{
|
||||||
|
|
@ -592,10 +592,7 @@ async function onClickDownloadReport(val: string, name: string) {
|
||||||
<q-list dense style="min-width: 150px">
|
<q-list dense style="min-width: 150px">
|
||||||
<!-- เลือกคนครอง -->
|
<!-- เลือกคนครอง -->
|
||||||
<q-item
|
<q-item
|
||||||
v-if="
|
v-if="props.row.positionIsSelected == 'ว่าง'"
|
||||||
props.row.positionIsSelected == 'ว่าง' &&
|
|
||||||
store.typeOrganizational === 'draft'
|
|
||||||
"
|
|
||||||
clickable
|
clickable
|
||||||
v-close-popup
|
v-close-popup
|
||||||
@click="openSelectPerson(props.row)"
|
@click="openSelectPerson(props.row)"
|
||||||
|
|
@ -612,10 +609,7 @@ async function onClickDownloadReport(val: string, name: string) {
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item
|
<q-item
|
||||||
v-else-if="
|
v-else-if="props.row.positionIsSelected != 'ว่าง'"
|
||||||
props.row.positionIsSelected != 'ว่าง' &&
|
|
||||||
store.typeOrganizational === 'draft'
|
|
||||||
"
|
|
||||||
clickable
|
clickable
|
||||||
v-close-popup
|
v-close-popup
|
||||||
@click="removePerson(props.row.id)"
|
@click="removePerson(props.row.id)"
|
||||||
|
|
@ -632,9 +626,7 @@ async function onClickDownloadReport(val: string, name: string) {
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item
|
<q-item
|
||||||
v-for="(item, index) in store.typeOrganizational === 'draft'
|
v-for="(item, index) in listMenu"
|
||||||
? listMenu
|
|
||||||
: listMenu.filter((e) => e.type === 'HISTORY')"
|
|
||||||
:key="index"
|
:key="index"
|
||||||
clickable
|
clickable
|
||||||
v-close-popup
|
v-close-popup
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,6 @@ const store = usePositionEmp();
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const { showLoader, hideLoader, messageError } = useCounterMixin();
|
const { showLoader, hideLoader, messageError } = useCounterMixin();
|
||||||
|
|
||||||
/** props*/
|
|
||||||
const historyId = defineModel<string>("historyId", { required: true }); // id ประวัติโครงสร้าง
|
|
||||||
const count = defineModel<number>("count", { required: true });
|
|
||||||
|
|
||||||
const nodeTree = ref<OrgTree[]>(); // ข้อมูล Tree
|
const nodeTree = ref<OrgTree[]>(); // ข้อมูล Tree
|
||||||
const nodeId = ref<string>(""); // id ของ Tree
|
const nodeId = ref<string>(""); // id ของ Tree
|
||||||
const orgLevel = ref<number>(0); // levelTree
|
const orgLevel = ref<number>(0); // levelTree
|
||||||
|
|
@ -178,36 +174,12 @@ function searchAndReplaceOrgName(data: any, targetId: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**lifecycle Hook*/
|
/**lifecycle Hook*/
|
||||||
onMounted(async () => {
|
onMounted(() => {
|
||||||
const id =
|
setTimeout(async () => {
|
||||||
store.typeOrganizational === "current"
|
store.activeId && (await fetchDataTree(store.activeId));
|
||||||
? store.activeId
|
}, 200);
|
||||||
: store.typeOrganizational === "draft"
|
|
||||||
? store.draftId
|
|
||||||
: historyId.value;
|
|
||||||
id && (await fetchDataTree(id));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/** callback function ทำงาน ทำการ fetch ข้อมูล Tree เมื่อมีการเลือกประวัติโครงสร้าง*/
|
|
||||||
watch(
|
|
||||||
() => count.value,
|
|
||||||
() => {
|
|
||||||
fetchDataTree(historyId.value);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/** callblck function ทำการ fetch ข้อมูล Tree เมื่อมีการเปลี่ยนโครงสร้าง*/
|
|
||||||
watch(
|
|
||||||
() => store.typeOrganizational,
|
|
||||||
() => {
|
|
||||||
const id =
|
|
||||||
store.typeOrganizational === "current" ? store.activeId : store.draftId;
|
|
||||||
id && store.typeOrganizational !== "old" && fetchDataTree(id);
|
|
||||||
nodeId.value = "";
|
|
||||||
store.treeId = "";
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/** callblck function ทำการ fetch ข้อมูล Table เมื่อมีการเปลี่ยนหน้า*/
|
/** callblck function ทำการ fetch ข้อมูล Table เมื่อมีการเปลี่ยนหน้า*/
|
||||||
watch([() => reqMaster.page, () => reqMaster.pageSize], () => {
|
watch([() => reqMaster.page, () => reqMaster.pageSize], () => {
|
||||||
action1.value === false &&
|
action1.value === false &&
|
||||||
|
|
@ -226,13 +198,6 @@ watch(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(
|
|
||||||
() => store.draftId,
|
|
||||||
() => {
|
|
||||||
store.draftId && fetchDataTree(store.draftId?.toString());
|
|
||||||
}
|
|
||||||
);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
||||||
|
|
@ -16,13 +16,6 @@ const $q = useQuasar();
|
||||||
const { showLoader, hideLoader, messageError } = useCounterMixin();
|
const { showLoader, hideLoader, messageError } = useCounterMixin();
|
||||||
const store = usePositionEmp();
|
const store = usePositionEmp();
|
||||||
|
|
||||||
/** สถานะ*/
|
|
||||||
const isStatusData = ref<boolean>(false); // แสดงตั้งเวลาเผยแพร่
|
|
||||||
|
|
||||||
/** ประวัติโครงสร้าง*/
|
|
||||||
const historyId = ref<string>(""); // ID ประวัติโครงสร้าง
|
|
||||||
const count = ref<number>(0);
|
|
||||||
|
|
||||||
/** function เรียกข้อมูลโครงสร้าง แบบปัจุบันและ แบบร่าง*/
|
/** function เรียกข้อมูลโครงสร้าง แบบปัจุบันและ แบบร่าง*/
|
||||||
async function fetchOrganizationActive() {
|
async function fetchOrganizationActive() {
|
||||||
showLoader();
|
showLoader();
|
||||||
|
|
@ -32,20 +25,6 @@ async function fetchOrganizationActive() {
|
||||||
const data = res.data.result;
|
const data = res.data.result;
|
||||||
if (data) {
|
if (data) {
|
||||||
store.fetchDataActive(data);
|
store.fetchDataActive(data);
|
||||||
if (data.activeName === null && data.draftName === null) {
|
|
||||||
isStatusData.value = false;
|
|
||||||
} else {
|
|
||||||
isStatusData.value = true;
|
|
||||||
if (isStatusData.value) {
|
|
||||||
if (data.activeName === null) {
|
|
||||||
// ishasActive.value = true;
|
|
||||||
store.typeOrganizational = "draft";
|
|
||||||
} else if (data.draftName === null) {
|
|
||||||
// ishasDraft.value = true;
|
|
||||||
store.typeOrganizational = "current";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
@ -58,7 +37,6 @@ async function fetchOrganizationActive() {
|
||||||
|
|
||||||
/** lifecycleHook */
|
/** lifecycleHook */
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
store.typeOrganizational = "current";
|
|
||||||
await fetchOrganizationActive();
|
await fetchOrganizationActive();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -73,7 +51,7 @@ onMounted(async () => {
|
||||||
<q-card flat bordered>
|
<q-card flat bordered>
|
||||||
<q-card class="my-card">
|
<q-card class="my-card">
|
||||||
<q-card-section style="padding: 0px">
|
<q-card-section style="padding: 0px">
|
||||||
<TreeView v-model:historyId="historyId" v-model:count="count" />
|
<TreeView />
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</q-card>
|
</q-card>
|
||||||
</q-card>
|
</q-card>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue