163 lines
3.9 KiB
Vue
163 lines
3.9 KiB
Vue
<script setup lang="ts">
|
|
import { ref, onMounted } 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 router = useRouter();
|
|
|
|
const complainstStore = useComplainstDataStore();
|
|
|
|
const props = defineProps({
|
|
filterTable: {
|
|
type: String,
|
|
default: "",
|
|
},
|
|
});
|
|
const columns = ref<QTableProps["columns"]>([
|
|
{
|
|
name: "no",
|
|
align: "left",
|
|
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: "detail",
|
|
align: "left",
|
|
label: "รายละเอียด",
|
|
sortable: true,
|
|
field: "detail",
|
|
headerStyle: "font-size: 14px",
|
|
style: "font-size: 14px",
|
|
},
|
|
{
|
|
name: "complainant",
|
|
align: "left",
|
|
label: "ผู้ถูกร้องเรียน",
|
|
sortable: true,
|
|
field: "complainant",
|
|
headerStyle: "font-size: 14px",
|
|
style: "font-size: 14px",
|
|
},
|
|
{
|
|
name: "offenseDescription",
|
|
align: "left",
|
|
label: "ลักษณะความผิด",
|
|
sortable: true,
|
|
field: "offenseDescription",
|
|
headerStyle: "font-size: 14px",
|
|
style: "font-size: 14px",
|
|
},
|
|
{
|
|
name: "creationDate",
|
|
align: "left",
|
|
label: "วันที่สร้างเรื่องร้องเรียน",
|
|
sortable: true,
|
|
field: "creationDate",
|
|
headerStyle: "font-size: 14px",
|
|
style: "font-size: 14px",
|
|
},
|
|
{
|
|
name: "considerationLevel",
|
|
align: "left",
|
|
label: "ระดับการพิจารณา",
|
|
sortable: true,
|
|
field: "considerationLevel",
|
|
headerStyle: "font-size: 14px",
|
|
style: "font-size: 14px",
|
|
},
|
|
{
|
|
name: "considerationDeadlineDate",
|
|
align: "left",
|
|
label: "วันที่กำหนดพิจารณา",
|
|
sortable: true,
|
|
field: "considerationDeadlineDate",
|
|
headerStyle: "font-size: 14px",
|
|
style: "font-size: 14px",
|
|
},
|
|
]);
|
|
const visibleColumns = ref<string[]>([
|
|
"no",
|
|
"subject",
|
|
"detail",
|
|
"complainant",
|
|
"offenseDescription",
|
|
"creationDate",
|
|
"considerationLevel",
|
|
"considerationDeadlineDate",
|
|
]);
|
|
|
|
onMounted(() => {
|
|
complainstStore.columns = columns.value;
|
|
complainstStore.visibleColumns = visibleColumns.value;
|
|
});
|
|
|
|
//pagination
|
|
const pagination = ref({
|
|
descending: true,
|
|
page: 1,
|
|
rowsPerPage: 10,
|
|
});
|
|
function OpenEdit(id:string){
|
|
console.log(id)
|
|
router.push(`/discipline/complaints/${id}`)
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<d-table
|
|
id="table"
|
|
ref="table"
|
|
:columns="columns"
|
|
:rows="complainstStore.rows"
|
|
:filter="props.filterTable"
|
|
row-key="subject"
|
|
flat
|
|
bordered
|
|
:paging="true"
|
|
dense
|
|
class="custom-header-table"
|
|
:visible-columns="complainstStore.visibleColumns"
|
|
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">
|
|
<span class="text-weight-medium">{{ col.label }}</span>
|
|
</q-th>
|
|
</q-tr>
|
|
</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)">
|
|
<div v-if="col.name == 'no'">
|
|
{{ props.rowIndex + 1 }}
|
|
</div>
|
|
<div v-if="col.name == 'detail'">
|
|
<div class="table_ellipsis">
|
|
{{ props.row.detail }}
|
|
</div>
|
|
</div>
|
|
<div v-else>
|
|
{{ col.value }}
|
|
</div>
|
|
</q-td>
|
|
</q-tr>
|
|
</template>
|
|
</d-table>
|
|
</template>
|
|
|
|
<style scoped></style>
|