โครงสร้างอัตรากำลัง => ปรับย้ายตำแหน่ง
This commit is contained in:
parent
e5d1a58f66
commit
c6936bae34
3 changed files with 86 additions and 4 deletions
|
|
@ -9,7 +9,10 @@ import type {
|
|||
OrgTree,
|
||||
PosMaster2,
|
||||
} from "@/modules/02_organizationalNew/interface/response/organizational";
|
||||
import type { MovePos } from "@/modules/02_organizationalNew/interface/request/organizational";
|
||||
import type {
|
||||
MovePos,
|
||||
FilterMaster,
|
||||
} from "@/modules/02_organizationalNew/interface/request/organizational";
|
||||
import type { DataTree } from "@/modules/02_organizationalNew/interface/index/organizational";
|
||||
|
||||
import HeaderDialog from "@/components/DialogHeader.vue";
|
||||
|
|
@ -29,6 +32,8 @@ const {
|
|||
} = useCounterMixin();
|
||||
|
||||
const modal = defineModel<boolean>("modal", { required: true });
|
||||
const reqMaster = defineModel<FilterMaster>("reqMaster", { required: true });
|
||||
const totalPage = defineModel<number>("totalPage", { required: true });
|
||||
const nodeTree = defineModel<OrgTree[]>("nodeTree", { required: true });
|
||||
const columns = defineModel<QTableProps[]>("columns", {});
|
||||
const rows = defineModel<PosMaster2[]>("rows", { required: true });
|
||||
|
|
@ -111,9 +116,60 @@ function onClickMovePos() {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function fetch ข้อรายการตำแหน่ง
|
||||
* @param id idTree
|
||||
* @param level levelTree
|
||||
*/
|
||||
async function fetchDataTable(id: string, level: number, action: boolean) {
|
||||
// orgLevel.value = level;
|
||||
// reqMaster.id = id;
|
||||
// reqMaster.type = level;
|
||||
// action1.value = action;
|
||||
// if (action) {
|
||||
// setTimeout(() => {
|
||||
// action1.value = false;
|
||||
// }, 1000);
|
||||
// reqMaster.isAll = false;
|
||||
// reqMaster.page = 1;
|
||||
// reqMaster.pageSize = 10;
|
||||
// reqMaster.keyword = "";
|
||||
// }
|
||||
// if (action === true) {
|
||||
// isLoad.value = true;
|
||||
// }
|
||||
// await http
|
||||
// .post(config.API.orgPosMasterList, reqMaster)
|
||||
// .then((res) => {
|
||||
// posMaster.value = [];
|
||||
// const dataMain: PosMaster[] = [];
|
||||
// totalPage.value = Math.ceil(res.data.result.total / reqMaster.pageSize);
|
||||
// res.data.result.data.forEach((e: PosMaster) => {
|
||||
// const p = e.positions;
|
||||
// if (p.length !== 0) {
|
||||
// const a = p.find((el: Position) => el.positionIsSelected === true);
|
||||
// const { id, ...rest } = a ? a : p[0];
|
||||
// const test = { ...e, ...rest };
|
||||
// dataMain.push(test);
|
||||
// }
|
||||
// });
|
||||
// posMaster.value = store.fetchPosMaster(dataMain);
|
||||
// })
|
||||
// .catch((err) => {
|
||||
// messageError($q, err);
|
||||
// posMaster.value = [];
|
||||
// })
|
||||
// .finally(() => {
|
||||
// setTimeout(() => {
|
||||
// isLoad.value = false;
|
||||
// }, 500);
|
||||
// });
|
||||
}
|
||||
|
||||
watch(
|
||||
() => modal.value,
|
||||
() => {
|
||||
reqMaster.value.page = 1;
|
||||
if (modal.value && props.type === "SINGER") {
|
||||
const data = rows.value.filter((e: PosMaster2) => e.id === props.rowId);
|
||||
selectedFilter.value = data;
|
||||
|
|
@ -181,7 +237,11 @@ watch(
|
|||
:props="props"
|
||||
>
|
||||
<div v-if="col.name == 'no'">
|
||||
{{ props.rowIndex + 1 }}
|
||||
{{
|
||||
(reqMaster.page - 1) * Number(reqMaster.pageSize) +
|
||||
props.rowIndex +
|
||||
1
|
||||
}}
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
|
|
@ -190,6 +250,17 @@ watch(
|
|||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:pagination="scope">
|
||||
<q-pagination
|
||||
v-model="reqMaster.page"
|
||||
active-color="primary"
|
||||
color="dark"
|
||||
:max="totalPage"
|
||||
size="sm"
|
||||
boundary-links
|
||||
direction-links
|
||||
></q-pagination>
|
||||
</template>
|
||||
</d-table>
|
||||
</q-card>
|
||||
|
||||
|
|
|
|||
|
|
@ -159,11 +159,20 @@ watch(
|
|||
);
|
||||
|
||||
/** callblck function ทำการ fetch ข้อมูล Table เมื่อมีการเปลี่ยนหน้า*/
|
||||
watch([() => reqMaster.page, () => reqMaster.pageSize], () => {
|
||||
action1.value === false &&
|
||||
fetchDataTable(reqMaster.id, reqMaster.type, false);
|
||||
});
|
||||
|
||||
/** callblck function ทำการ fetch ข้อมูล Table เมื่อแสดงตำแหน่งทั้งหมด*/
|
||||
watch(
|
||||
[() => reqMaster.page, () => reqMaster.pageSize, () => reqMaster.isAll],
|
||||
() => reqMaster.isAll,
|
||||
() => {
|
||||
action1.value === false &&
|
||||
if (reqMaster.page !== 1) {
|
||||
reqMaster.page = 1;
|
||||
} else {
|
||||
fetchDataTable(reqMaster.id, reqMaster.type, false);
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -806,6 +806,8 @@ async function genReportDoc(data: any) {
|
|||
v-model:nodeTree="nodeTree"
|
||||
v-model:columns="columns as QTableProps[]"
|
||||
v-model:rows="posMaster"
|
||||
v-model:totalPage="totalPage"
|
||||
v-model:reqMaster="reqMaster"
|
||||
:fetchDataTree="props.fetchDataTree"
|
||||
:type="typeMove"
|
||||
:rowId="rowId"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue