ข้อมูลตำแหน่ง:UI+API

This commit is contained in:
oat 2024-02-06 11:23:13 +07:00
parent 9f30a71efe
commit 765a4c94c8
9 changed files with 1069 additions and 16 deletions

View file

@ -0,0 +1,30 @@
import { defineStore } from "pinia";
import { ref } from "vue";
import type {
DataResponse,
DataRow,
} from "../interface/response/position/ListType";
import { useCounterMixin } from "@/stores/mixin";
const { date2Thai } = useCounterMixin();
export const usePositionDataStore = defineStore("PositionData", () => {
const row = ref<DataRow[]>([]);
const name = ref<any>([]);
function save(data: DataResponse[], id: string) {
const list = data.map((e) => ({
...e,
posTypes: undefined,
posTypeId: e.posTypes?.id,
posTypeName: e.posTypes?.posTypeName,
posTypeRank: e.posTypes?.posTypeRank,
createdAt: e.createdAt ? date2Thai(e.createdAt) : "",
lastUpdatedAt: e.lastUpdatedAt ? date2Thai(e.lastUpdatedAt) : "",
})) satisfies DataRow[];
row.value = list.filter((e) => e.posTypeId === id);
}
return {
save,
row,
};
});

View file

@ -0,0 +1,28 @@
import { defineStore } from "pinia";
import { ref } from "vue";
import type {
DataResponse,
DataRow,
} from "../interface/response/position/ListType";
import { useCounterMixin } from "@/stores/mixin";
const { date2Thai } = useCounterMixin();
export const usePositionTypeDataStore = defineStore("PositionTypeData", () => {
const row = ref<DataRow[]>([]);
function save(data: DataResponse[]) {
const list = data.map((e) => ({
...e,
posTypes: undefined,
posTypeId: e.posTypes?.id,
createdAt: e.createdAt ? date2Thai(e.createdAt) : "",
lastUpdatedAt: e.lastUpdatedAt ? date2Thai(e.lastUpdatedAt) : "",
})) satisfies DataRow[];
row.value = list;
}
return {
save,
row,
};
});