This commit is contained in:
joylink_zhaoerwei 2023-06-09 15:15:35 +08:00
commit 0943d9b103
3 changed files with 22 additions and 13 deletions

View File

@ -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<Item> {
* @param params
* @returns
*/
export async function getLineList(): Promise<Item> {
export async function getLineList(): Promise<Array<Item>> {
const response = await api.get(`${UriBase}/list`);
return response.data;
}

View File

@ -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[] = [

View File

@ -28,12 +28,6 @@
<template v-slot:body-cell-operations="props">
<q-td :props="props">
<div class="q-gutter-sm row justify-center">
<q-btn
color="primary"
:disable="operateDisabled"
label="编辑"
:to="`/painting/${props.row.id}`"
/>
<q-btn
color="red"
:disable="operateDisabled"
@ -183,7 +177,6 @@ function onCreate() {
await createLine({
name: LineName.value,
lineId: LineId.value,
config: '',
});
createFormShow.value = false;
tableRef.value.requestServerInteraction(); //