แก้รายการลา
This commit is contained in:
parent
7fa0a1b11d
commit
5d165e8610
3 changed files with 23 additions and 22 deletions
|
|
@ -23,7 +23,7 @@ const { showLoader, hideLoader, messageError } = mixin;
|
|||
const total = ref<number>(0);
|
||||
const totalList = ref<number>(1);
|
||||
|
||||
const querySting = reactive<QuerySting>({
|
||||
const querySting = ref<QuerySting>({
|
||||
year: leaveStore.filter.year, //*ปีในการยื่นขอใบลา(ใช้เป็น คศ.)
|
||||
type: leaveStore.filter.type, //*Id ประเภทการลา
|
||||
status: leaveStore.filter.status, //*สถานะการของลา
|
||||
|
|
@ -38,22 +38,22 @@ const querySting = reactive<QuerySting>({
|
|||
//** เรียกข้อมูลจาก API*/
|
||||
async function fecthLeaveList() {
|
||||
leaveStore.rows = [];
|
||||
querySting.keyword = querySting.keyword.trim();
|
||||
querySting.status = await (querySting.status == null
|
||||
querySting.value.keyword = querySting.value.keyword.trim();
|
||||
querySting.value.status = await (querySting.value.status == null
|
||||
? "ALL"
|
||||
: querySting.status);
|
||||
querySting.type = await (querySting.type == null
|
||||
: querySting.value.status);
|
||||
querySting.value.type = await (querySting.value.type == null
|
||||
? "00000000-0000-0000-0000-000000000000"
|
||||
: querySting.type);
|
||||
: querySting.value.type);
|
||||
|
||||
if (querySting.status != null && querySting.type != null) {
|
||||
if (querySting.value.status != null && querySting.value.type != null) {
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.leaveList(), querySting)
|
||||
.post(config.API.leaveList(), querySting.value)
|
||||
.then(async (res) => {
|
||||
const data = res.data.result;
|
||||
totalList.value = Math.ceil(
|
||||
res.data.result.total / querySting.pageSize
|
||||
res.data.result.total / querySting.value.pageSize
|
||||
);
|
||||
total.value = res.data.result.total;
|
||||
await leaveStore.fetchListLeave(data.data); /** ส่งข้อมูลไป stores*/
|
||||
|
|
@ -82,12 +82,12 @@ async function fetchOption() {
|
|||
}
|
||||
|
||||
function getSearch() {
|
||||
querySting.page = 1;
|
||||
querySting.value.page = 1;
|
||||
fecthLeaveList();
|
||||
}
|
||||
|
||||
watch(
|
||||
() => querySting.pageSize,
|
||||
() => querySting.value.pageSize,
|
||||
async () => {
|
||||
getSearch();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ const $q = useQuasar(); //ใช้ noti quasar
|
|||
const total = ref<number>(0);
|
||||
const totalList = ref<number>(1);
|
||||
|
||||
const querySting = reactive<QuerySting>({
|
||||
const querySting = ref<QuerySting>({
|
||||
year: leaveStore.filter.year, //*ปีในการยื่นขอใบลา(ใช้เป็น คศ.)
|
||||
type: leaveStore.filter.type, //*Id ประเภทการลา
|
||||
status: leaveStore.filter.status, //*สถานะการของลา
|
||||
|
|
@ -39,22 +39,22 @@ const querySting = reactive<QuerySting>({
|
|||
//** เรียกข้อมูลจาก API*/
|
||||
async function fecthLeaveList() {
|
||||
leaveStore.rows = [];
|
||||
querySting.keyword = querySting.keyword.trim();
|
||||
querySting.status = await (querySting.status == null
|
||||
querySting.value.keyword = querySting.value.keyword.trim();
|
||||
querySting.value.status = await (querySting.value.status == null
|
||||
? "ALL"
|
||||
: querySting.status);
|
||||
querySting.type = await (querySting.type == null
|
||||
: querySting.value.status);
|
||||
querySting.value.type = await (querySting.value.type == null
|
||||
? "00000000-0000-0000-0000-000000000000"
|
||||
: querySting.type);
|
||||
: querySting.value.type);
|
||||
|
||||
if (querySting.status != null && querySting.type != null) {
|
||||
if (querySting.value.status != null && querySting.value.type != null) {
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.leaveListDelete(), querySting)
|
||||
.post(config.API.leaveListDelete(), querySting.value)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
totalList.value = Math.ceil(
|
||||
res.data.result.total / querySting.pageSize
|
||||
res.data.result.total / querySting.value.pageSize
|
||||
);
|
||||
total.value = res.data.result.total;
|
||||
fetchListLeaveReject(data.data); /** ส่งข้อมูลไป stores*/
|
||||
|
|
@ -83,12 +83,12 @@ async function fetchOption() {
|
|||
}
|
||||
|
||||
function getSearch() {
|
||||
querySting.page = 1;
|
||||
querySting.value.page = 1;
|
||||
fecthLeaveList();
|
||||
}
|
||||
|
||||
watch(
|
||||
() => querySting.pageSize,
|
||||
() => querySting.value.pageSize,
|
||||
async () => {
|
||||
getSearch();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,6 +173,7 @@ export const useLeavelistDataStore = defineStore("leave", () => {
|
|||
dataToobar.value = val.map((e: any) => ({
|
||||
id: e.id,
|
||||
name: e.name,
|
||||
code:e.code
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue