ปรับโครงสร้าง

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-11-21 18:00:03 +07:00
parent 21b79e5fd0
commit 8a91cf97d6
6 changed files with 190 additions and 37 deletions

View file

@ -18,7 +18,7 @@ import type {
/** importComponents*/
import DialogResponsibilities from "@/modules/02_users/components/05_responsIbilities/DialogResponsibilities.vue";
import PopupPersonal from "@/modules/02_users/components/RoleOrganization/DialogPersonal.vue";
/** use*/
const $q = useQuasar();
@ -27,7 +27,39 @@ const { showLoader, hideLoader, messageError, success, dialogRemove } =
/** Tree*/
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 expanded = ref<string[]>([]); //
const nodeId = ref<string>(""); // id
@ -233,7 +265,9 @@ async function fetchDataTree(id: string) {
.get(config.API.orgByid(id.toString()))
.then(async (res) => {
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) => {
messageError($q, err);
@ -248,10 +282,14 @@ async function fetchDataTree(id: string) {
* @param id idTree
* @param level levelTree
*/
async function fetchDataTable(id: string, revisionId: string, level: number) {
async function fetchDataTable(
id: string | null,
revisionId: string,
level: number
) {
showLoader();
posMaster.value = [];
reqMaster.id = id;
reqMaster.id = id === "" ? null : id;
reqMaster.revisionId = revisionId;
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 เมื่อมีการเปลี่ยนหน้า*/
watch([() => reqMaster.pageSize], () => {
fetchDataTable(reqMaster.id, reqMaster.revisionId, reqMaster.type);
@ -567,6 +617,24 @@ onMounted(() => {
size="sm"
/>
</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>
{{ col.value ? col.value : "-" }}
</div>
@ -720,6 +788,12 @@ onMounted(() => {
:fetchDataTable="fetchDataTable"
:reqMaster="reqMaster"
/>
<PopupPersonal
:modal="modalPersonal"
:id="personId"
@update:modal="updatemodalPersonal"
/>
</template>
<style scoped>