|
@@ -12,12 +12,6 @@
|
12
|
12
|
</div>
|
13
|
13
|
<div class="table_wrap">
|
14
|
14
|
<Table :columns="columns" :data="searchForm.list">
|
15
|
|
- <template slot-scope="{ row }" slot="createtimeSlot">
|
16
|
|
- <div>{{ date_format(row.createtime) }}</div>
|
17
|
|
- </template>
|
18
|
|
- <template slot-scope="{ row }" slot="updatetimeSlot">
|
19
|
|
- <div>{{ date_format(row.updatetime) }}</div>
|
20
|
|
- </template>
|
21
|
15
|
<template slot-scope="{ row }" slot="actionSlot">
|
22
|
16
|
<div class="action_list">
|
23
|
17
|
<div @click="toEnter(row)">进入</div>
|
|
@@ -49,6 +43,7 @@
|
49
|
43
|
title="新建"
|
50
|
44
|
>
|
51
|
45
|
<Form
|
|
46
|
+ v-if="regionInfo.show"
|
52
|
47
|
ref="addForm"
|
53
|
48
|
:model="regionInfo"
|
54
|
49
|
:rules="rules"
|
|
@@ -61,9 +56,15 @@
|
61
|
56
|
placeholder="请输入区域名称"
|
62
|
57
|
></Input>
|
63
|
58
|
</FormItem>
|
|
59
|
+ <FormItem label="区域码" prop="regionCode" style="width: 100%">
|
|
60
|
+ <Input
|
|
61
|
+ v-model="regionInfo.regionCode"
|
|
62
|
+ placeholder="请输入区域码"
|
|
63
|
+ ></Input>
|
|
64
|
+ </FormItem>
|
64
|
65
|
<FormItem
|
65
|
66
|
label="管理员名称"
|
66
|
|
- prop="admin"
|
|
67
|
+ prop="aname"
|
67
|
68
|
style="width: calc(50% - 10px)"
|
68
|
69
|
>
|
69
|
70
|
<Input
|
|
@@ -110,15 +111,45 @@
|
110
|
111
|
>
|
111
|
112
|
<Input
|
112
|
113
|
style="width: calc(100% - 102px)"
|
113
|
|
- v-model="regionInfo.msgcode"
|
|
114
|
+ v-model="regionInfo.admin.msgcode"
|
114
|
115
|
placeholder="请输入短信验证码"
|
115
|
116
|
></Input>
|
116
|
|
- <div class="code_btn disabled">获取验证码</div>
|
|
117
|
+ <div
|
|
118
|
+ :class="['code_btn', regionInfo.second === 60 ? '' : 'disabled']"
|
|
119
|
+ @click="getMsgCode()"
|
|
120
|
+ >
|
|
121
|
+ 获取验证码
|
|
122
|
+ </div>
|
|
123
|
+ </FormItem>
|
|
124
|
+ <FormItem label="地址" prop="address" style="width: 100%">
|
|
125
|
+ <Input
|
|
126
|
+ v-model="regionInfo.admin.address"
|
|
127
|
+ placeholder="请输入地址"
|
|
128
|
+ ></Input>
|
|
129
|
+ </FormItem>
|
|
130
|
+ <FormItem label="描述信息" prop="comm" style="width: 100%">
|
|
131
|
+ <Input
|
|
132
|
+ type="textarea"
|
|
133
|
+ v-model="regionInfo.admin.comm"
|
|
134
|
+ placeholder="请输入描述信息"
|
|
135
|
+ ></Input>
|
117
|
136
|
</FormItem>
|
118
|
137
|
</Form>
|
119
|
|
- <div slot="footer">
|
120
|
|
- <Button @click="regionInfo.show = false">取消</Button>
|
121
|
|
- <Button @click="saveAddInfo()" type="primary">保存</Button>
|
|
138
|
+ <div
|
|
139
|
+ slot="footer"
|
|
140
|
+ style="
|
|
141
|
+ display: flex;
|
|
142
|
+ justify-content: space-between;
|
|
143
|
+ align-items: center;
|
|
144
|
+ "
|
|
145
|
+ >
|
|
146
|
+ <div style="color: #b50000">
|
|
147
|
+ 注:密码必须包含大小写字母和数字的组合,长度在8-32之间。
|
|
148
|
+ </div>
|
|
149
|
+ <div>
|
|
150
|
+ <Button @click="regionInfo.show = false">取消</Button>
|
|
151
|
+ <Button @click="saveAddInfo()" type="primary">保存</Button>
|
|
152
|
+ </div>
|
122
|
153
|
</div>
|
123
|
154
|
</Modal>
|
124
|
155
|
<!-- 查看 -->
|
|
@@ -128,7 +159,7 @@
|
128
|
159
|
v-model="viewInfo.show"
|
129
|
160
|
title="查看"
|
130
|
161
|
>
|
131
|
|
- <div class="view_title">河南星火燎原软件科技有限公司</div>
|
|
162
|
+ <div class="view_title">{{ viewInfo.regionName }}</div>
|
132
|
163
|
<Table
|
133
|
164
|
style="border: 1px solid #e8eaec; border-bottom: none"
|
134
|
165
|
:columns="viewInfo.columns"
|
|
@@ -142,11 +173,41 @@
|
142
|
173
|
</template>
|
143
|
174
|
|
144
|
175
|
<script>
|
145
|
|
-import { date_format } from "@/utils";
|
|
176
|
+import { generateRandomString } from "@/utils";
|
|
177
|
+import {
|
|
178
|
+ region_list,
|
|
179
|
+ region_list_admin,
|
|
180
|
+ region_delete,
|
|
181
|
+ region_add
|
|
182
|
+} from "@/api/region";
|
146
|
183
|
export default {
|
147
|
184
|
data() {
|
|
185
|
+ const reg = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,32}$/;
|
|
186
|
+ // 密码验证
|
|
187
|
+ const pwdCheck = (rule, value, callback) => {
|
|
188
|
+ if (!reg.test(this.regionInfo.admin.loginpwd)) {
|
|
189
|
+ return callback(
|
|
190
|
+ new Error("密码必须包含大小写字母和数字的组合,长度在8-32之间。")
|
|
191
|
+ );
|
|
192
|
+ } else {
|
|
193
|
+ callback();
|
|
194
|
+ }
|
|
195
|
+ };
|
|
196
|
+ // 重复密码验证
|
|
197
|
+ const pwdAgainCheck = async (rule, value, callback) => {
|
|
198
|
+ if (!reg.test(this.regionInfo.admin.loginpwd1)) {
|
|
199
|
+ return callback(
|
|
200
|
+ new Error("密码必须包含大小写字母和数字的组合,长度在8-32之间。")
|
|
201
|
+ );
|
|
202
|
+ } else if (
|
|
203
|
+ this.regionInfo.admin.loginpwd != this.regionInfo.admin.loginpwd1
|
|
204
|
+ ) {
|
|
205
|
+ return callback(new Error("两次输入密码不一致!"));
|
|
206
|
+ } else {
|
|
207
|
+ callback();
|
|
208
|
+ }
|
|
209
|
+ };
|
148
|
210
|
return {
|
149
|
|
- date_format,
|
150
|
211
|
searchForm: {
|
151
|
212
|
regionName: "",
|
152
|
213
|
page: 1,
|
|
@@ -157,13 +218,20 @@ export default {
|
157
|
218
|
// 新建
|
158
|
219
|
regionInfo: {
|
159
|
220
|
show: false,
|
|
221
|
+ // 验证码计时
|
|
222
|
+ timer: null,
|
|
223
|
+ second: 60,
|
160
|
224
|
regionName: "",
|
|
225
|
+ regionCode: "",
|
161
|
226
|
admin: {
|
162
|
227
|
aname: "",
|
163
|
228
|
loginname: "",
|
164
|
229
|
loginpwd: "",
|
165
|
230
|
loginpwd1: "",
|
166
|
|
- phone: ""
|
|
231
|
+ phone: "",
|
|
232
|
+ msgcode: "",
|
|
233
|
+ address: "",
|
|
234
|
+ comm: ""
|
167
|
235
|
}
|
168
|
236
|
},
|
169
|
237
|
// 查看
|
|
@@ -180,7 +248,7 @@ export default {
|
180
|
248
|
},
|
181
|
249
|
{
|
182
|
250
|
title: "名称",
|
183
|
|
- key: "admin",
|
|
251
|
+ key: "aname",
|
184
|
252
|
align: "center"
|
185
|
253
|
},
|
186
|
254
|
{
|
|
@@ -203,7 +271,7 @@ export default {
|
203
|
271
|
trigger: "blur"
|
204
|
272
|
}
|
205
|
273
|
],
|
206
|
|
- admin: [
|
|
274
|
+ aname: [
|
207
|
275
|
{
|
208
|
276
|
required: true,
|
209
|
277
|
message: "请输入管理员名称",
|
|
@@ -217,17 +285,17 @@ export default {
|
217
|
285
|
trigger: "blur"
|
218
|
286
|
}
|
219
|
287
|
],
|
220
|
|
- pwd: [
|
|
288
|
+ loginpwd: [
|
221
|
289
|
{
|
222
|
290
|
required: true,
|
223
|
|
- message: "请输入密码",
|
|
291
|
+ validator: pwdCheck,
|
224
|
292
|
trigger: "blur"
|
225
|
293
|
}
|
226
|
294
|
],
|
227
|
|
- pwd1: [
|
|
295
|
+ loginpwd1: [
|
228
|
296
|
{
|
229
|
297
|
required: true,
|
230
|
|
- message: "请输入确认密码",
|
|
298
|
+ validator: pwdAgainCheck,
|
231
|
299
|
trigger: "blur"
|
232
|
300
|
}
|
233
|
301
|
]
|
|
@@ -259,7 +327,7 @@ export default {
|
259
|
327
|
},
|
260
|
328
|
{
|
261
|
329
|
title: "创建时间",
|
262
|
|
- slot: "createtimeSlot",
|
|
330
|
+ key: "createtime",
|
263
|
331
|
width: 190,
|
264
|
332
|
align: "center"
|
265
|
333
|
},
|
|
@@ -271,7 +339,7 @@ export default {
|
271
|
339
|
},
|
272
|
340
|
{
|
273
|
341
|
title: "操作时间",
|
274
|
|
- slot: "updatetimeSlot",
|
|
342
|
+ key: "updatetime",
|
275
|
343
|
width: 190,
|
276
|
344
|
align: "center"
|
277
|
345
|
},
|
|
@@ -288,6 +356,30 @@ export default {
|
288
|
356
|
this.searchList();
|
289
|
357
|
},
|
290
|
358
|
methods: {
|
|
359
|
+ // 获取短信验证码
|
|
360
|
+ getMsgCode() {
|
|
361
|
+ if (this.regionInfo.second < 60) {
|
|
362
|
+ return;
|
|
363
|
+ }
|
|
364
|
+ // 手机号验证
|
|
365
|
+ if (!this.regionInfo.admin.phone) {
|
|
366
|
+ this.$Message.error("手机号码不能为空");
|
|
367
|
+ return;
|
|
368
|
+ }
|
|
369
|
+ let filter = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
|
|
370
|
+ if (!filter.test(this.regionInfo.admin.phone)) {
|
|
371
|
+ this.$Message.error("手机号码格式不正确");
|
|
372
|
+ return;
|
|
373
|
+ }
|
|
374
|
+ this.regionInfo.second = 60;
|
|
375
|
+ this.regionInfo.timer = setTimeout(() => {
|
|
376
|
+ this.regionInfo.second--;
|
|
377
|
+ if (this.regionInfo.second <= 0) {
|
|
378
|
+ clearTimeout(this.regionInfo.timer);
|
|
379
|
+ this.regionInfo.second = 60;
|
|
380
|
+ }
|
|
381
|
+ }, 1000);
|
|
382
|
+ },
|
291
|
383
|
// 搜索
|
292
|
384
|
searchList() {
|
293
|
385
|
this.searchForm.page = 1;
|
|
@@ -306,48 +398,75 @@ export default {
|
306
|
398
|
},
|
307
|
399
|
// 获取列表
|
308
|
400
|
getList() {
|
309
|
|
- this.searchForm.list = [
|
310
|
|
- {
|
311
|
|
- regionid: 1,
|
312
|
|
- regionName: "区域一",
|
313
|
|
- createname: "区域一",
|
314
|
|
- createtime: 1710838418,
|
315
|
|
- updatename: "区域一",
|
316
|
|
- updatetime: 1710838430
|
317
|
|
- },
|
318
|
|
- {
|
319
|
|
- regionid: 2,
|
320
|
|
- regionName: "区域二",
|
321
|
|
- createname: "区域一",
|
322
|
|
- createtime: 1710838418,
|
323
|
|
- updatename: "区域一",
|
324
|
|
- updatetime: 1710838430
|
325
|
|
- },
|
326
|
|
- {
|
327
|
|
- regionid: 3,
|
328
|
|
- regionName: "区域三",
|
329
|
|
- createname: "区域一",
|
330
|
|
- createtime: 1710838418,
|
331
|
|
- updatename: "区域一",
|
332
|
|
- updatetime: 1710838430
|
|
401
|
+ region_list({
|
|
402
|
+ page: this.searchForm.page,
|
|
403
|
+ size: this.searchForm.size,
|
|
404
|
+ regionName: this.searchForm.regionName
|
|
405
|
+ }).then((data) => {
|
|
406
|
+ if (data.code === 0) {
|
|
407
|
+ this.searchForm.list = data.obj.data;
|
|
408
|
+ this.searchForm.total = data.obj.total;
|
|
409
|
+ } else {
|
|
410
|
+ this.$Message.error(data.msg);
|
333
|
411
|
}
|
334
|
|
- ];
|
335
|
|
- this.searchForm.total = 3;
|
|
412
|
+ });
|
336
|
413
|
},
|
337
|
414
|
// 新建
|
338
|
415
|
toAdd() {
|
339
|
|
- this.regionInfo.show = true;
|
340
|
|
- this.regionInfo.regionName = "";
|
341
|
|
- this.regionInfo.admin = "";
|
342
|
|
- this.regionInfo.loginname = "";
|
343
|
|
- this.regionInfo.pwd = "";
|
344
|
|
- this.regionInfo.pwd1 = "";
|
345
|
|
- this.regionInfo.phone = "";
|
346
|
|
- this.regionInfo.code = "";
|
|
416
|
+ if (this.regionInfo.timer) {
|
|
417
|
+ clearTimeout(this.regionInfo.timer);
|
|
418
|
+ this.regionInfo.timer = null;
|
|
419
|
+ }
|
|
420
|
+ this.regionInfo = {
|
|
421
|
+ show: true,
|
|
422
|
+ // 验证码计时
|
|
423
|
+ timer: null,
|
|
424
|
+ second: 60,
|
|
425
|
+ regionName: "",
|
|
426
|
+ regionCode: "",
|
|
427
|
+ admin: {
|
|
428
|
+ aname: "",
|
|
429
|
+ loginname: "",
|
|
430
|
+ loginpwd: generateRandomString(8),
|
|
431
|
+ loginpwd1: "",
|
|
432
|
+ phone: "",
|
|
433
|
+ msgcode: "",
|
|
434
|
+ address: "",
|
|
435
|
+ comm: ""
|
|
436
|
+ }
|
|
437
|
+ };
|
347
|
438
|
},
|
348
|
439
|
// 保存新建
|
349
|
440
|
saveAddInfo() {
|
350
|
|
- this.regionInfo.show = false;
|
|
441
|
+ this.$refs.addForm.validate((valid) => {
|
|
442
|
+ if (valid) {
|
|
443
|
+ if (this.regionInfo.timer) {
|
|
444
|
+ clearTimeout(this.regionInfo.timer);
|
|
445
|
+ this.regionInfo.timer = null;
|
|
446
|
+ }
|
|
447
|
+ this.regionInfo.show = false;
|
|
448
|
+ region_add({
|
|
449
|
+ regionName: this.regionInfo.regionName,
|
|
450
|
+ regionCode: this.regionInfo.regionCode,
|
|
451
|
+ admin: {
|
|
452
|
+ aname: this.regionInfo.admin.aname,
|
|
453
|
+ loginname: this.regionInfo.admin.loginname,
|
|
454
|
+ loginpwd: this.regionInfo.admin.loginpwd,
|
|
455
|
+ phone: this.regionInfo.admin.phone,
|
|
456
|
+ msgcode: this.regionInfo.admin.msgcode,
|
|
457
|
+ address: this.regionInfo.admin.address,
|
|
458
|
+ comm: this.regionInfo.admin.comm
|
|
459
|
+ }
|
|
460
|
+ }).then((data) => {
|
|
461
|
+ if (data.code === 0) {
|
|
462
|
+ this.searchList();
|
|
463
|
+ this.$Message.success(data.msg);
|
|
464
|
+ } else {
|
|
465
|
+ this.$Message.error(data.msg);
|
|
466
|
+ }
|
|
467
|
+ });
|
|
468
|
+ }
|
|
469
|
+ });
|
351
|
470
|
},
|
352
|
471
|
// 进入
|
353
|
472
|
toEnter() {
|
|
@@ -357,21 +476,18 @@ export default {
|
357
|
476
|
});
|
358
|
477
|
},
|
359
|
478
|
// 查看
|
360
|
|
- toView() {
|
361
|
|
- this.viewInfo.show = true;
|
362
|
|
- this.viewInfo.regionName = "河南星火燎原软件科技有限公司";
|
363
|
|
- this.viewInfo.list = [
|
364
|
|
- {
|
365
|
|
- admin: "周文彦",
|
366
|
|
- loginname: "zhouwenyan@xhkjedu.com",
|
367
|
|
- phone: "15610230213"
|
368
|
|
- },
|
369
|
|
- {
|
370
|
|
- admin: "齐思宇",
|
371
|
|
- loginname: "zhouwenyan@xhkjedu.com",
|
372
|
|
- phone: "15610230213"
|
|
479
|
+ toView(row) {
|
|
480
|
+ region_list_admin({
|
|
481
|
+ regionid: row.regionid
|
|
482
|
+ }).then((data) => {
|
|
483
|
+ if (data.code === 0) {
|
|
484
|
+ this.viewInfo.show = true;
|
|
485
|
+ this.viewInfo.regionName = row.regionName;
|
|
486
|
+ this.viewInfo.list = data.obj;
|
|
487
|
+ } else {
|
|
488
|
+ this.$Message.error(data.msg);
|
373
|
489
|
}
|
374
|
|
- ];
|
|
490
|
+ });
|
375
|
491
|
},
|
376
|
492
|
// 编辑
|
377
|
493
|
toEdit(row) {
|
|
@@ -379,11 +495,23 @@ export default {
|
379
|
495
|
this.regionInfo.regionid = row.regionid;
|
380
|
496
|
},
|
381
|
497
|
// 删除
|
382
|
|
- toDel() {
|
|
498
|
+ toDel(row) {
|
383
|
499
|
this.$Modal.confirm({
|
384
|
500
|
title: "提示",
|
385
|
501
|
content: "您确定删除选中数据吗?",
|
386
|
|
- onOk: () => {},
|
|
502
|
+ onOk: () => {
|
|
503
|
+ region_delete({
|
|
504
|
+ regionid: row.regionid,
|
|
505
|
+ rversion: row.rversion
|
|
506
|
+ }).then((data) => {
|
|
507
|
+ if (data.code === 0) {
|
|
508
|
+ this.searchList();
|
|
509
|
+ this.$Message.success(data.msg);
|
|
510
|
+ } else {
|
|
511
|
+ this.$Message.error(data.msg);
|
|
512
|
+ }
|
|
513
|
+ });
|
|
514
|
+ },
|
387
|
515
|
onCancel: () => {}
|
388
|
516
|
});
|
389
|
517
|
}
|