ปรับ ui สร้างคำสั่ง

This commit is contained in:
Warunee Tamkoo 2024-09-25 10:22:03 +07:00
parent 0247619d87
commit 6af59e5892
2 changed files with 61 additions and 85 deletions

View file

@ -1,20 +1,26 @@
import { defineStore } from "pinia";
import { ref } from "vue";
import type { ListCommand } from "@/modules/18_command/interface/index/Main";
import http from "@/plugins/http";
import config from "@/app.config";
export const useCommandMainStore = defineStore("commandMainStore", () => {
const commandTypes = ref<ListCommand[]>([
{
id: "c94b8ce3-46f2-4ecb-9d3c-4d6b08f33dd9",
name: "คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ",
code: "C-PM-13",
subtitle: "",
commandSysId: "PLACEMENT",
},
]);
const commandTypes = ref<ListCommand[]>([]);
function getCommandTypes(data: ListCommand[]) {
return (commandTypes.value = data);
async function getCommandTypes() {
if (commandTypes.value.length === 0) {
await http
.get(config.API.commandType)
.then(async (res) => {
const data = await res.data.result;
commandTypes.value = data;
})
.catch((err) => {
console.log("get commands: ", err);
});
}
return commandTypes.value;
}
function getCommandTypeById(id: string) {