Browse Source

学校-白名单

gzb
wangzhonglu 10 months ago
parent
commit
9f3e9dc8a4

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

@@ -29,3 +29,23 @@ export const whiteLibrary_delete = (data) =>
29 29
  */
30 30
 export const whiteLibrary_detail = (data) =>
31 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,21 +16,24 @@
16 16
       <Table :columns="columns" :data="searchForm.list">
17 17
         <template slot-scope="{ row }" slot="nameSlot">
18 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 23
           </div>
23 24
         </template>
24 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 28
           </div>
28 29
         </template>
29 30
         <template slot-scope="{ row }" slot="actionSlot">
30 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 37
           </div>
35 38
         </template>
36 39
       </Table>
@@ -52,57 +55,30 @@
52 55
     <Modal
53 56
       class="modal1"
54 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 61
       <Form
59
-        v-if="whiteLibraryInfo.show"
62
+        v-if="whiteListInfo.show"
60 63
         ref="addForm"
61
-        :model="whiteLibraryInfo"
64
+        :model="whiteListInfo"
62 65
         :rules="rules"
63 66
         :label-width="90"
64 67
         inline
65 68
       >
66
-        <FormItem label="名称" prop="name" style="width: 100%">
69
+        <FormItem label="名称" prop="whiteName" style="width: 100%">
67 70
           <Input
68
-            v-model="whiteLibraryInfo.name"
71
+            v-model="whiteListInfo.whiteName"
69 72
             placeholder="请输入名称"
70 73
           ></Input>
71 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 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 77
         </FormItem>
102
-        <FormItem label="网址" prop="whiteAddress" style="width: 100%">
78
+        <FormItem label="网址" prop="website" style="width: 100%">
103 79
           <Input
104 80
             type="textarea"
105
-            v-model="whiteLibraryInfo.whiteAddress"
81
+            v-model="whiteListInfo.website"
106 82
             placeholder="请填写正确的IP地址或者域名,多个IP或域名之间用英文分号隔开"
107 83
           ></Input>
108 84
           <div style="color: #7c8db5">
@@ -111,7 +87,7 @@
111 87
         </FormItem>
112 88
       </Form>
113 89
       <div slot="footer">
114
-        <Button @click="whiteLibraryInfo.show = false">取消</Button>
90
+        <Button @click="whiteListInfo.show = false">取消</Button>
115 91
         <Button @click="saveAddInfo()" type="primary">保存</Button>
116 92
       </div>
117 93
     </Modal>
@@ -123,28 +99,18 @@
123 99
       title="查看"
124 100
     >
125 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 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 112
         <FormItem label="网址" style="margin-bottom: 0; width: 100%">{{
147
-          viewInfo.whiteAddress
113
+          viewInfo.website
148 114
         }}</FormItem>
149 115
       </Form>
150 116
       <div slot="footer" style="text-align: center">
@@ -156,68 +122,50 @@
156 122
 
157 123
 <script>
158 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 129
 } from "@/api/whiteLibrary";
164 130
 export default {
165 131
   data() {
166 132
     return {
167 133
       searchForm: {
168
-        name: "",
134
+        whiteName: "",
169 135
         page: 1,
170 136
         size: 10,
171 137
         list: [],
172 138
         total: 0
173 139
       },
174 140
       rules: {
175
-        name: [
141
+        whiteName: [
176 142
           {
177 143
             required: true,
178 144
             message: "请输入名称",
179 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 151
         show: false,
201
-        wlid: null,
152
+        whiteid: null,
202 153
         rversion: null,
203
-        name: "",
204
-        // 1app 2网页
205
-        wltype: 1,
154
+        whiteName: "",
155
+        // 1所有学校2指定学校
156
+        targetSchool: 2,
206 157
         website: "",
207
-        versionName: "",
158
+        regionid: null,
208 159
         comm: "",
209
-        whiteAddress: ""
160
+        schoolids: []
210 161
       },
211 162
       // 查看
212 163
       viewInfo: {
213 164
         show: false,
214
-        name: "",
215
-        // 1app 2网页
216
-        wltype: 1,
165
+        whiteName: "",
166
+        whiteType: "",
217 167
         website: "",
218
-        versionName: "",
219
-        comm: "",
220
-        whiteAddress: ""
168
+        comm: ""
221 169
       },
222 170
       columns: [
223 171
         {
@@ -234,20 +182,10 @@ export default {
234 182
           }
235 183
         },
236 184
         {
237
-          title: "应用名称",
185
+          title: "名称",
238 186
           slot: "nameSlot",
239 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 190
           title: "网址",
253 191
           slot: "whiteAddressSlot",
@@ -296,10 +234,12 @@ export default {
296 234
     },
297 235
     // 获取列表
298 236
     getList() {
299
-      whiteLibrary_list({
237
+      console.warn("---注意替换regionid---->white_list");
238
+      white_list({
239
+        regionid: 11,
300 240
         page: this.searchForm.page,
301 241
         size: this.searchForm.size,
302
-        name: this.searchForm.name
242
+        whiteName: this.searchForm.whiteName
303 243
       }).then((data) => {
304 244
         if (data.code === 0) {
305 245
           this.searchForm.list = data.obj.data;
@@ -311,41 +251,41 @@ export default {
311 251
     },
312 252
     // 新建
313 253
     toAdd() {
314
-      this.whiteLibraryInfo = {
254
+      console.warn("---注意替换regionid---schoolids->");
255
+      this.whiteListInfo = {
315 256
         show: true,
316
-        wlid: null,
257
+        whiteid: null,
317 258
         rversion: null,
318
-        name: "",
319
-        // 1app 2网页
320
-        wltype: 1,
259
+        whiteName: "",
260
+        // 1所有学校2指定学校
261
+        targetSchool: 2,
321 262
         website: "",
322
-        versionName: "",
263
+        regionid: 11,
323 264
         comm: "",
324
-        whiteAddress: ""
265
+        schoolids: [4]
325 266
       };
326 267
     },
327 268
     // 保存新建
328 269
     saveAddInfo() {
329 270
       this.$refs.addForm.validate((valid) => {
330 271
         if (valid) {
331
-          this.whiteLibraryInfo.show = false;
272
+          this.whiteListInfo.show = false;
332 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 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 290
           api(form).then((data) => {
351 291
             if (data.code === 0) {
@@ -362,38 +302,38 @@ export default {
362 302
     toView(row) {
363 303
       this.viewInfo = {
364 304
         show: true,
365
-        name: row.name,
366
-        // 1app 2网页
367
-        wltype: row.wltype,
305
+        whiteName: row.whiteName,
306
+        whiteType: row.whiteType,
368 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 312
     toEdit(row) {
376
-      this.whiteLibraryInfo = {
313
+      console.warn("---注意替换regionid-schoolids--->");
314
+      this.whiteListInfo = {
377 315
         show: true,
378
-        wlid: row.wlid,
316
+        whiteid: row.whiteid,
379 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 321
         website: row.website,
384
-        versionName: row.versionName,
322
+        regionid: 11,
385 323
         comm: row.comm,
386
-        whiteAddress: row.whiteAddress
324
+        schoolids: [4]
387 325
       };
388 326
     },
389 327
     // 删除
390 328
     toDel(row) {
391 329
       this.$Modal.confirm({
392 330
         title: "提示",
393
-        content: "您确定删除选中数据吗?",
331
+        content: `确定要将“${row.whiteName}”从白名单中${
332
+          row.whiteType === 2 ? "移除" : "删除"
333
+        }?`,
394 334
         onOk: () => {
395
-          whiteLibrary_delete({
396
-            wlid: row.wlid,
335
+          white_delete({
336
+            whiteid: row.whiteid,
397 337
             rversion: row.rversion
398 338
           }).then((data) => {
399 339
             if (data.code === 0) {
@@ -431,17 +371,7 @@ export default {
431 371
   font-size: 18px;
432 372
   font-weight: bold;
433 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 375
     margin-left: 10px;
446 376
     padding: 0 10px;
447 377
     line-height: 20px;
@@ -462,7 +392,7 @@ export default {
462 392
     text-overflow: ellipsis;
463 393
     white-space: nowrap;
464 394
   }
465
-  .app_tag {
395
+  .public_tag {
466 396
     margin-left: 4px;
467 397
     width: 32px;
468 398
     text-align: center;
@@ -472,16 +402,6 @@ export default {
472 402
     border-radius: 5px;
473 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 406
 .white_address {
487 407
   max-width: 100%;

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

@@ -142,15 +142,23 @@ export default {
142 142
     },
143 143
     // 添加到白名单
144 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