ปรับ ui การสอบสวนความผิดทางวินัย

This commit is contained in:
AnandaTon 2023-10-18 16:02:45 +07:00
parent b00a946c64
commit 09d44c24d7
9 changed files with 306 additions and 301 deletions

View file

@ -1,69 +1,109 @@
import { defineStore } from "pinia";
import { ref } from "vue";
import type {
investigateDisDataRowType,
DataOption,
directorType,
} from "@/modules/11_discipline/interface/index/Main";
export const useInvestigateDisStore = defineStore("DisciplineInvestigateDis", () => {
const rows = ref<any>([]);
async function fecthList(data: any) {
let datalist = data.map((e: any) => ({
subject: e.subject,
interrogated: e.interrogated,
fault: convertFault(e.fault),
penaltyLevel: convertPenaltyLevel(e.penaltyLevel),
caseFault: e.caseFault,
dateInvestigate: e.dateInvestigate,
status: convertSatatus(e.status),
active: activeStatus(e.active),
}));
rows.value = datalist;
console.log(rows.value);
}
function convertFault(val: string) {
switch (val) {
case "0":
return "ความผิดวินัยยังไม่ระบุ";
case "1":
return "ความผิดวินัยไม่ร้ายแรง";
case "2":
return "ความผิดวินัยร้ายแรง";
export const useInvestigateDisStore = defineStore(
"DisciplineInvestigateDis",
() => {
const rows = ref<investigateDisDataRowType[]>([]);
const rows2 = ref<directorType[]>([]);
const selected = ref<directorType[]>([]);
const optionsTypefault = ref<DataOption[]>([
{ id: "0", name: "ไม่ระบุ" },
{ id: "1", name: "ร้ายแรง" },
{ id: "2", name: "ไม่ร้ายแรง" },
]);
const optionsfaultLevel = ref<DataOption[]>([
{ id: "0", name: "ไม่ร้ายแรง" },
{ id: "1", name: "ภาคทัณฑ์" },
{ id: "2", name: "ตัดเงินเดือน" },
{ id: "3", name: "ลดขั้นเงินเดือน" },
{ id: "4", name: "ร้ายแรง" },
{ id: "5", name: "ปลดออก" },
{ id: "6", name: "ไล่ออก" },
]);
async function fecthList(data: investigateDisDataRowType[]) {
let datalist: any[] = data.map((e: any) => ({
subject: e.subject,
interrogated: e.interrogated,
fault: convertFault(e.fault),
penaltyLevel: convertPenaltyLevel(e.penaltyLevel),
caseFault: e.caseFault,
dateInvestigate: e.dateInvestigate,
status: convertSatatus(e.status),
active: activeStatus(e.active),
}));
rows.value = datalist;
}
}
function convertSatatus(val: string) {
switch (val) {
case "0":
return "เสร็จสิ้นแล้ว";
case "1":
return "ยุติเรื่อง";
async function fecthDirector(data: directorType[]) {
let datalistDirector: any[] = data.map((e: any) => ({
nameDirector: e.nameDirector,
position: e.position,
duty: e.duty,
email: e.email,
telephone: e.telephone,
}));
rows2.value = datalistDirector;
selected.value = rows2.value;
console.log(rows2.value);
}
}
function activeStatus(val: string) {
switch (val) {
case "0":
return "ยังไม่ได้ยืนยันผล";
case "1":
return "ยืนยันผลเเล้ว";
function convertFault(val: string) {
switch (val) {
case "0":
return "ความผิดวินัยยังไม่ระบุ";
case "1":
return "ความผิดวินัยไม่ร้ายแรง";
case "2":
return "ความผิดวินัยร้ายแรง";
}
}
}
function convertPenaltyLevel(val: string) {
switch (val) {
case "0":
return "ไม่ร้ายแรง";
case "1":
return "ภาคทัณฑ์";
case "3":
return "ตัดเงินเดือน";
case "4":
return "ลดขั้นเงินเดือน";
case "5":
return "ร้ายแรง";
case "6":
return "ปลดออก";
case "7":
return "ไล่ออก";
function convertSatatus(val: string) {
switch (val) {
case "0":
return "เสร็จสิ้นแล้ว";
case "1":
return "ยุติเรื่อง";
}
}
function activeStatus(val: string) {
switch (val) {
case "0":
return "กำลังยืนยันผล";
case "1":
return "ยืนยันผลเเล้ว";
case "2":
return "ยืนยันผล";
}
}
function convertPenaltyLevel(val: string) {
switch (val) {
case "0":
return "ไม่ร้ายแรง";
case "1":
return "ภาคทัณฑ์";
case "3":
return "ตัดเงินเดือน";
case "4":
return "ลดขั้นเงินเดือน";
case "5":
return "ร้ายแรง";
case "6":
return "ปลดออก";
case "7":
return "ไล่ออก";
}
}
return {
fecthList,
rows,
rows2,
optionsTypefault,
optionsfaultLevel,
fecthDirector,
};
}
return {
fecthList,
rows,
};
});
);