This commit is contained in:
fan 2022-09-20 10:19:21 +08:00
commit d5e9c55fcd
45 changed files with 389 additions and 658 deletions

View File

@ -19,6 +19,7 @@
},
"dependencies": {
"axios": "^0.18.0",
"dayjs": "^1.11.5",
"echarts": "^4.7.0",
"element-ui": "^2.12.0",
"file-saver": "^1.3.3",

View File

@ -1,258 +1,159 @@
import Group from 'zrender/src/container/Group';
import Image from 'zrender/src/graphic/Image';
import clock0 from '@/assets/ibp_images/clock/clock_0.png';
import clock1 from '@/assets/ibp_images/clock/clock_1.png';
import clock2 from '@/assets/ibp_images/clock/clock_2.png';
import clock3 from '@/assets/ibp_images/clock/clock_3.png';
import clock4 from '@/assets/ibp_images/clock/clock_4.png';
import clock5 from '@/assets/ibp_images/clock/clock_5.png';
import clock6 from '@/assets/ibp_images/clock/clock_6.png';
import clock7 from '@/assets/ibp_images/clock/clock_7.png';
import clock8 from '@/assets/ibp_images/clock/clock_8.png';
import clock9 from '@/assets/ibp_images/clock/clock_9.png';
import clockBg from '@/assets/ibp_images/clock/clock_bg.png';
import clockColon from '@/assets/ibp_images/clock/clock_colon.png';
import Group from 'zrender/src/container/Group'
import Image from 'zrender/src/graphic/Image'
import clock0 from '@/assets/ibp_images/clock/clock_0.png'
import clock1 from '@/assets/ibp_images/clock/clock_1.png'
import clock2 from '@/assets/ibp_images/clock/clock_2.png'
import clock3 from '@/assets/ibp_images/clock/clock_3.png'
import clock4 from '@/assets/ibp_images/clock/clock_4.png'
import clock5 from '@/assets/ibp_images/clock/clock_5.png'
import clock6 from '@/assets/ibp_images/clock/clock_6.png'
import clock7 from '@/assets/ibp_images/clock/clock_7.png'
import clock8 from '@/assets/ibp_images/clock/clock_8.png'
import clock9 from '@/assets/ibp_images/clock/clock_9.png'
import clockBg from '@/assets/ibp_images/clock/clock_bg.png'
import clockColon from '@/assets/ibp_images/clock/clock_colon.png'
import { timestampFormat } from '@/utils/date'
const pics = [clock0, clock1, clock2, clock3, clock4, clock5, clock6, clock7, clock8, clock9]
export default class clock extends Group {
constructor(device) {
super();
this._type = device.model._type;
this._code = device.model.code;
this.model = device.model;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.initTime = 0;
this.create();
}
create() {
this.grouper = new Group({
id: this.model.code,
position: [this.model.point.x, this.model.point.y]
});
this.clockBg = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: clockBg,
x: 0,
y: 0,
width: this.model.width,
height: this.model.width / 493 * 156
}
});
this.num1 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: this.getImagePic('0'),
x: this.model.width * 0.098,
y: this.model.width * 0.062,
width: this.model.width * 0.095,
height: this.model.width * 0.095 / 37 * 74
}
});
this.num2 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: this.getImagePic('0'),
x: this.model.width * 0.22,
y: this.model.width * 0.062,
width: this.model.width * 0.095,
height: this.model.width * 0.095 / 37 * 74
}
});
this.num3 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: this.getImagePic('0'),
x: this.model.width * 0.395,
y: this.model.width * 0.062,
width: this.model.width * 0.095,
height: this.model.width * 0.095 / 37 * 74
}
});
this.num4 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: this.getImagePic('0'),
x: this.model.width * 0.52,
y: this.model.width * 0.062,
width: this.model.width * 0.095,
height: this.model.width * 0.095 / 37 * 74
}
});
this.num5 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: this.getImagePic('0'),
x: this.model.width * 0.69,
y: this.model.width * 0.062,
width: this.model.width * 0.095,
height: this.model.width * 0.095 / 37 * 74
}
});
this.num6 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: this.getImagePic('0'),
x: this.model.width * 0.816,
y: this.model.width * 0.062,
width: this.model.width * 0.095,
height: this.model.width * 0.095 / 37 * 74
}
});
this.clockColon1 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: clockColon,
x: +this.model.width * 0.183,
y: -this.model.width * 0.017,
width: this.model.width * 0.34,
height: this.model.width / 1 * 0.34
}
});
this.clockColon2 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: clockColon,
x: +this.model.width * 0.48,
y: -this.model.width * 0.017,
width: this.model.width * 0.34,
height: this.model.width / 1 * 0.34
}
});
this.grouper.add(this.clockBg);
this.grouper.add(this.num1);
this.grouper.add(this.num2);
this.grouper.add(this.num3);
this.grouper.add(this.num4);
this.grouper.add(this.num5);
this.grouper.add(this.num6);
this.grouper.add(this.clockColon1);
this.grouper.add(this.clockColon2);
this.add(this.grouper);
}
getImagePic(context) {
let pic = clock0;
switch (context) {
case '0':
pic = clock0;
break;
case '1':
pic = clock1;
break;
case '2':
pic = clock2;
break;
case '3':
pic = clock3;
break;
case '4':
pic = clock4;
break;
case '5':
pic = clock5;
break;
case '6':
pic = clock6;
break;
case '7':
pic = clock7;
break;
case '8':
pic = clock8;
break;
case '9':
pic = clock9;
break;
}
return pic;
}
setClockStart(started) {
const _this = this;
if (started) {
this.timer && clearInterval(this.timer);
this.timer = setInterval(() => {
_this.handleClock(_this);
}, 1000);
} else {
this.timer && clearInterval(this.timer);
}
}
handleClock(_this) {
_this.initTime += 1;
let seconds = this.initTime % 60 + '';
let minutes = Math.floor(this.initTime / 60) % 60 + '';
let hours = Math.floor(this.initTime / 3600) + '';
if (seconds.length < 2) {
seconds = '0' + seconds;
}
if (minutes.length < 2) {
minutes = '0' + minutes;
}
if (hours.length < 2) {
hours = '0' + hours;
}
_this.setNumPic(6, seconds.charAt(1));
_this.setNumPic(5, seconds.charAt(0));
_this.setNumPic(4, minutes.charAt(1));
_this.setNumPic(3, minutes.charAt(0));
_this.setNumPic(2, hours.charAt(1));
_this.setNumPic(1, hours.charAt(0));
}
setNumPic(num, context) {
switch (num) {
case 1:
this.num1.setStyle('image', this.getImagePic(context));
break;
case 2:
this.num2.setStyle('image', this.getImagePic(context));
break;
case 3:
this.num3.setStyle('image', this.getImagePic(context));
break;
case 4:
this.num4.setStyle('image', this.getImagePic(context));
break;
case 5:
this.num5.setStyle('image', this.getImagePic(context));
break;
case 6:
this.num6.setStyle('image', this.getImagePic(context));
}
}
setClockTime(initTime) {
this.initTime = initTime;
let seconds = this.initTime % 60 + '';
let minutes = Math.floor(this.initTime / 60) % 60 + '';
let hours = Math.floor(this.initTime / 3600) + '';
if (seconds.length < 2) {
seconds = '0' + seconds;
}
if (minutes.length < 2) {
minutes = '0' + minutes;
}
if (hours.length < 2) {
hours = '0' + hours;
}
this.setNumPic(6, seconds.charAt(1));
this.setNumPic(5, seconds.charAt(0));
this.setNumPic(4, minutes.charAt(1));
this.setNumPic(3, minutes.charAt(0));
this.setNumPic(2, hours.charAt(1));
this.setNumPic(1, hours.charAt(0));
this.setClockStart(true);
}
setModel(dx, dy) {
this.model.point.x += dx;
this.model.point.y += dy;
}
constructor(device) {
super()
this._type = device.model._type
this._code = device.model.code
this.model = device.model
this.zlevel = device.model.zlevel
this.z = device.model.z
this.initTime = 0
this.create()
}
create() {
this.grouper = new Group({
id: this.model.code,
position: [this.model.point.x, this.model.point.y],
})
this.clockBg = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: clockBg,
x: 0,
y: 0,
width: this.model.width,
height: (this.model.width / 493) * 156,
},
})
this.num1 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: pics[0],
x: this.model.width * 0.098,
y: this.model.width * 0.062,
width: this.model.width * 0.095,
height: ((this.model.width * 0.095) / 37) * 74,
},
})
this.num2 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: pics[0],
x: this.model.width * 0.22,
y: this.model.width * 0.062,
width: this.model.width * 0.095,
height: ((this.model.width * 0.095) / 37) * 74,
},
})
this.num3 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: pics[0],
x: this.model.width * 0.395,
y: this.model.width * 0.062,
width: this.model.width * 0.095,
height: ((this.model.width * 0.095) / 37) * 74,
},
})
this.num4 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: pics[0],
x: this.model.width * 0.52,
y: this.model.width * 0.062,
width: this.model.width * 0.095,
height: ((this.model.width * 0.095) / 37) * 74,
},
})
this.num5 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: pics[0],
x: this.model.width * 0.69,
y: this.model.width * 0.062,
width: this.model.width * 0.095,
height: ((this.model.width * 0.095) / 37) * 74,
},
})
this.num6 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: pics[0],
x: this.model.width * 0.816,
y: this.model.width * 0.062,
width: this.model.width * 0.095,
height: ((this.model.width * 0.095) / 37) * 74,
},
})
this.clockColon1 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: clockColon,
x: +this.model.width * 0.183,
y: -this.model.width * 0.017,
width: this.model.width * 0.34,
height: (this.model.width / 1) * 0.34,
},
})
this.clockColon2 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: clockColon,
x: +this.model.width * 0.48,
y: -this.model.width * 0.017,
width: this.model.width * 0.34,
height: (this.model.width / 1) * 0.34,
},
})
this.grouper.add(this.clockBg)
this.grouper.add(this.num1)
this.grouper.add(this.num2)
this.grouper.add(this.num3)
this.grouper.add(this.num4)
this.grouper.add(this.num5)
this.grouper.add(this.num6)
this.grouper.add(this.clockColon1)
this.grouper.add(this.clockColon2)
this.add(this.grouper)
}
setNumPic(position, num) {
this[`num${position}`].setStyle(`image`, pics[num])
}
setClockTime(initTime) {
this.initTime = initTime
let timeStr = timestampFormat('HHmmss', this.initTime)
timeStr.split('').forEach((digit, index) => {
this.setNumPic(index + 1, Number(digit))
})
}
setModel(dx, dy) {
this.model.point.x += dx
this.model.point.y += dy
}
}

