รายการ web services
This commit is contained in:
parent
ae55c3b489
commit
70bebf6e7e
5 changed files with 67 additions and 7 deletions
|
|
@ -4,6 +4,9 @@ import { useQuasar } from "quasar";
|
||||||
|
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
|
||||||
|
import type { ListApi } from "@/modules/06_webservices/interface/index/Main";
|
||||||
|
import type { FormCreate } from "@/modules/06_webservices/interface/request/Main";
|
||||||
|
|
||||||
import DialogHeader from "@/components/DialogHeader.vue";
|
import DialogHeader from "@/components/DialogHeader.vue";
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
@ -14,18 +17,18 @@ const modal = defineModel<boolean>("modal", { required: true });
|
||||||
const isAPIKey = ref<boolean>(false);
|
const isAPIKey = ref<boolean>(false);
|
||||||
const topicRef = ref<any>(null);
|
const topicRef = ref<any>(null);
|
||||||
const apiKey = ref<string>("");
|
const apiKey = ref<string>("");
|
||||||
const options = ref<any[]>([
|
const options = ref<ListApi[]>([
|
||||||
{ label: "API 1", value: "API 1" },
|
{ label: "API 1", value: "API 1" },
|
||||||
{ label: "API 2", value: "API 2" },
|
{ label: "API 2", value: "API 2" },
|
||||||
{ label: "API 3", value: "API 3" },
|
{ label: "API 3", value: "API 3" },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const formData = reactive({
|
const formData = reactive<FormCreate>({
|
||||||
topic: "",
|
topic: "",
|
||||||
access: [],
|
access: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
const titleName = computed(() => {
|
const titleName = computed<string>(() => {
|
||||||
return !isAPIKey.value ? "สร้าง API Key" : "API Key";
|
return !isAPIKey.value ? "สร้าง API Key" : "API Key";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -64,6 +67,7 @@ function onCloseDialog() {
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<q-input
|
<q-input
|
||||||
ref="topicRef"
|
ref="topicRef"
|
||||||
|
class="inputgreen"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
v-model="formData.topic"
|
v-model="formData.topic"
|
||||||
|
|
@ -113,6 +117,7 @@ function onCloseDialog() {
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
API ที่เข้าถึงได้
|
API ที่เข้าถึงได้
|
||||||
<q-option-group
|
<q-option-group
|
||||||
|
disable
|
||||||
:options="options"
|
:options="options"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
keep-color
|
keep-color
|
||||||
|
|
|
||||||
13
src/modules/06_webservices/interface/index/Main.ts
Normal file
13
src/modules/06_webservices/interface/index/Main.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
interface ListWebServices {
|
||||||
|
id: string;
|
||||||
|
topic: string;
|
||||||
|
access: string[];
|
||||||
|
amount: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ListApi {
|
||||||
|
label: string;
|
||||||
|
value: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type { ListWebServices, ListApi };
|
||||||
6
src/modules/06_webservices/interface/request/Main.ts
Normal file
6
src/modules/06_webservices/interface/request/Main.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
interface FormCreate {
|
||||||
|
topic: string;
|
||||||
|
access: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export type { FormCreate };
|
||||||
8
src/modules/06_webservices/interface/response/Main.ts
Normal file
8
src/modules/06_webservices/interface/response/Main.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
interface ResListWebServices {
|
||||||
|
id: string;
|
||||||
|
topic: string;
|
||||||
|
access: string[];
|
||||||
|
amount: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type { ResListWebServices };
|
||||||
|
|
@ -1,14 +1,23 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onMounted, ref } from "vue";
|
import { onMounted, ref } from "vue";
|
||||||
|
import { useQuasar } from "quasar";
|
||||||
|
|
||||||
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
|
||||||
/** importType*/
|
/** importType*/
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
|
import type { ListWebServices } from "@/modules/06_webservices/interface/index/Main";
|
||||||
|
import type { ResListWebServices } from "@/modules/06_webservices/interface/response/Main";
|
||||||
|
|
||||||
import DialogApiKey from "@/modules/06_webservices/components/DialogApiKey.vue";
|
import DialogApiKey from "@/modules/06_webservices/components/DialogApiKey.vue";
|
||||||
import DialogUsability from "@/modules/06_webservices/components/DialogUsability.vue";
|
import DialogUsability from "@/modules/06_webservices/components/DialogUsability.vue";
|
||||||
|
|
||||||
|
/** use*/
|
||||||
|
const $q = useQuasar();
|
||||||
|
const { dialogRemove } = useCounterMixin();
|
||||||
|
|
||||||
/** Table*/
|
/** Table*/
|
||||||
const rows = ref<any>([]);
|
const rows = ref<ListWebServices[]>([]);
|
||||||
const keyword = ref<string>("");
|
const keyword = ref<string>("");
|
||||||
const visibleColumns = ref<string[]>(["topic", "access", "amount"]);
|
const visibleColumns = ref<string[]>(["topic", "access", "amount"]);
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = ref<QTableProps["columns"]>([
|
||||||
|
|
@ -48,13 +57,15 @@ const modalApiKey = ref<boolean>(false);
|
||||||
const modalUsability = ref<boolean>(false);
|
const modalUsability = ref<boolean>(false);
|
||||||
|
|
||||||
function fetchListWebServices() {
|
function fetchListWebServices() {
|
||||||
const data = [
|
const data: ResListWebServices[] = [
|
||||||
{
|
{
|
||||||
|
id: "",
|
||||||
topic: "รายการ web services 1",
|
topic: "รายการ web services 1",
|
||||||
access: ["API1", "API2", "API3"],
|
access: ["API1", "API2", "API3"],
|
||||||
amount: "1",
|
amount: "1",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id: "",
|
||||||
topic: "รายการ web services 2",
|
topic: "รายการ web services 2",
|
||||||
access: ["API1", "API2", "API3"],
|
access: ["API1", "API2", "API3"],
|
||||||
amount: "2",
|
amount: "2",
|
||||||
|
|
@ -63,6 +74,10 @@ function fetchListWebServices() {
|
||||||
rows.value = data;
|
rows.value = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onDeleteData(id: string) {
|
||||||
|
dialogRemove($q, () => {});
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fetchListWebServices();
|
fetchListWebServices();
|
||||||
});
|
});
|
||||||
|
|
@ -140,18 +155,31 @@ onMounted(() => {
|
||||||
>
|
>
|
||||||
<template v-slot:header="props">
|
<template v-slot:header="props">
|
||||||
<q-tr :props="props">
|
<q-tr :props="props">
|
||||||
|
<q-th auto-width />
|
||||||
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
||||||
<span class="text-weight-medium">{{ col.label }}</span>
|
<span class="text-weight-medium">{{ col.label }}</span>
|
||||||
</q-th>
|
</q-th>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:body="props">
|
<template v-slot:body="props">
|
||||||
<q-tr :props="props" class="cursor-pointer">
|
<q-tr :props="props">
|
||||||
|
<q-td auto-width>
|
||||||
|
<q-btn
|
||||||
|
dense
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
color="red"
|
||||||
|
@click="onDeleteData(props.row.id)"
|
||||||
|
icon="delete"
|
||||||
|
>
|
||||||
|
<q-tooltip>ลบข้อมูล</q-tooltip>
|
||||||
|
</q-btn></q-td
|
||||||
|
>
|
||||||
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
||||||
<div v-if="col.name === 'access'">
|
<div v-if="col.name === 'access'">
|
||||||
<q-list dense>
|
<q-list dense>
|
||||||
<q-item v-for="(item, key) in col.value">
|
<q-item v-for="(item, key) in col.value">
|
||||||
<q-item-section> {{ item }}</q-item-section>
|
<q-item-section> - {{ item }}</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
</q-list>
|
</q-list>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue