แก้ วินัย เพิ่ม api

This commit is contained in:
setthawutttty 2024-01-03 13:50:17 +07:00
parent fc55ffc928
commit 142fc30d8b
13 changed files with 134 additions and 145 deletions

View file

@ -9,13 +9,16 @@ import {
} from "vue";
import { QForm, useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import type { DirectorRowsResponse } from "@/modules/11_discipline/interface/response/director";
import DialogHeader from "@/modules/05_placement/components/PersonalList/DialogHeader.vue";
import config from "@/app.config";
import http from "@/plugins/http";
const $q = useQuasar();
const mixin = useCounterMixin();
const { showLoader, success, messageError, dialogConfirm, hideLoader } = mixin;
const listCheck = ref<string>("");
const listCheck = ref<number>();
const props = defineProps({
modal: Boolean,
title: {
@ -23,87 +26,43 @@ const props = defineProps({
default: "",
},
close: Function,
type: String,
dataList: Object,
});
const dataList = ref<any>();
const listInvestigateDetail = [
{
id: "1",
title: "test1",
type: "x1",
},
{
id: "2",
title: "test2",
type: "x2",
},
{
id: "3",
title: "test3",
type: "x3",
},
{
id: "4",
title: "test4",
type: "x4",
},
{
id: "5",
title: "test5",
type: "x5",
},
{
id: "6",
title: "test6",
type: "x6",
},
{
id: "7",
title: "test7",
type: "x7",
},
];
const listInvestigateDetail = ref<any>([]);
function clickList(id: string, type: string) {
const data = [
{
id: "1",
title: "นาย 1",
type: "x1",
},
{
id: "2",
title: "นาย 2",
type: "x1",
},
{
id: "3",
title: "นาย 3",
type: "x2",
},
{
id: "4",
title: "นาย 4",
type: "x2",
},
{
id: "5",
title: "นาย 5",
type: "x3",
},
{
id: "6",
title: "นาย 6",
type: "x3",
},
{
id: "7",
title: "นาย 7",
type: "x4",
},
];
dataList.value = data.filter((r) => r.type == type);
listCheck.value = id;
function clickList(index: number, data: any) {
listCheck.value = index;
dataList.value = data.map((i: any) => ({
commandNo: i.commandNo,
duty: i.duty,
prefix: i.prefix,
firstName: i.firstName,
lastName: i.lastName,
fullName:`${i.prefix}${i.firstName} ${i.lastName}`
}));
console.log(data);
}
watch(props, () => {
if (props) {
const data: DirectorRowsResponse = props.dataList as DirectorRowsResponse;
showLoader();
http
.get(config.API.historyDirectorbyId(data.id, props.type as string))
.then((res) => {
console.log(res.data.result);
listInvestigateDetail.value = res.data.result;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
});
</script>
<template>
@ -123,26 +82,26 @@ function clickList(id: string, type: string) {
<div
class="col-xs-12 col-sm-12 text-weight-medium bg-grey-1 q-py-xs q-px-md"
>
รายการเรองรองเรยน
รายการเรองรองเรยน
</div>
<div class="col-12"><q-separator /></div>
<q-scroll-area
style="height: 300px;"
class="bg-white rounded-borders q-px-sm row col-12"
style="height: 300px"
class="bg-white rounded-borders q-px-xs row col-12"
>
<q-list
v-for="(item, index) in listInvestigateDetail"
:key="item.id"
:key="index"
bordered
separator
>
<q-item
clickable
v-ripple
:active="listCheck === item.id"
:active="listCheck === index"
active-class="my-menu-link"
@click="clickList(item.id, item.type)"
@click="clickList(index, item.director)"
>
<q-item-section>{{ item.title }}</q-item-section>
</q-item>
@ -165,16 +124,16 @@ function clickList(id: string, type: string) {
<div class="col-12"><q-separator /></div>
<q-scroll-area
style="height: 300px"
class="bg-white rounded-borders q-px-sm row col-12"
class="bg-white rounded-borders q-px-xs row col-12"
>
<q-list
v-for="(item, index) in dataList"
:key="item.id"
:key="index"
bordered
separator
>
<q-item clickable v-ripple>
<q-item-section>{{ item.title }}</q-item-section>
<q-item-section>{{ item.fullName }}</q-item-section>
</q-item>
</q-list>
</q-scroll-area>

View file

@ -6,6 +6,7 @@ import { useDisciplineDirectorDataStore } from "@/modules/11_discipline/store/Di
import config from "@/app.config";
import http from "@/plugins/http";
import DialogTotal from "@/modules/11_discipline/components/6_BasicInformation/Director/DialogInvestigateTotal.vue";
import type { DirectorRowsResponse } from "@/modules/11_discipline/interface/response/director";
const $q = useQuasar();
const dataStore = useDisciplineDirectorDataStore();
@ -18,6 +19,8 @@ const maxPage = ref<number>(1);
const page = ref<number>(1);
const rowsPerPage = ref<number>(10);
const modalDetail = ref<boolean>(false);
const type = ref<string>('')
const dataPopUp = ref<DirectorRowsResponse>()
/**
* นหาในตาราง
*/
@ -111,9 +114,15 @@ function filterFn() {
getList();
}
function openDetail(title: string) {
titleInvestigate.value = title;
function openDetail(data: DirectorRowsResponse, typeChange: string) {
if (typeChange == "investigate") {
titleInvestigate.value = `รายการสืบสวนข้อเท็จจริงของ ${data.fullName}`;
} else if (typeChange == "disciplinary") {
titleInvestigate.value = `รายการสอบสวนความผิดทางวินัยของ ${data.fullName}`;
}
dataPopUp.value = data
modalDetail.value = true;
type.value = typeChange
}
function closeDetail() {
@ -232,9 +241,7 @@ onMounted(() => {
props.row.totalInvestigate > 0
"
class="text-blue"
@click="
openDetail(`รายการสืบสวนข้อเท็จจริงของ ${props.row.fullName}`)
"
@click="openDetail(props.row, 'investigate')"
>
{{ props.row.totalInvestigate }}
</div>
@ -244,11 +251,7 @@ onMounted(() => {
props.row.totalDisciplinary > 0
"
class="text-blue"
@click="
openDetail(
`รายการสอบสวนความผิดทางวินัยของ ${props.row.fullName}`
)
"
@click="openDetail(props.row, 'disciplinary')"
>
{{ props.row.totalDisciplinary }}
</div>
@ -282,5 +285,7 @@ onMounted(() => {
:modal="modalDetail"
:title="titleInvestigate"
:close="closeDetail"
:type="type"
:data-list="dataPopUp"
/>
</template>