ui รายการอุทธรณ์ร้องทุกข์ *ยังไม่เสร็จดี
This commit is contained in:
parent
e410268bfc
commit
163a3b07a6
9 changed files with 1085 additions and 2 deletions
|
|
@ -55,6 +55,7 @@ watch(
|
|||
getList();
|
||||
}
|
||||
);
|
||||
|
||||
async function getList() {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
<script setup lang="ts">
|
||||
import Form from "@/modules/11_discipline/components/8_AppealComplain/Form.vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
/** บันทึกข้อมูลเเละ route กลับหน้าหลัก */
|
||||
async function onSubmit(){
|
||||
console.log("add");
|
||||
router.push(`/discipline-appealcomplain`);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="col-xs-12 col-sm-12 col-md-11">
|
||||
<div class="toptitle text-dark col-12 row items-center">
|
||||
<q-btn
|
||||
for="#backMaininvestigate"
|
||||
icon="mdi-arrow-left"
|
||||
unelevated
|
||||
round
|
||||
dense
|
||||
flat
|
||||
color="primary"
|
||||
class="q-mr-sm"
|
||||
@click="router.go(-1)"
|
||||
/>
|
||||
เพิ่มการอุทธรณ์/ร้องทุกข์
|
||||
</div>
|
||||
|
||||
<Form :on-submit="onSubmit" />
|
||||
</div>
|
||||
</template>
|
||||
240
src/modules/11_discipline/components/8_AppealComplain/Form.vue
Normal file
240
src/modules/11_discipline/components/8_AppealComplain/Form.vue
Normal file
|
|
@ -0,0 +1,240 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
|
||||
import DialogAddPersonal from "@/components/Dialogs/AddPersonal.vue";
|
||||
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useAppealComplainStore } from "@/modules/11_discipline/store/AppealComplainStore";
|
||||
import { useDisciplineMainStore } from "@/modules/11_discipline/store/main";
|
||||
|
||||
import type { MyObjectAppealRef } from "@/modules/11_discipline/interface/response/appealComplain";
|
||||
|
||||
const mainStore = useDisciplineMainStore();
|
||||
const router = useRouter();
|
||||
/** รับ props มาจากหน้าหลัก */
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
onSubmit: {
|
||||
type: Function,
|
||||
default: () => "",
|
||||
},
|
||||
getData: {
|
||||
type: Function,
|
||||
default: () => "",
|
||||
},
|
||||
});
|
||||
|
||||
const $q = useQuasar();
|
||||
const modalPerson = ref<boolean>(false);
|
||||
const mixin = useCounterMixin();
|
||||
const { dialogConfirm } = mixin;
|
||||
const dataStore = useAppealComplainStore();
|
||||
|
||||
const modalEdit = ref<boolean>(false);
|
||||
const formData = reactive<any>({
|
||||
type: "",
|
||||
status: "",
|
||||
|
||||
year: new Date().getFullYear().toString(),
|
||||
});
|
||||
|
||||
/** ตัวแปร validate */
|
||||
const typeRef = ref<Object | null>(null);
|
||||
const statusRef = ref<Object | null>(null);
|
||||
|
||||
const objectAppeal: MyObjectAppealRef = {
|
||||
complaint: typeRef,
|
||||
complaintdetail: statusRef,
|
||||
};
|
||||
|
||||
/*** ฟังก์ชั่นสำหรับ validate ฟอร์ม */
|
||||
function validateForm() {
|
||||
const hasError = [];
|
||||
for (const key in objectAppeal) {
|
||||
if (Object.prototype.hasOwnProperty.call(objectAppeal, key)) {
|
||||
const property = objectAppeal[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("ไม่ผ่าน ");
|
||||
// console.log(hasError);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleModal() {
|
||||
modalPerson.value = true
|
||||
}
|
||||
|
||||
async function addPerson(data: any) {
|
||||
|
||||
toggleModal();
|
||||
}
|
||||
|
||||
function handleSave(returnData: any) {
|
||||
console.log(returnData)
|
||||
modalPerson.value = false
|
||||
mainStore.rowsAdd = returnData
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
async () => {
|
||||
console.log("add");
|
||||
},
|
||||
"ยืนยันการบันทึกข้อมูล",
|
||||
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
|
||||
);
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<form @submit.prevent="validateForm">
|
||||
<q-card bordered>
|
||||
<div class="q-pa-md">
|
||||
<div class="q-gutter-y-sm">
|
||||
<div class="row q-gutter-x-sm">
|
||||
<div class="col-3">
|
||||
<q-select
|
||||
ref="typeRef"
|
||||
v-model="formData.type"
|
||||
label="ประเภท"
|
||||
dense
|
||||
outlined
|
||||
emit-value
|
||||
map-options
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
:options="dataStore.typeOptions"
|
||||
:rules="[(val) => !!val || `${'กรุณาเลือกผู้ร้องเรียน'}`]"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row col-12">
|
||||
<q-card
|
||||
bordered
|
||||
class="row col-12"
|
||||
style="border: 1px solid #d6dee1"
|
||||
>
|
||||
<div
|
||||
class="col-xs-12 col-sm-12 text-weight-medium bg-grey-1 q-py-xs q-px-md"
|
||||
>
|
||||
ผู้ยื่นอุทธณ์/ร้องทุกข์
|
||||
<q-btn
|
||||
size="12px"
|
||||
flat
|
||||
round
|
||||
dense
|
||||
color="add"
|
||||
class="q-ml-sm"
|
||||
icon="mdi-plus"
|
||||
@click="toggleModal"
|
||||
>
|
||||
<q-tooltip>เพิ่มผู้ยื่นอุทธณ์/ร้องทุกข์</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
<div class="col-12"><q-separator /></div>
|
||||
<div class="col-xs-12 q-pa-sm">
|
||||
<d-table
|
||||
ref="table"
|
||||
:columns="mainStore.columnsRespondent"
|
||||
:rows="mainStore.rowsAdd"
|
||||
row-key="idcard"
|
||||
flat
|
||||
bordered
|
||||
:paging="false"
|
||||
dense
|
||||
hide-bottom
|
||||
class="custom-header-table"
|
||||
:visible-columns="mainStore.visibleColumnsRespondent"
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
<q-th
|
||||
v-for="col in props.cols"
|
||||
:key="col.name"
|
||||
:props="props"
|
||||
style="color: #000000; font-weight: 500"
|
||||
>
|
||||
<span class="text-weight-medium">{{ col.label }}</span>
|
||||
</q-th>
|
||||
<q-th auto-width></q-th>
|
||||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:body="props">
|
||||
<q-tr :props="props" class="cursor-pointer">
|
||||
<q-td
|
||||
v-for="col in props.cols"
|
||||
:key="col.name"
|
||||
:props="props"
|
||||
>
|
||||
<div v-if="col.name == 'no'">
|
||||
{{ props.rowIndex + 1 }}
|
||||
</div>
|
||||
<div v-else-if="col.name == 'info'">
|
||||
<q-btn
|
||||
size="14px"
|
||||
flat
|
||||
round
|
||||
dense
|
||||
color="info"
|
||||
icon="info"
|
||||
@click="
|
||||
router.push(`/registry/${props.row.personId}`)
|
||||
"
|
||||
><q-tooltip
|
||||
>ดูข้อมูลในทะเบียนประวัติ</q-tooltip
|
||||
></q-btn
|
||||
>
|
||||
</div>
|
||||
<div
|
||||
v-else-if="col.name === 'organization'"
|
||||
class="table_ellipsis"
|
||||
>
|
||||
{{ props.row.organization }}
|
||||
</div>
|
||||
<div v-else>
|
||||
{{ col.value }}
|
||||
</div>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
</d-table>
|
||||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<q-separator />
|
||||
<div class="row col-12 q-pa-sm">
|
||||
<q-space />
|
||||
<q-btn id="onSubmit" type="submit" label="บันทึก" color="secondary"
|
||||
><q-tooltip>บันทึก</q-tooltip></q-btn
|
||||
>
|
||||
</div>
|
||||
</q-card>
|
||||
</form>
|
||||
<DialogAddPersonal
|
||||
title="ผู้ถูกร้องเรียน"
|
||||
:modal="modalPerson"
|
||||
btn-title="เพิ่มรายชื่อผู้ถูกสอบสวน"
|
||||
:close="toggleModal"
|
||||
:save="addPerson"
|
||||
:selected-data="mainStore.rowsAdd"
|
||||
@returnData="handleSave"
|
||||
selecetSwitch="single"
|
||||
/>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,487 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted, watch, reactive } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { useQuasar } from "quasar";
|
||||
import type { QTableProps } from "quasar";
|
||||
import type { RowList } from "@/modules/11_discipline/interface/response/appealComplain";
|
||||
import type { DataOption } from "@/modules/11_discipline/interface/index/Main";
|
||||
// importStroe
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useAppealComplainStore } from "@/modules/11_discipline/store/AppealComplainStore";
|
||||
|
||||
// impoet Components
|
||||
import DialogStatus from "@/modules/11_discipline/components/8_AppealComplain/dialog/DialogEditStatus.vue";
|
||||
import config from "@/app.config";
|
||||
import http from "@/plugins/http";
|
||||
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
|
||||
const { showLoader, messageError, hideLoader, dialogConfirm } = mixin;
|
||||
const router = useRouter();
|
||||
const modalStatusEdit = ref<boolean>(false);
|
||||
/** stoer */
|
||||
const dataStore = useAppealComplainStore();
|
||||
const { fetchAppealComplain } = dataStore;
|
||||
const type = ref<DataOption[]>([
|
||||
{ id: "ALL", name: "ทั้งหมด" },
|
||||
...dataStore.typeOptions,
|
||||
]);
|
||||
const filterTable = ref<string>("");
|
||||
const filterKeyword = ref<string>("");
|
||||
|
||||
const dataRow = ref<RowList[]>([]);
|
||||
const currentPage = ref<number>(1);
|
||||
const maxPage = ref<number>(1);
|
||||
const page = ref<number>(1);
|
||||
const rowsPerPage = ref<number>(10);
|
||||
|
||||
/**
|
||||
*pagination ของตาราง
|
||||
*/
|
||||
const pagination = ref({
|
||||
descending: false,
|
||||
page: page.value,
|
||||
rowsPerPage: rowsPerPage.value,
|
||||
});
|
||||
|
||||
const formData = reactive<any>({
|
||||
type: "ALL",
|
||||
status: "",
|
||||
year: new Date().getFullYear().toString(),
|
||||
});
|
||||
|
||||
const visibleColumns = ref<string[]>([
|
||||
"no",
|
||||
"type",
|
||||
"title",
|
||||
"name",
|
||||
"idCard",
|
||||
"caseType",
|
||||
"caseNo",
|
||||
"dateEdit",
|
||||
"status",
|
||||
]);
|
||||
|
||||
// หัวตาราง
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "no",
|
||||
align: "center",
|
||||
label: "ลำดับ",
|
||||
sortable: false,
|
||||
field: "no",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "type",
|
||||
align: "left",
|
||||
label: "ประเภท",
|
||||
sortable: true,
|
||||
field: "type",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "title",
|
||||
align: "left",
|
||||
label: "เรื่องร้องเรียน",
|
||||
sortable: true,
|
||||
field: "title",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "name",
|
||||
align: "left",
|
||||
label: "ชื่อ-นามสกุล",
|
||||
sortable: true,
|
||||
field: "name",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "idCard",
|
||||
align: "left",
|
||||
label: "เลขประจำตัวประชาชน",
|
||||
sortable: true,
|
||||
field: "idCard",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "caseType",
|
||||
align: "left",
|
||||
label: "ประเภทคดี",
|
||||
sortable: true,
|
||||
field: "caseType",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "caseNo",
|
||||
align: "left",
|
||||
label: "คดีเลขที่",
|
||||
sortable: true,
|
||||
field: "caseNo",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "dateEdit",
|
||||
align: "left",
|
||||
label: "วันที่แก้ไข",
|
||||
sortable: true,
|
||||
field: "dateEdit",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "status",
|
||||
align: "left",
|
||||
label: "สถานะของคำร้อง",
|
||||
sortable: false,
|
||||
field: "status",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
]);
|
||||
|
||||
watch(
|
||||
() => currentPage.value,
|
||||
() => {
|
||||
rowsPerPage.value = pagination.value.rowsPerPage;
|
||||
// getList();
|
||||
}
|
||||
);
|
||||
|
||||
watch(
|
||||
() => pagination.value.rowsPerPage,
|
||||
() => {
|
||||
rowsPerPage.value = pagination.value.rowsPerPage;
|
||||
currentPage.value = 1;
|
||||
// getList();
|
||||
}
|
||||
);
|
||||
|
||||
// async function getList() {
|
||||
// showLoader();
|
||||
// await http
|
||||
// .get(
|
||||
// config.API.complaintList(
|
||||
// page.value,
|
||||
// rowsPerPage.value,
|
||||
// filterKeyword.value
|
||||
// )
|
||||
// )
|
||||
// //
|
||||
// .then((res) => {
|
||||
// maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value);
|
||||
// const data = res.data.result.data;
|
||||
// fetchAppealComplain(data);
|
||||
// })
|
||||
// .catch((e) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(() => {
|
||||
// hideLoader();
|
||||
// });
|
||||
// }
|
||||
|
||||
/** ไปยังหน้าเพิ่มข้อมูล */
|
||||
function redirectToPageadd() {
|
||||
router.push(`/discipline-appealcomplain/add`);
|
||||
}
|
||||
|
||||
function filterFn() {
|
||||
// getList();
|
||||
console.log("enter", filterKeyword.value);
|
||||
}
|
||||
|
||||
function openEditStatus(data: RowList[]) {
|
||||
modalStatusEdit.value = true;
|
||||
dataRow.value = data;
|
||||
}
|
||||
|
||||
function close() {
|
||||
modalStatusEdit.value = false;
|
||||
}
|
||||
|
||||
function editStatusReturn(data: any) {
|
||||
dialogConfirm($q, () => {
|
||||
console.log("saveStatus");
|
||||
modalStatusEdit.value = false;
|
||||
});
|
||||
console.log(data);
|
||||
}
|
||||
/** เรียกใช้งาน ฟังชั่น ตอนเริ่มโหลดหน้า */
|
||||
onMounted(async () => {
|
||||
// await getList();
|
||||
dataStore.visibleColumns = visibleColumns.value;
|
||||
dataStore.columns = columns.value;
|
||||
const data = [
|
||||
{
|
||||
id: "xxx-xxx-xxx",
|
||||
type: "อุทธรณ์",
|
||||
title: "โดนหัวหน้าตัดสินโดยไม่ยุติธรรม",
|
||||
prefix: "นาง",
|
||||
firstName: "สมใจ",
|
||||
lastName: "ดีใจ",
|
||||
idCard: "1234567890123",
|
||||
caseType: "YYYY",
|
||||
caseNo: "YYYY",
|
||||
dateEdit: new Date("2023-12-08T06:55:00"),
|
||||
status: "NEW",
|
||||
},
|
||||
];
|
||||
await fetchAppealComplain(data);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="toptitle text-dark col-12 row items-center">
|
||||
รายการอุทธรณ์ร้องทุกข์
|
||||
</div>
|
||||
<q-card flat bordered class="col-12 q-mt-sm q-pa-md">
|
||||
<div class="row q-mb-sm">
|
||||
<div>
|
||||
<q-btn
|
||||
id="addComplaints"
|
||||
for="addComplaints"
|
||||
size="12px"
|
||||
flat
|
||||
round
|
||||
color="primary"
|
||||
icon="mdi-plus"
|
||||
@click="redirectToPageadd()"
|
||||
><q-tooltip>เพิ่มการอุทธรณ์/ร้องทุกข์</q-tooltip></q-btn
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row col-12 q-col-gutter-sm q-mb-sm">
|
||||
<div class="col-2">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="formData.year"
|
||||
class="col-2"
|
||||
: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
|
||||
dense
|
||||
lazy-rules
|
||||
outlined
|
||||
:model-value="Number(formData.year) + 543"
|
||||
:label="`${'ปีงบประมาณ'}`"
|
||||
>
|
||||
<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-2">
|
||||
<q-select
|
||||
v-model="formData.type"
|
||||
label="ประเภท"
|
||||
dense
|
||||
outlined
|
||||
emit-value
|
||||
map-options
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
:options="type"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<q-select
|
||||
v-model="formData.status"
|
||||
label="สถานะ"
|
||||
dense
|
||||
outlined
|
||||
emit-value
|
||||
map-options
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
:options="dataStore.statusOptions"
|
||||
/>
|
||||
</div>
|
||||
<q-space />
|
||||
|
||||
<q-input
|
||||
class="col-xs-12 col-sm-3 col-md-2"
|
||||
id="filterTable"
|
||||
for="filterTable"
|
||||
dense
|
||||
outlined
|
||||
v-model="filterKeyword"
|
||||
label="ค้นหา"
|
||||
debounce="300"
|
||||
@keydown.enter.prevent="filterFn"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon name="search" />
|
||||
</template>
|
||||
</q-input>
|
||||
|
||||
<q-select
|
||||
id="visibleColumns"
|
||||
for="visibleColumns"
|
||||
v-model="dataStore.visibleColumns"
|
||||
multiple
|
||||
outlined
|
||||
dense
|
||||
options-dense
|
||||
:display-value="$q.lang.table.columns"
|
||||
emit-value
|
||||
map-options
|
||||
:options="dataStore.columns"
|
||||
option-value="name"
|
||||
options-cover
|
||||
class="col-xs-12 col-sm-3 col-md-2"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<d-table
|
||||
ref="table"
|
||||
:columns="dataStore.columns"
|
||||
:rows="dataStore.rows"
|
||||
:filter="filterKeyword"
|
||||
row-key="interrogated"
|
||||
flat
|
||||
bordered
|
||||
:paging="true"
|
||||
dense
|
||||
class="custom-header-table"
|
||||
:visible-columns="dataStore.visibleColumns"
|
||||
v-model:pagination="pagination"
|
||||
:rows-per-page-options="[10, 25, 50, 100]"
|
||||
>
|
||||
<template v-slot:pagination="scope">
|
||||
<q-pagination
|
||||
v-model="currentPage"
|
||||
active-color="primary"
|
||||
color="dark"
|
||||
:max="Number(maxPage)"
|
||||
size="sm"
|
||||
boundary-links
|
||||
direction-links
|
||||
></q-pagination>
|
||||
</template>
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
<q-th
|
||||
v-for="col in props.cols"
|
||||
:key="col.name"
|
||||
:props="props"
|
||||
style="color: #000000; font-weight: 500"
|
||||
>
|
||||
<span class="text-weight-medium">{{ col.label }}</span>
|
||||
</q-th>
|
||||
<q-th auto-width></q-th>
|
||||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:body="props">
|
||||
<q-tr :props="props" class="cursor-pointer">
|
||||
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
||||
<div v-if="col.name == 'no'">
|
||||
{{ props.rowIndex + 1 }}
|
||||
</div>
|
||||
<div>
|
||||
{{ col.value }}
|
||||
</div>
|
||||
</q-td>
|
||||
<td auto-width>
|
||||
<q-btn
|
||||
icon="mdi-dots-vertical"
|
||||
size="12px"
|
||||
color="grey-7"
|
||||
flat
|
||||
round
|
||||
dense
|
||||
@click.stop
|
||||
>
|
||||
<q-menu transition-show="jump-down" transition-hide="jump-up">
|
||||
<q-list dense style="min-width: auto">
|
||||
<q-item clickable @click="openEditStatus(props.row)">
|
||||
<q-item-section
|
||||
style="min-width: 0px"
|
||||
avatar
|
||||
class="q-py-sm"
|
||||
>
|
||||
<q-tooltip>แก้ไขสถานะ</q-tooltip>
|
||||
<q-icon color="primary" size="xs" name="mdi-pencil" />
|
||||
</q-item-section>
|
||||
<q-item-section>แก้ไขสถานะ</q-item-section>
|
||||
</q-item>
|
||||
<q-item clickable v-close-popup>
|
||||
<q-item-section
|
||||
style="min-width: 0px"
|
||||
avatar
|
||||
class="q-py-sm"
|
||||
>
|
||||
<q-tooltip>แก้ไขคำร้อง</q-tooltip>
|
||||
<q-icon color="primary" size="xs" name="mdi-pencil" />
|
||||
</q-item-section>
|
||||
<q-item-section>แก้ไขคำร้อง</q-item-section>
|
||||
</q-item>
|
||||
<q-item clickable v-close-popup>
|
||||
<q-item-section
|
||||
style="min-width: 0px"
|
||||
avatar
|
||||
class="q-py-sm"
|
||||
>
|
||||
<q-tooltip>ดูรายละเอียดคำร้อง</q-tooltip>
|
||||
<q-icon
|
||||
color="blue"
|
||||
size="xs"
|
||||
name="mdi-information-outline"
|
||||
/>
|
||||
</q-item-section>
|
||||
<q-item-section>ดูรายละเอียดคำร้อง</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-menu>
|
||||
</q-btn>
|
||||
</td>
|
||||
</q-tr>
|
||||
</template>
|
||||
</d-table>
|
||||
</div>
|
||||
</q-card>
|
||||
|
||||
<DialogStatus
|
||||
:modal="modalStatusEdit"
|
||||
:data="dataRow"
|
||||
:close="close"
|
||||
@editStatusReturn="editStatusReturn"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
@ -0,0 +1,159 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, defineProps, watch, reactive } from "vue";
|
||||
import { useAppealComplainStore } from "@/modules/11_discipline/store/AppealComplainStore";
|
||||
import type { EditStatusRef } from "@/modules/11_discipline/interface/response/appealComplain";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
const $q = useQuasar();
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const { dialogConfirm } = mixin;
|
||||
const dataStore = useAppealComplainStore();
|
||||
|
||||
interface status {
|
||||
status: string;
|
||||
reason: string;
|
||||
}
|
||||
|
||||
/** ตัวแปร validate */
|
||||
const reasonRef = ref<Object | null>(null);
|
||||
const statusRef = ref<Object | null>(null);
|
||||
|
||||
const objectEditStatus: EditStatusRef = {
|
||||
reason: reasonRef,
|
||||
status: statusRef,
|
||||
};
|
||||
|
||||
const formData = reactive<status>({
|
||||
status: "",
|
||||
reason: "",
|
||||
});
|
||||
|
||||
const props = defineProps({
|
||||
modal: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default: {},
|
||||
},
|
||||
close: {
|
||||
type: Function,
|
||||
default: () => "",
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(["editStatusReturn"]);
|
||||
|
||||
function clickClose() {
|
||||
props.close();
|
||||
}
|
||||
|
||||
/*** ฟังก์ชั่นสำหรับ validate ฟอร์ม */
|
||||
function validateForm() {
|
||||
console.log("1");
|
||||
const hasError = [];
|
||||
for (const key in objectEditStatus) {
|
||||
if (Object.prototype.hasOwnProperty.call(objectEditStatus, key)) {
|
||||
const property = objectEditStatus[key];
|
||||
if (property.value && typeof property.value.validate === "function") {
|
||||
const isValid = property.value.validate();
|
||||
hasError.push(isValid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hasError.every((result) => result === true)) {
|
||||
emit("editStatusReturn", formData);
|
||||
} else {
|
||||
console.log("ไม่ผ่าน ");
|
||||
console.log(hasError);
|
||||
}
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
async () => {
|
||||
console.log("add");
|
||||
},
|
||||
"ยืนยันการบันทึกข้อมูล",
|
||||
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
|
||||
);
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.data,
|
||||
() => {
|
||||
formData.status = props.data.status;
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<q-dialog v-model="props.modal" persistent>
|
||||
<q-card style="min-width: 30vw">
|
||||
<form @submit.prevent="validateForm">
|
||||
<q-toolbar>
|
||||
<q-toolbar-title class="text-subtitle2 text-bold">
|
||||
{{ `แก้ไขสถานะ ${props.data.name}` }}
|
||||
</q-toolbar-title>
|
||||
<q-btn
|
||||
icon="close"
|
||||
unelevated
|
||||
round
|
||||
dense
|
||||
@click="clickClose"
|
||||
style="color: #ff8080; background-color: #ffdede"
|
||||
/>
|
||||
</q-toolbar>
|
||||
<q-separator />
|
||||
<q-card-section class="q-pa-md bg-grey-1">
|
||||
<div class="q-gutter-sm">
|
||||
<q-select
|
||||
ref="statusRef"
|
||||
v-model="props.data.status"
|
||||
label="สถานะ"
|
||||
dense
|
||||
bg-color="white"
|
||||
outlined
|
||||
emit-value
|
||||
:rules="[(val) => !!val || `${'กรุณาเลือกสถานะ'}`]"
|
||||
map-options
|
||||
hide-bottom-space
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
:options="dataStore.statusOptions"
|
||||
/>
|
||||
<q-input
|
||||
ref="reasonRef"
|
||||
v-model="formData.reason"
|
||||
dense
|
||||
outlined
|
||||
:rules="[(val) => !!val || `${'กรุณากรอกเหตุผล'}`]"
|
||||
bg-color="white"
|
||||
type="textarea"
|
||||
label="เหตุผล"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-separator />
|
||||
|
||||
<div class="row justify-end q-px-md q-py-sm items-center">
|
||||
<q-btn
|
||||
dense
|
||||
color="public"
|
||||
id="onSubmit"
|
||||
type="submit"
|
||||
class="q-px-md q-py-xs"
|
||||
label="บันทึก"
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
interface MainList {
|
||||
id: string
|
||||
type: string
|
||||
title: string
|
||||
prefix: string
|
||||
firstName: string
|
||||
lastName: string
|
||||
idCard: string
|
||||
caseType: string
|
||||
caseNo: string
|
||||
dateEdit: Date
|
||||
status: string
|
||||
}
|
||||
|
||||
interface RowList {
|
||||
id: string
|
||||
type: string
|
||||
title: string
|
||||
name: string
|
||||
prefix: string
|
||||
firstName: string
|
||||
lastName: string
|
||||
idCard: string
|
||||
caseType: string
|
||||
caseNo: string
|
||||
dateEdit: string | null
|
||||
status: string
|
||||
}
|
||||
|
||||
interface MyObjectAppealRef {
|
||||
complaint: object | null;
|
||||
complaintdetail: object | null;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
interface EditStatusRef {
|
||||
reason: object | null;
|
||||
status: object | null;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export type { MainList, RowList , MyObjectAppealRef ,EditStatusRef};
|
||||
|
|
@ -68,6 +68,8 @@ const listSuspendMainPage = () =>
|
|||
const suspendEditPage = () =>
|
||||
import("@/modules/11_discipline/components/7_ListSuspend/DetailPage.vue");
|
||||
|
||||
const appealComplain = () => import('@/modules/11_discipline/components/8_AppealComplain/MainPage.vue')
|
||||
const appealComplainAdd = () => import('@/modules/11_discipline/components/8_AppealComplain/AddPage.vue')
|
||||
export default [
|
||||
{
|
||||
path: "/discipline/complaints",
|
||||
|
|
@ -280,6 +282,26 @@ export default [
|
|||
Role: "discipline",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/discipline-appealcomplain",
|
||||
name: "appealComplain",
|
||||
component: appealComplain,
|
||||
meta: {
|
||||
Auth: true,
|
||||
Key: [11.4],
|
||||
Role: "discipline",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/discipline-appealcomplain/add",
|
||||
name: "appealComplainAdd",
|
||||
component: appealComplainAdd,
|
||||
meta: {
|
||||
Auth: true,
|
||||
Key: [11.4],
|
||||
Role: "discipline",
|
||||
},
|
||||
},
|
||||
|
||||
// {
|
||||
// path: "/discipline-order",
|
||||
|
|
|
|||
96
src/modules/11_discipline/store/AppealComplainStore.ts
Normal file
96
src/modules/11_discipline/store/AppealComplainStore.ts
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { ref } from "vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import type { QTableProps } from "quasar";
|
||||
import type { DataOption } from '@/modules/11_discipline/interface/index/Main'
|
||||
import type { MainList, RowList } from '@/modules/11_discipline/interface/response/appealComplain'
|
||||
|
||||
export const useAppealComplainStore = defineStore(
|
||||
"AppealComplainStore",
|
||||
() => {
|
||||
const rows = ref<RowList[]>([]);
|
||||
const visibleColumns = ref<string[]>([]);
|
||||
const columns = ref<QTableProps["columns"]>([]);
|
||||
|
||||
const mixin = useCounterMixin()
|
||||
const { date2Thai } = mixin
|
||||
function fetchAppealComplain(data: MainList[]) {
|
||||
let dataList: RowList[] = data.map((e: MainList) => ({
|
||||
id: e.id,
|
||||
type: e.type,
|
||||
title: e.title,
|
||||
name: `${e.prefix}${e.firstName} ${e.lastName}`,
|
||||
prefix: e.prefix,
|
||||
firstName: e.firstName,
|
||||
lastName: e.lastName,
|
||||
idCard: e.idCard,
|
||||
caseType: e.caseType,
|
||||
caseNo: e.caseNo,
|
||||
dateEdit: date2Thai(e.dateEdit),
|
||||
status: statusTothai(e.status),
|
||||
}));
|
||||
rows.value = dataList;
|
||||
}
|
||||
|
||||
const statusTothai = (val: string) => {
|
||||
switch (val) {
|
||||
case "NEW":
|
||||
return "ใหม่";
|
||||
case "STOP":
|
||||
return "ยุติเรื่อง";
|
||||
case "SEND_INVESTIGATE":
|
||||
return "มีมูลส่งไปสืบสวนแล้ว";
|
||||
default:
|
||||
return "-";
|
||||
}
|
||||
};
|
||||
|
||||
const typeOptions = ref<DataOption[]>([
|
||||
{ id: "APPEAL", name: "อุทธรณ์" },
|
||||
{ id: "COMPLAIN", name: "ร้องทุกข์" },
|
||||
]);
|
||||
const fiscalyearOP = ref<DataOption[]>([
|
||||
{ id: "0", name: "ทั้งหมด" },
|
||||
])
|
||||
|
||||
const statusOptions = ref<DataOption[]>([
|
||||
{ id: "NEW", name: "ใหม่" },
|
||||
{ id: "xx1", name: "ได้รับเอกสารแล้ว" },
|
||||
{ id: "xx2", name: "รับอุทธรณ์/ร้องทุกข์" },
|
||||
{ id: "xx3", name: "ไม่รับอุทธรณ์/ร้องทุกข์" },
|
||||
{ id: "xx4", name: "ตั้งองค์คณะวินิจฉัย" },
|
||||
{ id: "xx5", name: "สรุปผลการพิจารณา" },
|
||||
{ id: "xx6", name: "ปิดคำร้อง" },
|
||||
]);
|
||||
|
||||
// function filterSelector(val: string, update: Function, type: string) {
|
||||
// update(() => {
|
||||
// const needle = val.toLowerCase();
|
||||
// if (type === "yearSelect") {
|
||||
// complainantoptions.value = mainStore.complainantoptionsMain.filter(
|
||||
// (v: any) => v.name.toLowerCase().indexOf(needle) > -1
|
||||
// );
|
||||
// } else if (type === "filteragencytoptions") {
|
||||
// agencytoptions.value = consideredAgencytoptions.value.filter(
|
||||
// (v: any) => v.name.toLowerCase().indexOf(needle) > -1
|
||||
// );
|
||||
// } else if (type === "filtercomplainantOP") {
|
||||
// optionListName.value = optionListNameMain.value.filter(
|
||||
// (v: any) => v.name.toLowerCase().indexOf(needle) > -1
|
||||
// );
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
return {
|
||||
rows,
|
||||
visibleColumns,
|
||||
columns,
|
||||
fetchAppealComplain,
|
||||
// filterSelector,
|
||||
typeOptions,
|
||||
statusOptions,
|
||||
fiscalyearOP,
|
||||
};
|
||||
}
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue