Bläddra i källkod

拉黑用户,用户日志

魏熙美 6 år sedan
förälder
incheckning
444b314e38

+ 1
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ITaUserService.java Visa fil

@@ -21,7 +21,7 @@ public interface ITaUserService {
21 21
      * @param user
22 22
      */
23 23
     default void checkVerifyStatusUser(TaUser user) {
24
-        if (Constant.INVALID_VERIFY_STATUS.equals(user.getVerifyStatus())) {
24
+        if (Constant.BLACKLIST_STATUS.equals(user.getStatus())) {
25 25
             throw new WisdomException("关联账户违反社区规定,无法使用");
26 26
         }
27 27
     }

+ 5
- 0
CODE/smart-community/community-common/src/main/java/com/community/commom/constant/Constant.java Visa fil

@@ -204,4 +204,9 @@ public class Constant {
204 204
      * 认证作废
205 205
      */
206 206
     public static final String INVALID_VERIFY_STATUS = "3";
207
+
208
+    /**
209
+     * 人员状态  拉黑 (运营端操作 APP端的用户)
210
+     */
211
+    public static final String BLACKLIST_STATUS = "2";
207 212
 }

+ 58
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/controller/TaUserController.java Visa fil

@@ -0,0 +1,58 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.huiju.common.base.BaseController;
5
+import com.community.huiju.service.ITaUserService;
6
+import io.swagger.annotations.Api;
7
+import io.swagger.annotations.ApiImplicitParam;
8
+import io.swagger.annotations.ApiImplicitParams;
9
+import io.swagger.annotations.ApiOperation;
10
+import org.springframework.beans.factory.annotation.Autowired;
11
+import org.springframework.cloud.context.config.annotation.RefreshScope;
12
+import org.springframework.web.bind.annotation.*;
13
+
14
+import java.util.List;
15
+
16
+/**
17
+ * 移动端 用户
18
+ */
19
+@RestController
20
+@RequestMapping("/")
21
+@RefreshScope
22
+@Api(value = "移动用户API",description = "移动用户API")
23
+public class TaUserController  extends BaseController {
24
+
25
+    @Autowired
26
+    private ITaUserService iTaUserService;
27
+
28
+    @ApiOperation("查询所有用户")
29
+    @ApiImplicitParams({
30
+            @ApiImplicitParam(paramType = "query", dataTypeClass = String.class, name = "userName", value = "用户名"),
31
+            @ApiImplicitParam(paramType = "query", dataTypeClass = String.class, name = "loginName", value = "手机号"),
32
+            @ApiImplicitParam(paramType = "query", dataTypeClass = String.class, name = "idCard", value = "身份证"),
33
+            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "pageNum", value = "当前页"),
34
+            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "pageSize", value = "一页多少行"),
35
+    })
36
+    @RequestMapping(value = "/ta/user/getAll", method = RequestMethod.GET)
37
+    public ResponseBean getAll(@RequestParam(value = "userName", required = false) String userName,
38
+                               @RequestParam(value = "loginName", required = false)String loginName,
39
+                               @RequestParam(value = "idCard", required = false)String idCard,
40
+                               @RequestParam(value = "pageNum", defaultValue = "1")Integer pageNum,
41
+                               @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize) {
42
+        ResponseBean responseBean = new ResponseBean();
43
+        responseBean = iTaUserService.getAll(userName, loginName, idCard, pageNum, pageSize);
44
+        return responseBean;
45
+    }
46
+
47
+    @ApiOperation("拉黑用户")
48
+    @ApiImplicitParams({
49
+            @ApiImplicitParam(paramType = "body", dataTypeClass = String.class, name = "ids", value = "id集合"),
50
+    })
51
+    @RequestMapping(value = "/ta/user/blacklist", method = RequestMethod.PUT)
52
+    public ResponseBean blacklistTaUser(@RequestBody List<Integer> ids) {
53
+        ResponseBean responseBean = new ResponseBean();
54
+        responseBean = iTaUserService.blacklistTaUser(ids);
55
+        return responseBean;
56
+    }
57
+
58
+}

+ 8
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/dao/TaUserMapper.java Visa fil

@@ -3,6 +3,8 @@ package com.community.huiju.dao;
3 3
 import com.community.huiju.model.TaUser;
4 4
 import org.apache.ibatis.annotations.Mapper;
5 5
 import org.apache.ibatis.annotations.Param;
6
+import org.apache.ibatis.annotations.ResultMap;
7
+import org.apache.ibatis.annotations.Select;
6 8
 
7 9
 import java.util.List;
8 10
 import java.util.Map;
@@ -82,4 +84,10 @@ public interface TaUserMapper {
82 84
      * @return
83 85
      */
84 86
     Integer getOwnerCount();
87
+
88
+    /**
89
+     * 查询所有用户列表
90
+     * @return
91
+     */
92
+    List<TaUser> selectAll(String userName, String loginName, String idCard);
85 93
 }

+ 31
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/TaUser.java Visa fil

@@ -39,6 +39,13 @@ public class TaUser {
39 39
 
40 40
     private Date updateDate;
41 41
 
42
+    // 身份证
43
+    private String idCard;
44
+
45
+    private String openid;
46
+
47
+    private String nickname;
48
+
42 49
     /**
43 50
      * 海康人员编号
44 51
      */
@@ -250,4 +257,28 @@ public class TaUser {
250 257
     public void setHkPersonNo(Long hkPersonNo) {
251 258
         this.hkPersonNo = hkPersonNo;
252 259
     }
260
+
261
+    public String getIdCard() {
262
+        return idCard;
263
+    }
264
+
265
+    public void setIdCard(String idCard) {
266
+        this.idCard = idCard;
267
+    }
268
+
269
+    public String getOpenid() {
270
+        return openid;
271
+    }
272
+
273
+    public void setOpenid(String openid) {
274
+        this.openid = openid;
275
+    }
276
+
277
+    public String getNickname() {
278
+        return nickname;
279
+    }
280
+
281
+    public void setNickname(String nickname) {
282
+        this.nickname = nickname;
283
+    }
253 284
 }

+ 20
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/ITaUserService.java Visa fil

@@ -2,6 +2,8 @@ package com.community.huiju.service;
2 2
 
3 3
 import com.community.commom.mode.ResponseBean;
4 4
 
5
+import java.util.List;
6
+
5 7
 public interface ITaUserService {
6 8
 
7 9
     /**
@@ -12,4 +14,22 @@ public interface ITaUserService {
12 14
      */
13 15
     ResponseBean getByUserTypeCount();
14 16
 
17
+    /**
18
+     * 查询所有的 用户
19
+     * @param userName
20
+     * @param loginName
21
+     * @param idCard
22
+     * @param pageNum
23
+     * @param pageSize
24
+     * @return
25
+     */
26
+    ResponseBean getAll(String userName, String loginName, String idCard, Integer pageNum, Integer pageSize);
27
+
28
+    /**
29
+     * 批量拉黑用户
30
+     * @param ids
31
+     * @return
32
+     */
33
+    ResponseBean blacklistTaUser(List<Integer> ids);
34
+
15 35
 }

+ 38
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java Visa fil

@@ -2,11 +2,16 @@ package com.community.huiju.service.impl;
2 2
 
3 3
 import com.community.commom.mode.ResponseBean;
4 4
 import com.community.huiju.dao.TaUserMapper;
5
+import com.community.huiju.exception.WisdomException;
6
+import com.community.huiju.model.TaUser;
5 7
 import com.community.huiju.service.ITaUserService;
8
+import com.github.pagehelper.Page;
9
+import com.github.pagehelper.PageHelper;
6 10
 import com.google.common.collect.Lists;
7 11
 import com.google.common.collect.Maps;
8 12
 import org.springframework.beans.factory.annotation.Autowired;
9 13
 import org.springframework.stereotype.Service;
14
+import org.springframework.transaction.annotation.Transactional;
10 15
 
11 16
 import java.util.List;
12 17
 import java.util.Map;
@@ -47,4 +52,37 @@ public class TaUserServiceImpl implements ITaUserService {
47 52
         return responseBean;
48 53
     }
49 54
 
55
+    @Override
56
+    public ResponseBean getAll(String userName, String loginName, String idCard, Integer pageNum, Integer pageSize) {
57
+        ResponseBean responseBean = new ResponseBean();
58
+
59
+        Page<TaUser> page = PageHelper.startPage(pageNum, pageSize);
60
+        List<TaUser> userList = taUserMapper.selectAll(userName, loginName, idCard);
61
+
62
+        Map<String, Object> map = Maps.newHashMap();
63
+        map.put("item", userList);
64
+        map.put("total", page.getTotal());
65
+        map.put("pageNum", page.getPageNum());
66
+        map.put("pageSize", page.getPageSize());
67
+        responseBean.addSuccess(map);
68
+        return responseBean;
69
+    }
70
+
71
+    @Override
72
+    @Transactional(rollbackFor = Exception.class)
73
+    public ResponseBean blacklistTaUser(List<Integer> ids) {
74
+        ResponseBean responseBean = new ResponseBean();
75
+
76
+        ids.forEach(e -> {
77
+            TaUser user = taUserMapper.selectByPrimaryKey(e);
78
+            if (null == user) {
79
+                throw new WisdomException("用户不存在");
80
+            }
81
+            user.setStatus("2");
82
+            taUserMapper.updateByPrimaryKeySelective(user);
83
+        });
84
+
85
+        responseBean.addSuccess("操作成功");
86
+        return responseBean;
87
+    }
50 88
 }

+ 58
- 4
CODE/smart-community/operate-api/src/main/resources/mapper/TaUserMapper.xml Visa fil

@@ -24,11 +24,14 @@
24 24
     <result column="hk_user_id" property="hkUserId" jdbcType="INTEGER" />
25 25
     <result column="hk_card_no" property="hkCardNo" jdbcType="VARCHAR" />
26 26
     <result column="face_status" property="faceStatus" jdbcType="CHAR" />
27
+    <result column="id_card" property="idCard" jdbcType="INTEGER"/>
28
+    <result column="openid" property="openid" jdbcType="VARCHAR" />
29
+    <result column="nickname" property="nickname" jdbcType="VARCHAR" />
27 30
   </resultMap>
28 31
   <sql id="Base_Column_List" >
29 32
     id, community_id, building_owner_info_id, head_portrait, user_name, login_name, login_password,
30 33
     email, gender, status, remark, parent_id, accept_agreement_status, verify_status,
31
-    create_user, create_date, update_user, update_date, hk_person_no , hk_user_id, hk_card_no, face_status
34
+    create_user, create_date, update_user, update_date, hk_person_no, hk_user_id, hk_card_no, face_status, id_card, openid, nickname
32 35
   </sql>
33 36
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
34 37
     select
@@ -47,7 +50,7 @@
47 50
       status, remark, parent_id,
48 51
       accept_agreement_status, verify_status, create_user,
49 52
       create_date, update_user, update_date, hk_person_no,
50
-      hk_user_id, hk_card_no, face_status
53
+      hk_user_id, hk_card_no, face_status, id_card, openid, nickname
51 54
       )
52 55
     values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{buildingOwnerInfoId,jdbcType=INTEGER},
53 56
       #{headPortrait,jdbcType=VARCHAR}, #{userName,jdbcType=VARCHAR}, #{loginName,jdbcType=VARCHAR},
@@ -55,7 +58,8 @@
55 58
       #{status,jdbcType=CHAR}, #{remark,jdbcType=VARCHAR}, #{parentId,jdbcType=INTEGER},
56 59
       #{acceptAgreementStatus,jdbcType=CHAR}, #{verifyStatus,jdbcType=CHAR}, #{createUser,jdbcType=INTEGER},
57 60
       #{createDate,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER}, #{updateDate,jdbcType=TIMESTAMP},
58
-      #{hkPersonNo,jdbcType=BIGINT}, #{hkUserId,jdbcType=INTEGER}, #{hkCardNo,jdbcType=VARCHAR}, #{faceStatus,jdbcType=CHAR}
61
+      #{hkPersonNo,jdbcType=BIGINT}, #{hkUserId,jdbcType=INTEGER}, #{hkCardNo,jdbcType=VARCHAR}, #{faceStatus,jdbcType=CHAR},
62
+      #{idCard,jdbcType=VARCHAR}, #{openid,jdbcType=VARCHAR}, #{nickname,jdbcType=VARCHAR},
59 63
       )
60 64
   </insert>
61 65
   <insert id="insertSelective" parameterType="com.community.huiju.model.TaUser" useGeneratedKeys="true" keyProperty="id" >
@@ -127,6 +131,15 @@
127 131
       <if test="faceStatus != null" >
128 132
         face_status,
129 133
       </if>
134
+      <if test="idCard != null">
135
+        id_card,
136
+      </if>
137
+      <if test="openid != null" >
138
+        openid,
139
+      </if>
140
+      <if test="nickname != null" >
141
+        nickname,
142
+      </if>
130 143
     </trim>
131 144
     <trim prefix="values (" suffix=")" suffixOverrides="," >
132 145
       <if test="id != null" >
@@ -195,6 +208,15 @@
195 208
       <if test="faceStatus != null" >
196 209
         #{faceStatus,jdbcType=CHAR},
197 210
       </if>
211
+      <if test="idCard != null">
212
+        #{idCard,jdbcType=VARCHAR},
213
+      </if>
214
+      <if test="openid != null" >
215
+        #{openid,jdbcType=VARCHAR},
216
+      </if>
217
+      <if test="nickname != null" >
218
+        #{nickname,jdbcType=VARCHAR},
219
+      </if>
198 220
     </trim>
199 221
   </insert>
200 222
   <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TaUser" >
@@ -263,6 +285,15 @@
263 285
       <if test="faceStatus != null" >
264 286
         face_status = #{faceStatus,jdbcType=CHAR},
265 287
       </if>
288
+      <if test="idCard != null">
289
+        id_card = #{idCard,jdbcType=VARCHAR},
290
+      </if>
291
+      <if test="openid != null" >
292
+        openid = #{openid,jdbcType=VARCHAR},
293
+      </if>
294
+      <if test="nickname != null" >
295
+        nickname = #{nickname,jdbcType=VARCHAR},
296
+      </if>
266 297
     </set>
267 298
     where id = #{id,jdbcType=INTEGER}
268 299
   </update>
@@ -288,7 +319,10 @@
288 319
       hk_person_no = #{hkPersonNo,jdbcType=BIGINT},
289 320
       hk_user_id = #{hkUserId,jdbcType=INTEGER},
290 321
       hk_card_no = #{hkCardNo,jdbcType=VARCHAR},
291
-      face_status = #{faceStatus,jdbcType=CHAR}
322
+      face_status = #{faceStatus,jdbcType=CHAR},
323
+      id_card = #{idCard,jdbcType=VARCHAR},
324
+      openid = #{openid,jdbcType=VARCHAR},
325
+      nickname = #{nickname,jdbcType=VARCHAR}
292 326
     where id = #{id,jdbcType=INTEGER}
293 327
   </update>
294 328
 
@@ -357,4 +391,24 @@
357 391
     INNER JOIN ta_sys_user_role tsur on tu.id = tsur.user_id where tsur.role_id != 2
358 392
   </select>
359 393
 
394
+  <select id="selectAll" resultMap="BaseResultMap" >
395
+    select
396
+    <include refid="Base_Column_List"/>
397
+    from ta_user
398
+    <where>
399
+      <trim suffixOverrides="or | and">
400
+        <if test="userName != null and userName != ''" >
401
+          and user_name like CONCAT('%', #{userName,jdbcType=VARCHAR}, '%')
402
+        </if>
403
+        <if test="loginName != null and loginName != ''" >
404
+          and login_name like CONCAT('%', #{loginName,jdbcType=VARCHAR}, '%')
405
+        </if>
406
+        <if test="idCard != null and idCard != ''">
407
+          and id_card like CONCAT('%', #{idCard,jdbcType=VARCHAR}, '%')
408
+        </if>
409
+        and id != -1
410
+      </trim>
411
+    </where>
412
+  </select>
413
+
360 414
 </mapper>

+ 25
- 0
VUECODE/smart-operate-manage/src/api/user.js Visa fil

@@ -79,3 +79,28 @@ export function upDateStatus(data) {
79 79
     }
80 80
   })
81 81
 }
82
+
83
+// 查询所有的 移动端用户
84
+export function getTaUserAll(data) {
85
+  return request({
86
+    url: '/ta/user/getAll',
87
+    method: 'get',
88
+    params: {
89
+      userName: data.userName, // 用户名
90
+      loginName: data.loginName, // 手机号
91
+      idCard: data.idCard, // 身份证号
92
+      pageNum: data.pageNum,
93
+      pageSize: data.pageSize
94
+    }
95
+  })
96
+}
97
+
98
+// 拉黑 移动端用户用户
99
+export function blacklistUser(data) {
100
+  return request({
101
+    url: '/ta/user/blacklist',
102
+    method: 'put',
103
+    data
104
+  })
105
+}
106
+

+ 12
- 0
VUECODE/smart-operate-manage/src/router/index.js Visa fil

@@ -35,6 +35,18 @@ export const constantRouterMap = [
35 35
         component: () => import('@/views/community/communityTable'),
36 36
         name: 'community',
37 37
         meta: { title: '社区列表', icon: 'community' }
38
+      },
39
+      {
40
+        path: '/user/management',
41
+        component: () => import('@/views/community/user/index'),
42
+        name: 'user-management',
43
+        meta: { title: '用户列表', icon: 'user' }
44
+      },
45
+      {
46
+        path: '/user/log',
47
+        component: () => import('@/views/community/user/log/index'),
48
+        name: 'user-log',
49
+        meta: { title: '用户日志', icon: 'user' }
38 50
       }
39 51
     ]
40 52
   },

+ 19
- 1
VUECODE/smart-operate-manage/src/store/modules/user.js Visa fil

@@ -1,6 +1,6 @@
1 1
 import { login, logOut, getInfo, sendCode } from '@/api/login'
2 2
 import { getToken, setToken, removeToken } from '@/utils/auth'
3
-import { employeesList, userRoleById, addUser, selectUser, upDate, upDateStatus } from '@/api/user'
3
+import { employeesList, userRoleById, addUser, selectUser, upDate, upDateStatus, getTaUserAll, blacklistUser } from '@/api/user'
4 4
 
5 5
 const user = {
6 6
   state: {
@@ -161,6 +161,24 @@ const user = {
161 161
           reject(error)
162 162
         })
163 163
       })
164
+    },
165
+    GetTaUserAll({ commit }, data) { // 获取所有 移动端用户
166
+      return new Promise((resolve, reject) => {
167
+        getTaUserAll(data).then(response => {
168
+          resolve(response)
169
+        }).catch(error => {
170
+          reject(error)
171
+        })
172
+      })
173
+    },
174
+    BlacklistUser({ commit }, data) { // 拉黑移动端用户
175
+      return new Promise((resolve, reject) => {
176
+        blacklistUser(data).then(response => {
177
+          resolve(response)
178
+        }).catch(error => {
179
+          reject(error)
180
+        })
181
+      })
164 182
     }
165 183
   }
166 184
 }

+ 1
- 1
VUECODE/smart-operate-manage/src/views/account/role/edi/index.vue Visa fil

@@ -59,7 +59,7 @@ export default {
59 59
     }
60 60
   },
61 61
   mounted() {
62
-    this.ruleForm.id = this.$route.params.id
62
+    this.ruleForm.id = this.$route.query.id
63 63
     // 获取用户数据
64 64
     this.getInfo()
65 65
   },

+ 2
- 2
VUECODE/smart-operate-manage/src/views/account/role/index.vue Visa fil

@@ -181,13 +181,13 @@ export default {
181 181
         this.$message.error('只能选择一行数据!')
182 182
         return
183 183
       }
184
-      this.$router.push({ name: 'role-edi', params: { id: ids[0] }})
184
+      this.$router.push({ name: 'role-edi', query: { id: ids[0] }})
185 185
     },
186 186
     addRole() { // 添加角色
187 187
       this.$router.push({ name: 'role-add' })
188 188
     },
189 189
     infoRole(id) { // 查看角色详情
190
-      this.$router.push({ name: 'role-info', params: { id: id }})
190
+      this.$router.push({ name: 'role-info', query: { id: id }})
191 191
     }
192 192
   }
193 193
 }

+ 2
- 2
VUECODE/smart-operate-manage/src/views/account/role/info/index.vue Visa fil

@@ -59,13 +59,13 @@ export default {
59 59
     }
60 60
   },
61 61
   mounted() {
62
-    this.ruleForm.id = this.$route.params.id
62
+    this.ruleForm.id = this.$route.query.id
63 63
     // 获取用户数据
64 64
     this.getInfo()
65 65
   },
66 66
   methods: {
67 67
     submitForm(formName) {
68
-      this.$router.push({ name: 'role-edi', params: { id: this.ruleForm.id }})
68
+      this.$router.push({ name: 'role-edi', query: { id: this.ruleForm.id }})
69 69
     },
70 70
     resetForm() {
71 71
       // this.$refs[formName].resetFields()

+ 190
- 0
VUECODE/smart-operate-manage/src/views/community/user/index.vue Visa fil

@@ -0,0 +1,190 @@
1
+<template>
2
+  <div id="root">
3
+    <el-form :inline="true" :model="formInline" class="demo-form-inline">
4
+      <el-form-item label="用户姓名">
5
+        <el-input v-model="formInline.userName" placeholder="用户姓名"/>
6
+      </el-form-item>
7
+      <el-form-item label="手机号">
8
+        <el-input v-model="formInline.loginName" placeholder="手机号"/>
9
+      </el-form-item>
10
+      <el-form-item label="身份证号">
11
+        <el-input v-model="formInline.idCard" placeholder="身份证号"/>
12
+      </el-form-item>
13
+      <el-form-item>
14
+        <el-button type="info" @click="clear">清空</el-button>
15
+        <el-button type="primary" @click="searchData">查询</el-button>
16
+      </el-form-item>
17
+    </el-form>
18
+    <div class="button-div">
19
+      <el-button type="warning" @click="blacklistUser">拉黑</el-button>
20
+    </div>
21
+    <el-table
22
+      ref="multipleTable"
23
+      :data="users"
24
+      border
25
+      tooltip-effect="dark"
26
+      style="width: 100%;margin-top: 20px;"
27
+      @selection-change="handleSelectionChange">
28
+      <el-table-column
29
+        align="center"
30
+        type="selection"
31
+        width="55"/>
32
+      <el-table-column
33
+        align="center"
34
+        prop="userName"
35
+        label="姓名"/>
36
+      <el-table-column
37
+        align="center"
38
+        prop="loginName"
39
+        label="手机号"
40
+        width="120"/>
41
+      <el-table-column
42
+        align="center"
43
+        prop="idCard"
44
+        label="身份证号"/>
45
+      <el-table-column
46
+        align="center"
47
+        prop="gender"
48
+        label="性别">
49
+        <template slot-scope="scope">{{ scope.row.gender === '1' ? '男' : '女' }}</template>
50
+      </el-table-column>
51
+      <el-table-column
52
+        align="center"
53
+        prop="status"
54
+        label="账号状态">
55
+        <template slot-scope="scope">{{ scope.row.status === '2' ? '黑名单' : '正常' }}</template>
56
+      </el-table-column>
57
+      <el-table-column
58
+        align="center"
59
+        prop="createDate"
60
+        label="注册时间">
61
+        <template slot-scope="scope">{{ formatDate(scope.row.createDate) }}</template>
62
+      </el-table-column>
63
+      <el-table-column
64
+        align="center"
65
+        label="日志数据">
66
+        <template slot-scope="scope">
67
+          <el-button type="primary" @click="lookUserLog(scope.row.id)">查看</el-button>
68
+        </template>
69
+      </el-table-column>
70
+    </el-table>
71
+    <div class="footer-page">
72
+      <el-pagination
73
+        :current-page="formInline.pageNum"
74
+        :page-sizes="[10, 20, 40, 100]"
75
+        :page-size="formInline.pageSize"
76
+        :total="total"
77
+        layout="total, sizes, prev, pager, next, jumper"
78
+        @size-change="handleSizeChange"
79
+        @current-change="handleCurrentChange"/>
80
+    </div>
81
+  </div>
82
+</template>
83
+
84
+<script>
85
+export default {
86
+  name: 'UserManagement',
87
+  data() {
88
+    return {
89
+      formInline: {
90
+        userName: '', // 用户名
91
+        loginName: '', // 手机号
92
+        idCard: '', // 身份证号
93
+        pageNum: 1,
94
+        pageSize: 10
95
+      },
96
+      total: 0, // 总数
97
+      users: [], // 用户数据
98
+      ids: [] // 选中的id 集合
99
+    }
100
+  },
101
+  mounted() {
102
+    this.getData()
103
+  },
104
+  methods: {
105
+    clear() { // 清除
106
+      this.formInline.userName = ''
107
+      this.formInline.loginName = ''
108
+      this.formInline.idCard = ''
109
+      this.formInline.pageNum = 1
110
+      this.formInline.pageSize = 10
111
+      this.getData()
112
+    },
113
+    handleSelectionChange(val) { // 选中
114
+      this.ids = []
115
+      val.map((item, index) => {
116
+        this.ids.push(item.id)
117
+      })
118
+    },
119
+    handleSizeChange(val) {
120
+      console.log(`每页 ${val} 条`)
121
+    },
122
+    handleCurrentChange(val) {
123
+      console.log(`当前页: ${val}`)
124
+    },
125
+    searchData() { // 搜索
126
+      this.formInline.pageNum = 1
127
+      this.formInline.pageSize = 10
128
+      this.getData()
129
+    },
130
+    getData() {
131
+      this.$store.dispatch('GetTaUserAll', this.formInline).then((res) => {
132
+        const resCode = res.code
133
+        if (resCode === '0') {
134
+          const resData = res.data
135
+          this.users = resData.item
136
+          this.total = resData.total
137
+          this.formInline.pageNum = resData.pageNum
138
+          this.formInline.pageSize = resData.pageSize
139
+        }
140
+      }).catch(() => {
141
+        console.log('GetTaUserAll error')
142
+      })
143
+    },
144
+    formatDate(val) {
145
+      if (val === null) {
146
+        return
147
+      }
148
+      var value = new Date(val)
149
+      var year = value.getFullYear()
150
+      var month = value.getMonth() + 1
151
+      var day = value.getDate()
152
+      // var hour = value.getHours()
153
+      // var minutes = value.getMinutes()
154
+      // var seconds = value.getSeconds()
155
+      // return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes + ':' + seconds
156
+      return year + '-' + month + '-' + day
157
+    },
158
+    lookUserLog(id) { // 跳转查看用户日志
159
+      this.$router.push({ name: 'user-log', query: { id: id }})
160
+    },
161
+    blacklistUser() { // 拉黑移动端用户
162
+      this.$store.dispatch('BlacklistUser', this.ids).then((res) => {
163
+        const resCode = res.code
164
+        if (resCode === '1') {
165
+          this.$message.error(res.message)
166
+          return
167
+        }
168
+        this.$message.success(res.message)
169
+        this.getData()
170
+      }).catch(() => {
171
+        console.log('BlacklistUser error')
172
+      })
173
+    }
174
+  }
175
+}
176
+</script>
177
+
178
+<style scoped>
179
+.demo-form-inline {
180
+  margin-left: 20px;
181
+  margin-top: 20px;
182
+}
183
+.button-div {
184
+  margin-left: 20px;
185
+}
186
+.footer-page {
187
+  display: flex;
188
+  justify-content: flex-end;
189
+}
190
+</style>

+ 100
- 0
VUECODE/smart-operate-manage/src/views/community/user/log/index.vue Visa fil

@@ -0,0 +1,100 @@
1
+<template>
2
+  <div id="root">
3
+    <el-form :inline="true" :model="formInline" class="demo-form-inline">
4
+      <el-form-item label="操作类型">
5
+        <el-select v-model="formInline.logType" placeholder="操作类型">
6
+          <el-option label="账号相关操作" value="shanghai"/>
7
+          <el-option label="话题相关操作" value="beijing"/>
8
+          <el-option label="工单相关操作" value="beijing"/>
9
+          <el-option label="费用相关操作" value="beijing"/>
10
+          <el-option label="其他操作" value="beijing"/>
11
+        </el-select>
12
+      </el-form-item>
13
+      <el-form-item label="日志关键字">
14
+        <el-input v-model="formInline.logContext" placeholder="日志关键字"/>
15
+      </el-form-item>
16
+      <el-form-item label="日志日期">
17
+        <el-date-picker
18
+          v-model="formInline.logDate"
19
+          type="daterange"
20
+          range-separator="至"
21
+          start-placeholder="开始日期"
22
+          end-placeholder="结束日期"/>
23
+      </el-form-item>
24
+      <el-form-item>
25
+        <el-button type="info">清空</el-button>
26
+        <el-button type="primary">查询</el-button>
27
+      </el-form-item>
28
+    </el-form>
29
+
30
+    <!-- 表格 -->
31
+    <el-table
32
+      :data="logData"
33
+      border
34
+      style="width: 100%">
35
+      <el-table-column
36
+        prop="date"
37
+        label="编号"
38
+        width="180"/>
39
+      <el-table-column
40
+        prop="name"
41
+        label="操作类型"
42
+        width="180"/>
43
+      <el-table-column
44
+        prop="address"
45
+        label="日志类型"/>
46
+      <el-table-column
47
+        prop="address"
48
+        label="日志时间"/>
49
+    </el-table>
50
+
51
+    <div class="footer-page">
52
+      <el-pagination
53
+        :current-page="formInline.pageNum"
54
+        :page-sizes="[100, 200, 300, 400]"
55
+        :page-size="formInline.pageSize"
56
+        :total="total"
57
+        layout="total, sizes, prev, pager, next, jumper"
58
+        @size-change="handleSizeChange"
59
+        @current-change="handleCurrentChange"/>
60
+    </div>
61
+  </div>
62
+</template>
63
+
64
+<script>
65
+export default {
66
+  name: 'UserLog',
67
+  data() {
68
+    return {
69
+      formInline: {
70
+        logDate: '',
71
+        logContext: '',
72
+        logType: '',
73
+        pageNum: 0,
74
+        pageSize: 10
75
+      },
76
+      total: 0, // 总数
77
+      logData: [] // 数据
78
+    }
79
+  },
80
+  methods: {
81
+    handleSizeChange(val) {
82
+      console.log(`每页 ${val} 条`)
83
+    },
84
+    handleCurrentChange(val) {
85
+      console.log(`当前页: ${val}`)
86
+    }
87
+  }
88
+}
89
+</script>
90
+
91
+<style scoped>
92
+.demo-form-inline {
93
+  margin-top: 20px;
94
+  margin-left: 20px;
95
+}
96
+.footer-page {
97
+  display: flex;
98
+  justify-content: flex-end;
99
+}
100
+</style>