แก้ตัวแปร formAssign

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-08-30 09:50:52 +07:00
parent 9dc56a34e8
commit d2bf35a01b

View file

@ -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<boolean>(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<string>(route.params.form as string);
const routeName = router.currentRoute.value.name;
const myForm = ref<any>(null);
const fullname = ref<string>();
const date_start = ref<Date>();
const date_finish = ref<any>();
const other_desc = ref<object>({});
const other4_desc = ref<string>();
const Other5 = ref<string>();
const other5_no1_desc = ref<object>({});
const group = ref<any | null>(null);
const group2 = ref<any | null>(null);
const group3 = ref<any | null>(null);
const main = ref<any>();
const main2 = ref<any>();
const main3 = ref<any>();
const main4 = ref<any>();
const main5 = ref<any>();
const Other = ref<string>("");
const commander = ref<any>("");
const chairman = ref<any>("");
const date1 = ref<any>();
const date2 = ref<any>();
const date3 = ref<any>();
const date4 = ref<any>();
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<boolean>(false);
const myForm = ref<any>(null);
const fullnameFoot = ref<string>("");
const positionFoot = ref<string>("");
const caretakerFoot = ref<string>("");
const caretakerFoot2 = ref<string>("");
const id = ref<number>();
const personalId = route.params.personalId as string;
const fullname = ref<string>();
const knowledge_skill_map_no = ref<string[]>([]);
const round_no = ref<number>();
const date_start = ref<Date>();
const date_finish = ref<any>();
const behavior_desc = ref<string>();
const other_desc = ref<object>({});
const other4_desc = ref<string>();
const Other5 = ref<string>();
const other5_no1_desc = ref<object>({});
const other5_no2_desc = ref<object>({});
const experimenter_dated = ref<Date>();
const createdAt = ref<Date>();
const updatedAt = ref<Date>();
const group = ref<any | null>(null);
const group2 = ref<any | null>(null);
const group3 = ref<any | null>(null);
const main = ref<any>();
const main2 = ref<any>();
const main3 = ref<any>();
const main4 = ref<any>();
const main5 = ref<any>();
const assignId = ref<string>(route.params.form as string);
const Other = ref<string>("");
const commander = ref<any>("");
const chairman = ref<any>("");
const date1 = ref<any>();
const date2 = ref<any>();
const date3 = ref<any>();
const date4 = ref<any>();
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<string>("");
const position = ref<string>("");
const monthSelect = ref<any>();
@ -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<boolean>(false);
const productivityCount = ref<number>(1);
const output_desc = ref<string[]>(Array(productivityCount.value).fill(""));
const indicator_desc = ref<string[]>(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<string>("");
const skill = ref<any>();
const skill2 = ref<any>();
const skill3 = ref<any>();
@ -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],