โครงสร้างกำลัง => ปรับการค้นหา Tree
This commit is contained in:
parent
609a98d216
commit
51e544c259
2 changed files with 51 additions and 8 deletions
|
|
@ -418,7 +418,7 @@ watch(
|
||||||
default-expand-all
|
default-expand-all
|
||||||
:nodes="lazy"
|
:nodes="lazy"
|
||||||
node-key="orgTreeId"
|
node-key="orgTreeId"
|
||||||
label-key="orgTreeName"
|
label-key="labelName"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
:no-results-label="notFound"
|
:no-results-label="notFound"
|
||||||
:no-nodes-label="noData"
|
:no-nodes-label="noData"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onMounted, ref } from "vue";
|
import { onMounted, ref, computed, nextTick } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
|
|
@ -38,14 +38,47 @@ const periodLatest = ref<DataPeriodLatest>();
|
||||||
|
|
||||||
const isLoad = ref<boolean>(false);
|
const isLoad = ref<boolean>(false);
|
||||||
|
|
||||||
|
const page = ref<number>(1);
|
||||||
|
const pageSize = ref<number>(50);
|
||||||
|
const lastPage = ref<number>(0);
|
||||||
|
const loading = ref(false);
|
||||||
|
const nextPage = ref<number>(1);
|
||||||
|
|
||||||
|
function onScroll({ to, ref }: { to: number; ref: any }) {
|
||||||
|
const lastIndex = roundOptions.value.length - 1;
|
||||||
|
|
||||||
|
if (
|
||||||
|
loading.value !== true &&
|
||||||
|
nextPage.value < lastPage.value &&
|
||||||
|
to === lastIndex
|
||||||
|
) {
|
||||||
|
loading.value = true;
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
nextPage.value++;
|
||||||
|
page.value = nextPage.value;
|
||||||
|
getRound();
|
||||||
|
nextTick(() => {
|
||||||
|
ref.refresh();
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**function เรียกข้อมูลรอบการขึ้นเงินเดือน*/
|
/**function เรียกข้อมูลรอบการขึ้นเงินเดือน*/
|
||||||
async function getRound() {
|
async function getRound() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
.get(config.API.salaryPeriod() + `?page=1&pageSise=10&keyword=&year=0`)
|
.get(
|
||||||
|
config.API.salaryPeriod() +
|
||||||
|
`?page=${page.value}&pageSize=${pageSize.value}&keyword=&year=0`
|
||||||
|
)
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const data = res.data.result.data;
|
const data = res.data.result.data;
|
||||||
roundOptions.value = await data.map((x: DataRound) => ({
|
lastPage.value = Math.ceil(res.data.result.total / pageSize.value);
|
||||||
|
|
||||||
|
const optionMain = await data.map((x: DataRound) => ({
|
||||||
id: x.id,
|
id: x.id,
|
||||||
revisionId: x.revisionId,
|
revisionId: x.revisionId,
|
||||||
shortCode: x.period,
|
shortCode: x.period,
|
||||||
|
|
@ -53,12 +86,11 @@ async function getRound() {
|
||||||
(x.period === "OCT"
|
(x.period === "OCT"
|
||||||
? "รอบตุลาคม "
|
? "รอบตุลาคม "
|
||||||
: x.period === "SPECIAL"
|
: x.period === "SPECIAL"
|
||||||
? "รอบพิเศษ"
|
? "รอบพิเศษ "
|
||||||
: "รอบเมษายน ") +
|
: "รอบเมษายน ") +
|
||||||
(Number(x.year) + 543),
|
(Number(x.year) + 543),
|
||||||
}));
|
}));
|
||||||
|
roundOptions.value.push(...optionMain);
|
||||||
console.log(roundOptions.value);
|
|
||||||
|
|
||||||
roundFilter.value = await (roundOptions.value
|
roundFilter.value = await (roundOptions.value
|
||||||
? roundOptions.value[0]
|
? roundOptions.value[0]
|
||||||
|
|
@ -257,6 +289,7 @@ onMounted(async () => {
|
||||||
รายการเงินเดือน
|
รายการเงินเดือน
|
||||||
</div>
|
</div>
|
||||||
<q-space />
|
<q-space />
|
||||||
|
<!-- @virtual-scroll="onScroll" -->
|
||||||
<q-select
|
<q-select
|
||||||
v-model="roundFilter"
|
v-model="roundFilter"
|
||||||
label="รอบการขึ้นเงินเดือน"
|
label="รอบการขึ้นเงินเดือน"
|
||||||
|
|
@ -270,7 +303,17 @@ onMounted(async () => {
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
bg-color="white"
|
bg-color="white"
|
||||||
@update:model-value="onChangeRound"
|
@update:model-value="onChangeRound"
|
||||||
/>
|
:loading="loading"
|
||||||
|
@virtual-scroll="onScroll"
|
||||||
|
>
|
||||||
|
<template v-slot:option="scope">
|
||||||
|
<q-item v-bind="scope.itemProps">
|
||||||
|
<q-item-section>
|
||||||
|
<q-item-label>{{ scope.opt.name }}</q-item-label>
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-select>
|
||||||
<q-select
|
<q-select
|
||||||
class="q-ml-xs"
|
class="q-ml-xs"
|
||||||
v-model="snapFilter"
|
v-model="snapFilter"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue