Bladeren bron

Merge commit 'a0cfd3e8813bd4bbf4f82b4535d157bbd462082b' into gzb

gzb
guozhongbo 9 maanden geleden
bovenliggende
commit
a21f0f20e8

+ 5
- 0
src/api/whiteLibrary.js Bestand weergeven

@@ -9,6 +9,11 @@ export const whiteLibrary_list = (data) =>
9 9
  * 4.1.2白名单库--添加
10 10
  */
11 11
 export const whiteLibrary_add = (data) => setRequest("whiteLibrary/add", data);
12
+/**
13
+ * 4.1.2白名单库--添加到白名单
14
+ */
15
+export const whiteLibrary_add_white = (data) =>
16
+  setRequest("whiteLibrary/add_white", data);
12 17
 /**
13 18
  * 4.1.3白名单库--更新
14 19
  */

+ 482
- 4
src/views/schoolSection/networkManage/whitelist.vue Bestand weergeven

@@ -1,14 +1,492 @@
1 1
 <template>
2
-  <div class="main_root"></div>
2
+  <div class="main_root">
3
+    <div class="search_header">
4
+      <div class="search_left">
5
+        <Input
6
+          v-model="searchForm.aname"
7
+          placeholder="请输入名称"
8
+          search
9
+          @on-search="searchList()"
10
+          style="width: 150px"
11
+        />
12
+      </div>
13
+      <Button type="primary" class="primary_btn" @click="toAdd()">新建</Button>
14
+    </div>
15
+    <div class="table_wrap">
16
+      <Table :columns="columns" :data="searchForm.list">
17
+        <template slot-scope="{ row }" slot="nameSlot">
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>
22
+          </div>
23
+        </template>
24
+        <template slot-scope="{ row }" slot="whiteAddressSlot">
25
+          <div class="white_address" :title="row.whiteAddress">
26
+            {{ row.whiteAddress }}
27
+          </div>
28
+        </template>
29
+        <template slot-scope="{ row }" slot="actionSlot">
30
+          <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>
34
+          </div>
35
+        </template>
36
+      </Table>
37
+    </div>
38
+    <div class="page_wrap">
39
+      <Page
40
+        :transfer="true"
41
+        :total="searchForm.total"
42
+        :current="searchForm.page"
43
+        :page-size="searchForm.size"
44
+        :page-size-opts="[10, 20, 40, 60]"
45
+        @on-change="pageChange"
46
+        @on-page-size-change="pageSizeChange"
47
+        show-total
48
+        show-sizer
49
+      ></Page>
50
+    </div>
51
+    <!-- 新建/编辑 -->
52
+    <Modal
53
+      class="modal1"
54
+      :mask-closable="false"
55
+      v-model="whiteLibraryInfo.show"
56
+      :title="whiteLibraryInfo.wlid ? '编辑' : '新建'"
57
+    >
58
+      <Form
59
+        v-if="whiteLibraryInfo.show"
60
+        ref="addForm"
61
+        :model="whiteLibraryInfo"
62
+        :rules="rules"
63
+        :label-width="90"
64
+        inline
65
+      >
66
+        <FormItem label="名称" prop="name" style="width: 100%">
67
+          <Input
68
+            v-model="whiteLibraryInfo.name"
69
+            placeholder="请输入名称"
70
+          ></Input>
71
+        </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%">
97
+          <Input
98
+            v-model="whiteLibraryInfo.comm"
99
+            placeholder="请输入简介"
100
+          ></Input>
101
+        </FormItem>
102
+        <FormItem label="网址" prop="whiteAddress" style="width: 100%">
103
+          <Input
104
+            type="textarea"
105
+            v-model="whiteLibraryInfo.whiteAddress"
106
+            placeholder="请填写正确的IP地址或者域名,多个IP或域名之间用英文分号隔开"
107
+          ></Input>
108
+          <div style="color: #7c8db5">
109
+            说明:IP例如:192.168.1.200或者192.168.1.200/24,域名例如:new.iflytek.com
110
+          </div>
111
+        </FormItem>
112
+      </Form>
113
+      <div slot="footer">
114
+        <Button @click="whiteLibraryInfo.show = false">取消</Button>
115
+        <Button @click="saveAddInfo()" type="primary">保存</Button>
116
+      </div>
117
+    </Modal>
118
+    <!-- 查看 -->
119
+    <Modal
120
+      class="modal1"
121
+      :mask-closable="false"
122
+      v-model="viewInfo.show"
123
+      title="查看"
124
+    >
125
+      <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>
129
+      </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>
146
+        <FormItem label="网址" style="margin-bottom: 0; width: 100%">{{
147
+          viewInfo.whiteAddress
148
+        }}</FormItem>
149
+      </Form>
150
+      <div slot="footer" style="text-align: center">
151
+        <Button @click="viewInfo.show = false">关闭</Button>
152
+      </div>
153
+    </Modal>
154
+  </div>
3 155
 </template>
4 156
 
5 157
 <script>
158
+import {
159
+  whiteLibrary_list,
160
+  whiteLibrary_add,
161
+  whiteLibrary_edit,
162
+  whiteLibrary_delete
163
+} from "@/api/whiteLibrary";
6 164
 export default {
7 165
   data() {
8
-    return {};
166
+    return {
167
+      searchForm: {
168
+        name: "",
169
+        page: 1,
170
+        size: 10,
171
+        list: [],
172
+        total: 0
173
+      },
174
+      rules: {
175
+        name: [
176
+          {
177
+            required: true,
178
+            message: "请输入名称",
179
+            trigger: "change"
180
+          }
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
+        ]
197
+      },
198
+      // 新建/编辑
199
+      whiteLibraryInfo: {
200
+        show: false,
201
+        wlid: null,
202
+        rversion: null,
203
+        name: "",
204
+        // 1app 2网页
205
+        wltype: 1,
206
+        website: "",
207
+        versionName: "",
208
+        comm: "",
209
+        whiteAddress: ""
210
+      },
211
+      // 查看
212
+      viewInfo: {
213
+        show: false,
214
+        name: "",
215
+        // 1app 2网页
216
+        wltype: 1,
217
+        website: "",
218
+        versionName: "",
219
+        comm: "",
220
+        whiteAddress: ""
221
+      },
222
+      columns: [
223
+        {
224
+          title: "序号",
225
+          align: "center",
226
+          width: 70,
227
+          render: (h, params) => {
228
+            return h(
229
+              "span",
230
+              params.index +
231
+                (this.searchForm.page - 1) * this.searchForm.size +
232
+                1
233
+            );
234
+          }
235
+        },
236
+        {
237
+          title: "应用名称",
238
+          slot: "nameSlot",
239
+          align: "center"
240
+        },
241
+        {
242
+          title: "版本名称",
243
+          key: "versionName",
244
+          align: "center"
245
+        },
246
+        {
247
+          title: "包名",
248
+          key: "website",
249
+          align: "center"
250
+        },
251
+        {
252
+          title: "网址",
253
+          slot: "whiteAddressSlot",
254
+          align: "center"
255
+        },
256
+        {
257
+          title: "操作人",
258
+          key: "updatename",
259
+          width: 140,
260
+          align: "center"
261
+        },
262
+        {
263
+          title: "操作时间",
264
+          key: "updatetime",
265
+          width: 190,
266
+          align: "center"
267
+        },
268
+        {
269
+          title: "操作",
270
+          slot: "actionSlot",
271
+          width: 180,
272
+          align: "center"
273
+        }
274
+      ]
275
+    };
9 276
   },
10
-  methods: {}
277
+  created() {
278
+    this.searchList();
279
+  },
280
+  methods: {
281
+    // 搜索
282
+    searchList() {
283
+      this.searchForm.page = 1;
284
+      this.getList();
285
+    },
286
+    // 页码改变
287
+    pageChange(page) {
288
+      this.searchForm.page = page;
289
+      this.getList();
290
+    },
291
+    // 每页显示数量改变
292
+    pageSizeChange(size) {
293
+      this.searchForm.size = size;
294
+      this.searchForm.page = 1;
295
+      this.getList();
296
+    },
297
+    // 获取列表
298
+    getList() {
299
+      whiteLibrary_list({
300
+        page: this.searchForm.page,
301
+        size: this.searchForm.size,
302
+        name: this.searchForm.name
303
+      }).then((data) => {
304
+        if (data.code === 0) {
305
+          this.searchForm.list = data.obj.data;
306
+          this.searchForm.total = data.obj.total;
307
+        } else {
308
+          this.$Message.error(data.msg);
309
+        }
310
+      });
311
+    },
312
+    // 新建
313
+    toAdd() {
314
+      this.whiteLibraryInfo = {
315
+        show: true,
316
+        wlid: null,
317
+        rversion: null,
318
+        name: "",
319
+        // 1app 2网页
320
+        wltype: 1,
321
+        website: "",
322
+        versionName: "",
323
+        comm: "",
324
+        whiteAddress: ""
325
+      };
326
+    },
327
+    // 保存新建
328
+    saveAddInfo() {
329
+      this.$refs.addForm.validate((valid) => {
330
+        if (valid) {
331
+          this.whiteLibraryInfo.show = false;
332
+          let api =
333
+            this.whiteLibraryInfo.wlid && this.whiteLibraryInfo.rversion
334
+              ? whiteLibrary_edit
335
+              : whiteLibrary_add;
336
+          let form = {
337
+            name: this.whiteLibraryInfo.name,
338
+            wltype: this.whiteLibraryInfo.wltype,
339
+            comm: this.whiteLibraryInfo.comm,
340
+            whiteAddress: this.whiteLibraryInfo.whiteAddress
341
+          };
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;
349
+          }
350
+          api(form).then((data) => {
351
+            if (data.code === 0) {
352
+              this.searchList();
353
+              this.$Message.success(data.msg);
354
+            } else {
355
+              this.$Message.error(data.msg);
356
+            }
357
+          });
358
+        }
359
+      });
360
+    },
361
+    // 查看
362
+    toView(row) {
363
+      this.viewInfo = {
364
+        show: true,
365
+        name: row.name,
366
+        // 1app 2网页
367
+        wltype: row.wltype,
368
+        website: row.website,
369
+        versionName: row.versionName,
370
+        comm: row.comm,
371
+        whiteAddress: row.whiteAddress
372
+      };
373
+    },
374
+    // 编辑
375
+    toEdit(row) {
376
+      this.whiteLibraryInfo = {
377
+        show: true,
378
+        wlid: row.wlid,
379
+        rversion: row.rversion,
380
+        name: row.name,
381
+        // 1app 2网页
382
+        wltype: row.wltype,
383
+        website: row.website,
384
+        versionName: row.versionName,
385
+        comm: row.comm,
386
+        whiteAddress: row.whiteAddress
387
+      };
388
+    },
389
+    // 删除
390
+    toDel(row) {
391
+      this.$Modal.confirm({
392
+        title: "提示",
393
+        content: "您确定删除选中数据吗?",
394
+        onOk: () => {
395
+          whiteLibrary_delete({
396
+            wlid: row.wlid,
397
+            rversion: row.rversion
398
+          }).then((data) => {
399
+            if (data.code === 0) {
400
+              this.searchList();
401
+              this.$Message.success(data.msg);
402
+            } else {
403
+              this.$Message.error(data.msg);
404
+            }
405
+          });
406
+        },
407
+        onCancel: () => {}
408
+      });
409
+    }
410
+  }
11 411
 };
12 412
 </script>
13 413
 
14
-<style lang="less" scoped></style>
414
+<style lang="less" scoped>
415
+.search_header {
416
+  display: flex;
417
+  justify-content: space-between;
418
+  align-items: center;
419
+  margin: 16px 16px;
420
+  .search_left {
421
+    display: flex;
422
+    justify-content: flex-start;
423
+    align-items: center;
424
+  }
425
+}
426
+.view_title {
427
+  display: flex;
428
+  justify-content: center;
429
+  align-items: center;
430
+  margin-bottom: 16px;
431
+  font-size: 18px;
432
+  font-weight: bold;
433
+  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 {
445
+    margin-left: 10px;
446
+    padding: 0 10px;
447
+    line-height: 20px;
448
+    color: #fff;
449
+    font-weight: normal;
450
+    font-size: 12px;
451
+    border-radius: 4px;
452
+    background: #52c41a;
453
+  }
454
+}
455
+.name_slot {
456
+  display: flex;
457
+  justify-content: center;
458
+  align-items: center;
459
+  .name_content {
460
+    max-width: calc(100% - 38px);
461
+    overflow: hidden;
462
+    text-overflow: ellipsis;
463
+    white-space: nowrap;
464
+  }
465
+  .app_tag {
466
+    margin-left: 4px;
467
+    width: 32px;
468
+    text-align: center;
469
+    color: #fff;
470
+    line-height: 1.6;
471
+    font-size: 12px;
472
+    border-radius: 5px;
473
+    background-color: #7854f6;
474
+  }
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
+}
486
+.white_address {
487
+  max-width: 100%;
488
+  overflow: hidden;
489
+  text-overflow: ellipsis;
490
+  white-space: nowrap;
491
+}
492
+</style>

+ 193
- 4
src/views/schoolSection/networkManage/whitelistLibrary.vue Bestand weergeven

@@ -1,14 +1,203 @@
1 1
 <template>
2
-  <div class="main_root"></div>
2
+  <div class="main_root">
3
+    <div class="search_header">
4
+      <div class="search_left">
5
+        <Input
6
+          v-model="searchForm.aname"
7
+          placeholder="请输入名称"
8
+          search
9
+          @on-search="searchList()"
10
+          style="width: 150px"
11
+        />
12
+      </div>
13
+    </div>
14
+    <div class="table_wrap">
15
+      <Table :columns="columns" :data="searchForm.list">
16
+        <template slot-scope="{ row }" slot="nameSlot">
17
+          <div class="name_slot">
18
+            <div class="name_content" :title="row.name">{{ row.name }}</div>
19
+            <div v-if="row.wltype === 1" class="app_tag">APP</div>
20
+            <div v-else-if="row.wltype === 2" class="web_tag">网址</div>
21
+          </div>
22
+        </template>
23
+        <template slot-scope="{ row }" slot="actionSlot">
24
+          <div class="action_list">
25
+            <div @click="addToWhitelist(row)">添加到白名单</div>
26
+          </div>
27
+        </template>
28
+      </Table>
29
+    </div>
30
+    <div class="page_wrap">
31
+      <Page
32
+        :transfer="true"
33
+        :total="searchForm.total"
34
+        :current="searchForm.page"
35
+        :page-size="searchForm.size"
36
+        :page-size-opts="[10, 20, 40, 60]"
37
+        @on-change="pageChange"
38
+        @on-page-size-change="pageSizeChange"
39
+        show-total
40
+        show-sizer
41
+      ></Page>
42
+    </div>
43
+  </div>
3 44
 </template>
4 45
 
5 46
 <script>
47
+import { whiteLibrary_list, whiteLibrary_add_white } from "@/api/whiteLibrary";
6 48
 export default {
7 49
   data() {
8
-    return {};
50
+    return {
51
+      searchForm: {
52
+        name: "",
53
+        page: 1,
54
+        size: 10,
55
+        list: [],
56
+        total: 0
57
+      },
58
+      columns: [
59
+        {
60
+          title: "序号",
61
+          align: "center",
62
+          width: 70,
63
+          render: (h, params) => {
64
+            return h(
65
+              "span",
66
+              params.index +
67
+                (this.searchForm.page - 1) * this.searchForm.size +
68
+                1
69
+            );
70
+          }
71
+        },
72
+        {
73
+          title: "应用名称",
74
+          slot: "nameSlot",
75
+          align: "center"
76
+        },
77
+        {
78
+          title: "版本名称",
79
+          key: "versionName",
80
+          align: "center"
81
+        },
82
+        {
83
+          title: "包名",
84
+          key: "website",
85
+          align: "center"
86
+        },
87
+        {
88
+          title: "操作人",
89
+          key: "updatename",
90
+          width: 140,
91
+          align: "center"
92
+        },
93
+        {
94
+          title: "操作时间",
95
+          key: "updatetime",
96
+          width: 190,
97
+          align: "center"
98
+        },
99
+        {
100
+          title: "操作",
101
+          slot: "actionSlot",
102
+          width: 140,
103
+          align: "center"
104
+        }
105
+      ]
106
+    };
9 107
   },
10
-  methods: {}
108
+  created() {
109
+    this.searchList();
110
+  },
111
+  methods: {
112
+    // 搜索
113
+    searchList() {
114
+      this.searchForm.page = 1;
115
+      this.getList();
116
+    },
117
+    // 页码改变
118
+    pageChange(page) {
119
+      this.searchForm.page = page;
120
+      this.getList();
121
+    },
122
+    // 每页显示数量改变
123
+    pageSizeChange(size) {
124
+      this.searchForm.size = size;
125
+      this.searchForm.page = 1;
126
+      this.getList();
127
+    },
128
+    // 获取列表
129
+    getList() {
130
+      whiteLibrary_list({
131
+        page: this.searchForm.page,
132
+        size: this.searchForm.size,
133
+        name: this.searchForm.name
134
+      }).then((data) => {
135
+        if (data.code === 0) {
136
+          this.searchForm.list = data.obj.data;
137
+          this.searchForm.total = data.obj.total;
138
+        } else {
139
+          this.$Message.error(data.msg);
140
+        }
141
+      });
142
+    },
143
+    // 添加到白名单
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
+        }
154
+      });
155
+    }
156
+  }
11 157
 };
12 158
 </script>
13 159
 
14
-<style lang="less" scoped></style>
160
+<style lang="less" scoped>
161
+.search_header {
162
+  display: flex;
163
+  justify-content: space-between;
164
+  align-items: center;
165
+  margin: 16px 16px;
166
+  .search_left {
167
+    display: flex;
168
+    justify-content: flex-start;
169
+    align-items: center;
170
+  }
171
+}
172
+.name_slot {
173
+  display: flex;
174
+  justify-content: center;
175
+  align-items: center;
176
+  .name_content {
177
+    max-width: calc(100% - 38px);
178
+    overflow: hidden;
179
+    text-overflow: ellipsis;
180
+    white-space: nowrap;
181
+  }
182
+  .app_tag {
183
+    margin-left: 4px;
184
+    width: 32px;
185
+    text-align: center;
186
+    color: #fff;
187
+    line-height: 1.6;
188
+    font-size: 12px;
189
+    border-radius: 5px;
190
+    background-color: #7854f6;
191
+  }
192
+  .web_tag {
193
+    margin-left: 4px;
194
+    width: 32px;
195
+    text-align: center;
196
+    color: #fff;
197
+    line-height: 1.6;
198
+    font-size: 12px;
199
+    border-radius: 5px;
200
+    background-color: #52c41a;
201
+  }
202
+}
203
+</style>

Laden…
Annuleren
Opslaan