Merge branch 'develop' into devTee

This commit is contained in:
setthawutttty 2024-01-09 09:54:21 +07:00
commit d4881eefb8
6 changed files with 1 additions and 598 deletions

View file

@ -198,7 +198,7 @@ function onSubmit(data: dataType[], type: string) {
const dataMapId = data.map((item: dataType) => item.id);
showLoader();
http
.post(`${config.API.suspendReport()}/${type}`, {
.put(`${config.API.suspendReport()}/${type}`, {
id: dataMapId,
})
.then((res) => {

View file

@ -1,78 +0,0 @@
<script setup lang="ts">
import { ref } from "vue";
import { useRouter } from "vue-router";
/** import step */
import step01 from "@/modules/11_discipline/components/9_Order/Step01.vue";
import step02 from "@/modules/11_discipline/components/9_Order/Step02.vue";
import step03 from "@/modules/11_discipline/components/9_Order/Step03.vue";
const router = useRouter();
const step = ref<number>(1);
/** nextStep */
const nextStep = async () => {
localStorage.setItem("currentStep", step.value.toString());
step.value++;
};
/** previousStep */
const previousStep = async () => {
localStorage.setItem("currentStep", step.value.toString());
step.value--;
};
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">
<q-btn
for="buttonBackToMain"
icon="mdi-arrow-left"
unelevated
round
dense
flat
color="primary"
class="q-mr-sm"
@click="router.push(`/discipline-order`)"
/>
ออกคำสงลงโทษทางว
</div>
<div class="col-12 q-mt-sm">
<q-card flat bordered>
<q-stepper
for="myStepper"
v-model="step"
ref="stepper"
animated
active-color="pirmary"
active-icon="none"
header-class="bg-grey-1 "
>
<q-step
:name="1"
prefix="1"
title="รายละเอียดการออกคำสั่ง"
:done="step > 1"
>
<step01 v-if="step === 1" :next="nextStep" :previous="previousStep" />
</q-step>
<q-step :name="2" prefix="2" title="เลือกรายชื่อ" :done="step > 2">
<step02 v-if="step === 2" :next="nextStep" :previous="previousStep" />
</q-step>
<q-step
:name="3"
prefix="3"
title="รายละเอียดคำสั่งและแนบท้าย"
:done="step > 3"
>
<step03 v-if="step === 3" :next="nextStep" :previous="previousStep" />
</q-step>
</q-stepper>
</q-card>
</div>
</template>
<style scoped></style>

View file

@ -1,354 +0,0 @@
<script setup lang="ts">
import { ref, reactive } from "vue";
import { useQuasar } from "quasar";
import type { DataOption } from "@/modules/11_discipline/interface/index/Main";
import type {
FormData,
MyObjectRef,
} from "@/modules/11_discipline/interface/request/order";
// importStroe
import { useCounterMixin } from "@/stores/mixin";
const mixin = useCounterMixin();
const { date2Thai, dialogConfirm } = mixin;
const $q = useQuasar();
/** รับ props มาจากหน้าหลัก */
const props = defineProps({
next: {
type: Function,
default: () => console.log("not function"),
},
previous: {
type: Function,
default: () => console.log("not function"),
},
});
/** Options ต่างๆ */
const orderTypeOptions = ref<DataOption[]>([
{ id: "0", name: "ประเภทคำสั่ง 1" },
{ id: "1", name: "ประเภทคำสั่ง 2" },
{ id: "2", name: "ประเภทคำสั่ง 3" },
]);
const orderByOptions = ref<DataOption[]>([
{ id: "0", name: "คำสั่งโดย 1" },
{ id: "1", name: "คำสั่งโดย 2" },
{ id: "2", name: "คำสั่งโดย 3" },
]);
const listInvestigationOptions = ref<DataOption[]>([
{ id: "0", name: "รายการสอบสวนความผิดทางวินัย 1" },
{ id: "1", name: "รายการสอบสวนความผิดทางวินัย 2" },
{ id: "2", name: "รายการสอบสวนความผิดทางวินัย 3" },
]);
/** ข้อมูล v-model ของฟอร์ม */
const formData = reactive<FormData>({
orderType: "",
orderBy: "",
listInvestigation: "",
authority: "",
orderNumber: "",
dateYear: 0,
date: null,
authorityPosition: "",
subject: "",
mistakeDetail: "",
});
/** ตัวแปร ref สำหรับแสดง validate */
const orderTypeRef = ref<Object | null>(null);
const orderByRef = ref<Object | null>(null);
const listInvestigationRef = ref<Object | null>(null);
const authorityRef = ref<Object | null>(null);
const orderNumberRef = ref<Object | null>(null);
const dateYearRef = ref<Object | null>(null);
const dateRef = ref<Object | null>(null);
const authorityPositionRef = ref<Object | null>(null);
const subjectRef = ref<Object | null>(null);
const mistakeDetailRef = ref<Object | null>(null);
/** maping ref เข้าตัวแปรเพื่อเตรียมตรวจสอบ */
const myObjectRef: MyObjectRef = {
orderType: orderTypeRef,
orderBy: orderByRef,
listInvestigation: listInvestigationRef,
authority: authorityRef,
orderNumber: orderNumberRef,
dateYear: dateYearRef,
date: dateRef,
authorityPosition: authorityPositionRef,
subject: subjectRef,
mistakeDetail: mistakeDetailRef,
};
/**ฟังชั่น ไป step ต่อไป */
function next() {
props.next();
}
/** ฟังชั่นตรวจสอบความถูกต้องก่อน บันทึก */
function validateForm() {
const hasError = [];
for (const key in myObjectRef) {
if (Object.prototype.hasOwnProperty.call(myObjectRef, key)) {
const property = myObjectRef[key];
if (property.value && typeof property.value.validate === "function") {
const isValid = property.value.validate();
hasError.push(isValid);
}
}
}
if (hasError.every((result) => result === true)) {
onSubmit();
} else {
console.log("ไม่ผ่าน ");
}
}
/** ฟังชั่น บันทึก */
function onSubmit() {
console.log(formData);
dialogConfirm(
$q,
async () => {
next();
},
"ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่"
);
}
</script>
<template>
<form @submit.prevent.stop="validateForm">
<div class="row col-12 q-pa-sm">
<div class="row col-xs-12 col-sm-12 q-col-gutter-x-sm">
<div class="col-xs-12 col-sm-6">
ประเภทคำส
<q-select
for="selectOrderType"
ref="orderTypeRef"
dense
outlined
v-model="formData.orderType"
:options="orderTypeOptions"
option-value="id"
option-label="name"
emit-value
map-options
:rules="[(val) => !!val || `${'กรุณาเลือกประเภทคำสั่ง'}`]"
lazy-rules
use-input
/>
</div>
<div class="col-xs-12 col-sm-6">
คำสงโดย
<q-select
for="selectOrderBy"
ref="orderByRef"
dense
outlined
v-model="formData.orderBy"
:options="orderByOptions"
option-value="id"
option-label="name"
emit-value
map-options
:rules="[(val) => !!val || `${'กรุณาเลือกคำสั่งโดย'}`]"
lazy-rules
use-input
/>
</div>
<div class="col-xs-12 col-sm-6">
เลอกรายการสอบสวนความผดทางว
<q-select
for="selectListInvestigation"
ref="listInvestigationRef"
dense
outlined
v-model="formData.listInvestigation"
:options="listInvestigationOptions"
option-value="id"
option-label="name"
emit-value
map-options
:rules="[
(val) => !!val || `${'กรุณาเลือกรายการสอบสวนความผิดทางวินัย'}`,
]"
lazy-rules
use-input
/>
</div>
<div class="col-xs-12 col-sm-6">
อำนาจลงนาม
<q-input
for="inputAuthority"
ref="authorityRef"
dense
outlined
v-model="formData.authority"
placeholder="กรอกผู้มีอำนาจลงนาม"
:rules="[(val) => !!val || `${'กรุณากรอกผู้มีอำนาจลงนาม'}`]"
lazy-rules
/>
</div>
<div class="row col-xs-7 col-sm-3">
<div class="col-6">
คำสงท
<q-input
for="inputOrderNumber"
ref="orderNumberRef"
outlined
dense
v-model="formData.orderNumber"
hide-bottom-space
:rules="[(val) => !!val || `${'กรุณากรอรคำสั่งที่'}`]"
lazy-rules
>
</q-input>
</div>
<label class="col-1 flex justify-center items-center text-bold"
>/</label
>
<div class="col-5">
พศ
<datepicker
v-model="formData.dateYear"
:locale="'th'"
autoApply
year-picker
:enableTimePicker="false"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
for="inputDateYear"
ref="dateYearRef"
:model-value="
formData.dateYear ? formData.dateYear + 543 : null
"
:rules="[(val) => !!val || `${'กรุณากรอก พ.ศ.'}`]"
dense
outlined
>
</q-input>
</template>
</datepicker>
</div>
</div>
<div class="col-xs-5 col-sm-3">
นทผลคำส
<datepicker
menu-class-name="modalfix"
v-model="formData.date"
:locale="'th'"
autoApply
borderless
:enableTimePicker="false"
week-start="0"
>
<template #year="{ year }">
{{ year + 543 }}
</template>
<template #year-overlay-value="{ value }">
{{ parseInt(value + 543) }}
</template>
<template #trigger>
<q-input
for="inputDate"
ref="dateRef"
outlined
dense
class="full-width datepicker"
:model-value="
formData.date != null ? date2Thai(formData.date) : null
"
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่มีผลคำสั่ง'}`]"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
style="color: var(--q-primary)"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
<div class="col-xs-12 col-sm-6">
ตำแหนงผอำนาจลงนาม
<q-input
for="inputAuthorityPosition"
ref="authorityPositionRef"
dense
outlined
v-model="formData.authorityPosition"
placeholder="กรอกตำแหน่งผู้มีอำนาจลงนาม"
:rules="[(val) => !!val || `${'กรุณากรอกตำแหน่งผู้มีอำนาจลงนาม'}`]"
lazy-rules
/>
</div>
<div class="col-xs-12 col-sm-6">
คำสงเรอง
<q-input
for="inputSubject"
ref="subjectRef"
dense
outlined
v-model="formData.subject"
placeholder="กรอกคำสั่งเรื่อง"
:rules="[(val) => !!val || `${'กรุณากรอกคำสั่งเรื่อง'}`]"
lazy-rules
/>
</div>
<div class="col-xs-12 col-sm-12">
รายละเอยดการกระทำความผ
<q-input
for="inputMistakeDetail"
ref="mistakeDetailRef"
dense
outlined
v-model="formData.mistakeDetail"
placeholder="กรอกรายละเอียดการกระทำความผิด"
:rules="[(val) => !!val || `${'กรุณากรอกคำสั่งเรื่อง'}`]"
lazy-rules
type="textarea"
rows="5"
/>
</div>
</div>
</div>
<q-separator />
<div class="row col-12 q-pa-sm">
<q-space />
<q-btn
for="ButtonOnSubmit"
id="formSubmit"
color="secondary"
label="บันทึก"
type="submit"
><q-tooltip>บทกขอม</q-tooltip></q-btn
>
</div>
</form>
</template>
<style scoped></style>

View file

@ -1,128 +0,0 @@
<script setup lang="ts">
import { ref } from "vue";
/** รับ props มาจากหน้าหลัก */
const props = defineProps({
next: {
type: Function,
default: () => console.log("not function"),
},
previous: {
type: Function,
default: () => console.log("not function"),
},
});
const name = ref<string>("");
const lastname = ref<string>("");
const age = ref<string>("");
/** ตัวแปร ref สำหรับแสดง validate */
const nameRef = ref<any>(null);
const ageRef = ref<any>(null);
const lastnameRef = ref<any>(null);
/** maping ref เข้าตัวแปรเพื่อเตรียมตรวจสอบ */
const myObject: MyObject = {
name: nameRef,
lastname: lastnameRef,
age: ageRef,
};
/** กำหนด type */
interface MyObject {
name: any;
lastname: any;
age: any;
[key: string]: any;
}
/**ฟังชั่น ไป step ต่อไป */
function next() {
props.next();
}
/**ฟังชั่น ไป step ก่อนหน้า */
function previous() {
props.previous();
}
/** ฟังชั่นตรวจสอบความถูกต้องก่อน บันทึก */
function onSubmit() {
const hasError = [];
for (const key in myObject) {
if (Object.prototype.hasOwnProperty.call(myObject, key)) {
const property = myObject[key];
if (property.value && typeof property.value.validate === "function") {
const isValid = property.value.validate();
hasError.push(isValid);
}
}
}
if (hasError.every((result) => result === true)) {
console.log("ผ่าน สำเร็จ!");
} else {
console.log("ไม่ผ่าน ");
}
}
</script>
<template>
<div><h1>step02</h1></div>
<form @submit.prevent.stop="onSubmit" class="q-gutter-md">
<q-input
ref="nameRef"
filled
v-model="name"
label="Your name *"
hint="Name and surname"
lazy-rules
:rules="[(val) => !!val || `${'Name and surname'}`]"
/>
<q-input
ref="lastnameRef"
filled
v-model="lastname"
label="lastname *"
lazy-rules
:rules="[(val) => !!val || `${'lastname'}`]"
/>
<q-input
ref="ageRef"
filled
type="number"
v-model="age"
label="Your age *"
lazy-rules
:rules="[(val) => !!val || `${'Your age'}`]"
/>
<div>
<q-btn label="Submit" type="submit" color="primary" />
</div>
</form>
<q-card-actions align="right">
<q-btn
dense
unelevated
label="back"
color="public"
@click="previous()"
class="q-px-md"
/>
<q-btn
dense
unelevated
label="next"
color="public"
@click="next()"
class="q-px-md"
/>
</q-card-actions>
</template>
<style scoped></style>

View file

@ -1,35 +0,0 @@
<script setup lang="ts">
/** รับ props มาจากหน้าหลัก */
const props = defineProps({
next: {
type: Function,
default: () => console.log("not function"),
},
previous: {
type: Function,
default: () => console.log("not function"),
},
});
/**ฟังชั่น ไป step ก่อนหน้า */
function previous() {
props.previous();
}
</script>
<template>
<div><h1>step03</h1></div>
<q-card-actions align="right">
<q-btn
dense
unelevated
label="back"
color="public"
@click="previous()"
class="q-px-md"
/>
</q-card-actions>
</template>
<style scoped></style>

View file

@ -50,8 +50,6 @@ const InvestigateDisciplinaryAdd = () =>
import(
"@/modules/11_discipline/components/3_InvestigateDisciplinary/AddPage.vue"
);
const orderPage = () =>
import("@/modules/11_discipline/components/9_Order/OrderPage.vue");
const oredrMain = () =>
import("@/modules/11_discipline/components/9_Order/MainPage.vue");