104 lines
3.2 KiB
TypeScript
104 lines
3.2 KiB
TypeScript
import { defineStore } from "pinia";
|
|
import { ref } from "vue";
|
|
|
|
import type { QTableProps } from "quasar";
|
|
import { useCounterMixin } from "@/stores/mixin";
|
|
|
|
import type {
|
|
MainList,
|
|
ListResponse,
|
|
} from "@/modules/06_evaluate/interface/main";
|
|
|
|
const mixin = useCounterMixin();
|
|
const { date2Thai } = mixin;
|
|
|
|
export const useEvaluateStore = defineStore("evaluateStore", () => {
|
|
const filterKeyword = ref<string>("");
|
|
const columns = ref<QTableProps["columns"]>([]);
|
|
const visibleColumns = ref<string[]>([]);
|
|
const row = ref<MainList[]>([]);
|
|
|
|
/**
|
|
* function เรียกข่อมูลรายการประเมิน
|
|
* @param data ข้อมูลรายการประเมิน
|
|
*/
|
|
async function fetchEvaluateList(data: any) {
|
|
const list = data.map((e: ListResponse) => ({
|
|
id: e.id,
|
|
typeparam: e.type,
|
|
type: e.type,
|
|
type_th: e.type_th,
|
|
dateSend: date2Thai(e.updatedAt),
|
|
status: convertStatus(e.step),
|
|
step: e.step,
|
|
}));
|
|
|
|
row.value = list;
|
|
}
|
|
|
|
const tabMenu = ref<string>("1");
|
|
const checkFileupload = ref<boolean>(false);
|
|
const showLoadStatus = ref<boolean>(false);
|
|
const step = ref<number>(1);
|
|
const currentStep = ref<number>(1);
|
|
const statusUpload = ref<boolean>(false);
|
|
const title = ref<string[]>([
|
|
"ตรวจสอบคุณสมบัติ",
|
|
"จัดเตรียมเอกสารเล่ม 1",
|
|
"ตรวจสอบเอกสารเล่ม 1",
|
|
"รอตรวจสอบคุณสมบัติ",
|
|
"ประกาศบนเว็บไซต์",
|
|
"จัดเตรียมเอกสารเล่ม 2",
|
|
"ตรวจสอบเอกสารเล่ม 2",
|
|
"รอพิจารณาผลการประเมิน",
|
|
"เสร็จสิ้น",
|
|
]);
|
|
|
|
/**
|
|
* function แปรงสถานะ
|
|
* @param val สถานะ
|
|
*/
|
|
function convertStatus(val: string) {
|
|
switch (val) {
|
|
case "CHECK_SPEC":
|
|
return "ตรวจสอบคุณสมบัติด้วยตนเอง";
|
|
case "PREPARE_DOC_V1":
|
|
return "จัดเตรียมเอกสารเล่ม 1";
|
|
case "CHECK_DOC_V1":
|
|
return "ตรวจสอบเอกสารเล่ม 1";
|
|
case "WAIT_CHECK_DOC_V1":
|
|
return "รอตรวจสอบคุณสมบัติ";
|
|
case "ANNOUNCE_WEB":
|
|
return "ประกาศบนเว็บไซต์";
|
|
case "PREPARE_DOC_V2":
|
|
return "จัดเตรียมเอกสารเล่ม 2";
|
|
case "WAIT_CHECK_DOC_V2":
|
|
return "ตรวจสอบเอกสารเล่ม 2";
|
|
case "CHECK_DOC_V2":
|
|
return "รอพิจารณาผลการประเมิน";
|
|
case "DONE":
|
|
return "เสร็จสิ้น";
|
|
}
|
|
}
|
|
|
|
const tabPanels = ref<string>("1");
|
|
const evaluateId = ref<string>("");
|
|
|
|
return {
|
|
filterKeyword,
|
|
columns,
|
|
visibleColumns,
|
|
row,
|
|
fetchEvaluateList,
|
|
|
|
tabMenu,
|
|
checkFileupload,
|
|
step,
|
|
currentStep,
|
|
statusUpload,
|
|
title,
|
|
tabPanels,
|
|
evaluateId,
|
|
showLoadStatus,
|
|
};
|
|
});
|