范围列表调整

This commit is contained in:
Yuan 2023-08-23 15:45:43 +08:00
parent 1ce48a45d0
commit c3d4c7cc12
2 changed files with 27 additions and 5 deletions

View File

@ -44,6 +44,21 @@ export enum DevType {
DEVICE_TYPE_GAMA = 'DEVICE_TYPE_GAMA', DEVICE_TYPE_GAMA = 'DEVICE_TYPE_GAMA',
} }
export const deviceTypeMap = {
DEVICE_TYPE_UNKNOW: '未知设备',
DEVICE_TYPE_RTU: '集中站',
DEVICE_TYPE_STATION: '车站',
DEVICE_TYPE_SIGNAL: '信号机',
DEVICE_TYPE_SWITCH: '道岔',
DEVICE_TYPE_TRACK: '轨道',
DEVICE_TYPE_ENTRY: '方向设备',
DEVICE_TYPE_PLATFORM: '站台',
DEVICE_TYPE_SCADA: '供电区段',
DEVICE_TYPE_WATERPROOF_DOOR: '防淹门',
DEVICE_TYPE_WORK_AREA: '工作区',
DEVICE_TYPE_GAMA: '区域自动驾驶',
};
export function trainMockApi( export function trainMockApi(
lineId: number, lineId: number,
data: { data: {

View File

@ -9,6 +9,7 @@ import { useRoute } from 'vue-router';
import DraggableDialog from './common/DraggableDialog.vue'; import DraggableDialog from './common/DraggableDialog.vue';
import { QTable, useQuasar } from 'quasar'; import { QTable, useQuasar } from 'quasar';
import { errorNotify } from 'src/utils/CommonNotify'; import { errorNotify } from 'src/utils/CommonNotify';
import { deviceTypeMap } from 'src/api/TrainApi';
const $q = useQuasar(); const $q = useQuasar();
const lineId = useRoute().params.id as string; const lineId = useRoute().params.id as string;
@ -16,11 +17,16 @@ const tableRef = ref<QTable>();
const columns: QTable['columns'] = [ const columns: QTable['columns'] = [
{ name: 'id', label: 'ID', field: 'id', align: 'center' }, { name: 'id', label: 'ID', field: 'id', align: 'center' },
{ name: 'lineId', label: '线路ID', field: 'lineId', align: 'center' }, { name: 'lineId', label: '线路ID', field: 'lineId', align: 'center' },
{ name: 'areaName', label: '名称', field: 'areaName', align: 'center' }, {
name: 'areaName',
label: '名称',
field: 'areaName',
align: 'center',
},
{ {
name: 'deviceType', name: 'deviceType',
label: '设备类型', label: '设备类型',
field: 'deviceType', field: (row) => deviceTypeMap[row.deviceType as keyof typeof deviceTypeMap],
align: 'center', align: 'center',
}, },
{ name: 'operations', label: '操作', field: 'operations', align: 'center' }, { name: 'operations', label: '操作', field: 'operations', align: 'center' },
@ -64,13 +70,14 @@ function onEdit(row: IAreaConfigListItem) {
props.onEditClick(row); props.onEditClick(row);
} }
function deleteData(row: IAreaConfigListItem) { function deleteData(row: IAreaConfigListItem) {
console.log(row);
$q.dialog({ message: `确定删除 "${row.areaName}" 吗?`, cancel: true }).onOk( $q.dialog({ message: `确定删除 "${row.areaName}" 吗?`, cancel: true }).onOk(
() => { async () => {
try { try {
deleteDeviceArea(row.id); await deleteDeviceArea(row.id);
} catch (err) { } catch (err) {
errorNotify('删除失败:', err); errorNotify('删除失败:', err);
} finally {
tableRef.value?.requestServerInteraction();
} }
} }
); );