API สรุปผล รอ pathName
This commit is contained in:
parent
5bb31541c9
commit
84a45e3f59
4 changed files with 94 additions and 61 deletions
|
|
@ -16,11 +16,13 @@ import type {
|
|||
DataListRow,
|
||||
PersonType,
|
||||
} from "@/modules/11_discipline/interface/request/result";
|
||||
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
const route = useRoute();
|
||||
|
||||
const idPath = ref<string>(route.params.id as string);
|
||||
const type = ref<string>("");
|
||||
const rows = ref<DataListRow[]>([]);
|
||||
const $q = useQuasar();
|
||||
|
|
@ -79,23 +81,45 @@ const saveOrder = () => {
|
|||
//ส่งไปออกคำสั่ง
|
||||
const Ordersave = async () => {
|
||||
const id = selected.value.map((r) => r.id);
|
||||
const body = {
|
||||
id,
|
||||
};
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.reportresult(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 persons = selected.value.map((r) => r.id);
|
||||
|
||||
if (props.title == "ส่งไปออกคำสั่งลงโทษทางวินัย") {
|
||||
const body = {
|
||||
id,
|
||||
};
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.reportresult(type.value as string), body)
|
||||
.then((res: any) => {
|
||||
success($q, `${props.title}สำเร็จ`);
|
||||
props.closeModal?.();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.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([
|
||||
|
|
@ -151,9 +175,15 @@ watchEffect(() => {
|
|||
selected.value = [];
|
||||
type.value = "";
|
||||
// console.log(props.data.status)
|
||||
rows.value = props.data.persons.filter(
|
||||
(item: any) => item.status !== "REPORT"
|
||||
);
|
||||
if (props.title == "ส่งไปออกคำสั่งลงโทษทางวินัย") {
|
||||
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'
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue