Browse Source

时间策略优化;

gzb
wangzhonglu 8 months ago
parent
commit
f09e95509a

+ 36
- 9
src/components/TimeStrategy/TimeStrategy.vue View File

@@ -116,9 +116,13 @@ export default {
116 116
         if (Number(_stoptimeArr[1]) === 30) {
117 117
           _stopHalfHour++;
118 118
         }
119
-        while (_startHalfHour <= _stopHalfHour) {
120
-          _timeInfo[timeItem.week].push(_startHalfHour);
121
-          _startHalfHour++;
119
+        if (_stopHalfHour === _startHalfHour + 1) {
120
+          _timeInfo[timeItem.week].push(_stopHalfHour);
121
+        } else {
122
+          while (_startHalfHour < _stopHalfHour) {
123
+            _startHalfHour++;
124
+            _timeInfo[timeItem.week].push(_startHalfHour);
125
+          }
122 126
         }
123 127
       }
124 128
       this.timeInfo = _timeInfo;
@@ -137,12 +141,19 @@ export default {
137 141
             prevHalfHour: null
138 142
           };
139 143
           for (let index = 0; index < _dayHalfHours.length; index++) {
140
-            const _halfHour = _dayHalfHours[index];
144
+            let _halfHour = _dayHalfHours[index];
141 145
             let _bigTime = Math.floor(_halfHour / 2);
142 146
             _bigTime = _bigTime > 9 ? _bigTime : `0${_bigTime}`;
143 147
             let _time = `${_bigTime}:${_halfHour % 2 === 0 ? "00" : "30"}`;
148
+            let _startHalfHour = _halfHour - 1;
149
+            let _startBigTime = Math.floor((_halfHour - 1) / 2);
150
+            _startBigTime =
151
+              _startBigTime > 9 ? _startBigTime : `0${_startBigTime}`;
152
+            let _startTime = `${_startBigTime}:${
153
+              _startHalfHour % 2 === 0 ? "00" : "30"
154
+            }`;
144 155
             if (!_dayTimeInfo.starttime) {
145
-              _dayTimeInfo.starttime = _time;
156
+              _dayTimeInfo.starttime = _startTime;
146 157
               _dayTimeInfo.stoptime = _time;
147 158
               _dayTimeInfo.prevHalfHour = _halfHour;
148 159
             } else {
@@ -150,9 +161,12 @@ export default {
150 161
                 _times.push({
151 162
                   week: weekValue,
152 163
                   starttime: _dayTimeInfo.starttime,
153
-                  stoptime: _dayTimeInfo.stoptime
164
+                  stoptime:
165
+                    _dayTimeInfo.stoptime === "24:00"
166
+                      ? "23:59"
167
+                      : _dayTimeInfo.stoptime
154 168
                 });
155
-                _dayTimeInfo.starttime = _time;
169
+                _dayTimeInfo.starttime = _startTime;
156 170
                 _dayTimeInfo.stoptime = _time;
157 171
                 _dayTimeInfo.prevHalfHour = _halfHour;
158 172
               } else {
@@ -175,13 +189,26 @@ export default {
175 189
     },
176 190
     // 显示每个单元格标题
177 191
     getTimeTitle(weekItemLabel, halfHour) {
192
+      let _startTime = "";
193
+      let _endTime = "";
194
+      let _startHalfHour = parseInt((halfHour - 1) / 2);
195
+      _startHalfHour =
196
+        _startHalfHour > 9 ? _startHalfHour : `0${_startHalfHour}`;
197
+      let _startMinute = (halfHour - 1) % 2 === 0 ? "00" : "30";
198
+      if (_startHalfHour === 24 && _startMinute === "00") {
199
+        _startTime = "23:59";
200
+      } else {
201
+        _startTime = `${_startHalfHour}:${_startMinute}`;
202
+      }
178 203
       let _hour = parseInt(halfHour / 2);
179 204
       _hour = _hour > 9 ? _hour : `0${_hour}`;
180 205
       let _minute = halfHour % 2 === 0 ? "00" : "30";
181 206
       if (_hour === 24 && _minute === "00") {
182
-        return `${weekItemLabel} 23:59`;
207
+        _endTime = "23:59";
208
+      } else {
209
+        _endTime = `${_hour}:${_minute}`;
183 210
       }
184
-      return `${weekItemLabel} ${_hour}:${_minute}`;
211
+      return `${weekItemLabel} ${_startTime}-${_endTime}`;
185 212
     },
186 213
     // 设置时间策略
187 214
     toSetTimeStrategy(weekIndex, halfHour) {

+ 2
- 2
src/views/schoolSection/applicationStrategy/appStrategyManage.vue View File

@@ -1,14 +1,14 @@
1 1
 <template>
2 2
   <div class="main_root">
3 3
     <div class="main_left">
4
-      <div class="main_left_title">用户组</div>
4
+      <div class="main_left_title">按班级</div>
5 5
       <div class="class_list">
6 6
         <div
7 7
           :class="['class_item', !searchForm.classid ? 'selceted' : '']"
8 8
           @click="classChange(null, schoolInfo.hasst)"
9 9
           :title="schoolInfo.schoolname"
10 10
         >
11
-          {{ schoolInfo.schoolname }}
11
+          全部班级
12 12
           <Icon
13 13
             v-if="schoolInfo.hasst === 1"
14 14
             class="ivu-icon iconfont icon-ding-mianxing st_icon"

+ 1
- 1
src/views/schoolSection/deviceManage/breakRuleDevice.vue View File

@@ -152,7 +152,7 @@ export default {
152 152
       searchForm: {
153 153
         name: "",
154 154
         // 是否处理:0否 1是
155
-        handled: -1,
155
+        handled: 0,
156 156
         page: 1,
157 157
         size: 10,
158 158
         list: [],

+ 2
- 2
src/views/schoolSection/deviceManage/deviceManage.vue View File

@@ -1,13 +1,13 @@
1 1
 <template>
2 2
   <div class="main_root">
3 3
     <div class="main_left">
4
-      <div class="main_left_title">所有设备</div>
4
+      <div class="main_left_title">按班级</div>
5 5
       <div class="class_list">
6 6
         <div
7 7
           :class="['class_item', !searchForm.classid ? 'selceted' : '']"
8 8
           @click="classChange(null)"
9 9
         >
10
-          {{ schoolInfo.schoolname }}
10
+          全部班级
11 11
         </div>
12 12
         <div
13 13
           :class="[

+ 3
- 3
src/views/schoolSection/home/index.vue View File

@@ -643,21 +643,21 @@ export default {
643 643
           this.initOnlineEcharts({
644 644
             domId: "onlineEcharts1",
645 645
             onlineNum: this.onlineDeviceList[0].num,
646
-            onlineTatalNum: this.onlineDeviceList[0].tatalnum,
646
+            onlineTatalNum: this.onlineDeviceList[0].tatalnum || 1,
647 647
             onlineColor: ["#ABD5FF", "#339CFF", "#E2EEFE"],
648 648
             subtext: "最近1小时"
649 649
           });
650 650
           this.initOnlineEcharts({
651 651
             domId: "onlineEcharts2",
652 652
             onlineNum: this.onlineDeviceList[1].num,
653
-            onlineTatalNum: this.onlineDeviceList[1].tatalnum,
653
+            onlineTatalNum: this.onlineDeviceList[1].tatalnum || 1,
654 654
             onlineColor: ["#D3F6C1", "#52C41A", "#E9FFDE"],
655 655
             subtext: "最近48小时"
656 656
           });
657 657
           this.initOnlineEcharts({
658 658
             domId: "onlineEcharts3",
659 659
             onlineNum: this.onlineDeviceList[2].num,
660
-            onlineTatalNum: this.onlineDeviceList[2].tatalnum,
660
+            onlineTatalNum: this.onlineDeviceList[2].tatalnum || 1,
661 661
             onlineColor: ["#FCC9E3", "#ED4A99", "#FFE0EF"],
662 662
             subtext: "最近7天"
663 663
           });

Loading…
Cancel
Save