This commit is contained in:
fan 2020-10-28 18:19:46 +08:00
commit 36d6a7d81c
15 changed files with 142 additions and 25 deletions

View File

@ -179,3 +179,19 @@ export function justTripTurnBack(planId, tripNo, data) {
data
});
}
/** 开始编辑*/
export function startRpEdit(planId) {
return request({
url: `/api/rpTools/${planId}/edit`,
method: 'put'
})
}
/** 开始编辑*/
export function endRpEdit(planId) {
return request({
url: `/api/rpTools/${planId}/endEdit`,
method: 'put'
})
}

View File

@ -688,6 +688,7 @@ class SkinCode extends defaultStyle {
trainServer: {
serviceNumberPrefix: '00', // 服务号(表号)前缀
defaultServiceNumber: 'AA', // 默认服务号(表号)
defaultServiceHeadNum: 'MM', // 人工车号
trainServerOffset: { x: 4, y: 4 }// 列车服务号偏移
},
trainTarget: {

View File

@ -40,12 +40,22 @@ export default class TrainBody extends Group {
create() {
const model = this.model;
const style = this.model.style;
const serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.serviceNumber || model.model.specialServiceNumber || style.Train.trainServer.defaultServiceNumber);// 服务号(表号)
this.nameFormat = model.nameFormat;
const tripNumber = style.Train.trainTarget.tripNumberPrefix + (style.Train.trainTarget.defaultDirectionCode
? (model.directionCode || style.Train.trainTarget.defaultDirectionCode) + (model.tripNumber || style.Train.trainTarget.defaultTripNumber)
: model.tripNumber || style.Train.trainTarget.defaultTripNumber); // 车次号
let targetCode = style.Train.trainNumber.targetCodePrefix + (model.destinationCode || style.Train.trainNumber.defaultTargetCode); // 目的地码
: model.tripNumber || style.Train.trainTarget.defaultTripNumber); // 车次号
const groupNumber = style.Train.trainTargetNumber.groupNumberPrefix + (style.Train.trainTargetNumber.lineNumber || '') + (model.groupNumber || style.Train.trainTargetNumber.defaultGroupNumber); // 车组号
let serviceNumber = ''; // 服务号(表号)
if (this.model.type == 'PLAN') { // 计划车
serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.serviceNumber || model.model.specialServiceNumber || style.Train.trainServer.defaultServiceNumber);
} else if (this.model.type == 'HEAD') { // 头码车
serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.destinationCode || style.Train.trainNumber.defaultTargetCode);
this.nameFormat = 'serviceNumber:groupNumber';
} else if (this.model.type == 'MANUAL') { // 人工车
serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.serviceNumber || model.model.specialServiceNumber || style.Train.trainServer.defaultServiceHeadNum);
this.nameFormat = 'serviceNumber:groupNumber';
}
let targetCode = style.Train.trainNumber.targetCodePrefix + (model.destinationCode || style.Train.trainNumber.defaultTargetCode); // 目的地码
if (Vue.prototype.$jlmap.lineCode == '09') { // 暂时先写死 后面有了删掉就好
targetCode = '01';
}

View File

@ -5,7 +5,7 @@
<div :class="chatContent.memberId == myMemberId?'rightUser':'leftUser'">
<div class="userHeader">
<div v-if="!chatContent.self" class="userName">{{ covertName(chatContent.memberId) }}</div>
<div :class="chatContent.memberId == myMemberId?'userChatTime textRight':'userChatTime'">{{ chatContent.time }}</div>
<div :class="chatContent.memberId == myMemberId?'userChatTime textRight':'userChatTime'">{{ covertTime(chatContent.time) }}</div>
</div>
<div class="userBubble" @click="playAudio(baseUrl+chatContent.src)">
<div class="userMessage">
@ -23,6 +23,7 @@
<script>
import yuyin from '@/assets/yuyin.png';
import {overConversationMessage} from '@/api/chat';
// this.time = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}${prefixIntrger(date.getSeconds(), 2)}`;
export default {
props:{
messageList:{
@ -153,6 +154,16 @@ export default {
}
return name;
},
covertTime(time) {
const date = new Date(time);
let hour = date.getHours();
let minute = date.getMinutes();
let second = date.getSeconds();
hour = hour > 9 ? hour : '0' + hour;
minute = minute > 9 ? minute : '0' + minute;
second = second > 9 ? second : '0' + second;
return hour + ':' + minute + ':' + second;
},
playAudio(audioUrl) {
if (!this.isPlay) {
document.querySelector('#audioPlay').src = audioUrl;

View File

@ -129,7 +129,7 @@ export default {
height: calc(100% - 10px);
/deep/ {
.el-card__body {
height: 100%;
height: calc(100% - 50px);
overflow-y: auto;
&::-webkit-scrollbar {

View File

@ -1,6 +1,6 @@
<template>
<drawer :visible.sync="drawer" direction="rtl" :width="600" @before-close="e => drawer=false">
<template slot="title">修改表单</template>
<template slot="title">修改站信息</template>
<div class="container" v-if="model">
<el-form class="form" :model="model" :rules="rules" ref="form" label-width="100px" >
<el-form-item label="车站名称" prop="name">

View File

@ -63,7 +63,7 @@ export default {
rules: {
time: [
{
type: 'number', min: 0, message: 'Please select the arrival time.', trigger: 'blur'
required: true, type: 'number', min: 0, message: 'Please select the arrival time.', trigger: 'blur'
},
{
validator: validator, trigger: 'blur'

View File

@ -46,7 +46,7 @@ export default {
rules: {
time: [
{
type: 'number', min: 0, max: 12*3600, message: 'Please select the stop time.', trigger: 'blur'
required: true, type: 'number', min: 0, max: 12*3600, message: 'Please select the stop time.', trigger: 'blur'
},
{
validator: validator, trigger: 'blur'

View File

@ -38,7 +38,7 @@ export default {
rules: {
time: [
{
type: 'number', min: 0, message: 'Please select turn back time.', trigger: 'blur'
required: true, type: 'number', min: 0, message: 'Please select turn back time.', trigger: 'blur'
}
],
}

View File

@ -1,6 +1,6 @@
<template>
<el-dialog v-dialogDrag append-to-body title="Modification of train diagram parameters" :visible.sync="dialogShow" width="30%" :close-on-click-modal="false" :before-close="doClose">
<el-form ref="form" label-width="160px" :model="formModel" :rules="rules">
<el-form ref="form" label-width="200px" :model="formModel" :rules="rules">
<el-form-item label="Average speed" prop="averageSpeed">
<el-input-number v-model="formModel.averageSpeed" controls-position="right" :min="20" :max="60" />
<span style="padding-left: 10px">km/h</span>
@ -57,32 +57,32 @@ export default {
rules: {
averageSpeed: [
{
type: 'number', min: 20, max: 60, message: 'Please select the stop time.', trigger: 'blur'
required: true, type: 'number', min: 20, max: 60, message: 'Please select the stop time.', trigger: 'blur'
}
],
maxSpeed: [
{
type: 'number', min: 50, max: 80, message: 'Please select the stop time.', trigger: 'blur'
required: true, type: 'number', min: 50, max: 80, message: 'Please select the stop time.', trigger: 'blur'
}
],
stopTime: [
{
type: 'number', min: 10, max: 120, message: 'Please select the stop time.', trigger: 'blur'
required: true, type: 'number', min: 10, max: 120, message: 'Please select the stop time.', trigger: 'blur'
}
],
minStopTime: [
{
type: 'number', min: 10, max: 30, message: 'Please select the stop time.', trigger: 'blur'
required: true, type: 'number', min: 10, max: 30, message: 'Please select the stop time.', trigger: 'blur'
}
],
minIntervalTime: [
{
type: 'number', min: 30, max: 360, message: 'Please select the stop time.', trigger: 'blur'
required: true, type: 'number', min: 30, max: 360, message: 'Please select the stop time.', trigger: 'blur'
}
],
turnBackTime: [
{
type: 'number', min: 60, max: 180, message: 'Please select the stop time.', trigger: 'blur'
required: true, type: 'number', min: 60, max: 180, message: 'Please select the stop time.', trigger: 'blur'
}
]
}

View File

@ -73,6 +73,7 @@ import * as utils from '../utils.js';
import { timeFormat } from '@/utils/date';
import { mapGetters } from 'vuex';
import {
startRpEdit, endRpEdit,
listLines, listStations,
listRps, createRp, deleteRp,
getRpTools, clearRpPlan, addRpTrip, delRpTrip,
@ -102,6 +103,7 @@ export default {
planData: {},
selected: null,
target: null,
isModify: false,
textareaModel: {
id: 0,
show: false,
@ -123,7 +125,7 @@ export default {
},
computed: {
disabled() {
return !this.planId;
return !this.planId || !this.isModify;
},
show() {
return this.textareaModel.show;
@ -157,14 +159,35 @@ export default {
height() {
this.setPosition();
},
$route() {
this.loadPlanData();
$route: function (to, from) {
const fromPlanId = from.query.planId;
if (fromPlanId) {
if(utils.getModifyState(fromPlanId)) {
endRpEdit(fromPlanId).then(resp => {
utils.delModifyState(fromPlanId);
this.loadPlanData();
})
} else {
this.loadPlanData();
}
} else {
this.loadPlanData();
}
}
},
created() {
this.planUtil = this.$theme.loadPlanConvert(this.lineCode);
},
mounted() {
window.onbeforeunload = e => {
if(this.planId &&
utils.getModifyState(this.planId)) {
endRpEdit(this.planId).then(resp => {
utils.setModifyState(this.planId, resp.data);
})
}
};
this.setPosition();
this.loadPlanData();
},
@ -177,6 +200,7 @@ export default {
return {
id: it.id,
isPlan: true,
isModify: it.editable,
name: it.mapName,
lineId: it.mapId,
}
@ -200,6 +224,31 @@ export default {
this.$refs.schedule.loadChartPage(stations);
if (this.planId) {
if(utils.getModifyState(this.planId)) {
endRpEdit(this.planId).then(resp => {
utils.setModifyState(this.planId, resp.data);
startRpEdit(this.planId).then(resp => {
this.isModify = resp.data;
utils.setModifyState(this.planId, resp.data);
if (this.isModify) {
listRps().then(resp => {
this.planList = this.buildPlanList(resp.data);
});
}
});
})
} else {
startRpEdit(this.planId).then(resp => {
this.isModify = resp.data;
utils.setModifyState(this.planId, resp.data);
if (this.isModify) {
listRps().then(resp => {
this.planList = this.buildPlanList(resp.data);
});
}
});
}
getRpTools(this.planId).then(rest => {
const planData = this.planData = rest.data;
this.$store.commit('rpTools/setPlanData', planData);

View File

@ -7,12 +7,15 @@
<span><i :class="data.isPlan? 'el-icon-document': 'el-icon-folder'"/>&ensp;{{data.name}}</span>
<el-button
v-if="!data.isPlan"
type="text"
style="color:red"
class="btn-text"
type="danger"
size="mini"
@click.stop="onDelete(data)">
Delete
<i class="el-icon-delete" />
</el-button>
<span v-else>
<el-link :underline="false" :type="data.isModify?'warning':'info'"><code>{{data.isModify? 'edit': 'read'}}</code></el-link>
</span>
</span>
</template>
</el-tree>
@ -68,4 +71,9 @@ export default {
justify-content: space-between;
width: 100%;
}
.btn-text {
color: #fff;
padding: 5px 10px;
}
</style>

View File

@ -42,9 +42,8 @@ export default {
const xIndex = pointInGrid[0];
const yIndex = pointInGrid[1];
const option = this.myChart.getOption();
const minY = option.yAxis[0].min;
const xVal = option.xAxis[0].data[xIndex];
const yObj = this.planUtil.getStationByCoordinateY(this.stations, yIndex-minY);
const yObj = this.planUtil.getStationByCoordinateY(this.stations, yIndex);
if (yObj) {
cb({yObj, xVal, pointInPixel, pointInGrid, e});
}

View File

@ -163,7 +163,9 @@ export default {
shadowColor: 'rgba(0, 0, 0, 0.6)',
shadowOffsetX: 2,
shadowOffsetY: 2
},
},
rangeMode: 'percent',
labelFormatter: this.dataZoomFormat,
bottom: '20px'
}
]
@ -197,6 +199,9 @@ export default {
yAxisLabelFormat(value, index) {
return '';
},
dataZoomFormat(value) {
return timeFormat(value);
},
axisTooltip(param) {
let data = '';

View File

@ -111,3 +111,21 @@ var binary = atob(dataURI.split(',')[1]), array = [];
for(var i = 0; i < binary.length; i++) array.push(binary.charCodeAt(i));
return new Blob([new Uint8Array(array)], {type: dataTYPE});
}
const ModifyFlag = 'AUS-modify-flag'
export function getModifyState(planId) {
const state = JSON.parse(localStorage.getItem(ModifyFlag)||`{ }`);
return state[planId];
}
export function setModifyState(planId, bool) {
const state = JSON.parse(localStorage.getItem(ModifyFlag)||`{ }`);
bool
? state[planId] = bool
: delete state[planId]
localStorage.setItem(ModifyFlag, JSON.stringify(state));
}
export function delModifyState(planId) {
const state = JSON.parse(localStorage.getItem(ModifyFlag)||`{ }`);
delete state[planId];
localStorage.setItem(ModifyFlag, JSON.stringify(state));
}