api เครื่องราช

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-08-21 16:31:28 +07:00
parent fd1f5ce8e4
commit 9c6ebfb485
6 changed files with 633 additions and 59 deletions

View file

@ -1,9 +1,29 @@
<script setup lang="ts">
import { onMounted, ref, watch } from "vue";
import type { QTableProps } from "quasar";
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import http from "@/plugins/http";
import config from "@/app.config";
const organization = ref<number>(1);
const organizationOptions = ref<any>([{ id: 1, name: "ทั้งหมด" }]);
const DataStore = useInsigniaDataStore();
const props = defineProps({
tab: {
type: String,
},
roundId: {
type: String,
},
fecthInsigniaAll: {
type: Function,
},
fecthInsigniaByOc: {
type: Function,
},
});
const organization = ref<string>("1");
const organizationOptions = ref<any>([{ id: "1", name: "ทั้งหมด" }]);
const visibleColumns = ref<string[]>([
"no",
"citizenId",
@ -173,6 +193,50 @@ const rows = ref<any[]>([
dateSend: "31 ม.ค. 2566",
},
]);
onMounted(async () => {
organizationOptions.value = DataStore.optionsTypeOc;
organization.value = organizationOptions.value[0].id;
// if (props.fecthInsigniaAll) {
// await props.fecthInsigniaAll(props.roundId, props.tab);
// }
if (organization.value !== "" || organization.value !== undefined) {
if (props.fecthInsigniaByOc) {
props.fecthInsigniaByOc(
props.roundId,
organization.value,
"officer",
props.tab
);
}
}
});
const changtypeOc = () => {
if (props.fecthInsigniaByOc) {
props.fecthInsigniaByOc(
props.roundId,
organization.value,
"officer",
props.tab
);
}
};
// const fecthInsigniaAll = async () => {
// let data: any = [];
// for (const item of DataStore.optionsTypeOc) {
// await http
// .get(
// config.API.insigniaList(props.roundId, item["id"], "officer", props.tab)
// )
// .then((res) => {
// // console.log(res);
// data.push(res.data.result);
// })
// .catch((err) => {
// console.log(err);
// });
// }
// console.log(data);
// };
const filterKeyword = ref<string>("");
const filterRef = ref<any>(null);
@ -212,6 +276,7 @@ const paginationLabel = (start: string, end: string, total: string) => {
:outlined="true"
:hide-dropdown-icon="false"
style="min-width: 150px"
@update:model-value="changtypeOc"
/>
<!-- <div>
<q-btn size="md" icon="mdi-download" flat round color="primary">