เพิ่ม tabMenu วินัย
This commit is contained in:
parent
e9529f11a7
commit
34b229e817
7 changed files with 288 additions and 158 deletions
|
|
@ -13,6 +13,7 @@ const { date2Thai } = mixin;
|
|||
export const useInvestigateDisStore = defineStore(
|
||||
"DisciplineInvestigateDis",
|
||||
() => {
|
||||
const tabMenu = ref<string>("disciplinary");
|
||||
const rows = ref<investigateDisDataRowType[]>([]);
|
||||
const rows2 = ref<directorType[]>([]);
|
||||
const selected = ref<directorType[]>([]);
|
||||
|
|
@ -32,7 +33,7 @@ export const useInvestigateDisStore = defineStore(
|
|||
]);
|
||||
async function fecthList(data: investigateDisDataRowType[]) {
|
||||
let datalist: investigateDisDataRowType[] = data.map((e: any) => ({
|
||||
id:e.id,
|
||||
id: e.id,
|
||||
subject: e.subject,
|
||||
interrogated: e.interrogated,
|
||||
fault: convertFault(e.fault),
|
||||
|
|
@ -273,6 +274,7 @@ export const useInvestigateDisStore = defineStore(
|
|||
},
|
||||
]);
|
||||
return {
|
||||
tabMenu,
|
||||
fecthList,
|
||||
rows,
|
||||
rows2,
|
||||
|
|
|
|||
|
|
@ -1,170 +1,183 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { ref } from "vue";
|
||||
import type { QTableProps } from "quasar";
|
||||
import type { investigatefactsDataRowType, DataOption, DataNumberOption } from '@/modules/11_discipline/interface/index/Main'
|
||||
import type {
|
||||
investigatefactsDataRowType,
|
||||
DataOption,
|
||||
DataNumberOption,
|
||||
} from "@/modules/11_discipline/interface/index/Main";
|
||||
|
||||
/*** store ของข้อมูลสืบสวนข้อเท็จจริง */
|
||||
export const useInvestigateFactStore = defineStore("DisciplineInvestigateFact", () => {
|
||||
const rows = ref<investigatefactsDataRowType[]>([])
|
||||
export const useInvestigateFactStore = defineStore(
|
||||
"DisciplineInvestigateFact",
|
||||
() => {
|
||||
const tabMenu = ref<string>("investigatefacts");
|
||||
const rows = ref<investigatefactsDataRowType[]>([]);
|
||||
|
||||
const daysExtendOps = ref<DataNumberOption[]>([
|
||||
{ id: 15, name: "15 วัน" },
|
||||
{ id: 30, name: "30 วัน" },
|
||||
{ id: 45, name: "45 วัน" },
|
||||
{ id: 60, name: "60 วัน" },
|
||||
{ id: 15, name: "15 วัน" },
|
||||
{ id: 30, name: "30 วัน" },
|
||||
{ id: 45, name: "45 วัน" },
|
||||
{ id: 60, name: "60 วัน" },
|
||||
]);
|
||||
const investigationOps = ref<DataOption[]>([
|
||||
{ id: "001", name: "เเต่งตั้งการสืบสวน" },
|
||||
{ id: "002", name: "สืบสวนทางลับ" },
|
||||
{ id: "003", name: "อื่นๆ" },
|
||||
{ id: "001", name: "เเต่งตั้งการสืบสวน" },
|
||||
{ id: "002", name: "สืบสวนทางลับ" },
|
||||
{ id: "003", name: "อื่นๆ" },
|
||||
]);
|
||||
const faultOps = ref<DataOption[]>([
|
||||
{ id: "001", name: "ยังไม่ระบุ" },
|
||||
{ id: "002", name: "ไม่ร้ายเเรง" },
|
||||
{ id: "003", name: "ร้ายเเรง" },
|
||||
{ id: "001", name: "ยังไม่ระบุ" },
|
||||
{ id: "002", name: "ไม่ร้ายเเรง" },
|
||||
{ id: "003", name: "ร้ายเเรง" },
|
||||
]);
|
||||
const statusResultOptions = ref<DataOption[]>([
|
||||
{ id: "not_specified", name: "ยังไม่ระบุ" },
|
||||
{ id: "have_cause", name: "มีมูล" },
|
||||
{ id: "no_cause", name: "ไม่มีมูล" },
|
||||
{ id: "not_specified", name: "ยังไม่ระบุ" },
|
||||
{ id: "have_cause", name: "มีมูล" },
|
||||
{ id: "no_cause", name: "ไม่มีมูล" },
|
||||
]);
|
||||
const causeTextOptions = ref<DataOption[]>([
|
||||
{ id: "ร้ายแรง", name: "ร้ายแรง" },
|
||||
{ id: "ไม่ร้ายแรง", name: "ไม่ร้ายแรง" },
|
||||
{ id: "ร้ายแรง", name: "ร้ายแรง" },
|
||||
{ id: "ไม่ร้ายแรง", name: "ไม่ร้ายแรง" },
|
||||
]);
|
||||
|
||||
const daysExtendOp = ref<DataNumberOption[]>(daysExtendOps.value);
|
||||
const investigationOp = ref<DataOption[]>(investigationOps.value);
|
||||
const faultOp = ref<DataOption[]>(faultOps.value);
|
||||
const visibleColumns = ref<string[]>([
|
||||
"no",
|
||||
"subject",
|
||||
"interrogated",
|
||||
"fault",
|
||||
"status",
|
||||
"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",
|
||||
},
|
||||
{
|
||||
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 | number, update: any, type: string) {
|
||||
update(() => {
|
||||
if (type === "faultOp") {
|
||||
faultOp.value = faultOps.value.filter(
|
||||
(v: any) => v.name.toLowerCase().indexOf(val) > -1
|
||||
);
|
||||
|
||||
} else if (type === "investigationOp") {
|
||||
investigationOp.value = investigationOps.value.filter(
|
||||
(v: any) => v.name.toLowerCase().indexOf(val) > -1
|
||||
);
|
||||
} else if (type === "daysExtendOp") {
|
||||
daysExtendOp.value = daysExtendOps.value.filter(
|
||||
(v: any) => v.id.indexOf(val) > -1
|
||||
);
|
||||
}
|
||||
|
||||
});
|
||||
function filterFnOptionsType(
|
||||
val: string | number,
|
||||
update: any,
|
||||
type: string
|
||||
) {
|
||||
update(() => {
|
||||
if (type === "faultOp") {
|
||||
faultOp.value = faultOps.value.filter(
|
||||
(v: any) => v.name.toLowerCase().indexOf(val) > -1
|
||||
);
|
||||
} else if (type === "investigationOp") {
|
||||
investigationOp.value = investigationOps.value.filter(
|
||||
(v: any) => v.name.toLowerCase().indexOf(val) > -1
|
||||
);
|
||||
} else if (type === "daysExtendOp") {
|
||||
daysExtendOp.value = daysExtendOps.value.filter(
|
||||
(v: any) => v.id.indexOf(val) > -1
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
function fecthList(data: investigatefactsDataRowType[]) {
|
||||
let datalist: investigatefactsDataRowType[] = data.map((e: investigatefactsDataRowType) => {
|
||||
return {
|
||||
id: e.id,
|
||||
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;
|
||||
let datalist: investigatefactsDataRowType[] = data.map(
|
||||
(e: investigatefactsDataRowType) => {
|
||||
return {
|
||||
id: e.id,
|
||||
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) {
|
||||
case "0":
|
||||
return "ความผิดวินัยไม่ร้ายแรง"
|
||||
case "1":
|
||||
return "ความผิดวินัยร้ายแรง"
|
||||
}
|
||||
switch (val) {
|
||||
case "0":
|
||||
return "ความผิดวินัยไม่ร้ายแรง";
|
||||
case "1":
|
||||
return "ความผิดวินัยร้ายแรง";
|
||||
}
|
||||
}
|
||||
function convertSatatus(val: string) {
|
||||
switch (val) {
|
||||
case "0":
|
||||
return "ยุติเรื่อง"
|
||||
case "1":
|
||||
return "เสร็จสิ้นเเล้ว"
|
||||
}
|
||||
switch (val) {
|
||||
case "0":
|
||||
return "ยุติเรื่อง";
|
||||
case "1":
|
||||
return "เสร็จสิ้นเเล้ว";
|
||||
}
|
||||
}
|
||||
function activeStatus(val: string) {
|
||||
switch (val) {
|
||||
case "0":
|
||||
return "ยังไม่ได้ยืนยันผล"
|
||||
case "1":
|
||||
return "ยืนยันผลเเล้ว"
|
||||
}
|
||||
switch (val) {
|
||||
case "0":
|
||||
return "ยังไม่ได้ยืนยันผล";
|
||||
case "1":
|
||||
return "ยืนยันผลเเล้ว";
|
||||
}
|
||||
}
|
||||
return {
|
||||
fecthList,
|
||||
rows,
|
||||
daysExtendOps,
|
||||
investigationOps,
|
||||
faultOps,
|
||||
filterFnOptionsType,
|
||||
faultOp,
|
||||
daysExtendOp,
|
||||
investigationOp,
|
||||
visibleColumns,
|
||||
columns,
|
||||
statusResultOptions,
|
||||
causeTextOptions
|
||||
tabMenu,
|
||||
fecthList,
|
||||
rows,
|
||||
daysExtendOps,
|
||||
investigationOps,
|
||||
faultOps,
|
||||
filterFnOptionsType,
|
||||
faultOp,
|
||||
daysExtendOp,
|
||||
investigationOp,
|
||||
visibleColumns,
|
||||
columns,
|
||||
statusResultOptions,
|
||||
causeTextOptions,
|
||||
};
|
||||
})
|
||||
}
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue