desc: 修改代码
This commit is contained in:
parent
a59d579d57
commit
d65f7fb334
@ -10,7 +10,6 @@ module.exports = {
|
||||
es6: true,
|
||||
},
|
||||
extends: ['plugin:vue/recommended', 'eslint:recommended'],
|
||||
// add your custom rules here
|
||||
//it is base on https://github.com/vuejs/eslint-config-vue
|
||||
rules: {
|
||||
"vue/max-attributes-per-line": [2, {
|
||||
@ -43,7 +42,6 @@ module.exports = {
|
||||
'curly': [2, 'multi-line'],
|
||||
'dot-location': [2, 'property'],
|
||||
'eol-last': 2,
|
||||
// 'eqeqeq': ["error", "always", { "null": "ignore" }], // 全等
|
||||
'generator-star-spacing': [2, {
|
||||
'before': true,
|
||||
'after': true
|
||||
|
388
src/jmap/map.js
388
src/jmap/map.js
@ -1,388 +0,0 @@
|
||||
import * as zrUtil from 'zrender/src/core/util';
|
||||
import zrender from 'zrender';
|
||||
import localStore from 'storejs';
|
||||
import Painter from './painter';
|
||||
import Options from './options';
|
||||
import MouseController from './mouseController';
|
||||
import deviceState from './constant/deviceState';
|
||||
import { selectSkinStyle } from './config/deviceStyle';
|
||||
import deviceType from './constant/deviceType';
|
||||
import { parser, deviceFactory, createBoundingRect, calculateDCenter } from './utils/parser';
|
||||
|
||||
const renderer = 'canvas';
|
||||
const devicePixelRatio = 1;
|
||||
|
||||
class Jlmap {
|
||||
constructor(opts) {
|
||||
// 回调事件
|
||||
this.methods = opts.methods;
|
||||
|
||||
// 鼠标事件
|
||||
this.events = { __Pan: 'pan', __Zoom: 'zoom', Selected: 'selected', Contextmenu: 'contextmenu', DataZoom: 'dataZoom'};
|
||||
|
||||
// 原始数据
|
||||
this.data = {};
|
||||
|
||||
// 皮肤参数
|
||||
this.skinStyle = '';
|
||||
|
||||
// 皮肤风格
|
||||
this.styleDict = {};
|
||||
|
||||
// 设备数据
|
||||
this.mapDevice = {};
|
||||
|
||||
// 默认状态
|
||||
this.defaultStateDict = this.loadDefaultState();
|
||||
|
||||
this.initMapInstance(opts);
|
||||
}
|
||||
|
||||
// 初始化属性有鼠标事件 缩放等
|
||||
initMapInstance(opts) {
|
||||
const width = opts.dom.clientWidth;
|
||||
const height = opts.dom.clientHeight;
|
||||
|
||||
this.$zr = zrender.init(opts.dom, Object.assign({ renderer, devicePixelRatio, width, height }, opts.config));
|
||||
|
||||
this.$options = new Options(Object.assign({ scaleRate: 1, offsetX: 0, offsetY: 0 }, opts.options || {}), (dataZoom) => { this.$mouseController.trigger(this.events.DataZoom, dataZoom); }); // 缩放
|
||||
this.$painter = new Painter(this);
|
||||
this.$painter.updateZrSize({width: this.$zr.getWidth(), height: this.$zr.getHeight()});
|
||||
this.$painter.updateTransform(this.$options);
|
||||
|
||||
this.optionsHandler = this.setOptions.bind(this);
|
||||
|
||||
this.$mouseController = new MouseController(this);
|
||||
this.$mouseController.enable();
|
||||
|
||||
this.$mouseController.on(this.events.__Pan, this.optionsHandler);
|
||||
this.$mouseController.on(this.events.__Zoom, this.optionsHandler);
|
||||
}
|
||||
|
||||
loadStyle(skinStyle) {
|
||||
return selectSkinStyle(skinStyle);
|
||||
}
|
||||
|
||||
loadDefaultState() {
|
||||
const defaultStateDict = {};
|
||||
|
||||
zrUtil.each(Object.keys(deviceState), (type) => {
|
||||
defaultStateDict[type] = {};
|
||||
zrUtil.each(Object.keys(deviceState[type] || {}), (state) => {
|
||||
defaultStateDict[type][state] = deviceState[type][state].Default;
|
||||
}, this);
|
||||
}, this);
|
||||
|
||||
return defaultStateDict;
|
||||
}
|
||||
|
||||
setMap(map) {
|
||||
// 保存皮肤类型
|
||||
if (map.skinVO) {
|
||||
this.skinStyle = map.skinVO.code;
|
||||
}
|
||||
|
||||
// 保存原始数据
|
||||
this.data = map;
|
||||
|
||||
// 加载对应皮肤
|
||||
this.styleDict = this.loadStyle(this.skinStyle);
|
||||
|
||||
// 解析地图数据
|
||||
this.mapDevice = parser(map, this);
|
||||
|
||||
// 数据加载完成 回调
|
||||
if (this.methods.dataLoaded instanceof Function) { this.methods.dataLoaded(this.mapDevice); }
|
||||
|
||||
// 初次渲染视图
|
||||
this.$painter.repaint(this.mapDevice);
|
||||
|
||||
// 视图加载完成 回调
|
||||
if (this.methods.viewLoaded instanceof Function) { this.methods.viewLoaded(this.mapDevice); }
|
||||
|
||||
}
|
||||
|
||||
setDefaultState() {
|
||||
const list = [];
|
||||
|
||||
Object.values(this.mapDevice).forEach(elem => {
|
||||
const code = elem._code;
|
||||
const type = elem._type;
|
||||
// 列车不需要设置默认状态
|
||||
type != deviceType.Train && list.push(Object.assign({ code, type }, this.defaultStateDict[type]));
|
||||
});
|
||||
|
||||
this.update(list);
|
||||
|
||||
if (this.methods.stateLoaded instanceof Function) { this.methods.stateLoaded(list); }
|
||||
}
|
||||
|
||||
setOptions(opts) {
|
||||
const options = this.pullBack(opts);
|
||||
this.$options.update(options);
|
||||
this.$painter.updateTransform(this.$options);
|
||||
|
||||
if (this.$options.disabled == true) {
|
||||
this.$mouseController.disable();
|
||||
} else {
|
||||
this.$mouseController.enable(opts);
|
||||
}
|
||||
|
||||
if (this.methods.optionsUpdate instanceof Function) { this.methods.optionsUpdate(this.$options); }
|
||||
}
|
||||
|
||||
setCenter(deviceCode) {
|
||||
const device = this.mapDevice[deviceCode];
|
||||
if (device && device.instance) {
|
||||
var rect = createBoundingRect(device.instance);
|
||||
var dcenter = calculateDCenter(rect, { width: this.$zr.getWidth(), height: this.$zr.getHeight() });
|
||||
this.setOptions(dcenter);
|
||||
}
|
||||
}
|
||||
|
||||
setLayerVisible(layer) {
|
||||
this.$painter.setLayerVisible(layer);
|
||||
}
|
||||
|
||||
setLevelVisible(list, show) {
|
||||
this.$painter.setLevelVisible(list, show);
|
||||
}
|
||||
|
||||
render(list) {
|
||||
(list || []).forEach(elem => {
|
||||
const type = elem.type;
|
||||
const code = elem.code;
|
||||
const oDevice = this.mapDevice[code] || deviceFactory(type, this.styleDict[type], elem);
|
||||
const nDevice = Object.assign(oDevice || {}, elem);
|
||||
this.dataSync(nDevice, nDevice._dispose, !this.mapDevice[code]);
|
||||
this.$painter.delete(oDevice);
|
||||
if (!elem._dispose) {
|
||||
this.mapDevice[code] = nDevice;
|
||||
this.$painter.add(nDevice);
|
||||
}
|
||||
});
|
||||
|
||||
if (this.methods.viewUpdate instanceof Function) { this.methods.viewUpdate(list); }
|
||||
}
|
||||
|
||||
// 中间处理
|
||||
hookHandle(elem) {
|
||||
// 如果是延时计时,需要保存计数值到全局
|
||||
if (elem._type === deviceType.StationCounter) {
|
||||
let val = '' + elem.val;
|
||||
if (val === '0' || !elem.val) {
|
||||
val = elem.val = localStore.get(elem._code) || '0';
|
||||
}
|
||||
|
||||
localStore(elem._code, val);
|
||||
}
|
||||
|
||||
return elem;
|
||||
}
|
||||
|
||||
// 后处理
|
||||
postHandle(list) {
|
||||
list.forEach(elem => {
|
||||
if (elem._type == deviceType.Switch) {
|
||||
const item = this.mapDevice[elem.code];
|
||||
if (item) {
|
||||
const sectionA = this.mapDevice[item.sectionACode];
|
||||
const sectionB = this.mapDevice[item.sectionBCode];
|
||||
const sectionC = this.mapDevice[item.sectionCCode];
|
||||
if (sectionA && sectionB && sectionC) {
|
||||
item['cutOff'] = sectionA.cutOff;
|
||||
item['sectionAstatus'] = sectionA.status;
|
||||
item['sectionBstatus'] = sectionB.status;
|
||||
item['sectionCstatus'] = sectionC.status;
|
||||
}
|
||||
}
|
||||
|
||||
this.$painter.update(item);
|
||||
}
|
||||
|
||||
if (elem._type == deviceType.Section) {
|
||||
const item = this.mapDevice[elem.code];
|
||||
if (item) {
|
||||
const swch = this.mapDevice[item.relSwitchCode];
|
||||
if (swch) {
|
||||
const sectionA = this.mapDevice[swch.sectionACode];
|
||||
const sectionB = this.mapDevice[swch.sectionBCode];
|
||||
const sectionC = this.mapDevice[swch.sectionCCode];
|
||||
if (sectionA && sectionB && sectionC) {
|
||||
swch['sectionAstatus'] = sectionA.status;
|
||||
swch['sectionBstatus'] = sectionB.status;
|
||||
swch['sectionCstatus'] = sectionC.status;
|
||||
}
|
||||
|
||||
this.$painter.update(swch);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
update(list) {
|
||||
(list || []).forEach(elem => {
|
||||
const code = elem.code;
|
||||
const oDevice = this.mapDevice[code] || {};
|
||||
if (elem._dispose) {
|
||||
this.$painter.delete(oDevice);
|
||||
} else {
|
||||
const nDevice = Object.assign(oDevice, this.hookHandle(elem));
|
||||
this.$painter.update(nDevice);
|
||||
}
|
||||
});
|
||||
|
||||
// 状态后处理
|
||||
this.postHandle(list);
|
||||
|
||||
if (this.methods.stateUpdate instanceof Function) { this.methods.stateUpdate(list); }
|
||||
}
|
||||
|
||||
pullBack(payload) {
|
||||
if (payload.type === 'zoom') {
|
||||
const zrWidth = this.$zr.getWidth();
|
||||
const zrHeight = this.$zr.getHeight();
|
||||
const originX = payload.originX || zrWidth / 2;
|
||||
const originY = payload.originY || zrHeight / 2;
|
||||
const x = (this.$options.offsetX + originX) / this.$options.scaleRate;
|
||||
const y = (this.$options.offsetY + originY) / this.$options.scaleRate;
|
||||
const newScaleRate = this.$options.getScaleRate(payload.scale);
|
||||
const dx = originX - (x * newScaleRate - this.$options.offsetX);
|
||||
const dy = originY - (y * newScaleRate - this.$options.offsetY);
|
||||
payload.dx = dx;
|
||||
payload.dy = dy;
|
||||
}
|
||||
|
||||
return payload || {};
|
||||
}
|
||||
|
||||
dataSync(model, isDel, isAdd) {
|
||||
const code = model.code;
|
||||
const type = model.type;
|
||||
|
||||
let prop = null;
|
||||
switch (type) {
|
||||
case deviceType.Link: prop = 'linkList'; break;
|
||||
case deviceType.Sction: prop = 'sectionList'; break;
|
||||
case deviceType.Switch: prop = 'switchList'; break;
|
||||
case deviceType.Signal: prop = 'signalList'; break;
|
||||
case deviceType.Station: prop = 'stationList'; break;
|
||||
case deviceType.StationStand: prop = 'stationStandList'; break;
|
||||
case deviceType.StationControl: prop = 'stationControlList'; break;
|
||||
case deviceType.StationCounter: prop = 'stationCounterList'; break;
|
||||
case deviceType.ZcControl: prop = 'zcControlList'; break;
|
||||
case deviceType.StationDelayUnlock: prop = 'stationDelayUnlockList'; break;
|
||||
case deviceType.LcControl: prop = 'lcControlList'; break;
|
||||
case deviceType.LimitControl: prop = 'tempSpeedLimitList'; break;
|
||||
case deviceType.ImageControl: prop = 'imageControl'; break;
|
||||
case deviceType.Train: prop = 'trainList'; break;
|
||||
case deviceType.TrainWindow: prop = 'trainWindowList'; break;
|
||||
case deviceType.Line: prop = 'lineList'; break;
|
||||
case deviceType.Text: prop = 'textList'; break;
|
||||
}
|
||||
|
||||
const list = this.data[prop];
|
||||
if (list) {
|
||||
if (isAdd) {
|
||||
list.push(model);
|
||||
}
|
||||
if (isDel) {
|
||||
const idex = list.findIndex(elem => { return elem.code == code; });
|
||||
if (idex >= 0) {
|
||||
list.splice(idex, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getZr() {
|
||||
return this.$zr;
|
||||
}
|
||||
|
||||
getEvents() {
|
||||
return this.events;
|
||||
}
|
||||
|
||||
getSkinStyle() {
|
||||
return this.skinStyle;
|
||||
}
|
||||
|
||||
getStyleDict() {
|
||||
return this.styleDict;
|
||||
}
|
||||
|
||||
getDefaultStateDict() {
|
||||
return this.defaultStateDict;
|
||||
}
|
||||
|
||||
getDeviceByCode(code) {
|
||||
return this.mapDevice[code];
|
||||
}
|
||||
|
||||
resize(opt) {
|
||||
this.$zr.resize(opt);
|
||||
this.$painter.updateZrSize(opt);
|
||||
}
|
||||
|
||||
refresh() {
|
||||
this.$painter.refresh();
|
||||
}
|
||||
|
||||
clearTrainView() {
|
||||
this.$painter.clearLevel(deviceType.Train);
|
||||
}
|
||||
|
||||
clear() {
|
||||
this.$painter.clear();
|
||||
}
|
||||
|
||||
dispose() {
|
||||
this.off(this.events.Pan, this.optionsHandler);
|
||||
this.off(this.events.Zoom, this.optionsHandler);
|
||||
|
||||
this.skinStyle = '';
|
||||
this.styleDict = {};
|
||||
this.mapDevice = {};
|
||||
|
||||
this.$mouseController.dispose();
|
||||
this.$zr && zrender.dispose(this.$zr);
|
||||
this.$painter.dispose();
|
||||
}
|
||||
|
||||
on(eventname, cb, context) {
|
||||
const idx = Object.values(this.events).indexOf(eventname);
|
||||
if (idx >= 0) {
|
||||
switch (eventname) {
|
||||
case this.events.Selected:
|
||||
this.$mouseController.on(this.events.Selected, cb, context);
|
||||
break;
|
||||
case this.events.Contextmenu:
|
||||
this.$mouseController.on(this.events.Contextmenu, cb, context);
|
||||
break;
|
||||
case this.events.DataZoom:
|
||||
this.$mouseController.on(this.events.DataZoom, cb, context);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
off(eventname, cb) {
|
||||
const idx = Object.values(this.events).indexOf(eventname);
|
||||
if (idx >= 0) {
|
||||
switch (eventname) {
|
||||
case this.events.Selected:
|
||||
this.$mouseController.off(this.events.Selected, cb);
|
||||
break;
|
||||
case this.events.Contextmenu:
|
||||
this.$mouseController.off(this.events.Contextmenu, cb);
|
||||
break;
|
||||
case this.events.DataZoom:
|
||||
this.$mouseController.off(this.events.DataZoom, cb);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default Jlmap;
|
@ -55,11 +55,11 @@ export const attribute = {
|
||||
{ prop: 'leftSdCode', label: '左侧侧向Link:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: [], optionCode: 'linkList' },
|
||||
{ prop: 'rightFdCode', label: '右侧正向Link:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: [], optionCode: 'linkList' },
|
||||
{ prop: 'rightSdCode', label: '右侧侧向Link:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: [], optionCode: 'linkList' },
|
||||
{ prop: 'lp', label: 'Link 起点坐标:', type: 'coordinate', children: [
|
||||
{ prop: 'lp', label: 'Link 起点坐标:', type: 'coordinate', width: '160px', children: [
|
||||
{ prop: 'lp.x', firstLevel: 'lp', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px', disabled: true },
|
||||
{ prop: 'lp.y', firstLevel: 'lp', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px', disabled: true }
|
||||
] },
|
||||
{ prop: 'rp', label: 'Link 终点坐标:', type: 'coordinate', children: [
|
||||
{ prop: 'rp', label: 'Link 终点坐标:', type: 'coordinate', width: '160px', children: [
|
||||
{ prop: 'rp.x', firstLevel: 'rp', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px', disabled: true },
|
||||
{ prop: 'rp.y', firstLevel: 'rp', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px', disabled: true }
|
||||
] }
|
||||
@ -326,7 +326,7 @@ export const attribute = {
|
||||
{ prop: 'kmPost', label: '公里标名称:', type: 'input' },
|
||||
{ prop: 'kmPostFont', label: '公里标字体:', type: 'font', placeholder: '公里标字体' },
|
||||
{ prop: 'kmPostFontColor', label: '公里标字体颜色:', type: 'color' },
|
||||
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'y', label: 'x坐标:', type: 'number', placeholder: 'px' },
|
||||
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x坐标:', type: 'number', placeholder: 'px' },
|
||||
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y坐标:', type: 'number', placeholder: 'px' }
|
||||
],
|
||||
rules: {
|
||||
@ -350,5 +350,100 @@ export const attribute = {
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
stationControl: {
|
||||
attr: {
|
||||
labelWidth: '160px',
|
||||
items: [
|
||||
{ prop: 'stationCode', label: '所属设备集中站:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: [], optionCode: 'stationList' },
|
||||
{ prop: 'code', label: '控制模式编码:', type: 'select', optionLabel: 'code', optionValue: 'code', options: [], optionCode: 'stationControlList', change: true, deviceChange: 'deviceChange' },
|
||||
{ prop: 'zcCode', label: '所属zc区域编码:', type: 'select', optionLabel: 'code&&name', optionValue: 'code', options: [], optionCode: 'zcList' },
|
||||
{ prop: 'name', label: '控制模式名称:', type: 'input' },
|
||||
{ prop: 'zokContent', label: '中控内容:', type: 'input' },
|
||||
{ prop: 'zakContent', label: '站控内容:', type: 'input' },
|
||||
{ prop: 'jjzkContent', label: '紧急站控/总报警内容:', type: 'input' },
|
||||
{ prop: 'zzkContent', label: '站中控内容:', type: 'input' },
|
||||
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: '坐标 x:', type: 'number', placeholder: 'px' },
|
||||
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: '坐标 y:', type: 'number', placeholder: 'px' }
|
||||
],
|
||||
rules: {
|
||||
code: [
|
||||
{ required: true, message: '请选择设备', trigger: 'change' }
|
||||
],
|
||||
stationCode: [
|
||||
{ required: true, message: '请选择所属车站', trigger: 'change' }
|
||||
],
|
||||
zokContent: [
|
||||
{ required: true, message: '请输入中控内容', trigger: 'blur' }
|
||||
],
|
||||
zakContent: [
|
||||
{ required: true, message: '请输入站控内容', trigger: 'blur' }
|
||||
],
|
||||
jjzkContent: [
|
||||
{ required: true, message: '请输入紧急站控内容', trigger: 'blur' }
|
||||
],
|
||||
zzkContent: [
|
||||
{ required: true, message: '请输入站中控内容', trigger: 'blur' }
|
||||
],
|
||||
'position.x': [
|
||||
{ required: true, message: '请输入坐标x', trigger: 'blur' }
|
||||
],
|
||||
'position.y': [
|
||||
{ required: true, message: '请输入坐标y', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
stationStand: {
|
||||
attr: {
|
||||
labelWidth: '130px',
|
||||
items: [
|
||||
{ prop: 'deviceStationCode', label: '所属设备集中站:', type: 'select', optionLabel: 'name', optionValue: 'code', options: [], optionCode: 'stationList' },
|
||||
{ prop: 'code', label: '站台编码:', type: 'select', optionLabel: 'code&&name', optionValue: 'code', options: [], optionCode: 'stationStandList', change: true, deviceChange: 'deviceChange' },
|
||||
{ prop: 'name', label: '站台名称:', type: 'input', disabled: true },
|
||||
{ prop: 'stationCode', label: '所属车站:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: [], optionCode: 'stationList' },
|
||||
{ prop: 'direction', label: '上下行方向:', type: 'select', optionLabel: 'name', optionValue: 'code', options: [], optionCode: 'RunDirectionTypeList' },
|
||||
{ prop: 'visible', label: '是否显示:', type: 'checkbox' },
|
||||
{ prop: 'nameShow', label: '是否显示名称:', type: 'checkbox' },
|
||||
{ prop: 'doorLocationType', label: '站台方向:', type: 'select', optionLabel: 'name', optionValue: 'code', options: [], optionCode: 'DoorLocationTypeList' },
|
||||
{ prop: 'hasDoor', label: '是否显示屏蔽门:', type: 'checkbox' },
|
||||
{ prop: 'width', label: '宽度 w:', type: 'number', min: 0, max: 2000, placeholder: 'px' },
|
||||
{ prop: 'height', label: '高度 h', type: 'number', min: 0, max: 2000, placeholder: 'px' },
|
||||
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: '坐标 x:', type: 'number', placeholder: 'px' },
|
||||
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: '坐标 y:', type: 'number', placeholder: 'px' }
|
||||
],
|
||||
rules: {
|
||||
code: [
|
||||
{ required: true, message: '请重新选择设备', trigger: 'change' }
|
||||
],
|
||||
stationCode: [
|
||||
{ required: true, message: '请选择关联车站', trigger: 'change' }
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: '请输入计数器名称', trigger: 'change' }
|
||||
],
|
||||
doorLocationType: [
|
||||
{ required: true, message: '请选择站台方向', trigger: 'change' }
|
||||
],
|
||||
deviceStationCode: [
|
||||
{ required: true, message: '请选择所属设备集中站', trigger: 'change' }
|
||||
],
|
||||
direction: [
|
||||
{ required: true, message: '请选择上下行方向', trigger: 'change' }
|
||||
],
|
||||
width: [
|
||||
{ required: true, message: '请输入车站宽度', trigger: 'change' }
|
||||
],
|
||||
height: [
|
||||
{ required: true, message: '请输入车站高度', trigger: 'change' }
|
||||
],
|
||||
'position.x': [
|
||||
{ required: true, message: '请输入x坐标', trigger: 'change' }
|
||||
],
|
||||
'position.y': [
|
||||
{ required: true, message: '请输入y坐标', trigger: 'change' }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -82,7 +82,7 @@ function saveMapDeviceDefaultConvert(state) {
|
||||
// 是否集中站
|
||||
if (map.stationControlList && map.stationControlList.length) {
|
||||
map.stationControlList.forEach(elem => {
|
||||
const station = deviceMap[elem.stationCode] ? deviceMap[elem.stationCode].model : null;
|
||||
const station = deviceMap[elem.stationCode];
|
||||
if (station) {
|
||||
station.centralized = true;
|
||||
}
|
||||
@ -110,7 +110,7 @@ function saveMapDeviceDefaultConvert(state) {
|
||||
// 站台轨设置
|
||||
if (map.stationStandList && map.stationStandList.length && map.sectionList && map.sectionList.length) {
|
||||
map.stationStandList.forEach((stand) => {
|
||||
const stopPoint = deviceMap[stand.stopPointCode] ? deviceMap[stand.stopPointCode].model : null;
|
||||
const stopPoint = deviceMap[stand.stopPointCode];
|
||||
if (stopPoint) {
|
||||
map.sectionList.forEach(section => {
|
||||
if (section.type === '01' &&
|
||||
@ -155,19 +155,19 @@ function saveMapDeviceDefaultConvert(state) {
|
||||
// 设置道岔区段
|
||||
if (map.switchList && map.switchList.length && map.sectionList && map.sectionList.length) {
|
||||
map.switchList.forEach(elem => {
|
||||
const sectiona = deviceMap[elem.sectionACode] ? deviceMap[elem.sectionACode].model : null;
|
||||
const sectiona = deviceMap[elem.sectionACode];
|
||||
if (sectiona && sectiona.type !== '03') {
|
||||
sectiona.nameShow = false;
|
||||
sectiona.isSwitchSection = true;
|
||||
sectiona.relSwitchCode = elem.code;
|
||||
}
|
||||
const sectionb = deviceMap[elem.sectionBCode] ? deviceMap[elem.sectionBCode].model : null;
|
||||
const sectionb = deviceMap[elem.sectionBCode];
|
||||
if (sectionb && sectiona.type !== '03') {
|
||||
sectionb.nameShow = false;
|
||||
sectionb.isSwitchSection = true;
|
||||
sectionb.relSwitchCode = elem.code;
|
||||
}
|
||||
const sectionc = deviceMap[elem.sectionCCode] ? deviceMap[elem.sectionCCode].model : null;
|
||||
const sectionc = deviceMap[elem.sectionCCode];
|
||||
if (sectionc && sectiona.type !== '03') {
|
||||
sectionc.nameShow = false;
|
||||
sectionc.isSwitchSection = true;
|
||||
|
@ -57,3 +57,6 @@
|
||||
.el-card__body {
|
||||
padding: 0px;
|
||||
}
|
||||
.el-radio{
|
||||
margin-right: 0;
|
||||
}
|
||||
|
@ -265,11 +265,13 @@ export default {
|
||||
|
||||
this.mapSaveing = true;
|
||||
this.$store.dispatch('map/saveMapDeviceDefaultConvert').then(() => {
|
||||
console.log(Object.assign(map, { mapId: this.$route.params.mapId }));
|
||||
saveMap(Object.assign(map, { mapId: this.$route.params.mapId })).then(response => {
|
||||
this.$message.success('保存成功');
|
||||
this.mapSaveing = false;
|
||||
this.initAutoSaveTask();
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
this.$messageBox('保存失败');
|
||||
this.mapSaveing = false;
|
||||
if (error.code === 40004 || error.code === 40005 || error.code === 40003) {
|
||||
|
@ -66,11 +66,11 @@
|
||||
<el-form-item v-if="!item.isHidden" :key="item.prop" :label="item.label" :prop="item.prop" :required="item.required">
|
||||
<div v-if="!item.firstLevel">
|
||||
<el-input-number v-model="formModel[item.prop]" :min="item.min" :max="item.max" :label="item.label" :disabled="item.disabled" />
|
||||
<span style="padding-left: 5px;">{{ item.placeholder }}</span>
|
||||
<span style="padding-left: 1px;">{{ item.placeholder }}</span>
|
||||
</div>
|
||||
<div v-else>
|
||||
<el-input-number v-model="formModel[item.firstLevel][item.secondLevel]" :min="item.min" :max="item.max" :label="item.label" :disabled="item.disabled" />
|
||||
<span style="padding-left: 5px;">{{ item.placeholder }}</span>
|
||||
<span style="padding-left: 1px;">{{ item.placeholder }}</span>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</template>
|
||||
@ -82,14 +82,14 @@
|
||||
<template v-if="checkFieldType(item, 'radio')">
|
||||
<el-form-item v-if="!item.isHidden" :key="item.prop" :label="item.label" :prop="item.prop" :required="item.required">
|
||||
<el-radio-group v-model="formModel[item.prop]" :disabled="item.disabled">
|
||||
<el-radio v-for="(opts, index) in item.radioList" :key="index" :label="opts.value">{{ opts.label }}</el-radio>
|
||||
<el-radio v-for="(opts, index) in item.radioList" :key="index" :border="item.border" :label="opts.value">{{ opts.label }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<!-- 坐标点并列显示 -->
|
||||
<template v-if="checkFieldType(item, 'coordinate')">
|
||||
<div v-if="!item.isHidden" :key="item.prop" class="coordinate">
|
||||
<span class="title" :style="item.width">{{ item.label }}</span>
|
||||
<span class="title" :style="{width: item.width}">{{ item.label }}</span>
|
||||
<div v-for="opt in item.children" :key="opt.code" class="listWidth">
|
||||
<el-form-item :label="opt.label" :prop="opt.prop" :label-width="opt.labelWidth">
|
||||
<el-input-number v-model="formModel[opt.firstLevel][opt.secondLevel]" :label="opt.label" :disabled="opt.disabled" />
|
||||
@ -100,7 +100,7 @@
|
||||
<!-- 多个坐标点绘制 -->
|
||||
<template v-if="checkFieldType(item, 'points')">
|
||||
<div v-if="!item.isHidden" :key="item.prop" class="coordinate">
|
||||
<span class="title" :style="item.width">{{ item.label }}</span>
|
||||
<span class="title" :style="{width: item.width}">{{ item.label }}</span>
|
||||
<div class="point-section">
|
||||
<template v-for="(point, index) in formModel[item.prop]">
|
||||
<div :key="index" style="overflow: hidden;">
|
||||
@ -194,10 +194,11 @@ export default {
|
||||
return option.name + ' (' + option.code+ ')';
|
||||
} else if (label == 'code&&name') {
|
||||
return option.code + ' (' + option.name+ ')';
|
||||
} else {
|
||||
return option.label;
|
||||
}
|
||||
},
|
||||
decompose(item, prop) {
|
||||
console.log(prop);
|
||||
if (!prop.includes('.')) {
|
||||
return prop;
|
||||
}
|
||||
@ -243,7 +244,7 @@ export default {
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
line-height: 40px;
|
||||
padding: 0 12px 0 0;
|
||||
// padding: 0 12px 0 0;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
line-height: 28px;
|
||||
|
@ -26,91 +26,13 @@
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<template v-if="isNew">
|
||||
<el-form ref="make1" label-width="120px" :model="addModel" size="mini" :rules="makeRules1">
|
||||
<el-form-item label="显示长度:" prop="lengthShow">
|
||||
<el-input-number v-model="addModel.lengthShow" :min="0" />px
|
||||
</el-form-item>
|
||||
<el-form-item label="真实长度:" prop="lengthFact">
|
||||
<el-input-number v-model="addModel.lengthFact" :min="0" />米
|
||||
</el-form-item>
|
||||
<el-form-item label="颜色:" prop="color">
|
||||
<el-color-picker v-model="addModel.color" :predefine="skins" />
|
||||
</el-form-item>
|
||||
<el-form-item label="坐标 x:" prop="x">
|
||||
<el-input-number v-model="addModel.x" />px
|
||||
</el-form-item>
|
||||
<el-form-item label="坐标 y:" prop="y">
|
||||
<el-input-number v-model="addModel.y" />px
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<config-list ref="make1" :form="formMake1" :form-model="addModel" :rules="makeRules1" />
|
||||
</template>
|
||||
<template v-if="isFd">
|
||||
<el-form ref="make2" label-width="120px" :model="addModel" size="mini" :rules="makeRules2">
|
||||
<el-form-item label="基础Link:" prop="code">
|
||||
<el-select v-model="addModel.code" filterable placeholder="请选择">
|
||||
<el-option
|
||||
v-for="option in linkList"
|
||||
:key="option.code"
|
||||
:label="option.name"
|
||||
:value="option.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="方向:" prop="direct">
|
||||
<el-radio-group v-model="addModel.direct">
|
||||
<el-radio
|
||||
v-for="item in LinkDriectTypeList"
|
||||
:key="item.value"
|
||||
:label="item.value"
|
||||
border
|
||||
:disabled="item.disabled"
|
||||
>{{ item.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="!isSd" label="显示长度:" prop="lengthShow">
|
||||
<el-input-number v-model="addModel.lengthShow" :min="0" />px
|
||||
</el-form-item>
|
||||
<el-form-item label="真实长度:" prop="lengthFact">
|
||||
<el-input-number v-model="addModel.lengthFact" :min="0" />米
|
||||
</el-form-item>
|
||||
<el-form-item label="颜色:" prop="color">
|
||||
<el-color-picker v-model="addModel.color" :predefine="skins" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<config-list ref="make2" :form="formMake2" :form-model="addModel" :rules="makeRules2" />
|
||||
</template>
|
||||
<template v-if="isSd">
|
||||
<el-form ref="make3" label-width="120px" :model="addModel" size="mini" :rules="makeRules3">
|
||||
<el-form-item label="左侧正向Link:" prop="lfd">
|
||||
<el-select v-model="addModel.lfd" filterable placeholder="请选择">
|
||||
<el-option
|
||||
v-for="option in linkList"
|
||||
:key="option.code"
|
||||
:label="option.name"
|
||||
:value="option.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="右侧正向Link:" prop="rfd">
|
||||
<el-select v-model="addModel.rfd" filterable placeholder="请选择">
|
||||
<el-option
|
||||
v-for="option in linkList"
|
||||
:key="option.code"
|
||||
:label="option.name"
|
||||
:value="option.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="!isSd" label="显示长度:" prop="lengthShow">
|
||||
<el-input-number v-model="addModel.lengthShow" :min="0" />px
|
||||
</el-form-item>
|
||||
<el-form-item label="真实长度:" prop="lengthFact">
|
||||
<el-input-number v-model="addModel.lengthFact" :min="0" />米
|
||||
</el-form-item>
|
||||
<el-form-item label="颜色:" prop="color">
|
||||
<el-color-picker v-model="addModel.color" :predefine="skins" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<config-list ref="make3" :form="formMake3" :form-model="addModel" :rules="makeRules3" />
|
||||
</template>
|
||||
</el-form>
|
||||
</el-scrollbar>
|
||||
@ -129,7 +51,6 @@ import { mapGetters } from 'vuex';
|
||||
import { getUID } from '@/jmap/utils/Uid';
|
||||
import { getUName } from '@/jmap/utils/Uname';
|
||||
import ConfigList from './config/list';
|
||||
import { getAttrList, getAttrRules } from '@/scripts/attribute';
|
||||
|
||||
export default {
|
||||
name: 'LinkDraft',
|
||||
@ -150,7 +71,6 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
form: getAttrList('link', 'attr', this),
|
||||
linkLists: [],
|
||||
activeName: 'first',
|
||||
LinkType: '0',
|
||||
@ -231,29 +151,104 @@ export default {
|
||||
...mapGetters('map', [
|
||||
'linkList'
|
||||
]),
|
||||
form() {
|
||||
const form = {
|
||||
labelWidth: '130px',
|
||||
items: [
|
||||
{ prop: 'code', label: 'Link编码:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.linkList, change: true, deviceChange: this.deviceChange },
|
||||
{ prop: 'name', label: 'Link名称:', type: 'input' },
|
||||
{ prop: 'lengthShow', label: 'Link显示长度:', type: 'number', min: 50, placeholder: 'px' },
|
||||
{ prop: 'lengthFact', label: 'Link实际长度:', type: 'number', min: 0, placeholder: '米' },
|
||||
{ prop: 'color', label: 'Link颜色:', type: 'color' },
|
||||
{ prop: 'leftFdCode', label: '左侧正向Link:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.linkList },
|
||||
{ prop: 'leftSdCode', label: '左侧侧向Link:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.linkList },
|
||||
{ prop: 'rightFdCode', label: '右侧正向Link:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.linkList },
|
||||
{ prop: 'rightSdCode', label: '右侧侧向Link:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.linkList },
|
||||
{ prop: 'lp', label: 'Link 起点坐标:', type: 'coordinate', width: '160px', children: [
|
||||
{ prop: 'lp.x', firstLevel: 'lp', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px', disabled: true },
|
||||
{ prop: 'lp.y', firstLevel: 'lp', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px', disabled: true }
|
||||
] },
|
||||
{ prop: 'rp', label: 'Link 终点坐标:', type: 'coordinate', width: '160px', children: [
|
||||
{ prop: 'rp.x', firstLevel: 'rp', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px', disabled: true },
|
||||
{ prop: 'rp.y', firstLevel: 'rp', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px', disabled: true }
|
||||
] }
|
||||
]
|
||||
};
|
||||
return form;
|
||||
},
|
||||
rules() {
|
||||
const baseRules = getAttrRules('link', 'attr');
|
||||
const rules = {
|
||||
code: [
|
||||
{ required: true, message: '请选择设备', trigger: 'change' }
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: '请输入Link名称', trigger: 'blur' }
|
||||
],
|
||||
lengthFact: [
|
||||
{ required: true, message: '请输入Link实际长度', trigger: 'blur' }
|
||||
]
|
||||
};
|
||||
// 清空表单验证提示信息
|
||||
this.$nextTick(function () {
|
||||
this.$refs.dataform.clearValidate();
|
||||
});
|
||||
|
||||
return baseRules.rules;
|
||||
return rules;
|
||||
},
|
||||
|
||||
formMake1() {
|
||||
const form = {
|
||||
labelWidth: '120px',
|
||||
items: [
|
||||
{ prop: 'lengthShow', label: '显示长度:', type: 'number', min: 0, placeholder: 'px' },
|
||||
{ prop: 'lengthFact', label: '真实长度:', type: 'number', min: 0, placeholder: '米' },
|
||||
{ prop: 'color', label: '颜色:', type: 'color' },
|
||||
{ prop: 'x', label: '坐标 x:', type: 'number', placeholder: 'px' },
|
||||
{ prop: 'y', label: '坐标 y:', type: 'number', placeholder: 'px' }
|
||||
]
|
||||
};
|
||||
return form;
|
||||
},
|
||||
formMake2() {
|
||||
const form = {
|
||||
labelWidth: '120px',
|
||||
items: [
|
||||
{ prop: 'code', label: '基础Link:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.linkList },
|
||||
{ prop: 'direct', label: '方向:', type: 'radio', border: true, radioList: this.LinkDriectTypeList },
|
||||
{ prop: 'lengthShow', label: '显示长度:', type: 'number', min: 0, placeholder: 'px', isHidden: !this.isSd },
|
||||
{ prop: 'lengthFact', label: '真实长度:', type: 'number', min: 0, placeholder: '米' },
|
||||
{ prop: 'color', label: '颜色:', type: 'color' }
|
||||
]
|
||||
};
|
||||
return form;
|
||||
},
|
||||
formMake3() {
|
||||
const form = {
|
||||
labelWidth: '120px',
|
||||
items: [
|
||||
{ prop: 'lfd', label: '左侧正向Link:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.linkList },
|
||||
{ prop: 'rfd', label: '右侧正向Link:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.linkList },
|
||||
{ prop: 'lengthShow', label: '显示长度:', type: 'number', min: 0, placeholder: 'px', isHidden: !this.isSd },
|
||||
{ prop: 'lengthFact', label: '真实长度:', type: 'number', min: 0, placeholder: '米' },
|
||||
{ prop: 'color', label: '颜色:', type: 'color' }
|
||||
]
|
||||
};
|
||||
return form;
|
||||
},
|
||||
|
||||
// 是否初始link
|
||||
isNew() {
|
||||
this.addModel.type = '01';
|
||||
// this.addModel.type = '01';
|
||||
return this.LinkType === '0';
|
||||
},
|
||||
// 是否正向link
|
||||
isFd() {
|
||||
this.addModel.type = '01';
|
||||
// this.addModel.type = '01';
|
||||
return this.LinkType === '1';
|
||||
},
|
||||
// 是否侧向link
|
||||
isSd() {
|
||||
this.addModel.type = '02';
|
||||
// this.addModel.type = '02';
|
||||
return this.LinkType === '2';
|
||||
}
|
||||
},
|
||||
@ -264,9 +259,6 @@ export default {
|
||||
$route() {
|
||||
this.$refs.dataform.clearValidate();
|
||||
this.activeName = 'first';
|
||||
},
|
||||
'$store.state.map.mapDataLoadedCount': function() {
|
||||
this.form = getAttrList('link', 'attr', this);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -282,24 +274,23 @@ export default {
|
||||
this.$refs.dataform.clearValidate();
|
||||
this.$refs.make.resetFields();
|
||||
if (selected && selected._type.toUpperCase() === 'Link'.toUpperCase()) {
|
||||
const model = selected.model;
|
||||
this.editModel.name = model.name;
|
||||
this.editModel.code = this.addModel.code = model.code;
|
||||
this.editModel.type = model.type;
|
||||
this.editModel.lengthShow = Math.sqrt(Math.pow(model.rp.x - model.lp.x, 2) + Math.pow(model.rp.y - model.lp.y, 2));
|
||||
this.editModel.lengthFact = model.lengthFact;
|
||||
this.editModel.color = model.color;
|
||||
this.editModel.leftFdCode = model.leftFdCode;
|
||||
this.editModel.leftSdCode = model.leftSdCode;
|
||||
this.editModel.rightFdCode = model.rightFdCode;
|
||||
this.editModel.rightSdCode = model.rightSdCode;
|
||||
this.editModel.name = selected.name;
|
||||
this.editModel.code = this.addModel.code = selected.code;
|
||||
this.editModel.type = selected.type;
|
||||
this.editModel.lengthShow = Math.sqrt(Math.pow(selected.rp.x - selected.lp.x, 2) + Math.pow(selected.rp.y - selected.lp.y, 2));
|
||||
this.editModel.lengthFact = selected.lengthFact;
|
||||
this.editModel.color = selected.color;
|
||||
this.editModel.leftFdCode = selected.leftFdCode;
|
||||
this.editModel.leftSdCode = selected.leftSdCode;
|
||||
this.editModel.rightFdCode = selected.rightFdCode;
|
||||
this.editModel.rightSdCode = selected.rightSdCode;
|
||||
this.editModel.lp = {
|
||||
x: model.lp.x,
|
||||
y: model.lp.y
|
||||
x: selected.lp.x,
|
||||
y: selected.lp.y
|
||||
};
|
||||
this.editModel.rp = {
|
||||
x: model.rp.x,
|
||||
y: model.rp.y
|
||||
x: selected.rp.x,
|
||||
y: selected.rp.y
|
||||
};
|
||||
this.activeName = 'first';
|
||||
} else {
|
||||
|
@ -158,7 +158,6 @@ import { mapGetters } from 'vuex';
|
||||
import { getUID } from '@/jmap/utils/Uid';
|
||||
import JTriangle from '@/jmap/utils/JTriangle';
|
||||
import ConfigList from './config/list';
|
||||
import { getAttrList, getAttrRules } from '@/scripts/attribute';
|
||||
|
||||
export default {
|
||||
name: 'SectionDraft',
|
||||
@ -179,7 +178,6 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
form: getAttrList('section', 'attr', this),
|
||||
linksCollection: [],
|
||||
activeName: 'first',
|
||||
SectionTypeList: [],
|
||||
@ -281,14 +279,133 @@ export default {
|
||||
'stationStandList',
|
||||
'skinStyle'
|
||||
]),
|
||||
form() {
|
||||
const form = {
|
||||
labelWidth: '160px',
|
||||
items: [
|
||||
{ prop: 'stationCode', label: '所属设备集中站:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', disabled: this.isStationCodeDisabled, options: this.stationList },
|
||||
{ prop: 'parentCode', label: '关联物理区段:', type: 'select', optionLabel: 'code&&name', optionValue: 'code', disabled: true, options: this.sectionList, isHidden: !this.isParentCode },
|
||||
{ prop: 'code', label: '区段编码:', type: 'select', optionLabel: 'code&&name', optionValue: 'code', options: this.sectionList, change: true, deviceChange: this.deviceChange },
|
||||
{ prop: 'type', label: '区段类型:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SectionTypeList },
|
||||
{ prop: 'name', label: '区段名称:', type: 'input' },
|
||||
{ prop: 'namePoint', label: '区段名称偏移量:', type: 'coordinate', width: '150px', children: [
|
||||
{ prop: 'namePoint.x', firstLevel: 'namePoint', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px' },
|
||||
{ prop: 'namePoint.y', firstLevel: 'namePoint', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px' }
|
||||
] },
|
||||
{ prop: 'kmRangeLeft', label: '左侧公里标(米):', type: 'number', min: 0 },
|
||||
{ prop: 'kmRangeRight', label: '右侧公里标(米):', type: 'number', min: 0 },
|
||||
{ prop: 'region', label: '区间:', type: 'select', optionLabel: 'label', optionValue: 'value', options: this.regionList },
|
||||
{ prop: 'nameShow', label: '是否显示区段名称:', type: 'checkbox', isHidden: !this.isSectionType },
|
||||
{ prop: 'axleShow', label: '是否显示计轴:', type: 'checkbox', disabled: this.isStationAxleShow, isHidden: !this.isSectionType},
|
||||
{ prop: 'logicSectionShow', label: '是否显示逻辑区段:', type: 'checkbox', isHidden: !this.isSectionType },
|
||||
{ prop: 'logicSectionNameShow', label: '是否显示逻辑区段名称:', type: 'checkbox', disabled: this.islogicSectionNameShow, isHidden: !this.isSectionType },
|
||||
{ prop: 'isStandTrack', label: '是否站台轨:', type: 'checkbox', isHidden: !this.isSectionType },
|
||||
{ prop: 'standTrackName', label: '站台轨名称:', type: 'input', isHidden: !this.isstandTrackNameShow },
|
||||
{ prop: 'standTrackNamePosition', label: '站台轨名称偏移量:', type: 'coordinate', width: '150px', isHidden: !this.isstandTrackNameShow, children: [
|
||||
{ prop: 'standTrackNamePosition.x', firstLevel: 'standTrackNamePosition', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px', disabled: true },
|
||||
{ prop: 'standTrackNamePosition.y', firstLevel: 'standTrackNamePosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px', disabled: true }
|
||||
] },
|
||||
{ prop: 'relStandCode', label: '站台编码:', type: 'selectHover', optionLabel: 'code&&name', optionValue: 'code', options: this.stationStandList, hover: this.hover, buttonType: 'relStandCode', buttonShowType: this.isButtonType, isHidden: !this.isrelStandCode },
|
||||
{ prop: 'isReentryTrack', label: '是否折返轨:', type: 'checkbox', isHidden: !this.isSectionType },
|
||||
{ prop: 'reentryTrackName', label: '折返轨名称:', type: 'input', isHidden: !this.isreentryTrackName },
|
||||
{ prop: 'reentryTrackNamePosition', label: '折返轨名称偏移量:', type: 'coordinate', width: '150px', isHidden: !this.isreentryTrackName, children: [
|
||||
{ prop: 'reentryTrackNamePosition.x', firstLevel: 'reentryTrackNamePosition', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px', disabled: true },
|
||||
{ prop: 'reentryTrackNamePosition.y', firstLevel: 'reentryTrackNamePosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px', disabled: true }
|
||||
] },
|
||||
{ prop: 'isTransferTrack', label: '是否转换轨:', type: 'checkbox', isHidden: !this.isSectionType },
|
||||
{ prop: 'transferTrackName', label: '转换轨名称:', type: 'input', isHidden: !this.istransferTrackName },
|
||||
{ prop: 'transferTrackNamePosition', label: '转换轨名称偏移量:', type: 'coordinate', width: '150px', isHidden: !this.istransferTrackName, children: [
|
||||
{ prop: 'transferTrackNamePosition.x', firstLevel: 'transferTrackNamePosition', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px', disabled: true },
|
||||
{ prop: 'transferTrackNamePosition.y', firstLevel: 'transferTrackNamePosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px', disabled: true }
|
||||
] },
|
||||
{ prop: 'destinationCode', label: '目的地码:', type: 'input', isHidden: !this.isdestinationCode },
|
||||
{ prop: 'destinationCodePoint', label: '目的地码坐标:', type: 'coordinate', width: '150px', isHidden: !this.isdestinationCode, children: [
|
||||
{ prop: 'destinationCodePoint.x', firstLevel: 'destinationCodePoint', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px', disabled: true },
|
||||
{ prop: 'destinationCodePoint.y', firstLevel: 'destinationCodePoint', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px', disabled: true }
|
||||
] },
|
||||
{ prop: 'destinationCodeShow', label: '是否显示目的地码:', type: 'checkbox', isHidden: !this.isdestinationCode },
|
||||
{ prop: 'leftStopPointOffset', label: '左向停车点偏移量:', type: 'number', min: 0, isHidden: !this.isStopPointOffset },
|
||||
{ prop: 'rightStopPointOffset', label: '右向停车点偏移量:', type: 'number', min: 0, isHidden: !this.isStopPointOffset },
|
||||
{ prop: 'isSwitchSection', label: '是否道岔区段:', type: 'checkbox', isHidden: !this.isSectionType },
|
||||
{ prop: 'relSwitchCode', label: '关联道岔Code:', type: 'select', optionLabel: 'code&&name', optionValue: 'code', options: this.switchList, change: true, deviceChange: this.deviceChange, isHidden: !this.isRelSwitchCode },
|
||||
{ prop: 'logicSectionNameSort', label: '逻辑区段排序:', type: 'radio', isHidden: !this.isLogicSectionNameSort, radioList: [
|
||||
{value: true, label: '从小到大'},
|
||||
{value: false, label: '从大到小'}
|
||||
] },
|
||||
{ prop: 'linkCode', label: '关联的Link:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.linkList, disabled: true, isHidden: !this.isSectionType },
|
||||
{ prop: 'sepTypeLeft', label: '左侧分隔符类型:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SectionSepTypeList, isHidden: !this.isSectionType },
|
||||
{ prop: 'offsetLeft', label: '左侧Link偏移量:', type: 'number', min: 0, placeholder: '米', isHidden: !this.isSectionType },
|
||||
{ prop: 'sepTypeRight', label: '右侧分隔符类型:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SectionSepTypeList, isHidden: !this.isSectionType },
|
||||
{ prop: 'offsetRight', label: '右侧Link偏移量:', type: 'number', min: 0, placeholder: '米', isHidden: !this.isSectionType },
|
||||
{ prop: 'isSegmentation', label: '是否分割:', type: 'checkbox', isHidden: !this.isSectionType },
|
||||
{ prop: 'segmentationPosition', label: '默认背景:', type: 'coordinate', width: '150px', isHidden: !this.issegmentationPosition, children: [
|
||||
{ prop: 'segmentationPosition.x', firstLevel: 'segmentationPosition', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px', disabled: true },
|
||||
{ prop: 'segmentationPosition.y', firstLevel: 'segmentationPosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px', disabled: true }
|
||||
] },
|
||||
{ prop: 'isCurve', label: '是否曲线:', type: 'checkbox', isHidden: !this.isSectionType },
|
||||
{ prop: 'points', label: '区段显示坐标:', type: 'points', width: '160px', isHidden: !this.isPointsShow, pointDisabled: this.pointDisabledName, addPoint: this.addPoint, delPoint: this.delPoint },
|
||||
{ prop: 'trainPosType', label: '列车所在方向:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.TrainPositionTypeList, isHidden: !this.isSectionType }
|
||||
]
|
||||
};
|
||||
return form;
|
||||
},
|
||||
rules() {
|
||||
const baseRules = getAttrRules('section', 'attr');
|
||||
const rules = {
|
||||
code: [
|
||||
{ required: true, message: '请选择设备', trigger: 'change' }
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: '请输入区段名称', trigger: 'blur' }
|
||||
],
|
||||
type: [
|
||||
{ required: true, message: '请输入区段类型', trigger: 'blur' }
|
||||
],
|
||||
relStandCode: [
|
||||
{ required: true, message: '请选择关联站台', trigger: 'change' }
|
||||
],
|
||||
leftStopPointOffset: [
|
||||
{ required: true, message: '请输入左向停车点偏移量', trigger: 'blur' }
|
||||
],
|
||||
rightStopPointOffset: [
|
||||
{ required: true, message: '请输入右向停车点偏移量', trigger: 'blur' }
|
||||
],
|
||||
destinationCode: [
|
||||
{ required: true, message: '请输入目的地码', trigger: 'blur' }
|
||||
],
|
||||
'destinationCodePoint.x': [
|
||||
{ required: true, message: '请输入目的地码坐标X', trigger: 'blur' }
|
||||
],
|
||||
'destinationCodePoint.y': [
|
||||
{ required: true, message: '请输入目的地码坐标Y', trigger: 'blur' }
|
||||
],
|
||||
'namePoint.x': [
|
||||
{ required: true, message: '请输入区段名称坐标X', trigger: 'blur' }
|
||||
],
|
||||
'namePoint.y': [
|
||||
{ required: true, message: '请输入区段名称坐标Y', trigger: 'blur' }
|
||||
],
|
||||
logicSectionNameSort: [
|
||||
{ required: true, message: '请选择逻辑区段名称排序', trigger: 'change' }
|
||||
],
|
||||
offsetLeft: [
|
||||
{ required: true, message: '请输入左侧Link偏移量', trigger: 'blur' }
|
||||
],
|
||||
sepTypeLeft: [
|
||||
{ required: true, message: '请选择左侧分隔符', trigger: 'change' }
|
||||
],
|
||||
offsetRight: [
|
||||
{ required: true, message: '请输入右侧Link偏移量', trigger: 'blur' }
|
||||
],
|
||||
sepTypeRight: [
|
||||
{ required: true, message: '请选择右侧分隔符', trigger: 'change' }
|
||||
]
|
||||
};
|
||||
// 清空表单验证提示信息
|
||||
this.$nextTick(function () {
|
||||
this.$refs.dataform.clearValidate();
|
||||
});
|
||||
|
||||
return baseRules.rules;
|
||||
return rules;
|
||||
},
|
||||
PhysicalSectionList() {
|
||||
let list = [];
|
||||
@ -353,7 +470,7 @@ export default {
|
||||
},
|
||||
|
||||
isButtonType() {
|
||||
return this.fieldS === 'relStandCode';
|
||||
return this.fieldS == 'relStandCode';
|
||||
},
|
||||
isrelStandCode() {
|
||||
return this.editModel.type !== '03' && this.editModel.isStandTrack && this.editModel.type == '01';
|
||||
@ -371,7 +488,7 @@ export default {
|
||||
return this.editModel.type !== '03' && this.editModel.points.length > 0;
|
||||
},
|
||||
pointDisabledName() {
|
||||
return this.editModel.type === '02';
|
||||
return this.editModel.type == '02';
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -381,19 +498,6 @@ export default {
|
||||
$route() {
|
||||
this.$refs.dataform.clearValidate();
|
||||
this.activeName = 'first';
|
||||
},
|
||||
editModel: {
|
||||
handler: function() {
|
||||
if (this.sectionList) {
|
||||
this.form = getAttrList('section', 'attr', this);
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
'$store.state.map.mapDataLoadedCount': function() {
|
||||
if (this.sectionList) {
|
||||
this.form = getAttrList('section', 'attr', this);
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -432,11 +536,10 @@ export default {
|
||||
this.$emit('setCenter', code);
|
||||
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
|
||||
},
|
||||
deviceSelect(model) {
|
||||
deviceSelect(selected) {
|
||||
if (!this.fieldS) { // 判断是否激活选择站台
|
||||
this.editModel.points = [];
|
||||
if (model && model._type.toUpperCase() === 'Section'.toUpperCase()) {
|
||||
const selected = model.model;
|
||||
if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) {
|
||||
this.editModel.code = selected.code;
|
||||
this.editModel.name = selected.name;
|
||||
this.editModel.type = selected.type;
|
||||
@ -540,9 +643,6 @@ export default {
|
||||
} else {
|
||||
this.field = field === this.field ? '' : field;
|
||||
}
|
||||
if (this.sectionList) {
|
||||
this.form = getAttrList('section', 'attr', this);
|
||||
}
|
||||
},
|
||||
handleDelete(index, row) {
|
||||
row.num = 0;
|
||||
|
@ -67,7 +67,6 @@ import { mapGetters } from 'vuex';
|
||||
import { getUID } from '@/jmap/utils/Uid';
|
||||
import JTriangle from '@/jmap/utils/JTriangle';
|
||||
import ConfigList from './config/list';
|
||||
import { getAttrList, getAttrRules } from '@/scripts/attribute';
|
||||
|
||||
export default {
|
||||
name: 'SignalDraft',
|
||||
@ -88,7 +87,6 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
form: getAttrList('signal', 'attr', this),
|
||||
activeName: 'first',
|
||||
SignalLeftOrRightList: [],
|
||||
SignalPotLampTypeList: [],
|
||||
@ -159,8 +157,6 @@ export default {
|
||||
x: 0,
|
||||
y: 0
|
||||
},
|
||||
// 'position.x': 0,
|
||||
// 'position.y': 0,
|
||||
buttonPosition: {
|
||||
x: 0,
|
||||
y: 0
|
||||
@ -198,14 +194,80 @@ export default {
|
||||
}
|
||||
return list;
|
||||
},
|
||||
form() {
|
||||
const form = {
|
||||
labelWidth: '150px',
|
||||
items: [
|
||||
{ prop: 'stationCode', label: '所属设备集中站:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList },
|
||||
{ prop: 'code', label: '信号机编码:', type: 'select', optionLabel: 'code&&name', optionValue: 'code', options: this.signalList, change: true, deviceChange: this.deviceChange },
|
||||
{ prop: 'name', label: '信号机名称:', type: 'input' },
|
||||
{ prop: 'uniqueName', label: '信号机唯一名称:', type: 'input' },
|
||||
{ prop: 'nameShow', label: '是否显示信号机名称:', type: 'checkbox' },
|
||||
{ prop: 'lampPostType', label: '灯柱类型:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SignalLampPostTypeList },
|
||||
{ prop: 'lampPositionType', label: '灯位类型:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SignalLampPositionTypeList },
|
||||
{ prop: 'useType', label: '用途类型:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SignalUseTypeList },
|
||||
{ prop: 'potLampType', label: '点灯类型:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SignalPotLampTypeList },
|
||||
{ prop: 'directionType', label: '方向类型:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SignalDirectionTypeList },
|
||||
{ prop: 'positionType', label: '信号机位置类型:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SignalPositionTypeList },
|
||||
{ prop: 'linkCode', label: 'LinkCode:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.linkList },
|
||||
{ prop: 'offset', label: '偏移量:', type: 'number', min: 0, placeholder: '米' },
|
||||
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: '信号机x:', type: 'number', placeholder: '米' },
|
||||
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: '信号机y:', type: 'number', placeholder: '米' },
|
||||
{ prop: 'rotate', label: '旋转角度:', type: 'number', min: -90, max: 90, placeholder: '度' },
|
||||
{ prop: 'namePosition.x', firstLevel: 'namePosition', secondLevel: 'x', label: '信号机名字偏移量 x:', type: 'number', placeholder: 'px' },
|
||||
{ prop: 'namePosition.y', firstLevel: 'namePosition', secondLevel: 'x', label: '信号机名字偏移量 y:', type: 'number', placeholder: 'px' },
|
||||
{ prop: 'buttonShow', label: '是否显示按钮:', type: 'checkbox' },
|
||||
{ prop: 'buttonPosition.x', firstLevel: 'buttonPosition', secondLevel: 'x', label: '按钮x:', type: 'number', placeholder: 'px' },
|
||||
{ prop: 'buttonPosition.y', firstLevel: 'buttonPosition', secondLevel: 'x', label: '按钮y:', type: 'number', placeholder: 'px' },
|
||||
{ prop: 'guideShow', label: '是否显示引导信号灯:', type: 'checkbox' },
|
||||
{ prop: 'guidePosition.x', firstLevel: 'guidePosition', secondLevel: 'x', label: '引导信号x:', type: 'number', placeholder: 'px' },
|
||||
{ prop: 'guidePosition.y', firstLevel: 'guidePosition', secondLevel: 'x', label: '引导信号y:', type: 'number', placeholder: 'px' }
|
||||
]
|
||||
};
|
||||
return form;
|
||||
},
|
||||
rules() {
|
||||
const baseRules = getAttrRules('signal', 'attr');
|
||||
const rules = {
|
||||
code: [
|
||||
{ required: true, message: '请选择设备', trigger: 'change' }
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: '请输入信号灯名称', trigger: 'blur' }
|
||||
],
|
||||
uniqueName: [
|
||||
{ required: true, message: '请输入信号机唯一名称', trigger: 'blur' }
|
||||
],
|
||||
offset: [
|
||||
{ required: true, message: '请输入偏移量', trigger: 'blur' }
|
||||
],
|
||||
stationCode: [
|
||||
{ required: true, message: '请输入设备集中站', trigger: 'change' }
|
||||
],
|
||||
'position.x': [
|
||||
{ required: true, message: '信号机x', trigger: 'blur' }
|
||||
],
|
||||
'position.y': [
|
||||
{ required: true, message: '信号机y', trigger: 'blur' }
|
||||
],
|
||||
'buttonPosition.x': [
|
||||
{ required: true, message: '请输入按钮x', trigger: 'blur' }
|
||||
],
|
||||
'buttonPosition.y': [
|
||||
{ required: true, message: '请输入按钮y', trigger: 'blur' }
|
||||
],
|
||||
'guidePosition.x': [
|
||||
{ required: true, message: '请输入引导信号x', trigger: 'blur' }
|
||||
],
|
||||
'guidePosition.y': [
|
||||
{ required: true, message: '请输入引导信号y', trigger: 'blur' }
|
||||
]
|
||||
};
|
||||
// 清空表单验证提示信息
|
||||
this.$nextTick(function () {
|
||||
this.$refs.dataform.clearValidate();
|
||||
});
|
||||
|
||||
return baseRules.rules;
|
||||
return rules;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -215,9 +277,6 @@ export default {
|
||||
$route() {
|
||||
this.$refs.dataform.resetFields();
|
||||
this.activeName = 'first';
|
||||
},
|
||||
'$store.state.map.mapDataLoadedCount': function() {
|
||||
this.form = getAttrList('signal', 'attr', this);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -252,11 +311,10 @@ export default {
|
||||
this.$emit('setCenter', code);
|
||||
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
|
||||
},
|
||||
deviceSelect(model) {
|
||||
deviceSelect(selected) {
|
||||
this.$refs.dataform.resetFields();
|
||||
this.$refs.make.resetFields();
|
||||
if (model && model._type.toUpperCase() === 'Signal'.toUpperCase()) {
|
||||
const selected = model.model;
|
||||
if (selected && selected._type.toUpperCase() === 'Signal'.toUpperCase()) {
|
||||
this.editModel.code = selected.code;
|
||||
this.editModel.name = selected.name;
|
||||
this.editModel.uniqueName = selected.uniqueName;
|
||||
@ -298,9 +356,8 @@ export default {
|
||||
};
|
||||
}
|
||||
this.activeName = 'first';
|
||||
} else if (model && model._type.toUpperCase() === 'Section'.toUpperCase()) {
|
||||
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) {
|
||||
// 获取逻辑区段关联的物理区段
|
||||
const selected = model.model;
|
||||
if (selected.type === '02') {
|
||||
const section = this.sectionList.find(stn => stn.parentCode === selected.code);
|
||||
this.addModel.sectionCode = section ? section.code : '';
|
||||
|
@ -37,7 +37,6 @@
|
||||
import { mapGetters } from 'vuex';
|
||||
import { getUID } from '@/jmap/utils/Uid';
|
||||
import ConfigList from './config/list';
|
||||
import { getAttrList, getAttrRules } from '@/scripts/attribute';
|
||||
|
||||
export default {
|
||||
name: 'StationDraft',
|
||||
@ -58,7 +57,6 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
form: getAttrList('station', 'attr', this),
|
||||
activeName: 'first',
|
||||
editModel: {
|
||||
centralized: false,
|
||||
@ -99,14 +97,57 @@ export default {
|
||||
'zcList',
|
||||
'skinStyle'
|
||||
]),
|
||||
form() {
|
||||
const form = {
|
||||
labelWidth: '150px',
|
||||
items: [
|
||||
{ prop: 'concentrateStationCode', label: '所属联锁站编码:', type: 'select', optionLabel: 'code&&name', optionValue: 'code', options: this.stationList },
|
||||
{ prop: 'code', label: '车站编码:', type: 'select', optionLabel: 'code&&name', optionValue: 'code', options: this.stationList, change: true, deviceChange: this.deviceChange },
|
||||
{ prop: 'zcCode', label: '所属zc区域编码:', type: 'select', optionLabel: 'code&&name', optionValue: 'code', options: this.zcList },
|
||||
{ prop: 'centralized', label: '是否集中站:', type: 'checkbox' },
|
||||
{ prop: 'name', label: '车站名称:', type: 'input' },
|
||||
{ prop: 'runPlanName', label: '真实名称:', type: 'input' },
|
||||
{ prop: 'visible', label: '是否显示:', type: 'checkbox' },
|
||||
{ prop: 'nameFont', label: '车站字体:', type: 'font', placeholder: '车站字体' },
|
||||
{ prop: 'nameFontColor', label: '车站字体颜色:', type: 'color' },
|
||||
{ prop: 'kmPostShow', label: '是否显示公里标名称:', type: 'checkbox' },
|
||||
{ prop: 'kmRange', label: '公里标距离:', type: 'number', min: 0, placeholder: '米' },
|
||||
{ prop: 'kmPost', label: '公里标名称:', type: 'input' },
|
||||
{ prop: 'kmPostFont', label: '公里标字体:', type: 'font', placeholder: '公里标字体' },
|
||||
{ prop: 'kmPostFontColor', label: '公里标字体颜色:', type: 'color' },
|
||||
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x坐标:', type: 'number', placeholder: 'px' },
|
||||
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y坐标:', type: 'number', placeholder: 'px' }
|
||||
]
|
||||
};
|
||||
return form;
|
||||
},
|
||||
rules() {
|
||||
const baseRules = getAttrRules('station', 'attr');
|
||||
const rules = {
|
||||
code: [
|
||||
{ required: true, message: '请选择设备', trigger: 'change' }
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: '请输入车站名称', trigger: 'blur' }
|
||||
],
|
||||
kmRange: [
|
||||
{ required: true, message: '请输入公里标距离', trigger: 'blur' }
|
||||
],
|
||||
kmPost: [
|
||||
{ required: true, message: '请输入公里标名称', trigger: 'blur' }
|
||||
],
|
||||
'position.x': [
|
||||
{ required: true, message: '请输入x坐标', trigger: 'blur' }
|
||||
],
|
||||
'position.y': [
|
||||
{ required: true, message: '请输入y坐标', trigger: 'blur' }
|
||||
]
|
||||
};
|
||||
// 清空表单验证提示信息
|
||||
this.$nextTick(function () {
|
||||
this.$refs.dataform.clearValidate();
|
||||
});
|
||||
|
||||
return baseRules.rules;
|
||||
return rules;
|
||||
},
|
||||
PhysicalSectionList() {
|
||||
let list = [];
|
||||
@ -123,9 +164,6 @@ export default {
|
||||
$route() {
|
||||
this.$refs.dataform.resetFields();
|
||||
this.activeName = 'first';
|
||||
},
|
||||
'$store.state.map.mapDataLoadedCount': function() {
|
||||
this.form = getAttrList('station', 'attr', this);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -133,11 +171,10 @@ export default {
|
||||
this.$emit('setCenter', code);
|
||||
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
|
||||
},
|
||||
deviceSelect(model) {
|
||||
deviceSelect(selected) {
|
||||
this.$refs.dataform.resetFields();
|
||||
this.$refs.make.resetFields();
|
||||
if (model && model._type.toUpperCase() === 'Station'.toUpperCase()) {
|
||||
const selected = model.model;
|
||||
if (selected && selected._type.toUpperCase() === 'Station'.toUpperCase()) {
|
||||
this.editModel.centralized = selected.centralized;
|
||||
this.editModel.concentrateStationCode = selected.concentrateStationCode;
|
||||
this.editModel.code = selected.code;
|
||||
@ -160,8 +197,7 @@ export default {
|
||||
};
|
||||
}
|
||||
this.activeName = 'first';
|
||||
} else if (model && model._type.toUpperCase() === 'Section'.toUpperCase()) {
|
||||
const selected = model.model;
|
||||
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) {
|
||||
// 获取逻辑区段关联的物理区段
|
||||
if (selected.type !== '01') {
|
||||
const section = this.sectionList.find(stn => stn.parentCode === selected.code);
|
||||
|
@ -3,52 +3,7 @@
|
||||
<el-tabs v-model="activeName">
|
||||
<el-tab-pane class="view-control" label="属性" name="first">
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: cardHeight +'px' }">
|
||||
<el-form ref="form" :model="editModel" label-width="140px" size="mini" :rules="rules">
|
||||
<el-form-item label="所属设备集中站:" prop="stationCode">
|
||||
<el-select v-model="editModel.stationCode" filterable>
|
||||
<el-option
|
||||
v-for="item in stationList"
|
||||
:key="item.code"
|
||||
:label="item.name + ' (' + item.code+ ')'"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="控制模式编码:" prop="code">
|
||||
<el-select v-model="editModel.code" filterable @change="deviceChange">
|
||||
<el-option
|
||||
v-for="item in stationControlList"
|
||||
:key="item.code"
|
||||
:label="item.code"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="控制模式名称:" prop="name">
|
||||
<el-input v-model="editModel.name" />
|
||||
</el-form-item>
|
||||
<el-form-item label="中控内容:" prop="zokContent">
|
||||
<el-input v-model="editModel.zokContent" label="Context" />
|
||||
</el-form-item>
|
||||
<el-form-item label="站控内容:" prop="zakContent">
|
||||
<el-input v-model="editModel.zakContent" label="Context" />
|
||||
</el-form-item>
|
||||
<el-form-item label="总报警控制内容:" prop="jjzkContent">
|
||||
<el-input v-model="editModel.zbjkContent" label="Context" />
|
||||
</el-form-item>
|
||||
<el-form-item label="紧急站控内容:" prop="jjzkContent">
|
||||
<el-input v-model="editModel.jjzkContent" label="Context" />
|
||||
</el-form-item>
|
||||
<el-form-item label="站中控内容:" prop="zzkContent">
|
||||
<el-input v-model="editModel.zzkContent" label="Context" />
|
||||
</el-form-item>
|
||||
<el-form-item label="坐标 x:" prop="position.x">
|
||||
<el-input-number v-model="editModel.position.x" />px
|
||||
</el-form-item>
|
||||
<el-form-item label="坐标 y:" prop="position.y">
|
||||
<el-input-number v-model="editModel.position.y" />px
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<config-list ref="dataform" :form="form" :form-model="editModel" :rules="rules" />
|
||||
</el-scrollbar>
|
||||
<el-button-group class="map-draft-group">
|
||||
<el-button type="primary" @click="edit">修改</el-button>
|
||||
@ -81,10 +36,12 @@
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import { getUID } from '@/jmap/utils/Uid';
|
||||
import ConfigList from './config/list';
|
||||
|
||||
export default {
|
||||
name: 'StationControlDraft',
|
||||
components: {
|
||||
ConfigList
|
||||
},
|
||||
props: {
|
||||
selected: {
|
||||
@ -118,7 +75,39 @@ export default {
|
||||
addModel: {
|
||||
stationCode: ''
|
||||
},
|
||||
rules: {
|
||||
makeRules: {
|
||||
stationCode: [
|
||||
{ required: true, message: '请选择车站名称', trigger: 'change' }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('map', [
|
||||
'stationList',
|
||||
'stationControlList',
|
||||
'skinStyle'
|
||||
]),
|
||||
form() {
|
||||
const form = {
|
||||
labelWidth: '160px',
|
||||
items: [
|
||||
{ prop: 'stationCode', label: '所属设备集中站:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList },
|
||||
{ prop: 'code', label: '控制模式编码:', type: 'select', optionLabel: 'code', optionValue: 'code', options: this.stationControlList, change: true, deviceChange: this.deviceChange },
|
||||
{ prop: 'zcCode', label: '所属zc区域编码:', type: 'select', optionLabel: 'code&&name', optionValue: 'code', options: this.zcList },
|
||||
{ prop: 'name', label: '控制模式名称:', type: 'input' },
|
||||
{ prop: 'zokContent', label: '中控内容:', type: 'input' },
|
||||
{ prop: 'zakContent', label: '站控内容:', type: 'input' },
|
||||
{ prop: 'jjzkContent', label: '紧急站控/总报警内容:', type: 'input' },
|
||||
{ prop: 'zzkContent', label: '站中控内容:', type: 'input' },
|
||||
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: '坐标 x:', type: 'number', placeholder: 'px' },
|
||||
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: '坐标 y:', type: 'number', placeholder: 'px' }
|
||||
]
|
||||
};
|
||||
return form;
|
||||
},
|
||||
rules() {
|
||||
const rules = {
|
||||
code: [
|
||||
{ required: true, message: '请选择设备', trigger: 'change' }
|
||||
],
|
||||
@ -143,27 +132,21 @@ export default {
|
||||
'position.y': [
|
||||
{ required: true, message: '请输入坐标y', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
makeRules: {
|
||||
stationCode: [
|
||||
{ required: true, message: '请选择车站名称', trigger: 'change' }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('map', [
|
||||
'stationList',
|
||||
'stationControlList',
|
||||
'skinStyle'
|
||||
])
|
||||
};
|
||||
// 清空表单验证提示信息
|
||||
this.$nextTick(function () {
|
||||
this.$refs.dataform.clearValidate();
|
||||
});
|
||||
|
||||
return rules;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
selected: function (val, oldVal) {
|
||||
this.deviceSelect(val);
|
||||
},
|
||||
$route() {
|
||||
this.$refs.form.resetFields();
|
||||
this.$refs.dataform.resetFields();
|
||||
this.activeName = 'first';
|
||||
}
|
||||
},
|
||||
@ -174,11 +157,10 @@ export default {
|
||||
this.$emit('setCenter', code);
|
||||
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
|
||||
},
|
||||
deviceSelect(model) {
|
||||
this.$refs.form.resetFields();
|
||||
deviceSelect(selected) {
|
||||
this.$refs.dataform.resetFields();
|
||||
this.$refs.make.resetFields();
|
||||
if (model && model._type.toUpperCase() === 'StationControl'.toUpperCase()) {
|
||||
const selected = model.model;
|
||||
if (selected && selected._type.toUpperCase() === 'StationControl'.toUpperCase()) {
|
||||
this.editModel.name = selected.name;
|
||||
this.editModel.code = selected.code;
|
||||
this.editModel.zokContent = selected.zokContent;
|
||||
@ -194,8 +176,7 @@ export default {
|
||||
};
|
||||
}
|
||||
this.activeName = 'first';
|
||||
} else if (model && model._type.toUpperCase() === 'Station'.toUpperCase()) {
|
||||
const selected = model.model;
|
||||
} else if (selected && selected._type.toUpperCase() === 'Station'.toUpperCase()) {
|
||||
this.addModel.stationCode = selected.code;
|
||||
this.activeName = 'second';
|
||||
} else {
|
||||
@ -233,7 +214,7 @@ export default {
|
||||
},
|
||||
// 修改对象
|
||||
edit() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
this.$refs['dataform'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.$emit('addOrUpdateMapModel', this.buildEditModel());
|
||||
}
|
||||
|
@ -3,94 +3,7 @@
|
||||
<el-tabs v-model="activeName">
|
||||
<el-tab-pane class="view-control" label="属性" name="first">
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: cardHeight +'px' }">
|
||||
<el-form ref="form" :model="editModel" :rules="editRules" label-width="130px" size="mini">
|
||||
<el-form-item label="所属设备集中站:" prop="deviceStationCode">
|
||||
<el-select v-model="editModel.deviceStationCode" filterable>
|
||||
<el-option
|
||||
v-for="item in stationList"
|
||||
:key="item.code"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="站台编码:" prop="code">
|
||||
<el-select v-model="editModel.code" filterable @change="deviceChange">
|
||||
<el-option
|
||||
v-for="item in stationStandList"
|
||||
:key="item.code"
|
||||
:label="item.code + ' (' + item.name+ ')'"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="站台名称:" prop="name" disabled="true">
|
||||
<el-input v-model="editModel.name" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所属车站:" prop="stationCode">
|
||||
<el-select v-model="editModel.stationCode" filterable>
|
||||
<el-option
|
||||
v-for="item in stationList"
|
||||
:key="item.code"
|
||||
:label="item.name + ' (' + item.code+ ')'"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="关联Link:" prop="linkCode">
|
||||
<el-select v-model="editModel.linkCode" filterable>
|
||||
<el-option v-for="item in linkList" :key="item.code"
|
||||
:label="item.name + ' (' + item.code+ ')'" :value="item.code"></el-option>
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item label="关联停车点:" prop="stopPointCode">
|
||||
<el-select v-model="editModel.stopPointCode" filterable>
|
||||
<el-option v-for="item in stopPointList" :key="item.code"
|
||||
:label="item.name + ' (' + item.code+ ')'" :value="item.code"></el-option>
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="上下行方向:" prop="direction">
|
||||
<el-select v-model="editModel.direction" filterable>
|
||||
<el-option
|
||||
v-for="item in RunDirectionTypeList"
|
||||
:key="item.code"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否显示:" prop="visible">
|
||||
<el-checkbox v-model="editModel.visible" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否显示名称:" prop="nameShow">
|
||||
<el-checkbox v-model="editModel.nameShow" />
|
||||
</el-form-item>
|
||||
<el-form-item label="站台方向:" prop="doorLocationType">
|
||||
<el-select v-model="editModel.doorLocationType" filterable placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in DoorLocationTypeList"
|
||||
:key="item.code"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否显示屏蔽门:" prop="hasDoor">
|
||||
<el-checkbox v-model="editModel.hasDoor" />
|
||||
</el-form-item>
|
||||
<el-form-item label="宽度 w:" prop="width">
|
||||
<el-input-number v-model="editModel.width" :min="0" :max="2000" />px
|
||||
</el-form-item>
|
||||
<el-form-item label="高度 h:" prop="height">
|
||||
<el-input-number v-model="editModel.height" :min="0" :max="2000" />px
|
||||
</el-form-item>
|
||||
<el-form-item label="坐标 x:" prop="position.x">
|
||||
<el-input-number v-model="editModel.position.x" />px
|
||||
</el-form-item>
|
||||
<el-form-item label="坐标 y:" prop="position.y">
|
||||
<el-input-number v-model="editModel.position.y" />px
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<config-list ref="dataform" :form="form" :form-model="editModel" :rules="rules" />
|
||||
</el-scrollbar>
|
||||
<el-button-group class="map-draft-group">
|
||||
<el-button type="primary" @click="edit">修改</el-button>
|
||||
@ -146,10 +59,12 @@
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import { getUID } from '@/jmap/utils/Uid';
|
||||
import ConfigList from './config/list';
|
||||
|
||||
export default {
|
||||
name: 'StationStandDraft',
|
||||
components: {
|
||||
ConfigList
|
||||
},
|
||||
props: {
|
||||
selected: {
|
||||
@ -169,9 +84,9 @@ export default {
|
||||
DoorLocationTypeList: [],
|
||||
RunDirectionTypeList: [],
|
||||
/*
|
||||
{ code: '01', name: '朝下' },
|
||||
{ code: '02', name: '朝上' }
|
||||
*/
|
||||
{ code: '01', name: '朝下' },
|
||||
{ code: '02', name: '朝上' }
|
||||
*/
|
||||
editModel: {
|
||||
code: '',
|
||||
name: '',
|
||||
@ -181,7 +96,6 @@ export default {
|
||||
hasDoor: false,
|
||||
width: 0,
|
||||
height: 0,
|
||||
// linkCode: '',
|
||||
stationCode: '',
|
||||
position: {
|
||||
x: 0,
|
||||
@ -189,7 +103,6 @@ export default {
|
||||
},
|
||||
visible: true,
|
||||
direction: ''
|
||||
// stopPointCode: '',
|
||||
},
|
||||
addModel: {
|
||||
stationCode: '',
|
||||
@ -201,23 +114,39 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('map', [
|
||||
// 'linkList',
|
||||
'stationList',
|
||||
'stationStandList',
|
||||
// 'stopPointList',
|
||||
'skinStyle'
|
||||
]),
|
||||
editRules: function () {
|
||||
return {
|
||||
form() {
|
||||
const form = {
|
||||
labelWidth: '130px',
|
||||
items: [
|
||||
{ prop: 'deviceStationCode', label: '所属设备集中站:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.stationList },
|
||||
{ prop: 'code', label: '站台编码:', type: 'select', optionLabel: 'code&&name', optionValue: 'code', options: this.stationStandList, change: true, deviceChange: this.deviceChange },
|
||||
{ prop: 'name', label: '站台名称:', type: 'input', disabled: true },
|
||||
{ prop: 'stationCode', label: '所属车站:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList },
|
||||
{ prop: 'direction', label: '上下行方向:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.RunDirectionTypeList },
|
||||
{ prop: 'visible', label: '是否显示:', type: 'checkbox' },
|
||||
{ prop: 'nameShow', label: '是否显示名称:', type: 'checkbox' },
|
||||
{ prop: 'doorLocationType', label: '站台方向:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.DoorLocationTypeList },
|
||||
{ prop: 'hasDoor', label: '是否显示屏蔽门:', type: 'checkbox' },
|
||||
{ prop: 'width', label: '宽度 w:', type: 'number', min: 0, max: 2000, placeholder: 'px' },
|
||||
{ prop: 'height', label: '高度 h', type: 'number', min: 0, max: 2000, placeholder: 'px' },
|
||||
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: '坐标 x:', type: 'number', placeholder: 'px' },
|
||||
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: '坐标 y:', type: 'number', placeholder: 'px' }
|
||||
]
|
||||
};
|
||||
return form;
|
||||
},
|
||||
rules() {
|
||||
const rules = {
|
||||
code: [
|
||||
{ required: true, message: '请重新选择设备', trigger: 'change' }
|
||||
],
|
||||
stationCode: [
|
||||
{ required: true, message: '请选择关联车站', trigger: 'change' }
|
||||
],
|
||||
// stopPointCode: [
|
||||
// { required: true, message: '请选择关联停车点', trigger: 'change' }
|
||||
// ],
|
||||
name: [
|
||||
{ required: true, message: '请输入计数器名称', trigger: 'change' }
|
||||
],
|
||||
@ -242,8 +171,13 @@ export default {
|
||||
'position.y': [
|
||||
{ required: true, message: '请输入y坐标', trigger: 'change' }
|
||||
]
|
||||
|
||||
};
|
||||
// 清空表单验证提示信息
|
||||
this.$nextTick(function () {
|
||||
this.$refs.dataform.clearValidate();
|
||||
});
|
||||
|
||||
return rules;
|
||||
},
|
||||
createRules: function () {
|
||||
return {
|
||||
@ -264,7 +198,7 @@ export default {
|
||||
this.deviceSelect(val);
|
||||
},
|
||||
$route() {
|
||||
this.$refs.form.resetFields();
|
||||
this.$refs.dataform.resetFields();
|
||||
this.activeName = 'first';
|
||||
}
|
||||
},
|
||||
@ -281,20 +215,17 @@ export default {
|
||||
this.$emit('setCenter', code);
|
||||
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
|
||||
},
|
||||
deviceSelect(model) {
|
||||
this.$refs.form.resetFields();
|
||||
deviceSelect(selected) {
|
||||
this.$refs.dataform.resetFields();
|
||||
this.$refs.make.resetFields();
|
||||
if (model && model._type.toUpperCase() === 'StationStand'.toUpperCase()) {
|
||||
const selected = model.model;
|
||||
if (selected && selected._type.toUpperCase() === 'StationStand'.toUpperCase()) {
|
||||
this.editModel.name = selected.name;
|
||||
this.editModel.code = selected.code;
|
||||
this.editModel.isShowName = selected.isShowName;
|
||||
this.editModel.width = selected.width;
|
||||
this.editModel.height = selected.height;
|
||||
this.editModel.hasDoor = selected.hasDoor;
|
||||
// this.editModel.linkCode = selected.linkCode;
|
||||
this.editModel.stationCode = selected.stationCode;
|
||||
// this.editModel.stopPointCode = selected.stopPointCode;
|
||||
this.editModel.doorLocationType = selected.doorLocationType;
|
||||
this.editModel.deviceStationCode = selected.deviceStationCode;
|
||||
if (selected.hasOwnProperty('position')) {
|
||||
@ -306,8 +237,7 @@ export default {
|
||||
this.editModel.visible = selected.visible;
|
||||
this.editModel.direction = selected.direction;
|
||||
this.activeName = 'first';
|
||||
} else if (model && model._type.toUpperCase() === 'Station'.toUpperCase()) {
|
||||
const selected = model.model;
|
||||
} else if (selected && selected._type.toUpperCase() === 'Station'.toUpperCase()) {
|
||||
this.addModel.stationCode = selected.code;
|
||||
this.activeName = 'second';
|
||||
} else {
|
||||
@ -321,12 +251,10 @@ export default {
|
||||
const model = {
|
||||
_type: 'StationStand',
|
||||
code: uid,
|
||||
// linkCode: '0',
|
||||
width: 40,
|
||||
height: 20,
|
||||
doorLocationType: this.addModel.doorLocationType,
|
||||
deviceStationCode: this.addModel.deviceStationCode,
|
||||
// stopPointCode: '',
|
||||
visible: true,
|
||||
direction: '01',
|
||||
hasDoor: this.addModel.hasDoor
|
||||
@ -345,7 +273,7 @@ export default {
|
||||
},
|
||||
// 修改对象
|
||||
edit() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
this.$refs.dataform.validate((valid) => {
|
||||
if (valid) {
|
||||
this.$emit('addOrUpdateMapModel', this.buildEditModel());
|
||||
}
|
||||
@ -361,9 +289,7 @@ export default {
|
||||
deviceStationCode: this.editModel.deviceStationCode,
|
||||
hasDoor: this.editModel.hasDoor,
|
||||
name: this.editModel.name,
|
||||
// linkCode: this.editModel.linkCode,
|
||||
stationCode: this.editModel.stationCode,
|
||||
// stopPointCode: this.editModel.stopPointCode,
|
||||
position: {
|
||||
x: this.editModel.position.x,
|
||||
y: this.editModel.position.y
|
||||
|
@ -37,7 +37,6 @@
|
||||
import { mapGetters } from 'vuex';
|
||||
import { getUID } from '@/jmap/utils/Uid';
|
||||
import ConfigList from './config/list';
|
||||
import { getAttrList, getAttrRules } from '@/scripts/attribute';
|
||||
|
||||
export default {
|
||||
name: 'SwitchDraft',
|
||||
@ -58,7 +57,6 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
form: getAttrList('switch', 'attr', this),
|
||||
sectionsCollection: [],
|
||||
activeName: 'first',
|
||||
editModel: {
|
||||
@ -95,14 +93,60 @@ export default {
|
||||
}
|
||||
return list;
|
||||
},
|
||||
form() {
|
||||
const form = {
|
||||
labelWidth: '170px',
|
||||
items: [
|
||||
{ prop: 'stationCode', label: '所属设备集中站:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList },
|
||||
{ prop: 'code', label: '道岔编码:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.switchList, change: true, deviceChange: this.deviceChange },
|
||||
{ prop: 'name', label: '道岔名称:', type: 'input' },
|
||||
{ prop: 'nameShow', label: '是否显示道岔名称:', type: 'checkbox' },
|
||||
{ prop: 'namePoint.x', firstLevel: 'namePoint', secondLevel: 'x', label: '道岔名称x偏移量:', type: 'number', placeholder: 'px' },
|
||||
{ prop: 'namePoint.y', firstLevel: 'namePoint', secondLevel: 'y', label: '道岔名称y偏移量:', type: 'number', placeholder: 'px' },
|
||||
{ prop: 'turnTime', label: '道岔时间:', type: 'number', min: 0, max: 1000, placeholder: 's' },
|
||||
{ prop: 'timeoutShow', label: '是否显示道岔时间:', type: 'checkbox' },
|
||||
{ prop: 'sectionACode', label: '关联的A Section Code:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.sectionList },
|
||||
{ prop: 'sectionBCode', label: '关联的B Section Code:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.sectionList },
|
||||
{ prop: 'sectionCCode', label: '关联的C Section Code:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.sectionList },
|
||||
{ prop: 'tp.x', firstLevel: 'tp', secondLevel: 'x', label: '时间x坐标偏移量:', type: 'number', placeholder: 'px' },
|
||||
{ prop: 'tp.y', firstLevel: 'tp', secondLevel: 'y', label: '时间y坐标偏移量:', type: 'number', placeholder: 'px' }
|
||||
]
|
||||
};
|
||||
return form;
|
||||
},
|
||||
rules() {
|
||||
const baseRules = getAttrRules('link', 'attr');
|
||||
const rules = {
|
||||
code: [
|
||||
{ required: true, message: '请选择设备', trigger: 'change' }
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: '请输入道岔名称', trigger: 'blur' }
|
||||
],
|
||||
'namePoint.x': [
|
||||
{ required: true, message: '请输入道岔名称坐标x', trigger: 'blur' }
|
||||
],
|
||||
'namePoint.y': [
|
||||
{ required: true, message: '请输入道岔名称坐标y', trigger: 'blur' }
|
||||
],
|
||||
stationCode: [
|
||||
{ required: true, message: '请输入设备集中站', trigger: 'change' }
|
||||
],
|
||||
turnTime: [
|
||||
{ required: true, message: '请输入道岔时间', trigger: 'blur' }
|
||||
],
|
||||
'tp.x': [
|
||||
{ required: true, message: '请输入时间坐标x', trigger: 'blur' }
|
||||
],
|
||||
'tp.y': [
|
||||
{ required: true, message: '请输入时间坐标y', trigger: 'blur' }
|
||||
]
|
||||
};
|
||||
// 清空表单验证提示信息
|
||||
this.$nextTick(function () {
|
||||
this.$refs.dataform.clearValidate();
|
||||
});
|
||||
|
||||
return baseRules.rules;
|
||||
return rules;
|
||||
},
|
||||
...mapGetters('map', [
|
||||
'linkList',
|
||||
@ -119,9 +163,6 @@ export default {
|
||||
$route() {
|
||||
this.$refs.dataform.resetFields();
|
||||
this.activeName = 'first';
|
||||
},
|
||||
'$store.state.map.mapDataLoadedCount': function() {
|
||||
this.form = getAttrList('switch', 'attr', this);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -134,10 +175,9 @@ export default {
|
||||
this.$emit('setCenter', code);
|
||||
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
|
||||
},
|
||||
deviceSelect(model) {
|
||||
deviceSelect(selected) {
|
||||
this.$refs.dataform.resetFields();
|
||||
if (model && model._type.toUpperCase() === 'Switch'.toUpperCase()) {
|
||||
const selected = model.model;
|
||||
if (selected && selected._type.toUpperCase() === 'Switch'.toUpperCase()) {
|
||||
this.editModel.name = selected.name;
|
||||
this.editModel.code = selected.code;
|
||||
this.editModel.turnTime = selected.turnTime;
|
||||
|
Loading…
Reference in New Issue
Block a user