API จัดการตำแหน่งติดเงื่อนไข

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-11-01 10:17:45 +07:00
parent d4696409b2
commit 9114081c21
6 changed files with 115 additions and 27 deletions

View file

@ -7,6 +7,11 @@ import http from "@/plugins/http";
import config from "@/app.config";
import type { QTableProps } from "quasar";
import type {
OrgTree,
DataPositionCondition,
} from "@/modules/19_condition/interface/response/Main";
import type { Pagination } from "@/modules/19_condition/interface/index/Main";
import LoadView from "@/components/LoadView.vue";
import DialogCondition from "@/modules/19_condition/components/DialogCondition.vue";
@ -20,7 +25,7 @@ const isLoadTable = ref<boolean>(false);
const activeId = ref<string>("");
const filter = ref<string>("");
const orgTreeId = ref<string>("");
const nodeTree = ref<any[]>([]);
const nodeTree = ref<OrgTree[]>([]);
const expanded = ref<string[]>([]);
//Table
@ -32,9 +37,9 @@ const orgLevel = ref<number>(0);
const totalPage = ref<number>(1);
const totalRow = ref<number>(0);
const modalCondition = ref<boolean>(false);
const dataCondition = ref<any>();
const dataCondition = ref<DataPositionCondition>();
const rows = ref<any[]>([]);
const rows = ref<DataPositionCondition[]>([]);
const pagination = ref({
page: 1,
rowsPerPage: 10,
@ -230,7 +235,7 @@ async function fetchDataTree(id: string) {
});
}
function onSelectedOrgTree(data: any) {
function onSelectedOrgTree(data: OrgTree) {
orgTreeId.value = data.orgTreeId;
orgLevel.value = data.orgLevel;
fetchDataTable();
@ -243,7 +248,7 @@ async function fetchDataTable() {
rows.value = [];
isLoadTable.value = true;
await http
.post(config.API.orgPosMasterList, {
.post(config.API.positionCondition, {
id: orgTreeId.value,
type: orgLevel.value,
isAll: isAll.value,
@ -256,7 +261,8 @@ async function fetchDataTable() {
const data = await res.data.result;
totalRow.value = data.total;
totalPage.value = Math.ceil(data.total / pageSize.value);
rows.value = data.data.map((e: any) => ({
rows.value = data.data.map((e: DataPositionCondition) => ({
...e,
profilePosition: e.profilePosition
? e.profilePosition
@ -282,12 +288,11 @@ function onSearchDataTable() {
fetchDataTable();
}
function updatePagination(newPagination: any) {
function updatePagination(newPagination: Pagination) {
pageSize.value = newPagination.rowsPerPage;
}
function onSetCondution(data: any) {
console.log(data);
function onSetCondution(data: DataPositionCondition) {
dataCondition.value = data;
modalCondition.value = true;
}
@ -450,7 +455,13 @@ onMounted(async () => {
:props="props"
>
<div v-if="col.name === 'isCondition'">
<q-icon name="check" color="primary" />
<q-icon
v-if="col.value"
name="check"
color="primary"
size="sm"
/>
<span v-else>-</span>
</div>
<div v-else>
{{ col.value ? col.value : "-" }}