Refactoring code module 08_KPI
This commit is contained in:
parent
3636f380fb
commit
67d117dcfc
48 changed files with 989 additions and 1140 deletions
|
|
@ -60,6 +60,33 @@ interface FileObType {
|
|||
pathName: string;
|
||||
fileName: string;
|
||||
}
|
||||
interface FormProfile {
|
||||
profileId: string;
|
||||
fullname: string;
|
||||
citizenId: string;
|
||||
oc: string;
|
||||
position: string;
|
||||
}
|
||||
|
||||
interface FormDataType {
|
||||
id: string;
|
||||
title: string;
|
||||
type: string;
|
||||
description: string;
|
||||
year: string;
|
||||
caseType: string;
|
||||
caseNumber: string;
|
||||
fullname: string;
|
||||
profileId: string;
|
||||
citizenId: string;
|
||||
status: string;
|
||||
oc: string;
|
||||
position: string;
|
||||
disciplineComplaint_Appeal_Docs: FileObType[];
|
||||
historyStatus: HistoryStatusType[];
|
||||
files: File | null;
|
||||
lastUpdatedAt: Date | null;
|
||||
}
|
||||
|
||||
export type {
|
||||
FormType,
|
||||
|
|
@ -68,4 +95,6 @@ export type {
|
|||
EditDataList,
|
||||
HistoryStatusType,
|
||||
FileObType,
|
||||
FormDataType,
|
||||
FormProfile
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,17 +8,22 @@ import config from "@/app.config";
|
|||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
import Form from "@/modules/07_appealComplain/views/Form.vue";
|
||||
|
||||
import type {
|
||||
FormProfile,
|
||||
FormDataType,
|
||||
} from "@/modules/07_appealComplain/interface/response/mainType";
|
||||
const router = useRouter();
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
|
||||
const { findOrgName, success, messageError, showLoader, hideLoader } = mixin;
|
||||
|
||||
const formProfile = reactive<any>({
|
||||
const formProfile = reactive<FormProfile>({
|
||||
profileId: "",
|
||||
fullname: "",
|
||||
citizenId: "",
|
||||
oc: "",
|
||||
position: "",
|
||||
});
|
||||
|
||||
/** ดึงข้อมูลจาก keycloak*/
|
||||
|
|
@ -46,7 +51,7 @@ function getProFile() {
|
|||
* บันทึกข้อมูล
|
||||
* @param data ฟอร์มข้อมูล
|
||||
*/
|
||||
function onSubmit(data: any) {
|
||||
function onSubmit(data: FormDataType) {
|
||||
const formData = new FormData();
|
||||
formData.append("profileId", data.profileId);
|
||||
formData.append("citizenId", data.citizenId);
|
||||
|
|
@ -57,23 +62,25 @@ function onSubmit(data: any) {
|
|||
formData.append("year", "");
|
||||
formData.append("caseType", "");
|
||||
formData.append("caseNumber", "");
|
||||
formData.append("file", data.files);
|
||||
if (data.files) {
|
||||
formData.append("file", data.files);
|
||||
}
|
||||
formData.append("oc", data.oc);
|
||||
formData.append("position", data.position);
|
||||
showLoader();
|
||||
http
|
||||
.post(config.API.appealAdd(), formData)
|
||||
.then((res) => {
|
||||
/** รอรับ id จาก response */
|
||||
router.push(`/appeal-complain/${res.data.result}`);
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
});
|
||||
// showLoader();
|
||||
// http
|
||||
// .post(config.API.appealAdd(), formData)
|
||||
// .then((res) => {
|
||||
// /** รอรับ id จาก response */
|
||||
// router.push(`/appeal-complain/${res.data.result}`);
|
||||
// success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
// })
|
||||
// .catch((e) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(async () => {
|
||||
// hideLoader();
|
||||
// });
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
|
|
|||
|
|
@ -90,7 +90,6 @@ async function getReport(fileName: string) {
|
|||
await http
|
||||
.get(config.API.appealByPrintReport(id.value))
|
||||
.then(async (res) => {
|
||||
console.log(res.data.result.data);
|
||||
const data = res.data.result;
|
||||
await genReport(data, fileName);
|
||||
})
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import type { MyObjectAppealRef } from "@/modules/07_appealComplain/interface/re
|
|||
import type {
|
||||
HistoryStatusType,
|
||||
FileObType,
|
||||
FormDataType,
|
||||
} from "@/modules/07_appealComplain/interface/response/mainType";
|
||||
|
||||
const $q = useQuasar();
|
||||
|
|
@ -29,7 +30,8 @@ const fileOb = reactive<FileObType>({
|
|||
fileName: "",
|
||||
});
|
||||
|
||||
const formData = reactive<any>({
|
||||
const formData = reactive<FormDataType>({
|
||||
id: "",
|
||||
title: "",
|
||||
type: "",
|
||||
description: "",
|
||||
|
|
@ -41,8 +43,11 @@ const formData = reactive<any>({
|
|||
citizenId: "",
|
||||
oc: "",
|
||||
position: "",
|
||||
status: "",
|
||||
disciplineComplaint_Appeal_Docs: [fileOb],
|
||||
historyStatus: [historyStatusOb],
|
||||
files: null,
|
||||
lastUpdatedAt: null,
|
||||
});
|
||||
|
||||
const props = defineProps({
|
||||
|
|
@ -98,8 +103,6 @@ function validateForm() {
|
|||
if (hasError.every((result) => result === true)) {
|
||||
onSubmit(formData);
|
||||
} else {
|
||||
console.log("ไม่ผ่าน ");
|
||||
console.log(hasError);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -134,7 +137,7 @@ function filePrintDownload(fileName: string) {
|
|||
* บันทึก form อุทธรณ์/ร้องทุกข์
|
||||
* @param data ข้อมูล
|
||||
*/
|
||||
function onSubmit(data: any) {
|
||||
function onSubmit(data: FormDataType) {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
async () => {
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ async function getData() {
|
|||
filterKeyword.value
|
||||
)
|
||||
)
|
||||
.then((res: any) => {
|
||||
.then((res) => {
|
||||
total.value = res.data.result.total;
|
||||
maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value);
|
||||
let data = res.data.result.data;
|
||||
|
|
@ -436,10 +436,7 @@ onMounted(async () => {
|
|||
<div class="q-pa-xs col-xs-12 col-sm-6 col-md-4 col-lg-3">
|
||||
<q-card bordered flat>
|
||||
<q-list @click="editPage(props.row.id)">
|
||||
<q-item
|
||||
v-for="col in props.cols.filter((col:any) => col.name !== 'desc')"
|
||||
:key="col.name"
|
||||
>
|
||||
<q-item v-for="col in props.cols" :key="col.name">
|
||||
<q-item-section>
|
||||
<q-item-label caption>{{ col.label }}</q-item-label>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue