ข้อมูลตำแหน่ง:UI+API
This commit is contained in:
parent
9f30a71efe
commit
765a4c94c8
9 changed files with 1069 additions and 16 deletions
30
src/modules/01_metadataNew/stores/positionListStore.ts
Normal file
30
src/modules/01_metadataNew/stores/positionListStore.ts
Normal 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,
|
||||
};
|
||||
});
|
||||
28
src/modules/01_metadataNew/stores/positionTypeStore.ts
Normal file
28
src/modules/01_metadataNew/stores/positionTypeStore.ts
Normal 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,
|
||||
};
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue