popup แก้ไข มติอกก

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-09-14 10:47:09 +07:00
parent 8783a54691
commit 155a3b206d
3 changed files with 93 additions and 14 deletions

View file

@ -8,12 +8,13 @@ import { useRouter } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import DialogHeader from "@/components/DialogHeader.vue";
import DialogPopupReason from "@/components/Dialogs/PopupReason.vue";
const route = useRoute();
const router = useRouter();
const $q = useQuasar();
const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError, success } = mixin;
const { showLoader, hideLoader, messageError, success, dialogConfirm } = mixin;
// const type_params = route.params.type;
// const year_params = route.params.year;
const retireld_params = route.params.retirementId;
@ -26,6 +27,8 @@ const retireld = ref<string>(retireld_params.toString());
const profileId = ref<string>("");
const filter = ref<string>("");
const statusUpload = ref<boolean>();
const modalEdit = ref<boolean>(false);
const textReport = ref<string>("");
const columns = ref<any["columns"]>([
{
@ -177,6 +180,7 @@ const fecthlistprofile = async (id: string) => {
round.value = res.data.result.round;
statusReport.value = res.data.result.json;
typeReport.value = res.data.result.typeReport;
textReport.value = res.data.result.detail;
rows.value = res.data.result.profile.map((e: any) => ({
id: e.id,
profileId: e.profileId,
@ -312,6 +316,7 @@ const uploadFile = async (event: any) => {
console.log(selectedFile);
const formdata = new FormData();
formdata.append("file", selectedFile);
await http
.put(config.API.fileRetirement(retireld.value.toString()), formdata)
.then((res) => {
@ -381,6 +386,36 @@ const downloadFile = (response: any, filename: string) => {
// return "color: #26a69a;";
// } else return "";
// };
const saveEdiitReport = (reason: string) => {
const formdata = new FormData();
formdata.append("Detail", reason);
dialogConfirm(
$q,
async () => {
await http
.put(config.API.editDetail(retireld.value), formdata)
.then(() => {
success($q, "แก้ไขข้อความสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
fecthlistprofile(retireld.value);
closemodalEditReport();
});
},
"ยืนยันการแก้ไขข้อมูล",
"ต้องการยืนยันการแก้ไขข้อมูลนี้หรือไม่ ?"
);
};
const openmodalEditReport = () => {
modalEdit.value = true;
};
const closemodalEditReport = () => {
modalEdit.value = false;
};
const paging = ref<boolean>(true);
const pagination = ref({
sortBy: "order",
@ -427,9 +462,22 @@ const paginationLabel = (start: number, end: number, total: number) => {
<!-- <q-btn flat round style="color: #016987;" icon="save" @click="saveList">
<q-tooltip>นทกขอม</q-tooltip>
</q-btn> -->
<q-btn color="primary" flat round icon="download">
<q-btn color="primary" flat round icon="mdi-dots-vertical">
<q-menu>
<q-list style="min-width: 100px">
<q-item
clickable
v-close-popup
type="a"
@click="openmodalEditReport()"
target="_blank"
>
<q-item-section avatar
><q-icon color="primary" name="mdi-pencil"
/></q-item-section>
<q-item-section>แกไข มต ... </q-item-section>
</q-item>
<q-separator />
<q-item
clickable
v-close-popup
@ -743,6 +791,15 @@ const paginationLabel = (start: number, end: number, total: number) => {
</q-card-actions>
</q-card>
</q-dialog>
<DialogPopupReason
:modal="modalEdit"
title="แก้ไขมติ อ.ก.ก."
label="มติ อ.ก.ก."
:click-close="closemodalEditReport"
:savaForm="saveEdiitReport"
:textReport="textReport"
/>
</template>
<style lang="scss" scope>