diff --git a/src/api/LineInfoApi.ts b/src/api/LineInfoApi.ts index 75f17f1..5b54923 100644 --- a/src/api/LineInfoApi.ts +++ b/src/api/LineInfoApi.ts @@ -38,7 +38,7 @@ export async function pageQuery( export function createLine(data: { name: string; lineId: number; - config: string; + config?: string; }) { return api.post(`${UriBase}`, data); } @@ -74,7 +74,7 @@ export async function getLineInfo(id: number): Promise { * @param params * @returns */ -export async function getLineList(): Promise { +export async function getLineList(): Promise> { const response = await api.get(`${UriBase}/list`); return response.data; } diff --git a/src/pages/DraftManage.vue b/src/pages/DraftManage.vue index ae487e1..6bc77a2 100644 --- a/src/pages/DraftManage.vue +++ b/src/pages/DraftManage.vue @@ -137,6 +137,7 @@ import { ref, reactive, onMounted, computed } from 'vue'; import { useQuasar, type QTableColumn, QForm } from 'quasar'; import { pageQuery, createDraft, deleteDraft } from '../api/DraftApi'; import { publishDraft } from '../api/PublishApi'; +import { getLineList } from '../api/LineInfoApi'; const $q = useQuasar(); @@ -156,10 +157,24 @@ const typeOptions = [ { label: '线网', value: 'LineNetwork' }, ]; const createType = ref('Line'); -const lineOptions = [ - { label: '线路1', value: 1 }, - { label: '线路2', value: 2 }, -]; + +let lineOptions: Array<{ label: string; value: number }> = []; +function getAllLineList() { + lineOptions = []; + getLineList() + .then((res) => { + res.forEach((item) => { + const obj = { + label: item.name, + value: item.lineId, + }; + lineOptions.push(obj); + }); + }) + .catch((err) => { + console.log(err, '---err--'); + }); +} const typeOptionsMap = computed(() => { const obj: { [k: string]: string } = {}; @@ -171,6 +186,7 @@ const typeOptionsMap = computed(() => { onMounted(() => { tableRef.value.requestServerInteraction(); + getAllLineList(); }); const columnDefs: QTableColumn[] = [ diff --git a/src/pages/LineInfoManage.vue b/src/pages/LineInfoManage.vue index 25b1e44..00d5706 100644 --- a/src/pages/LineInfoManage.vue +++ b/src/pages/LineInfoManage.vue @@ -28,12 +28,6 @@