ปรับ interfeac
This commit is contained in:
parent
09b1b9f492
commit
cfc073e30c
16 changed files with 462 additions and 277 deletions
|
|
@ -1,8 +1,12 @@
|
|||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { ref, reactive } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import type { DataOption, MyObjectRef } from "../../interface/index/Main";
|
||||
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";
|
||||
|
||||
|
|
@ -38,28 +42,30 @@ const listInvestigationOptions = ref<DataOption[]>([
|
|||
{ id: "2", name: "รายการสอบสวนความผิดทางวินัย 3" },
|
||||
]);
|
||||
// ตัวแปรทั้งหมด
|
||||
const orderType = ref<string>("");
|
||||
const orderBy = ref<string>("");
|
||||
const listInvestigation = ref<string>("");
|
||||
const authority = ref<string>("");
|
||||
const orderNumber = ref<string>();
|
||||
const dateYear = ref<number>(2023);
|
||||
const date = ref<Date | null>(null);
|
||||
const authorityPosition = ref<string>("");
|
||||
const subject = ref<string>("");
|
||||
const mistakeDetail = ref<string>("");
|
||||
const formData = reactive<FormData>({
|
||||
orderType: "",
|
||||
orderBy: "",
|
||||
listInvestigation: "",
|
||||
authority: "",
|
||||
orderNumber: "",
|
||||
dateYear: 0,
|
||||
date: null,
|
||||
authorityPosition: "",
|
||||
subject: "",
|
||||
mistakeDetail: "",
|
||||
});
|
||||
|
||||
// validateForm
|
||||
const orderTypeRef = ref<any>(null);
|
||||
const orderByRef = ref<any>(null);
|
||||
const listInvestigationRef = ref<any>(null);
|
||||
const authorityRef = ref<any>(null);
|
||||
const orderNumberRef = ref<any>(null);
|
||||
const dateYearRef = ref<any>(null);
|
||||
const dateRef = ref<any>(null);
|
||||
const authorityPositionRef = ref<any>(null);
|
||||
const subjectRef = ref<any>(null);
|
||||
const mistakeDetailRef = ref<any>(null);
|
||||
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);
|
||||
const myObjectRef: MyObjectRef = {
|
||||
orderType: orderTypeRef,
|
||||
orderBy: orderByRef,
|
||||
|
|
@ -91,6 +97,7 @@ function validateForm() {
|
|||
}
|
||||
|
||||
function onSubmit() {
|
||||
console.log(formData);
|
||||
dialogConfirm(
|
||||
$q,
|
||||
async () => {
|
||||
|
|
@ -109,10 +116,11 @@ function onSubmit() {
|
|||
<div class="col-xs-12 col-sm-6">
|
||||
ประเภทคำสั่ง
|
||||
<q-select
|
||||
for="orderType"
|
||||
ref="orderTypeRef"
|
||||
dense
|
||||
outlined
|
||||
v-model="orderType"
|
||||
v-model="formData.orderType"
|
||||
:options="orderTypeOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
|
|
@ -126,10 +134,11 @@ function onSubmit() {
|
|||
<div class="col-xs-12 col-sm-6">
|
||||
คำสั่งโดย
|
||||
<q-select
|
||||
for="orderBy"
|
||||
ref="orderByRef"
|
||||
dense
|
||||
outlined
|
||||
v-model="orderBy"
|
||||
v-model="formData.orderBy"
|
||||
:options="orderByOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
|
|
@ -143,10 +152,11 @@ function onSubmit() {
|
|||
<div class="col-xs-12 col-sm-6">
|
||||
เลือกรายการสอบสวนความผิดทางวินัย
|
||||
<q-select
|
||||
for="listInvestigation"
|
||||
ref="listInvestigationRef"
|
||||
dense
|
||||
outlined
|
||||
v-model="listInvestigation"
|
||||
v-model="formData.listInvestigation"
|
||||
:options="listInvestigationOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
|
|
@ -162,10 +172,11 @@ function onSubmit() {
|
|||
<div class="col-xs-12 col-sm-6">
|
||||
ผู้มีอำนาจลงนาม
|
||||
<q-input
|
||||
for="authority"
|
||||
ref="authorityRef"
|
||||
dense
|
||||
outlined
|
||||
v-model="authority"
|
||||
v-model="formData.authority"
|
||||
placeholder="กรอกผู้มีอำนาจลงนาม"
|
||||
:rules="[(val) => !!val || `${'กรุณากรอกผู้มีอำนาจลงนาม'}`]"
|
||||
lazy-rules
|
||||
|
|
@ -175,10 +186,11 @@ function onSubmit() {
|
|||
<div class="col-6">
|
||||
คำสั่งที่
|
||||
<q-input
|
||||
for="orderNumber"
|
||||
ref="orderNumberRef"
|
||||
outlined
|
||||
dense
|
||||
v-model="orderNumber"
|
||||
v-model="formData.orderNumber"
|
||||
hide-bottom-space
|
||||
:rules="[(val) => !!val || `${'กรุณากรอรคำสั่งที่'}`]"
|
||||
lazy-rules
|
||||
|
|
@ -191,7 +203,7 @@ function onSubmit() {
|
|||
<div class="col-5">
|
||||
พศ
|
||||
<datepicker
|
||||
v-model="dateYear"
|
||||
v-model="formData.dateYear"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
year-picker
|
||||
|
|
@ -204,9 +216,10 @@ function onSubmit() {
|
|||
<template #trigger>
|
||||
<q-input
|
||||
ref="dateYearRef"
|
||||
:model-value="dateYear + 543"
|
||||
:model-value="
|
||||
formData.dateYear ? formData.dateYear + 543 : null
|
||||
"
|
||||
:rules="[(val) => !!val || `${'กรุณากรอก พ.ศ.'}`]"
|
||||
:label="`${'พ.ศ.'}`"
|
||||
dense
|
||||
outlined
|
||||
>
|
||||
|
|
@ -219,7 +232,7 @@ function onSubmit() {
|
|||
วันที่มีผลคำสั่ง
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="date"
|
||||
v-model="formData.date"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
borderless
|
||||
|
|
@ -234,11 +247,14 @@ function onSubmit() {
|
|||
</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
for="date"
|
||||
ref="dateRef"
|
||||
outlined
|
||||
dense
|
||||
class="full-width datepicker"
|
||||
:model-value="date != null ? date2Thai(date) : null"
|
||||
:model-value="
|
||||
formData.date != null ? date2Thai(formData.date) : null
|
||||
"
|
||||
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่มีผลคำสั่ง'}`]"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
|
|
@ -256,10 +272,11 @@ function onSubmit() {
|
|||
<div class="col-xs-12 col-sm-6">
|
||||
ตำแหน่งผู้มีอำนาจลงนาม
|
||||
<q-input
|
||||
for="authorityPosition"
|
||||
ref="authorityPositionRef"
|
||||
dense
|
||||
outlined
|
||||
v-model="authorityPosition"
|
||||
v-model="formData.authorityPosition"
|
||||
placeholder="กรอกตำแหน่งผู้มีอำนาจลงนาม"
|
||||
:rules="[(val) => !!val || `${'กรุณากรอกตำแหน่งผู้มีอำนาจลงนาม'}`]"
|
||||
lazy-rules
|
||||
|
|
@ -268,10 +285,11 @@ function onSubmit() {
|
|||
<div class="col-xs-12 col-sm-6">
|
||||
คำสั่งเรื่อง
|
||||
<q-input
|
||||
for="subject"
|
||||
ref="subjectRef"
|
||||
dense
|
||||
outlined
|
||||
v-model="subject"
|
||||
v-model="formData.subject"
|
||||
placeholder="กรอกคำสั่งเรื่อง"
|
||||
:rules="[(val) => !!val || `${'กรุณากรอกคำสั่งเรื่อง'}`]"
|
||||
lazy-rules
|
||||
|
|
@ -280,10 +298,11 @@ function onSubmit() {
|
|||
<div class="col-xs-12 col-sm-12">
|
||||
รายละเอียดการกระทำความผิด
|
||||
<q-input
|
||||
for="mistakeDetail"
|
||||
ref="mistakeDetailRef"
|
||||
dense
|
||||
outlined
|
||||
v-model="mistakeDetail"
|
||||
v-model="formData.mistakeDetail"
|
||||
placeholder="กรอกรายละเอียดการกระทำความผิด"
|
||||
:rules="[(val) => !!val || `${'กรุณากรอกคำสั่งเรื่อง'}`]"
|
||||
lazy-rules
|
||||
|
|
@ -295,6 +314,7 @@ function onSubmit() {
|
|||
</div>
|
||||
<q-card-actions align="right">
|
||||
<q-btn
|
||||
for="submit"
|
||||
flat
|
||||
round
|
||||
unelevated
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue