Refactoring code module 11_discipline
This commit is contained in:
parent
202fbf27b6
commit
9653ae78cb
58 changed files with 1021 additions and 1305 deletions
|
|
@ -1,30 +1,25 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive, watch } from "vue";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useDisciplineResultStore } from "@/modules/11_discipline/store/ResultStore";
|
||||
import { useDisciplineMainStore } from "@/modules/11_discipline/store/main";
|
||||
import DialogHistory from "@/modules/11_discipline/components/4_Result/DialogHistory.vue";
|
||||
import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue";
|
||||
|
||||
import type {
|
||||
FormData,
|
||||
FormRef,
|
||||
DataOption,
|
||||
DataOptionRes,
|
||||
FileArray,
|
||||
} from "@/modules/11_discipline/interface/request/result";
|
||||
|
||||
const modalPersonal = ref<boolean>(false);
|
||||
const personId = ref<string>("");
|
||||
import DialogHistory from "@/modules/11_discipline/components/4_Result/DialogHistory.vue";
|
||||
import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue";
|
||||
|
||||
const countNum = ref<number>(1);
|
||||
const mainStore = useDisciplineMainStore();
|
||||
const modalPerson = ref<boolean>(false);
|
||||
const isReadonly = ref<boolean>(false); // อ่านได้อย่างเดียว
|
||||
|
||||
const dataStore = useDisciplineResultStore();
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
|
|
@ -36,8 +31,13 @@ const {
|
|||
dialogRemove,
|
||||
downloadRenameFileByLink,
|
||||
} = mixin;
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const modalPersonal = ref<boolean>(false);
|
||||
const personId = ref<string>("");
|
||||
const countNum = ref<number>(1);
|
||||
const isReadonly = ref<boolean>(false); // อ่านได้อย่างเดียว
|
||||
|
||||
const checkRoutePermisson = ref<boolean>(
|
||||
route.name == "disciplineResultDetail"
|
||||
);
|
||||
|
|
@ -151,38 +151,6 @@ function onSubmit() {
|
|||
async function fetchDatadetail() {
|
||||
formData.resultDescription = props.data.resultDescription;
|
||||
}
|
||||
/**
|
||||
* เช็คข้อมูลจาก props
|
||||
* เมื่อมีข้อมูล
|
||||
* เก็บข้อมูลลง formData
|
||||
*/
|
||||
watch(
|
||||
() => props.data,
|
||||
async () => {
|
||||
if (countNum.value === 1) {
|
||||
respondentType.value = props.data.respondentType;
|
||||
formData.oc = props.data.resultOc;
|
||||
formData.disciplineType = props.data.resultDisciplineType;
|
||||
formData.titleType = props.data.resultTitleType;
|
||||
formData.disciplineDisciplinary_DocResults =
|
||||
props.data.disciplineDisciplinary_DocResults;
|
||||
formData.year = props.data.resultYear ?? 0;
|
||||
mainStore.rowsAdd = props.data.persons;
|
||||
await fetchDatadetail();
|
||||
await getActive();
|
||||
|
||||
organizationId.value = props.data.organizationId;
|
||||
organizationName.value = props.data.organization;
|
||||
organization.value = {
|
||||
id: props.data.organizationId,
|
||||
name: props.data.organization,
|
||||
};
|
||||
} else if (countNum.value === 2) {
|
||||
formData.disciplineDisciplinary_DocResults =
|
||||
props.data.disciplineDisciplinary_DocResults;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
function inputEdit(val: boolean) {
|
||||
return {
|
||||
|
|
@ -221,10 +189,7 @@ function uploadFile() {
|
|||
});
|
||||
}
|
||||
|
||||
function downloadFile(link: string) {
|
||||
window.open(link, "_blank");
|
||||
}
|
||||
|
||||
/** ลบไฟล์ */
|
||||
function deleteFile(id: string) {
|
||||
dialogRemove($q, () => confirmDelete(id));
|
||||
}
|
||||
|
|
@ -248,16 +213,19 @@ function confirmDelete(docid: string) {
|
|||
});
|
||||
}
|
||||
|
||||
/** เปิดรายละเอียด */
|
||||
function openDetial(id: string) {
|
||||
personalId.value = id;
|
||||
modalHistory.value = true;
|
||||
}
|
||||
|
||||
/** xbf ikp]tgvupf */
|
||||
function closeDetail() {
|
||||
modalHistory.value = false;
|
||||
personalId.value = "";
|
||||
}
|
||||
|
||||
/** เปิดรายละเอียด */
|
||||
function onclickViewinfo(id: string) {
|
||||
modalPersonal.value = true;
|
||||
personId.value = id;
|
||||
|
|
@ -266,6 +234,39 @@ function onclickViewinfo(id: string) {
|
|||
function updatemodalPersonal(modal: boolean) {
|
||||
modalPersonal.value = modal;
|
||||
}
|
||||
|
||||
/**
|
||||
* เช็คข้อมูลจาก props
|
||||
* เมื่อมีข้อมูล
|
||||
* เก็บข้อมูลลง formData
|
||||
*/
|
||||
watch(
|
||||
() => props.data,
|
||||
async () => {
|
||||
if (countNum.value === 1) {
|
||||
respondentType.value = props.data.respondentType;
|
||||
formData.oc = props.data.resultOc;
|
||||
formData.disciplineType = props.data.resultDisciplineType;
|
||||
formData.titleType = props.data.resultTitleType;
|
||||
formData.disciplineDisciplinary_DocResults =
|
||||
props.data.disciplineDisciplinary_DocResults;
|
||||
formData.year = props.data.resultYear ?? 0;
|
||||
mainStore.rowsAdd = props.data.persons;
|
||||
await fetchDatadetail();
|
||||
await getActive();
|
||||
|
||||
organizationId.value = props.data.organizationId;
|
||||
organizationName.value = props.data.organization;
|
||||
organization.value = {
|
||||
id: props.data.organizationId,
|
||||
name: props.data.organization,
|
||||
};
|
||||
} else if (countNum.value === 2) {
|
||||
formData.disciplineDisciplinary_DocResults =
|
||||
props.data.disciplineDisciplinary_DocResults;
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<template>
|
||||
<div class="row col-12 bg-white">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue