From d2bf35a01b5c170b27da9cb1db55ba29039f0d7b Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Wed, 30 Aug 2023 09:50:52 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B8=95=E0=B8=B1?= =?UTF-8?q?=E0=B8=A7=E0=B9=81=E0=B8=9B=E0=B8=A3=20formAssign?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/probation/FormAssign.vue | 163 ++++++++---------- 1 file changed, 69 insertions(+), 94 deletions(-) diff --git a/src/modules/05_placement/components/probation/FormAssign.vue b/src/modules/05_placement/components/probation/FormAssign.vue index de45c7617..29e577f06 100644 --- a/src/modules/05_placement/components/probation/FormAssign.vue +++ b/src/modules/05_placement/components/probation/FormAssign.vue @@ -4,25 +4,74 @@ import { ref, computed, watch, onMounted } from "vue"; import { useCounterMixin } from "@/stores/mixin"; import { useQuasar } from "quasar"; import http from "@/plugins/http"; - import config from "@/app.config"; + const $q = useQuasar(); -const val1 = ref([ - { - id: 1, - text: "1.รัฐธรรมนูญ", - checked: false, - }, -]); const status = ref(true); +const router = useRouter(); +const route = useRoute(); +const mixin = useCounterMixin(); +const { + date2Thai, + dateToISO, + success, + messageError, + showLoader, + hideLoader, + dialogConfirm, + dialogMessageNotify, +} = mixin; +const personalId = route.params.personalId as string; +const assignId = ref(route.params.form as string); +const routeName = router.currentRoute.value.name; + +const myForm = ref(null); +const fullname = ref(); +const date_start = ref(); +const date_finish = ref(); +const other_desc = ref({}); +const other4_desc = ref(); +const Other5 = ref(); +const other5_no1_desc = ref({}); +const group = ref(null); +const group2 = ref(null); +const group3 = ref(null); +const main = ref(); +const main2 = ref(); +const main3 = ref(); +const main4 = ref(); +const main5 = ref(); +const Other = ref(""); +const commander = ref(""); +const chairman = ref(""); +const date1 = ref(); +const date2 = ref(); +const date3 = ref(); +const date4 = ref(); +const OPmain = ref< + Array<{ + id: number; + title: string; + description: string; + level: number; + }> +>([]); +const OPgroup = ref< + Array<{ + id: number; + title: string; + description: string; + level: number; + }> +>([]); const dataEdit = async (id: string) => { showLoader(); const data = putDataEdit(id); await http .put(config.API.saveEditAssign(id), data) - .then((res) => {}) - .catch((e) => {}) + .then(() => {}) + .catch(() => {}) .finally(async () => { status.value = false; getAssign(); @@ -38,20 +87,7 @@ const edit = () => { const cancel = () => { status.value = false; }; -const router = useRouter(); -const mixin = useCounterMixin(); -const { - date2Thai, - notifyError, - dateToISO, - success, - messageError, - showLoader, - hideLoader, - dialogConfirm, - dialogMessageNotify, - modalWarning, -} = mixin; + const filterData = (options: any[], excludedGroups: any[]) => { return options.filter( (item) => !excludedGroups.some((group) => group && group.id === item.id) @@ -67,64 +103,7 @@ const filterMain = (options: any[], excludedGroups: any[]) => { (item) => !excludedGroups.some((group) => group && group.id === item.id) ); }; -const route = useRoute(); -const checkValidate = ref(false); -const myForm = ref(null); -const fullnameFoot = ref(""); -const positionFoot = ref(""); -const caretakerFoot = ref(""); -const caretakerFoot2 = ref(""); -const id = ref(); -const personalId = route.params.personalId as string; -const fullname = ref(); -const knowledge_skill_map_no = ref([]); -const round_no = ref(); -const date_start = ref(); -const date_finish = ref(); -const behavior_desc = ref(); -const other_desc = ref({}); -const other4_desc = ref(); -const Other5 = ref(); -const other5_no1_desc = ref({}); -const other5_no2_desc = ref({}); -const experimenter_dated = ref(); -const createdAt = ref(); -const updatedAt = ref(); -const group = ref(null); -const group2 = ref(null); -const group3 = ref(null); -const main = ref(); -const main2 = ref(); -const main3 = ref(); -const main4 = ref(); -const main5 = ref(); -const assignId = ref(route.params.form as string); -const Other = ref(""); -const commander = ref(""); -const chairman = ref(""); -const date1 = ref(); -const date2 = ref(); -const date3 = ref(); -const date4 = ref(); - -const OPmain = ref< - Array<{ - id: number; - title: string; - description: string; - level: number; - }> ->([]); - -const OPgroup = ref< - Array<{ - id: number; - title: string; - description: string; - level: number; - }> ->([]); const clearDateExam = () => { date_start.value = undefined; }; @@ -134,8 +113,7 @@ const clearDateExam2 = () => { const isDatePicker2Readonly = computed(() => { return date_start.value === undefined; }); -const routeName = router.currentRoute.value.name; -const name = ref(""); + const position = ref(""); const monthSelect = ref(); @@ -226,9 +204,6 @@ const addKnowledge = () => { const knowledgeArray = computed(() => { return Array(knowledgeCount.value).fill(""); }); -const getOpknowledge = (index: number) => { - return OPknowledge; -}; const deleteknowledge = (item: number) => { knowledge.value.splice(item, 1); @@ -236,7 +211,6 @@ const deleteknowledge = (item: number) => { knowledgeCount.value--; } }; -const checked = ref(false); const productivityCount = ref(1); const output_desc = ref(Array(productivityCount.value).fill("")); const indicator_desc = ref(Array(productivityCount.value).fill("")); @@ -350,7 +324,6 @@ const getLaw = async (id: string) => { checkRule.value = res.data.data; }); }; - const postDateTime = async () => { await http .post(config.API.calculateDate(), { @@ -621,10 +594,13 @@ const DataSave = async (id: string) => { const data = putData(id); http .post(config.API.saveFinish(id), data) - .then((res) => { + .then(() => { router.push(`/probation/detail/${id}`); + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); }) - .catch((e) => {}) .finally(() => { hideLoader(); }); @@ -634,7 +610,6 @@ const DataSave = async (id: string) => { }); }; const OtherLaw = ref(""); - const skill = ref(); const skill2 = ref(); const skill3 = ref(); @@ -671,8 +646,6 @@ const OPresourse = ref< level_description: string; }> >([]); -const skillIds = [1, 2, 3, 4]; - const getAssign = async () => { await http.get(config.API.probationsGetAssign(assignId.value)).then((res) => { status.value = false; @@ -766,7 +739,9 @@ onMounted(async () => { await getSkill(personalId); await getKnowledge(personalId); await getAssignNew(personalId); - await getAssign(); + if (assignId.value !== undefined) { + await getAssign(); + } }); watch( () => [monthSelect.value, date_start.value],