From a8f24024bf3de78404460a8283c0a0a53249d141 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Thu, 21 Sep 2023 16:08:12 +0700 Subject: [PATCH] =?UTF-8?q?Refactor=20Code=20=E0=B8=81=E0=B8=B2=E0=B8=A3?= =?UTF-8?q?=E0=B8=97=E0=B8=94=E0=B8=A5=E0=B8=AD=E0=B8=87=E0=B8=9B=E0=B8=8F?= =?UTF-8?q?=E0=B8=B4=E0=B8=9A=E0=B8=B1=E0=B8=95=E0=B8=B4=E0=B8=AB=E0=B8=99?= =?UTF-8?q?=E0=B9=89=E0=B8=B2=E0=B8=97=E0=B8=B5=E0=B9=88=E0=B8=A3=E0=B8=B2?= =?UTF-8?q?=E0=B8=8A=E0=B8=81=E0=B8=B2=E0=B8=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/probation/FormAssign.vue | 201 ++---- .../probation/FormEvaluation/FormEvaluate.vue | 127 ++-- .../FormEvaluation/FormEvaluateAdd.vue | 71 +- .../FormEvaluation/FormEvaluateScore.vue | 675 +++++++++++------- .../FormEvaluation/FormEvaluateScoreAdd.vue | 171 +---- .../probation/FormEvaluation/FormReport.vue | 77 +- .../FormEvaluation/FormSaveResult.vue | 231 ++---- .../FormSaveResultAddCommander.vue | 144 ++-- .../FormEvaluation/FormSaveResultCommader.vue | 205 ++---- .../FormEvaluation/Template1Commader.vue | 1 - .../components/probation/MainProbation.vue | 149 ++-- .../components/probation/ProbationDetail.vue | 88 +-- src/modules/05_placement/store.ts | 25 +- src/modules/05_placement/storeProbation.ts | 2 - 14 files changed, 898 insertions(+), 1269 deletions(-) diff --git a/src/modules/05_placement/components/probation/FormAssign.vue b/src/modules/05_placement/components/probation/FormAssign.vue index 1dc27cb5e..3d0f966c2 100644 --- a/src/modules/05_placement/components/probation/FormAssign.vue +++ b/src/modules/05_placement/components/probation/FormAssign.vue @@ -31,6 +31,7 @@ const date_start = ref(); const date_finish = ref(); const other_desc = ref({}); const other4_desc = ref(); +const monthOp: MonthOption[] = []; const Other5 = ref(); const other5_no1_desc = ref({}); const group = ref(null); @@ -48,22 +49,37 @@ 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 OtherLaw = ref(""); +const skill = ref(); +const skill2 = ref(); +const skill3 = ref(); +const skill4 = ref(); +const knowledgeCount = ref(3); +const knowledge = ref([]); +const position = ref(""); + +const monthSelect = ref(); + +const caretaker1 = ref(""); +const caretaker2 = ref(""); +const productivityCount = ref(1); +const output_desc = ref(Array(productivityCount.value).fill("")); +const indicator_desc = ref(Array(productivityCount.value).fill("")); +const activityCount = ref(2); +const activity_desc = ref(Array(activityCount.value).fill("")); +const goal_desc = ref(Array(activityCount.value).fill("")); +const checkRule = 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 OPcomputer = ref< Array<{ id: number; title: string; level: number; level_description: string; }> >([]); +const OPenglish = ref< Array<{ id: number; title: string; level: number; level_description: string; }> >([]); +const OPinfomation = ref< Array<{ id: number; title: string; level: number; level_description: string; }> >([]); +const OPresourse = ref< Array<{ id: number; title: string; level: number; level_description: string; }> >([]); +const OPknowledge = ref< Array<{ id: number; title: number; description: string; level: string; }> >([]); +const OPcaretaker = ref< Array<{ id: string; prefix: string; firstName: string; lastName: string; name: string; citizenId: number; isDirector: boolean; }>[] >([]); +const OPcommander = ref< Array<{ id: string; prefix: string; firstName: string; lastName: string; name: string; citizenId: number; isDirector: boolean; }>[] >([]); +const OPchairman = ref[] >([]); const dataEdit = async (id: string) => { await myForm.value.validate().then((result: boolean) => { @@ -120,57 +136,13 @@ const isDatePicker2Readonly = computed(() => { return date_start.value === undefined; }); -const position = ref(""); - -const monthSelect = ref(); - -const caretaker1 = ref(""); -const caretaker2 = ref(""); -const OPcaretaker = ref< - Array<{ - id: string; - prefix: string; - firstName: string; - lastName: string; - name: string; - citizenId: number; - isDirector: boolean; - }>[] ->([]); - -const OPcommander = ref< - Array<{ - id: string; - prefix: string; - firstName: string; - lastName: string; - name: string; - citizenId: number; - isDirector: boolean; - }>[] ->([]); -const OPchairman = ref< - Array<{ - id: string; - prefix: string; - firstName: string; - lastName: string; - name: string; - citizenId: number; - isDirector: boolean; - }>[] ->([]); interface MonthOption { value: number; label: string; } -const monthOp: MonthOption[] = []; //-----------------(3.1)-----------// -const activityCount = ref(2); -const activityDataArray = ref([]); -const activity_desc = ref(Array(activityCount.value).fill("")); -const goal_desc = ref(Array(activityCount.value).fill("")); + const addActivity = () => { activityCount.value++; }; @@ -184,23 +156,9 @@ const deleteactivity = (item: number) => { const activityArray = computed(() => { return Array(activityCount.value).fill(""); }); -const resetActivity = () => { - activityCount.value = 2; - activity_desc.value = Array(activityCount.value).fill(""); - goal_desc.value = Array(activityCount.value).fill(""); -}; + //-----------------(3.2)-----------// -const knowledgeCount = ref(3); -const knowledge = ref([]); -const OPknowledge = ref< - Array<{ - id: number; - title: number; - description: string; - level: string; - }> ->([]); const addKnowledge = () => { if (knowledgeCount.value < 6) { knowledgeCount.value++; @@ -217,9 +175,7 @@ const deleteknowledge = (item: number) => { knowledgeCount.value--; } }; -const productivityCount = ref(1); -const output_desc = ref(Array(productivityCount.value).fill("")); -const indicator_desc = ref(Array(productivityCount.value).fill("")); + const deleteProductivitys = (item: number) => { output_desc.value.splice(item, 1); indicator_desc.value.splice(item, 1); @@ -241,8 +197,6 @@ interface CheckboxItem { checked: number; } -const checkRule = ref([]); - const getUser = async () => { await http.get(config.API.userPlacement(personalId)).then((res: any) => { const data = res.data.result; @@ -455,8 +409,6 @@ const putDataEdit = (id: string) => { date_finish.value instanceof Date ? dateToISO(date_finish.value) : dateToISO(new Date(date_finish.value)), - // caretaker_1: caretaker1.value, - // caretaker_2: caretaker2.value, assign_knowledges: know_ledge, assign_jobs: assign_job.filter((item) => item !== null), other_desc: OtherLaw.value, @@ -466,15 +418,9 @@ const putDataEdit = (id: string) => { other4_desc: Other.value, other5_no1_desc: Other5.value, assign_outputs: Productivity_assign.filter((item) => item !== null), - // commander: commander.value, assign_director: assign_director, experimenter_dated: date1.value instanceof Date ? dateToISO(date1.value) : new Date(), - // date_2: date2.value instanceof Date ? dateToISO(date2.value) : new Date(), - // date_3: date3.value instanceof Date ? dateToISO(date3.value) : new Date(), - // date_4: date4.value instanceof Date ? dateToISO(date4.value) : new Date(), - // caretaker_foot: caretakerFoot.value, - // caretaker_foot2: caretakerFoot2.value, assign_law: checkRule.value .filter((item) => item.checked === 1) .map((item) => ({ @@ -632,49 +578,11 @@ const DataSave = async (id: string) => { hideLoader(); }); }; -const OtherLaw = ref(""); -const skill = ref(); -const skill2 = ref(); -const skill3 = ref(); -const skill4 = ref(); -const OPcomputer = ref< - Array<{ - id: number; - title: string; - level: number; - level_description: string; - }> ->([]); -const OPenglish = ref< - Array<{ - id: number; - title: string; - level: number; - level_description: string; - }> ->([]); -const OPinfomation = ref< - Array<{ - id: number; - title: string; - level: number; - level_description: string; - }> ->([]); -const OPresourse = ref< - Array<{ - id: number; - title: string; - level: number; - level_description: string; - }> ->([]); + const getAssign = async () => { await http.get(config.API.probationsGetAssign(assignId.value)).then((res) => { status.value = false; const data = res.data.data; - console.log(data); - fullname.value = data.profile.name; position.value = data.profile.Position; date_start.value = data.assign.date_start; @@ -764,6 +672,19 @@ const clickdownloadFile = async (type: string) => { }); }; +watch( + () => [monthSelect.value, date_start.value], + () => { + if (monthSelect.value !== undefined && date_start.value !== undefined) { + postDateTime(); + } + } +); +watch(knowledge.value, () => { + knowledge.value.forEach((item) => { + OPknowledge.value = OPknowledge.value.filter((e) => e.id != item.id); + }); +}); onMounted(async () => { await getUser(); await getLaw(personalId); @@ -776,25 +697,6 @@ onMounted(async () => { await getAssign(); } }); -watch( - () => [monthSelect.value, date_start.value], - () => { - if (monthSelect.value !== undefined && date_start.value !== undefined) { - postDateTime(); - } - } -); - -watch(knowledge.value, () => { - knowledge.value.forEach((item) => { - OPknowledge.value = OPknowledge.value.filter((e) => e.id != item.id); - }); -}); -const countCheckedItems = checkRule.value.filter( - (item) => item.checked === 1 -).length; - -console.log(countCheckedItems);