发布数据管理列表类型显示

This commit is contained in:
dong 2023-11-21 15:16:37 +08:00
parent 29072e2bb1
commit b0814bf7fd
2 changed files with 31 additions and 32 deletions

View File

@ -2,7 +2,7 @@
<div class="q-pa-md">
<q-table
ref="tableRef"
title="发布"
title="发布数据管理"
:style="{ height: tableHeight + 'px' }"
:rows="rows"
:columns="columnDefs"
@ -30,11 +30,6 @@
<template v-slot:body-cell-operations="props" v-if="!isProject">
<q-td :props="props">
<div class="q-gutter-sm row justify-center">
<!-- <q-btn
color="primary"
label="创建仿真"
@click="create(props.row)"
/> -->
<q-btn
color="primary"
label="另存到草稿"
@ -94,13 +89,11 @@ import {
saveToDraft,
PublishItem,
} from '../api/PublishApi';
import { useRoute, useRouter } from 'vue-router';
import { createSimulation } from 'src/api/Simulation';
import { useRoute } from 'vue-router';
import { ApiError } from 'src/boot/axios';
import { useLineStore } from 'src/stores/line-store';
import { MapInfo } from 'src/api/ProjectLinkApi';
import { getCategoryList } from 'src/api/CategoryInfoApi';
const router = useRouter();
import { PictureType } from 'src/protos/picture';
const route = useRoute();
const $q = useQuasar();
@ -138,6 +131,14 @@ const columnDefs: QTableColumn[] = [
},
align: 'center',
},
{
name: 'type',
label: '类型',
field: (row) => {
return getTypeName(row.type);
},
align: 'center',
},
{
name: 'note',
label: '备注',
@ -167,7 +168,6 @@ function categoryName(val?: string) {
const operateDisabled = ref(false);
const tableRef = ref();
const lineStore = useLineStore();
const rows = reactive([]);
const filter = reactive({
name: '',
@ -211,25 +211,6 @@ async function onRequest(props: any) {
}
}
async function create(row: PublishItem) {
createSimulation({ mapId: row.id })
.then((res) => {
const query = {
mapId: res.mapId,
simulationId: res.simulationId,
};
lineStore.setSimulationId(res.simulationId);
router.push({ path: '/linemap', query });
})
.catch((err) => {
const error = err as ApiError;
$q.notify({
type: 'negative',
message: error.title,
});
});
}
async function deleteData(row: PublishItem) {
operateDisabled.value = true;
$q.dialog({
@ -329,4 +310,21 @@ function getCategoryOptions() {
console.log(err, '获取厂家列表失败!');
});
}
const pictureTypeList: { label: string; value: PictureType }[] = [
{ label: '信号布置图', value: PictureType.StationLayout },
{ label: 'PSL', value: PictureType.Psl },
{ label: '继电器柜布置图', value: PictureType.RelayCabinetLayout },
{ label: 'IBP盘', value: PictureType.IBP },
{ label: '列车数据', value: PictureType.TrainData },
];
function getTypeName(val?: number) {
let n = '';
const find = pictureTypeList.find((item) => {
return item.value === val;
});
n = find ? find.label : '';
return n;
}
</script>

View File

@ -99,7 +99,7 @@ export const asyncRoutes: RouteRecordRaw[] = [
name: 'publish',
component: () => import('pages/PublishManage.vue'),
meta: {
label: '发布管理',
label: '发布数据管理',
icon: 'playlist_add_check',
},
},
@ -173,7 +173,8 @@ export const asyncRoutes: RouteRecordRaw[] = [
{
path: '/relayCabinet/:id',
name: 'relayCabinet',
component: () => import('src/layouts/RelayCabinetLayout/RelayCabinetLayout.vue'),
component: () =>
import('src/layouts/RelayCabinetLayout/RelayCabinetLayout.vue'),
meta: {
hidden: true,
},