Browse Source

学校-白名单

gzb
wangzhonglu 10 months ago
parent
commit
9f3e9dc8a4

+ 20
- 0
src/api/whiteLibrary.js View File

29
  */
29
  */
30
 export const whiteLibrary_detail = (data) =>
30
 export const whiteLibrary_detail = (data) =>
31
   setRequest("whiteLibrary/detail", data);
31
   setRequest("whiteLibrary/detail", data);
32
+/**
33
+ * 4.2.1白名单--管理列表
34
+ */
35
+export const white_list = (data) => setRequest("white/list", data);
36
+/**
37
+ * 4.2.2白名单--添加
38
+ */
39
+export const white_add = (data) => setRequest("white/add", data);
40
+/**
41
+ * 4.2.3白名单--更新
42
+ */
43
+export const white_edit = (data) => setRequest("white/edit", data);
44
+/**
45
+ * 4.2.4白名单--删除
46
+ */
47
+export const white_delete = (data) => setRequest("white/delete", data);
48
+/**
49
+ * 4.2.5白名单--详情
50
+ */
51
+export const white_detail = (data) => setRequest("white/detail", data);

+ 92
- 172
src/views/schoolSection/networkManage/whitelist.vue View File

16
       <Table :columns="columns" :data="searchForm.list">
16
       <Table :columns="columns" :data="searchForm.list">
17
         <template slot-scope="{ row }" slot="nameSlot">
17
         <template slot-scope="{ row }" slot="nameSlot">
18
           <div class="name_slot">
18
           <div class="name_slot">
19
-            <div class="name_content" :title="row.name">{{ row.name }}</div>
20
-            <div v-if="row.wltype === 1" class="app_tag">APP</div>
21
-            <div v-else-if="row.wltype === 2" class="web_tag">网址</div>
19
+            <div class="name_content" :title="row.whiteName">
20
+              {{ row.whiteName }}
21
+            </div>
22
+            <div v-if="row.whiteType === 2" class="public_tag">公用</div>
22
           </div>
23
           </div>
23
         </template>
24
         </template>
24
         <template slot-scope="{ row }" slot="whiteAddressSlot">
25
         <template slot-scope="{ row }" slot="whiteAddressSlot">
25
-          <div class="white_address" :title="row.whiteAddress">
26
-            {{ row.whiteAddress }}
26
+          <div class="white_address" :title="row.website">
27
+            {{ row.website }}
27
           </div>
28
           </div>
28
         </template>
29
         </template>
29
         <template slot-scope="{ row }" slot="actionSlot">
30
         <template slot-scope="{ row }" slot="actionSlot">
30
           <div class="action_list">
31
           <div class="action_list">
31
-            <div @click="toView(row)">查看</div>
32
-            <div @click="toEdit(row)">编辑</div>
33
-            <div class="action_del" @click="toDel(row)">删除</div>
32
+            <div @click="toView(row)" v-if="row.whiteType !== 2">查看</div>
33
+            <div @click="toEdit(row)" v-if="row.whiteType !== 2">编辑</div>
34
+            <div class="action_del" @click="toDel(row)">
35
+              {{ row.whiteType === 2 ? "移除" : "删除" }}
36
+            </div>
34
           </div>
37
           </div>
35
         </template>
38
         </template>
36
       </Table>
39
       </Table>
52
     <Modal
55
     <Modal
53
       class="modal1"
56
       class="modal1"
54
       :mask-closable="false"
57
       :mask-closable="false"
55
-      v-model="whiteLibraryInfo.show"
56
-      :title="whiteLibraryInfo.wlid ? '编辑' : '新建'"
58
+      v-model="whiteListInfo.show"
59
+      :title="whiteListInfo.whiteid ? '编辑' : '新建'"
57
     >
60
     >
58
       <Form
61
       <Form
59
-        v-if="whiteLibraryInfo.show"
62
+        v-if="whiteListInfo.show"
60
         ref="addForm"
63
         ref="addForm"
61
-        :model="whiteLibraryInfo"
64
+        :model="whiteListInfo"
62
         :rules="rules"
65
         :rules="rules"
63
         :label-width="90"
66
         :label-width="90"
64
         inline
67
         inline
65
       >
68
       >
66
-        <FormItem label="名称" prop="name" style="width: 100%">
69
+        <FormItem label="名称" prop="whiteName" style="width: 100%">
67
           <Input
70
           <Input
68
-            v-model="whiteLibraryInfo.name"
71
+            v-model="whiteListInfo.whiteName"
69
             placeholder="请输入名称"
72
             placeholder="请输入名称"
70
           ></Input>
73
           ></Input>
71
         </FormItem>
74
         </FormItem>
72
-        <FormItem label="类型" prop="wltype" style="width: 100%">
73
-          <RadioGroup v-model="whiteLibraryInfo.wltype">
74
-            <Radio :label="1">APP</Radio>
75
-            <Radio :label="2">网址</Radio>
76
-          </RadioGroup>
77
-        </FormItem>
78
-        <template v-if="whiteLibraryInfo.wltype === 1">
79
-          <FormItem
80
-            label="版本名称"
81
-            prop="versionName"
82
-            style="width: calc(50% - 10px)"
83
-          >
84
-            <Input
85
-              v-model="whiteLibraryInfo.versionName"
86
-              placeholder="请输入版本名称"
87
-            ></Input>
88
-          </FormItem>
89
-          <FormItem label="包名" prop="website" style="width: calc(50% - 10px)">
90
-            <Input
91
-              v-model="whiteLibraryInfo.website"
92
-              placeholder="请输入包名"
93
-            ></Input>
94
-          </FormItem>
95
-        </template>
96
         <FormItem label="简介" prop="comm" style="width: 100%">
75
         <FormItem label="简介" prop="comm" style="width: 100%">
97
-          <Input
98
-            v-model="whiteLibraryInfo.comm"
99
-            placeholder="请输入简介"
100
-          ></Input>
76
+          <Input v-model="whiteListInfo.comm" placeholder="请输入简介"></Input>
101
         </FormItem>
77
         </FormItem>
102
-        <FormItem label="网址" prop="whiteAddress" style="width: 100%">
78
+        <FormItem label="网址" prop="website" style="width: 100%">
103
           <Input
79
           <Input
104
             type="textarea"
80
             type="textarea"
105
-            v-model="whiteLibraryInfo.whiteAddress"
81
+            v-model="whiteListInfo.website"
106
             placeholder="请填写正确的IP地址或者域名,多个IP或域名之间用英文分号隔开"
82
             placeholder="请填写正确的IP地址或者域名,多个IP或域名之间用英文分号隔开"
107
           ></Input>
83
           ></Input>
108
           <div style="color: #7c8db5">
84
           <div style="color: #7c8db5">
111
         </FormItem>
87
         </FormItem>
112
       </Form>
88
       </Form>
113
       <div slot="footer">
89
       <div slot="footer">
114
-        <Button @click="whiteLibraryInfo.show = false">取消</Button>
90
+        <Button @click="whiteListInfo.show = false">取消</Button>
115
         <Button @click="saveAddInfo()" type="primary">保存</Button>
91
         <Button @click="saveAddInfo()" type="primary">保存</Button>
116
       </div>
92
       </div>
117
     </Modal>
93
     </Modal>
123
       title="查看"
99
       title="查看"
124
     >
100
     >
125
       <div class="view_title">
101
       <div class="view_title">
126
-        <div>{{ viewInfo.name }}</div>
127
-        <div v-if="viewInfo.wltype === 1" class="wltype_1">APP</div>
128
-        <div v-if="viewInfo.wltype === 2" class="wltype_2">网址</div>
102
+        <div>{{ viewInfo.whiteName }}</div>
103
+        <div v-if="viewInfo.whiteType === 2" class="public">公用</div>
129
       </div>
104
       </div>
130
-      <Form :label-width="80" inline>
131
-        <template v-if="viewInfo.wltype === 1">
132
-          <FormItem
133
-            label="版本名称"
134
-            style="margin-bottom: 0; width: calc(50% - 10px)"
135
-            >{{ viewInfo.versionName }}</FormItem
136
-          >
137
-          <FormItem
138
-            label="包名"
139
-            style="margin-bottom: 0; width: calc(50% - 10px)"
140
-            >{{ viewInfo.website }}</FormItem
141
-          >
142
-        </template>
143
-        <FormItem label="简介" style="margin-bottom: 0; width: 100%">{{
144
-          viewInfo.comm
145
-        }}</FormItem>
105
+      <Input
106
+        v-if="viewInfo.comm"
107
+        v-model="viewInfo.comm"
108
+        disabled
109
+        type="textarea"
110
+      />
111
+      <Form :label-width="46">
146
         <FormItem label="网址" style="margin-bottom: 0; width: 100%">{{
112
         <FormItem label="网址" style="margin-bottom: 0; width: 100%">{{
147
-          viewInfo.whiteAddress
113
+          viewInfo.website
148
         }}</FormItem>
114
         }}</FormItem>
149
       </Form>
115
       </Form>
150
       <div slot="footer" style="text-align: center">
116
       <div slot="footer" style="text-align: center">
156
 
122
 
157
 <script>
123
 <script>
158
 import {
124
 import {
159
-  whiteLibrary_list,
160
-  whiteLibrary_add,
161
-  whiteLibrary_edit,
162
-  whiteLibrary_delete
125
+  white_list,
126
+  white_add,
127
+  white_edit,
128
+  white_delete
163
 } from "@/api/whiteLibrary";
129
 } from "@/api/whiteLibrary";
164
 export default {
130
 export default {
165
   data() {
131
   data() {
166
     return {
132
     return {
167
       searchForm: {
133
       searchForm: {
168
-        name: "",
134
+        whiteName: "",
169
         page: 1,
135
         page: 1,
170
         size: 10,
136
         size: 10,
171
         list: [],
137
         list: [],
172
         total: 0
138
         total: 0
173
       },
139
       },
174
       rules: {
140
       rules: {
175
-        name: [
141
+        whiteName: [
176
           {
142
           {
177
             required: true,
143
             required: true,
178
             message: "请输入名称",
144
             message: "请输入名称",
179
             trigger: "change"
145
             trigger: "change"
180
           }
146
           }
181
-        ],
182
-        wltype: [
183
-          {
184
-            required: true,
185
-            type: "number",
186
-            message: "请选择状态",
187
-            trigger: "change"
188
-          }
189
-        ],
190
-        versionName: [
191
-          {
192
-            required: true,
193
-            message: "请输入版本名称",
194
-            trigger: "change"
195
-          }
196
         ]
147
         ]
197
       },
148
       },
198
       // 新建/编辑
149
       // 新建/编辑
199
-      whiteLibraryInfo: {
150
+      whiteListInfo: {
200
         show: false,
151
         show: false,
201
-        wlid: null,
152
+        whiteid: null,
202
         rversion: null,
153
         rversion: null,
203
-        name: "",
204
-        // 1app 2网页
205
-        wltype: 1,
154
+        whiteName: "",
155
+        // 1所有学校2指定学校
156
+        targetSchool: 2,
206
         website: "",
157
         website: "",
207
-        versionName: "",
158
+        regionid: null,
208
         comm: "",
159
         comm: "",
209
-        whiteAddress: ""
160
+        schoolids: []
210
       },
161
       },
211
       // 查看
162
       // 查看
212
       viewInfo: {
163
       viewInfo: {
213
         show: false,
164
         show: false,
214
-        name: "",
215
-        // 1app 2网页
216
-        wltype: 1,
165
+        whiteName: "",
166
+        whiteType: "",
217
         website: "",
167
         website: "",
218
-        versionName: "",
219
-        comm: "",
220
-        whiteAddress: ""
168
+        comm: ""
221
       },
169
       },
222
       columns: [
170
       columns: [
223
         {
171
         {
234
           }
182
           }
235
         },
183
         },
236
         {
184
         {
237
-          title: "应用名称",
185
+          title: "名称",
238
           slot: "nameSlot",
186
           slot: "nameSlot",
239
           align: "center"
187
           align: "center"
240
         },
188
         },
241
-        {
242
-          title: "版本名称",
243
-          key: "versionName",
244
-          align: "center"
245
-        },
246
-        {
247
-          title: "包名",
248
-          key: "website",
249
-          align: "center"
250
-        },
251
         {
189
         {
252
           title: "网址",
190
           title: "网址",
253
           slot: "whiteAddressSlot",
191
           slot: "whiteAddressSlot",
296
     },
234
     },
297
     // 获取列表
235
     // 获取列表
298
     getList() {
236
     getList() {
299
-      whiteLibrary_list({
237
+      console.warn("---注意替换regionid---->white_list");
238
+      white_list({
239
+        regionid: 11,
300
         page: this.searchForm.page,
240
         page: this.searchForm.page,
301
         size: this.searchForm.size,
241
         size: this.searchForm.size,
302
-        name: this.searchForm.name
242
+        whiteName: this.searchForm.whiteName
303
       }).then((data) => {
243
       }).then((data) => {
304
         if (data.code === 0) {
244
         if (data.code === 0) {
305
           this.searchForm.list = data.obj.data;
245
           this.searchForm.list = data.obj.data;
311
     },
251
     },
312
     // 新建
252
     // 新建
313
     toAdd() {
253
     toAdd() {
314
-      this.whiteLibraryInfo = {
254
+      console.warn("---注意替换regionid---schoolids->");
255
+      this.whiteListInfo = {
315
         show: true,
256
         show: true,
316
-        wlid: null,
257
+        whiteid: null,
317
         rversion: null,
258
         rversion: null,
318
-        name: "",
319
-        // 1app 2网页
320
-        wltype: 1,
259
+        whiteName: "",
260
+        // 1所有学校2指定学校
261
+        targetSchool: 2,
321
         website: "",
262
         website: "",
322
-        versionName: "",
263
+        regionid: 11,
323
         comm: "",
264
         comm: "",
324
-        whiteAddress: ""
265
+        schoolids: [4]
325
       };
266
       };
326
     },
267
     },
327
     // 保存新建
268
     // 保存新建
328
     saveAddInfo() {
269
     saveAddInfo() {
329
       this.$refs.addForm.validate((valid) => {
270
       this.$refs.addForm.validate((valid) => {
330
         if (valid) {
271
         if (valid) {
331
-          this.whiteLibraryInfo.show = false;
272
+          this.whiteListInfo.show = false;
332
           let api =
273
           let api =
333
-            this.whiteLibraryInfo.wlid && this.whiteLibraryInfo.rversion
334
-              ? whiteLibrary_edit
335
-              : whiteLibrary_add;
274
+            this.whiteListInfo.whiteid && this.whiteListInfo.rversion
275
+              ? white_edit
276
+              : white_add;
336
           let form = {
277
           let form = {
337
-            name: this.whiteLibraryInfo.name,
338
-            wltype: this.whiteLibraryInfo.wltype,
339
-            comm: this.whiteLibraryInfo.comm,
340
-            whiteAddress: this.whiteLibraryInfo.whiteAddress
278
+            whiteName: this.whiteListInfo.whiteName,
279
+            targetSchool: this.whiteListInfo.targetSchool,
280
+            website: this.whiteListInfo.website,
281
+            comm: this.whiteListInfo.comm,
282
+            schoolids: this.whiteListInfo.schoolids
341
           };
283
           };
342
-          if (this.whiteLibraryInfo.wltype === 1) {
343
-            form.website = this.whiteLibraryInfo.website;
344
-            form.versionName = this.whiteLibraryInfo.versionName;
345
-          }
346
-          if (this.whiteLibraryInfo.wlid && this.whiteLibraryInfo.rversion) {
347
-            form.wlid = this.whiteLibraryInfo.wlid;
348
-            form.rversion = this.whiteLibraryInfo.rversion;
284
+          if (this.whiteListInfo.whiteid && this.whiteListInfo.rversion) {
285
+            form.whiteid = this.whiteListInfo.whiteid;
286
+            form.rversion = this.whiteListInfo.rversion;
287
+          } else {
288
+            form.regionid = this.whiteListInfo.regionid;
349
           }
289
           }
350
           api(form).then((data) => {
290
           api(form).then((data) => {
351
             if (data.code === 0) {
291
             if (data.code === 0) {
362
     toView(row) {
302
     toView(row) {
363
       this.viewInfo = {
303
       this.viewInfo = {
364
         show: true,
304
         show: true,
365
-        name: row.name,
366
-        // 1app 2网页
367
-        wltype: row.wltype,
305
+        whiteName: row.whiteName,
306
+        whiteType: row.whiteType,
368
         website: row.website,
307
         website: row.website,
369
-        versionName: row.versionName,
370
-        comm: row.comm,
371
-        whiteAddress: row.whiteAddress
308
+        comm: row.comm
372
       };
309
       };
373
     },
310
     },
374
     // 编辑
311
     // 编辑
375
     toEdit(row) {
312
     toEdit(row) {
376
-      this.whiteLibraryInfo = {
313
+      console.warn("---注意替换regionid-schoolids--->");
314
+      this.whiteListInfo = {
377
         show: true,
315
         show: true,
378
-        wlid: row.wlid,
316
+        whiteid: row.whiteid,
379
         rversion: row.rversion,
317
         rversion: row.rversion,
380
-        name: row.name,
381
-        // 1app 2网页
382
-        wltype: row.wltype,
318
+        whiteName: row.whiteName,
319
+        // 1所有学校2指定学校
320
+        targetSchool: 2,
383
         website: row.website,
321
         website: row.website,
384
-        versionName: row.versionName,
322
+        regionid: 11,
385
         comm: row.comm,
323
         comm: row.comm,
386
-        whiteAddress: row.whiteAddress
324
+        schoolids: [4]
387
       };
325
       };
388
     },
326
     },
389
     // 删除
327
     // 删除
390
     toDel(row) {
328
     toDel(row) {
391
       this.$Modal.confirm({
329
       this.$Modal.confirm({
392
         title: "提示",
330
         title: "提示",
393
-        content: "您确定删除选中数据吗?",
331
+        content: `确定要将“${row.whiteName}”从白名单中${
332
+          row.whiteType === 2 ? "移除" : "删除"
333
+        }?`,
394
         onOk: () => {
334
         onOk: () => {
395
-          whiteLibrary_delete({
396
-            wlid: row.wlid,
335
+          white_delete({
336
+            whiteid: row.whiteid,
397
             rversion: row.rversion
337
             rversion: row.rversion
398
           }).then((data) => {
338
           }).then((data) => {
399
             if (data.code === 0) {
339
             if (data.code === 0) {
431
   font-size: 18px;
371
   font-size: 18px;
432
   font-weight: bold;
372
   font-weight: bold;
433
   text-align: center;
373
   text-align: center;
434
-  .wltype_1 {
435
-    margin-left: 10px;
436
-    padding: 0 10px;
437
-    line-height: 20px;
438
-    color: #fff;
439
-    font-weight: normal;
440
-    font-size: 12px;
441
-    border-radius: 4px;
442
-    background: #7854f6;
443
-  }
444
-  .wltype_2 {
374
+  .public {
445
     margin-left: 10px;
375
     margin-left: 10px;
446
     padding: 0 10px;
376
     padding: 0 10px;
447
     line-height: 20px;
377
     line-height: 20px;
462
     text-overflow: ellipsis;
392
     text-overflow: ellipsis;
463
     white-space: nowrap;
393
     white-space: nowrap;
464
   }
394
   }
465
-  .app_tag {
395
+  .public_tag {
466
     margin-left: 4px;
396
     margin-left: 4px;
467
     width: 32px;
397
     width: 32px;
468
     text-align: center;
398
     text-align: center;
472
     border-radius: 5px;
402
     border-radius: 5px;
473
     background-color: #7854f6;
403
     background-color: #7854f6;
474
   }
404
   }
475
-  .web_tag {
476
-    margin-left: 4px;
477
-    width: 32px;
478
-    text-align: center;
479
-    color: #fff;
480
-    line-height: 1.6;
481
-    font-size: 12px;
482
-    border-radius: 5px;
483
-    background-color: #52c41a;
484
-  }
485
 }
405
 }
486
 .white_address {
406
 .white_address {
487
   max-width: 100%;
407
   max-width: 100%;

+ 17
- 9
src/views/schoolSection/networkManage/whitelistLibrary.vue View File

142
     },
142
     },
143
     // 添加到白名单
143
     // 添加到白名单
144
     addToWhitelist(row) {
144
     addToWhitelist(row) {
145
-      whiteLibrary_add_white({
146
-        wlid: row.wlid,
147
-        regionid: row.regionid
148
-      }).then((data) => {
149
-        if (data.code === 0) {
150
-          this.searchList();
151
-        } else {
152
-          this.$Message.error(data.msg);
153
-        }
145
+      console.warn("---注意替换regionid---->whiteLibrary_add_white");
146
+      this.$Modal.confirm({
147
+        title: "提示",
148
+        content: `确定要将“${row.name}”加到白名单?`,
149
+        onOk: () => {
150
+          whiteLibrary_add_white({
151
+            wlid: row.wlid,
152
+            regionid: 11
153
+          }).then((data) => {
154
+            if (data.code === 0) {
155
+              this.$Message.success(data.msg);
156
+            } else {
157
+              this.$Message.error(data.msg);
158
+            }
159
+          });
160
+        },
161
+        onCancel: () => {}
154
       });
162
       });
155
     }
163
     }
156
   }
164
   }

Loading…
Cancel
Save