Merge branch 'develop' into setthawut
This commit is contained in:
commit
667118b92f
55 changed files with 1396 additions and 686 deletions
|
|
@ -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,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
};
|
||||
|
|
@ -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,
|
||||
|
||||
|
|
|
|||
|
|
@ -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'">
|
||||
|
|
|
|||
|
|
@ -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 }}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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 : "-" }}
|
||||
|
|
|
|||
|
|
@ -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'">
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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 ?? "-" }}
|
||||
|
|
|
|||
|
|
@ -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'">
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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'">
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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)"
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 ที่เข้าถึงได้
|
||||
|
|
|
|||
|
|
@ -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 )"
|
||||
>
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue