This commit is contained in:
fan 2019-09-04 18:48:10 +08:00
commit e24a0e1b4d
19 changed files with 624 additions and 173 deletions

View File

@ -72,9 +72,24 @@ export function queryRunPlan(planId) {
});
}
/**
* 删除运行图
*/
// 根据skinCode查询发布运行图列表
export function queryRunPlanList(skinCode) {
return request({
url: `/api/runPlan/template/skin/${skinCode}`,
method: 'get'
});
}
// 从发布运行图创建新运行图
export function postCreatePlan(data) {
return request({
url: `/api/runPlan/draft/createFrom/${data.templateId}`,
method: 'post',
data: data
});
}
// 删除运行图
export function deleteRunPlan(planId) {
return request({
url: `/api/runPlan/draft/${planId}`,
@ -82,6 +97,15 @@ export function deleteRunPlan(planId) {
});
}
// 修改运行图内容
export function putRunPlanDetail(data) {
return request({
url: `/api/runPlan/draft/${data.planId}`,
method: 'put',
data: data
});
}
/**
* 发布运行图
*/
@ -204,15 +228,6 @@ export function duplicateService(data) {
});
}
/** 修改计划*/
// export function updatePlanService(data) {
// return request({
// url: `/api/runPlan/draft/${data.planId}/service/${data.serviceNumber}`,
// method: 'put',
// data: data
// })
// }
/** 增加任务*/
export function addPlanTrip(data) {
return request({

View File

@ -110,8 +110,15 @@ class MouseController extends Eventful {
this._draggingName='simple';
} else if (this.isAllowDragging&&e.target.parent.getName()=='group') {
this._draggingName='group';
this._offsetX=e.offsetX;
this._offsetY=e.offsetY;
// debugger;
// this._draggingTarget.parent.model.point
} else if (this.isAllowDragging&&e.target.parent.getName()=='group_child') {
this._draggingName='group_child';
this._offsetX=e.offsetX;
this._offsetY=e.offsetY;
}
this._draggingTarget = draggingTarget;
// draggingTarget.dragging = true;
@ -157,6 +164,9 @@ class MouseController extends Eventful {
} else if (this.isAllowDragging&&this._draggingTarget&&(this._draggingName=='group'||this._draggingName=='group_child')) {
// debugger;
if (this._draggingName=='group') {
// this._draggingTarget.parent.model.point.x+=dx;
// this._draggingTarget.parent.model.point.y+=dy;
// this._draggingTarget.parent.dirty();
this._draggingTarget.parent.drift(dx, dy, e);
return true;
} else {
@ -175,6 +185,17 @@ class MouseController extends Eventful {
// debugger;
const draggingTarget = this._draggingTarget;
if (!eventTool.notLeftMouse(e)&&draggingTarget) {
if (this._draggingName=='simple') {
console.log();
} else if (this._draggingName=='group'||this._draggingName=='group_child') {
if (this._draggingName=='group') {
this._draggingTarget.parent.setModal(e.offsetX - this._offsetX, e.offsetY - this._offsetY);
this._draggingTarget.parent.dirty();
} else {
this._draggingTarget.parent.parent.parent.setModal(e.offsetX - this._offsetX, e.offsetY - this._offsetY);
this._draggingTarget.parent.parent.dirty();
}
}
this._dragging = false;
this._draggingTarget = null;
this._draggingName=='';

View File

@ -28,6 +28,7 @@ export default class clock extends Group {
this.initTime = 0;
this.name='group';
this.create();
}
create() {
this.clockBg = new Image({
@ -263,4 +264,18 @@ export default class clock extends Group {
getName() {
return this.name;
}
setModal(dx, dy) {
// debugger;
// this.parent.dirty();
//
// this.model.point.x+=dx;
// this.model.point.y+=dy;
// this.eachChild(function(child) {
// // // debugger;
// child.style.x+=dx;
// child.style.y+=dy;
// // child.dirty();
// }, this.parent);
}
}

View File

@ -102,4 +102,8 @@ export default class elevator extends Group {
// this.grouper.attr('draggable', true);
// this.createMouseEvent();
}
setModal(dx, dy) {
this.model.point.x+=dx;
this.model.point.y+=dy;
}
}

View File

@ -153,6 +153,7 @@ class Jlmap {
const type = elem._type;
const oDevice = this.mapDevice[code] || deviceFactory(type, elem);
const nDevice = Object.assign(oDevice || {}, elem);
console.log(oDevice, nDevice, 111);
this.$painter.delete(oDevice);
if (!elem._dispose) {
this.mapDevice[code] = nDevice;

View File

@ -3,8 +3,8 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'https://test.joylink.club/jlcloud';
BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.4:9000' // 琰培
} else {

View File

@ -439,11 +439,24 @@ export default {
edit() {
this.$refs['dataform'].validate((valid) => {
if (valid) {
const model = Object.assign({_type: 'Link'}, this.editModel);
this.$emit('addOrUpdateMapModel', model);
this.$emit('addOrUpdateMapModel', this.buildEditModel());
}
});
},
buildEditModel() {
const model = {
_type: 'Link',
code: this.editModel.code,
name: this.editModel.name,
color: this.editModel.color == '' ? '#4e8de6' : this.editModel.color,
leftFdCode: this.editModel.leftFdCode,
leftSdCode: this.editModel.leftSdCode,
rightFdCode: this.editModel.rightFdCode,
rightSdCode: this.editModel.rightSdCode,
lengthFact: this.editModel.lengthFact
};
return model;
},
//
deleteObj() {
const selected = this.$store.getters['map/getDeviceByCode'](this.editModel.code);

View File

@ -312,8 +312,6 @@ export default {
{ prop: 'destinationCodePoint.y', firstLevel: 'destinationCodePoint', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px'}
] },
{ prop: 'destinationCodeShow', label: this.$t('map.destinationCodeShow'), type: 'checkbox', isHidden: !this.isdestinationCode },
{ prop: 'leftStopPointOffset', label: this.$t('map.leftStopPointOffset'), type: 'number', min: 0, isHidden: !this.isStopPointOffset },
{ prop: 'rightStopPointOffset', label: this.$t('map.rightStopPointOffset'), type: 'number', min: 0, isHidden: !this.isStopPointOffset },
{ prop: 'isSwitchSection', label: this.$t('map.isSwitchSection'), type: 'checkbox', isHidden: !this.isSectionType },
{ prop: 'relSwitchCode', label: this.$t('map.relSwitchCode'), type: 'select', optionLabel: 'code&&name', optionValue: 'code', options: this.switchList, change: true, deviceChange: this.deviceChange, isHidden: !this.isRelSwitchCode, disabled: true },
@ -340,6 +338,8 @@ export default {
{ prop: 'stationCode', label: this.$t('map.equipmentStation'), type: 'select', mode: true, optionLabel: 'name&&code', optionValue: 'code', disabled: this.isStationCodeDisabled, options: this.stationList },
{ prop: 'offsetLeft', label: this.$t('map.sectionOffsetLeft'), type: 'number', min: 0, placeholder: '米', isHidden: !this.isSectionType },
{ prop: 'offsetRight', label: this.$t('map.sectionOffsetRight'), type: 'number', min: 0, placeholder: '米', isHidden: !this.isSectionType },
{ prop: 'leftStopPointOffset', label: this.$t('map.leftStopPointOffset'), type: 'number', min: 0, isHidden: !this.isStopPointOffset },
{ prop: 'rightStopPointOffset', label: this.$t('map.rightStopPointOffset'), type: 'number', min: 0, isHidden: !this.isStopPointOffset },
{ prop: 'region', label: this.$t('map.sectionColon'), type: 'select', optionLabel: 'label', optionValue: 'value', options: this.regionList, isHidden: !this.sectionColonShow },
{ prop: 'kmRangeLeft', label: this.$t('map.leftKilometerMark'), type: 'number', min: 0 },
{ prop: 'kmRangeRight', label: this.$t('map.rightKilometerMark'), type: 'number', min: 0 },

View File

@ -366,11 +366,48 @@ export default {
edit() {
this.$refs['dataform'].validate((valid) => {
if (valid) {
const model = Object.assign({_type: 'Signal'}, this.editModel);
this.$emit('addOrUpdateMapModel', model);
this.$emit('addOrUpdateMapModel', this.buildEditModel());
}
});
},
buildEditModel() {
const model = {
_type: 'Signal',
code: this.editModel.code,
name: this.editModel.name,
uniqueName: this.editModel.uniqueName,
useType: this.editModel.useType,
lampPostType: this.editModel.lampPostType,
lampPositionType: this.editModel.lampPositionType,
potLampType: this.editModel.potLampType,
positionType: this.editModel.positionType,
directionType: this.editModel.directionType,
nameShow: this.editModel.nameShow,
buttonShow: this.editModel.buttonShow,
guideShow: this.editModel.guideShow,
offset: this.editModel.offset,
rotate: this.editModel.rotate,
position: {
x: this.editModel.position.x,
y: this.editModel.position.y
},
namePosition: {
x: this.editModel.namePosition.x,
y: this.editModel.namePosition.y
},
guidePosition: {
x: this.editModel.guidePosition.x,
y: this.editModel.guidePosition.y
},
buttonPosition: {
x: this.editModel.buttonPosition.x,
y: this.editModel.buttonPosition.y
},
stationCode: this.editModel.stationCode,
linkCode: this.editModel.linkCode
};
return model;
},
//
deleteObj() {
const selected = this.$store.getters['map/getDeviceByCode'](this.editModel.code);

View File

@ -241,11 +241,36 @@ export default {
edit() {
this.$refs['dataform'].validate((valid) => {
if (valid) {
const model = Object.assign({_type: 'Station'}, this.editModel);
this.$emit('addOrUpdateMapModel', model);
this.$emit('addOrUpdateMapModel', this.buildEditModel());
}
});
},
buildEditModel() {
var model = {
_type: 'Station',
code: this.editModel.code,
visible: this.editModel.visible,
runPlanName: this.editModel.runPlanName,
name: this.editModel.name,
zcCode: this.editModel.zcCode,
nameFont: this.editModel.nameFont,
nameFontColor: this.editModel.nameFontColor,
kmPostShow: this.editModel.kmPostShow,
kmRange: this.editModel.kmRange,
kmPost: this.editModel.kmPost,
kmPostFontColor: this.editModel.kmPostFontColor,
kmPostFont: this.editModel.kmPostFont,
isShowControlMode: this.editModel.isShowControlMode,
centralized: this.editModel.centralized,
concentrateStationCode: this.editModel.concentrateStationCode,
position: {
x: this.editModel.position.x,
y: this.editModel.position.y
}
};
return model;
},
//
deleteObj() {
const selected = this.$store.getters['map/getDeviceByCode'](this.editModel.code);

View File

@ -224,11 +224,27 @@ export default {
edit() {
this.$refs['dataform'].validate((valid) => {
if (valid) {
const model = Object.assign({_type: 'StationControl'}, this.editModel);
this.$emit('addOrUpdateMapModel', model);
this.$emit('addOrUpdateMapModel', this.buildEditModel());
}
});
},
buildEditModel() {
const model = {
_type: 'StationControl',
code: this.editModel.code,
zokContent: this.editModel.zokContent,
zbjkContent: this.editModel.zbjkContent,
zakContent: this.editModel.zakContent,
jjzkContent: this.editModel.jjzkContent,
zzkContent: this.editModel.zzkContent,
stationCode: this.editModel.stationCode,
position: {
x: this.editModel.position.x,
y: this.editModel.position.y
}
};
return model;
},
//
deleteObj() {
const selected = this.$store.getters['map/getDeviceByCode'](this.editModel.code);

View File

@ -158,16 +158,8 @@ export default {
this.$messageBox(this.$t('map.failedLoadListPublishedMaps'));
});
},
isNormal() {
return this.activeTab === 'first';
},
isThird() {
return this.activeTab === 'third';
},
create() {
if (this.isThird()) {
this.close();
} else if (this.isNormal()) {
if (this.activeTab === 'first') {
this.$refs['newForm'].validate((valid) => {
if (valid) {
this.loading = true;

View File

@ -1,9 +1,9 @@
<template>
<el-dialog :title="this.$t('map.operationGraphPublished')" :visible.sync="dialogShow" width="30%" :before-close="handleClose">
<div>
<el-form ref="form" label-position="right" :model="editModel" label-width="120px" size="mini">
<el-form ref="form" label-position="right" :model="editModel" label-width="120px" size="mini" :rules="rules">
<el-form-item :label="this.$t('map.operationGraphName')" prop="name">
<el-input v-model="editModel.name" :disabled="true" />
<el-input v-model="editModel.name" />
</el-form-item>
</el-form>
</div>
@ -34,6 +34,11 @@ export default {
editModel: {
planId: '',
name: ''
},
rules: {
name: [
{ required: true, message: '请输入运行图名称', trigger: 'blur' }
]
}
};
},

View File

@ -150,19 +150,27 @@ export default {
title: '打开运行图',
click: this.handleOpenRunPlan
},
{
type: 'file',
title: '导入运行图',
click: this.handleImportRunPlan
},
// {
// type: 'file',
// title: '',
// click: this.handleImportRunPlan
// },
{
title: '新建运行图',
click: this.handleCreateEmptyPlan
},
{
title: '修改运行图名称',
click: this.handleEditPlan
},
{
title: '修改站间运行时间',
click: this.handleModifyingStationIntervalTime
// disabledCallback: () => { return !this.$route.query.planId },
},
{
title: '删除运行图',
click: this.handledeleteRunPlan
}
]
},
@ -389,7 +397,14 @@ export default {
},
//
handleOpenRunPlan() {
this.$emit('dispatchDialog', { name: 'openRunPlan', params: {} });
this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
},
handledeleteRunPlan() {
this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'delete'} });
},
//
handleEditPlan() {
this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'edit'} });
},
loadingScreen() {
this.loading = this.$loading({

View File

@ -4,28 +4,54 @@
class="planEdit__tool create-empty-plan"
:title="title"
:visible.sync="dialogShow"
width="420px"
width="30%"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-row>
<el-form ref="form" :model="addModel" label-width="140px" size="mini" :rules="rules" @submit.native.prevent>
<el-form-item label="运行图名称:" prop="name">
<el-input v-model="addModel.name" autofocus />
</el-form-item>
</el-form>
</el-row>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
<div>
<el-tabs v-model="activeTab" type="card">
<el-tab-pane label="正常新建" name="first">
<el-row>
<el-form ref="form" :model="newModel" label-width="140px" size="mini" :rules="rules" @submit.native.prevent>
<el-form-item label="运行图名称:" prop="name">
<el-input v-model="newModel.name" autofocus />
</el-form-item>
</el-form>
</el-row>
</el-tab-pane>
<el-tab-pane label="从发布运行图创建" name="second">
<el-row>
<el-form ref="pullForm" :model="pullModel" label-width="140px" size="mini" :rules="pullRules" @submit.native.prevent>
<el-form-item label="发布运行图" prop="templateId">
<el-select v-model="pullModel.templateId" :placeholder="$t('map.pleaseSelect')">
<el-option
v-for="item in publishMapList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="运行图名称:" prop="name">
<el-input v-model="pullModel.name" autofocus />
</el-form-item>
</el-form>
</el-row>
</el-tab-pane>
</el-tabs>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" :loading="loading" @click="handleCommit">{{ $t('map.confirm') }}</el-button>
<el-button @click="doClose">{{ $t('map.cancel') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { createEmptyPlan } from '@/api/runplan';
import { createEmptyPlan, queryRunPlanList, postCreatePlan } from '@/api/runplan';
import { UrlConfig } from '@/router/index';
export default {
name: 'CreateEmptyPlan',
@ -33,9 +59,16 @@ export default {
},
data() {
return {
activeTab: 'first',
dialogShow: false,
loading: false,
addModel: {
publishMapList: [],
newModel: {
name: '',
skinCode: this.$route.query.skinCode
},
pullModel: {
templateId: '',
name: '',
skinCode: this.$route.query.skinCode
}
@ -43,7 +76,7 @@ export default {
},
computed: {
title() {
return '创建空运行图数据';
return '新建运行图';
},
rules() {
return {
@ -51,36 +84,88 @@ export default {
{ required: true, message: '请输入运行图名称', trigger: 'blur' }
]
};
},
pullRules() {
return {
templateId: [
{ required: true, message: '请选择发布运行图', trigger: 'change' }
],
name: [
{ required: true, message: '请输入运行图名称', trigger: 'blur' }
]
};
}
},
mounted() {
},
methods: {
async initLoad() {
const res = await queryRunPlanList(this.$route.query.skinCode);
if (res.code == 200 && res.data.length) {
this.publishMapList = res.data;
}
},
doShow() {
this.dialogShow = true;
this.initLoad();
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.newModel.name = '';
this.pullModel.templateId = '';
this.pullModel.name = '';
if (this.$refs.form) {
this.$refs.form.resetFields();
}
if (this.$refs.pullForm) {
this.$refs.pullForm.resetFields();
}
},
handleCommit() {
this.$refs['form'].validate((valid) => {
if (valid) {
createEmptyPlan(this.addModel).then(resp => {
const params = {
dialogName: 'openRunPlan',
operate: 'loadRunPlanData',
params: { planId: resp.data, skinCode: this.$route.query.skinCode, planName: this.addModel.name, refresh: true }
};
if (this.activeTab === 'first') {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true;
createEmptyPlan(this.newModel).then(resp => {
const params = {
dialogName: 'openRunPlan',
operate: 'loadRunPlanData',
params: { planId: resp.data, skinCode: this.$route.query.skinCode, planName: this.newModel.name, refresh: true }
};
this.$emit('dispatchOperate', params);
this.$emit('dispatchDialog', { name: 'openRunPlan', params: {} });
this.$message.success('创建空运行图成功!');
this.doClose();
}).catch(() => {
this.$messageBox('创建空运行图失败');
this.doClose();
});
}
});
this.$emit('dispatchOperate', params);
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
this.$message.success('创建空运行图成功!');
this.jump(resp.data, this.newModel.name);
this.doClose();
}).catch(() => {
this.$messageBox('创建空运行图失败');
this.doClose();
});
}
});
} else {
this.$refs['pullForm'].validate((valid) => {
if (valid) {
this.loading = true;
postCreatePlan(this.pullModel).then(resp => {
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
this.$message.success('创建运行图成功!');
this.jump(resp.data, this.pullModel.name);
this.doClose();
}).catch(() => {
this.$messageBox('创建运行图失败');
this.doClose();
});
}
});
}
},
jump(planId, planName) {
const query = { skinCode: this.$route.query.skinCode, mapId: this.$route.query.mapId, planId: planId, planName: planName };
this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query });
}
}
};

View File

@ -0,0 +1,116 @@
<template>
<el-dialog
v-dialogDrag
class="planEdit__tool create-empty-plan"
:title="title"
:visible.sync="dialogShow"
width="30%"
:before-close="doClose"
:z-index="3000"
:modal="false"
:close-on-click-modal="false"
>
<div>
<el-row>
<el-form ref="form" :model="editModel" label-width="140px" size="mini" :rules="rules" @submit.native.prevent>
<el-form-item label="运行图名称:" prop="name">
<el-input v-model="editModel.name" autofocus />
</el-form-item>
</el-form>
</el-row>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" :loading="loading" @click="handleEdit">修改</el-button>
<el-button @click="doClose">{{ $t('map.cancel') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { putRunPlanDetail } from '@/api/runplan';
export default {
name: 'CreateEmptyPlan',
components: {
},
data() {
return {
activeTab: 'first',
dialogShow: false,
loading: false,
publishMapList: [],
editModel: {
planId: '',
name: ''
}
};
},
computed: {
title() {
return '修改运行图名称';
},
rules() {
return {
name: [
{ required: true, message: '请输入运行图名称', trigger: 'blur' }
]
};
}
},
mounted() {
},
methods: {
doShow(data) {
this.dialogShow = true;
if (data && data.name) {
this.editModel.name = data.name;
this.editModel.planId = data.id;
}
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.editModel.name = '';
if (this.$refs.form) {
this.$refs.form.resetFields();
}
},
handleEdit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true;
putRunPlanDetail(this.editModel).then(resp => {
const params = {
dialogName: 'openRunPlan',
operate: 'loadRunPlanData',
params: { planId: resp.data, skinCode: this.$route.query.skinCode, planName: this.editModel.name, refresh: true }
};
this.$emit('dispatchOperate', params);
this.$message.success('修改运行图名称成功!');
this.$emit('renewal');
this.doClose();
}).catch(() => {
this.$messageBox('修改运行图名称失败');
this.doClose();
});
}
});
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
/deep/ {
.el-input {
width: 160px;
}
.el-input-number {
width: 120px;
}
}
</style>

View File

@ -1,42 +1,49 @@
<template>
<el-dialog
v-dialogDrag
class="planEdit__tool open-runplan"
:title="title"
:visible.sync="show"
width="640px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{height: height+'px'}">
<el-tree
ref="tree"
class="filter-tree"
:data="runPlanList"
:props="defaultProps"
default-expand-all
:style="{height: height-20+'px'}"
>
<span slot-scope="{ node, data }">
<el-radio v-model="planId" :label="data.id"><span>{{ data.name }}</span></el-radio>
</span>
</el-tree>
</el-scrollbar>
<el-row type="flex" justify="center" class="button-group">
<el-button type="primary" @click="handleConfirm">选择运行图</el-button>
<el-button @click="dialogShow = false"> </el-button>
</el-row>
</el-dialog>
<div>
<el-dialog
v-dialogDrag
class="planEdit__tool open-runplan"
:title="title"
:visible.sync="show"
width="640px"
:before-close="doClose"
:z-index="2000"
:modal="true"
:close-on-click-modal="false"
>
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{height: height+'px'}">
<el-tree
ref="tree"
class="filter-tree"
:data="runPlanList"
:props="defaultProps"
highlight-current
default-expand-all
:style="{height: height-20+'px'}"
@node-click="handleNodeClick"
/>
</el-scrollbar>
<el-row type="flex" justify="center" class="button-group">
<el-button v-if="type == 'add'" type="primary" @click="handleConfirm">选择运行图</el-button>
<el-button v-if="type == 'delete'" type="primary" @click="handleDelete">删除</el-button>
<el-button v-if="type == 'edit'" type="primary" @click="handleEdit">修改</el-button>
<el-button @click="dialogShow = false"> </el-button>
</el-row>
</el-dialog>
<edit-plan-name ref="editPlan" @renewal="getRunPlanList" />
</div>
</template>
<script>
import { getRpListByMapId } from '@/api/runplan';
import { getRpListByMapId, deleteRunPlan } from '@/api/runplan';
import { UrlConfig } from '@/router/index';
import EditPlanName from './editPlanName';
export default {
name: 'OpenRunPlan',
components: {
EditPlanName
},
props: {
skinCode: {
type: String,
@ -49,6 +56,9 @@ export default {
loading: false,
height: 260,
planId: '',
planName: '',
type: 'add',
// defaultShowKeys: [],
runPlanList: [],
runPlanDict: {},
defaultProps: {
@ -72,35 +82,74 @@ export default {
});
},
methods: {
handleNodeClick(data) {
this.planId = data.id;
this.planName = data.name;
},
loadRunPlanData({ refresh, planId, skinCode, planName }) {
if (refresh) {
this.$store.dispatch('runPlan/refresh');
} else {
const query = { skinCode: skinCode, mapId: this.$route.query.mapId, planId: planId, planName, try: this.$route.query.try, goodsId: this.$route.query.goodsId };
const query = { skinCode: skinCode, mapId: this.$route.query.mapId, planId: planId, planName: planName };
this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query });
}
},
doShow() {
getRunPlanList() {
getRpListByMapId(this.$route.query.mapId).then((resp) => {
this.runPlanList = resp.data;
this.runPlanList.forEach(elem => {
this.runPlanDict[elem.id] = elem.name;
});
// this.defaultShowKeys = [this.planId];
this.dialogShow = true;
}).catch(() => {
this.$messageBox('获取运行图列表失败');
});
},
doShow(data) {
this.type = data.type || 'add';
this.getRunPlanList();
},
doClose() {
this.dialogShow = false;
this.planId = '';
this.planName = '';
},
//
handleConfirm() {
this.loadRunPlanData({
planId: this.planId,
skinCode: this.$route.query.skinCode,
planName: this.runPlanDict[this.planId]
planName: this.planName
});
this.doClose();
},
//
handleDelete() {
this.$confirm('您确认是否删除此运行图?', this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
deleteRunPlan(this.planId).then(Response => {
this.$message.success(`删除成功!`);
if (this.planId === this.$route.query.planId) {
const query = { skinCode: this.$route.query.skinCode, mapId: this.$route.query.mapId };
this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query });
}
this.doClose();
}).catch(() => {
this.$messageBox(this.$t('tip.deleteOperationGraphFailed'));
});
}).catch(() => { });
},
//
handleEdit() {
if (this.planId && this.planName) {
this.$refs.editPlan.doShow({id: this.planId, name: this.planName});
} else {
this.$message.info('请选择运行图');
}
}
}
};

View File

@ -371,6 +371,8 @@ export default {
this.myChart && this.myChart.hideLoading();
this.$messageBox('获取运行图数据失败');
});
} else {
this.clearCanvas();
}
});
}).catch(() => {
@ -468,6 +470,14 @@ export default {
}
});
},
clearCanvas() {
this.option.series = [];
this.option.title.text = '';
if (this.myChart) {
this.myChart.clear();
}
this.myChart.setOption(this.option);
},
xAxisPointFormat(params) {
return timeFormat(params.value);
},

View File

@ -15,7 +15,7 @@
</div>
<!-- 参与人员 -->
<div class="personnel">
<div style="height: calc(100% - 20px); overflow-y: scroll;">
<div style="height: calc(100% - 20px); overflow-y: scroll; padding: 0px 30px;">
<div style="display: flex; justify-content: space-between;">
<div class="Scheduling">
<p class="title">调度员</p>
@ -33,7 +33,7 @@
<el-button icon="el-icon-plus" circle plain @click="addingRoles('dispatch', '增加调度人员')" />
</div>
</div>
<div class="Scheduling bottomNone">
<div class="Scheduling">
<p class="title">车站值班员</p>
<ul>
<li v-for="(nor, index) in equipmentList" :key="index" class="selectPerson">
@ -107,7 +107,7 @@
</div>
</div>
<div style="display: flex; justify-content: space-between;">
<div class="Scheduling bottomNone">
<div class="Scheduling">
<p class="title">司机</p>
<ul>
<li v-for="(nor, index) in driverList" :key="index" class="selectPerson">
@ -123,7 +123,7 @@
<el-button icon="el-icon-plus" circle plain @click="addingRoles('driver', '增加司机')" />
</div>
</div>
<div class="Scheduling bottomNone">
<div class="Scheduling">
<p class="title">IBP</p>
<ul>
<li v-for="(nor, index) in ibpList" :key="index" class="selectPerson">
@ -162,54 +162,72 @@
</div>
</div>
</div>
<div class="start-box">
<div v-if="!starting" style="float: right; margin-left: 10px;">
<el-button
v-if="userId == roomInfo.creatorId"
type="primary"
style="float: right;"
:loading="loading"
@click="start"
>
开始仿真</el-button>
<div style="display: flex; justify-content: space-between;">
<div class="Scheduling">
<p class="title">大屏</p>
<ul>
<li v-for="(nor, index) in bigScreenList" :key="index" class="selectPerson">
<span>{{ nor.nickName }}</span>
<i
v-if="userId == roomInfo.creatorId"
class="el-icon-close delPerson"
@click="handleDelUser(bigScreenList, nor, index)"
/>
</li>
</ul>
<div v-if="userId == roomInfo.creatorId" class="add-box">
<el-button icon="el-icon-plus" circle plain @click="addingRoles('bigScreen', '增加大屏')" />
</div>
</div>
<div v-else>
<el-button
type="primary"
style="float: right; margin-right: 10px;"
:loading="loading"
@click="joinJointTrain"
>
进入仿真</el-button>
<el-button
v-if="userId == roomInfo.creatorId"
type=""
style="float: right; margin-right: 10px;"
:loading="loading"
@click="stop"
>
结束仿真</el-button>
</div>
<el-button
v-if="userId == roomInfo.creatorId"
type=""
style="float: right; margin-right: 0px;"
:loading="loading"
@click="postCode"
>生成二维码
</el-button>
<el-button type="" style="float: right; margin-right: 10px;" @click="backRoom">返回
</el-button>
<el-button
v-if="userId == roomInfo.creatorId"
type="danger"
style="float: right; margin-right: 0px;"
:loading="loading"
@click="exit"
>销毁房间
</el-button>
</div>
</div>
<div class="start-box">
<el-button
v-if="userId == roomInfo.creatorId"
style="margin-left: 10px"
type="danger"
:loading="loading"
@click="exit"
>销毁房间
</el-button>
<el-button
v-if="userId == roomInfo.creatorId"
style="margin-left: 10px"
type="success"
:loading="loading"
@click="postCode"
>生成二维码
</el-button>
<template v-if="!starting">
<el-button
v-if="userId == roomInfo.creatorId"
style="margin-left: 10px"
type="primary"
:loading="loading"
@click="start"
>
开始仿真</el-button>
</template>
<template v-else>
<el-button
type="primary"
style="margin-left: 10px"
:loading="loading"
@click="joinJointTrain"
>
进入仿真</el-button>
<el-button
v-if="userId == roomInfo.creatorId"
style="margin-left: 10px"
type="warning"
:loading="loading"
@click="stop"
>
结束仿真</el-button>
</template>
<el-button type="" @click="backRoom">返回
</el-button>
</div>
</div>
</div>
<!-- 观众席 -->
@ -286,7 +304,8 @@ export default {
adminList: [],
driverList: [],
signalList: [],
stationList: [], //
bigScreenList: [],
stationList: [],
ibpList: [],
point: {
x: 0,
@ -387,7 +406,8 @@ export default {
...this.equipmentList,
...this.driverList,
...this.signalList,
...this.ibpList
...this.ibpList,
...this.bigScreenList
].length - 1: 0;
},
filterNode(value, data) {
@ -483,11 +503,11 @@ export default {
break;
case 'Attendant':
this.equipmentList.forEach((nor, index) => {
if (nor.id == item.id) { //
if (nor.id == item.id) {
this.equipmentList.splice(index, 1);
}
});
this.equipmentList.push(item); //
this.equipmentList.push(item);
break;
case 'Driver':
this.driverList.push(item);
@ -497,11 +517,14 @@ export default {
break;
case 'IBP':
this.ibpList.forEach((nor, index) => {
if (nor.id == item.id) { //
if (nor.id == item.id) {
this.ibpList.splice(index, 1);
}
});
this.ibpList.push(item); //
this.ibpList.push(item);
break;
case 'BigScreen':
this.bigScreenList.push(item);
break;
default:
this.dispatchList.forEach((nor, index) => {
@ -534,6 +557,11 @@ export default {
this.ibpList.splice(index, 1);
}
});
this.bigScreenList.forEach((nor, index) => {
if (item.id == nor.id) {
this.bigScreenList.splice(index, 1);
}
});
break;
}
});
@ -597,6 +625,10 @@ export default {
item.select = true;
this.ibpList.push(item);
break;
case 'BigScreen':
item.select = true;
this.bigScreenList.push(item);
break;
}
this.treeData.push(item);
});
@ -713,6 +745,9 @@ export default {
case 'ibp': // IBP
params.userRole = 'IBP';
break;
case 'bigScreen': //
params.userRole = 'BigScreen';
break;
}
arr.push(params);
});
@ -886,15 +921,14 @@ export default {
}
.personnel {
padding: 0px 20px;
width: calc(100% - 500px);
height: calc(100% - 60px);
height: calc(100% - 120px);
float: left;
.Scheduling {
width: calc(50% - 10px);
float: left;
height: 250px;
height: 240px;
border: 1px solid #ccc;
margin-bottom: 20px;
overflow-y: scroll;
@ -915,10 +949,6 @@ export default {
}
}
.bottomNone {
margin-bottom: 0;
}
.selectPerson {
height: 30px;
line-height: 30px;
@ -940,9 +970,11 @@ export default {
}
.start-box {
width: 100%;
height: 40px;
margin-top: 20px;
width: 100%;
display: flex;
justify-content: center;
background: #f1f1f1;
padding: 20px 0px;
}
@media screen and (max-width: 1325px) {