Merge branch 'develop' of github.com:Frappet/bma-ehr-admin into develop
This commit is contained in:
commit
8ea824664d
4 changed files with 185 additions and 116 deletions
9
src/api/04_system/api.backup.ts
Normal file
9
src/api/04_system/api.backup.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
import env from "../index";
|
||||||
|
|
||||||
|
const backup = `http://192.168.1.90:20007/api/v1/backup`;
|
||||||
|
const restore = `http://192.168.1.90:20007/api/v1/backup/restore`;
|
||||||
|
|
||||||
|
export default {
|
||||||
|
backup,
|
||||||
|
restore,
|
||||||
|
};
|
||||||
|
|
@ -1,107 +1,113 @@
|
||||||
/**ใช้รวมไฟล์ย่อยๆ ของ api แต่ละไฟล์ */
|
/**ใช้รวมไฟล์ย่อยๆ ของ api แต่ละไฟล์ */
|
||||||
|
|
||||||
/** API Metadata */
|
/** API Metadata */
|
||||||
import manageOrganization from "./api/manage/api.organization"
|
import manageOrganization from "./api/manage/api.organization";
|
||||||
import managePerson from "./api/manage/api.person"
|
import managePerson from "./api/manage/api.person";
|
||||||
import managePosition from "./api/manage/api.position"
|
import managePosition from "./api/manage/api.position";
|
||||||
import managePositionEmployee from "./api/manage/api.positionEmployee"
|
import managePositionEmployee from "./api/manage/api.positionEmployee";
|
||||||
import manageInsignia from "./api/manage/api.insignia"
|
import manageInsignia from "./api/manage/api.insignia";
|
||||||
import manageHoliday from "./api/manage/api.holiday"
|
import manageHoliday from "./api/manage/api.holiday";
|
||||||
|
|
||||||
/** API Tree List */
|
/** API Tree List */
|
||||||
import organizationTreeList from "./api/02_organizational/api.treelist"
|
import organizationTreeList from "./api/02_organizational/api.treelist";
|
||||||
|
|
||||||
/** API Structure & Org Chart */
|
/** API Structure & Org Chart */
|
||||||
import organizationChart from "./api/02_organizational/api.chart"
|
import organizationChart from "./api/02_organizational/api.chart";
|
||||||
|
|
||||||
/** API Profile List */
|
/** API Profile List */
|
||||||
import profile from "./api/registry/api.profile"
|
import profile from "./api/registry/api.profile";
|
||||||
import registry from "./api/registry/api.registry"
|
import registry from "./api/registry/api.registry";
|
||||||
|
|
||||||
/** API dashboard */
|
/** API dashboard */
|
||||||
import message from "./api/00_dashboard/api.message"
|
import message from "./api/00_dashboard/api.message";
|
||||||
|
|
||||||
/** API reports */
|
/** API reports */
|
||||||
import reports from "./api/reports/api.report"
|
import reports from "./api/reports/api.report";
|
||||||
|
|
||||||
/** API โครงสร้างอัตรากำลัง*/
|
/** API โครงสร้างอัตรากำลัง*/
|
||||||
import organization from "./api/02_organizational/api.organization"
|
import organization from "./api/02_organizational/api.organization";
|
||||||
|
|
||||||
import file from "./api/file/api.file"
|
import file from "./api/file/api.file";
|
||||||
|
|
||||||
/** API ManagementUsers*/
|
/** API ManagementUsers*/
|
||||||
import menagement from "./api/manage/api.management"
|
import menagement from "./api/manage/api.management";
|
||||||
|
|
||||||
/** API ระเมินผลการปฏิบัติราชการระดับบุคคล*/
|
/** API ระเมินผลการปฏิบัติราชการระดับบุคคล*/
|
||||||
import KPI from "./api/14_KPI/api.KPI"
|
import KPI from "./api/14_KPI/api.KPI";
|
||||||
|
|
||||||
/** API เงินเดือน/ค่าจ้าง*/
|
/** API เงินเดือน/ค่าจ้าง*/
|
||||||
import development from "./api/15_development/api.development"
|
import development from "./api/15_development/api.development";
|
||||||
|
|
||||||
|
/** API BackUp/*/
|
||||||
|
import backup from "./api/04_system/api.backup";
|
||||||
|
|
||||||
// environment variables
|
// environment variables
|
||||||
export const compettitivePanel = import.meta.env.VITE_COMPETITIVE_EXAM_PANEL
|
export const compettitivePanel = import.meta.env.VITE_COMPETITIVE_EXAM_PANEL;
|
||||||
export const qualifyDisableExamPanel = import.meta.env.VITE_QUALIFY_DISABLE_EMAM_PANEL
|
export const qualifyDisableExamPanel = import.meta.env
|
||||||
export const qualifyExamPanel = import.meta.env.VITE_QUALIFY_EXAM_PANEL
|
.VITE_QUALIFY_DISABLE_EMAM_PANEL;
|
||||||
|
export const qualifyExamPanel = import.meta.env.VITE_QUALIFY_EXAM_PANEL;
|
||||||
|
|
||||||
const path = "http://chamomind.ddns.net:20006"
|
const path = "http://chamomind.ddns.net:20006";
|
||||||
|
|
||||||
const generatePopupPath = (routeName: any) => {
|
const generatePopupPath = (routeName: any) => {
|
||||||
if (routeName.includes("viewLogs")) {
|
if (routeName.includes("viewLogs")) {
|
||||||
return `${path}/build-and-deploy`
|
return `${path}/build-and-deploy`;
|
||||||
}
|
}
|
||||||
if (routeName.includes("manageUsers")) {
|
if (routeName.includes("manageUsers")) {
|
||||||
return `${path}/build-and-deploy`
|
return `${path}/build-and-deploy`;
|
||||||
}
|
}
|
||||||
if (routeName.includes("manageRoles")) {
|
if (routeName.includes("manageRoles")) {
|
||||||
return `${path}/build-and-deploy`
|
return `${path}/build-and-deploy`;
|
||||||
}
|
}
|
||||||
if (routeName.includes("managePermission")) {
|
if (routeName.includes("managePermission")) {
|
||||||
return `${path}/build-and-deploy`
|
return `${path}/build-and-deploy`;
|
||||||
} else {
|
} else {
|
||||||
return manualConfig[routeName as keyof typeof manualConfig]
|
return manualConfig[routeName as keyof typeof manualConfig];
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
const manualConfig = {
|
const manualConfig = {
|
||||||
dashboard: `${path}/build-and-deploy`,
|
dashboard: `${path}/build-and-deploy`,
|
||||||
}
|
};
|
||||||
const API = {
|
const API = {
|
||||||
//Metadata
|
//Metadata
|
||||||
...manageOrganization,
|
...manageOrganization,
|
||||||
...managePerson,
|
...managePerson,
|
||||||
...managePosition,
|
...managePosition,
|
||||||
...managePositionEmployee,
|
...managePositionEmployee,
|
||||||
...manageInsignia,
|
...manageInsignia,
|
||||||
...manageHoliday,
|
...manageHoliday,
|
||||||
|
|
||||||
// โครงสร้างอัตรากำลัง
|
// โครงสร้างอัตรากำลัง
|
||||||
...organization,
|
...organization,
|
||||||
|
|
||||||
//Tree List
|
//Tree List
|
||||||
...organizationTreeList,
|
...organizationTreeList,
|
||||||
...organizationChart,
|
...organizationChart,
|
||||||
|
|
||||||
//profile
|
//profile
|
||||||
...profile,
|
...profile,
|
||||||
...registry,
|
...registry,
|
||||||
|
|
||||||
//dashboard
|
//dashboard
|
||||||
...message,
|
...message,
|
||||||
|
|
||||||
//reports
|
//reports
|
||||||
...reports,
|
...reports,
|
||||||
|
|
||||||
/*file*/
|
/*file*/
|
||||||
...file,
|
...file,
|
||||||
|
|
||||||
/** menagement*/
|
/** menagement*/
|
||||||
...menagement,
|
...menagement,
|
||||||
/** KPI*/
|
/** KPI*/
|
||||||
...KPI,
|
...KPI,
|
||||||
...development,
|
...development,
|
||||||
}
|
/** backup*/
|
||||||
|
...backup,
|
||||||
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
API: API,
|
API: API,
|
||||||
generatePopupPath,
|
generatePopupPath,
|
||||||
}
|
};
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,8 @@ import type { DataBackup } from "@/modules/04_system/interface/response/Main";
|
||||||
* importStore
|
* importStore
|
||||||
*/
|
*/
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
import { useDataStore } from "@/modules/04_system/stores/main";
|
||||||
|
import { storeToRefs } from "pinia";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* use
|
* use
|
||||||
|
|
@ -19,6 +21,9 @@ import { useCounterMixin } from "@/stores/mixin";
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const { showLoader, hideLoader, date2Thai, dialogRemove, dialogConfirm } =
|
const { showLoader, hideLoader, date2Thai, dialogRemove, dialogConfirm } =
|
||||||
useCounterMixin();
|
useCounterMixin();
|
||||||
|
const { fetchListBackup, createBackUp, restore, deleteBackUp } = useDataStore();
|
||||||
|
const storeData = useDataStore();
|
||||||
|
const { dataBackUp } = storeToRefs(storeData);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* props
|
* props
|
||||||
|
|
@ -28,7 +33,6 @@ const tab = defineModel<string>("tab", { required: true });
|
||||||
/**
|
/**
|
||||||
* Table
|
* Table
|
||||||
*/
|
*/
|
||||||
const rows = ref<DataBackup[]>([]);
|
|
||||||
const filter = ref<string>("");
|
const filter = ref<string>("");
|
||||||
const visibleColumns = ref<string[]>(["name", "createAt", "status"]);
|
const visibleColumns = ref<string[]>(["name", "createAt", "status"]);
|
||||||
const baseColumns = ref<QTableProps["columns"]>([
|
const baseColumns = ref<QTableProps["columns"]>([
|
||||||
|
|
@ -50,15 +54,6 @@ const baseColumns = ref<QTableProps["columns"]>([
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "status",
|
|
||||||
align: "left",
|
|
||||||
label: "สถานะ",
|
|
||||||
sortable: true,
|
|
||||||
field: "status",
|
|
||||||
headerStyle: "font-size: 14px",
|
|
||||||
style: "font-size: 14px",
|
|
||||||
},
|
|
||||||
]);
|
]);
|
||||||
const columns = computed(() => {
|
const columns = computed(() => {
|
||||||
if (tab.value === "restore") {
|
if (tab.value === "restore") {
|
||||||
|
|
@ -69,40 +64,15 @@ const columns = computed(() => {
|
||||||
return baseColumns.value;
|
return baseColumns.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* function เรียกข้อมูลรายการสำรอง
|
|
||||||
*/
|
|
||||||
function fetchListBackup() {
|
|
||||||
showLoader();
|
|
||||||
const data: DataBackup[] = [
|
|
||||||
{
|
|
||||||
id: "1",
|
|
||||||
name: "สำรอง1",
|
|
||||||
createAt: new Date(),
|
|
||||||
status: "ดำเนินการ",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "2",
|
|
||||||
name: "สำรอง2",
|
|
||||||
createAt: new Date(),
|
|
||||||
status: "ดำเนินการ",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
rows.value = data;
|
|
||||||
setTimeout(() => {
|
|
||||||
hideLoader();
|
|
||||||
}, 500);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function สร้างรายการข้อมูสำรอง
|
* function สร้างรายการข้อมูสำรอง
|
||||||
*/
|
*/
|
||||||
function onCreateBackup() {
|
function onCreateBackup() {
|
||||||
dialogConfirm(
|
dialogConfirm(
|
||||||
$q,
|
$q,
|
||||||
() => {
|
async () => {
|
||||||
showLoader();
|
showLoader();
|
||||||
fetchListBackup();
|
await createBackUp();
|
||||||
},
|
},
|
||||||
"ยืนยันการสร้างข้อมูสำรอง",
|
"ยืนยันการสร้างข้อมูสำรอง",
|
||||||
"ต้องการยืนยันการสร้างข้อมูสำรองใช่หรือไม่?"
|
"ต้องการยืนยันการสร้างข้อมูสำรองใช่หรือไม่?"
|
||||||
|
|
@ -113,10 +83,10 @@ function onCreateBackup() {
|
||||||
* function ลบรายการข้อมูสำรอง
|
* function ลบรายการข้อมูสำรอง
|
||||||
* @param id รายการสำรอง
|
* @param id รายการสำรอง
|
||||||
*/
|
*/
|
||||||
function onDelete(id: string) {
|
function onDelete(name: string) {
|
||||||
dialogRemove($q, () => {
|
dialogRemove($q, async () => {
|
||||||
showLoader();
|
showLoader();
|
||||||
fetchListBackup();
|
deleteBackUp(name);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -124,20 +94,20 @@ function onDelete(id: string) {
|
||||||
* function คืนค่าข้อมูสำรอง
|
* function คืนค่าข้อมูสำรอง
|
||||||
* @param id ข้อมูสำรอง
|
* @param id ข้อมูสำรอง
|
||||||
*/
|
*/
|
||||||
function onRestore(id: string) {
|
function onRestore(name: string) {
|
||||||
dialogConfirm(
|
dialogConfirm(
|
||||||
$q,
|
$q,
|
||||||
() => {
|
async () => {
|
||||||
showLoader();
|
showLoader();
|
||||||
fetchListBackup();
|
await restore(name);
|
||||||
},
|
},
|
||||||
"ยืนยันการคืนค่าข้อมูสำรอง",
|
"ยืนยันการคืนค่าข้อมูสำรอง",
|
||||||
"ต้องการยืนยันการคืนค่าข้อมูสำรองนี้ใช่หรือไม่?"
|
"ต้องการยืนยันการคืนค่าข้อมูสำรองนี้ใช่หรือไม่?"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(async () => {
|
||||||
fetchListBackup();
|
await fetchListBackup();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -184,7 +154,7 @@ onMounted(() => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<d-table
|
<d-table
|
||||||
:rows="rows"
|
:rows="dataBackUp"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
row-key="name"
|
row-key="name"
|
||||||
:visible-columns="visibleColumns"
|
:visible-columns="visibleColumns"
|
||||||
|
|
@ -214,7 +184,7 @@ onMounted(() => {
|
||||||
icon="delete"
|
icon="delete"
|
||||||
color="red"
|
color="red"
|
||||||
size="12px"
|
size="12px"
|
||||||
@click.petvent="onDelete(props.row.id)"
|
@click.petvent="onDelete(props.row.name)"
|
||||||
>
|
>
|
||||||
<q-tooltip>ลบข้อมูลสำรอง </q-tooltip>
|
<q-tooltip>ลบข้อมูลสำรอง </q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
|
|
@ -227,7 +197,7 @@ onMounted(() => {
|
||||||
icon="restore"
|
icon="restore"
|
||||||
color="primary"
|
color="primary"
|
||||||
size="12px"
|
size="12px"
|
||||||
@click.petvent="onRestore(props.row.id)"
|
@click.petvent="onRestore(props.row.name)"
|
||||||
>
|
>
|
||||||
<q-tooltip>คืนค่า </q-tooltip>
|
<q-tooltip>คืนค่า </q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
|
|
|
||||||
84
src/modules/04_system/stores/main.ts
Normal file
84
src/modules/04_system/stores/main.ts
Normal file
|
|
@ -0,0 +1,84 @@
|
||||||
|
import { defineStore } from "pinia";
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
import config from "@/app.config";
|
||||||
|
|
||||||
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
|
||||||
|
import type { DataBackup } from "@/modules/04_system/interface/response/Main";
|
||||||
|
|
||||||
|
import { ref } from "vue";
|
||||||
|
|
||||||
|
const mixin = useCounterMixin();
|
||||||
|
const {
|
||||||
|
dialogRemove,
|
||||||
|
messageError,
|
||||||
|
showLoader,
|
||||||
|
hideLoader,
|
||||||
|
success,
|
||||||
|
dialogConfirm,
|
||||||
|
} = mixin;
|
||||||
|
|
||||||
|
export const useDataStore = defineStore("storeData", () => {
|
||||||
|
const dataBackUp = ref<DataBackup[]>([]);
|
||||||
|
|
||||||
|
async function fetchListBackup() {
|
||||||
|
showLoader();
|
||||||
|
await http
|
||||||
|
.get(config.API.backup)
|
||||||
|
.then((res) => {
|
||||||
|
dataBackUp.value = res.data;
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function createBackUp() {
|
||||||
|
showLoader();
|
||||||
|
await http
|
||||||
|
.post(config.API.backup + "/create")
|
||||||
|
.then(async (res) => {
|
||||||
|
fetchListBackup();
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteBackUp(filename: string) {
|
||||||
|
showLoader();
|
||||||
|
await http
|
||||||
|
.delete(config.API.backup + "/delete", {
|
||||||
|
data: { filename: filename },
|
||||||
|
})
|
||||||
|
.then(async (res) => {
|
||||||
|
fetchListBackup();
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function restore(filename: string) {
|
||||||
|
showLoader();
|
||||||
|
await http
|
||||||
|
.post(config.API.restore, {
|
||||||
|
filename: filename,
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
fetchListBackup();
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
dataBackUp,
|
||||||
|
|
||||||
|
fetchListBackup,
|
||||||
|
createBackUp,
|
||||||
|
restore,
|
||||||
|
deleteBackUp,
|
||||||
|
};
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue