Merge branch 'develop' into setthawut

This commit is contained in:
setthawutttty 2025-01-10 09:23:50 +07:00
commit 667118b92f
55 changed files with 1396 additions and 686 deletions

View file

@ -1,8 +1,9 @@
import env from "../index";
const log = `${env.API_LOG}/log`;
// const log = `${env.API_URI}/log`;
const reportTemplate = `${env.API_REPORT_TEMPLATE_URI}`;
export default {
log,
reportLog: `${log}/report/logsList`,
reportTemplate,
};

View file

@ -3,8 +3,7 @@ import { ref } from "vue";
const env = ref<string>(process.env.NODE_ENV || "development");
export const apiUrlConfig = import.meta.env.VITE_API_URI_CONFIG;
// export const apiUrlConfigPublish = import.meta.env.VITE_API_PUBLISH_URL;
// export const apiUrlConfigReport = import.meta.env.VITE_API_REPORT_URL;
export const apiUrlConfigReport = import.meta.env.VITE_API_REPORT_URL;
// if (process.env.VUE_APP_TEST) {
// env = "test";
// }
@ -17,7 +16,6 @@ const config = ref<any>({
API_URI_PROFILE_SERVICE: apiUrlConfig,
API_REPORT_URI: apiUrlConfig,
MEET_URI: "meet.frappet.com",
API_REPORT2_URI: "https://bma-ehr.frappet.synology.me/api/v2",
API_REPORT_TEMPLATE_URI:
"https://report-server.frappet.synology.me/api/v1/report-template",
API_LOG: apiUrlConfig,
@ -36,9 +34,7 @@ const config = ref<any>({
API_URI_PROFILE_SERVICE: apiUrlConfig,
API_REPORT_URI: apiUrlConfig,
MEET_URI: "meet.frappet.com",
API_REPORT2_URI: `${window.location.protocol}//${window.location.host}/api/v2`,
API_REPORT_TEMPLATE_URI:
"https://report-server.frappet.synology.me/api/v1/report-template",
API_REPORT_TEMPLATE_URI: apiUrlConfigReport,
API_LOG: apiUrlConfig,
},
});
@ -55,7 +51,6 @@ const MEET_URI = ref<string>(config.value[env.value].MEET_URI);
const API_URI_PROFILE_SERVICE = ref<string>(
config.value[env.value].API_URI_PROFILE_SERVICE
);
const API_REPORT2_URI = ref<string>(config.value[env.value].API_REPORT2_URI);
const API_REPORT_TEMPLATE_URI = ref<string>(
config.value[env.value].API_REPORT_TEMPLATE_URI
);
@ -70,7 +65,6 @@ export default {
API_URI_ORG_EMPLOYEE_SERVICE: API_URI_ORG_EMPLOYEE_SERVICE.value,
API_URI_PROFILE_SERVICE: API_URI_PROFILE_SERVICE.value,
MEET_URI: MEET_URI.value,
API_REPORT2_URI: API_REPORT2_URI.value,
API_REPORT_TEMPLATE_URI: API_REPORT_TEMPLATE_URI.value,
API_LOG: API_LOG.value,
};

View file

@ -1,49 +0,0 @@
/**
* api
*/
import env from "../index";
const reportOrder = `${env.API_REPORT2_URI}/report/order`;
const reportRetire = `${env.API_REPORT2_URI}/report/retire`;
const reportProbation = `${env.API_REPORT2_URI}/report/probation`;
const reportResign = `${env.API_REPORT2_URI}/report/resign/33`;
const reportTransfer = `${env.API_REPORT2_URI}/report/transfer`;
const reportDeceased = `${env.API_REPORT2_URI}/report/deceased`;
const reportTemplate = `${env.API_REPORT_TEMPLATE_URI}`;
export default {
reportOrderCover: (fileType: string, id: string, commandCode: string) =>
`${reportOrder}/${commandCode}/cover/${fileType}/${id}`,
reportOrderAttachment: (fileType: string, id: string, commandCode: string) =>
`${reportOrder}/${commandCode}/attachment/${fileType}/${id}`,
reportRetireList: (fileType: string, id: string) =>
`${reportRetire}/${fileType}/${id}`,
reportResignList: (fileType: string, id: string) =>
`${reportResign}/${fileType}/${id}`,
fileCover: (format: string, fileType: string, id: string) =>
`${reportOrder}/${format}/cover/${fileType}/${id}`,
fileAttachment: (format: string, fileType: string, id: string) =>
`${reportOrder}/${format}/attachment/${fileType}/${id}`,
//ระบบทดลองงาน
reportAssign: (type: string, id: string) =>
`${reportProbation}/13/${type}/${id}`,
reportEvaluateRecord1: (type: string, id: string) =>
`${reportProbation}/14/${type}/${id}`,
// reportEvaluateRecord2:(type:string, id:string) => `${reportProbation}/15/${type}/${id}`,
reportEvaluate: (type: string, id: string) =>
`${reportProbation}/16/${type}/${id}`,
reportEvaluateChairman: (type: string, id: string) =>
`${reportProbation}/17/${type}/${id}`,
reportEvaluateResult: (type: string, id: string) =>
`${reportProbation}/19/${type}/${id}`,
// reportSurvey:(type:string, id:string) => `${reportProbation}/19/${type}/${id}`,
//filetransfer
reportTransferFile: (no: number, type: string, id: string) =>
`${reportTransfer}/${no}/${type}/${id}`,
DeceasedReport: (type: string, id: string) =>
`${reportDeceased}/36/${type}/${id}`,
reportTemplate,
};

View file

@ -21,9 +21,6 @@ import registry from "./api/registry/api.registry";
/** API dashboard */
import message from "./api/00_dashboard/api.message";
/** API reports */
import reports from "./api/reports/api.report";
/** API โครงสร้างอัตรากำลัง*/
import organization from "./api/02_organizational/api.organization";
@ -55,34 +52,32 @@ export const qualifyDisableExamPanel = import.meta.env
.VITE_QUALIFY_DISABLE_EMAM_PANEL;
export const qualifyExamPanel = import.meta.env.VITE_QUALIFY_EXAM_PANEL;
const path =
import.meta.env.VITE_MANUAL_URL ??
"https://bma-ehr-manual.frappet.synology.me";
const path = import.meta.env.VITE_MANUAL_URL ?? "";
const generatePopupPath = (check: any) => {
// if (routeName.includes("viewLogs")) {
// return `${path}/manual/chapter-2-superadmin-maintenance`;
// return `${path}/chapter-2-superadmin-maintenance`;
// }
// if (routeName.includes("manageUsers")) {
// return `${path}/manual/chapter-2-superadmin-maintenance`;
// return `${path}/chapter-2-superadmin-maintenance`;
// }
// if (routeName.includes("manageRoles")) {
// return `${path}/manual/chapter-2-superadmin-maintenance`;
// return `${path}/chapter-2-superadmin-maintenance`;
// }
// if (routeName.includes("managePermission")) {
// return `${path}/manual/chapter-2-superadmin-maintenance`;
// return `${path}/chapter-2-superadmin-maintenance`;
// }
if (!check) {
return `${path}/manual/chapter-1-superadmin-maintenance`;
return `${path}/chapter-1-superadmin-maintenance`;
} else if (check) {
return `${path}/manual/chapter-2-superadmin-maintenance`;
return `${path}/chapter-2-superadmin-maintenance`;
} else {
return manualConfig[check as keyof typeof manualConfig];
}
};
const manualConfig = {
dashboard: `${path}/manual/chapter-2-superadmin-maintenance`,
dashboard: `${path}/chapter-2-superadmin-maintenance`,
};
const API = {
//Metadata
@ -107,9 +102,6 @@ const API = {
//dashboard
...message,
//reports
...reports,
/*file*/
...file,

View file

@ -18,7 +18,14 @@ const router = useRouter();
const $q = useQuasar();
const store = useInsigniaDataStore();
const mixin = useCounterMixin();
const { dialogConfirm, showLoader, hideLoader, messageError, success } = mixin;
const {
dialogConfirm,
showLoader,
hideLoader,
messageError,
success,
dialogRemove,
} = mixin;
const id = ref<string>(route.params.id.toString()); //
const title = ref<string>(""); //
@ -179,7 +186,6 @@ async function fetchData(id: string) {
/**
* นยนการบนทกขอมลเครองราชอสรยาภรณ
*
* dialogStatus.value เป "create" จะเพมขอม าไมจะเปนการแกไขขอม
*/
async function onSubmit() {
@ -217,9 +223,31 @@ async function onSubmit() {
});
}
/**
* ลบขอมลเครองราชอสรยาภรณ
* แล fetch อมลรายการ อมลเครองราชอสรยาภรณ ใหม
* @param id อมลเครองราชอสรยาภรณ
*/
async function onDeleteData(idrow: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.insigniaNewIdOrg(idrow))
.then(async () => {
await fetchData(id.value);
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* popup เพ,แกไข อม
*
* และ กำหนดฟอร เพมขอม,แกไขขอมลเป defult
*/
function closeDialog() {
@ -232,7 +260,6 @@ function closeDialog() {
/**
* hook จำทำเมอมการเรยกใช components
*
* ทำการดงรายการขอมลเครองราชอสรยาภรณตามลำดบชนเครองราชอสรยาภรณ
*/
onMounted(async () => {
@ -294,12 +321,13 @@ onMounted(async () => {
<q-input
dense
outlined
clearable
v-model="filterKeyword"
placeholder="ค้นหา"
@clear="filterKeyword = ''"
@keydown.enter.pervent="
store.onSearchData(filterKeyword, columns)
"
>
<template v-slot:append v-if="filterKeyword === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -325,7 +353,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="store.row"
:filter="filterKeyword"
row-key="name"
flat
bordered
@ -350,7 +377,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -367,6 +393,16 @@ onMounted(async () => {
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn
color="red"
flat
dense
round
icon="delete"
@click.stop.prevent="onDeleteData(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="(col, index) in props.cols" :key="col.id">
<div v-if="col.name == 'no'">

View file

@ -13,7 +13,8 @@ import DialogForm from "@/modules/01_metadata/components/personal/DialogForm.vue
const $q = useQuasar();
const store = usePersonalDataStore();
const { messageError, showLoader, hideLoader, success } = useCounterMixin();
const { messageError, showLoader, hideLoader, success, dialogRemove } =
useCounterMixin();
/**
* Table
@ -142,6 +143,29 @@ async function editData(id: string) {
});
}
/**
* ลบรายการคำนำหนาช
* แล fetch อมลรายการ คำนำหนาช ใหม
* @param id รายการคำนำหนาช
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgPrefixId(id))
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* hook ทำงานเม Components กเรยกใชงาน
* แลวเรยก function fetch อมลรายการคำนำหนาช
@ -173,12 +197,13 @@ onMounted(async () => {
borderless
dense
outlined
clearable
v-model="filterKeyword"
placeholder="ค้นหา"
@clear="filterKeyword = ''"
@keydown.enter.pervent="
store.onSearchData(filterKeyword, TABLE_COLUMNS)
"
>
<template v-slot:append v-if="filterKeyword === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -202,7 +227,6 @@ onMounted(async () => {
ref="table"
:columns="TABLE_COLUMNS"
:rows="store.row"
:filter="filterKeyword"
row-key="name"
flat
bordered
@ -227,7 +251,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -241,6 +264,16 @@ onMounted(async () => {
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn
color="red"
flat
dense
round
icon="delete"
@click.stop.prevent="onDeleteData(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
{{ col.value }}

View file

@ -13,7 +13,8 @@ import DialogForm from "@/modules/01_metadata/components/personal/DialogForm.vue
const $q = useQuasar();
const store = usePersonalDataStore();
const { messageError, showLoader, hideLoader, success } = useCounterMixin();
const { messageError, showLoader, hideLoader, success, dialogRemove } =
useCounterMixin();
/**
* Table
@ -142,6 +143,29 @@ async function editData(id: string) {
});
}
/**
* ลบรายการยศ
* แล fetch อมลรายการ อมลรายการยศ ใหม
* @param id รายการยศ
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgRankId(id))
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* hook ทำงานเม Components กเรยกใชงาน
* แลวเรยก function fetch อมลรายการยศ
@ -172,12 +196,11 @@ onMounted(async () => {
<q-input
dense
outlined
clearable
v-model="filterKeyword"
placeholder="ค้นหา"
@clear="filterKeyword = ''"
@keydown.enter.pervent="store.onSearchData(filterKeyword, columns)"
>
<template v-slot:append v-if="filterKeyword === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -201,7 +224,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="store.row"
:filter="filterKeyword"
row-key="name"
flat
bordered
@ -226,7 +248,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -240,6 +261,17 @@ onMounted(async () => {
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn
color="red"
flat
dense
round
icon="delete"
@click.stop.prevent="onDeleteData(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div>

View file

@ -13,7 +13,8 @@ import DialogForm from "@/modules/01_metadata/components/personal/DialogForm.vue
const $q = useQuasar();
const store = usePersonalDataStore();
const { messageError, showLoader, hideLoader, success } = useCounterMixin();
const { messageError, showLoader, hideLoader, success, dialogRemove } =
useCounterMixin();
/**
* Table
@ -142,6 +143,29 @@ async function editData(id: string) {
});
}
/**
* ลบรายการเพศ
* แล fetch อมลรายการ อมลรายการเพศ ใหม
* @param id รายการเพศ
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgGenderId(id))
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* hook ทำงานเม Components กเรยกใชงาน
* แลวเรยก function fetch อมลรายการเพศ
@ -172,12 +196,11 @@ onMounted(async () => {
<q-input
dense
outlined
clearable
v-model="filterKeyword"
placeholder="ค้นหา"
@clear="filterKeyword = ''"
@keydown.enter.pervent="store.onSearchData(filterKeyword, columns)"
>
<template v-slot:append v-if="filterKeyword === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -201,7 +224,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="store.row"
:filter="filterKeyword"
row-key="name"
flat
bordered
@ -226,7 +248,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -240,6 +261,16 @@ onMounted(async () => {
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn
color="red"
flat
dense
round
icon="delete"
@click.stop.prevent="onDeleteData(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div>

View file

@ -13,7 +13,8 @@ import DialogForm from "@/modules/01_metadata/components/personal/DialogForm.vue
const $q = useQuasar();
const store = usePersonalDataStore();
const { messageError, showLoader, hideLoader, success } = useCounterMixin();
const { messageError, showLoader, hideLoader, success, dialogRemove } =
useCounterMixin();
/**
* Table
@ -142,6 +143,29 @@ async function editData(id: string) {
});
}
/**
* ลบรายการสถานภาพ
* แล fetch อมลรายการ อมลรายการสถานภาพ ใหม
* @param id รายการสถานภาพ
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgRelationshipId(id))
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* hook ทำงานเม Components กเรยกใชงาน
* แลวเรยก function fetch อมลรายการสถานภาพ
@ -172,12 +196,11 @@ onMounted(async () => {
<q-input
dense
outlined
clearable
v-model="filterKeyword"
placeholder="ค้นหา"
@clear="filterKeyword = ''"
@keydown.enter.pervent="store.onSearchData(filterKeyword, columns)"
>
<template v-slot:append v-if="filterKeyword === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -201,7 +224,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="store.row"
:filter="filterKeyword"
row-key="name"
flat
bordered
@ -226,7 +248,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -240,6 +261,16 @@ onMounted(async () => {
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn
color="red"
flat
dense
round
icon="delete"
@click.stop.prevent="onDeleteData(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div>

View file

@ -13,7 +13,8 @@ import DialogForm from "@/modules/01_metadata/components/personal/DialogForm.vue
const $q = useQuasar();
const store = usePersonalDataStore();
const { messageError, showLoader, hideLoader, success } = useCounterMixin();
const { messageError, showLoader, hideLoader, success, dialogRemove } =
useCounterMixin();
/**
* Table
@ -141,6 +142,29 @@ async function editData(id: string) {
});
}
/**
* ลบขอมลรายการกลมเลอด
* แล fetch อมลรายการ อมลรายการกลมเลอด ใหม
* @param id อมลรายการกลมเลอด
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgBloodGroupId(id))
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* hook ทำงานเม Components กเรยกใชงาน
* แลวเรยก function fetch อมลรายการกลมเลอด
@ -171,12 +195,11 @@ onMounted(async () => {
<q-input
dense
outlined
clearable
v-model="filterKeyword"
placeholder="ค้นหา"
@clear="filterKeyword = ''"
@keydown.enter.pervent="store.onSearchData(filterKeyword, columns)"
>
<template v-slot:append v-if="filterKeyword === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -200,7 +223,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="store.row"
:filter="filterKeyword"
row-key="name"
flat
bordered
@ -225,7 +247,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -239,6 +260,17 @@ onMounted(async () => {
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn
color="red"
flat
dense
round
icon="delete"
@click.stop.prevent="onDeleteData(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div>

View file

@ -13,7 +13,8 @@ import DialogForm from "@/modules/01_metadata/components/personal/DialogForm.vue
const $q = useQuasar();
const store = usePersonalDataStore();
const { messageError, showLoader, hideLoader, success } = useCounterMixin();
const { messageError, showLoader, hideLoader, success, dialogRemove } =
useCounterMixin();
/**
* Table
@ -142,6 +143,29 @@ async function editData(id: string) {
});
}
/**
* ลบขอมลรายการศาสนา
* แล fetch อมลรายการ อมลรายการศาสนา ใหม
* @param id อมลรายการศาสนา
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgReligionId(id))
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* hook ทำงานเม Components กเรยกใชงาน
* แลวเรยก function fetch อมลรายการศาสนา
@ -172,12 +196,11 @@ onMounted(async () => {
<q-input
dense
outlined
clearable
v-model="filterKeyword"
placeholder="ค้นหา"
@clear="filterKeyword = ''"
@keydown.enter.pervent="store.onSearchData(filterKeyword, columns)"
>
<template v-slot:append v-if="filterKeyword === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -201,7 +224,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="store.row"
:filter="filterKeyword"
row-key="name"
flat
bordered
@ -226,7 +248,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -240,6 +261,16 @@ onMounted(async () => {
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn
color="red"
flat
dense
round
icon="delete"
@click.stop.prevent="onDeleteData(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div>

View file

@ -15,7 +15,8 @@ import DialogForm from "@/modules/01_metadata/components/personal/DialogForm.vue
const $q = useQuasar();
const router = useRouter();
const store = usePersonalDataStore();
const { messageError, showLoader, hideLoader, success } = useCounterMixin();
const { messageError, showLoader, hideLoader, success, dialogRemove } =
useCounterMixin();
/**
* Teble
@ -145,7 +146,30 @@ async function editData(id: string) {
}
/**
* ไปยงหน รายากรเขต/อำเภอ โดย id ของจงหว
* ลบขอมลรายการจงหว
* แล fetch อมลรายการ อมลรายการจงหว ใหม
* @param id อมลรายการจงหว
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgProvince + `/${id}`)
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* ไปยงหน รายการเขต/อำเภอ โดย id ของจงหว
* @param id งหว
*/
function nextPage(id: string) {
@ -183,12 +207,11 @@ onMounted(async () => {
<q-input
dense
outlined
clearable
v-model="filterKeyword"
placeholder="ค้นหา"
@clear="filterKeyword = ''"
@keydown.enter.pervent="store.onSearchData(filterKeyword, columns)"
>
<template v-slot:append v-if="filterKeyword === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -212,7 +235,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="store.row"
:filter="filterKeyword"
row-key="name"
flat
bordered
@ -237,7 +259,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -251,6 +272,16 @@ onMounted(async () => {
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn
color="red"
flat
dense
round
icon="delete"
@click.stop.prevent="onDeleteData(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td
v-for="col in props.cols"

View file

@ -13,7 +13,8 @@ import DialogForm from "@/modules/01_metadata/components/personal/DialogForm.vue
const $q = useQuasar();
const store = usePersonalDataStore();
const { messageError, showLoader, hideLoader, success } = useCounterMixin();
const { messageError, showLoader, hideLoader, success, dialogRemove } =
useCounterMixin();
const columns = [
{
@ -154,6 +155,29 @@ async function editData(id: string) {
});
}
/**
* ลบขอมลรายการระดบการศกษา
* แล fetch อมลรายการ อมลรายการระดบการศกษา ใหม
* @param id อมลรายการระดบการศกษา
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgEducationLevelId(id))
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* hook ทำงานเม Components กเรยกใชงาน
* แลวเรยก function fetch อมลรายการระดบการศกษา
@ -186,12 +210,11 @@ onMounted(async () => {
<q-input
dense
outlined
clearable
v-model="filterKeyword"
placeholder="ค้นหา"
@clear="filterKeyword = ''"
@keydown.enter.pervent="store.onSearchData(filterKeyword, columns)"
>
<template v-slot:append v-if="filterKeyword === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -215,7 +238,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="store.row"
:filter="filterKeyword"
row-key="name"
flat
bordered
@ -240,7 +262,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -255,6 +276,16 @@ onMounted(async () => {
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn
color="red"
flat
dense
round
icon="delete"
@click.stop.prevent="onDeleteData(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div>

View file

@ -15,8 +15,15 @@ import DialogForm from "@/modules/01_metadata/components/personal/DialogForm.vue
const $q = useQuasar();
const router = useRouter();
const route = useRoute();
const { messageError, showLoader, hideLoader, success, date2Thai } =
useCounterMixin();
const {
messageError,
showLoader,
hideLoader,
success,
date2Thai,
onSearchDataTable,
dialogRemove,
} = useCounterMixin();
/**
* Table
@ -82,6 +89,7 @@ const dialog = ref<boolean>(false); // เพิ่มข้อมูล,แก
const dialogStatus = ref<string>(""); // ,
const personalName = ref<string>("เขต/อำเภอ"); //label input
const rows = ref<FormDistrict[]>([]); // /
const rowsMain = ref<FormDistrict[]>([]); // /
const provinceName = ref<string>(""); //
/**
@ -99,12 +107,15 @@ async function fetchData() {
const list = data.map((e: FormDistrict) => ({
...e,
createdAt: e.createdAt ? date2Thai(new Date(e.createdAt)) : "",
createdAt: e.createdAt
? date2Thai(new Date(e.createdAt), false, true)
: "",
lastUpdatedAt: e.lastUpdatedAt
? date2Thai(new Date(e.lastUpdatedAt))
? date2Thai(new Date(e.lastUpdatedAt), false, true)
: "",
}));
rows.value = list;
rowsMain.value = list;
})
.catch((err) => {
messageError($q, err);
@ -161,13 +172,44 @@ async function editData(id: string) {
}
/**
* ไปยงหน รายากรเแขวง/ตำบลโดย id ของเขต/อำเภอ
* ลบขอมลรายการระดบการเขต/อำเภอ
* แล fetch อมลรายการ อมลรายการระดบการเขต/อำเภอ ใหม
* @param id อมลรายการระดบการเขต/อำเภอ
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgDistrict + `/${id}`)
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* ไปยงหน รายการเแขวง/ตำบลโดย id ของเขต/อำเภอ
* @param idSub เขต/อำเภอ
*/
function nextPage(idSub: string) {
router.push(`/master-data/personal/sub-district/${id.value}/${idSub}`);
}
function serchDataTable() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsMain.value,
columns ? columns : []
);
}
/**
* hook ทำงานเม Components กเรยกใชงาน
* แลวเรยก function fetch อมลรายการระดบการเขต/อำเภอ
@ -217,7 +259,12 @@ onMounted(async () => {
dense
v-model="filterKeyword"
label="ค้นหา"
></q-input>
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<q-select
v-model="visibleColumns"
multiple
@ -238,7 +285,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="rows"
:filter="filterKeyword"
row-key="name"
flat
bordered
@ -263,7 +309,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -277,6 +322,16 @@ onMounted(async () => {
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn
color="red"
flat
dense
round
icon="delete"
@click.stop.prevent="onDeleteData(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td
v-for="col in props.cols"

View file

@ -15,8 +15,15 @@ import DialogForm from "@/modules/01_metadata/components/personal/DialogForm.vue
const $q = useQuasar();
const router = useRouter();
const route = useRoute();
const { messageError, showLoader, hideLoader, success, date2Thai } =
useCounterMixin();
const {
messageError,
showLoader,
hideLoader,
success,
date2Thai,
onSearchDataTable,
dialogRemove,
} = useCounterMixin();
/**
* Table
@ -88,7 +95,8 @@ const visibleColumns = ref<string[]>([
const id = ref<string>(route.params.id as string); // /
const rows = ref<FormSubDistrict[]>([]); // /
const editId = ref<string>(""); // id /
const rowsMain = ref<FormSubDistrict[]>([]); // /
const editId = ref<string>(""); // id /
const filterKeyword = ref<string>(""); //
const dialog = ref<boolean>(false); // ,
const subDistrict = ref<string>(""); // / ;
@ -111,12 +119,15 @@ async function fetchData() {
subdistrict.value = await res.data.result.name;
const list = data.map((e: FormSubDistrict) => ({
...e,
createdAt: e.createdAt ? date2Thai(new Date(e.createdAt)) : "",
createdAt: e.createdAt
? date2Thai(new Date(e.createdAt), false, true)
: "",
lastUpdatedAt: e.lastUpdatedAt
? date2Thai(new Date(e.lastUpdatedAt))
? date2Thai(new Date(e.lastUpdatedAt), false, true)
: "",
}));
rows.value = list;
rowsMain.value = list;
})
.catch((err) => {
messageError($q, err);
@ -173,6 +184,37 @@ async function editData(idRow: string) {
});
}
/**
* ลบขอมลรายการแขวง/ตำบล
* แล fetch อมลรายการ อมลรายการแขวง/ตำบล ใหม
* @param id อมลรายการแขวง/ตำบล
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgSubDistrict + `/${id}`)
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
function serchDataTable() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsMain.value,
columns ? columns : []
);
}
/**
* hook ทำงานเม Components กเรยกใชงาน
* แลวเรยก function fetch อมลรายการแขวง/ตำบล
@ -223,7 +265,12 @@ onMounted(async () => {
dense
v-model="filterKeyword"
label="ค้นหา"
></q-input>
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<q-select
v-model="visibleColumns"
multiple
@ -244,7 +291,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="rows"
:filter="filterKeyword"
row-key="name"
flat
bordered
@ -269,7 +315,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -284,6 +329,16 @@ onMounted(async () => {
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn
color="red"
flat
dense
round
icon="delete"
@click.stop.prevent="onDeleteData(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div>

View file

@ -321,67 +321,74 @@ onMounted(async () => {
>
</div>
<div class="row col-12 q-col-gutter-sm q-mb-sm">
<div class="col-xs-12 col-md-2">
<q-select
label="ค้นหาจาก"
v-model="formQuery.type"
:options="optionFilter"
emit-value
dense
map-options
outlined
option-label="name"
option-value="id"
/>
</div>
<div class="row col-12 q-col-gutter-sm">
<div class="row q-col-gutter-sm align-items-center">
<div class="col-auto">
<q-select
label="ค้นหาจาก"
v-model="formQuery.type"
:options="optionFilter"
emit-value
dense
map-options
outlined
option-label="name"
option-value="id"
/>
</div>
<div class="col-xs-12 col-md-3">
<q-input
ref="searchRef"
v-model="formQuery.keyword"
outlined
dense
lazy-rules
label="คำค้น"
hide-bottom-space
@keydown.enter="fetchData()"
>
<template v-slot:append>
<q-icon
v-if="formQuery.keyword"
name="cancel"
@click="formQuery.keyword = ''"
class="cursor-pointer"
></q-icon>
</template>
</q-input>
</div>
<div class="col">
<q-input
ref="searchRef"
v-model="formQuery.keyword"
outlined
dense
lazy-rules
label="คำค้น"
hide-bottom-space
@keydown.enter="fetchData()"
style="min-width: 300px"
>
<template v-slot:append>
<q-icon
v-if="formQuery.keyword"
name="cancel"
@click="formQuery.keyword = ''"
class="cursor-pointer"
></q-icon>
</template>
</q-input>
</div>
<div class="col-xs-12 col-md-1">
<q-btn
color="primary"
icon="search"
label="ค้นหา"
class="full-width"
@click="fetchData()"
/>
<div class="col-auto">
<q-btn
outline
color="primary"
icon="search"
label="ค้นหา"
class="full-width full-height"
@click="fetchData()"
/>
</div>
</div>
<q-space />
<div class="col-xs-12 col-md-1">
<q-select
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
/>
<div class="row q-col-gutter-sm align-items-center">
<div class="col-auto">
<q-select
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
/>
</div>
</div>
</div>
</div>

View file

@ -24,10 +24,13 @@ const {
showLoader,
hideLoader,
date2Thai,
onSearchDataTable,
dialogRemove,
} = useCounterMixin();
//Table
const rows = ref<ResGroup[]>([]); //
const rowsMain = ref<ResGroup[]>([]); //
const filterKeyword = ref<string>(""); //
const columns = ref<QTableProps["columns"]>([
{
@ -114,7 +117,6 @@ const dialogStatus = ref<string>("");
/**
* งกนดงขอมลรายการกลมงาน API
*
* เกบขอมลรรายการกลมงานไวใน rows.value
*/
async function fetchData() {
@ -123,6 +125,7 @@ async function fetchData() {
.get(config.API.orgEmployeeType)
.then(async (res) => {
rows.value = await res.data.result;
rowsMain.value = await res.data.result;
})
.catch((err) => {
messageError($q, err);
@ -135,9 +138,7 @@ async function fetchData() {
/**
* งกนเป popup แกไขขอมลกลมงาน
* @param data อมลกลมงานทจะแกไข
*
* กำหนด dialogStatus เป edit และกำหนดให ฟอรมขอมลกลมงาน เป อมลทจะแกไข
*
*/
function onClickOpenDialogEdit(data: ResGroup) {
dialogStatus.value = "edit";
@ -150,7 +151,6 @@ function onClickOpenDialogEdit(data: ResGroup) {
/**
* นยนการบนทกขอมลรายการกลมงาน
*
* dialogStatus เป 'create' จะทำการเพมขอมลรายการกลมงาน าไมจะทำการแกไขขอม
* เมอบนทกขอมลเสรจจะเรยก function fetchData() เพอดงขอมลรายการกลมงานใหม
*
@ -183,6 +183,29 @@ function onSubmit() {
});
}
/**
* ลบขอมลรายการกลมงาน
* แล fetch อมลรายการ อมลรายการกลมงาน ใหม
* @param id อมลรายการกลมงาน
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgEmployeeTypeById(id))
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* งกนไปหนารายการระดบชนงาน
* @param id กลมงาน
@ -193,7 +216,6 @@ function onClickDetail(id: string) {
/**
* งกนป popup แกไขหรอเพมขอมลกลมงาน
*
* และกำหนดให ฟอรมขอมลกลมงาน เปนคาวาง
*/
function closeDialog() {
@ -203,6 +225,14 @@ function closeDialog() {
formDataGroup.posTypeRank = null;
}
function serchDataTable() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
/**
* hook ทำงานเม Components กเรยกใชงาน
*/
@ -232,12 +262,11 @@ onMounted(async () => {
<q-input
dense
outlined
clearable
v-model="filterKeyword"
placeholder="ค้นหา"
@clear="filterKeyword = ''"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append v-if="filterKeyword === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -261,7 +290,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="rows"
:filter="filterKeyword"
row-key="name"
flat
bordered
@ -291,12 +319,21 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
@click.stop="onClickOpenDialogEdit(props.row)"
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn
color="red"
flat
dense
round
icon="delete"
@click.stop.prevent="onDeleteData(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
{{ col.value ? col.value : "-" }}

View file

@ -30,10 +30,13 @@ const {
messageError,
success,
date2Thai,
onSearchDataTable,
dialogRemove,
} = useCounterMixin();
// Table
const rows = ref<DataGroup[]>([]); //
const rowsMain = ref<DataGroup[]>([]); //
const filter = ref<string>(""); //
const columns = ref<QTableProps["columns"]>([
{
@ -134,20 +137,23 @@ const formDataLevel = reactive<FormDataLevel>({
/**
* งกนดงขอมลรายการระดบชนงาน API
*
* เกบขอมลรรายการระดบชนงานไวใน rows.value
*/
async function fetchData() {
rows.value = [];
rowsMain.value = [];
showLoader();
await http
.get(config.API.orgEmployeeTypeById(posTypeId.value))
.then(async (res) => {
titleName.value = res.data.result.posTypeName ?? null;
formDataLevel.posTypeName = res.data.result.posTypeName;
rows.value = await res.data.result.posLevels.map((x: ResLevel) => ({
const lists = await res.data.result.posLevels.map((x: ResLevel) => ({
...x,
posTypeName: res.data.result.posTypeName,
}));
rows.value = lists;
rowsMain.value = lists;
})
.catch((err) => {
messageError($q, err);
@ -160,9 +166,7 @@ async function fetchData() {
/**
* งกนเป popup แกไขขอมลระดบชนงาน
* @param data อมลระดบชนงานทจะแกไข
*
* กำหนด isStatusEdit เป true และกำหนดให ฟอรมขอมลระดบชนงาน เป อมลทจะแกไข
*
*/
function onClickOpenDialog(
statusEdit: boolean = false,
@ -183,7 +187,6 @@ function onClickOpenDialog(
/**
* งกนป popup แกไขหรอเพมขอมลระดบชนงาน
*
* และกำหนดให ฟอรมขอมลระดบชนงาน เปนคาวาง
*/
function onClickCloseDialog() {
@ -195,7 +198,6 @@ function onClickCloseDialog() {
/**
* นยนการบนทกขอมลรายการระดบชนงาน
*
* dialogStatus เป 'false' จะทำการเพมขอมลรายการระดบชนงาน าไมจะทำการแกไขขอม
* เมอบนทกขอมลเสรจจะเรยก function fetchData() เพอดงขอมลรายการระดบชนงานใหม
*
@ -229,6 +231,29 @@ function onSubmit() {
});
}
/**
* ลบขอมลรายการระดบชนงาน
* แล fetch อมลรายการ อมลรายการระดบชนงาน ใหม
* @param id อมลรายการระดบชนงาน
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgEmployeelevelById(id))
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* งกนแปลงตำแหนงผอำนาจ
* @param val าของผอำนาจ
@ -239,9 +264,16 @@ function convertPosLevelAuthority(val: string) {
return result?.label;
}
function serchDataTable() {
rows.value = onSearchDataTable(
filter.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
/**
* hook ทำงานเม Components กเรยกใชงาน
*
* าม posTypeId จะดงขอมลรายการระดบชนงาน
*/
onMounted(() => {
@ -281,12 +313,11 @@ onMounted(() => {
<q-input
dense
outlined
clearable
v-model="filter"
placeholder="ค้นหา"
@clear="filter = ''"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append v-if="filter === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -310,7 +341,6 @@ onMounted(() => {
ref="table"
:columns="columns"
:rows="rows"
:filter="filter"
row-key="name"
flat
bordered
@ -335,12 +365,21 @@ onMounted(() => {
flat
dense
round
class="q-mr-xs"
icon="edit"
@click.stop.pervent="onClickOpenDialog(true, props.row)"
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn
color="red"
flat
dense
round
icon="delete"
@click.stop.prevent="onDeleteData(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="(col, index) in props.cols" :key="col.id">
<div v-if="col.name == 'no'">

View file

@ -309,62 +309,71 @@ onMounted(async () => {
><q-tooltip>เพมตำเเหน </q-tooltip></q-btn
>
</div>
<div class="row col-12 q-col-gutter-sm q-mb-sm">
<div class="col-xs-12 col-md-2">
<q-select
label="ค้นหาจาก"
v-model="type"
:options="optionFilter"
emit-value
dense
map-options
outlined
option-label="name"
option-value="id"
/>
</div>
<div class="col-xs-12 col-md-3">
<q-input
v-model="search"
outlined
dense
lazy-rules
label="คำค้น"
hide-bottom-space
>
<template v-slot:append>
<q-icon
v-if="search"
name="cancel"
@click="search = ''"
class="cursor-pointer"
></q-icon>
</template>
</q-input>
</div>
<div class="col-xs-12 col-md-2">
<q-btn
class="full-width"
color="primary"
icon="search"
label="ค้นหา"
type="submit"
/>
<div class="row col-12 q-col-gutter-sm">
<div class="row q-col-gutter-sm align-items-center">
<div class="col-auto">
<q-select
label="ค้นหาจาก"
v-model="type"
:options="optionFilter"
emit-value
dense
map-options
outlined
option-label="name"
option-value="id"
/>
</div>
<div class="col">
<q-input
v-model="search"
outlined
dense
lazy-rules
label="คำค้น"
hide-bottom-space
style="min-width: 300px"
>
<template v-slot:append>
<q-icon
v-if="search"
name="cancel"
@click="search = ''"
class="cursor-pointer"
></q-icon>
</template>
</q-input>
</div>
<div class="col-auto">
<q-btn
outline
color="primary"
icon="search"
label="ค้นหา"
type="submit"
class="full-width full-height"
/>
</div>
</div>
<q-space />
<div class="col-xs-12 col-md-1">
<q-select
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
/>
<div class="row q-col-gutter-sm align-items-center">
<div class="col-auto">
<q-select
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
/>
</div>
</div>
</div>
</div>

View file

@ -15,8 +15,15 @@ import dialogHeader from "@/components/DialogHeader.vue";
const $q = useQuasar();
const router = useRouter();
const store = usePositionTypeDataStore();
const { dialogConfirm, success, messageError, showLoader, hideLoader } =
useCounterMixin();
const {
dialogConfirm,
success,
messageError,
showLoader,
hideLoader,
onSearchDataTable,
dialogRemove,
} = useCounterMixin();
// Table
const filterKeyword = ref<string>(""); //
@ -93,7 +100,6 @@ const posTypeRank = ref<number | null>(null); // ระดับตำแหน
/**
* งขอมลรายการประเภทตำแหน
*
* นทกขอมลรายการประเภทตำแหนงใน Store positionTypeStore
*/
async function fetchData() {
@ -113,7 +119,6 @@ async function fetchData() {
/**
* นยนการบนทกขอมลประเภทตำแหน
*
* dialogStatus เป 'create' จะทำการเพมขอมลรายการประเภทตำแหน าไมจะทำการแกไขขอม
* เมอบนทกขอมลเสรจจะเรยก function fetchData() เพอดงขอมลรายการประเภทตำแหนงใหม
*
@ -150,9 +155,31 @@ function onSubmit() {
}
}
/**
* ลบขอมลประเภทตำแหน
* แล fetch อมลรายการ อมลประเภทตำแหน ใหม
* @param id อมลประเภทตำแหน
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgPosTypeId(id))
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* popup ฟอรมประเภทตำแหน
*
* และเคลยรวแปรในฟอรมประเภทตำแหน
*/
function closeDialog() {
@ -169,6 +196,14 @@ function onclickDetail(id: string) {
router.push(`/master-data/position/level/${id}`);
}
function serchDataTable() {
store.row = onSearchDataTable(
filterKeyword.value,
store.rowMain,
columns ? columns : []
);
}
/**
* hook ทำงานเม Components กเรยกใชงาน
*/
@ -198,12 +233,11 @@ onMounted(async () => {
<q-input
dense
outlined
clearable
v-model="filterKeyword"
placeholder="ค้นหา"
@clear="filterKeyword = ''"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append v-if="filterKeyword === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -227,7 +261,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="store.row"
:filter="filterKeyword"
row-key="name"
flat
bordered
@ -256,7 +289,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -271,6 +303,16 @@ onMounted(async () => {
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn
color="red"
flat
dense
round
icon="delete"
@click.stop.prevent="onDeleteData(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
{{ col.value ?? "-" }}

View file

@ -12,10 +12,19 @@ import type { RowListForm } from "@/modules/01_metadata/interface/request/positi
import DialogAdd from "@/modules/01_metadata/components/position/DialogFormExecutive.vue";
const $q = useQuasar();
const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin();
const {
showLoader,
hideLoader,
messageError,
date2Thai,
onSearchDataTable,
dialogRemove,
success,
} = useCounterMixin();
// Table
const rows = ref<RowListForm[]>([]); //
const rows = ref<RowListForm[]>([]); //
const rowsMain = ref<RowListForm[]>([]); //
const filterKeyword = ref<string>(""); //
const visibleColumns = ref<string[]>([
"no",
@ -94,7 +103,6 @@ const modalPosExecutive = ref<boolean>(false); // popup ตำแหน่งท
/**
* งรายการขอมลตำแหนงทางการบรหาร
*
* เกบขอมลรายการตำแหนงทางการบรหารใน rows.value
*/
async function getData() {
@ -104,6 +112,7 @@ async function getData() {
.then(async (res) => {
const data = await res.data.result;
rows.value = data;
rowsMain.value = data;
})
.catch((e) => {
messageError($q, e);
@ -114,14 +123,37 @@ async function getData() {
}
/**
* เป popup เพอเพมขอมลรายกรตำแหนงทางการบรหาร
* เป popup เพอเพมขอมลรายรตำแหนงทางการบรหาร
*/
function popUpAdd() {
modalPosExecutive.value = true;
}
/**
* เป popup เพอแกไขขอมลรายากรตำแหนงทางการบรหาร
* ลบรายการเพศ
* แล fetch อมลรายการ อมลรายการเพศ ใหม
* @param id รายการเพศ
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgPosExecutiveById(id))
.then(async () => {
await getData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* เป popup เพอแกไขขอมลรายการตำแหนงทางการบรหาร
* @param data อมลรายการตำแหนงทางการบรหารทองการแกไข
*/
function editPopUp(data: RowListForm) {
@ -130,6 +162,14 @@ function editPopUp(data: RowListForm) {
isEdit.value = true;
}
function serchDataTable() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
/**
* hook ทำงานเม Components กเรยกใชงาน
*/
@ -157,12 +197,11 @@ onMounted(async () => {
<q-input
dense
outlined
clearable
v-model="filterKeyword"
placeholder="ค้นหา"
@clear="filterKeyword = ''"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append v-if="filterKeyword === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -185,7 +224,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="rows"
:filter="filterKeyword"
row-key="id"
flat
bordered
@ -215,7 +253,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -226,18 +263,18 @@ onMounted(async () => {
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<!-- <q-btn
<q-btn
color="red"
flat
dense
round
icon="mdi-delete"
clickable
@click.stop="deletePos(props.row.id)"
@click.stop="onDeleteData(props.row.id)"
v-close-popup
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn> -->
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div v-if="col.name == 'no'">

View file

@ -25,6 +25,7 @@ const {
hideLoader,
messageError,
success,
onSearchDataTable,
} = useCounterMixin();
//table
@ -236,6 +237,14 @@ function closeDialog() {
dialog.value = false;
}
function serchDataTable() {
store.row = onSearchDataTable(
filterKeyword.value,
store.rowMain,
columns ? columns : []
);
}
/**
* hook ทำงานเม Components กเรยกใชงาน
*/
@ -284,12 +293,11 @@ onMounted(async () => {
<q-input
dense
outlined
clearable
v-model="filterKeyword"
placeholder="ค้นหา"
@clear="filterKeyword = ''"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append v-if="filterKeyword === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -313,7 +321,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="store.row"
:filter="filterKeyword"
row-key="name"
flat
bordered

View file

@ -6,10 +6,11 @@ import type {
} from "../interface/response/insignia/Insignia";
import { useCounterMixin } from "@/stores/mixin";
const { date2Thai } = useCounterMixin();
const { date2Thai, onSearchDataTable } = useCounterMixin();
export const useInsigniaDataStore = defineStore("insigniaData", () => {
const row = ref<DataRow[]>([]);
const rowMain = ref<DataRow[]>([]);
async function fetchData(data: DataResponse[], insigniaType?: string) {
const list = data.map((e) => ({
@ -20,12 +21,18 @@ export const useInsigniaDataStore = defineStore("insigniaData", () => {
? date2Thai(e.lastUpdatedAt, false, true)
: "-",
}));
list;
row.value = list;
rowMain.value = list;
}
function onSearchData(keyword: string, columns: any = []) {
row.value = onSearchDataTable(keyword, rowMain.value, columns);
}
return {
fetchData,
row,
onSearchData,
};
});

View file

@ -7,10 +7,11 @@ import type {
DataRow,
} from "../interface/response/personal/personal";
const { date2Thai } = useCounterMixin();
const { date2Thai, onSearchDataTable } = useCounterMixin();
export const usePersonalDataStore = defineStore("PersonalData", () => {
const row = ref<DataRow[]>([]); // ข้อมูลในตาราง
const rowMain = ref<DataRow[]>([]); // ข้อมูลในตาราง
const currentTab = ref<string>("list_prefix"); // Tab ปัจจุบัน
/**
@ -19,6 +20,7 @@ export const usePersonalDataStore = defineStore("PersonalData", () => {
*/
async function save(data: DataResponse[]) {
row.value = [];
rowMain.value = [];
const list = data.map((e) => ({
...e,
createdAt: e.createdAt ? date2Thai(e.createdAt, false, true) : "-",
@ -26,12 +28,19 @@ export const usePersonalDataStore = defineStore("PersonalData", () => {
? date2Thai(e.lastUpdatedAt, false, true)
: "-",
}));
row.value = list;
rowMain.value = list;
}
function onSearchData(keyword: string, columns: any = []) {
row.value = onSearchDataTable(keyword, rowMain.value, columns);
}
return {
save,
row,
currentTab,
onSearchData,
};
});

View file

@ -13,6 +13,8 @@ const { date2Thai } = useCounterMixin();
export const usePositionDataStore = defineStore("PositionData", () => {
const pathLocation = ref<string>("list_position");
const row = ref<DataRow[]>([]);
const rowMain = ref<DataRow[]>([]);
function save(data: DataResponse[], posTypeName: string) {
const list = data.map((e) => ({
...e,
@ -29,11 +31,13 @@ export const usePositionDataStore = defineStore("PositionData", () => {
: "-",
})) satisfies DataRow[];
row.value = list;
rowMain.value = list;
}
return {
save,
row,
rowMain,
pathLocation,
};
});

View file

@ -12,6 +12,7 @@ const { date2Thai } = useCounterMixin();
export const usePositionTypeDataStore = defineStore("PositionTypeData", () => {
const row = ref<DataRow[]>([]);
const rowMain = ref<DataRow[]>([]);
/**
* row.value
@ -28,9 +29,11 @@ export const usePositionTypeDataStore = defineStore("PositionTypeData", () => {
: "-",
})) satisfies DataRow[];
row.value = list;
rowMain.value = list;
}
return {
save,
row,
rowMain,
};
});

View file

@ -15,8 +15,14 @@ import dialogHeader from "@/components/DialogHeader.vue";
const $q = useQuasar();
const router = useRouter();
const store = useInsigniaDataStore();
const { dialogConfirm, success, messageError, showLoader, hideLoader } =
useCounterMixin();
const {
dialogConfirm,
success,
messageError,
showLoader,
hideLoader,
dialogRemove,
} = useCounterMixin();
// Table
const filterKeyword = ref<string>("");
@ -93,7 +99,6 @@ const editId = ref<string>(""); // id รายการที่จะแก้
/**
* งขอมลเครองราชอสรยาภรณ
*
* และบนทกใน store.fetchData
*/
async function fetchData() {
@ -113,7 +118,6 @@ async function fetchData() {
/**
* นยนการบนทกขอมลเครองราชอสรยาภรณ
*
* dialogStatus.value เป "create" จะเพมขอม าไมจะเปนการแกไขขอม
*/
function onSubmit() {
@ -145,9 +149,31 @@ function onSubmit() {
});
}
/**
* ลบขอมลเครองราชอสรยาภรณ
* แล fetch อมลรายการ อมลเครองราชอสรยาภรณ ใหม
* @param id อมลเครองราชอสรยาภรณ
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.insigniaTypeNewIdOrg(id))
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* popup เพ,แกไข อม
*
* และ กำหนดลำดบชนเครองราช เปนคาวาง สถานะการใชงาน เป false
*/
function closeDialog() {
@ -166,7 +192,6 @@ function onclickDetail(id: string) {
/**
* hook จำทำเมอมการเรยกใช components
*
* ทำการดงขอมลเครองราชอสรยาภรณ
*/
onMounted(async () => {
@ -200,12 +225,11 @@ onMounted(async () => {
<q-input
dense
outlined
clearable
v-model="filterKeyword"
placeholder="ค้นหา"
@clear="filterKeyword = ''"
@keydown.enter.pervent="store.onSearchData(filterKeyword, columns)"
>
<template v-slot:append v-if="filterKeyword === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -230,7 +254,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="store.row"
:filter="filterKeyword"
row-key="name"
flat
bordered
@ -259,7 +282,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -274,6 +296,16 @@ onMounted(async () => {
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn
color="red"
flat
dense
round
icon="delete"
@click.stop.prevent="onDeleteData(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div v-if="col.name == 'isActive'">

View file

@ -23,6 +23,7 @@ const {
messageError,
success,
dialogMessageNotify,
onSearchDataTable,
} = useCounterMixin();
/** props*/
@ -41,6 +42,8 @@ const props = defineProps({
});
const rows = ref<Roles[]>([]);
const rowsMain = ref<Roles[]>([]);
const keyword = ref<string>("");
const columns = ref<QTableProps["columns"]>([
{
name: "roleName",
@ -63,12 +66,12 @@ const columns = ref<QTableProps["columns"]>([
]);
const visibleColumns = ref<string[]>(["roleName", "roleDescription"]);
const keyword = ref<string>("");
const selected = ref<Roles[]>([]);
function closeDialog() {
modal.value = false;
selected.value = [];
keyword.value = "";
}
function fetchListRoles() {
@ -78,6 +81,7 @@ function fetchListRoles() {
.then((res) => {
const data = res.data.result;
rows.value = data;
rowsMain.value = data;
const findRole = data.find(
(e: Roles) => e.id === props.dataPosMaster.authRoleId
);
@ -124,6 +128,14 @@ function onSubmit() {
}
}
function serchDataTable() {
rows.value = onSearchDataTable(
keyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
watch(
() => modal.value,
() => {
@ -140,9 +152,15 @@ watch(
<q-card-section>
<div class="row q-col-gutter-sm">
<div class="col-12">
<q-input outlined dense v-model="keyword" label="ค้นหา">
<q-input
outlined
dense
v-model="keyword"
label="ค้นหา"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append>
<q-icon name="search" color="grey-5" />
<q-icon name="search" />
</template>
</q-input>
</div>
@ -151,7 +169,6 @@ watch(
ref="table"
:columns="columns"
:rows="rows"
:filter="keyword"
row-key="id"
flat
bordered
@ -162,15 +179,6 @@ watch(
selection="single"
v-model:selected="selected"
>
<!-- <template v-slot:header-selection="scope">
<q-checkbox
keep-color
color="primary"
dense
v-model="scope.selected"
/>
</template> -->
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td>

View file

@ -208,15 +208,18 @@ watch(
dense
v-model="qurey.searchKeyword"
label="คำค้น"
clearable
>
<template v-slot:append v-if="!qurey.searchKeyword">
<q-icon name="search" color="grey-5" />
</template>
<!-- <template v-slot:append>
<q-icon name="search" />
</template> -->
</q-input>
</q-toolbar-title>
<q-btn
outline
icon="search"
class="full-height"
label="ค้นหา"
color="primary"
@click="onSearchListPerson(true)"

View file

@ -122,6 +122,7 @@ const total = ref<number>(0); // จำนวนรายการ
const maxPage = ref<number>(1); //
const isPwd = ref<boolean>(true); //
const isEmail = ref<boolean>(false);
const roles = ref<Roles[]>([]); //
//
const formData = reactive<FormUser>({
@ -232,7 +233,7 @@ function onSubmit() {
http[isStatusEdit.value ? "put" : "post"](url, {
...formData,
email: `${formData.email}@bangkok.go.th`,
email: isEmail.value ? formData.email : `${formData.email}@bangkok.go.th`,
})
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
@ -320,6 +321,7 @@ watch(
formData.lastName = data.lastName;
formData.email = data.email;
formData.username = data.citizenId;
isEmail.value = data.email ? true : false;
}
}
);
@ -524,7 +526,7 @@ watch(
lazy-rules
hide-bottom-space
class="inputgreen"
suffix="@bangkok.go.th"
:suffix="isEmail ? '' : '@bangkok.go.th'"
>
</q-input>
</div>

View file

@ -220,7 +220,6 @@ function onClickAction(type: string, data: Users) {
/**
* งกนเป popup สำหรบเพมขอมลผใชงาน
*
* กำหนดสถานะการแกไขเป false และ id ใชงานทองการแกไขเปนคาวาง
*/
function openDialog() {
@ -232,7 +231,6 @@ function openDialog() {
/**
* function นยนการลบขอมลรายการผใชงาน
* @param id รายการผใชงาน
*
* ลบขอมลรายชอเสรจแลวทำการดงขอมลรายชอผใชงานใหม
*/
function onDeleteUser(id: string) {
@ -257,7 +255,6 @@ function onDeleteUser(id: string) {
* งกนระงบการใชงานผใชงาน
* @param id ใชงาน
* @param type เปดใชงาน,ระงบการใชงาน
*
* เสรจแลวทำการดงขอมลรายชอผใชงานใหม
*/
function onLockUser(id: string, type: boolean) {
@ -286,7 +283,6 @@ function onLockUser(id: string, type: boolean) {
/**
* function ปเดท paging
* @param initialPagination อม pagination
*
* กำหนดหนาไปยงหนาแรก
*/
function updatePagination(initialPagination: Pagination) {
@ -314,7 +310,6 @@ function filterFnOptions(val: string, update: Function, type: string) {
/**
* การเปลยนแปลงของจำนวนขอมลตอหน
*
* งขอมลรายชอผใชงานตามจำนวนขอมลตอหน
*/
watch(
@ -326,7 +321,6 @@ watch(
/**
* hook ทำงานเมอมการเรยกใชงาน Components
*
* งขอมลรายชอผใชงาน
*/
onMounted(async () => {
@ -385,12 +379,10 @@ onMounted(async () => {
dense
outlined
v-model="keyword"
clearable
@clear="keyword = ''"
placeholder="ค้นหา"
@keydown.enter.prevent="(currentPage = 1), fetchListUsers()"
>
<template v-slot:append v-if="keyword === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>

View file

@ -18,11 +18,18 @@ import DialogAddRole from "@/modules/02_users/components/Roles/DialogAddRole.vue
/** use*/
const $q = useQuasar();
const router = useRouter();
const { dialogRemove, messageError, showLoader, hideLoader, success } =
useCounterMixin();
const {
dialogRemove,
messageError,
showLoader,
hideLoader,
success,
onSearchDataTable,
} = useCounterMixin();
/** Table*/
const rows = ref<Roles[]>([]); //
const rowsMain = ref<Roles[]>([]); //
const keyword = ref<string>(""); //
const columns = ref<QTableProps["columns"]>([
{
@ -75,7 +82,6 @@ const itemMenu = ref<ItemsMenu[]>([
/**
* function fetch รายการบทบาท
*
* และบนทกใน rows
*/
async function fetchListRole() {
@ -85,6 +91,7 @@ async function fetchListRole() {
.then(async (res) => {
const data = await res.data.result;
rows.value = data;
rowsMain.value = data;
})
.catch((err) => {
messageError($q, err);
@ -110,9 +117,7 @@ function onClickAction(type: string, data: Roles) {
}
}
/**
* เป popup เพมบทบาท
*/
/** เปิด popup เพิ่มบทบาท*/
function openDialog() {
modalDialogAdd.value = true;
}
@ -139,9 +144,16 @@ function onDeleteRole(id: string) {
});
}
function serchDataTable() {
rows.value = onSearchDataTable(
keyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
/**
* hook ทำงานเมอมการเรยกใชงาน Components
*
* งขอมลบทบาท
*/
onMounted(() => {
@ -166,14 +178,12 @@ onMounted(() => {
<q-input
borderless
dense
debounce="300"
outlined
v-model="keyword"
placeholder="ค้นหา"
clearable
@clear="keyword = ''"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append v-if="keyword===''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -198,7 +208,6 @@ onMounted(() => {
:columns="columns"
:rows="rows"
row-key="id"
:filter="keyword"
flat
bordered
:paging="true"

View file

@ -22,9 +22,7 @@ import type {
import DialogAdd from "@/modules/02_users/components/Permissions/DialogAdd.vue";
import PopupPersonal from "@/modules/02_users/components/RoleOrganization/DialogPersonal.vue";
/**
* use
*/
/** use*/
const $q = useQuasar();
const store = usePermissionsStore();
const { showLoader, hideLoader, messageError, success, dialogRemove } =
@ -236,7 +234,7 @@ const columnsExpand = ref<QTableProps["columns"]>([
const reqMaster = reactive<FilterReqMaster>({
id: null,
type: 0,
isAll: false,
isAll: true,
isBlank: false,
page: 1,
pageSize: 10,
@ -254,9 +252,7 @@ const pagination = ref<Pagination>({
const modalDialogAdd = ref<boolean>(false); // popup
/**
* function เรยกขอมลโครงสราง แบบปนและ แบบราง
*/
/** function เรียกข้อมูลโครงสร้าง แบบปัจุบันและ แบบร่าง */
async function fetchOrganizationActive() {
showLoader();
await http
@ -391,6 +387,7 @@ async function fetchDataTable(
* @param data
*/
function updateSelected(data: NodeTree) {
reqMaster.isAll = data.orgTreeId === "" ? true : reqMaster.isAll;
nodeId.value = data.orgTreeId;
fetchDataTable(data.orgTreeId, data.orgRevisionId, data.orgLevel);
}
@ -416,9 +413,9 @@ function onClickAddRole(data: PosMaster) {
function onDeleteRole(id: string) {
dialogRemove(
$q,
() => {
async () => {
showLoader();
http
await http
.post(config.API.managementPermission, {
authRoleId: "",
posMasterId: id,
@ -485,8 +482,8 @@ watch(
() => [reqMaster.isAll, reqMaster.isBlank],
() => {
reqMaster.page = 1;
reqMaster.id &&
fetchDataTable(reqMaster.id, reqMaster.revisionId, reqMaster.type);
fetchDataTable(reqMaster.id, reqMaster.revisionId, reqMaster.type);
}
);
@ -545,13 +542,7 @@ onMounted(() => {
<div class="col-12">
<q-input dense outlined v-model="filter" label="ค้นหา">
<template v-slot:append>
<q-icon
v-if="filter !== ''"
name="clear"
class="cursor-pointer"
@click="filter = ''"
/>
<q-icon name="search" color="grey-5" v-else />
<q-icon name="search" />
</template>
</q-input>
</div>
@ -625,7 +616,10 @@ onMounted(() => {
</div>
<!-- TOOLBAR -->
<div class="col-xs-12 col-sm-9 q-pa-md row">
<div
class="col-xs-12 col-sm-9 q-pa-md row scroll"
style="height: 75vh"
>
<div class="col-12">
<q-toolbar style="padding: 0">
<q-space />
@ -643,6 +637,7 @@ onMounted(() => {
<div>
<q-checkbox
:disable="nodeId"
keep-color
v-model="reqMaster.isAll"
label="แสดงตำแหน่งทั้งหมด"
@ -659,8 +654,6 @@ onMounted(() => {
dense
v-model="reqMaster.keyword"
label="ค้นหา"
clearable
@clear="reqMaster.keyword = ''"
@keydown.enter.prevent="
(reqMaster.page = 1),
fetchDataTable(
@ -670,8 +663,8 @@ onMounted(() => {
)
"
>
<template v-slot:append v-if="reqMaster.keyword === ''">
<q-icon name="search" color="grey-5" />
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
</div>

View file

@ -223,9 +223,7 @@ watch(
}
);
/**
* hook ทำงานเม Components กเรยกใชงาน
*/
/** hook ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
onMounted(async () => {
await fatchOrg(); //
});
@ -241,13 +239,7 @@ onMounted(async () => {
<div>
<q-input dense outlined v-model="filter" label="ค้นหา">
<template v-slot:append>
<q-icon
v-if="filter !== ''"
name="clear"
class="cursor-pointer"
@click="filter = ''"
/>
<q-icon v-else name="search" color="grey-5" />
<q-icon name="search" />
</template>
</q-input>
</div>
@ -258,7 +250,7 @@ onMounted(async () => {
:nodes="nodeTree"
node-key="orgRootName"
label-key="labelName"
:filter="filter"
:filter="filter?.trim()"
no-results-label="ไม่พบข้อมูลที่ค้นหา"
no-nodes-label="ไม่มีข้อมูล"
v-model:expanded="expanded"
@ -300,16 +292,13 @@ onMounted(async () => {
</div>
</q-card-section>
<q-separator :vertical="$q.screen.gt.sm" />
<q-card-section
class="col-lg-9 col-md-8 col-xs-12 scroll"
style="height: 83vh"
>
<q-card-section class="col-lg-9 col-md-8 col-xs-12" style="height: 85vh">
<q-card bordered style="height: 100%; border: 1px solid #d6dee1">
<div class="col-12 text-weight-medium bg-grey-1 q-py-sm q-px-md">
รายชอคนททธดการโครงสราง
</div>
<div class="col-12"><q-separator /></div>
<q-card-section>
<q-card-section style="height: 92%" class="scroll">
<div class="row col-12 q-col-md">
<q-btn
v-if="orgId"
@ -349,22 +338,15 @@ onMounted(async () => {
label="คำค้น"
hide-bottom-space
>
<template v-slot:append>
<q-icon
v-if="qureyBody.searchKeyword"
name="cancel"
@click="qureyBody.searchKeyword = ''"
class="cursor-pointer"
></q-icon>
</template>
</q-input>
</div>
<div>
<q-btn
outline
color="primary"
icon="search"
label="ค้นหา"
class="full-width"
class="full-width full-height"
@click="fetchListPerson(true)"
/>
</div>
@ -492,7 +474,7 @@ onMounted(async () => {
<style scoped>
.tree-container {
overflow: auto;
height: 70vh;
height: 76vh;
border: 1px solid #e6e6e7;
border-radius: 10px;
}

View file

@ -143,7 +143,7 @@ const columns = ref<QTableProps["columns"]>([
{
name: "isPosMasterAssign",
align: "center",
label: "การเจ้าหน้าที่",
label: "การเจ้าหน้าที่/สกจ.",
sortable: false,
field: "isPosMasterAssign",
headerStyle: "font-size: 14px",
@ -228,7 +228,7 @@ const columnsExpand = ref<QTableProps["columns"]>([
const reqMaster = reactive<FilterReqMaster>({
id: "",
type: 0,
isAll: false,
isAll: true,
isBlank: false,
page: 1,
pageSize: 10,
@ -340,6 +340,7 @@ async function fetchDataTable(
* @param data
*/
function updateSelected(data: NodeTree) {
reqMaster.isAll = data.orgTreeId === "" ? true : reqMaster.isAll;
nodeId.value = data.orgTreeId;
isOfficer.value = data.isOfficer;
fetchDataTable(data.orgTreeId, data.orgRevisionId, data.orgLevel);
@ -411,8 +412,7 @@ watch(
() => [reqMaster.isAll, reqMaster.isBlank],
() => {
reqMaster.page = 1;
reqMaster.id &&
fetchDataTable(reqMaster.id, reqMaster.revisionId, reqMaster.type);
fetchDataTable(reqMaster.id, reqMaster.revisionId, reqMaster.type);
}
);
@ -441,13 +441,7 @@ onMounted(() => {
<div class="col-12">
<q-input dense outlined v-model="filter" label="ค้นหา">
<template v-slot:append>
<q-icon
v-if="filter !== ''"
name="clear"
class="cursor-pointer"
@click="filter = ''"
/>
<q-icon v-else name="search" color="grey-5" />
<q-icon name="search" />
</template>
</q-input>
</div>
@ -460,7 +454,7 @@ onMounted(() => {
:nodes="lazy"
node-key="orgTreeId"
label-key="labelName"
:filter="filter"
:filter="filter?.trim()"
no-results-label="ไม่พบข้อมูลที่ค้นหา"
no-nodes-label="ไม่มีข้อมูล"
v-model:expanded="expanded"
@ -521,7 +515,10 @@ onMounted(() => {
</div>
<!-- TOOLBAR -->
<div class="col-xs-12 col-sm-9 q-pa-md row">
<div
class="col-xs-12 col-sm-9 q-pa-md row scroll"
style="height: 85vh"
>
<div class="col-12">
<q-toolbar style="padding: 0">
<q-space />
@ -540,6 +537,7 @@ onMounted(() => {
<div>
<q-checkbox
keep-color
:disable="nodeId"
v-model="reqMaster.isAll"
label="แสดงตำแหน่งทั้งหมด"
color="primary"
@ -555,8 +553,6 @@ onMounted(() => {
dense
v-model="reqMaster.keyword"
label="ค้นหา"
clearable
@clear="reqMaster.keyword = ''"
@keydown.enter.prevent="
(reqMaster.page = 1),
fetchDataTable(
@ -566,8 +562,8 @@ onMounted(() => {
)
"
>
<template v-slot:append v-if="reqMaster.keyword === ''">
<q-icon name="search" color="grey-5" />
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
</div>
@ -709,7 +705,9 @@ onMounted(() => {
<q-item-section avatar>
<q-icon color="red" name="delete" />
</q-item-section>
<q-item-section> ลบหนาทความรบผดชอบทงหมด</q-item-section>
<q-item-section>
ลบหนาทความรบผดชอบทงหมด</q-item-section
>
</q-item>
</q-list>
</q-menu>
@ -834,7 +832,7 @@ onMounted(() => {
<style scoped>
.tree-container {
overflow: auto;
height: 75vh;
height: 80vh;
border: 1px solid #e6e6e7;
border-radius: 10px;
}

View file

@ -443,10 +443,10 @@ function updateDate() {
function onSendCSV() {
const queryString = {
rootId: qureyBody.rootId ?? undefined,
size: size.value ?? undefined,
// size: size.value ?? undefined,
search: inputSearch.value ?? undefined,
systemName: systemName.value ?? undefined,
searchAfter: searchAfter.value ?? undefined,
// searchAfter: searchAfter.value ?? undefined,
sort: sortTime.value,
startDate: new Date(startDate.value) ?? undefined,
endDate: new Date(endDate.value) ?? undefined,
@ -495,13 +495,7 @@ onMounted(async () => {
<div class="q-mb-sm">
<q-input dense outlined v-model="filter" label="ค้นหา">
<template v-slot:append>
<q-icon
v-if="filter !== ''"
name="clear"
class="cursor-pointer"
@click="filter = ''"
/>
<q-icon v-else name="search" color="grey-5" />
<q-icon name="search" />
</template>
</q-input>
</div>
@ -512,7 +506,7 @@ onMounted(async () => {
:nodes="nodeTree"
node-key="orgRootName"
label-key="orgRootName"
:filter="filter"
:filter="filter.trim()"
no-results-label="ไม่พบข้อมูลที่ค้นหา"
no-nodes-label="ไม่มีข้อมูล"
v-model:expanded="expanded"
@ -590,17 +584,17 @@ onMounted(async () => {
style="display: flex"
>
<!-- นหาขอความใน table -->
<!-- @update:model-value="" -->
<q-input
standout
dense
clearable
v-model="inputSearch"
ref="filterRef"
@update:model-value="
@keydown.enter.pervent="
storeData.fetchLog({
rootId: qureyBody.rootId ?? undefined,
size: size ?? undefined,
search: inputSearch ?? undefined,
search: inputSearch?.trim() ?? undefined,
systemName: systemName ?? undefined,
sort: sortTime,
// date: new Date(startDate),
@ -609,16 +603,12 @@ onMounted(async () => {
})
"
outlined
debounce="500"
placeholder="ค้นหา"
style="max-width: 200px"
class="q-ml-sm"
>
<template v-slot:append>
<q-icon
name="search"
v-if="inputSearch === '' || inputSearch === null"
/>
<q-icon name="search" />
</template>
</q-input>

View file

@ -1,32 +1,44 @@
<script setup lang="ts">
import { ref } from "vue";
import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";
/**
* importType
*/
/** importType*/
import type { QTableProps } from "quasar";
import type { DataBackup } from "@/modules/04_system/interface/response/Main";
/**
* importStore
*/
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/modules/04_system/stores/main";
import { storeToRefs } from "pinia";
/**
* use
*/
/** use*/
const $q = useQuasar();
const { showLoader, date2Thai, dialogRemove, dialogConfirm } =
useCounterMixin();
const { createBackUp, restore, deleteBackUp } = useDataStore();
const {
showLoader,
date2Thai,
dialogRemove,
dialogConfirm,
onSearchDataTable,
success,
} = useCounterMixin();
const {
createBackUp,
restore,
deleteBackUp,
fetchListBackup,
backupRunningList,
restoreRunningList,
} = useDataStore();
const storeData = useDataStore();
const { dataBackUp, backupRunTotal, restoreRunTotal } = storeToRefs(storeData);
const {
dataBackUp,
backupRunTotal,
restoreRunTotal,
prevBackupRunTotal,
prevRestoreRunTotal,
} = storeToRefs(storeData);
/**
* Table
*/
/** Table*/
const filter = ref<string>("");
const visibleColumns = ref<string[]>([
"name",
@ -67,9 +79,7 @@ const columns = ref<QTableProps["columns"]>([
},
]);
/**
* function สรางรายการขอมลสำรอง
*/
/** function สร้างรายการข้อมูลสำรอง*/
function onCreateBackup() {
dialogConfirm(
$q,
@ -107,6 +117,29 @@ function onRestore(name: string) {
"ต้องการยืนยันการคืนค่าข้อมูลสำรองนี้ใช่หรือไม่?"
);
}
const dataMain = ref<DataBackup[]>([]);
function onDownloadFile(id: string) {
success($q, "รอ API");
}
function serchDataTable() {
dataBackUp.value = onSearchDataTable(
filter.value,
dataMain.value,
columns.value ? columns.value : []
);
}
onMounted(async () => {
prevBackupRunTotal.value = -1;
prevRestoreRunTotal.value = -1;
await fetchListBackup();
await backupRunningList(fetchListBackup);
await restoreRunningList(() => {});
dataMain.value = dataBackUp.value;
});
</script>
<template>
@ -127,10 +160,10 @@ function onRestore(name: string) {
<q-input
borderless
dense
debounce="300"
outlined
v-model="filter"
placeholder="ค้นหา"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append>
<q-icon name="search" />
@ -156,7 +189,6 @@ function onRestore(name: string) {
:columns="columns"
row-key="name"
:visible-columns="visibleColumns"
:filter="filter"
>
<template v-slot:header="props">
<q-tr :props="props">
@ -205,6 +237,18 @@ function onRestore(name: string) {
<q-tooltip>ลบขอมลสำรอง</q-tooltip>
</q-btn>
<q-btn
v-if="props.row.status !== 'running'"
dense
flat
round
icon="mdi-download"
color="primary"
@click.petvent="onDownloadFile(props.row.id)"
>
<q-tooltip>ดาวนโหลดขอมลสำรอง</q-tooltip>
</q-btn>
<q-btn
v-if="props.row.status !== 'running'"
dense

View file

@ -33,6 +33,7 @@ const {
dialogRemove,
dialogConfirm,
dialogMessageNotify,
onSearchDataTable,
} = useCounterMixin();
const {
getSchedule,
@ -112,8 +113,10 @@ const columns = ref<QTableProps["columns"]>([
align: "left",
label: "วันที่เริ่มการสำรองข้อมูล",
sortable: true,
field: (v) => date2Thai(v, false, true),
field: "startAt",
format(val, row) {
return date2Thai(val, false, true);
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
@ -268,6 +271,14 @@ function clearForm() {
formDataschedule.value.time = "";
formDataschedule.value.schedule = "";
}
const dataMain = ref<Schedule[]>([]);
function serchDataTable() {
dataSchedule.value = onSearchDataTable(
filter.value,
dataMain.value,
columns.value ? columns.value : []
);
}
watch(tab, () => {
if (tab.value === formDataschedule.value.type) {
@ -282,7 +293,8 @@ watch(tab, () => {
});
onMounted(async () => {
getSchedule();
await getSchedule();
dataMain.value = dataSchedule.value;
});
</script>
@ -309,10 +321,10 @@ onMounted(async () => {
<q-input
borderless
dense
debounce="300"
outlined
v-model="filter"
placeholder="ค้นหา"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append>
<q-icon name="search" />
@ -338,7 +350,6 @@ onMounted(async () => {
:columns="columns"
row-key="name"
:visible-columns="visibleColumns"
:filter="filter"
>
<template v-slot:header="props">
<q-tr :props="props">

View file

@ -35,22 +35,23 @@ export const useDataStore = defineStore("systemStore", () => {
*
*/
async function fetchListBackup() {
showLoader();
const res = await http.get(config.API.backup);
hideLoader();
if (!res) return false;
try {
showLoader();
const res = await http.get(config.API.backup);
if (res.status === 200) {
dataBackUp.value = await res.data;
dataBackUp.value = dataBackUp.value.map((item) => {
return {
...item,
status: "สำเร็จ",
};
});
return res.status;
if (!res) return false;
if (res.status === 200) {
dataBackUp.value = await res.data;
dataBackUp.value = dataBackUp.value.map((item) => {
return {
...item,
status: "สำเร็จ",
};
});
return res.status;
}
} finally {
hideLoader();
}
}

View file

@ -1,27 +1,22 @@
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { useDataStore } from "@/modules/04_system/stores/main";
import { storeToRefs } from "pinia";
/**
* import type
*/
// import { useDataStore } from "@/modules/04_system/stores/main";
// import { storeToRefs } from "pinia";
/** import type*/
import type { ItemsTeb } from "@/modules/04_system/interface/index/Main";
/**
* import components
*/
/** import components*/
import Card from "@/modules/04_system/components/01_cardBackupRestore.vue"; //
import CardAutoBackup from "@/modules/04_system/components/02_cardAutoBackup.vue"; //
const { fetchListBackup, backupRunningList, restoreRunningList } =
useDataStore();
// const { fetchListBackup, backupRunningList, restoreRunningList } =
// useDataStore();
/**
* วแปร
*/
const storeData = useDataStore();
const { prevBackupRunTotal, prevRestoreRunTotal } = storeToRefs(storeData);
/** ตัวแปร*/
// const storeData = useDataStore();
// const { prevBackupRunTotal, prevRestoreRunTotal } = storeToRefs(storeData);
const tab = ref<string>("backup");
const tabItems = ref<ItemsTeb[]>([
@ -29,13 +24,13 @@ const tabItems = ref<ItemsTeb[]>([
{ name: "autoBackUp", label: "Schedule ", icon: "mdi-clock-outline" },
]);
onMounted(async () => {
prevBackupRunTotal.value = -1;
prevRestoreRunTotal.value = -1;
await fetchListBackup();
await backupRunningList(fetchListBackup);
await restoreRunningList(() => {});
});
// onMounted(async () => {
// prevBackupRunTotal.value = -1;
// prevRestoreRunTotal.value = -1;
// await fetchListBackup();
// await backupRunningList(fetchListBackup);
// await restoreRunningList(() => {});
// });
</script>
<template>

View file

@ -31,7 +31,6 @@ const isLoadPDF = ref<boolean>(false); // Loading display pdf
const pdfSrc = ref<any>(null); // PDF path display
const page = ref<number>(1); //
const numOfPages = ref<number>(0); // PDF
const splitterModel = ref(14);
const typeFile = ref<string>(type.value === "cover" ? "docx" : "xlsx"); // cover=docx attachment=xlsx
// next page PDF
function nextPage() {
@ -269,7 +268,6 @@ defineExpose({
</div>
<div class="col-12">
<q-splitter
v-model="splitterModel"
horizontal
style="
height: 70vh;

View file

@ -31,6 +31,7 @@ interface ListOrder {
isAttachment: boolean;
category?: string;
commandSysId: string;
isUploadAttachment: boolean;
}
interface ListTemplateSalary {
@ -50,5 +51,5 @@ export type {
ListOrder,
Tabs,
ListTemplateSalary,
CommandSysType
CommandSysType,
};

View file

@ -8,7 +8,6 @@ import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/modules/05_command/stores/main";
import type {
ActiveOptions,
ListOrder,
Tabs,
DateOption,
@ -59,6 +58,7 @@ const isActive = ref<boolean>(true); // สถานะของรายกา
const isAttachment = ref<boolean>(true); //
const isSalary = ref<boolean>(true); //
const isAttachmentShow = ref<boolean>(true); // show/off
const isUploadAttachment = ref<boolean>(false);
const dataCategory = ref<DateOption[]>([]); //
const categoryOP = ref<DateOption[]>([]); // options
@ -79,9 +79,7 @@ const page = ref<number>(1); // หน้า
const pageSize = ref<number>(13); //
const maxPage = ref<number>(0); //
/**
* งกนดงรายการประเภทคำส
*/
/** ฟังก์ชั่นดึงรายการประเภทคำสั่ง*/
async function fetchCommandType() {
showLoader();
await http
@ -114,9 +112,7 @@ async function fetchCommandType() {
});
}
/**
* งกนดงขอมลรายการหมวดหม
*/
/** ฟังก์ชันดึงข้อมูลรายการหมวดหมู่*/
function fetchCommandSys() {
showLoader();
http
@ -161,6 +157,7 @@ function onDialogEdit(data: ListOrder) {
subtitle.value = data.subtitle ? data.subtitle : "";
isEdit.value = true;
isAttachment.value = data.isAttachment;
isUploadAttachment.value = data.isUploadAttachment;
dialogFormCommand.value = true;
}
@ -177,9 +174,7 @@ function closeDialog() {
category.value = "";
}
/**
* นทกขอมลการแกไขคำส
*/
/** บันทึกข้อมูลการแก้ไขคำสั่ง*/
function onSubmit() {
dialogConfirm($q, async () => {
showLoader();
@ -191,6 +186,7 @@ function onSubmit() {
isActive: status.value,
isAttachment: isAttachment.value,
isSalary: isSalary.value,
isUploadAttachment: isUploadAttachment.value,
})
.then(async () => {
await fetchCommandType();
@ -247,7 +243,6 @@ async function fetchDataCommandTypeId(id: string) {
*/
function filterSelector(val: string, update: Function) {
update(() => {
category.value = val ? "" : category.value;
categoryOP.value = dataCategory.value.filter(
(v: DateOption) => v.name.indexOf(val) > -1
);
@ -281,13 +276,11 @@ onMounted(async () => {
borderless
dense
outlined
clearable
v-model="keyword"
placeholder="ค้นหา"
@clear="(keyword = ''), searchByStatus()"
@keydown.enter.prevent="searchByStatus()"
>
<template v-slot:append v-if="keyword === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -475,6 +468,8 @@ onMounted(async () => {
option-value="id"
lazy-rules
use-input
hide-selected
fill-input
hide-bottom-space
outlined
:rules="[(val:string) => !!val || `${'กรุณาเลือกหมวดหมู่'}`]"
@ -505,9 +500,11 @@ onMounted(async () => {
label="บัญชีแนบท้าย"
size="sm"
/>
<q-checkbox v-model="isSalary" label="แก้ไขเงินเดือน" size="sm" />
<q-checkbox
v-model="isSalary"
label="แก้ไขเงินเดือน"
v-model="isUploadAttachment"
label="อัปโหลดบัญชีแนบท้าย"
size="sm"
/>
</div>

View file

@ -6,20 +6,17 @@ import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/modules/05_command/stores/main";
import type {
CommandSysType,
ListTemplateSalary,
ActiveOptions,
} from "@/modules/05_command/interface/index/Main";
import Header from "@/components/DialogHeader.vue";
import { options } from "@fullcalendar/core/preact";
const $q = useQuasar();
const mixin = useCounterMixin();
const store = useDataStore();
const {
dialogConfirm,
success,
@ -42,16 +39,6 @@ const filter = ref<string>(""); // ตัวแปร ฟิลเตอร์
const listOrder = ref<CommandSysType[]>([]);
const activeOrderId = ref<string>(""); // id = class
const isActive = ref<boolean>(true); //
const isActiveOption = ref<ActiveOptions[]>([
{
value: true,
label: "ใช้งาน",
},
{
value: false,
label: "ไม่ได้ใช้งาน",
},
]);
const dataForm = reactive<ListTemplateSalary>({
id: "",
name: "",
@ -139,7 +126,6 @@ function closeDialog() {
dataForm.id = "";
dataForm.name = "";
dataForm.isActive = false;
isEdit.value = false;
dialogForm.value = false;
}
@ -301,7 +287,7 @@ onMounted(() => {
dense
round
icon="add"
color="add"
color="primary"
@click="onDialogAdd"
><q-tooltip>เพมขอม</q-tooltip>
</q-btn>
@ -323,20 +309,13 @@ onMounted(() => {
<q-input
borderless
dense
debounce="300"
outlined
v-model="filter"
placeholder="ค้นหา"
@keydown.enter="(pagination.page = 1), fetchSalaryList()"
>
<template v-slot:append>
<q-icon name="search" v-if="filter == ''" />
<q-icon
name="clear"
v-else
class="cursor-pointer"
@click="filter = ''"
/>
<q-icon name="search" />
</template>
</q-input>
<q-select

View file

@ -39,7 +39,7 @@ const isAPIKey = ref<boolean>(false); //status API Key
const apiKey = ref<string>(""); // API Key
const options = ref<ListApi[]>([]); // API
// form API Key
// form API Key
const formData = reactive<FormCreate>({
name: "", ///
apiId: [], //id API

View file

@ -74,7 +74,7 @@ const columns = ref<QTableProps["columns"]>([
{
name: "apiName",
align: "left",
label: "API Request",
label: "API ที่เข้าถึง",
sortable: false,
field: "apiName",
headerStyle: "font-size: 14px",
@ -95,7 +95,7 @@ const columns = ref<QTableProps["columns"]>([
{
name: "apiKey",
align: "left",
label: " คน request",
label: "ผู้ร้องขอ",
sortable: false,
field: "apiKey",
headerStyle: "font-size: 14px",
@ -104,7 +104,7 @@ const columns = ref<QTableProps["columns"]>([
{
name: "ipApi",
align: "left",
label: " IP",
label: " IP Address",
sortable: false,
field: "ipApi",
headerStyle: "font-size: 14px",
@ -126,7 +126,7 @@ async function fetchListApiKeyName() {
dataApiName.value.push(...optionData);
options.value = dataApiName.value;
await onItemClick(labelDropdown.value, valDropdown.value);
await fetchListLog();
// await fetchListLog();
})
.catch((err) => {
messageError($q, err);
@ -301,10 +301,12 @@ onMounted(async () => {
map-options
v-model="apiNameId"
:options="options"
label="รายกร Web Services"
label="รายร Web Services"
use-input
hide-selected
fill-input
:clearable="apiNameId !== ''"
@clear="(apiNameId = ''), (options = dataApiName)"
@update:modelValue="onSelectType"
@filter="(inputValue: string,doneFn: Function) => filterSelector(inputValue, doneFn )"
>

View file

@ -24,10 +24,12 @@ const {
messageError,
success,
date2Thai,
onSearchDataTable,
} = useCounterMixin();
/** Table*/
const rows = ref<ListWebServices[]>([]); // webservices
const rowsMain = ref<ListWebServices[]>([]); // webservices
const keyword = ref<string>(""); // webservices
const visibleColumns = ref<string[]>([
"name",
@ -107,6 +109,7 @@ async function fetchListWebServices() {
.then(async (res) => {
const data = await res.data.result;
rows.value = data;
rowsMain.value = data;
})
.catch((err) => {
messageError($q, err);
@ -140,6 +143,14 @@ function onDeleteData(id: string) {
});
}
function serchDataTable() {
rows.value = onSearchDataTable(
keyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
/** hook เมื่อเรียก Components จะเรียกฟังก์ชัน 'fetchListWebServices' เรียกข้อมูลรายการ webservices*/
onMounted(() => {
fetchListWebServices();
@ -148,9 +159,6 @@ onMounted(() => {
<template>
<div class="row items-center">
<!-- <div class="toptitle text-dark row items-center q-py-xs">
รายการ web services
</div> -->
<q-space />
<q-btn
flat
@ -160,105 +168,91 @@ onMounted(() => {
/>
</div>
<!-- <q-card flast bordered class="q-pa-md"> -->
<!-- toolbar -->
<div class="items-center col-12 row q-col-gutter-sm">
<q-btn
class="q-ml-sm"
flat
round
dense
color="primary"
icon="add"
@click.pervent="modalApiKey = true"
>
<q-tooltip>สราง API Key </q-tooltip>
</q-btn>
<q-space />
<q-input
borderless
dense
outlined
clearable
v-model="keyword"
placeholder="ค้นหา"
@clear="keyword = ''"
>
<template v-slot:append v-if="keyword === ''">
<q-icon name="search" />
</template>
</q-input>
<q-select
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
/>
</div>
<div class="items-center col-12 row q-col-gutter-sm">
<q-btn
class="q-ml-sm"
flat
round
dense
color="primary"
icon="add"
@click.pervent="modalApiKey = true"
>
<q-tooltip>สราง API Key </q-tooltip>
</q-btn>
<q-space />
<q-input
borderless
dense
outlined
v-model="keyword"
placeholder="ค้นหา"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<q-select
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
/>
</div>
<!-- Table -->
<div class="col-12 q-pt-sm">
<d-table
ref="table"
:columns="columns"
:rows="rows"
row-key="id"
:filter="keyword"
flat
bordered
:paging="true"
dense
:rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th auto-width />
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props">
<q-td auto-width>
<q-btn
dense
flat
round
color="red"
@click="onDeleteData(props.row.id)"
icon="delete"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn></q-td
<!-- Table -->
<div class="col-12 q-pt-sm">
<d-table
ref="table"
:columns="columns"
:rows="rows"
row-key="id"
flat
bordered
:paging="true"
dense
:rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th auto-width />
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props">
<q-td auto-width>
<q-btn
dense
flat
round
color="red"
@click="onDeleteData(props.row.id)"
icon="delete"
>
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<!-- <div v-if="col.name === 'apiNames'">
<q-list dense>
<q-item v-for="(item, key) in col.value">
<q-item-section>- {{ item.name }}</q-item-section>
</q-item>
</q-list>
</div> -->
<div v-html="col.value ? col.value : '-'"></div>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn></q-td
>
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div v-html="col.value ? col.value : '-'"></div>
<div>
<!-- {{ col.value ? col.value : "-" }} -->
</div>
</q-td>
</q-tr>
</template>
</d-table>
</div>
<!-- </q-card> -->
<div></div>
</q-td>
</q-tr>
</template>
</d-table>
</div>
<!-- สราง API Key -->
<DialogApiKey

View file

@ -3,7 +3,7 @@ import { ref } from "vue";
/** importComponents*/
import ListView from "@/modules/06_webservices/view/listView.vue";
import LogView from "@/modules/06_webservices/view/logView.vue";
import LogView from "@/modules/06_webservices/view/historyView.vue";
const tabs = ref<string>("list");
</script>

View file

@ -1058,6 +1058,26 @@ export const useCounterMixin = defineStore("mixin", () => {
}
}
function onSearchDataTable(keyword: string, data: any[], columns: any[]) {
const searchText = keyword.trim().toLowerCase();
if (!searchText) {
return data; // คืนค่าทั้งหมดถ้าไม่มีข้อความค้นหา
}
// คืนค่าข้อมูลที่กรองแล้ว
return data.filter((row: any) => {
return columns.some((col: any) => {
const rawValue = row[col.field];
const formattedValue = col.format
? col.format(rawValue, row) // ใช้ `format` ถ้ามี
: rawValue;
return String(formattedValue).toLowerCase().includes(searchText);
});
});
}
return {
calAge,
date2Thai,
@ -1099,5 +1119,7 @@ export const useCounterMixin = defineStore("mixin", () => {
findOrgNameOld,
findPosMasterNo,
findPosMasterNoOld,
onSearchDataTable,
};
});