Browse Source

时间策略优化;

gzb
wangzhonglu 8 months ago
parent
commit
f09e95509a

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

116
         if (Number(_stoptimeArr[1]) === 30) {
116
         if (Number(_stoptimeArr[1]) === 30) {
117
           _stopHalfHour++;
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
       this.timeInfo = _timeInfo;
128
       this.timeInfo = _timeInfo;
137
             prevHalfHour: null
141
             prevHalfHour: null
138
           };
142
           };
139
           for (let index = 0; index < _dayHalfHours.length; index++) {
143
           for (let index = 0; index < _dayHalfHours.length; index++) {
140
-            const _halfHour = _dayHalfHours[index];
144
+            let _halfHour = _dayHalfHours[index];
141
             let _bigTime = Math.floor(_halfHour / 2);
145
             let _bigTime = Math.floor(_halfHour / 2);
142
             _bigTime = _bigTime > 9 ? _bigTime : `0${_bigTime}`;
146
             _bigTime = _bigTime > 9 ? _bigTime : `0${_bigTime}`;
143
             let _time = `${_bigTime}:${_halfHour % 2 === 0 ? "00" : "30"}`;
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
             if (!_dayTimeInfo.starttime) {
155
             if (!_dayTimeInfo.starttime) {
145
-              _dayTimeInfo.starttime = _time;
156
+              _dayTimeInfo.starttime = _startTime;
146
               _dayTimeInfo.stoptime = _time;
157
               _dayTimeInfo.stoptime = _time;
147
               _dayTimeInfo.prevHalfHour = _halfHour;
158
               _dayTimeInfo.prevHalfHour = _halfHour;
148
             } else {
159
             } else {
150
                 _times.push({
161
                 _times.push({
151
                   week: weekValue,
162
                   week: weekValue,
152
                   starttime: _dayTimeInfo.starttime,
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
                 _dayTimeInfo.stoptime = _time;
170
                 _dayTimeInfo.stoptime = _time;
157
                 _dayTimeInfo.prevHalfHour = _halfHour;
171
                 _dayTimeInfo.prevHalfHour = _halfHour;
158
               } else {
172
               } else {
175
     },
189
     },
176
     // 显示每个单元格标题
190
     // 显示每个单元格标题
177
     getTimeTitle(weekItemLabel, halfHour) {
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
       let _hour = parseInt(halfHour / 2);
203
       let _hour = parseInt(halfHour / 2);
179
       _hour = _hour > 9 ? _hour : `0${_hour}`;
204
       _hour = _hour > 9 ? _hour : `0${_hour}`;
180
       let _minute = halfHour % 2 === 0 ? "00" : "30";
205
       let _minute = halfHour % 2 === 0 ? "00" : "30";
181
       if (_hour === 24 && _minute === "00") {
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
     toSetTimeStrategy(weekIndex, halfHour) {
214
     toSetTimeStrategy(weekIndex, halfHour) {

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

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

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

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

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

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

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

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

Loading…
Cancel
Save