diff --git a/package.json b/package.json
index 4373cc9e3..80eb50f30 100644
--- a/package.json
+++ b/package.json
@@ -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",
diff --git a/src/ibp/shape/clock.js b/src/ibp/shape/clock.js
index 259f9727e..84b268d68 100644
--- a/src/ibp/shape/clock.js
+++ b/src/ibp/shape/clock.js
@@ -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
+ }
}
diff --git a/src/jmapNew/theme/beijing_01/menus/menuTool.vue b/src/jmapNew/theme/beijing_01/menus/menuTool.vue
index d278e2adf..155232fee 100644
--- a/src/jmapNew/theme/beijing_01/menus/menuTool.vue
+++ b/src/jmapNew/theme/beijing_01/menus/menuTool.vue
@@ -10,7 +10,7 @@
diff --git a/src/views/newMap/displayBaSiDi/baSiDiNew.vue b/src/views/newMap/displayBaSiDi/baSiDiNew.vue
index 9089753df..be5ff9da0 100644
--- a/src/views/newMap/displayBaSiDi/baSiDiNew.vue
+++ b/src/views/newMap/displayBaSiDi/baSiDiNew.vue
@@ -106,11 +106,10 @@
diff --git a/src/views/newMap/displayBaSiDi/index.vue b/src/views/newMap/displayBaSiDi/index.vue
index 8f1bf3294..dbbab7be3 100644
--- a/src/views/newMap/displayBaSiDi/index.vue
+++ b/src/views/newMap/displayBaSiDi/index.vue
@@ -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) {
diff --git a/src/views/newMap/displayCity/demon/setTime.vue b/src/views/newMap/displayCity/demon/setTime.vue
index d64695573..d189fea63 100644
--- a/src/views/newMap/displayCity/demon/setTime.vue
+++ b/src/views/newMap/displayCity/demon/setTime.vue
@@ -22,7 +22,7 @@