เอา columns/visibleColumns ใส่ store
This commit is contained in:
parent
cfc073e30c
commit
bbeb7558ed
3 changed files with 121 additions and 173 deletions
|
|
@ -1,12 +1,9 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { QTableProps } from "quasar";
|
|
||||||
import { onMounted, ref } from "vue";
|
import { onMounted, ref } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import type { Pagination } from "@/modules/03_recruiting/interface/index/Main";
|
import type { Pagination } from "@/modules/03_recruiting/interface/index/Main";
|
||||||
import Table from "@/modules/11_discipline/components/3_InvestigateDisciplinary/Table.vue";
|
import Table from "@/modules/11_discipline/components/3_InvestigateDisciplinary/Table.vue";
|
||||||
import http from "@/plugins/http";
|
|
||||||
import config from "@/app.config";
|
|
||||||
import { useInvestigateDisStore } from "../../store/InvestigateDisStore";
|
import { useInvestigateDisStore } from "../../store/InvestigateDisStore";
|
||||||
|
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
|
|
@ -15,127 +12,14 @@ const { fecthList } = dataInvestigateDis;
|
||||||
const $q = useQuasar(); // show dialog
|
const $q = useQuasar(); // show dialog
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const {
|
const { hideLoader } = mixin;
|
||||||
date2Thai,
|
|
||||||
success,
|
|
||||||
typeCategoryExam,
|
|
||||||
messageError,
|
|
||||||
showLoader,
|
|
||||||
hideLoader,
|
|
||||||
} = mixin;
|
|
||||||
const filter = ref<string>(""); //search data table
|
const filter = ref<string>(""); //search data table
|
||||||
const initialPagination = ref<Pagination>({
|
const initialPagination = ref<Pagination>({
|
||||||
rowsPerPage: 0,
|
rowsPerPage: 0,
|
||||||
});
|
});
|
||||||
const visibleColumns = ref<String[]>([
|
|
||||||
"no",
|
|
||||||
"subject",
|
|
||||||
"interrogated",
|
|
||||||
"fault",
|
|
||||||
"penaltyLevel",
|
|
||||||
"caseFault",
|
|
||||||
"dateInvestigate",
|
|
||||||
"status",
|
|
||||||
]);
|
|
||||||
const columns = ref<QTableProps["columns"]>([
|
|
||||||
{
|
|
||||||
name: "no",
|
|
||||||
align: "center",
|
|
||||||
label: "ลำดับ",
|
|
||||||
sortable: false,
|
|
||||||
field: "no",
|
|
||||||
headerStyle: "font-size: 14px",
|
|
||||||
style: "font-size: 14px",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "subject",
|
|
||||||
align: "left",
|
|
||||||
label: "เรื่อง",
|
|
||||||
sortable: true,
|
|
||||||
field: "subject",
|
|
||||||
headerStyle: "font-size: 14px",
|
|
||||||
style: "font-size: 14px",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "interrogated",
|
|
||||||
align: "left",
|
|
||||||
label: "ผู้ถูกสืบสวน",
|
|
||||||
sortable: true,
|
|
||||||
field: "interrogated",
|
|
||||||
headerStyle: "font-size: 14px",
|
|
||||||
style: "font-size: 14px",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "fault",
|
|
||||||
align: "left",
|
|
||||||
label: "ลักษณะความผิด",
|
|
||||||
sortable: true,
|
|
||||||
field: "fault",
|
|
||||||
headerStyle: "font-size: 14px",
|
|
||||||
style: "font-size: 14px",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "penaltyLevel",
|
|
||||||
align: "left",
|
|
||||||
label: "ระดับโทษความผิด",
|
|
||||||
sortable: true,
|
|
||||||
field: "penaltyLevel",
|
|
||||||
headerStyle: "font-size: 14px",
|
|
||||||
style: "font-size: 14px",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "caseFault",
|
|
||||||
align: "left",
|
|
||||||
label: "กรณีความผิด",
|
|
||||||
sortable: true,
|
|
||||||
field: "caseFault",
|
|
||||||
headerStyle: "font-size: 14px",
|
|
||||||
style: "font-size: 14px",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "dateInvestigate",
|
|
||||||
align: "left",
|
|
||||||
label: "วันที่สอบสวน",
|
|
||||||
sortable: true,
|
|
||||||
field: "dateInvestigate",
|
|
||||||
headerStyle: "font-size: 14px",
|
|
||||||
style: "font-size: 14px",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "status",
|
|
||||||
align: "left",
|
|
||||||
label: "สถานะ",
|
|
||||||
sortable: true,
|
|
||||||
field: "status",
|
|
||||||
headerStyle: "font-size: 14px",
|
|
||||||
style: "font-size: 14px",
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await fecthInvestigateDis();
|
fecthList([
|
||||||
await hideLoader();
|
|
||||||
});
|
|
||||||
|
|
||||||
const clickDelete = (id: string) => {
|
|
||||||
$q.dialog({
|
|
||||||
title: "ยืนยันการลบข้อมูล",
|
|
||||||
message: "ต้องการลบข้อมูลนี้ใช่หรือไม่?",
|
|
||||||
cancel: {
|
|
||||||
flat: true,
|
|
||||||
color: "negative",
|
|
||||||
},
|
|
||||||
persistent: true,
|
|
||||||
})
|
|
||||||
.onOk(async () => {
|
|
||||||
// await deleteData(id);
|
|
||||||
})
|
|
||||||
.onCancel(() => {})
|
|
||||||
.onDismiss(() => {});
|
|
||||||
};
|
|
||||||
|
|
||||||
function fecthInvestigateDis() {
|
|
||||||
const data = [
|
|
||||||
{
|
{
|
||||||
subject: "ทุจริตในหน้าที่",
|
subject: "ทุจริตในหน้าที่",
|
||||||
interrogated: "ศิรินภา คงน้อยี่",
|
interrogated: "ศิรินภา คงน้อยี่",
|
||||||
|
|
@ -176,28 +60,13 @@ function fecthInvestigateDis() {
|
||||||
status: "0",
|
status: "0",
|
||||||
active: "1",
|
active: "1",
|
||||||
},
|
},
|
||||||
];
|
]);
|
||||||
fecthList(data); // ส่งข้อมูลไป stores
|
await hideLoader();
|
||||||
}
|
});
|
||||||
|
|
||||||
const clickAdd = () => {
|
const clickAdd = () => {
|
||||||
router.push(`/discipline/InvestigateDisciplinary/add`);
|
router.push(`/discipline/InvestigateDisciplinary/add`);
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteData = async (id: string) => {
|
|
||||||
// showLoader();
|
|
||||||
// await http
|
|
||||||
// .delete(config.API.periodExamId(id))
|
|
||||||
// .then((res) => {
|
|
||||||
// success($q, "ลบข้อมูลสำเร็จ");
|
|
||||||
// })
|
|
||||||
// .catch((e) => {
|
|
||||||
// messageError($q, e);
|
|
||||||
// })
|
|
||||||
// .finally(async () => {
|
|
||||||
// hideLoader();
|
|
||||||
// });
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -209,11 +78,11 @@ const deleteData = async (id: string) => {
|
||||||
<Table
|
<Table
|
||||||
style="max-height: 80vh"
|
style="max-height: 80vh"
|
||||||
:rows="dataInvestigateDis.rows"
|
:rows="dataInvestigateDis.rows"
|
||||||
:columns="columns"
|
:columns="dataInvestigateDis.columns"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
:visible-columns="visibleColumns"
|
:visible-columns="dataInvestigateDis.visibleColumns"
|
||||||
v-model:inputfilter="filter"
|
v-model:inputfilter="filter"
|
||||||
v-model:inputvisible="visibleColumns"
|
v-model:inputvisible="dataInvestigateDis.visibleColumns"
|
||||||
:pagination="initialPagination"
|
:pagination="initialPagination"
|
||||||
:nornmalData="true"
|
:nornmalData="true"
|
||||||
:add="clickAdd"
|
:add="clickAdd"
|
||||||
|
|
@ -222,29 +91,13 @@ const deleteData = async (id: string) => {
|
||||||
>
|
>
|
||||||
<template #columns="props">
|
<template #columns="props">
|
||||||
<q-tr :props="props" class="cursor-pointer">
|
<q-tr :props="props" class="cursor-pointer">
|
||||||
<q-td key="no" :props="props">
|
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
||||||
{{ props.rowIndex + 1 }}
|
<q-td v-if="col.name == 'no'">
|
||||||
</q-td>
|
{{ props.rowIndex + 1 }}
|
||||||
<q-td key="subject" :props="props">
|
</q-td>
|
||||||
{{ props.row.subject }}
|
<div>
|
||||||
</q-td>
|
{{ col.value }}
|
||||||
<q-td key="interrogated" :props="props">
|
</div>
|
||||||
{{ props.row.interrogated }}
|
|
||||||
</q-td>
|
|
||||||
<q-td key="fault" :props="props">
|
|
||||||
{{ props.row.fault }}
|
|
||||||
</q-td>
|
|
||||||
<q-td key="penaltyLevel" :props="props">
|
|
||||||
{{ props.row.penaltyLevel }}
|
|
||||||
</q-td>
|
|
||||||
<q-td key="caseFault" :props="props">
|
|
||||||
{{ props.row.caseFault }}
|
|
||||||
</q-td>
|
|
||||||
<q-td key="dateInvestigate" :props="props">
|
|
||||||
{{ props.row.dateInvestigate }}
|
|
||||||
</q-td>
|
|
||||||
<q-td key="status" :props="props">
|
|
||||||
{{ props.row.status }}
|
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td style="font-size: 14px; width: 10rem">
|
<q-td style="font-size: 14px; width: 10rem">
|
||||||
<q-btn
|
<q-btn
|
||||||
|
|
|
||||||
|
|
@ -5,22 +5,20 @@ interface DataOption {
|
||||||
interface investigatefactsDataRowType {
|
interface investigatefactsDataRowType {
|
||||||
subject: string;
|
subject: string;
|
||||||
interrogated: string;
|
interrogated: string;
|
||||||
fault: string|undefined;
|
fault: string | undefined;
|
||||||
status: string|undefined;
|
status: string | undefined;
|
||||||
active: string|undefined;
|
active: string | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
interface investigateDisDataRowType {
|
interface investigateDisDataRowType {
|
||||||
subject: string;
|
subject: string;
|
||||||
interrogated: string;
|
interrogated: string;
|
||||||
fault: string;
|
fault: string | undefined;
|
||||||
penaltyLevel: string;
|
penaltyLevel: string | undefined;
|
||||||
caseFault: string;
|
caseFault: string | undefined;
|
||||||
dateInvestigate: string;
|
dateInvestigate: string | undefined;
|
||||||
status: string;
|
status: string | undefined;
|
||||||
active: string;
|
active: string | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface directorType {
|
interface directorType {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
|
import type { QTableProps } from "quasar";
|
||||||
import type {
|
import type {
|
||||||
investigateDisDataRowType,
|
investigateDisDataRowType,
|
||||||
DataOption,
|
DataOption,
|
||||||
|
|
@ -97,6 +98,100 @@ export const useInvestigateDisStore = defineStore(
|
||||||
return "ไล่ออก";
|
return "ไล่ออก";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const visibleColumns = ref<String[]>([
|
||||||
|
"no",
|
||||||
|
"subject",
|
||||||
|
"interrogated",
|
||||||
|
"fault",
|
||||||
|
"penaltyLevel",
|
||||||
|
"caseFault",
|
||||||
|
"dateInvestigate",
|
||||||
|
"status",
|
||||||
|
]);
|
||||||
|
|
||||||
|
const columns = ref<QTableProps["columns"]>([
|
||||||
|
{
|
||||||
|
name: "no",
|
||||||
|
align: "center",
|
||||||
|
label: "ลำดับ",
|
||||||
|
sortable: false,
|
||||||
|
field: "no",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "subject",
|
||||||
|
align: "left",
|
||||||
|
label: "เรื่อง",
|
||||||
|
sortable: true,
|
||||||
|
field: "subject",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "interrogated",
|
||||||
|
align: "left",
|
||||||
|
label: "ผู้ถูกสืบสวน",
|
||||||
|
sortable: true,
|
||||||
|
field: "interrogated",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "fault",
|
||||||
|
align: "left",
|
||||||
|
label: "ลักษณะความผิด",
|
||||||
|
sortable: true,
|
||||||
|
field: "fault",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "penaltyLevel",
|
||||||
|
align: "left",
|
||||||
|
label: "ระดับโทษความผิด",
|
||||||
|
sortable: true,
|
||||||
|
field: "penaltyLevel",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "caseFault",
|
||||||
|
align: "left",
|
||||||
|
label: "กรณีความผิด",
|
||||||
|
sortable: true,
|
||||||
|
field: "caseFault",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "dateInvestigate",
|
||||||
|
align: "left",
|
||||||
|
label: "วันที่สอบสวน",
|
||||||
|
sortable: true,
|
||||||
|
field: "dateInvestigate",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "status",
|
||||||
|
align: "left",
|
||||||
|
label: "สถานะ",
|
||||||
|
sortable: true,
|
||||||
|
field: "status",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
},
|
||||||
|
]);
|
||||||
return {
|
return {
|
||||||
fecthList,
|
fecthList,
|
||||||
rows,
|
rows,
|
||||||
|
|
@ -104,6 +199,8 @@ export const useInvestigateDisStore = defineStore(
|
||||||
optionsTypefault,
|
optionsTypefault,
|
||||||
optionsfaultLevel,
|
optionsfaultLevel,
|
||||||
fecthDirector,
|
fecthDirector,
|
||||||
|
visibleColumns,
|
||||||
|
columns,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue