调整站台操作,增加综合监控调节

This commit is contained in:
zyy 2020-06-05 18:04:27 +08:00
parent dd16694b52
commit 768c62333c
15 changed files with 784 additions and 63 deletions

View File

@ -284,4 +284,10 @@ deviceRender[deviceType.Elevator] = {
zlevel: 1, zlevel: 1,
z: 5 z: 5
}; };
// 风机
deviceRender[deviceType.Draught] = {
_type: deviceType.Draught,
zlevel: 1,
z: 5
};
export default deviceRender; export default deviceRender;

View File

@ -43,7 +43,8 @@ const deviceType = {
Cistern: 'Cistern', Cistern: 'Cistern',
Electrically: 'Electrically', Electrically: 'Electrically',
Stairs: 'Stairs', Stairs: 'Stairs',
Elevator: 'Elevator' Elevator: 'Elevator',
Draught: 'Draught'
}; };
export default deviceType; export default deviceType;

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,275 @@
import deviceType from './constant/deviceType';
import Eventful from 'zrender/src/mixin/Eventful';
import * as eventTool from 'zrender/src/core/event';
import store from '@/store/index_APP_TARGET';
class EventModel {
constructor(e) {
this.clientX = e.event.clientX;
this.clientY = e.event.clientY;
let view = e.target;
while (view) {
if (Object.values(deviceType).includes(view._type)) {
this.deviceCode = view._code;
this.deviceType = view._type;
this.deviceModel = view.model;
this.eventTarget = view;
break;
}
view = view.parent;
}
}
}
class MouseController extends Eventful {
constructor(iscs) {
super();
this.$iscs = iscs;
this.$zr = iscs.getZr();
this.isAllowDragging = iscs.isAllowDragging || false; // 是否在绘图中,仅绘图状态下可拖拽
this.events = iscs.getEvents();
// this._dragging = false; // 是否在拖拽状态
this.deviceList = [];
this.rightClickPoint = {
x: 0,
y: 0
}; // 右键点击坐标
this.initHandler(this.$zr);
}
initHandler(zr) {
if (zr) {
zr.on('contextmenu', this.contextmenu, this);
zr.on('mousemove', this.moveEvent, this);
zr.on('click', this.click, this);
this.enable = function (opts) {
opts = opts || {};
this._moveOnMouseMove = opts.moveOnMouseMove || true;
this._preventDefaultMouseMove = opts.preventDefaultMouseMove || true;
this.disable();
zr.on('mousedown', this.mousedown, this);
zr.on('mousemove', this.mousemove, this);
zr.on('mouseup', this.mouseup, this);
zr.on('touchstart', this.mousedown, this);
zr.on('touchmove', this.mousemove, this);
zr.on('touchend', this.mouseup, this);
};
this.disable = function () {
zr.off('mousedown', this.mousedown);
zr.off('mousemove', this.mousemove);
zr.off('mouseup', this.mouseup);
zr.off('touchstart', this.mousedown);
zr.off('touchmove', this.mousemove);
zr.off('touchend', this.mouseup);
};
this.dispose = function () {
zr.off('click', this.click);
zr.off('contextmenu', this.contextmenu);
zr.off('mousemove', this.moveEvent);
this.disable();
};
// this.isDragging = function () { return this._dragging; };
}
}
setAllowDragging(data) {
this.isAllowDragging = data;
}
mousedown(e) {
e.event.preventDefault();
e.event.stopPropagation();
const em = new EventModel(e);
this.eventTarget = em.eventTarget;
this._offsetX = e.offsetX;
this._offsetY = e.offsetY;
this._x = e.offsetX;
this._y = e.offsetY;
// this._dragging = true;
console.log(e, e.which);
if (e.which === 3) {
this.handleMouseDownRight(e);
} else if (e.which === 1) {
this.handleMouseDownLeft(e);
}
console.log(this.deviceList);
}
mousemove(e) {
const oldX = this._x;
const oldY = this._y;
const dx = e.offsetX - oldX;
const dy = e.offsetY - oldY;
this._x = e.offsetX;
this._y = e.offsetY;
if (e.which === 3) {
this.handleMouseMoveRight({x: e.offsetX, y: e.offsetY});
} else if (e.which === 1) {
this.handleMouseMoveLeft(e, dx, dy, oldX, oldY);
}
}
mouseup(e) {
console.log(e);
if (eventTool.notLeftMouse(e) || !this.eventTarget ) {
return;
}
// if (this.deviceList.length) {
// this.deviceList.forEach(item => {
// item.setModel(e.offsetX - this._offsetX, e.offsetY - this._offsetY);
// });
// this.deviceList = [];
// this.$iscs.deleteCheckBox('check_box');
// this.eventTarget = '';
// // this._dragging = false;
// this.deviceList = [];
// return;
// }
// if (this.isAllowDragging) {
// this.eventTarget.setModel(e.offsetX - this._offsetX, e.offsetY - this._offsetY);
// this.eventTarget.dirty();
// }
// this.eventTarget = '';
// // this._dragging = false;
// this.deviceList = [];
}
contextmenu(e) {
var em = this.checkEvent(e);
this.trigger(this.events.Contextmenu, em);
}
click(e) {
var em = this.checkEvent(e);
this.trigger(this.events.Selected, em);
}
moveEvent(e) {
const newEm = new EventModel(e);
const trainDetails = store.state.map.trainDetails;
if (trainDetails) {
if (newEm.deviceType != deviceType.Train || trainDetails.code != newEm.deviceCode) {
var instance = (this.$iscs.getDeviceByCode(trainDetails.code) || {} ).instance;
instance && instance.removeTrainDetail && instance.removeTrainDetail();
}
}
}
checkEvent(e) {
var oldEm = new EventModel(this.$zr.curEvent || { event: {} });
var newEm = new EventModel(e);
if ([1, 3].includes(e.which)) {
// 查找之前和当前鼠标选中的实例
var oldDevice = this.$iscs.getDeviceByCode(oldEm.deviceCode) || {};
var newDevice = this.$iscs.getDeviceByCode(newEm.deviceCode) || {};
var oldInstance = (this.$iscs.getDeviceByCode(oldEm.deviceCode) || {}).instance || {};
var newInstance = (this.$iscs.getDeviceByCode(newEm.deviceCode) || {}).instance || {};
// 如果之前和当前选中的实例不一致
if (oldInstance != newInstance) {
// 如果实例有取消选择函数并且被点击,则执行取消选中函数
if (oldInstance.mouseEvent && oldInstance.mouseEvent.mouseout) {
// 视图数据设置点击标志,同步执行
oldDevice['down'] = false;
oldInstance.mouseEvent['mouseout'](e);
}
// 如果实例有选中函数并且被点击,则执行选中函数
if (e.which == 3 && newInstance.mouseEvent && newInstance.mouseEvent.mouseover) {
newDevice['down'] = true;
newInstance.mouseEvent['mouseover'](e);
}
}
// 保存当前实例到全局
this.$zr.curEvent = e;
}
return newEm;
}
/** 处理鼠标右键按下事件 */
handleMouseDownRight(e) {
this.deviceList = [];
this.$iscs.deleteCheckBox('check_box'); // 清空上次操作
this.rightClickPoint.x = e.offsetX;
this.rightClickPoint.y = e.offsetY;
}
/** 处理鼠标左键按下事件 */
handleMouseDownLeft(e) {
if (this.eventTarget && this.eventTarget._type === deviceType.CheckBox) {
this.handleBoundingRect(this.eventTarget);
} else {
this.$iscs.deleteCheckBox('check_box');
}
}
/** 处理右键拖动事件--- 改变选中区域大小 */
handleMouseMoveRight(point2) {
const point1 = this.rightClickPoint;
const x = Math.min(point1.x, point2.x) + this.$iscs.$options.offsetX;
const y = Math.min(point1.y, point2.y) + this.$iscs.$options.offsetY;
const width = Math.abs(point1.x - point2.x);
const height = Math.abs(point1.y - point2.y);
this.$iscs.renderCheckBox({code: 'check_box', _type: 'CheckBox', point: {x: x, y: y}, width: width, height: height });
}
/** 处理左键拖动事件--- 图形移动 */
handleMouseMoveLeft(e, dx, dy, oldX, oldY) {
// if (!this._moveOnMouseMove || !this._dragging || !this.isAllowDragging) {
// return;
// }
// 选中区域图形移动
// if (this.deviceList.length) {
// this.deviceList.forEach(item => {
// item.grouper.drift(dx, dy, e);
// });
// } else if (this._dragging && this.eventTarget) { // 选中元素图形移动
// if (!this.isAllowDragging) {
// this._preventDefaultMouseMove && eventTool.stop(e.event);
// this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y });
// } else if (this.isAllowDragging) {
// this.eventTarget.grouper.drift(dx, dy, e);
// }
// } else if (this._dragging) {
// this._preventDefaultMouseMove && eventTool.stop(e.event);
// this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y });
// }
}
/** 通过包围盒筛选选中区域的元素 */
handleBoundingRect(eventTarget) {
this.deviceList = [];
let boundingRect = eventTarget.grouper.getBoundingRect();
boundingRect = this.createFakeBoundingRect(eventTarget, boundingRect);
const deviceList = Object.values(this.$iscs.iscsDevice);
const includeDeviceList = [];
deviceList.forEach( item =>{
let deviceBoundingRect = item.instance.grouper.getBoundingRect();
deviceBoundingRect = this.createFakeBoundingRect(item.instance, deviceBoundingRect);
if (this.whetherInclude(boundingRect, deviceBoundingRect )) {
includeDeviceList.push(item.instance);
}
});
this.deviceList = includeDeviceList;
}
/** 创建假包围盒对象 */
createFakeBoundingRect(instance, boundingRect) {
return {
x1: instance.model.point.x + boundingRect.x,
y1: instance.model.point.y + boundingRect.y,
x2: instance.model.point.x + boundingRect.width,
y2: instance.model.point.y + boundingRect.height
};
}
/** 判断元素包围盒是否在选中区域 */
whetherInclude(boundingRect1, boundingRect2) {
return boundingRect1.x1 <= boundingRect2.x1 && boundingRect1.y1 <= boundingRect2.y1 && boundingRect1.x2 >= boundingRect2.x2 && boundingRect1.y2 >= boundingRect2.y2;
}
}
export default MouseController;

View File

@ -0,0 +1,27 @@
import Group from 'zrender/src/container/Group';
import createPathSvg from '../components/pathsvg';
export default class airConditioner extends Group {
constructor(device) {
super();
this.model = device.model;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this._type = device.model._type;
this.code = device.model.code;
this.create();
}
create() {
this.grouper = new Group({
id: this.model.code,
position: [this.model.point.x, this.model.point.y]
});
this.path = createPathSvg(this.model);
this.grouper.add(this.path);
this.add(this.grouper);
}
setModel(dx, dy) {
this.model.point.x += dx;
this.model.point.y += dy;
}
}

View File

@ -87,6 +87,10 @@ const map = {
Elevator: { // 电梯 Elevator: { // 电梯
width: 134, width: 134,
path: 'M124,10V129H9V10H124ZM16,121H117V15H16V121Zm91.5-59a3.5,3.5,0,1,1,3.5-3.5A3.5,3.5,0,0,1,107.5,62Zm0-11a3.5,3.5,0,1,1,3.5-3.5A3.5,3.5,0,0,1,107.5,51Zm0-11a3.5,3.5,0,1,1,3.5-3.5A3.5,3.5,0,0,1,107.5,40Zm0-10a3.5,3.5,0,1,1,3.5-3.5A3.5,3.5,0,0,1,107.5,30ZM67,64H64V82l-2,1v22l-5-2V85H55v21l-5-1L49,54H43V69l-4-2V50l12-1s-3.327-1.327-4-3c-1.151-2.858-2.493-7.956,5-10s10.62,2.4,11,5c0.861,5.9-2,7-2,7v3l5,2,10,9,13-2v3s-6.188,4.864-13,5S67,64,67,64Zm59-10V8H7V131H126V82h8v55H0V0H134V54h-8Z' path: 'M124,10V129H9V10H124ZM16,121H117V15H16V121Zm91.5-59a3.5,3.5,0,1,1,3.5-3.5A3.5,3.5,0,0,1,107.5,62Zm0-11a3.5,3.5,0,1,1,3.5-3.5A3.5,3.5,0,0,1,107.5,51Zm0-11a3.5,3.5,0,1,1,3.5-3.5A3.5,3.5,0,0,1,107.5,40Zm0-10a3.5,3.5,0,1,1,3.5-3.5A3.5,3.5,0,0,1,107.5,30ZM67,64H64V82l-2,1v22l-5-2V85H55v21l-5-1L49,54H43V69l-4-2V50l12-1s-3.327-1.327-4-3c-1.151-2.858-2.493-7.956,5-10s10.62,2.4,11,5c0.861,5.9-2,7-2,7v3l5,2,10,9,13-2v3s-6.188,4.864-13,5S67,64,67,64Zm59-10V8H7V131H126V82h8v55H0V0H134V54h-8Z'
},
Draught: {
width: 58,
path: 'M51,37H40s-7.972-2.382-9-13c-0.861-8.9,8-13,8-13h5l2-2V0H58V28ZM56,2H48V4h8V2Zm0,4H48V8h8V6Zm0,4H48l-3,3H40s-7.193,3.874-7,11c0.212,7.819,8,11,8,11h9l6-8V10ZM37,24s-0.648-7.966,8-9c0,0,9,.386,9,8,0,0-.386,8.444-8,9C46,32,37,31.614,37,24ZM8,36S1.028,34.618,0,24c-0.861-8.9,8-14,8-14h5l2-3V0H28V28l-8,8H8ZM17,2V4.82L23.658,2H17Zm9,1.18L19.343,6H26V3.18ZM26,8H17l-3,4H10S1.807,15.874,2,23A13,13,0,0,0,9,34H19l7-7V8ZM6,24c-0.08-2.305,1.386-9,9-9,0,0,8,.386,8,8,0,0,.54,7.739-8,9C12.306,32.4,6.224,30.493,6,24Z'
} }
}; };

View File

@ -44,6 +44,7 @@ import Cistern from './bas/cistern';
import Electrically from './bas/electrically'; import Electrically from './bas/electrically';
import Stairs from './bas/stairs'; import Stairs from './bas/stairs';
import Elevator from './bas/elevator'; import Elevator from './bas/elevator';
import Draught from './bas/draught';
const iscsShape = {}; const iscsShape = {};
iscsShape[deviceType.ManualAlarmButton] = ManualAlarmButton; iscsShape[deviceType.ManualAlarmButton] = ManualAlarmButton;
@ -92,6 +93,7 @@ iscsShape[deviceType.Cistern] = Cistern;
iscsShape[deviceType.Electrically] = Electrically; iscsShape[deviceType.Electrically] = Electrically;
iscsShape[deviceType.Stairs] = Stairs; iscsShape[deviceType.Stairs] = Stairs;
iscsShape[deviceType.Elevator] = Elevator; iscsShape[deviceType.Elevator] = Elevator;
iscsShape[deviceType.Draught] = Draught;
function shapefactory(device, iscs) { function shapefactory(device, iscs) {
const type = device.model._type; const type = device.model._type;

View File

@ -178,6 +178,9 @@ export function parser(data) {
zrUtil.each(data.elevatorList || [], elem => { zrUtil.each(data.elevatorList || [], elem => {
iscsDevice[elem.code] = deviceFactory(deviceType.Elevator, elem); iscsDevice[elem.code] = deviceFactory(deviceType.Elevator, elem);
}); });
zrUtil.each(data.draughtList || [], elem => {
iscsDevice[elem.code] = deviceFactory(deviceType.Draught, elem);
});
} }
return iscsDevice; return iscsDevice;
@ -247,5 +250,6 @@ export function updateIscsData(state, device) {
case deviceType.Electrically: updateIscsListByDevice(state, 'electricallyList', device); break; case deviceType.Electrically: updateIscsListByDevice(state, 'electricallyList', device); break;
case deviceType.Stairs: updateIscsListByDevice(state, 'stairsList', device); break; case deviceType.Stairs: updateIscsListByDevice(state, 'stairsList', device); break;
case deviceType.Elevator: updateIscsListByDevice(state, 'elevatorList', device); break; case deviceType.Elevator: updateIscsListByDevice(state, 'elevatorList', device); break;
case deviceType.Draught: updateIscsListByDevice(state, 'draughtList', device); break;
} }
} }

