Browse Source

学校应用策略

gzb
wangzhonglu 9 months ago
parent
commit
13f4b1d0e2

+ 5
- 5
src/components/TimeStrategy/TimeStrategy.vue View File

135
           };
135
           };
136
           for (let index = 0; index < _dayHalfHours.length; index++) {
136
           for (let index = 0; index < _dayHalfHours.length; index++) {
137
             const _halfHour = _dayHalfHours[index];
137
             const _halfHour = _dayHalfHours[index];
138
-            let _time = `${Math.floor(_halfHour / 2)}:${
139
-              _halfHour % 2 === 0 ? "00" : "30"
140
-            }`;
138
+            let _bigTime = Math.floor(_halfHour / 2);
139
+            _bigTime = _bigTime > 9 ? _bigTime : `0${_bigTime}`;
140
+            let _time = `${_bigTime}:${_halfHour % 2 === 0 ? "00" : "30"}`;
141
             if (!_dayTimeInfo.starttime) {
141
             if (!_dayTimeInfo.starttime) {
142
               _dayTimeInfo.starttime = _time;
142
               _dayTimeInfo.starttime = _time;
143
               _dayTimeInfo.stoptime = _time;
143
               _dayTimeInfo.stoptime = _time;
282
             let _yIndex =
282
             let _yIndex =
283
               timeInfo.weekIndex - _mouseInfo.weekIndex >= 0
283
               timeInfo.weekIndex - _mouseInfo.weekIndex >= 0
284
                 ? _mouseInfo.weekIndex + y
284
                 ? _mouseInfo.weekIndex + y
285
-                : _mouseInfo.weekIndex - y;
285
+                : timeInfo.weekIndex + y;
286
             let _xHalfHour =
286
             let _xHalfHour =
287
               timeInfo.halfHour - _mouseInfo.halfHour >= 0
287
               timeInfo.halfHour - _mouseInfo.halfHour >= 0
288
                 ? _mouseInfo.halfHour + x
288
                 ? _mouseInfo.halfHour + x
289
-                : _mouseInfo.halfHour - x;
289
+                : timeInfo.halfHour + x;
290
             this.toSetTimeStrategy(_yIndex, _xHalfHour);
290
             this.toSetTimeStrategy(_yIndex, _xHalfHour);
291
           }
291
           }
292
         }
292
         }

+ 76
- 11
src/views/schoolSection/applicationStrategy/appStrategyTemplateAdd.vue View File

71
         <tr>
71
         <tr>
72
           <th colspan="7">
72
           <th colspan="7">
73
             <div class="table_header">
73
             <div class="table_header">
74
-              <div class="table_header_title">应用策略列表</div>
74
+              <div class="table_header_title">应用策略{{ groupIndex + 1 }}</div>
75
               <div class="table_header_action">
75
               <div class="table_header_action">
76
-                <div>编辑</div>
77
-                <div class="del">删除</div>
76
+                <div @click="toEditeGroupItem(groupItem, groupIndex)">编辑</div>
77
+                <div class="del" @click="toDelGroupItem(groupIndex)">删除</div>
78
               </div>
78
               </div>
79
             </div>
79
             </div>
80
           </th>
80
           </th>
84
             {{ weekItem.label }}
84
             {{ weekItem.label }}
85
           </td>
85
           </td>
86
         </tr>
86
         </tr>
87
+        <tr>
88
+          <td v-for="weekItem in weekDay" :key="weekItem.value">
89
+            <div class="time_list">
90
+              <span
91
+                v-for="(timeItem, timeIndex) in appStrategyGroupInfo[
92
+                  groupIndex
93
+                ][weekItem.value]"
94
+                :key="timeIndex"
95
+                >{{ timeItem.starttime }} - {{ timeItem.stoptime }}</span
96
+              >
97
+            </div>
98
+          </td>
99
+        </tr>
87
         <tr>
100
         <tr>
88
           <td colspan="7">
101
           <td colspan="7">
89
             <div class="table_app_list">
102
             <div class="table_app_list">
90
               <div
103
               <div
91
                 class="table_app_item"
104
                 class="table_app_item"
92
-                v-for="appItem in groupItem.apps"
93
-                :key="appItem.appid"
105
+                v-for="appid in groupItem.apps"
106
+                :key="appid"
94
               >
107
               >
95
-                <div class="app_top"></div>
108
+                <div class="app_top">
109
+                  <img
110
+                    v-if="appsInfo[appid]"
111
+                    :src="$api.showImageUrl + appsInfo[appid].appIcon"
112
+                  />
113
+                </div>
96
                 <div class="app_name">
114
                 <div class="app_name">
97
-                  {{ appsInfo[appItem.appid].appName }}
115
+                  {{ appsInfo[appid] && appsInfo[appid].appName }}
98
                 </div>
116
                 </div>
99
               </div>
117
               </div>
100
             </div>
118
             </div>
153
         info[item.appid] = item;
171
         info[item.appid] = item;
154
       });
172
       });
155
       return info;
173
       return info;
174
+    },
175
+    appStrategyGroupInfo() {
176
+      let info = [];
177
+      this.appStrategyInfo.groups.forEach((groupItem) => {
178
+        let groupTimes = {};
179
+        groupItem.times.forEach((timeItem) => {
180
+          if (!groupTimes[timeItem.week]) {
181
+            groupTimes[timeItem.week] = [];
182
+          }
183
+          groupTimes[timeItem.week].push(timeItem);
184
+        });
185
+        info.push(groupTimes);
186
+      });
187
+      return info;
156
     }
188
     }
157
   },
189
   },
158
   methods: {
190
   methods: {
191
+    toEditeGroupItem(groupItem, groupIndex) {
192
+      this.tempStrategyInfo = JSON.parse(JSON.stringify(groupItem));
193
+      this.appStrategyInfo.groups.splice(groupIndex, 1);
194
+    },
195
+    toDelGroupItem(groupIndex) {
196
+      this.$Modal.confirm({
197
+        title: "提示",
198
+        content: "您确定删除选中数据吗?",
199
+        onOk: () => {
200
+          this.appStrategyInfo.groups.splice(groupIndex, 1);
201
+        },
202
+        onCancel: () => {}
203
+      });
204
+    },
159
     appAllCheckChange(selected) {
205
     appAllCheckChange(selected) {
160
       if (selected) {
206
       if (selected) {
161
         this.tempStrategyInfo.apps = this.appList.map(
207
         this.tempStrategyInfo.apps = this.appList.map(
207
         return;
253
         return;
208
       }
254
       }
209
       this.appStrategyInfo.groups.push(_tempStrategyInfo);
255
       this.appStrategyInfo.groups.push(_tempStrategyInfo);
256
+      this.toResetStrategy();
210
     }
257
     }
211
   }
258
   }
212
 };
259
 };
378
         cursor: pointer;
425
         cursor: pointer;
379
         &:hover {
426
         &:hover {
380
           color: #339dff;
427
           color: #339dff;
381
-        }
382
-        &.del {
383
-          color: #f0153f;
428
+          &.del {
429
+            color: #f0153f;
430
+          }
384
         }
431
         }
385
       }
432
       }
386
     }
433
     }
387
   }
434
   }
435
+  .time_list {
436
+    display: flex;
437
+    justify-content: center;
438
+    align-items: center;
439
+    flex-wrap: wrap;
440
+    > span {
441
+      margin: 4px 6px;
442
+      line-height: 1;
443
+      white-space: nowrap;
444
+    }
445
+  }
388
   .table_app_list {
446
   .table_app_list {
389
     display: flex;
447
     display: flex;
390
     justify-content: flex-start;
448
     justify-content: flex-start;
393
     .table_app_item {
451
     .table_app_item {
394
       margin: 10px;
452
       margin: 10px;
395
       .app_top {
453
       .app_top {
454
+        display: flex;
455
+        justify-content: center;
456
+        align-items: center;
396
         margin: 0 auto;
457
         margin: 0 auto;
397
         width: 56px;
458
         width: 56px;
398
         height: 56px;
459
         height: 56px;
399
         border-radius: 6px;
460
         border-radius: 6px;
400
         border: 1px solid #e5e5e5;
461
         border: 1px solid #e5e5e5;
401
         background: #ffffff;
462
         background: #ffffff;
463
+        img {
464
+          width: 38px;
465
+          height: 38px;
466
+        }
402
       }
467
       }
403
       .app_name {
468
       .app_name {
404
         margin-top: 10px;
469
         margin-top: 10px;
405
         max-width: 100px;
470
         max-width: 100px;
406
         line-height: 1;
471
         line-height: 1;
407
-        font-size: 14px;
472
+        font-size: 12px;
408
         text-align: center;
473
         text-align: center;
409
         overflow: hidden;
474
         overflow: hidden;
410
         text-overflow: ellipsis;
475
         text-overflow: ellipsis;

Loading…
Cancel
Save