API สรุปผล รอ pathName
This commit is contained in:
parent
5bb31541c9
commit
84a45e3f59
4 changed files with 94 additions and 61 deletions
|
|
@ -79,7 +79,9 @@ export default {
|
||||||
suspendReport: () => `${suspend}/report`,
|
suspendReport: () => `${suspend}/report`,
|
||||||
|
|
||||||
reportresult: (id: string) => `${disciplineMain}/result/report/${id}`,
|
reportresult: (id: string) => `${disciplineMain}/result/report/${id}`,
|
||||||
|
discardResult:(id:string,commandType:string) => `${discipline}/discard/${id}/${commandType}`,
|
||||||
|
upLoadFileResult:(id:string) => `${disciplineMain}/result/file/${id}`,
|
||||||
|
deleteFileResult:(id:string,docId:string) => `${disciplineMain}/result/file/${id}/${docId}`,
|
||||||
|
|
||||||
appealMainList: (status: string, type: string, year: number, page: number, pageSize: number, keyword: string) => `${appeal}/admin?status=${status}&type=${type}&year=${year}&page=${page}&pageSize=${pageSize}&keyword=${keyword}`,
|
appealMainList: (status: string, type: string, year: number, page: number, pageSize: number, keyword: string) => `${appeal}/admin?status=${status}&type=${type}&year=${year}&page=${page}&pageSize=${pageSize}&keyword=${keyword}`,
|
||||||
appealAdd: () => `${appeal}`,
|
appealAdd: () => `${appeal}`,
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,13 @@ import type {
|
||||||
DataListRow,
|
DataListRow,
|
||||||
PersonType,
|
PersonType,
|
||||||
} from "@/modules/11_discipline/interface/request/result";
|
} from "@/modules/11_discipline/interface/request/result";
|
||||||
|
import { useRouter, useRoute } from "vue-router";
|
||||||
import DialogHeader from "@/components/DialogHeader.vue";
|
import DialogHeader from "@/components/DialogHeader.vue";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
const route = useRoute();
|
||||||
|
|
||||||
|
const idPath = ref<string>(route.params.id as string);
|
||||||
const type = ref<string>("");
|
const type = ref<string>("");
|
||||||
const rows = ref<DataListRow[]>([]);
|
const rows = ref<DataListRow[]>([]);
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
@ -79,23 +81,45 @@ const saveOrder = () => {
|
||||||
//ส่งไปออกคำสั่ง
|
//ส่งไปออกคำสั่ง
|
||||||
const Ordersave = async () => {
|
const Ordersave = async () => {
|
||||||
const id = selected.value.map((r) => r.id);
|
const id = selected.value.map((r) => r.id);
|
||||||
const body = {
|
const persons = selected.value.map((r) => r.id);
|
||||||
id,
|
|
||||||
};
|
if (props.title == "ส่งไปออกคำสั่งลงโทษทางวินัย") {
|
||||||
showLoader();
|
const body = {
|
||||||
await http
|
id,
|
||||||
.put(config.API.reportresult(type.value as string), body)
|
};
|
||||||
.then((res: any) => {
|
showLoader();
|
||||||
success($q, `${props.title}สำเร็จ`);
|
await http
|
||||||
props.closeModal?.();
|
.put(config.API.reportresult(type.value as string), body)
|
||||||
})
|
.then((res: any) => {
|
||||||
.catch((e) => {
|
success($q, `${props.title}สำเร็จ`);
|
||||||
messageError($q, e);
|
props.closeModal?.();
|
||||||
})
|
})
|
||||||
.finally(async () => {
|
.catch((e) => {
|
||||||
props.getData?.();
|
messageError($q, e);
|
||||||
hideLoader();
|
})
|
||||||
});
|
.finally(async () => {
|
||||||
|
props.getData?.();
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
} else if (props.title == "ส่งไปออกคำสั่งงดโทษ/เพิ่มโทษ") {
|
||||||
|
const body = {
|
||||||
|
persons,
|
||||||
|
};
|
||||||
|
showLoader();
|
||||||
|
await http
|
||||||
|
.put(config.API.discardResult(idPath.value, type.value as string), body)
|
||||||
|
.then((res: any) => {
|
||||||
|
success($q, `${props.title}สำเร็จ`);
|
||||||
|
props.closeModal?.();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(async () => {
|
||||||
|
props.getData?.();
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const emit = defineEmits([
|
const emit = defineEmits([
|
||||||
|
|
@ -151,9 +175,15 @@ watchEffect(() => {
|
||||||
selected.value = [];
|
selected.value = [];
|
||||||
type.value = "";
|
type.value = "";
|
||||||
// console.log(props.data.status)
|
// console.log(props.data.status)
|
||||||
rows.value = props.data.persons.filter(
|
if (props.title == "ส่งไปออกคำสั่งลงโทษทางวินัย") {
|
||||||
(item: any) => item.status !== "REPORT"
|
rows.value = props.data.persons.filter(
|
||||||
);
|
(item: any) => item.status !== "REPORT"
|
||||||
|
);
|
||||||
|
} else if (props.title == "ส่งไปออกคำสั่งงดโทษ/เพิ่มโทษ") {
|
||||||
|
rows.value = props.data.persons.filter(
|
||||||
|
(item: any) => item.status == "REPORT" && item.statusDiscard == 'NEW'
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ const investigateDis = useInvestigateDisStore();
|
||||||
const isReadonly = ref<boolean>(false); // อ่านได้อย่างเดียว
|
const isReadonly = ref<boolean>(false); // อ่านได้อย่างเดียว
|
||||||
const dataStore = useDisciplineResultStore();
|
const dataStore = useDisciplineResultStore();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const { date2Thai, hideLoader, dialogConfirm, success, messageError } = mixin;
|
const { date2Thai, hideLoader, dialogConfirm, success, messageError,showLoader,dialogRemove } = mixin;
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
|
|
@ -69,7 +69,7 @@ const formData = reactive<FormData>({
|
||||||
titleType: "",
|
titleType: "",
|
||||||
oc: "",
|
oc: "",
|
||||||
file: null,
|
file: null,
|
||||||
disciplineComplaint_Appeal_Docs: [],
|
disciplineDisciplinary_DocResults: [],
|
||||||
year: new Date().getFullYear(),
|
year: new Date().getFullYear(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -171,7 +171,8 @@ watch(
|
||||||
formData.oc = props.data.resultOc;
|
formData.oc = props.data.resultOc;
|
||||||
formData.disciplineType = props.data.resultDisciplineType;
|
formData.disciplineType = props.data.resultDisciplineType;
|
||||||
formData.titleType = props.data.resultTitleType;
|
formData.titleType = props.data.resultTitleType;
|
||||||
formData.year = props.data.resultYear;
|
formData.disciplineDisciplinary_DocResults = props.data.disciplineDisciplinary_DocResults;
|
||||||
|
formData.year = props.data.resultYear ?? 0;
|
||||||
mainStore.rowsAdd = props.data.persons;
|
mainStore.rowsAdd = props.data.persons;
|
||||||
await fetchDatadetail();
|
await fetchDatadetail();
|
||||||
await fetchOrganization();
|
await fetchOrganization();
|
||||||
|
|
@ -203,24 +204,24 @@ function changeFormData() {
|
||||||
|
|
||||||
function uploadFile() {
|
function uploadFile() {
|
||||||
/** uploadFile */
|
/** uploadFile */
|
||||||
// const Data = new FormData();
|
const Data = new FormData();
|
||||||
// Data.append("file", formData.file);
|
Data.append("file", formData.file);
|
||||||
// showLoader();
|
showLoader();
|
||||||
// http
|
http
|
||||||
// .put(config.API.appealUpLoadFile(formData.id), Data)
|
.put(config.API.upLoadFileResult(id.value), Data)
|
||||||
// .then((res) => {
|
.then((res) => {
|
||||||
// console.log(res);
|
console.log(res);
|
||||||
// success($q, "อัปโหลดไฟล์สำเร็จ");
|
success($q, "อัปโหลดไฟล์สำเร็จ");
|
||||||
// props.getData();
|
props.fetchData();
|
||||||
// // router.push(`/discipline/complaints`);
|
// router.push(`/discipline/complaints`);
|
||||||
// })
|
})
|
||||||
// .catch((e) => {
|
.catch((e) => {
|
||||||
// messageError($q, e);
|
messageError($q, e);
|
||||||
// })
|
})
|
||||||
// .finally(async () => {
|
.finally(async () => {
|
||||||
// hideLoader();
|
hideLoader();
|
||||||
// formData.file = null;
|
formData.file = null;
|
||||||
// });
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function downloadFile(link: string) {
|
function downloadFile(link: string) {
|
||||||
|
|
@ -228,26 +229,26 @@ function downloadFile(link: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteFile(id: string) {
|
function deleteFile(id: string) {
|
||||||
// dialogRemove($q, () => confirmDelete(id));
|
dialogRemove($q, () => confirmDelete(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ยืนยัน ลบ ไฟล์
|
* ยืนยัน ลบ ไฟล์
|
||||||
* @param id id file
|
* @param id id file
|
||||||
*/
|
*/
|
||||||
function confirmDelete(id: string) {
|
function confirmDelete(docid: string) {
|
||||||
// showLoader();
|
showLoader();
|
||||||
// http
|
http
|
||||||
// .delete(config.API.appealDeleteFile(formData.id, id))
|
.delete(config.API.deleteFileResult(id.value, docid))
|
||||||
// .then((res) => {
|
.then((res) => {
|
||||||
// success($q, `ลบไฟล์สำเร็จ`);
|
success($q, `ลบไฟล์สำเร็จ`);
|
||||||
// })
|
})
|
||||||
// .catch((e) => {
|
.catch((e) => {
|
||||||
// messageError($q, e);
|
messageError($q, e);
|
||||||
// })
|
})
|
||||||
// .finally(() => {
|
.finally(() => {
|
||||||
// props.getData();
|
props.fetchData();
|
||||||
// });
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {});
|
onMounted(async () => {});
|
||||||
|
|
@ -573,7 +574,7 @@ onMounted(async () => {});
|
||||||
|
|
||||||
<div class="col-1 self-center text-center">
|
<div class="col-1 self-center text-center">
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="formData.file && isReadonly"
|
v-if="formData.file"
|
||||||
size="14px"
|
size="14px"
|
||||||
flat
|
flat
|
||||||
round
|
round
|
||||||
|
|
@ -586,11 +587,11 @@ onMounted(async () => {});
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="formData.disciplineComplaint_Appeal_Docs.length > 0"
|
v-if="formData.disciplineDisciplinary_DocResults.length > 0"
|
||||||
class="col-xs-12 q-pa-sm row"
|
class="col-xs-12 q-pa-sm row"
|
||||||
>
|
>
|
||||||
<q-list
|
<q-list
|
||||||
v-for="data in formData.disciplineComplaint_Appeal_Docs"
|
v-for="data in formData.disciplineDisciplinary_DocResults"
|
||||||
:key="data.id"
|
:key="data.id"
|
||||||
class="full-width"
|
class="full-width"
|
||||||
bordered
|
bordered
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ interface FormData {
|
||||||
titleType: string;
|
titleType: string;
|
||||||
oc: string;
|
oc: string;
|
||||||
file: any
|
file: any
|
||||||
disciplineComplaint_Appeal_Docs: any
|
disciplineDisciplinary_DocResults: any
|
||||||
year: number | null;
|
year: number | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue