validateForm เพิ่มเรื่องร้องเรียน
This commit is contained in:
parent
dd89933261
commit
b00a946c64
8 changed files with 302 additions and 62 deletions
|
|
@ -1,23 +1,27 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted } from "vue";
|
import { ref, onMounted } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
|
|
||||||
import type { DataOption } from "../../interface/index/Main";
|
// import Type
|
||||||
|
import type {
|
||||||
|
DataOption,
|
||||||
|
MyObjectComplaintsRef,
|
||||||
|
} from "../../interface/index/Main";
|
||||||
|
|
||||||
// importStroe
|
// importStroe
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { useComplainstDataStore } from "../../stroes/ComplaintsStore";
|
import { useComplainstDataStore } from "../../stroes/ComplaintsStore";
|
||||||
|
|
||||||
const route = useRoute();
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const { date2Thai, dialogConfirm } = mixin;
|
const { date2Thai, dialogConfirm } = mixin; //function จาก stores หลัก
|
||||||
|
|
||||||
const complainstStore = useComplainstDataStore();
|
const complainstStore = useComplainstDataStore();
|
||||||
const { selectComplainantTpye, filterSelector, fectOptioin } = complainstStore;
|
const { selectComplainantTpye, filterSelector, fectOptioin } = complainstStore; // function จาก store complainstStore
|
||||||
|
|
||||||
|
// options ทั้งหมด
|
||||||
const complainantoptions = ref<DataOption[]>([
|
const complainantoptions = ref<DataOption[]>([
|
||||||
{ id: "0", name: "บุคคล" },
|
{ id: "0", name: "บุคคล" },
|
||||||
{ id: "1", name: "หน่ายงาน" },
|
{ id: "1", name: "หน่ายงาน" },
|
||||||
|
|
@ -67,15 +71,15 @@ const fileDocDataUpload = ref<File[]>([]);
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fectOptioin(complainantoptions.value, agencytoptions.value);
|
fectOptioin(complainantoptions.value, agencytoptions.value);
|
||||||
});
|
});
|
||||||
|
// เลือกผู้ร้องเรียน
|
||||||
async function selectComplainant(val: string) {
|
async function selectComplainant(val: string) {
|
||||||
complainant.value = "";
|
complainant.value = "";
|
||||||
office.value = "";
|
office.value = "";
|
||||||
agency.value = "";
|
agency.value = "";
|
||||||
if (val === "0") {
|
if (val === "0") {
|
||||||
await fectListname();
|
await fectListname(); // ถ้าเลือกบุกคลจะเรียก function fectListname เรียกรายชื่อจากทะเบียน
|
||||||
} else if (val === "1") {
|
} else if (val === "1") {
|
||||||
await fectOffice();
|
await fectOffice(); // ถ้าเลือกหน่วยงานจะเรียก function fectOffice เรียกโครงสร้างสำนักงาน
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// เรียกรายชื่อ
|
// เรียกรายชื่อ
|
||||||
|
|
@ -96,6 +100,7 @@ async function fectListname() {
|
||||||
];
|
];
|
||||||
selectComplainantTpye(listName);
|
selectComplainantTpye(listName);
|
||||||
}
|
}
|
||||||
|
// เรียกโครงสร้างสำนักงาน
|
||||||
async function fectOffice() {
|
async function fectOffice() {
|
||||||
// const listOffice = [
|
// const listOffice = [
|
||||||
// {
|
// {
|
||||||
|
|
@ -112,22 +117,23 @@ async function fectOffice() {
|
||||||
// },
|
// },
|
||||||
// ];
|
// ];
|
||||||
}
|
}
|
||||||
|
// อัพโหลดไฟล์
|
||||||
const fileUploadDoc = async (files: any) => {
|
const fileUploadDoc = async (files: any) => {
|
||||||
files.forEach((file: any) => {
|
files.forEach((file: any) => {
|
||||||
fileDocDataUpload.value.push(file);
|
fileDocDataUpload.value.push(file);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
// เลือกระดับการพิจารณา
|
||||||
function selectLevel(val: string) {
|
function selectLevel(val: string) {
|
||||||
let dayNum = 0;
|
let dayNum = 0;
|
||||||
if (val == "0") {
|
if (val == "0") {
|
||||||
dayNum = 45;
|
dayNum = 45; // ปกติ
|
||||||
} else if (val == "1") {
|
} else if (val == "1") {
|
||||||
dayNum = 30;
|
dayNum = 30; // ด่วน
|
||||||
} else {
|
} else {
|
||||||
dayNum = 15;
|
dayNum = 15; // ด่วนมาก
|
||||||
}
|
}
|
||||||
|
// วันแจ้งเตือนล่วงหน้า
|
||||||
if (dateconsideration.value) {
|
if (dateconsideration.value) {
|
||||||
const currentDate = new Date(dateconsideration.value);
|
const currentDate = new Date(dateconsideration.value);
|
||||||
const newDate = new Date(
|
const newDate = new Date(
|
||||||
|
|
@ -136,7 +142,56 @@ function selectLevel(val: string) {
|
||||||
datewarn.value = newDate;
|
datewarn.value = newDate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// validateForm
|
||||||
|
const complainantTypeRef = ref<any>(null);
|
||||||
|
const complainantRef = ref<any>(null);
|
||||||
|
const officeRef = ref<any>(null);
|
||||||
|
const agencyRef = ref<any>(null);
|
||||||
|
const topicComplaintRef = ref<any>(null);
|
||||||
|
const detailRef = ref<any>(null);
|
||||||
|
const datereceiveRef = ref<any>();
|
||||||
|
const dateconsiderationRef = ref<any>(null);
|
||||||
|
const offenseDescriptionRef = ref<any>(null);
|
||||||
|
const considerationLevelRef = ref<any>(null);
|
||||||
|
const datewarnRef = ref<any>(null);
|
||||||
|
const receivecomplaintsRef = ref<any>(null);
|
||||||
|
const petitionerRef = ref<any>(null);
|
||||||
|
const filesRef = ref<any>(null);
|
||||||
|
|
||||||
|
const objectComplaintsRef: MyObjectComplaintsRef = {
|
||||||
|
complainantType: complainantTypeRef,
|
||||||
|
complainant: complainantRef,
|
||||||
|
office: officeRef,
|
||||||
|
agency: agencyRef,
|
||||||
|
topicComplaint: topicComplaintRef,
|
||||||
|
detail: detailRef,
|
||||||
|
datereceive: datereceiveRef,
|
||||||
|
dateconsideration: dateconsiderationRef,
|
||||||
|
offenseDescription: offenseDescriptionRef,
|
||||||
|
considerationLevel: considerationLevelRef,
|
||||||
|
datewarn: datewarnRef,
|
||||||
|
receivecomplaints: receivecomplaintsRef,
|
||||||
|
petitioner: petitionerRef,
|
||||||
|
files: filesRef,
|
||||||
|
};
|
||||||
|
function validateForm() {
|
||||||
|
const hasError = [];
|
||||||
|
for (const key in objectComplaintsRef) {
|
||||||
|
if (Object.prototype.hasOwnProperty.call(objectComplaintsRef, key)) {
|
||||||
|
const property = objectComplaintsRef[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() {
|
function onSubmit() {
|
||||||
dialogConfirm(
|
dialogConfirm(
|
||||||
$q,
|
$q,
|
||||||
|
|
@ -162,13 +217,14 @@ function onSubmit() {
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 q-mt-sm">
|
<div class="col-12 q-mt-sm">
|
||||||
<q-card flat bordered>
|
<q-card flat bordered>
|
||||||
<q-form @submit.prevent="onSubmit">
|
<form @submit.prevent="validateForm">
|
||||||
<div class="col-12 row q-pa-md">
|
<div class="col-12 row q-pa-md">
|
||||||
<div
|
<div
|
||||||
class="col-xs-12 col-sm-12 row q-col-gutter-x-md q-col-gutter-y-xs"
|
class="col-xs-12 col-sm-12 row q-col-gutter-x-md q-col-gutter-y-xs"
|
||||||
>
|
>
|
||||||
<div class="col-xs-12 col-sm-2">
|
<div class="col-xs-12 col-sm-2">
|
||||||
<q-select
|
<q-select
|
||||||
|
ref="complainantTypeRef"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
v-model="complainantType"
|
v-model="complainantType"
|
||||||
|
|
@ -185,26 +241,58 @@ function onSubmit() {
|
||||||
@filter="(inputValue: any,
|
@filter="(inputValue: any,
|
||||||
doneFn: Function) => filterSelector(inputValue, doneFn, 'filtercomplainantType'
|
doneFn: Function) => filterSelector(inputValue, doneFn, 'filtercomplainantType'
|
||||||
)"
|
)"
|
||||||
/>
|
>
|
||||||
|
<template v-slot:no-option>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section class="text-grey">
|
||||||
|
ไม่มีข้อมูล
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-xs-12 col-sm-2" v-if="complainantType === '0'">
|
<div class="col-xs-12 col-sm-2" v-if="complainantType === '0'">
|
||||||
<q-select
|
<q-select
|
||||||
|
ref="complainantRef"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
v-model="complainant"
|
v-model="complainant"
|
||||||
:options="complainstStore.optionListName"
|
:options="complainstStore.optionListName"
|
||||||
label="ราชชื่อจากทะเบียรประวัติ"
|
label="รายชื่อจากทะเบียรประวัติ"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
/>
|
:rules="[(val) => !!val || `${'กรุณาเลือกรายชื่อ'}`]"
|
||||||
|
lazy-rules
|
||||||
|
use-input
|
||||||
|
@filter="(inputValue: any,
|
||||||
|
doneFn: Function) => filterSelector(inputValue, doneFn, 'filtercomplainantOP'
|
||||||
|
)"
|
||||||
|
><template v-slot:no-option>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section class="text-grey">
|
||||||
|
ไม่มีข้อมูล
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-2" v-if="complainantType === '1'">
|
<div class="col-xs-12 col-sm-2" v-if="complainantType === '1'">
|
||||||
<q-input dense outlined v-model="office" label="เลือกสำนักงาน" />
|
<q-input
|
||||||
|
ref="officeRef"
|
||||||
|
dense
|
||||||
|
outlined
|
||||||
|
v-model="office"
|
||||||
|
label="เลือกสำนักงาน"
|
||||||
|
:rules="[(val) => !!val || `${'กรุณาเลือกสำนักงาน'}`]"
|
||||||
|
lazy-rules
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-2">
|
<div class="col-xs-12 col-sm-2">
|
||||||
<q-select
|
<q-select
|
||||||
|
ref="agencyRef"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
v-model="agency"
|
v-model="agency"
|
||||||
|
|
@ -220,10 +308,19 @@ function onSubmit() {
|
||||||
@filter="(inputValue: any,
|
@filter="(inputValue: any,
|
||||||
doneFn: Function) => filterSelector(inputValue, doneFn, 'filteragencytoptions'
|
doneFn: Function) => filterSelector(inputValue, doneFn, 'filteragencytoptions'
|
||||||
)"
|
)"
|
||||||
/>
|
>
|
||||||
|
<template v-slot:no-option>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section class="text-grey">
|
||||||
|
ไม่มีข้อมูล
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-12">
|
<div class="col-xs-12 col-sm-12">
|
||||||
<q-input
|
<q-input
|
||||||
|
ref="topicComplaintRef"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
v-model="topicComplaint"
|
v-model="topicComplaint"
|
||||||
|
|
@ -236,6 +333,7 @@ function onSubmit() {
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-12">
|
<div class="col-xs-12 col-sm-12">
|
||||||
<q-input
|
<q-input
|
||||||
|
ref="detailRef"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
v-model="detail"
|
v-model="detail"
|
||||||
|
|
@ -264,6 +362,7 @@ function onSubmit() {
|
||||||
</template>
|
</template>
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<q-input
|
<q-input
|
||||||
|
ref="datereceiveRef"
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
class="full-width datepicker"
|
class="full-width datepicker"
|
||||||
|
|
@ -306,6 +405,7 @@ function onSubmit() {
|
||||||
</template>
|
</template>
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<q-input
|
<q-input
|
||||||
|
ref="dateconsiderationRef"
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
class="full-width datepicker"
|
class="full-width datepicker"
|
||||||
|
|
@ -334,6 +434,7 @@ function onSubmit() {
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-2">
|
<div class="col-xs-12 col-sm-2">
|
||||||
<q-select
|
<q-select
|
||||||
|
ref="offenseDescriptionRef"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
v-model="offenseDescription"
|
v-model="offenseDescription"
|
||||||
|
|
@ -349,6 +450,7 @@ function onSubmit() {
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-2">
|
<div class="col-xs-12 col-sm-2">
|
||||||
<q-select
|
<q-select
|
||||||
|
ref="considerationLevelRef"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
v-model="considerationLevel"
|
v-model="considerationLevel"
|
||||||
|
|
@ -382,6 +484,7 @@ function onSubmit() {
|
||||||
</template>
|
</template>
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<q-input
|
<q-input
|
||||||
|
ref="datewarnRef"
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
class="full-width datepicker"
|
class="full-width datepicker"
|
||||||
|
|
@ -407,6 +510,7 @@ function onSubmit() {
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-2">
|
<div class="col-xs-12 col-sm-2">
|
||||||
<q-select
|
<q-select
|
||||||
|
ref="receivecomplaintsRef"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
v-model="receivecomplaints"
|
v-model="receivecomplaints"
|
||||||
|
|
@ -423,6 +527,7 @@ function onSubmit() {
|
||||||
<div class="col-xs-12 col-sm-6"></div>
|
<div class="col-xs-12 col-sm-6"></div>
|
||||||
<div class="col-xs-12 col-sm-4">
|
<div class="col-xs-12 col-sm-4">
|
||||||
<q-input
|
<q-input
|
||||||
|
ref="petitionerRef"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
v-model="petitioner"
|
v-model="petitioner"
|
||||||
|
|
@ -433,6 +538,7 @@ function onSubmit() {
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-4">
|
<div class="col-xs-12 col-sm-4">
|
||||||
<q-file
|
<q-file
|
||||||
|
ref="filesRef"
|
||||||
class="col-xs-12 col-sm-10"
|
class="col-xs-12 col-sm-10"
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
|
|
@ -443,6 +549,7 @@ function onSubmit() {
|
||||||
lazy-rules
|
lazy-rules
|
||||||
accept=".pdf,.xlsx,.doc"
|
accept=".pdf,.xlsx,.doc"
|
||||||
clearable
|
clearable
|
||||||
|
:rules="[(val) => !!val || `${'กรุณาเพิ่มไฟล์เอกสารหลักฐาน'}`]"
|
||||||
>
|
>
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
<q-icon name="attach_file" />
|
<q-icon name="attach_file" />
|
||||||
|
|
@ -463,7 +570,7 @@ function onSubmit() {
|
||||||
><q-tooltip>บับทึกข้อมูล</q-tooltip></q-btn
|
><q-tooltip>บับทึกข้อมูล</q-tooltip></q-btn
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</q-form>
|
</form>
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import { useComplainstDataStore } from "../../stroes/ComplaintsStore";
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const complainstStore = useComplainstDataStore();
|
const complainstStore = useComplainstDataStore();
|
||||||
const { fectComplainst } = complainstStore;
|
const { fectComplainst } = complainstStore; // function จาก stores
|
||||||
|
|
||||||
//ข้อมูล Table
|
//ข้อมูล Table
|
||||||
const filterTable = ref<string>("");
|
const filterTable = ref<string>("");
|
||||||
|
|
@ -99,6 +99,7 @@ onMounted(async () => {
|
||||||
await fecthListComplaints();
|
await fecthListComplaints();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// เรีนกรายการเรื่องร้องเรียน
|
||||||
async function fecthListComplaints() {
|
async function fecthListComplaints() {
|
||||||
const listData = [
|
const listData = [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,9 @@ import { useOrderStore } from "../../stroes/OrderStore";
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const OrderStore = useOrderStore();
|
const OrderStore = useOrderStore();
|
||||||
const { fecthOrder } = OrderStore;
|
const { fecthOrder } = OrderStore; // function จาก stores
|
||||||
|
|
||||||
|
// ข้อมูล table
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = ref<QTableProps["columns"]>([
|
||||||
{
|
{
|
||||||
name: "subject",
|
name: "subject",
|
||||||
|
|
@ -74,13 +75,13 @@ const visibleColumns = ref<string[]>([
|
||||||
"signer",
|
"signer",
|
||||||
"statusorder",
|
"statusorder",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const filterTable = ref<string>("");
|
const filterTable = ref<string>("");
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await fecthListOrder();
|
await fecthListOrder();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// เรียกรายการคำสั่ง จาก API
|
||||||
async function fecthListOrder() {
|
async function fecthListOrder() {
|
||||||
const listData = [
|
const listData = [
|
||||||
{
|
{
|
||||||
|
|
@ -108,9 +109,10 @@ async function fecthListOrder() {
|
||||||
statusorder: "เสร็จสิ้นแล้ว",
|
statusorder: "เสร็จสิ้นแล้ว",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
await fecthOrder(listData);
|
await fecthOrder(listData); // ส่งข้อมูลไปยัง stores
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// redirect ไปยังการเพิ่มออกคำสั่งลงโทษทางวินัย
|
||||||
function redirectToPageadd() {
|
function redirectToPageadd() {
|
||||||
router.push(`/discipline-order/add`);
|
router.push(`/discipline-order/add`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
|
|
||||||
|
// import step
|
||||||
import step01 from "./Step01.vue";
|
import step01 from "./Step01.vue";
|
||||||
import step02 from "./Step02.vue";
|
import step02 from "./Step02.vue";
|
||||||
import step03 from "./Step03.vue";
|
import step03 from "./Step03.vue";
|
||||||
|
|
@ -9,11 +10,12 @@ import step03 from "./Step03.vue";
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const step = ref<number>(1);
|
const step = ref<number>(1);
|
||||||
|
// nextStep
|
||||||
const nextStep = async () => {
|
const nextStep = async () => {
|
||||||
localStorage.setItem("currentStep", step.value.toString());
|
localStorage.setItem("currentStep", step.value.toString());
|
||||||
step.value++;
|
step.value++;
|
||||||
};
|
};
|
||||||
|
// previousStep
|
||||||
const previousStep = async () => {
|
const previousStep = async () => {
|
||||||
localStorage.setItem("currentStep", step.value.toString());
|
localStorage.setItem("currentStep", step.value.toString());
|
||||||
step.value--;
|
step.value--;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
|
|
||||||
import type { DataOption } from "../../interface/index/Main";
|
import type { DataOption, MyObjectRef } from "../../interface/index/Main";
|
||||||
// importStroe
|
// importStroe
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
|
||||||
|
|
@ -21,7 +21,7 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const next = () => props.next();
|
const next = () => props.next();
|
||||||
|
// Options ต่างๆ
|
||||||
const orderTypeOptions = ref<DataOption[]>([
|
const orderTypeOptions = ref<DataOption[]>([
|
||||||
{ id: "0", name: "ประเภทคำสั่ง 1" },
|
{ id: "0", name: "ประเภทคำสั่ง 1" },
|
||||||
{ id: "1", name: "ประเภทคำสั่ง 2" },
|
{ id: "1", name: "ประเภทคำสั่ง 2" },
|
||||||
|
|
@ -37,7 +37,7 @@ const listInvestigationOptions = ref<DataOption[]>([
|
||||||
{ id: "1", name: "รายการสอบสวนความผิดทางวินัย 2" },
|
{ id: "1", name: "รายการสอบสวนความผิดทางวินัย 2" },
|
||||||
{ id: "2", name: "รายการสอบสวนความผิดทางวินัย 3" },
|
{ id: "2", name: "รายการสอบสวนความผิดทางวินัย 3" },
|
||||||
]);
|
]);
|
||||||
|
// ตัวแปรทั้งหมด
|
||||||
const orderType = ref<string>("");
|
const orderType = ref<string>("");
|
||||||
const orderBy = ref<string>("");
|
const orderBy = ref<string>("");
|
||||||
const listInvestigation = ref<string>("");
|
const listInvestigation = ref<string>("");
|
||||||
|
|
@ -49,6 +49,47 @@ const authorityPosition = ref<string>("");
|
||||||
const subject = ref<string>("");
|
const subject = ref<string>("");
|
||||||
const mistakeDetail = ref<string>("");
|
const mistakeDetail = ref<string>("");
|
||||||
|
|
||||||
|
// 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 myObjectRef: MyObjectRef = {
|
||||||
|
orderType: orderTypeRef,
|
||||||
|
orderBy: orderByRef,
|
||||||
|
listInvestigation: listInvestigationRef,
|
||||||
|
authority: authorityRef,
|
||||||
|
orderNumber: orderNumberRef,
|
||||||
|
dateYear: dateYearRef,
|
||||||
|
date: dateRef,
|
||||||
|
authorityPosition: authorityPositionRef,
|
||||||
|
subject: subjectRef,
|
||||||
|
mistakeDetail: mistakeDetailRef,
|
||||||
|
};
|
||||||
|
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() {
|
function onSubmit() {
|
||||||
dialogConfirm(
|
dialogConfirm(
|
||||||
$q,
|
$q,
|
||||||
|
|
@ -62,12 +103,13 @@ function onSubmit() {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<q-form @submit.prevent="onSubmit">
|
<form @submit.prevent.stop="validateForm">
|
||||||
<div class="col-12 row q-pa-lg">
|
<div class="col-12 row q-pa-lg">
|
||||||
<div class="col-xs-12 col-sm-12 q-col-gutter-x-lg row q-col-gutter-y-xs">
|
<div class="col-xs-12 col-sm-12 q-col-gutter-x-lg row q-col-gutter-y-xs">
|
||||||
<div class="col-xs-12 col-sm-6">
|
<div class="col-xs-12 col-sm-6">
|
||||||
ประเภทคำสั่ง
|
ประเภทคำสั่ง
|
||||||
<q-select
|
<q-select
|
||||||
|
ref="orderTypeRef"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
v-model="orderType"
|
v-model="orderType"
|
||||||
|
|
@ -84,6 +126,7 @@ function onSubmit() {
|
||||||
<div class="col-xs-12 col-sm-6">
|
<div class="col-xs-12 col-sm-6">
|
||||||
คำสั่งโดย
|
คำสั่งโดย
|
||||||
<q-select
|
<q-select
|
||||||
|
ref="orderByRef"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
v-model="orderBy"
|
v-model="orderBy"
|
||||||
|
|
@ -100,6 +143,7 @@ function onSubmit() {
|
||||||
<div class="col-xs-12 col-sm-6">
|
<div class="col-xs-12 col-sm-6">
|
||||||
เลือกรายการสอบสวนความผิดทางวินัย
|
เลือกรายการสอบสวนความผิดทางวินัย
|
||||||
<q-select
|
<q-select
|
||||||
|
ref="listInvestigationRef"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
v-model="listInvestigation"
|
v-model="listInvestigation"
|
||||||
|
|
@ -118,6 +162,7 @@ function onSubmit() {
|
||||||
<div class="col-xs-12 col-sm-6">
|
<div class="col-xs-12 col-sm-6">
|
||||||
ผู้มีอำนาจลงนาม
|
ผู้มีอำนาจลงนาม
|
||||||
<q-input
|
<q-input
|
||||||
|
ref="authorityRef"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
v-model="authority"
|
v-model="authority"
|
||||||
|
|
@ -130,6 +175,7 @@ function onSubmit() {
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
คำสั่งที่
|
คำสั่งที่
|
||||||
<q-input
|
<q-input
|
||||||
|
ref="orderNumberRef"
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
v-model="orderNumber"
|
v-model="orderNumber"
|
||||||
|
|
@ -157,6 +203,7 @@ function onSubmit() {
|
||||||
}}</template>
|
}}</template>
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<q-input
|
<q-input
|
||||||
|
ref="dateYearRef"
|
||||||
:model-value="dateYear + 543"
|
:model-value="dateYear + 543"
|
||||||
:rules="[(val) => !!val || `${'กรุณากรอก พ.ศ.'}`]"
|
:rules="[(val) => !!val || `${'กรุณากรอก พ.ศ.'}`]"
|
||||||
:label="`${'พ.ศ.'}`"
|
:label="`${'พ.ศ.'}`"
|
||||||
|
|
@ -187,6 +234,7 @@ function onSubmit() {
|
||||||
</template>
|
</template>
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<q-input
|
<q-input
|
||||||
|
ref="dateRef"
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
class="full-width datepicker"
|
class="full-width datepicker"
|
||||||
|
|
@ -208,6 +256,7 @@ function onSubmit() {
|
||||||
<div class="col-xs-12 col-sm-6">
|
<div class="col-xs-12 col-sm-6">
|
||||||
ตำแหน่งผู้มีอำนาจลงนาม
|
ตำแหน่งผู้มีอำนาจลงนาม
|
||||||
<q-input
|
<q-input
|
||||||
|
ref="authorityPositionRef"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
v-model="authorityPosition"
|
v-model="authorityPosition"
|
||||||
|
|
@ -219,6 +268,7 @@ function onSubmit() {
|
||||||
<div class="col-xs-12 col-sm-6">
|
<div class="col-xs-12 col-sm-6">
|
||||||
คำสั่งเรื่อง
|
คำสั่งเรื่อง
|
||||||
<q-input
|
<q-input
|
||||||
|
ref="subjectRef"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
v-model="subject"
|
v-model="subject"
|
||||||
|
|
@ -230,6 +280,7 @@ function onSubmit() {
|
||||||
<div class="col-xs-12 col-sm-12">
|
<div class="col-xs-12 col-sm-12">
|
||||||
รายละเอียดการกระทำความผิด
|
รายละเอียดการกระทำความผิด
|
||||||
<q-input
|
<q-input
|
||||||
|
ref="mistakeDetailRef"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
v-model="mistakeDetail"
|
v-model="mistakeDetail"
|
||||||
|
|
@ -252,7 +303,7 @@ function onSubmit() {
|
||||||
type="submit"
|
type="submit"
|
||||||
/>
|
/>
|
||||||
</q-card-actions>
|
</q-card-actions>
|
||||||
</q-form>
|
</form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { ref } from "vue";
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
next: {
|
next: {
|
||||||
type: Function,
|
type: Function,
|
||||||
|
|
@ -11,10 +12,79 @@ const props = defineProps({
|
||||||
});
|
});
|
||||||
const next = () => props.next();
|
const next = () => props.next();
|
||||||
const previous = () => props.previous();
|
const previous = () => props.previous();
|
||||||
|
|
||||||
|
const name = ref<string>("");
|
||||||
|
const lastname = ref<string>("");
|
||||||
|
const age = ref<string>("");
|
||||||
|
|
||||||
|
const nameRef = ref<any>(null);
|
||||||
|
const ageRef = ref<any>(null);
|
||||||
|
const lastnameRef = ref<any>(null);
|
||||||
|
const myObject: MyObject = {
|
||||||
|
name: nameRef,
|
||||||
|
lastname: lastnameRef,
|
||||||
|
age: ageRef,
|
||||||
|
};
|
||||||
|
interface MyObject {
|
||||||
|
name: any;
|
||||||
|
lastname: any;
|
||||||
|
age: any;
|
||||||
|
[key: string]: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div><h1>step02</h1></div>
|
<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-card-actions align="right">
|
||||||
<q-btn
|
<q-btn
|
||||||
dense
|
dense
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,28 @@ interface MyObjectRef {
|
||||||
mistakeDetail: any,
|
mistakeDetail: any,
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}
|
}
|
||||||
|
interface MyObjectComplaintsRef {
|
||||||
|
complainantType: any
|
||||||
|
complainant: any
|
||||||
|
office: any
|
||||||
|
agency: any
|
||||||
|
topicComplaint: any
|
||||||
|
datereceive: any
|
||||||
|
dateconsideration: any
|
||||||
|
offenseDescription: any
|
||||||
|
considerationLevel: any
|
||||||
|
datewarn: any
|
||||||
|
receivecomplaints: any
|
||||||
|
petitioner: any
|
||||||
|
files: any
|
||||||
|
[key: string]: any;
|
||||||
|
}
|
||||||
|
|
||||||
export type {
|
export type {
|
||||||
DataOption,
|
DataOption,
|
||||||
investigatefactsDataRowType,
|
investigatefactsDataRowType,
|
||||||
MyObjectRef,
|
MyObjectRef,
|
||||||
|
MyObjectComplaintsRef,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import type { DataOption } from "../interface/index/Main";
|
||||||
|
|
||||||
export const useComplainstDataStore = defineStore("DisciplineComplainst", () => {
|
export const useComplainstDataStore = defineStore("DisciplineComplainst", () => {
|
||||||
const rows = ref<any>([])
|
const rows = ref<any>([])
|
||||||
const optionListName = ref<any>([{}])
|
|
||||||
|
|
||||||
|
|
||||||
function fectComplainst(data: any) {
|
function fectComplainst(data: any) {
|
||||||
|
|
@ -21,49 +21,39 @@ export const useComplainstDataStore = defineStore("DisciplineComplainst", () =>
|
||||||
rows.value = datalist
|
rows.value = datalist
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectComplainantTpye(list: any) {
|
|
||||||
optionListName.value = list
|
|
||||||
}
|
|
||||||
|
|
||||||
const complainantoptionsMain = ref<DataOption[]>()
|
const complainantoptionsMain = ref<DataOption[]>()
|
||||||
const complainantoptions = ref<DataOption[]>()
|
const complainantoptions = ref<DataOption[]>()
|
||||||
const agencytoptionsMain = ref<DataOption[]>()
|
const agencytoptionsMain = ref<DataOption[]>()
|
||||||
const agencytoptions = ref<DataOption[]>()
|
const agencytoptions = ref<DataOption[]>()
|
||||||
|
const optionListNameMain = ref<DataOption[]>([])
|
||||||
|
const optionListName = ref<DataOption[]>([])
|
||||||
function fectOptioin(complainantoptions: any, agencytoptions: any) {
|
function fectOptioin(complainantoptions: any, agencytoptions: any) {
|
||||||
complainantoptionsMain.value = complainantoptions
|
complainantoptionsMain.value = complainantoptions
|
||||||
agencytoptionsMain.value = agencytoptions
|
agencytoptionsMain.value = agencytoptions
|
||||||
|
}
|
||||||
|
function selectComplainantTpye(list: any) {
|
||||||
|
optionListNameMain.value = list
|
||||||
|
optionListName.value = list
|
||||||
}
|
}
|
||||||
function filterSelector(val: any, update: Function, type: string) {
|
function filterSelector(val: any, update: Function, type: string) {
|
||||||
console.log(val, type);
|
update(() => {
|
||||||
let data: DataOption[] | undefined = undefined;
|
if (type === "filtercomplainantType" && complainantoptionsMain.value) {
|
||||||
let filter: DataOption[] | undefined = undefined;
|
complainantoptions.value = complainantoptionsMain.value.filter(
|
||||||
if (type == "filtercomplainantType") {
|
(e) => e.name.search(val) !== -1
|
||||||
data = complainantoptionsMain.value
|
);
|
||||||
} else if (type == "filteragencytoptions") {
|
} else if (type === "filteragencytoptions" && agencytoptionsMain.value) {
|
||||||
data = agencytoptionsMain.value
|
agencytoptions.value = agencytoptionsMain.value.filter(
|
||||||
}
|
(e) => e.name.search(val) !== -1
|
||||||
if (val == "") {
|
);
|
||||||
update(() => {
|
} else if (type === "filtercomplainantOP" && optionListNameMain.value) {
|
||||||
filter = data;
|
optionListName.value = optionListNameMain.value.filter(
|
||||||
});
|
(e) => e.name.search(val) !== -1
|
||||||
} else {
|
);
|
||||||
update(() => {
|
|
||||||
if (data) {
|
|
||||||
filter = data.filter(
|
|
||||||
(e) => e.name.search(val) !== -1
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (filter) {
|
|
||||||
if (type == "filtercomplainantType") {
|
|
||||||
complainantoptions.value = filter
|
|
||||||
} else if (type = "filteragencytoptions") {
|
|
||||||
agencytoptions.value = filter
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
})
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
rows,
|
rows,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue