เพิ่ม id ให้ เทส
This commit is contained in:
parent
e300009dc3
commit
89c381afcc
4 changed files with 132 additions and 160 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { ref } from "vue";
|
||||
import type { QTableProps } from "quasar";
|
||||
import type { investigatefactsDataRowType, DataOption } from '@/modules/11_discipline/interface/index/Main'
|
||||
|
||||
export const useInvestigateFactStore = defineStore("DisciplineInvestigateFact", () => {
|
||||
|
|
@ -23,6 +24,66 @@ export const useInvestigateFactStore = defineStore("DisciplineInvestigateFact",
|
|||
{ id: "002", name: "ไม่ร้ายเเรง" },
|
||||
{ id: "003", name: "ร้ายเเรง" },
|
||||
]);
|
||||
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",
|
||||
},
|
||||
]);
|
||||
function filterFnOptionsType(val: string, update: any, type: string) {
|
||||
update(() => {
|
||||
const needle = val.toLowerCase();
|
||||
|
|
@ -44,16 +105,17 @@ export const useInvestigateFactStore = defineStore("DisciplineInvestigateFact",
|
|||
|
||||
});
|
||||
}
|
||||
async function fecthList(data: investigatefactsDataRowType[]) {
|
||||
let datalist: investigatefactsDataRowType[] = data.map((e: any) => ({
|
||||
subject: e.subject,
|
||||
interrogated: e.interrogated,
|
||||
fault: e.fault ?? convertFault(e.fault),
|
||||
status: e.status ?? convertSatatus(e.status),
|
||||
active: e.active ?? activeStatus(e.active)
|
||||
|
||||
}))
|
||||
rows.value = datalist
|
||||
function fecthList(data: investigatefactsDataRowType[]) {
|
||||
let datalist: investigatefactsDataRowType[] = data.map((e: investigatefactsDataRowType) => {
|
||||
return {
|
||||
subject: e.subject,
|
||||
interrogated: e.interrogated,
|
||||
fault: e.fault ? convertFault(e.fault):'-',
|
||||
status: e.status ? convertSatatus(e.status):'-',
|
||||
active: e.active ? activeStatus(e.active):'-'
|
||||
};
|
||||
});
|
||||
rows.value = datalist;
|
||||
}
|
||||
function convertFault(val: string) {
|
||||
switch (val) {
|
||||
|
|
@ -89,5 +151,7 @@ export const useInvestigateFactStore = defineStore("DisciplineInvestigateFact",
|
|||
faultOp,
|
||||
daysExtendOp,
|
||||
investigationOp,
|
||||
visibleColumns,
|
||||
columns
|
||||
};
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue