Refactoring code module 11_probation

This commit is contained in:
STW_TTTY\stwtt 2024-09-10 15:47:12 +07:00
parent 779e33d2a5
commit 606064c77c
5 changed files with 42 additions and 40 deletions

View file

@ -383,7 +383,6 @@ function filterOptionFn(val: string, update: Function) {
<q-select
outlined
dense
readonly
:rules="[(val:string) => !!val || `${'กรุณาเลือกโครงการ/หลักสูตรการฝึกอบรม'}`,]"
class="inputgreen"
label="โครงการ/หลักสูตรการฝึกอบรม"

View file

@ -5,16 +5,15 @@ import { useRoute, useRouter } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import Criterion from "@/modules/11_probation/component/Criterion.vue";
import { useProbationStore } from "@/modules/11_probation/store/probation";
import { useQuasar } from "quasar";
import Criterion from "@/modules/11_probation/component/Criterion.vue";
const $q = useQuasar();
const route = useRoute();
const router = useRouter();
const store = useProbationStore();
const dateAutherise = ref<any>(new Date());
const behavior_improve_desc = ref<string>("");
const mixin = useCounterMixin();
const {
showLoader,
@ -26,8 +25,9 @@ const {
dialogMessageNotify,
dateToISO,
} = mixin;
const route = useRoute();
const router = useRouter();
const dateAutherise = ref<Date | null>(new Date());
const behavior_improve_desc = ref<string>("");
const id = ref<string>(route.params.id as string);
const profileId = ref<string>(route.params.profileId as string);
@ -200,7 +200,7 @@ function putformData() {
self_learning: Number(self_learning.value),
training_seminar: Number(training_seminar.value),
other_training: Number(other_training.value),
assessor_dated: dateToISO(dateAutherise.value),
assessor_dated: dateToISO(dateAutherise.value as Date),
};
dialogConfirm($q, async () => await saveformdata(data));
}
@ -434,7 +434,7 @@ onMounted(async () => {
class="full-width datepicker col-3"
:model-value="start_date != null ? date2Thai(start_date) : null"
:label="`${'ระหว่างวันที่'}`"
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่'}`]"
:rules="[(val:string) => !!val || `${'กรุณาเลือกวันที่'}`]"
>
<template v-slot:prepend>
<q-icon
@ -474,7 +474,7 @@ onMounted(async () => {
date_finish != null ? date2Thai(date_finish) : null
"
:label="`${'ถึงวันที่'}`"
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่'}`]"
:rules="[(val:string) => !!val || `${'กรุณาเลือกวันที่'}`]"
>
<template v-slot:prepend>
<q-icon
@ -1372,7 +1372,7 @@ onMounted(async () => {
outlined
class="bg-white"
:rules="[
(val) =>
(val:string) =>
(val && val.length > 0) || 'กรุณากรอกข้อความ',
]"
/>
@ -1445,7 +1445,7 @@ onMounted(async () => {
outlined
class="bg-white"
:rules="[
(val) =>
(val:string) =>
(val && val.length > 0) || 'กรุณากรอกข้อความ',
]"
/>
@ -1728,7 +1728,7 @@ onMounted(async () => {
outlined
class="bg-white"
:rules="[
(val) =>
(val:string) =>
(val && val.length > 0) || 'กรุณากรอกข้อความ',
]"
/>
@ -1799,7 +1799,7 @@ onMounted(async () => {
outlined
class="bg-white"
:rules="[
(val) => (val && val.length > 0) || 'กรุณากรอกข้อความ',
(val:string) => (val && val.length > 0) || 'กรุณากรอกข้อความ',
]"
/>
</q-item-section>
@ -2217,7 +2217,7 @@ onMounted(async () => {
: null
"
:label="`${'ลงวันที่'}`"
:rules="[(val) => !!val || `${'กรุณาเลือกลงวันที่'}`]"
:rules="[(val:string) => !!val || `${'กรุณาเลือกลงวันที่'}`]"
>
<template v-slot:prepend>
<q-icon

View file

@ -5,12 +5,11 @@ import { useRoute, useRouter } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import Criterion from "@/modules/11_probation/component/Criterion.vue";
import { useProbationStore } from "@/modules/11_probation/store/probation";
import { useQuasar } from "quasar";
import Criterion from "@/modules/11_probation/component/Criterion.vue";
const Header = defineAsyncComponent(
() => import("@/modules/11_probation/component/Header.vue")
);
@ -1481,7 +1480,7 @@ onMounted(async () => {
outlined
class="bg-white"
:rules="[
(val) =>
(val:string) =>
(val && val.length > 0) || 'กรุณากรอกข้อความ',
]"
/>
@ -1557,7 +1556,7 @@ onMounted(async () => {
outlined
class="bg-white"
:rules="[
(val) => (val && val.length > 0) || 'กรุณากรอกข้อความ',
(val:string) => (val && val.length > 0) || 'กรุณากรอกข้อความ',
]"
/>
</q-item-section>
@ -1843,7 +1842,7 @@ onMounted(async () => {
outlined
class="bg-white"
:rules="[
(val) => (val && val.length > 0) || 'กรุณากรอกข้อความ',
(val:string) => (val && val.length > 0) || 'กรุณากรอกข้อความ',
]"
/>
</q-item-section>
@ -1909,7 +1908,7 @@ onMounted(async () => {
outlined
class="bg-white"
:rules="[
(val) => (val && val.length > 0) || 'กรุณากรอกข้อความ',
(val:string) => (val && val.length > 0) || 'กรุณากรอกข้อความ',
]"
/>
</q-item-section>
@ -2332,7 +2331,7 @@ onMounted(async () => {
dateAutherise != null ? date2Thai(dateAutherise) : null
"
:label="`${'ลงวันที่'}`"
:rules="[(val) => !!val || `${'กรุณาเลือกลงวันที่'}`]"
:rules="[(val:string) => !!val || `${'กรุณาเลือกลงวันที่'}`]"
>
<template v-slot:prepend>
<q-icon

View file

@ -8,4 +8,14 @@ interface ListMain {
chairman: string;
}
export type { ListMain };
interface ProbationFormType {
prefix: string;
firstName: string;
lastName: string;
position: string;
posExecutiveName: string;
posTypeName: string;
posLevelName: string;
org: string;
}
export type { ListMain,ProbationFormType };

View file

@ -9,19 +9,23 @@ import http from "@/plugins/http";
import config from "@/app.config";
import { useQuasar, type QTableProps } from "quasar";
import type { ListMain } from "@/modules/11_probation/interface/index/main";
import type {
ListMain,
ProbationFormType,
} from "@/modules/11_probation/interface/index/main";
const profileId = ref<string>("");
const rows = ref<ListMain[]>([]);
const $q = useQuasar();
const mixin = useCounterMixin();
const { messageError, findOrgName, showLoader, hideLoader, date2Thai } = mixin;
const mode = ref<any>($q.screen.gt.xs);
const profileId = ref<string>("");
const rows = ref<ListMain[]>([]);
const mode = ref<boolean>($q.screen.gt.xs);
const profileImg = ref<string>("");
const router = useRouter();
const formData = reactive<any>({
const formData = reactive<ProbationFormType>({
prefix: "",
firstName: "",
lastName: "",
@ -289,16 +293,6 @@ onMounted(async () => {
<div class="col-12 row">
<q-card bordered class="col-12 q-pa-md">
<div class="row">
<!-- <q-btn
@click="router.push(`/probation/add/${profileId}`)"
size="12px"
flat
round
color="add"
icon="mdi-plus"
>
<q-tooltip>เพมงานทไดบมอบหมาย</q-tooltip>
</q-btn> -->
<q-space />
<q-input
class="inputgreen"