View File

@ -10,7 +10,7 @@
</div>
</template>
<script>
import { prefixIntrger } from '@/utils/date';
import { timestampFormat } from '@/utils/date';
import SystemTime from '@/views/components/systemTime/index';
import logo_ from '@/assets/logo_.png';
@ -126,8 +126,7 @@ export default {
},
watch: {
'$store.state.training.initTime': function (initTime) {
const date = new Date(initTime);
this.time = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}${prefixIntrger(date.getSeconds(), 2)}`;
this.time = timestampFormat('HH:mmss', initTime)
}
},
mounted() {

View File

@ -19,7 +19,7 @@
</div>
</template>
<script>
import { prefixIntrger } from '@/utils/date';
import { timestampFormat } from '@/utils/date';
import SystemTime from '@/views/components/systemTime/index';
import logo_ from '@/assets/logo_.png';
@ -135,8 +135,7 @@ export default {
},
watch: {
'$store.state.training.initTime': function (initTime) {
const date = new Date(initTime);
this.time = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}${prefixIntrger(date.getSeconds(), 2)}`;
this.time = timestampFormat('HH:mmss', initTime)
}
},
mounted() {

View File

@ -232,10 +232,10 @@ export default {
this.guideLockLeftFlag = false;
},
'$store.state.socket.simulationTimeSync': function (val) {
if (this.timeNode && val - this.timeNode >= 15) {
if (this.timeNode && val - this.timeNode >= 15000) {
this.clearOperate();
}
if (this.deviceTimeNode && val - this.deviceTimeNode >= 15) {
if (this.deviceTimeNode && val - this.deviceTimeNode >= 15000) {
if (this.deviceList && this.deviceList.length && this.deviceList[0]._type === 'SignalButton') {
this.$store.dispatch('training/updateMapState', [{code: this.deviceList[0].code, _type: 'SignalButton', hasSelected: 0}]);
} else if (this.deviceList && this.deviceList.length && this.deviceList[0]._type === 'Signal' && this.deviceList[0].type === 'SHUNTING') {

View File

@ -19,7 +19,7 @@
</div>
</template>
<script>
import { prefixIntrger } from '@/utils/date';
import { timestampFormat } from '@/utils/date';
import SystemTime from '@/views/components/systemTime/index';
import logo_ from '@/assets/logo_.png';
@ -135,8 +135,7 @@ export default {
},
watch: {
'$store.state.training.initTime': function (initTime) {
const date = new Date(initTime);
this.time = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}${prefixIntrger(date.getSeconds(), 2)}`;
this.time = timestampFormat('HH:mmss', initTime)
}
},
mounted() {

View File

@ -96,8 +96,7 @@ import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo'
import PassiveAlarm from './passiveDialog/alarm';
import PassiveContorl from '@/jmapNew/theme/components/menus/passiveDialog/control';
import PassiveTimeout from './passiveDialog/timeout';
import { timeFormat } from '@/utils/date';
import { prefixIntrger } from '@/utils/date';
import { timestampFormat } from '@/utils/date';
import BottomTable from './bottomTable';
import MenuPanel from './menuPanel';
import CtcBarIcon1 from '@/assets/ctc_icon/pic1.png';
@ -232,9 +231,8 @@ export default {
val && this.$store.dispatch('config/updateMenuBar');
},
'$store.state.socket.simulationTimeSync': function (time) { // 仿
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(time)}`));
const date = new Date(+new Date(`${new Date().toLocaleDateString()} ${timeFormat(time)}`));
this.initDate(date);
this.$store.dispatch('training/setInitTime', time);
this.initDate(time);
},
'$store.state.socket.railwaySimulationRunplanSendChange': function (val) {
if (this.isCtc) {
@ -427,14 +425,9 @@ export default {
}
},
initDate(date) {
this.time = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}:${prefixIntrger(date.getSeconds(), 2)}`;
const years = date.getFullYear() + '';
let months = date.getMonth() + 1 + '';
let dates = date.getDate() + '';
if (months.length < 2) { months = '0' + months; }
if (dates.length < 2) { dates = '0' + dates; }
this.dateString = years + months + dates;
this.dateString1 = years + '年' + months + '月' + dates + '日';
this.time = timestampFormat('HH:mm:ss', date)
this.dateString = timestampFormat('YYYYMMDD', date)
this.dateString1 = timestampFormat('YYYY年MM月DD日', date)
},
handleRunplan() {
this.$refs.runplanPane.doShow();

View File

@ -263,10 +263,10 @@ export default {
this.guideLockLeftFlag = false;
},
'$store.state.socket.simulationTimeSync': function (val) {
if (this.timeNode && val - this.timeNode >= 15) {
if (this.timeNode && val - this.timeNode >= 15000) {
this.clearOperate();
}
if (this.deviceTimeNode && val - this.deviceTimeNode >= 15) {
if (this.deviceTimeNode && val - this.deviceTimeNode >= 15000) {
if (this.deviceList && this.deviceList.length && this.deviceList[0]._type === 'SignalButton') {
this.$store.dispatch('training/updateMapState', [{code: this.deviceList[0].code, _type: 'SignalButton', hasSelected: 0}]);
} else if (this.deviceList && this.deviceList.length && this.deviceList[0]._type === 'Signal' && this.deviceList[0].type === 'SHUNTING') {

View File

@ -271,10 +271,10 @@ export default {
}
},
'$store.state.socket.simulationTimeSync': function (val) {
if (this.timeNode && val - this.timeNode >= 15) {
if (this.timeNode && val - this.timeNode >= 15000) {
this.clearOperate();
}
if (this.deviceTimeNode && val - this.deviceTimeNode >= 15) {
if (this.deviceTimeNode && val - this.deviceTimeNode >= 15000) {
if (this.deviceList && this.deviceList.length && this.deviceList[0]._type === 'SignalButton') {
this.$store.dispatch('training/updateMapState', [{code: this.deviceList[0].code, _type: 'SignalButton', hasSelected: 0}]);
} else if (this.deviceList && this.deviceList.length && this.deviceList[0]._type === 'Signal' && this.deviceList[0].type === 'SHUNTING') {

View File

@ -19,7 +19,7 @@
</div>
</template>
<script>
import { prefixIntrger } from '@/utils/date';
import { timestampFormat } from '@/utils/date';
import SystemTime from '@/views/components/systemTime/index';
import logo_ from '@/assets/logo_.png';
@ -135,8 +135,7 @@ export default {
},
watch: {
'$store.state.training.initTime': function (initTime) {
const date = new Date(initTime);
this.time = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}${prefixIntrger(date.getSeconds(), 2)}`;
this.time = timestampFormat('HH:mmss', initTime)
}
},
mounted() {

View File

@ -581,8 +581,7 @@ import Rpb from '@/assets/ctc_icon/rpb.png';
import Rpwp from '@/assets/ctc_icon/rpwp.png';
import Rph from '@/assets/ctc_icon/rph.png';
import RpAdd from '@/assets/ctc_icon/rpadd.png';
import { timeFormat } from '@/utils/date';
import { prefixIntrger } from '@/utils/date';
import { timestampFormat } from '@/utils/date';
import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo';
import SendRunplan from './dialog/sendRunplan';
import StageRunplan from './dialog/stageRunplan';
@ -664,9 +663,8 @@ export default {
},
watch:{
'$store.state.socket.simulationTimeSync': function (time) { // 仿
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(time)}`));
const date = new Date(+new Date(`${new Date().toLocaleDateString()} ${timeFormat(time)}`));
this.initDate(date);
this.$store.dispatch('training/setInitTime', time);
this.initDate(time);
},
'$store.state.training.roleDeviceCode':function(newVal, oldVal) {
if (oldVal) {
@ -706,14 +704,9 @@ export default {
}
},
initDate(date) {
this.time = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}:${prefixIntrger(date.getSeconds(), 2)}`;
const years = date.getFullYear() + '';
let months = date.getMonth() + 1 + '';
let dates = date.getDate() + '';
if (months.length < 2) { months = '0' + months; }
if (dates.length < 2) { dates = '0' + dates; }
this.dateString = years + months + dates;
this.dateString1 = years + '年' + months + '月' + dates + '日';
this.time = timestampFormat('HH:mm:ss', date)
this.dateString = timestampFormat('YYYYMMDD', date)
this.dateString1 = timestampFormat('YYYY年MM月DD日', date)
},
judgeColor({row, rowIndex}) {
if (row.effect) {

View File

@ -80,8 +80,7 @@ import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo'
import PassiveAlarm from './passiveDialog/alarm';
import PassiveContorl from '@/jmapNew/theme/components/menus/passiveDialog/control';
import PassiveTimeout from './passiveDialog/timeout';
import { timeFormat } from '@/utils/date';
import { prefixIntrger } from '@/utils/date';
import { timestampFormat } from '@/utils/date';
import BottomTable from './bottomTable';
import MenuPanel from './menuPanel';
import CtcBarIcon1 from '@/assets/ctc_icon/pic1.png';
@ -210,9 +209,8 @@ export default {
val && this.$store.dispatch('config/updateMenuBar');
},
'$store.state.socket.simulationTimeSync': function (time) { // 仿
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(time)}`));
const date = new Date(+new Date(`${new Date().toLocaleDateString()} ${timeFormat(time)}`));
this.initDate(date);
this.$store.dispatch('training/setInitTime', time);
this.initDate(time);
},
'$store.state.socket.railwaySimulationRunplanSendChange': function (val) {
if (this.isCtc) {
@ -273,14 +271,9 @@ export default {
}
},
initDate(date) {
this.time = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}:${prefixIntrger(date.getSeconds(), 2)}`;
const years = date.getFullYear() + '';
let months = date.getMonth() + 1 + '';
let dates = date.getDate() + '';
if (months.length < 2) { months = '0' + months; }
if (dates.length < 2) { dates = '0' + dates; }
this.dateString = years + months + dates;
this.dateString1 = years + '年' + months + '月' + dates + '日';
this.time = timestampFormat('HH:mm:ss', date)
this.dateString = timestampFormat('YYYYMMDD', date)
this.dateString1 = timestampFormat('YYYY年MM月DD日', date)
},
handleRunplan() {
this.$refs.runplanPane.doShow();

View File

@ -349,10 +349,10 @@ export default {
this.guideLockLeftFlag = false
},
'$store.state.socket.simulationTimeSync': function(val) {
if (this.timeNode && val - this.timeNode >= 15) {
if (this.timeNode && val - this.timeNode >= 15000) {
this.clearOperate()
}
if (this.deviceTimeNode && val - this.deviceTimeNode >= 15) {
if (this.deviceTimeNode && val - this.deviceTimeNode >= 15000) {
if (this.deviceList && this.deviceList.length && this.deviceList[0]._type === 'SignalButton') {
this.$store.dispatch('training/updateMapState', [{ code: this.deviceList[0].code, _type: 'SignalButton', hasSelected: 0 }])
} else if (

View File

@ -269,10 +269,10 @@ export default {
}
},
'$store.state.socket.simulationTimeSync': function (val) {
if (this.timeNode && val - this.timeNode >= 15) {
if (this.timeNode && val - this.timeNode >= 15000) {
this.clearOperate();
}
if (this.deviceTimeNode && val - this.deviceTimeNode >= 15) {
if (this.deviceTimeNode && val - this.deviceTimeNode >= 15000) {
if (this.deviceList && this.deviceList.length && this.deviceList[0]._type === 'SignalButton') {
this.$store.dispatch('training/updateMapState', [{code: this.deviceList[0].code, _type: 'SignalButton', hasSelected: 0}]);
} else if (this.deviceList && this.deviceList.length && this.deviceList[0]._type === 'Signal' && this.deviceList[0].type === 'SHUNTING') {

View File

@ -19,7 +19,7 @@
</div>
</template>
<script>
import { prefixIntrger } from '@/utils/date';
import { timestampFormat } from '@/utils/date';
import SystemTime from '@/views/components/systemTime/index';
import logo_ from '@/assets/logo_.png';
@ -135,8 +135,7 @@ export default {
},
watch: {
'$store.state.training.initTime': function (initTime) {
const date = new Date(initTime);
this.time = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}${prefixIntrger(date.getSeconds(), 2)}`;
this.time = timestampFormat('HH:mmss', initTime)
}
},
mounted() {

View File

@ -80,8 +80,7 @@ import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo'
import PassiveAlarm from './passiveDialog/alarm';
import PassiveContorl from '@/jmapNew/theme/components/menus/passiveDialog/control';
import PassiveTimeout from './passiveDialog/timeout';
import { timeFormat } from '@/utils/date';
import { prefixIntrger } from '@/utils/date';
import { timestampFormat } from '@/utils/date';
import BottomTable from './bottomTable';
import MenuPanel from './menuPanel';
import CtcBarIcon1 from '@/assets/ctc_icon/pic1.png';
@ -210,9 +209,8 @@ export default {
val && this.$store.dispatch('config/updateMenuBar');
},
'$store.state.socket.simulationTimeSync': function (time) { // 仿
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(time)}`));
const date = new Date(+new Date(`${new Date().toLocaleDateString()} ${timeFormat(time)}`));
this.initDate(date);
this.$store.dispatch('training/setInitTime', time);
this.initDate(time);
},
'$store.state.socket.railwaySimulationRunplanSendChange': function (val) {
if (this.isCtc) {
@ -273,14 +271,9 @@ export default {
}
},
initDate(date) {
this.time = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}:${prefixIntrger(date.getSeconds(), 2)}`;
const years = date.getFullYear() + '';
let months = date.getMonth() + 1 + '';
let dates = date.getDate() + '';
if (months.length < 2) { months = '0' + months; }
if (dates.length < 2) { dates = '0' + dates; }
this.dateString = years + months + dates;
this.dateString1 = years + '年' + months + '月' + dates + '日';
this.time = timestampFormat('HH:mm:ss', date)
this.dateString = timestampFormat('YYYYMMDD', date)
this.dateString1 = timestampFormat('YYYY年MM月DD日', date)
},
handleRunplan() {
this.$refs.runplanPane.doShow();

View File

@ -273,7 +273,7 @@ export default {
this.clearOperate();
},
'$store.state.socket.simulationTimeSync': function(val) {
if (this.timeNode && val - this.timeNode >= 15) {
if (this.timeNode && val - this.timeNode >= 15000) {
this.clearOperate();
}
const routeDeviceList = [];
@ -289,7 +289,7 @@ export default {
routeDeviceList.forEach(item => {
updateList.push({ code: item.code, _type: item._type, toSelected: 0 });
});
if (this.deviceTimeNode && val - this.deviceTimeNode >= 15) {
if (this.deviceTimeNode && val - this.deviceTimeNode >= 15000) {
if (this.deviceList && this.deviceList.length && this.deviceList[0]._type === 'SignalButton') {
this.$store.dispatch('training/updateMapState', updateList);
} else if (this.deviceList && this.deviceList.length && this.deviceList[0]._type === 'Signal' && this.deviceList[0].type === 'SHUNTING') {

View File

@ -269,10 +269,10 @@ export default {
}
},
'$store.state.socket.simulationTimeSync': function (val) {
if (this.timeNode && val - this.timeNode >= 15) {
if (this.timeNode && val - this.timeNode >= 15000) {
this.clearOperate();
}
if (this.deviceTimeNode && val - this.deviceTimeNode >= 15) {
if (this.deviceTimeNode && val - this.deviceTimeNode >= 15000) {
if (this.deviceList && this.deviceList.length && this.deviceList[0]._type === 'SignalButton') {
this.$store.dispatch('training/updateMapState', [{code: this.deviceList[0].code, _type: 'SignalButton', hasSelected: 0}]);
} else if (this.deviceList && this.deviceList.length && this.deviceList[0]._type === 'Signal' && this.deviceList[0].type === 'SHUNTING') {

View File

@ -19,7 +19,7 @@
</div>
</template>
<script>
import { prefixIntrger } from '@/utils/date';
import { timestampFormat } from '@/utils/date';
import SystemTime from '@/views/components/systemTime/index';
import logo_ from '@/assets/logo_.png';
@ -135,8 +135,7 @@ export default {
},
watch: {
'$store.state.training.initTime': function (initTime) {
const date = new Date(initTime);
this.time = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}${prefixIntrger(date.getSeconds(), 2)}`;
this.time = timestampFormat('HH:mmss', initTime)
}
},
mounted() {

View File

@ -10,7 +10,7 @@
</div>
</template>
<script>
import { prefixIntrger } from '@/utils/date';
import { timestampFormat } from '@/utils/date';
import SystemTime from '@/views/components/systemTime/index';
import logo_ from '@/assets/logo_.png';
@ -126,8 +126,7 @@ export default {
},
watch: {
'$store.state.training.initTime': function (initTime) {
const date = new Date(initTime);
this.time = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}${prefixIntrger(date.getSeconds(), 2)}`;
this.time = timestampFormat('HH:mmss', initTime)
}
},
mounted() {

View File

@ -1,96 +1,98 @@
import dayjs from 'dayjs'
// import utc from 'dayjs/plugin/utc'
import 'dayjs/locale/zh-cn'
import duration from 'dayjs/plugin/duration'
import localizedFormat from 'dayjs/plugin/localizedFormat'
dayjs.locale('zh-cn')
dayjs
// .extend(utc)
.extend(localizedFormat)
.extend(duration)
/**
* @returns 当前时间, 格式: 'YYYY-MM-DD HH:mm:ss'
*/
export function now() {
var d = new Date();
var year = d.getFullYear();
var month = change(d.getMonth() + 1);
var day = change(d.getDate());
var hour = change(d.getHours());
var minute = change(d.getMinutes());
var second = change(d.getSeconds());
function change(t) {
if (t < 10) {
return '0' + t;
} else {
return t;
}
var d = new Date()
var year = d.getFullYear()
var month = change(d.getMonth() + 1)
var day = change(d.getDate())
var hour = change(d.getHours())
var minute = change(d.getMinutes())
var second = change(d.getSeconds())
function change(t) {
if (t < 10) {
return '0' + t
} else {
return t
}
return year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
}
return year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second
}
/**
* @param {Number} usedTime 秒数
* @returns `HH:mm:ss`
*/
export function timeFormat(usedTime = 0) {
let hour = 0; let minute = 0; let second = 0; let sumTime = usedTime;
if (sumTime) {
if (sumTime >= 3600) {
hour = Math.floor(sumTime / 3600) % 24;
sumTime = (sumTime % 3600);
}
if (sumTime >= 60) {
minute = Math.floor(sumTime / 60);
sumTime = sumTime % 60;
}
second = Math.floor(sumTime);
let hour = 0
let minute = 0
let second = 0
let sumTime = usedTime
if (sumTime) {
if (sumTime >= 3600) {
hour = Math.floor(sumTime / 3600) % 24
sumTime = sumTime % 3600
}
function getTimeStr(val) {
return val < 10 ? '0' + val : val;
if (sumTime >= 60) {
minute = Math.floor(sumTime / 60)
sumTime = sumTime % 60
}
return getTimeStr(hour) + ':' + getTimeStr(minute) + ':' + getTimeStr(second);
second = Math.floor(sumTime)
}
function getTimeStr(val) {
return val < 10 ? '0' + val : val
}
return getTimeStr(hour) + ':' + getTimeStr(minute) + ':' + getTimeStr(second)
}
// 时分秒转为时间戳
/**
* 时分秒转为时间戳
* @param {String} time 'HH:mm:ss'
* @returns 秒数
*/
export function toTimeStamp(time = '') {
let s = 0;
const hour = time.split(':')[0];
const min = time.split(':')[1];
const sec = time.split(':')[2];
s = Number(hour * 3600) + Number(min * 60) + Number(sec);
return s;
let s = 0
const hour = time.split(':')[0]
const min = time.split(':')[1]
const sec = time.split(':')[2]
s = Number(hour * 3600) + Number(min * 60) + Number(sec)
return s
}
// 时间戳的只转为时分秒
/**
* 时间戳的转换为时分秒
* @param {Number} mss Unix时间戳
* @returns 'HH:mm:ss'
*/
export function formatDuring(mss) {
const now = new Date(mss);
const hour = now.getHours(); // 返回日期中的小时数0到23
const minute = now.getMinutes(); // 返回日期中的分钟数0到59
const second = now.getSeconds(); // 返回日期中的秒数0到59
return hour + ':' + minute + ':' + second;
}
export function prefixIntrger(num, length) {
return (Array(length).join('0') + num).slice(-length);
}
/** 根据秒计算时间hh:mm:ss */
export function computationTime(time) {
let hours = Math.floor(time / 3600);
const newTime = time % 3600;
let minutes = Math.floor(newTime / 60) + '';
let seconds = newTime % 60;
if (hours < 0) {
hours = '00';
} else if (hours < 10) {
hours = '0' + hours;
}
if (minutes < 0) {
minutes = '00';
} else if (minutes < 10) {
minutes = '0' + minutes;
}
if (seconds < 0) {
seconds = '00';
} else if (seconds < 10) {
seconds = '0' + seconds;
}
return hours + ':' + minutes + ':' + seconds;
const now = new Date(mss)
const hour = now.getHours() // 返回日期中的小时数0到23
const minute = now.getMinutes() // 返回日期中的分钟数0到59
const second = now.getSeconds() // 返回日期中的秒数0到59
return hour + ':' + minute + ':' + second
}
export function computationSeconds(seconds, hourUnit, minuteUnit, secondUnit) {
if (seconds) {
const h = parseInt(seconds / 3600);
const m = parseInt((seconds - h * 3600) / 60);
const s = (seconds - h * 3600) % 60;
return h ? `${h} ${hourUnit} ${m} ${minuteUnit} ${s} ${secondUnit}`
: m ? `${m} ${minuteUnit} ${s} ${secondUnit}`
: `${s} ${secondUnit}`;
}
return null;
if (seconds) {
const h = parseInt(seconds / 3600)
const m = parseInt((seconds - h * 3600) / 60)
const s = (seconds - h * 3600) % 60
return h ? `${h} ${hourUnit} ${m} ${minuteUnit} ${s} ${secondUnit}` : m ? `${m} ${minuteUnit} ${s} ${secondUnit}` : `${s} ${secondUnit}`
}
return null
}
export function timestampFormat(format, ms = new Date()) {
return dayjs/* .utc */(ms).format(format)
}

View File

@ -19,7 +19,7 @@ import Digit from './digit';
import Separator from './separator';
export default {
name: 'SystenTime',
name: 'SystemTime',
components: {
Digit,
Separator

View File

@ -23,7 +23,6 @@ import { creatSubscribe, clearSubscribe, displayTopic} from '@/utils/stomp';
import MenuSystemTime from '@/views/newMap/displayNew/menuSystemTime';
import { getToken } from '@/utils/auth';
import { mapGetters } from 'vuex';
import { timeFormat } from '@/utils/date';
export default {
name:'TestRunplan',
components: {
@ -142,8 +141,7 @@ export default {
if (resp && resp.code == 200 && resp.data) {
if (!resp.data.dataError) {
this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause); //
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`));
// this.$store.dispatch('training/countTime');
this.$store.dispatch('training/setInitTime', resp.data.systemTime);
this.planRunning = resp.data.planRunning;
if (resp.data.planRunning) {
this.$store.commit('training/start');
@ -159,7 +157,7 @@ export default {
time: model.initTime
};
ranAsPlan(data, this.group).then(res => {
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`));
this.$store.dispatch('training/setInitTime', model.initTime);
}).catch(error => {
if (error.code == '5001') {
this.$messageBox(this.$t('error.mapDataError') + ',' + this.$t('error.startSimulationFailed'));

View File

@ -91,9 +91,7 @@
<script>
import axios from 'axios';
import { prefixIntrger } from '@/utils/date';
import { timestampFormat } from '@/utils/date';
import { mmirender } from '@/views/jlmap3d/drive/sceneview/mmi';
@ -173,8 +171,7 @@ export default {
},
watch: {
'$store.state.training.initTime': function (initTime) {
let date = new Date(initTime);
this.timer = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}:${prefixIntrger(date.getSeconds(), 2)}`;
this.timer = timestampFormat('HH:mm:ss', initTime)
document.getElementById("timeupdate").innerHTML = this.timer;
}
},

View File

@ -5,7 +5,7 @@
运行
</div>
<div :id="topmsg.id" class="tmstopdivchild" v-for="(topmsg,index) in trainData" :style="{left:topmsg.left+'px',width:topmsg.width+'px'}">
<div :id="topmsg.id" class="tmstopdivchild" v-for="(topmsg,index) in trainData" :key="index" :style="{left:topmsg.left+'px',width:topmsg.width+'px'}">
<div class="tmstopmsg" style="top:0" :style="{width:topmsg.width+'px'}">
{{topmsg.name}}
</div>
@ -47,6 +47,7 @@
<div class="tmsdowndivmsg" style="top:0;">
<div class="tmsdownbutton"
v-for="(button1,indexbt1) in buttonList1"
:key="indexbt1"
:style="{left:button1.left+'px',backgroundColor:button1.bgcolor}">
{{button1.name}}
</div>
@ -55,6 +56,7 @@
<div class="tmsdowndivmsg" style="bottom:0;border:solid 0.5px #fff">
<div class="tmsdownbutton"
v-for="(button2,indexbt2) in buttonList2"
:key="indexbt2"
:style="{left:button2.left+'px',backgroundColor:button2.bgcolor}">
{{button2.name}}
</div>
@ -67,9 +69,8 @@
<script>
import axios from 'axios';
import { timestampFormat } from '@/utils/date';
import { prefixIntrger } from '@/utils/date';
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
import TmsFault from '@/views/jlmap3d/drive/sceneview/tmscomponent/tmsfault';
@ -231,8 +232,7 @@ export default {
},
watch: {
'$store.state.training.initTime': function (initTime) {
let date = new Date(initTime);
this.timer = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}:${prefixIntrger(date.getSeconds(), 2)}`;
this.timer = timestampFormat('HH:mm:ss', initTime)
document.getElementById("tmstimeupdate").innerHTML = this.timer;
}
},

View File

@ -91,10 +91,6 @@
<script>
import axios from 'axios';
import { prefixIntrger } from '@/utils/date';
import { mmirender } from '@/views/jlmap3d/railwaydrive/sceneview/mmi';
import { mmiimage } from '@/views/jlmap3d/railwaydrive/sceneview/mmiimage';
@ -160,17 +156,7 @@ export default {
window.updateSpeedView = this.updateSpeedView
this.init();
},
beforeDestroy() {
},
// watch: {
// '$store.state.training.initTime': function (initTime) {
// let date = new Date(initTime);
// this.timer = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}:${prefixIntrger(date.getSeconds(), 2)}`;
// document.getElementById("timeupdate").innerHTML = this.timer;
// }
// },
beforeDestroy() { },
methods: {
init(){
this.time();

View File

@ -32,9 +32,7 @@
</div>
</template>
<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:{

View File

@ -123,11 +123,10 @@
<script>
import { mapGetters } from 'vuex';
import { timeFormat } from '@/utils/date';
import BuzzerAudio from '@/assets/buzzer.mp3';
import AlarmTableHmi from '@/jmapNew/theme/nanjing_02/menus/menuDialog/alarmTableHmi';
import LogDetail from '@/jmapNew/theme/nanjing_02/menus/menuDialog/logDetail';
import { prefixIntrger } from '@/utils/date';
import { timestampFormat } from '@/utils/date';
export default {
name: 'BaSiDi',
components: {
@ -135,7 +134,6 @@ export default {
LogDetail
},
props: {
dataError: {
type: Boolean,
required: true
@ -197,11 +195,11 @@ export default {
},
watch: {
'$store.state.training.initTime': function (initTime) {
const date = new Date(initTime);
this.initDate(date);
// const date = new Date(initTime);
this.initDate(initTime);
},
'$store.state.socket.simulationTimeSync': function (time) { // 仿
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(time)}`));
this.$store.dispatch('training/setInitTime', time);
},
'$store.state.socket.simulationAlarmInfo': function(val) {
(val || []).forEach(item => {
@ -291,14 +289,9 @@ export default {
this.$emit('back');
},
initDate(date) {
this.time = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}:${prefixIntrger(date.getSeconds(), 2)}`;
const years = date.getFullYear() + '';
let months = date.getMonth() + 1 + '';
let dates = date.getDate() + '';
if (months.length < 2) { months = '0' + months; }
if (dates.length < 2) { dates = '0' + dates; }
this.dateString = dates + '.' + months + '.' + years;
}
this.time = timestampFormat('HH:mm:ss', date)
this.dateString = timestampFormat('YYYY.MM.DD', date)
},
}
};
</script>

View File

@ -106,11 +106,10 @@
<script>
import { mapGetters } from 'vuex';
import { timeFormat } from '@/utils/date';
import BuzzerAudio from '@/assets/buzzer.mp3';
import AlarmTableHmi from '@/jmapNew/theme/nanjing_02/menus/menuDialog/alarmTableHmi';
import LogDetail from '@/jmapNew/theme/nanjing_02/menus/menuDialog/logDetail';
import { prefixIntrger } from '@/utils/date';
import { timestampFormat } from '@/utils/date';
export default {
name: 'BaSiDi',
components: {
@ -169,11 +168,10 @@ export default {
},
watch: {
'$store.state.training.initTime': function (initTime) {
const date = new Date(initTime);
this.initDate(date);
this.initDate(initTime);
},
'$store.state.socket.simulationTimeSync': function (time) { // 仿
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(time)}`));
this.$store.dispatch('training/setInitTime', time);
},
'$store.state.socket.simulationAlarmInfo': function(val) {
(val || []).forEach(item => {
@ -263,14 +261,9 @@ export default {
this.$emit('back');
},
initDate(date) {
this.time = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}:${prefixIntrger(date.getSeconds(), 2)}`;
const years = date.getFullYear() + '';
let months = date.getMonth() + 1 + '';
let dates = date.getDate() + '';
if (months.length < 2) { months = '0' + months; }
if (dates.length < 2) { dates = '0' + dates; }
this.dateString = dates + '.' + months + '.' + years;
}
this.time = timestampFormat('HH:mm:ss', date)
this.dateString = timestampFormat('YYYY.MM.DD', date)
},
}
};
</script>

View File

@ -26,7 +26,6 @@
import { getSessionStorage } from '@/utils/auth';
import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic';
import { timeFormat } from '@/utils/date';
import { getToken } from '@/utils/auth';
import { creatSubscribe, clearSubscribe, displayTopic, getTopic } from '@/utils/stomp';
import SetTime from '@/views/newMap/displayNew/demon/setTime';
@ -309,7 +308,7 @@ export default {
if (resp && resp.code == 200 && resp.data) {
if (!resp.data.dataError) {
this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause); //
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`));
this.$store.dispatch('training/setInitTime', resp.data.systemTime);
this.$store.dispatch('training/countTime');
this.$store.dispatch('runPlan/setRunPlanInfo', resp.data.runPlan);
this.planRunning = resp.data.planRunning;
@ -342,7 +341,7 @@ export default {
data.loadNumber = model.loadNum;
}
ranAsPlan(data, this.group).then(res => {
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`));
this.$store.dispatch('training/setInitTime', model.initTime);
}).catch(error => {
let message = '';
switch (error.code) {

View File

@ -22,7 +22,7 @@
</template>
<script>
import { prefixIntrger } from '@/utils/date';
import { timestampFormat } from '@/utils/date';
import { getLoadTrainNumber } from '@/api/simulation';
//
@ -85,23 +85,17 @@ export default {
handleChange(initTime) {
this.formModel.loadNum = 0;
if (this.hasNumber) {
getLoadTrainNumber({ time: this.formatTime(initTime) }, this.group).then(resp => {
getLoadTrainNumber({ time: timestampFormat('HH:mm:ss', initTime) }, this.group).then(resp => {
this.maxNumber = parseInt(resp.data);
});
}
},
formatTime(initTime) {
const hh = prefixIntrger(initTime.getHours(), 2);
const mm = prefixIntrger(initTime.getMinutes(), 2);
const ss = prefixIntrger(initTime.getSeconds(), 2);
return `${hh}:${mm}:${ss}`;
},
handleSure() {
this.$refs.form.validate((valid) => {
if (valid) {
this.status = true;
const model = {
initTime: this.formatTime(this.formModel.initTime)
initTime: timestampFormat('HH:mm:ss', this.formModel.initTime),
};
if (this.hasNumber) {

View File

@ -19,7 +19,6 @@
import { getSessionStorage } from '@/utils/auth';
import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic';
import { timeFormat } from '@/utils/date';
import MapSystemDraft from '@/views/newMap/mapsystemNew/index';
import MenuDemon from './menuDemon';
import MenuSystemTime from '@/views/newMap/displayCity/menuSystemTime';
@ -246,7 +245,7 @@ export default {
data.loadNumber = model.loadNum;
}
ranAsPlan(data, this.group).then(res => {
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`));
this.$store.dispatch('training/setInitTime', model.initTime);
}).catch(error => {
let message = '';
switch (error.code) {

View File

@ -16,9 +16,8 @@
</div>
</template>
<script>
import { prefixIntrger } from '@/utils/date';
import SystemTime from '@/views/components/systemTime/index';
import { timeFormat } from '@/utils/date';
import { timestampFormat } from '@/utils/date';
//
export default {
@ -65,55 +64,24 @@ export default {
}
},
watch: {
'$store.state.training.initTime': function (initTime) {
const date = new Date(initTime);
this.initDate(date);
'$store.state.training.initTime': function (timestamp) {
this.initDate(timestamp);
},
'$store.state.socket.simulationTimeSync': function (time) { // 仿
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(time)}`));
const date = new Date(+new Date(`${new Date().toLocaleDateString()} ${timeFormat(time)}`));
this.initDate(date);
'$store.state.socket.simulationTimeSync': function (timestamp) { // 仿
this.$store.dispatch('training/setInitTime', timestamp);
}
},
mounted() {
const initTime = this.$store.state.training.initTime;
if (initTime > 0) {
const date = new Date(initTime);
this.initDate(date);
this.initDate(initTime);
}
},
methods: {
initDate(date) {
this.time = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}${prefixIntrger(date.getSeconds(), 2)}`;
const years = date.getFullYear() + '';
let months = date.getMonth() + 1 + '';
let dates = date.getDate() + '';
if (months.length < 2) { months = '0' + months; }
if (dates.length < 2) { dates = '0' + dates; }
this.dateString = dates + '/' + months + '/' + years.slice(2);
const day = date.getDay();
switch (day) {
case 0:
this.dayString = '星 期 日';
break;
case 1:
this.dayString = '星 期 一';
break;
case 2:
this.dayString = '星 期 二';
break;
case 3:
this.dayString = '星 期 三';
break;
case 4:
this.dayString = '星 期 四';
break;
case 5:
this.dayString = '星 期 五';
break;
case 6:
this.dayString = '星 期 六';
}
initDate(timestamp) {
this.time = timestampFormat('HH:mmss', timestamp)
this.dateString = timestampFormat('YYYY/MM/DD', timestamp)
this.dayString = timestampFormat('dddd', timestamp).split('').join(' ')
}
}
};

View File

@ -18,7 +18,7 @@
<script>
import { modifySystemTime } from '@/api/simulation';
import { prefixIntrger } from '@/utils/date';
import { timestampFormat } from '@/utils/date';
//
export default {
@ -57,18 +57,12 @@ export default {
this.status = false;
this.show = false;
},
formatTime(time) {
const hh = prefixIntrger(time.getHours(), 2);
const mm = prefixIntrger(time.getMinutes(), 2);
const ss = prefixIntrger(time.getSeconds(), 2);
return `${hh}:${mm}:${ss}`;
},
handleSure() {
this.$refs.form.validate((valid) => {
if (valid) {
this.status = true;
const model = {
time: this.formatTime(this.formModel.time)
time: timestampFormat('HH:mm:ss', this.formModel.time)
};
modifySystemTime(model, this.group).then(resp => {
this.status = false;

View File

@ -22,7 +22,7 @@
</template>
<script>
import { prefixIntrger } from '@/utils/date';
import { timestampFormat } from '@/utils/date';
import { getLoadTrainNumber } from '@/api/simulation';
//
@ -85,23 +85,17 @@ export default {
handleChange(initTime) {
this.formModel.loadNum = 0;
if (this.hasNumber) {
getLoadTrainNumber({ time: this.formatTime(initTime) }, this.group).then(resp => {
getLoadTrainNumber({ time: timestampFormat('HH:mm:ss', initTime) }, this.group).then(resp => {
this.maxNumber = parseInt(resp.data);
});
}
},
formatTime(initTime) {
const hh = prefixIntrger(initTime.getHours(), 2);
const mm = prefixIntrger(initTime.getMinutes(), 2);
const ss = prefixIntrger(initTime.getSeconds(), 2);
return `${hh}:${mm}:${ss}`;
},
handleSure() {
this.$refs.form.validate((valid) => {
if (valid) {
this.status = true;
const model = {
initTime: this.formatTime(this.formModel.initTime)
initTime: timestampFormat('HH:mm:ss', this.formModel.initTime),
};
if (this.hasNumber) {

View File

@ -86,14 +86,10 @@ import MenuSchema from '@/views/newMap/displayNew/menuSchema';
import TheoryExamSelect from './theoryExamSelect';
import TheoryExam from './theoryExam';
import PayPage from '@/views/newMap/displayNew/demon/payPage';
// import { getGoodsTryUse } from '@/api/management/goods';
import {clearSimulation, getSimulationInfoNew } from '@/api/simulation';
// import { PermissionType } from '@/scripts/ConstDic';
// import { getCountTime } from '@/utils/index';
import { prefixIntrger } from '@/utils/date';
import { timestampFormat } from '@/utils/date';
import { ScriptMode, TrainingMode } from '@/scripts/ConstDic';
import SelectRole from '@/views/newMap/displayNew/scriptDisplay/component/selectRole';
// import { setGoodsTryUse } from '@/api/management/goods';
import {competitionPracticalSceneStart, competitionPracticalSceneExit, competitionPracticalSceneFinish, getEmptyOperationalStatistics} from '@/api/competition';
import { EventBus } from '@/scripts/event-bus';
@ -142,11 +138,6 @@ export default {
data() {
return {
userRole: 'AUDIENCE',
// training: {
// id: '',
// name: '',
// remarks: ''
// },
isScriptLoad: false,
isScriptRun: false,
scriptMode: ScriptMode.TEACH,
@ -214,7 +205,7 @@ export default {
'$store.state.map.mapViewLoadedCount': function (val) { //
if (this.$route.query.noFirst) {
const initTime = new Date(this.$store.state.training.initTime || null);
const model = {initTime:this.formatTime(initTime)};
const model = {initTime: timestampFormat('HH:mm:ss', initTime)};
this.start(model);
}
},
@ -251,12 +242,6 @@ export default {
});
},
methods: {
formatTime(initTime) {
const hh = prefixIntrger(initTime.getHours(), 2);
const mm = prefixIntrger(initTime.getMinutes(), 2);
const ss = prefixIntrger(initTime.getSeconds(), 2);
return `${hh}:${mm}:${ss}`;
},
selectBeginTime() {
this.$refs.setTime.doShow();
},

View File

@ -225,7 +225,7 @@ export default {
if (resp && resp.code == 200 && resp.data) {
if (!resp.data.dataError) {
this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause); //
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`));
this.$store.dispatch('training/setInitTime', resp.data.systemTime);
// this.$store.dispatch('training/countTime');
if (resp.data.prodType === '03') {
this.$store.dispatch('training/setPrdType', this.$route.query.prdType);
@ -287,7 +287,7 @@ export default {
data.loadNumber = model.loadNum;
}
ranAsPlan(data, this.group).then(res => {
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`));
this.$store.dispatch('training/setInitTime', model.initTime);
}).catch(error => {
let message = '';
switch (error.code) {

View File

@ -16,9 +16,8 @@
</div>
</template>
<script>
import { prefixIntrger } from '@/utils/date';
import SystemTime from '@/views/components/systemTime/index';
import { timeFormat } from '@/utils/date';
import { timestampFormat } from '@/utils/date';
//
export default {
@ -69,55 +68,24 @@ export default {
}
},
watch: {
'$store.state.training.initTime': function (initTime) {
const date = new Date(initTime);
this.initDate(date);
'$store.state.training.initTime': function (timestamp) {
this.initDate(timestamp);
},
'$store.state.socket.simulationTimeSync': function (time) { // 仿
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(time)}`));
const date = new Date(+new Date(`${new Date().toLocaleDateString()} ${timeFormat(time)}`));
this.initDate(date);
'$store.state.socket.simulationTimeSync': function (timestamp) { // 仿
this.initDate(timestamp)
}
},
mounted() {
const initTime = this.$store.state.training.initTime;
if (initTime > 0) {
const date = new Date(initTime);
this.initDate(date);
this.initDate(initTime);
}
},
methods: {
initDate(date) {
this.time = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}${prefixIntrger(date.getSeconds(), 2)}`;
const years = date.getFullYear() + '';
let months = date.getMonth() + 1 + '';
let dates = date.getDate() + '';
if (months.length < 2) { months = '0' + months; }
if (dates.length < 2) { dates = '0' + dates; }
this.dateString = dates + '/' + months + '/' + years.slice(2);
const day = date.getDay();
switch (day) {
case 0:
this.dayString = '星 期 日';
break;
case 1:
this.dayString = '星 期 一';
break;
case 2:
this.dayString = '星 期 二';
break;
case 3:
this.dayString = '星 期 三';
break;
case 4:
this.dayString = '星 期 四';
break;
case 5:
this.dayString = '星 期 五';
break;
case 6:
this.dayString = '星 期 六';
}
initDate(timestamp) {
this.time = timestampFormat('HH:mmss', timestamp)
this.dateString = timestampFormat('YYYY/MM/DD', timestamp)
this.dayString = timestampFormat('dddd', timestamp).split('').join(' ')
}
}
};

View File

@ -104,7 +104,6 @@ import { creatSubscribe, clearSubscribe, displayTopic, LPFTopic} from '@/utils/s
import MenuSystemTime from '@/views/newMap/displayNew/menuSystemTime';
import { getToken } from '@/utils/auth';
import { mapGetters } from 'vuex';
import { timeFormat } from '@/utils/date';
import { getPostByProjectCode } from '@/api/learn';
import { ProjectCode } from '@/scripts/ProjectConfig';
export default {
@ -288,7 +287,7 @@ export default {
if (resp && resp.code == 200 && resp.data) {
if (!resp.data.dataError) {
this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause); //
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`));
this.$store.dispatch('training/setInitTime', resp.data.systemTime);
// this.$store.dispatch('training/countTime');
this.$store.dispatch('runPlan/setRunPlanInfo', resp.data.runPlan);
this.planRunning = resp.data.planRunning;
@ -437,7 +436,7 @@ export default {
data.loadNumber = model.loadNum;
}
ranAsPlan(data, this.group).then(res => {
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`));
this.$store.dispatch('training/setInitTime', model.initTime);
}).catch(error => {
let message = '';
switch (error.code) {

View File

@ -267,7 +267,7 @@ export default {
this.$store.dispatch('training/over');// 仿
}
this.planRunning = resp.data.planRunning;
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`));
this.$store.dispatch('training/setInitTime', resp.data.systemTime);
} else if (resp && resp.code == 200 && resp.data && resp.data.dataError) {
this.dataError = true;
this.$messageBox('此地图数据正在维护中,无法运行!');

View File

@ -95,7 +95,6 @@ import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive';
import Jl3dDevice from '@/views/jlmap3d/device/jl3ddevice';
import Jl3dMaintainerSelect from '@/views/jlmap3d/maintainer/jl3dmaintainerselect';
import { EventBus } from '@/scripts/event-bus';
import { timeFormat } from '@/utils/date';
import { Message } from 'element-ui';
import { getToken } from '@/utils/auth';
import MembersManage from './memberManage/membersManage';
@ -389,7 +388,7 @@ export default {
const resp = await getSimulationInfoNew(this.group);
if (resp && resp.code == 200 && resp.data && !resp.data.dataError) {
this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause);//
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`));// 仿
this.$store.dispatch('training/setInitTime', resp.data.systemTime);// 仿
// this.$store.dispatch('training/countTime');// 仿
this.$store.dispatch('runPlan/setRunPlanInfo', resp.data.runPlan);
if (resp.data.planRunning) {

View File

@ -237,7 +237,7 @@ export default {
},
'$store.state.socket.simulationStart': async function (val) {
if (val) {
this.$store.dispatch('training/setInitTime', +new Date(val));
this.$store.dispatch('training/setInitTime', val);
this.$store.dispatch('training/start');
}
}
@ -356,6 +356,7 @@ export default {
},
selectBeginTime() {
this.$refs.setTime.doShow();
console.log(1)
},
// 仿
start(model) {
@ -363,7 +364,7 @@ export default {
time: model.initTime
};
ranAsPlan(data, this.group).then(res => {
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`));
this.$store.dispatch('training/setInitTime', model.initTime);
}).catch((error) => {
if (error.code == '5001') {
this.$messageBox(this.$t('error.mapDataError') + '' + this.$t('error.startSimulationFailed'));

View File

@ -17,16 +17,26 @@
<div class="devide"></div>
<div class="nextTrain">
<div>第一班列车 1st</div>
<div class="text-center yellow">
<div v-if="standPisState.firstTrainRemain > 1" class="text-center yellow">
<span class="bigger">{{ standPisState.firstTrainRemain }} 分钟</span> <span>min</span>
</div>
<div v-else-if="standPisState.firstTrainRemain > 0" class="text-center yellow">
<span class="bigger">即将到站</span>
</div>
<div v-else class="text-center yellow">
<span class="bigger">列车到站</span>
</div>
<div>开往 {{ standPisState.firstEndStationName }}</div>
<div v-if="standPisState.firstEndStationNameEn">TO {{ standPisState.firstEndStationNameEn }}</div>
</div>
<div class="devide"></div>
<div class="secondTrain">
<div>第二班列车 2nd</div>
<div class="text-center bigger">{{ standPisState.secondTrainRemain }} 分钟 <span>min</span></div>
<div v-if="standPisState.secondTrainRemain > 1" class="text-center bigger">
{{ standPisState.secondTrainRemain }} 分钟 <span>min</span>
</div>
<div v-else-if="standPisState.secondTrainRemain > 0" class="text-center bigger">即将到站</div>
<div v-else class="text-center bigger">列车到站</div>
<div>开往 {{ standPisState.secondEndStationName }}</div>
<div v-if="standPisState.secondEndStationNameEn">TO {{ standPisState.secondEndStationNameEn }}</div>
</div>
@ -92,29 +102,14 @@
</template>
<script>
let timer
import { creatSubscribe, clearSubscribe, getTopic } from '@/utils/stomp'
import { formatDuring } from '@/utils/date'
import { creatSubscribe, clearSubscribe, getTopic, displayTopic } from '@/utils/stomp'
import { timestampFormat } from '@/utils/date'
export default {
name: 'PIS',
components: {},
computed: {
date() {
return `${this.datetime.getFullYear()}${this.datetime.getMonth() + 1}${this.datetime.getDate()}`
},
time() {
let h = this.datetime.getHours().toString(),
m = this.datetime.getMinutes().toString()
if (h.length === 1) h = '0' + h
if (m.length === 1) m = '0' + m
return `${h}:${m}`
},
},
watch: {
'$store.state.socket.simulationTimeSync': function(val) {
console.log(val)
console.log(formatDuring(val))
this.time = timestampFormat('HH:mm', val)
this.date = timestampFormat('YYYY年MM月DD日', val)
},
'$store.state.socket.standPisState': function(val) {
this.standPisState = val
@ -126,7 +121,8 @@ export default {
data() {
return {
view: '',
datetime: new Date(),
date: '',
time: '',
standPisState: {
standCode: '',
stationName: '',
@ -145,10 +141,6 @@ export default {
}
},
mounted() {
clearTimeout(timer)
timer = setInterval(() => {
this.tick()
}, 1000)
this.initPage(this.$route.query)
},
beforeDestroy() {
@ -166,11 +158,9 @@ export default {
this.view = 'train'
creatSubscribe(getTopic(type, group, { groupNumber }))
}
creatSubscribe(getTopic('SYSTIME', group))
creatSubscribe(`${displayTopic}\/${group}`)
},
clearPage() {
clearInterval(timer)
timer = null
clearSubscribe(
getTopic(
this.query.type,
@ -178,10 +168,7 @@ export default {
this.view === 'stand' ? { standCode: this.query.standCode } : { groupNumber: this.query.groupNumber }
)
)
clearSubscribe(getTopic('SYSTIME', this.query.group))
},
tick() {
this.datetime = new Date()
clearSubscribe(`${displayTopic}\/${this.query.group}`)
},
},
}

View File

@ -8,7 +8,7 @@
</div>
</template>
<script>
import { prefixIntrger } from '@/utils/date';
import { timestampFormat } from '@/utils/date';
import logo_ from '@/assets/logo_.png';
export default {
@ -110,8 +110,7 @@ export default {
},
watch: {
'$store.state.training.initTime': function (initTime) {
const date = new Date(initTime);
this.time = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}${prefixIntrger(date.getSeconds(), 2)}`;
this.time = timestampFormat('HH:mmss', initTime)
}
},
mounted() {

View File

@ -180,6 +180,17 @@ export default {
if (this.editData['bgSceneJson']) {
this.bgSceneObj = JSON.parse(this.editData['bgSceneJson']);
}
},
'$store.state.map.activeTrainListChange': function () {
const activeTrainList = this.$store.state.map.activeTrainList;
const memberData = this.$store.state.training.memberData;
// 仿
const result = covertMemberData(activeTrainList, Object.values(memberData));
let list = [];
result.deviceListData.forEach(item => {
list = list.concat(item);
});
this.roleList = list;
}
},
methods: {