View File

@ -4,52 +4,72 @@
class="xian-01__systerm stand-run-level" class="xian-01__systerm stand-run-level"
:title="title" :title="title"
:visible.sync="show" :visible.sync="show"
width="320px" width="500px"
:before-close="doClose" :before-close="doClose"
:z-index="2000" :z-index="2000"
:modal="false" :modal="false"
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<div style="font-size: 16px; margin-bottom: 5px;">变通节点</div> <el-row class="header">
<div style="margin-bottom: 5px;"> <el-col :span="10"><span>车站名称</span></el-col>
<el-input v-model="stationName" size="mini" disabled /> <el-col :span="10" :offset="2"><span>站台方向</span></el-col>
</div> </el-row>
<div style="font-size: 16px; margin-bottom: 5px;">当前变通策略</div> <el-row>
<div style="margin-bottom: 5px;"> <el-col :span="10">
<el-input v-model="stationStrategy" size="mini" disabled /> <el-input v-model="stationName" size="small" disabled />
</div>
<div style="font-size: 16px; margin-bottom: 5px;">变通策略选项</div>
<el-table
ref="table"
:data="strategyList"
border
:cell-style="tableStyle"
style="width: 100%; margin-top:10px"
size="mini"
height="180"
highlight-current-row
:show-header="false"
@row-click="clickEvent"
>
<el-table-column :id="domIdChoose" prop="label" style="margin-left:30px" />
</el-table>
<el-row justify="center" class="button-group">
<el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" :disabled="!isConfirm" @click="commit">
确定</el-button>
</el-col> </el-col>
<el-col :span="8" :offset="4"> <el-col :span="10" :offset="2">
<el-button :id="domIdCancel" @click="cancel"> </el-button> <div style="height: 32px;">
<el-radio v-model="standStatus" :label="true" style="line-height: 32px;" disabled>上行方向</el-radio>
<el-radio v-model="standStatus" :label="false" style="line-height: 32px;" disabled>下行方向</el-radio>
</div>
</el-col> </el-col>
</el-row> </el-row>
<div class="table">
<span>站台状态</span>
<el-table ref="tempData" :data="tempData" border style="width: 100%; height: 170px;" size="mini">
<el-table-column prop="name" :width="170" label="折返站" />
<el-table-column prop="station" label="折返站台" />
<el-table-column prop="strategy" label="折返策略">
<template slot-scope="scope">
<el-select
:id="domIdChoose"
v-model="scope.row.strategy"
size="mini"
@change="strategySelectChange"
>
<el-option
v-for="item in strategyList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
</el-table>
</div>
<el-row class="button-group">
<span v-if="isSelect && tempData.length">{{ $t('menu.switchbackStrategyTip') }}</span>
<span v-if="isConfirm && tempData.length">{{ $t('menu.setSwitchbackStrategyTipPrefix') + tempData[0].name + $t('menu.setSwitchbackStrategyTipSuffix') }}</span>
</el-row>
<el-row justify="center" class="button-group">
<el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" :disabled="!isConfirm" @click="commit">确认</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel">取消</el-button>
</el-col>
</el-row>
<!-- <confirm-control ref="confirmControl" /> -->
<notice-info ref="noticeInfo" /> <notice-info ref="noticeInfo" />
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import NoticeInfo from './childDialog/childDialog/noticeInfo'; import NoticeInfo from './childDialog/childDialog/noticeInfo';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler'; import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import {menuOperate, commitOperate} from '../utils/menuOperate';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
export default { export default {
@ -61,15 +81,31 @@ export default {
return { return {
dialogShow: false, dialogShow: false,
loading: false, loading: false,
strategyList: [], tempData: [],
strategyList: [
{
value: '01',
label: this.$t('menu.noSwitchback')
},
{
value: '02',
label: this.$t('menu.noOneSwitchback')
},
{
value: '03',
label: this.$t('menu.automaticChange')
},
{
value: '04',
label: this.$t('menu.default')
}
],
stationName: '', stationName: '',
stationStrategy: '', standStatus: '',
selection: [], selection: [],
isSelect: true,
isConfirm: false, isConfirm: false,
strategyId: '', strategy: ''
tableStyle: {
'border-bottom': 'none'
}
}; };
}, },
computed: { computed: {
@ -83,13 +119,13 @@ export default {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : ''; return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
}, },
domIdConfirm() { domIdConfirm() {
return this.dialogShow ? OperationEvent.Station.setBackStrategy.menu.domId : ''; return this.dialogShow ? OperationEvent.StationStand.setBackStrategy.menu.domId : '';
}, },
domIdChoose() { domIdChoose() {
return this.dialogShow ? OperationEvent.Station.setBackStrategy.choose.domId : ''; return this.dialogShow ? OperationEvent.StationStand.setBackStrategy.choose.domId : '';
}, },
title() { title() {
return '策略选择'; return this.$t('menu.setSwitchbackStrategy');
} }
}, },
mounted() { mounted() {
@ -98,13 +134,39 @@ export default {
}); });
}, },
methods: { methods: {
loadInitData(selected) {
this.tempData = [];
const station = this.stationList.find(n => n.code == selected.stationCode);
this.tempData.push({ name: station.name, station: selected.name, strategy: selected.reentryStrategy || '04' });
},
strategySelectChange(strategy) {
const operate = {
operation: OperationEvent.StationStand.setBackStrategy.choose.operation,
val: `${strategy}`
};
this.strategy = strategy;
this.isSelect = false;
this.isConfirm = true;
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
});
},
doShow(operate, selected) { doShow(operate, selected) {
this.selected = selected; this.selected = selected;
if (!this.dialogShow) { if (!this.dialogShow) {
const name = selected.optionList.find(ele => ele.id == selected.tbStrategyId).label; this.standStatus = '';
this.stationName = selected.name || ''; this.stationName = '';
this.stationStrategy = selected.tbStrategyId ? name : '无策略折返'; // if (selected && selected._type.toUpperCase() === 'StationStand'.toUpperCase()) {
this.strategyList = selected.optionList; // this.standStatus = selected.right;
const station = this.$store.getters['map/getDeviceByCode'](selected.stationCode);
if (station) {
this.stationName = station.name;
}
}
this.loadInitData(selected);
} }
this.dialogShow = true; this.dialogShow = true;
@ -114,7 +176,7 @@ export default {
}, },
clickEvent(row, column, event) { clickEvent(row, column, event) {
const operate = { const operate = {
operation: OperationEvent.Station.setBackStrategy.choose.operation operation: OperationEvent.StationStand.setBackStrategy.choose.operation
}; };
this.strategyId = row.id; this.strategyId = row.id;
this.isConfirm = true; this.isConfirm = true;
@ -147,7 +209,16 @@ export default {
commit() { commit() {
if (this.isConfirm) { if (this.isConfirm) {
this.loading = true; this.loading = true;
commitOperate(menuOperate.StationControl.setBackStrategy, {id: this.strategyId}, 2).then(({valid})=>{ const operate = {
over: true,
operation: OperationEvent.StationStand.setBackStrategy.menu.operation,
cmdType: CMD.Stand.CMD_STAND_SET_REENTRY_STRATEGY,
param:{
standReentryStrategy: this.strategy
}
};
this.loading = true;
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
this.loading = false; this.loading = false;
if (valid) { if (valid) {
this.doClose(); this.doClose();

View File

@ -0,0 +1,179 @@
<template>
<el-dialog
v-dialogDrag
class="xian-01__systerm stand-run-level"
:title="title"
:visible.sync="show"
width="320px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<div style="font-size: 16px; margin-bottom: 5px;">变通节点</div>
<div style="margin-bottom: 5px;">
<el-input v-model="stationName" size="mini" disabled />
</div>
<div style="font-size: 16px; margin-bottom: 5px;">当前变通策略</div>
<div style="margin-bottom: 5px;">
<el-input v-model="stationStrategy" size="mini" disabled />
</div>
<div style="font-size: 16px; margin-bottom: 5px;">变通策略选项</div>
<el-table
ref="table"
:data="strategyList"
border
:cell-style="tableStyle"
style="width: 100%; margin-top:10px"
size="mini"
height="180"
highlight-current-row
:show-header="false"
@row-click="clickEvent"
>
<el-table-column :id="domIdChoose" prop="label" style="margin-left:30px" />
</el-table>
<el-row justify="center" class="button-group">
<el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" :disabled="!isConfirm" @click="commit">
确定</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-col>
</el-row>
<notice-info ref="noticeInfo" />
</el-dialog>
</template>
<script>
import NoticeInfo from './childDialog/childDialog/noticeInfo';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import {menuOperate, commitOperate} from '../utils/menuOperate';
import { mapGetters } from 'vuex';
export default {
name: 'StandBackStrategy',
components: {
NoticeInfo
},
data() {
return {
dialogShow: false,
loading: false,
strategyList: [],
stationName: '',
stationStrategy: '',
selection: [],
isConfirm: false,
strategyId: '',
tableStyle: {
'border-bottom': 'none'
}
};
},
computed: {
...mapGetters('map', [
'stationList'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationEvent.Station.setBackStrategy.menu.domId : '';
},
domIdChoose() {
return this.dialogShow ? OperationEvent.Station.setBackStrategy.choose.domId : '';
},
title() {
return '策略选择';
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
},
methods: {
doShow(operate, selected) {
this.selected = selected;
if (!this.dialogShow) {
const name = selected.optionList.find(ele => ele.id == selected.tbStrategyId).label;
this.stationName = selected.name || '';
this.stationStrategy = selected.tbStrategyId ? name : '无策略折返'; //
this.strategyList = selected.optionList; //
}
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
clickEvent(row, column, event) {
const operate = {
operation: OperationEvent.Station.setBackStrategy.choose.operation
};
this.strategyId = row.id;
this.isConfirm = true;
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
});
},
checkTableDataSelction(data) {
const selection = [];
if (data && data.length > 0) {
data.forEach(row => {
if (row.check && !row.disabled) {
selection.push(row);
}
});
}
this.disabledSend = !selection.length;
if (JSON.stringify(selection) !== JSON.stringify(this.selection)) {
this.selection = selection;
}
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
},
commit() {
if (this.isConfirm) {
this.loading = true;
commitOperate(menuOperate.StationControl.setBackStrategy, {id: this.strategyId}, 2).then(({valid})=>{
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(() => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow();
});
} else {
this.doClose();
}
},
cancel() {
const operate = {
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => {
this.doClose();
});
}
}
};
</script>

View File

@ -1,13 +1,13 @@
<template> <template>
<div> <div>
<pop-menu ref="popMenu" :menu="menu" /> <pop-menu ref="popMenu" :menu="menu" />
<stand-back-strategy ref="standBackStrategy" /> <station-back-strategy ref="stationBackStrategy" />
</div> </div>
</template> </template>
<script> <script>
import PopMenu from '@/components/PopMenu'; import PopMenu from '@/components/PopMenu';
import StandBackStrategy from './dialog/standBackStrategy'; import StationBackStrategy from './dialog/stationBackStrategy';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic'; import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
@ -19,7 +19,7 @@ export default {
name: 'MenuStationTurnBack', name: 'MenuStationTurnBack',
components: { components: {
PopMenu, PopMenu,
StandBackStrategy StationBackStrategy
}, },
props: { props: {
selected: { selected: {
@ -103,7 +103,7 @@ export default {
setBackStrategy() { setBackStrategy() {
commitOperate(menuOperate.StationControl.setBackStrategy, {stationCode: this.selected.stationCode}, 0).then(({valid, operate})=>{ commitOperate(menuOperate.StationControl.setBackStrategy, {stationCode: this.selected.stationCode}, 0).then(({valid, operate})=>{
if (valid) { if (valid) {
this.$refs.standBackStrategy.doShow(operate, this.selected); this.$refs.stationBackStrategy.doShow(operate, this.selected);
} }
}); });
} }

View File

@ -157,6 +157,12 @@ export default {
mode: 'bas', mode: 'bas',
id: '27', id: '27',
type: 'interface' type: 'interface'
},
{
name: '隧道通风',
mode: 'bas',
id: '28',
type: 'interface'
} }
] ]
}, },

View File

@ -0,0 +1,133 @@
<template>
<div>
<el-form ref="form" :rules="rules" :model="form" label-width="100px">
<el-form-item v-if="isUpdate" label="编号" prop="code">
<el-input v-model="form.code" :disabled="true" />
</el-form-item>
<el-form-item label="图形宽度" prop="width">
<el-input-number v-model="form.width" :min="10" />
</el-form-item>
<el-form-item label="颜色" prop="fill">
<el-color-picker v-model="form.fill" />
</el-form-item>
<el-form-item label="X轴坐标" prop="x">
<el-input-number v-model="form.x" controls-position="right" :min="1" />
</el-form-item>
<el-form-item label="Y轴坐标" prop="y">
<el-input-number v-model="form.y" controls-position="right" :min="1" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('form')">{{ buttonText }}</el-button>
<el-button v-show="showDeleteButton" type="danger" @click="deleteDevice">{{ $t('global.delete') }}</el-button>
<el-button v-show="showDeleteButton" @click="initPage">{{ $t('global.cancel') }}</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default {
name:'AirConditioner',
data() {
return {
isUpdate:false,
showDeleteButton: false,
buttonText: '立即创建',
form:{
code:'',
width: 40,
fill: '#fff',
x: 10,
y: 10
},
rules: {
code: [
{ required: true, message:'请生成设备图形的编码', trigger: 'blur' }
],
width:[
{ required: true, message:'请输入设备图形宽度', trigger: 'blur' }
],
x: [
{ required: true, message: '请输入设备图形的X轴坐标', trigger: 'blur' }
],
y: [
{ required: true, message: '请输入设备图形的Y轴坐标', trigger: 'blur' }
]
}
};
},
computed:{
...mapGetters('iscs', [
'iscs'
])
},
watch:{
'$store.state.iscs.rightClickCount': function (val) {
const model = this.$store.getters['iscs/updateDeviceData'];
if (model._type === 'Draught' ) {
this.buttonText = '修改';
this.showDeleteButton = true;
this.isUpdate = true;
this.form.code = model.code;
this.form.width = model.width;
this.form.fill = model.fill;
this.form.x = model.point.x;
this.form.y = model.point.y;
}
}
},
mounted() {
},
methods:{
onSubmit(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const model = {
point: {
x: this.form.x,
y: this.form.y
},
_type: 'Draught',
code: this.isUpdate ? this.form.code : getUID('Draught', this.iscs.draughtList || []),
width: this.form.width,
fill: this.form.fill
};
this.$emit('createDataModel', model);
this.initPage();
} else {
return false;
}
});
},
initPage() {
this.isUpdate = false;
this.buttonText = '立即创建';
this.showDeleteButton = false;
this.form = {
code:'',
width: 40,
x: 10,
y: 10
};
this.$refs.form.resetFields();
},
deleteDevice() {
const airConditionerModel = {
point: {
x: this.form.x,
y: this.form.y
},
_type: 'Draught',
code: this.form.code,
width: this.form.width,
fill: '#fff'
};
this.$emit('deleteDataModel', airConditionerModel );
this.initPage();
}
}
};
</script>

View File

@ -163,6 +163,14 @@
@deleteDataModel="deleteDataModel" @deleteDataModel="deleteDataModel"
/> />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="风机" name="Draught">
<draught
ref="draught"
style="width: 100%;height: 100%;"
@createDataModel="createDataModel"
@deleteDataModel="deleteDataModel"
/>
</el-tab-pane>
<el-tab-pane label="闸机" name="FasBrakeMachine"> <el-tab-pane label="闸机" name="FasBrakeMachine">
<fas-brake-machine <fas-brake-machine
ref="fasBrakeMachine" ref="fasBrakeMachine"
@ -252,6 +260,7 @@ import FasBrakeMachine from '../iscsOperate/brakeMachine'; // 闸机
import StateTable from '../iscsCommonElem/stateTable'; import StateTable from '../iscsCommonElem/stateTable';
import Stairs from './stairs'; import Stairs from './stairs';
import Elevator from './elevator'; import Elevator from './elevator';
import Draught from './draught';
export default { export default {
name: 'IscsOperate', name: 'IscsOperate',
@ -281,8 +290,8 @@ export default {
FasBrakeMachine, FasBrakeMachine,
StateTable, StateTable,
Stairs, Stairs,
Elevator Elevator,
Draught
}, },
mixins: [ mixins: [
], ],

View File

@ -139,13 +139,17 @@ export default {
if (this.selected && this.selected.code) { if (this.selected && this.selected.code) {
switch (hook) { switch (hook) {
case 'Ctrl_C': { case 'Ctrl_C': {
this.copyModel = deepAssign({}, this.selected); if (this.selected._type != "CheckBox") {
this.copyModel.point = { this.copyModel = deepAssign({}, this.selected);
x: this.selected.point.x + 10, this.copyModel.point = {
y: this.selected.point.y + 10 x: this.selected.point.x + 10,
}; y: this.selected.point.y + 10
const type1 = this.selected._type.charAt(0).toLowerCase() + this.selected._type.slice(1); // .toLowerCase() };
this.copyModel.code = getUID(this.selected._type, this.iscs[type1 + 'List'] || []); const type1 = this.selected._type.charAt(0).toLowerCase() + this.selected._type.slice(1); // .toLowerCase()
this.copyModel.code = getUID(this.selected._type, this.iscs[type1 + 'List'] || []);
} else {
this.copyModel = {}
}
} break; } break;
case 'Ctrl_V': case 'Ctrl_V':
this.copyModel.code && this.createDataModel(this.copyModel); this.copyModel.code && this.createDataModel(this.copyModel);