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 Metadata */
|
||||
import manageOrganization from "./api/manage/api.organization"
|
||||
import managePerson from "./api/manage/api.person"
|
||||
import managePosition from "./api/manage/api.position"
|
||||
import managePositionEmployee from "./api/manage/api.positionEmployee"
|
||||
import manageInsignia from "./api/manage/api.insignia"
|
||||
import manageHoliday from "./api/manage/api.holiday"
|
||||
import manageOrganization from "./api/manage/api.organization";
|
||||
import managePerson from "./api/manage/api.person";
|
||||
import managePosition from "./api/manage/api.position";
|
||||
import managePositionEmployee from "./api/manage/api.positionEmployee";
|
||||
import manageInsignia from "./api/manage/api.insignia";
|
||||
import manageHoliday from "./api/manage/api.holiday";
|
||||
|
||||
/** API Tree List */
|
||||
import organizationTreeList from "./api/02_organizational/api.treelist"
|
||||
import organizationTreeList from "./api/02_organizational/api.treelist";
|
||||
|
||||
/** API Structure & Org Chart */
|
||||
import organizationChart from "./api/02_organizational/api.chart"
|
||||
import organizationChart from "./api/02_organizational/api.chart";
|
||||
|
||||
/** API Profile List */
|
||||
import profile from "./api/registry/api.profile"
|
||||
import registry from "./api/registry/api.registry"
|
||||
import profile from "./api/registry/api.profile";
|
||||
import registry from "./api/registry/api.registry";
|
||||
|
||||
/** API dashboard */
|
||||
import message from "./api/00_dashboard/api.message"
|
||||
import message from "./api/00_dashboard/api.message";
|
||||
|
||||
/** API reports */
|
||||
import reports from "./api/reports/api.report"
|
||||
import reports from "./api/reports/api.report";
|
||||
|
||||
/** 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*/
|
||||
import menagement from "./api/manage/api.management"
|
||||
import menagement from "./api/manage/api.management";
|
||||
|
||||
/** API ระเมินผลการปฏิบัติราชการระดับบุคคล*/
|
||||
import KPI from "./api/14_KPI/api.KPI"
|
||||
import KPI from "./api/14_KPI/api.KPI";
|
||||
|
||||
/** 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
|
||||
export const compettitivePanel = import.meta.env.VITE_COMPETITIVE_EXAM_PANEL
|
||||
export const qualifyDisableExamPanel = import.meta.env.VITE_QUALIFY_DISABLE_EMAM_PANEL
|
||||
export const qualifyExamPanel = import.meta.env.VITE_QUALIFY_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 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) => {
|
||||
if (routeName.includes("viewLogs")) {
|
||||
return `${path}/build-and-deploy`
|
||||
}
|
||||
if (routeName.includes("manageUsers")) {
|
||||
return `${path}/build-and-deploy`
|
||||
}
|
||||
if (routeName.includes("manageRoles")) {
|
||||
return `${path}/build-and-deploy`
|
||||
}
|
||||
if (routeName.includes("managePermission")) {
|
||||
return `${path}/build-and-deploy`
|
||||
} else {
|
||||
return manualConfig[routeName as keyof typeof manualConfig]
|
||||
}
|
||||
}
|
||||
if (routeName.includes("viewLogs")) {
|
||||
return `${path}/build-and-deploy`;
|
||||
}
|
||||
if (routeName.includes("manageUsers")) {
|
||||
return `${path}/build-and-deploy`;
|
||||
}
|
||||
if (routeName.includes("manageRoles")) {
|
||||
return `${path}/build-and-deploy`;
|
||||
}
|
||||
if (routeName.includes("managePermission")) {
|
||||
return `${path}/build-and-deploy`;
|
||||
} else {
|
||||
return manualConfig[routeName as keyof typeof manualConfig];
|
||||
}
|
||||
};
|
||||
|
||||
const manualConfig = {
|
||||
dashboard: `${path}/build-and-deploy`,
|
||||
}
|
||||
dashboard: `${path}/build-and-deploy`,
|
||||
};
|
||||
const API = {
|
||||
//Metadata
|
||||
...manageOrganization,
|
||||
...managePerson,
|
||||
...managePosition,
|
||||
...managePositionEmployee,
|
||||
...manageInsignia,
|
||||
...manageHoliday,
|
||||
//Metadata
|
||||
...manageOrganization,
|
||||
...managePerson,
|
||||
...managePosition,
|
||||
...managePositionEmployee,
|
||||
...manageInsignia,
|
||||
...manageHoliday,
|
||||
|
||||
// โครงสร้างอัตรากำลัง
|
||||
...organization,
|
||||
// โครงสร้างอัตรากำลัง
|
||||
...organization,
|
||||
|
||||
//Tree List
|
||||
...organizationTreeList,
|
||||
...organizationChart,
|
||||
//Tree List
|
||||
...organizationTreeList,
|
||||
...organizationChart,
|
||||
|
||||
//profile
|
||||
...profile,
|
||||
...registry,
|
||||
//profile
|
||||
...profile,
|
||||
...registry,
|
||||
|
||||
//dashboard
|
||||
...message,
|
||||
//dashboard
|
||||
...message,
|
||||
|
||||
//reports
|
||||
...reports,
|
||||
//reports
|
||||
...reports,
|
||||
|
||||
/*file*/
|
||||
...file,
|
||||
/*file*/
|
||||
...file,
|
||||
|
||||
/** menagement*/
|
||||
...menagement,
|
||||
/** KPI*/
|
||||
...KPI,
|
||||
...development,
|
||||
}
|
||||
/** menagement*/
|
||||
...menagement,
|
||||
/** KPI*/
|
||||
...KPI,
|
||||
...development,
|
||||
/** backup*/
|
||||
...backup,
|
||||
};
|
||||
|
||||
export default {
|
||||
API: API,
|
||||
generatePopupPath,
|
||||
}
|
||||
API: API,
|
||||
generatePopupPath,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ import type { DataBackup } from "@/modules/04_system/interface/response/Main";
|
|||
* importStore
|
||||
*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useDataStore } from "@/modules/04_system/stores/main";
|
||||
import { storeToRefs } from "pinia";
|
||||
|
||||
/**
|
||||
* use
|
||||
|
|
@ -19,6 +21,9 @@ import { useCounterMixin } from "@/stores/mixin";
|
|||
const $q = useQuasar();
|
||||
const { showLoader, hideLoader, date2Thai, dialogRemove, dialogConfirm } =
|
||||
useCounterMixin();
|
||||
const { fetchListBackup, createBackUp, restore, deleteBackUp } = useDataStore();
|
||||
const storeData = useDataStore();
|
||||
const { dataBackUp } = storeToRefs(storeData);
|
||||
|
||||
/**
|
||||
* props
|
||||
|
|
@ -28,7 +33,6 @@ const tab = defineModel<string>("tab", { required: true });
|
|||
/**
|
||||
* Table
|
||||
*/
|
||||
const rows = ref<DataBackup[]>([]);
|
||||
const filter = ref<string>("");
|
||||
const visibleColumns = ref<string[]>(["name", "createAt", "status"]);
|
||||
const baseColumns = ref<QTableProps["columns"]>([
|
||||
|
|
@ -50,15 +54,6 @@ const baseColumns = ref<QTableProps["columns"]>([
|
|||
headerStyle: "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(() => {
|
||||
if (tab.value === "restore") {
|
||||
|
|
@ -69,40 +64,15 @@ const columns = computed(() => {
|
|||
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 onCreateBackup() {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
() => {
|
||||
async () => {
|
||||
showLoader();
|
||||
fetchListBackup();
|
||||
await createBackUp();
|
||||
},
|
||||
"ยืนยันการสร้างข้อมูสำรอง",
|
||||
"ต้องการยืนยันการสร้างข้อมูสำรองใช่หรือไม่?"
|
||||
|
|
@ -113,10 +83,10 @@ function onCreateBackup() {
|
|||
* function ลบรายการข้อมูสำรอง
|
||||
* @param id รายการสำรอง
|
||||
*/
|
||||
function onDelete(id: string) {
|
||||
dialogRemove($q, () => {
|
||||
function onDelete(name: string) {
|
||||
dialogRemove($q, async () => {
|
||||
showLoader();
|
||||
fetchListBackup();
|
||||
deleteBackUp(name);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -124,20 +94,20 @@ function onDelete(id: string) {
|
|||
* function คืนค่าข้อมูสำรอง
|
||||
* @param id ข้อมูสำรอง
|
||||
*/
|
||||
function onRestore(id: string) {
|
||||
function onRestore(name: string) {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
() => {
|
||||
async () => {
|
||||
showLoader();
|
||||
fetchListBackup();
|
||||
await restore(name);
|
||||
},
|
||||
"ยืนยันการคืนค่าข้อมูสำรอง",
|
||||
"ต้องการยืนยันการคืนค่าข้อมูสำรองนี้ใช่หรือไม่?"
|
||||
);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchListBackup();
|
||||
onMounted(async () => {
|
||||
await fetchListBackup();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
@ -184,7 +154,7 @@ onMounted(() => {
|
|||
</div>
|
||||
|
||||
<d-table
|
||||
:rows="rows"
|
||||
:rows="dataBackUp"
|
||||
:columns="columns"
|
||||
row-key="name"
|
||||
:visible-columns="visibleColumns"
|
||||
|
|
@ -214,7 +184,7 @@ onMounted(() => {
|
|||
icon="delete"
|
||||
color="red"
|
||||
size="12px"
|
||||
@click.petvent="onDelete(props.row.id)"
|
||||
@click.petvent="onDelete(props.row.name)"
|
||||
>
|
||||
<q-tooltip>ลบข้อมูลสำรอง </q-tooltip>
|
||||
</q-btn>
|
||||
|
|
@ -227,7 +197,7 @@ onMounted(() => {
|
|||
icon="restore"
|
||||
color="primary"
|
||||
size="12px"
|
||||
@click.petvent="onRestore(props.row.id)"
|
||||
@click.petvent="onRestore(props.row.name)"
|
||||
>
|
||||
<q-tooltip>คืนค่า </q-tooltip>
|
||||
</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