293 lines
8 KiB
Vue
293 lines
8 KiB
Vue
<script setup lang="ts">
|
|
import { ref, useAttrs, onMounted } from "vue";
|
|
import type { QTableProps } from "quasar";
|
|
import router from "@/router";
|
|
import { useQuasar } from "quasar";
|
|
// import { useCounterMixin } from "@/stores/mixin";
|
|
|
|
// import config from "@/app.config";
|
|
// import http from "@/plugins/http";
|
|
|
|
import { useInvestigateFactStore } from '../../store/InvestigateFactStore'
|
|
const dataInvestigate = useInvestigateFactStore()
|
|
const { fecthList } = dataInvestigate
|
|
|
|
// const mixin = useCounterMixin();
|
|
// const {
|
|
// date2Thai,
|
|
// success,
|
|
// messageError,
|
|
// showLoader,
|
|
// hideLoader,
|
|
// dialogConfirm,
|
|
// dialogRemove,
|
|
// } = mixin;
|
|
const $q = useQuasar(); //ใช้ noti quasar
|
|
|
|
const visibleColumns = ref<string[]>([
|
|
"no",
|
|
"subject",
|
|
"interrogated",
|
|
"fault",
|
|
"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: "status",
|
|
align: "left",
|
|
label: "สถานะ",
|
|
sortable: false,
|
|
field: "status",
|
|
headerStyle: "font-size: 14px",
|
|
style: "font-size: 14px",
|
|
},
|
|
]);
|
|
|
|
|
|
|
|
// ค้นหาในตาราง
|
|
const filterKeyword = ref<string>("");
|
|
const filterRef = ref<HTMLInputElement | null>(null);
|
|
const resetFilter = () => {
|
|
filterKeyword.value = "";
|
|
if (filterRef.value) {
|
|
filterRef.value.focus();
|
|
}
|
|
};
|
|
|
|
|
|
const attrs = ref<any>(useAttrs());
|
|
const paging = ref<boolean>(true);
|
|
const pagination = ref({
|
|
// sortBy: "desc",
|
|
descending: false,
|
|
page: 1,
|
|
rowsPerPage: 10,
|
|
});
|
|
const paginationLabel = (start: string, end: string, total: string) => {
|
|
if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
|
|
else return start + "-" + end + " ใน " + total;
|
|
};
|
|
|
|
function fecthInvestigateFact() {
|
|
const data = [
|
|
{
|
|
subject: "ทุจริตในหน้าที่",
|
|
interrogated: "ศิรินภา คงน้อยี่",
|
|
fault: "1",
|
|
status: "0",
|
|
active:'1'
|
|
},
|
|
{
|
|
subject: "ทุจริตในหน้าที่",
|
|
interrogated: "นายนครชัย วันดี",
|
|
fault: "1",
|
|
status: "1",
|
|
active:'1'
|
|
},
|
|
{
|
|
subject: "กระทำทุจริตเงินกองทุน",
|
|
interrogated: "นายกัณฐิมา กาฬสินธ์ุ",
|
|
fault: "0",
|
|
status: "1",
|
|
active:'1'
|
|
},
|
|
{
|
|
subject: "พูดจาไม่สุภาพ",
|
|
interrogated: "นายปิยรมย์ ศิริธาราฟ",
|
|
fault: "0",
|
|
status: "1",
|
|
active:'1'
|
|
},
|
|
];
|
|
fecthList(data); // ส่งข้อมูลไป stores
|
|
}
|
|
const clickAdd = () => {
|
|
router.push(`/discipline/investigatefacts/add`)
|
|
}
|
|
onMounted(()=>{
|
|
fecthInvestigateFact()
|
|
})
|
|
</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-col-gutter-sm">
|
|
<div class="row col-12 q-col-gutter-sm">
|
|
<div>
|
|
<q-btn
|
|
@click="clickAdd()"
|
|
size="12px"
|
|
flat
|
|
round
|
|
color="add"
|
|
icon="mdi-plus"
|
|
>
|
|
<q-tooltip>เพิ่มรายการสืบสวนข้อเท็จจริง</q-tooltip>
|
|
</q-btn>
|
|
</div>
|
|
<q-space />
|
|
|
|
<q-input
|
|
class="col-xs-12 col-sm-3 col-md-2"
|
|
standout
|
|
dense
|
|
v-model="filterKeyword"
|
|
ref="filterRef"
|
|
outlined
|
|
debounce="300"
|
|
placeholder="ค้นหา"
|
|
>
|
|
<template v-slot:append>
|
|
<q-icon v-if="filterKeyword == ''" name="search" />
|
|
<q-icon
|
|
v-if="filterKeyword !== ''"
|
|
name="clear"
|
|
class="cursor-pointer"
|
|
@click="resetFilter"
|
|
/>
|
|
</template>
|
|
</q-input>
|
|
|
|
<q-select
|
|
v-model="visibleColumns"
|
|
multiple
|
|
outlined
|
|
dense
|
|
options-dense
|
|
:display-value="$q.lang.table.columns"
|
|
emit-value
|
|
map-options
|
|
:options="columns"
|
|
option-value="name"
|
|
options-cover
|
|
style="min-width: 150px"
|
|
class="col-xs-12 col-sm-3 col-md-2"
|
|
/>
|
|
</div>
|
|
<div class="col-12">
|
|
<d-table
|
|
ref="table"
|
|
:columns="columns"
|
|
:rows="dataInvestigate.rows"
|
|
:filter="filterKeyword"
|
|
row-key="interrogated"
|
|
flat
|
|
bordered
|
|
:paging="true"
|
|
dense
|
|
class="custom-header-table"
|
|
v-bind="attrs"
|
|
:visible-columns="visibleColumns"
|
|
:pagination-label="paginationLabel"
|
|
v-model:pagination="pagination"
|
|
>
|
|
<template v-slot:header="props">
|
|
<q-tr :props="props">
|
|
<q-th v-for="col in props.cols" :key="col.name" :props="props" style="padding: 10px;color:#35373C;font-weight: 500;">
|
|
<span class="text-weight-medium">{{ col.label }}</span>
|
|
</q-th>
|
|
<q-th auto-width />
|
|
<q-th auto-width />
|
|
</q-tr>
|
|
</template>
|
|
<template v-slot:body="props">
|
|
<q-tr :props="props" class="cursor-pointer">
|
|
<q-td key="no" :props="props">
|
|
{{ props.rowIndex + 1 }}
|
|
</q-td>
|
|
<q-td
|
|
key="subject"
|
|
:props="props"
|
|
>
|
|
{{ props.row.subject }}
|
|
</q-td>
|
|
<q-td
|
|
key="interrogated"
|
|
:props="props"
|
|
>
|
|
{{ props.row.interrogated }}
|
|
</q-td>
|
|
<q-td
|
|
key="fault"
|
|
:props="props"
|
|
>
|
|
{{ props.row.fault }}
|
|
</q-td>
|
|
<q-td
|
|
key="status"
|
|
:props="props"
|
|
>
|
|
{{ props.row.status }}
|
|
</q-td>
|
|
<q-td style="font-size: 14px;width: 10rem">
|
|
{{ props.row.active }}
|
|
</q-td>
|
|
<q-td auto-width >
|
|
<q-btn v-if="props.row.status === 'ยุติเรื่อง'" class="q-px-xl q-py-xs text-white no-shadow" style="background-color:#00AA86 ; border-radius: 6px;">ยกเลิกยุติเรื่อง</q-btn>
|
|
</q-td>
|
|
</q-tr>
|
|
</template>
|
|
<!-- <template v-slot:pagination="scope">
|
|
<q-pagination
|
|
v-model="pagination.page"
|
|
active-color="primary"
|
|
color="dark"
|
|
:max="scope.pagesNumber"
|
|
:max-pages="5"
|
|
size="sm"
|
|
boundary-links
|
|
direction-links
|
|
></q-pagination>
|
|
</template> -->
|
|
</d-table>
|
|
</div>
|
|
</div>
|
|
</q-card>
|
|
</template>
|
|
|
|
|