ต่อ api
This commit is contained in:
parent
14c232d589
commit
e6d81b55da
9 changed files with 249 additions and 141 deletions
|
|
@ -12,7 +12,9 @@ export default {
|
|||
/**ลบ ช่องทางการร้องเรียน
|
||||
* @param id type
|
||||
*/
|
||||
complaintChannelbyId:(id:string) => `${discipline}/complaint_Channel/${id}`
|
||||
complaintChannelbyId:(id:string) => `${discipline}/complaint_Channel/${id}`,
|
||||
|
||||
complaintAdd:() => `${discipline}/complaint`,
|
||||
complaintList:(page:number,pageSize:number,keyword:string) => `${discipline}/complaint?page=${page}&pageSize=${pageSize}&keyword=${keyword}`,
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,13 +1,30 @@
|
|||
<script setup lang="ts">
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import Form from "@/modules/11_discipline/components/1_Complaint/Form.vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import config from "@/app.config";
|
||||
import http from "@/plugins/http";
|
||||
|
||||
const $q = useQuasar()
|
||||
const mixin = useCounterMixin()
|
||||
|
||||
const { showLoader,hideLoader } = mixin
|
||||
const router = useRouter();
|
||||
|
||||
/** บันทึกข้อมูล */
|
||||
async function onSubmit () {
|
||||
async function onSubmit (data:any) {
|
||||
/** post */
|
||||
console.log("add");
|
||||
showLoader()
|
||||
http
|
||||
.post(config.API.complaintAdd(),
|
||||
data
|
||||
).then((res)=>{
|
||||
console.log(res)
|
||||
}).catch(()=>{})
|
||||
.finally(()=>{})
|
||||
console.log("add",data);
|
||||
router.push(`/discipline/complaints`);
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ import { useCounterMixin } from "@/stores/mixin";
|
|||
import { useComplainstDataStore } from "@/modules/11_discipline/store/ComplaintsStore";
|
||||
|
||||
import DialogAddPersonal from "@/components/Dialogs/AddPersonal.vue";
|
||||
import config from "@/app.config";
|
||||
import http from "@/plugins/http";
|
||||
|
||||
const $q = useQuasar();
|
||||
const router = useRouter();
|
||||
|
|
@ -32,7 +34,7 @@ const { selectComplainantTpye, filterSelector } = complainstStore; // function
|
|||
/** validateForm */
|
||||
const respondentTypeRef = ref<Object | null>(null);
|
||||
const complainantRef = ref<Object | null>(null);
|
||||
const officeRef = ref<Object | null>(null);
|
||||
const organizationIdRef = ref<Object | null>(null);
|
||||
const consideredAgencyRef = ref<Object | null>(null);
|
||||
const titleRef = ref<Object | null>(null);
|
||||
const descriptionRef = ref<Object | null>(null);
|
||||
|
|
@ -57,16 +59,6 @@ const props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
/** ข้อมูล form*/
|
||||
const personOj = reactive<ArrayPerson>({
|
||||
idcard: "",
|
||||
name: "",
|
||||
positionNo: "",
|
||||
position: "",
|
||||
positionLevel: "",
|
||||
salary: "",
|
||||
organization: "",
|
||||
});
|
||||
|
||||
const fileListOj = reactive<ArrayFileList>({
|
||||
id: "",
|
||||
|
|
@ -77,7 +69,7 @@ const fileListOj = reactive<ArrayFileList>({
|
|||
|
||||
const formData = reactive<FormData>({
|
||||
respondentType: "",
|
||||
office: "",
|
||||
organizationId: null,
|
||||
consideredAgency: "",
|
||||
title: "",
|
||||
description: "",
|
||||
|
|
@ -90,17 +82,14 @@ const formData = reactive<FormData>({
|
|||
appellant: "",
|
||||
documentFile: null,
|
||||
complaintStatus: "",
|
||||
persons: [personOj],
|
||||
personId: [],
|
||||
organizationId: null,
|
||||
respondentId: [],
|
||||
fileList: [fileListOj],
|
||||
persons: [],
|
||||
fileList:fileList.value?? null
|
||||
});
|
||||
|
||||
/** maping ref เข้าตัวแปรเพื่อเตรียมตรวจสอบ */
|
||||
const objectComplaintsRef: MyObjectComplaintsRef = {
|
||||
respondentType: respondentTypeRef,
|
||||
office: officeRef,
|
||||
organizationId: organizationIdRef,
|
||||
consideredAgency: consideredAgencyRef,
|
||||
title: titleRef,
|
||||
description: descriptionRef,
|
||||
|
|
@ -227,7 +216,7 @@ const visibleColumns = ref<string[]>([
|
|||
* @param val บุคคล หน่วยงาน กทม
|
||||
*/
|
||||
async function selectComplainant(val: string) {
|
||||
formData.office = "";
|
||||
formData.organizationId = "";
|
||||
formData.consideredAgency = "";
|
||||
if (val === "0") {
|
||||
await fetchListname(); // ถ้าเลือกบุกคลจะเรียก function fetchListname เรียกรายชื่อจากทะเบียน
|
||||
|
|
@ -316,7 +305,7 @@ function onSubmit() {
|
|||
$q,
|
||||
async () => {
|
||||
console.log(formData);
|
||||
props.onSubmit();
|
||||
props.onSubmit(formData);
|
||||
},
|
||||
"ยืนยันการบันทึกข้อมูล",
|
||||
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
|
||||
|
|
@ -394,7 +383,7 @@ function confirmDelete(id: string) {
|
|||
*/
|
||||
watch(props.data, async () => {
|
||||
formData.respondentType = props.data.respondentType;
|
||||
formData.office = props.data.office;
|
||||
formData.organizationId = props.data.organizationId;
|
||||
formData.consideredAgency = props.data.consideredAgency;
|
||||
formData.title = props.data.title;
|
||||
formData.description = props.data.description;
|
||||
|
|
@ -417,9 +406,19 @@ watch(props.data, async () => {
|
|||
*/
|
||||
function handleSave(returnData: any) {
|
||||
console.log("returnData:", returnData);
|
||||
formData.persons = returnData
|
||||
}
|
||||
|
||||
function getOc(){
|
||||
http
|
||||
.get(config.API.typeOc())
|
||||
.then((res)=>{
|
||||
const data = res.data.result
|
||||
complainstStore.ocListFn(data)
|
||||
})
|
||||
}
|
||||
onMounted(() => {
|
||||
getOc()
|
||||
complainstStore.columns = columns.value;
|
||||
complainstStore.visibleColumns = visibleColumns.value;
|
||||
});
|
||||
|
|
@ -469,12 +468,12 @@ onMounted(() => {
|
|||
<div
|
||||
class="col-xs-12 col-sm-3"
|
||||
v-if="formData.respondentType === 'ORGANIZATION'"
|
||||
id="office"
|
||||
id="organizationId"
|
||||
>
|
||||
<q-select
|
||||
for="inputOffice"
|
||||
name="office"
|
||||
ref="officeRef"
|
||||
name="organizationId"
|
||||
ref="organizationIdRef"
|
||||
dense
|
||||
hide-bottom-space
|
||||
:readonly="
|
||||
|
|
@ -486,8 +485,8 @@ onMounted(() => {
|
|||
option-value="id"
|
||||
emit-value
|
||||
map-options
|
||||
v-model="formData.office"
|
||||
:options="complainstStore.officeOp"
|
||||
v-model="formData.organizationId"
|
||||
:options="complainstStore.organizationIdOp"
|
||||
label="เลือกสำนักงาน"
|
||||
:rules="[(val) => !!val || `${'กรุณาเลือกสำนักงาน'}`]"
|
||||
lazy-rules
|
||||
|
|
|
|||
|
|
@ -1,14 +1,22 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted } from "vue";
|
||||
import { ref, onMounted, watch } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
|
||||
import { useQuasar } from "quasar";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
// import type
|
||||
import type { DataList } from "@/modules/11_discipline/interface/response/complaint";
|
||||
// importStroe
|
||||
import { useComplainstDataStore } from "@/modules/11_discipline/store/ComplaintsStore";
|
||||
// impoet Components
|
||||
import TableComplaint from "@/modules/11_discipline/components/1_Complaint/TableComplaint.vue";
|
||||
import config from "@/app.config";
|
||||
import http from "@/plugins/http";
|
||||
import { max } from "moment";
|
||||
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
|
||||
const { showLoader, messageError, hideLoader } = mixin;
|
||||
const router = useRouter();
|
||||
|
||||
/** stoer */
|
||||
|
|
@ -16,54 +24,55 @@ const complainstStore = useComplainstDataStore();
|
|||
const { fetchComplainst } = complainstStore;
|
||||
|
||||
const filterTable = ref<string>("");
|
||||
const filterKeyword = ref<string>("");
|
||||
const maxPage = ref<number>(1);
|
||||
const page = ref<number>(1);
|
||||
const rowsPerPage = ref<number>(10);
|
||||
|
||||
/**เรีนกรายการเรื่องร้องเรียน */
|
||||
async function fetchListComplaints() {
|
||||
const listData: DataList[] = [
|
||||
{
|
||||
id: "001",
|
||||
title: "ทุจริตในหน้าที่",
|
||||
description: "มีข้อร้องเรียนเรื่องการทุจริตทางการเงิน",
|
||||
respondent: "นางศิรินภา คงน้อย",
|
||||
descMistake: "ร้ายแรง",
|
||||
createdAt: new Date("2023-12-01"),
|
||||
devLevel: "ด่วนมาก",
|
||||
considerationDate: new Date("2023-12-02"),
|
||||
complaintStatus: 'NEW',
|
||||
},
|
||||
{
|
||||
id: "002",
|
||||
title: "ทุจริตในหน้าที่",
|
||||
description: "มีข้อร้องเรียนเรื่องการทุจริตทางการเงิน",
|
||||
respondent: "นายแก้ว คำ",
|
||||
descMistake: "ร้ายแรง",
|
||||
createdAt: new Date("2023-12-01"),
|
||||
devLevel: "ด่วนมาก",
|
||||
considerationDate: new Date("2023-12-02"),
|
||||
complaintStatus: 'STOP',
|
||||
},
|
||||
{
|
||||
id: "003",
|
||||
title: "ทุจริตในหน้าที่",
|
||||
description:"มีข้อร้องเรียนเรื่องการทุจริตทางการเงิน มีข้อร้องเรียนเรื่องการทุจริตทางการเงิน มีข้อร้องเรียนเรื่องการทุจริตทางการเงิน มีข้อร้องเรียนเรื่องการทุจริตทางการเงิน มีข้อร้องเรียนเรื่องการทุจริตทางการเงิน มีข้อร้องเรียนเรื่องการทุจริตทางการเงิน มีข้อร้องเรียนเรื่องการทุจริตทางการเงิน มีข้อร้องเรียนเรื่องการทุจริตทางการเงิน มีข้อร้องเรียนเรื่องการทุจริตทางการเงิน มีข้อร้องเรียนเรื่องการทุจริตทางการเงิน มีข้อร้องเรียนเรื่องการทุจริตทางการเงิน",
|
||||
respondent: "นายภัทรานุย คงนอย",
|
||||
descMistake: "ร้ายแรง",
|
||||
createdAt: new Date("2023-12-01"),
|
||||
devLevel: "ด่วนมาก",
|
||||
considerationDate: new Date("2023-12-02"),
|
||||
complaintStatus: 'SEND_INVESTIGATE',
|
||||
},
|
||||
];
|
||||
await fetchComplainst(listData);
|
||||
async function updatePagingProp(rowPerpage:number,pageCurrent:number) {
|
||||
rowsPerPage.value = rowPerpage
|
||||
page.value = pageCurrent
|
||||
await 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;
|
||||
fetchComplainst(data);
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/** ไปยังหน้าเพิ่มข้อมูล */
|
||||
function redirectToPageadd() {
|
||||
router.push(`/discipline/complaints/add`);
|
||||
}
|
||||
|
||||
function filterFn() {
|
||||
getList();
|
||||
console.log("enter", filterKeyword.value);
|
||||
}
|
||||
|
||||
/** เรียกใช้งาน ฟังชั่น ตอนเริ่มโหลดหน้า */
|
||||
onMounted(async () => {
|
||||
await fetchListComplaints();
|
||||
await getList();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
@ -86,22 +95,23 @@ onMounted(async () => {
|
|||
</div>
|
||||
|
||||
<q-space />
|
||||
|
||||
|
||||
<q-input
|
||||
class="col-xs-12 col-sm-3 col-md-2"
|
||||
id="filterTable"
|
||||
for="filterTable"
|
||||
dense
|
||||
outlined
|
||||
v-model="filterTable"
|
||||
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"
|
||||
|
|
@ -121,7 +131,13 @@ onMounted(async () => {
|
|||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<TableComplaint :filterTable="filterTable" />
|
||||
<TableComplaint
|
||||
:filterTable="filterTable"
|
||||
:rowsPerPage="rowsPerPage"
|
||||
:page="page"
|
||||
:maxPage="maxPage"
|
||||
@update:pagination="updatePagingProp"
|
||||
/>
|
||||
</div>
|
||||
</q-card>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted } from "vue";
|
||||
import { ref, onMounted, watch } from "vue";
|
||||
// import type
|
||||
import type { QTableProps } from "quasar";
|
||||
// importStroe
|
||||
import { useComplainstDataStore } from "@/modules/11_discipline/store/ComplaintsStore";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
|
||||
const currentPage = ref<number>(1);
|
||||
const router = useRouter();
|
||||
const complainstStore = useComplainstDataStore();
|
||||
|
||||
|
|
@ -15,8 +15,22 @@ const props = defineProps({
|
|||
type: String,
|
||||
default: "",
|
||||
},
|
||||
maxPage: {
|
||||
type: Number,
|
||||
require: true,
|
||||
},
|
||||
rowsPerPage: {
|
||||
type: Number,
|
||||
require: true,
|
||||
},
|
||||
page: {
|
||||
type: Number,
|
||||
require: true,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(["update:pagination"]);
|
||||
|
||||
/** หัวตาราง */
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
|
|
@ -47,20 +61,20 @@ const columns = ref<QTableProps["columns"]>([
|
|||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "respondent",
|
||||
name: "appellant",
|
||||
align: "left",
|
||||
label: "ผู้ถูกร้องเรียน",
|
||||
sortable: true,
|
||||
field: "respondent",
|
||||
field: "appellant",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "descMistake",
|
||||
name: "offenseDetails",
|
||||
align: "left",
|
||||
label: "ลักษณะความผิด",
|
||||
sortable: true,
|
||||
field: "descMistake",
|
||||
field: "offenseDetails",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
|
|
@ -74,29 +88,29 @@ const columns = ref<QTableProps["columns"]>([
|
|||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "devLevel",
|
||||
name: "levelConsideration",
|
||||
align: "left",
|
||||
label: "ระดับการพิจารณา",
|
||||
sortable: true,
|
||||
field: "devLevel",
|
||||
field: "levelConsideration",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "considerationDate",
|
||||
name: "dateConsideration",
|
||||
align: "left",
|
||||
label: "วันที่กำหนดพิจารณา",
|
||||
sortable: true,
|
||||
field: "considerationDate",
|
||||
field: "dateConsideration",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "complaintStatus",
|
||||
name: "status",
|
||||
align: "left",
|
||||
label: "สถานะเรื่องร้องเรียน",
|
||||
sortable: true,
|
||||
field: "complaintStatus",
|
||||
field: "status",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
|
|
@ -107,12 +121,12 @@ const visibleColumns = ref<string[]>([
|
|||
"no",
|
||||
"title",
|
||||
"description",
|
||||
"respondent",
|
||||
"descMistake",
|
||||
"appellant",
|
||||
"offenseDetails",
|
||||
"createdAt",
|
||||
"devLevel",
|
||||
"considerationDate",
|
||||
'complaintStatus'
|
||||
"levelConsideration",
|
||||
"dateConsideration",
|
||||
"status",
|
||||
]);
|
||||
|
||||
/** เริ่มโหลดหน้า page เอาข้อมูลไปเก็บ ใน store*/
|
||||
|
|
@ -124,17 +138,37 @@ onMounted(() => {
|
|||
/** แสดงจำนวนในตาราง */
|
||||
const pagination = ref({
|
||||
descending: true,
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
page: Number(props.page),
|
||||
rowsPerPage: props.rowsPerPage,
|
||||
});
|
||||
/**
|
||||
* ฟังชั่นสำหรับ เปลี่ยน route ตาม id ที่รับมา
|
||||
* @param id ไอดีระบุ
|
||||
*/
|
||||
function OpenEdit(id:string){
|
||||
console.log(id)
|
||||
router.push(`/discipline/complaints/${id}`)
|
||||
function OpenEdit(id: string) {
|
||||
console.log(id);
|
||||
router.push(`/discipline/complaints/${id}`);
|
||||
}
|
||||
|
||||
const updateProp = (newPagination: any, page: number) => {
|
||||
// ส่ง event ไปยัง parent component เพื่ออัพเดทค่า props
|
||||
emit("update:pagination", newPagination, page);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => currentPage.value,
|
||||
() => {
|
||||
updateProp(pagination.value.rowsPerPage, currentPage.value);
|
||||
}
|
||||
);
|
||||
|
||||
watch(
|
||||
() => pagination.value.rowsPerPage,
|
||||
() => {
|
||||
currentPage.value = 1;
|
||||
updateProp(pagination.value.rowsPerPage, currentPage.value);
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -153,6 +187,17 @@ function OpenEdit(id:string){
|
|||
:visible-columns="complainstStore.visibleColumns"
|
||||
v-model:pagination="pagination"
|
||||
>
|
||||
<template v-slot:pagination="scope">
|
||||
<q-pagination
|
||||
v-model="currentPage"
|
||||
active-color="primary"
|
||||
color="dark"
|
||||
:max="Number(props.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">
|
||||
|
|
@ -162,10 +207,15 @@ function OpenEdit(id:string){
|
|||
</template>
|
||||
<template v-slot:body="props">
|
||||
<q-tr :props="props" class="cursor-pointer" style="height: 40px">
|
||||
<q-td v-for="col in props.cols" :key="col.name" :props="props" @click="OpenEdit(props.row.id)">
|
||||
<q-td
|
||||
v-for="col in props.cols"
|
||||
:key="col.name"
|
||||
:props="props"
|
||||
@click="OpenEdit(props.row.id)"
|
||||
>
|
||||
<div v-if="col.name == 'no'">
|
||||
{{ props.rowIndex + 1 }}
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="col.name == 'description'">
|
||||
<div class="table_ellipsis">
|
||||
{{ props.row.description }}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ const {
|
|||
const currentPage = ref<number>(1);
|
||||
const maxPage = ref<number>(1);
|
||||
const page = ref<number>(1);
|
||||
const rowsPerPage = ref<number>(1);
|
||||
const rowsPerPage = ref<number>(10);
|
||||
|
||||
/**
|
||||
*pagination ของตาราง
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
interface FormData {
|
||||
respondentType: string
|
||||
office: string
|
||||
consideredAgency: string
|
||||
title: string
|
||||
description: string
|
||||
|
|
@ -13,21 +12,22 @@ interface FormData {
|
|||
appellant: string
|
||||
documentFile: any | null
|
||||
complaintStatus: string
|
||||
persons: ArrayPerson[]
|
||||
personId: any
|
||||
persons: object|null
|
||||
organizationId:string|null
|
||||
respondentId:any
|
||||
fileList:ArrayFileList[]
|
||||
fileList:object|null
|
||||
}
|
||||
|
||||
interface ArrayPerson {
|
||||
idcard: string,
|
||||
name: string,
|
||||
positionNo: string,
|
||||
position: string,
|
||||
positionLevel: string,
|
||||
salary: string,
|
||||
organization: string,
|
||||
personId: string,//id อ้างอิง profile
|
||||
idcard: string,//รหัสบัตรประชาชน
|
||||
prefix: string,//คำนำหน้า
|
||||
firstName: string,//ชื่อ
|
||||
lastName: string,//นามสกุล
|
||||
posNo: string,//เลขที่ตำแหน่ง
|
||||
position: string,//ตำแหน่ง
|
||||
positionLevel: string,//ระดับ
|
||||
salary: number,//เงินเดือน
|
||||
organization: string,//สังกัด
|
||||
}
|
||||
interface ArrayFileList {
|
||||
id:string
|
||||
|
|
@ -37,7 +37,7 @@ interface ArrayFileList {
|
|||
}
|
||||
interface MyObjectComplaintsRef {
|
||||
respondentType: object | null;
|
||||
office: object | null;
|
||||
organizationId: object | null;
|
||||
consideredAgency: object | null;
|
||||
title: object | null;
|
||||
description: object | null;
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@ interface DataListRow {
|
|||
id:string
|
||||
title: string
|
||||
description: string
|
||||
respondent: string
|
||||
descMistake: string
|
||||
appellant: string
|
||||
offenseDetails: string
|
||||
createdAt: string
|
||||
devLevel: string
|
||||
considerationDate: string
|
||||
complaintStatus: string
|
||||
levelConsideration: string
|
||||
dateConsideration: string
|
||||
status: string
|
||||
}
|
||||
interface DataAdd {
|
||||
id:string
|
||||
|
|
@ -33,19 +33,23 @@ interface DataList {
|
|||
id:string
|
||||
title: string
|
||||
description: string
|
||||
respondent: string
|
||||
descMistake: string
|
||||
appellant: string
|
||||
offenseDetails: string
|
||||
createdAt: Date
|
||||
devLevel: string
|
||||
considerationDate: Date
|
||||
complaintStatus: string
|
||||
levelConsideration: string
|
||||
dateConsideration: Date
|
||||
status: string
|
||||
}
|
||||
|
||||
|
||||
interface ocListType{
|
||||
organizationId:string
|
||||
organizationName:string
|
||||
}
|
||||
|
||||
export type {
|
||||
DataList,
|
||||
DataListRow,
|
||||
DataAdd,
|
||||
DataAddResponse
|
||||
DataAddResponse,
|
||||
ocListType
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@ import { ref } from "vue";
|
|||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
import type { DataOption } from "@/modules/11_discipline/interface/index/Main";
|
||||
import type { DataList, DataListRow, DataAdd, DataAddResponse } from "@/modules/11_discipline/interface/response/complaint"
|
||||
import type { DataList, DataListRow, DataAdd, DataAddResponse,ocListType } from "@/modules/11_discipline/interface/response/complaint"
|
||||
import type { QTableProps } from "quasar";
|
||||
|
||||
const mixin = useCounterMixin()
|
||||
|
|
@ -48,12 +48,12 @@ export const useComplainstDataStore = defineStore("DisciplineComplainst", () =>
|
|||
id: e.id,
|
||||
title: e.title,
|
||||
description: e.description,
|
||||
respondent: e.respondent,
|
||||
descMistake: e.descMistake,
|
||||
appellant: e.appellant,
|
||||
offenseDetails: offenseDetailsTran(e.offenseDetails),
|
||||
createdAt: date2Thai(e.createdAt)!,
|
||||
devLevel: e.devLevel,
|
||||
considerationDate: date2Thai(e.considerationDate)!,
|
||||
complaintStatus: statusTothai(e.complaintStatus),
|
||||
levelConsideration: levelConsiderationTran(e.levelConsideration),
|
||||
dateConsideration: date2Thai(e.dateConsideration)!,
|
||||
status: statusTothai(e.status),
|
||||
}));
|
||||
rows.value = datalist;
|
||||
}
|
||||
|
|
@ -65,16 +65,8 @@ export const useComplainstDataStore = defineStore("DisciplineComplainst", () =>
|
|||
{ id: "BANGKOK", name: "กรุงเทพมหานคร" },
|
||||
]);
|
||||
const complainantoptions = ref<DataOption[]>(complainantoptionsMain.value)
|
||||
const consideredAgencytoptions = ref<DataOption[]>([
|
||||
{ id: "0", name: "หน่ายงานเอ" },
|
||||
{ id: "1", name: "หน่ายงานบี" },
|
||||
{ id: "2", name: "หน่ายงานชี" },
|
||||
]);
|
||||
const officeOp = ref<DataOption[]>([
|
||||
{ id: "0", name: "สำนักงาน1" },
|
||||
{ id: "1", name: "สำนักงาน2" },
|
||||
{ id: "2", name: "สำนักงาน3" },
|
||||
]);
|
||||
const consideredAgencytoptions = ref<DataOption[]>([]);
|
||||
const organizationIdOp = ref<DataOption[]>([]);
|
||||
|
||||
const statusTothai = (val: string) => {
|
||||
switch (val) {
|
||||
|
|
@ -84,6 +76,24 @@ export const useComplainstDataStore = defineStore("DisciplineComplainst", () =>
|
|||
default: return "-";
|
||||
}
|
||||
};
|
||||
|
||||
function offenseDetailsTran(val: string){
|
||||
switch (val) {
|
||||
case 'NOT_SPECIFIED': return "ยังไม่ระบุ";
|
||||
case 'NOT_DEADLY': return "ร้ายแรง";
|
||||
case 'DEADLY': return "ไม่ร้ายแรง";
|
||||
default: return "-";
|
||||
}
|
||||
}
|
||||
function levelConsiderationTran(val: string){
|
||||
switch (val) {
|
||||
case 'NORMAL': return "ปกติ";
|
||||
case 'URGENT': return "ด่วน";
|
||||
case 'VERT_URGENT': return "ด่วนมาก";
|
||||
default: return "-";
|
||||
}
|
||||
}
|
||||
|
||||
const agencytoptions = ref<DataOption[]>(consideredAgencytoptions.value)
|
||||
const optionListNameMain = ref<DataOption[]>([])
|
||||
const optionListName = ref<DataOption[]>([])
|
||||
|
|
@ -114,6 +124,15 @@ export const useComplainstDataStore = defineStore("DisciplineComplainst", () =>
|
|||
});
|
||||
}
|
||||
|
||||
function ocListFn(data:ocListType[]){
|
||||
let dataList:DataOption[] = data.map((item:ocListType)=>({
|
||||
id:item.organizationId,
|
||||
name:item.organizationName
|
||||
}))
|
||||
consideredAgencytoptions.value = dataList
|
||||
organizationIdOp.value = dataList
|
||||
|
||||
}
|
||||
return {
|
||||
rows,
|
||||
rowsAdd,
|
||||
|
|
@ -126,7 +145,8 @@ export const useComplainstDataStore = defineStore("DisciplineComplainst", () =>
|
|||
consideredAgencytoptions,
|
||||
optionListName,
|
||||
fetchComplainstAdd,
|
||||
officeOp
|
||||
organizationIdOp,
|
||||
ocListFn
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue