weiximei 6 anos atrás
pai
commit
dfcda91685

+ 5
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/RoleMapper.java Ver arquivo

@@ -1,11 +1,15 @@
1 1
 package com.community.huiju.dao;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
4 5
 import com.community.huiju.model.SysRole;
6
+import com.community.huiju.model.TpTransaction;
5 7
 import com.community.huiju.model.User;
6 8
 import org.apache.ibatis.annotations.Mapper;
7 9
 import org.apache.ibatis.annotations.Param;
8 10
 
11
+import java.util.List;
12
+
9 13
 /**
10 14
  * <p>
11 15
  * 物业web端用户表 Mapper 接口
@@ -16,4 +20,5 @@ import org.apache.ibatis.annotations.Param;
16 20
  */
17 21
 @Mapper
18 22
 public interface RoleMapper extends BaseMapper<SysRole> {
23
+	List<SysRole> getRoleListByParams(Page page,@Param("role") SysRole role);
19 24
 }

+ 10
- 2
CODE/smart-community/property-api/src/main/java/com/community/huiju/model/SysRole.java Ver arquivo

@@ -58,6 +58,14 @@ public class SysRole implements Serializable {
58 58
      * 更新时间
59 59
      */
60 60
     private LocalDateTime updateDate;
61
-
62
-
61
+    
62
+    /**
63
+     * 创建人
64
+     */
65
+    private String createName;
66
+    
67
+    /**
68
+     * 更新人
69
+     */
70
+    private String updateName;
63 71
 }

+ 2
- 2
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/RoleServiceImpl.java Ver arquivo

@@ -44,11 +44,11 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, SysRole> implements
44 44
 		SysRole role = new SysRole();
45 45
 		role.setRoleName(roleName);
46 46
 		role.setCommunityId(userElement.getCommunityId());
47
-		List<TpTransaction> list = roleMapper.getRoleListByParams(page,role);
47
+		List<SysRole> list = roleMapper.getRoleListByParams(page,role);
48 48
 		Map<String, Object> map = Maps.newHashMap();
49 49
 		map.put("list",list);
50 50
 		map.put("total",page.getTotal());
51 51
 		responseBean.addSuccess(map);
52
-		return null;
52
+		return responseBean;
53 53
 	}
54 54
 }

+ 26
- 2
CODE/smart-community/property-api/src/main/resources/mapper/SysRoleMapper.xml Ver arquivo

@@ -1,5 +1,29 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
-<mapper namespace="com.community.huiju.tp.mapper.SysRoleMapper">
4
-
3
+<mapper namespace="com.community.huiju.dao.RoleMapper">
4
+    <select id="getRoleListByParams" resultType="com.community.huiju.model.SysRole">
5
+        SELECT
6
+            t.id,
7
+            t.community_id as communityId,
8
+            t.role_name AS roleName,
9
+            t.description,
10
+            t.create_user AS createUser,
11
+            t.create_date AS createDate,
12
+            t.update_user AS updateUser,
13
+            t.update_date AS updateDate,
14
+            u.user_name as createName,
15
+            uu.user_name as updateName
16
+        FROM
17
+            tp_sys_role t
18
+        LEFT JOIN tp_user u ON t.create_user = u.id AND u.community_id = #{role.communityId}
19
+        LEFT JOIN tp_user uu ON t.create_user = uu.id AND uu.community_id = #{role.communityId}
20
+        where
21
+          1 = 1
22
+        AND t.community_id = #{role.communityId}
23
+        <if test="role.roleName != null and role.roleName != ''">
24
+            and t.roleName like concat('%',#{role.roleName,jdbcType=VARCHAR},'%')
25
+        </if>
26
+        ORDER BY
27
+            t.create_date DESC
28
+    </select>
5 29
 </mapper>

+ 7
- 0
VUECODE/smart-property-manage/src/router/index.js Ver arquivo

@@ -192,6 +192,13 @@ export const constantRouterMap = [
192 192
         component: () => import('@/views/account/role'),
193 193
         name: 'role-index',
194 194
         meta: { title: '角色管理', icon: 'table' }
195
+      },
196
+      {
197
+        path: '/account/add',
198
+        component: () => import('@/views/account/add/role-add'),
199
+        name: 'role-add',
200
+        hidden: true,
201
+        meta: { title: '添加角色', icon: 'table' }
195 202
       }
196 203
     ]
197 204
   },

+ 1
- 1
VUECODE/smart-property-manage/src/store/modules/role.js Ver arquivo

@@ -9,7 +9,7 @@ const transaction = {
9 9
 
10 10
   mutations: {
11 11
     SET_LIST: (state, list) => {
12
-      state.transactionList = list
12
+      state.roleList = list
13 13
     },
14 14
     SET_TOTAL: (state, total) => {
15 15
       state.total = total

+ 88
- 0
VUECODE/smart-property-manage/src/views/account/add/role-add.vue Ver arquivo

@@ -0,0 +1,88 @@
1
+<template>
2
+  <div class="root">
3
+    <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="100px" class="add-ruleForm">
4
+      <el-form-item label="角色名称" prop="phase">
5
+        <el-input v-model="ruleForm.phase"/>
6
+      </el-form-item>
7
+      <el-form-item label="角色描述" prop="building">
8
+        <el-input v-model="ruleForm.building"/>
9
+      </el-form-item>
10
+      <el-form-item>
11
+        <el-button type="primary" @click="submitForm('ruleForm')">立即创建</el-button>
12
+        <el-button @click="resetForm('ruleForm')">重置</el-button>
13
+      </el-form-item>
14
+    </el-form>
15
+  </div>
16
+</template>
17
+
18
+<script>
19
+export default {
20
+  data() {
21
+    return {
22
+      ruleForm: {
23
+        phase: '',
24
+        building: '',
25
+        unit: '',
26
+        level: '',
27
+        roomNo: '',
28
+        ownerName: '',
29
+        ownerTel: ''
30
+      },
31
+      rules: {
32
+        phase: [
33
+          { required: true, message: '请输入角色名称', trigger: 'blur' }
34
+        ]
35
+      }
36
+    }
37
+  },
38
+  methods: {
39
+    submitForm(formName) { // 提交
40
+      this.$refs[formName].validate((valid) => {
41
+        if (valid) {
42
+          this.addBuilding()
43
+        } else {
44
+          console.log('error submit!!')
45
+          return false
46
+        }
47
+      })
48
+    },
49
+    resetForm(formName) { // 重置
50
+      this.$refs[formName].resetFields()
51
+    },
52
+    addBuilding() {
53
+      // 加载框
54
+      const loading = this.$loading({
55
+        lock: true,
56
+        text: 'Loading',
57
+        spinner: 'el-icon-loading',
58
+        background: 'rgba(0, 0, 0, 0.7)'
59
+      })
60
+      this.$store.dispatch('AddBuilding', this.ruleForm).then((res) => {
61
+        if (res.code === '0') {
62
+          this.$message({
63
+            message: res.message,
64
+            type: 'success'
65
+          })
66
+          this.$router.push({ name: 'building-index' })
67
+          loading.close()
68
+          return
69
+        }
70
+        this.$message.error(res.message)
71
+        loading.close()
72
+      }).catch(() => {
73
+        loading.close()
74
+        console.log('error AddBuilding')
75
+      })
76
+    }
77
+  }
78
+}
79
+</script>
80
+
81
+<style scoped>
82
+.add-ruleForm{
83
+  width: 800px;
84
+  margin-left: auto;
85
+  margin-right: auto;
86
+  margin-top: 50px;
87
+}
88
+</style>

+ 14
- 14
VUECODE/smart-property-manage/src/views/account/role.vue Ver arquivo

@@ -6,9 +6,9 @@
6 6
       <el-button v-waves class="filter-item" type="primary" @click="handleFilter">查询</el-button>
7 7
     </div>
8 8
     <div style="margin-top: 20px;">
9
-      <el-button type="primary" @click="addActivity">添加</el-button>
10
-      <el-button type="warning" @click="ediActivity">修改</el-button>
11
-      <el-button type="danger" @click="invalidActivity">作废</el-button>
9
+      <el-button type="primary" @click="addRole">添加</el-button>
10
+      <el-button type="warning" @click="editRole">修改</el-button>
11
+      <el-button type="danger" @click="deleteRole">删除</el-button>
12 12
     </div>
13 13
     
14 14
     <el-table
@@ -23,17 +23,17 @@
23 23
       <el-table-column type="selection" width="55" align="center"/>
24 24
       <el-table-column label="角色名称" align="center">
25 25
         <template slot-scope="scope">
26
-          <span @click="handleLook(scope.row.id)" style="color: #409EFF;cursor: pointer">{{ scope.row.transactionTitle }}</span>
26
+          <span @click="handleLook(scope.row.id)" style="color: #409EFF;cursor: pointer">{{ scope.row.roleName }}</span>
27 27
         </template>
28 28
       </el-table-column>
29 29
       <el-table-column label="角色描述" align="center">
30 30
         <template slot-scope="scope">
31
-          <span>{{ scope.row.viewCount }}</span>
31
+          <span>{{ scope.row.description }}</span>
32 32
         </template>
33 33
       </el-table-column>
34 34
       <el-table-column label="创建人" align="center">
35 35
         <template slot-scope="scope">
36
-          <span>{{ scope.row.userName }}</span>
36
+          <span>{{ scope.row.createName }}</span>
37 37
         </template>
38 38
       </el-table-column>
39 39
       <el-table-column label="创建时间" align="center">
@@ -43,12 +43,12 @@
43 43
       </el-table-column>
44 44
       <el-table-column label="修改人" align="center">
45 45
         <template slot-scope="scope">
46
-          <span>{{ scope.row.userName }}</span>
46
+          <span>{{ scope.row.updateName }}</span>
47 47
         </template>
48 48
       </el-table-column>
49 49
       <el-table-column label="修改时间" align="center">
50 50
         <template slot-scope="scope">
51
-          <span>{{ formatDate(scope.row.createDate) }}</span>
51
+          <span>{{ formatDate(scope.row.updateDate) }}</span>
52 52
         </template>
53 53
       </el-table-column>
54 54
     </el-table>
@@ -73,8 +73,8 @@ import { parseTime } from '@/utils'
73 73
 
74 74
 export default {
75 75
   computed: {
76
-    ...mapState('transaction', {
77
-      transactionList: s => s.transactionList,
76
+    ...mapState('role', {
77
+      roleList: s => s.roleList,
78 78
       total: s => s.total
79 79
     })
80 80
   },
@@ -128,10 +128,7 @@ export default {
128 128
     clearListQuery() {
129 129
       this.listQuery.pageNum = 1
130 130
       this.listQuery.pageSize = 20
131
-      this.listQuery.transactionId = undefined
132
-      this.listQuery.transactionTitle = undefined
133
-      this.listQuery.status = undefined
134
-      this.listQuery.isReported = undefined
131
+      this.listQuery.roleName = undefined
135 132
       this.getList()
136 133
     },
137 134
     handleFilter() {
@@ -161,6 +158,9 @@ export default {
161 158
       this.listQuery.pageNum = val
162 159
       this.getList()
163 160
     },
161
+    addRole(){
162
+      this.$router.push({ name: 'role-add' })
163
+    },
164 164
     sortByID(order) {
165 165
       if (order === 'ascending') {
166 166
         this.listQuery.sort = '+id'