wangfei 6 years ago
parent
commit
5bb12ba3b0

+ 2
- 8
src/pages/system/page.js View File

6
 import addUser from './systemSet/userManager/add' // 添加用户
6
 import addUser from './systemSet/userManager/add' // 添加用户
7
 import editUser from './systemSet/userManager/edit' // 编辑用户
7
 import editUser from './systemSet/userManager/edit' // 编辑用户
8
 import roleManager from './systemSet/roleManager/index' // 角色管理
8
 import roleManager from './systemSet/roleManager/index' // 角色管理
9
-import addRole from './systemSet/roleManager/add' // 添加角色
10
-import editRole from './systemSet/roleManager/edit' // 编辑角色
9
+import editRole from './systemSet/roleManager/add' // 编辑角色
11
 
10
 
12
 import caseManager from './caseManager/index' // 案场管理
11
 import caseManager from './caseManager/index' // 案场管理
13
 import caseInfo from './caseManager/caseInfo/index' // 案场信息
12
 import caseInfo from './caseManager/caseInfo/index' // 案场信息
92
           path: 'roleManager',
91
           path: 'roleManager',
93
           name: 'roleManager',
92
           name: 'roleManager',
94
           component: roleManager,
93
           component: roleManager,
95
-          children: [{ // 添加角色
96
-            path: 'addRole',
97
-            name: 'addRole',
98
-            component: addRole,
99
-            children: []
100
-          }, { // 编辑角色
94
+          children: [{ // 编辑角色
101
             path: 'editRole',
95
             path: 'editRole',
102
             name: 'editRole',
96
             name: 'editRole',
103
             component: editRole,
97
             component: editRole,

+ 7
- 0
src/pages/system/systemSet/roleManager/add.vue View File

61
       'GetRoleByID',
61
       'GetRoleByID',
62
       'AddRole',
62
       'AddRole',
63
       'UpdateRole',
63
       'UpdateRole',
64
+      'SetRoleNull',
64
     ]),
65
     ]),
65
     submit () {
66
     submit () {
66
       if ((this.detail.RoleId || '') === '') {
67
       if ((this.detail.RoleId || '') === '') {
76
     }
77
     }
77
   },
78
   },
78
   beforeMount () {
79
   beforeMount () {
80
+    const { id } = this.$route.query
81
+    if (id && id !== '') {
82
+      this.GetRoleByID({ roleid: id })
83
+    } else {
84
+      this.SetRoleNull()
85
+    }
79
   }
86
   }
80
 }
87
 }
81
 </script>
88
 </script>

+ 0
- 67
src/pages/system/systemSet/roleManager/edit.vue View File

1
-<template>
2
-  <div class="subPage">
3
-    <form class="mainForm">
4
-      <ul>
5
-        <li class="flex-h">
6
-          <span>角色名称:</span>
7
-          <div class="flex-item">
8
-            <div style="width:50%">
9
-              <el-input
10
-                placeholder="请输入角色名称"
11
-                v-model="postData.roleName"
12
-                clearable>
13
-              </el-input>
14
-            </div>
15
-          </div>
16
-        </li>
17
-        <li class="flex-h">
18
-          <span>备注:</span>
19
-          <div class="flex-item">
20
-            <div>
21
-              <el-input
22
-                placeholder="请输入备注"
23
-                type="textarea"
24
-                :autosize="{ minRows: 3, maxRows: 5}"
25
-                v-model="postData.remark"
26
-                clearable>
27
-              </el-input>
28
-            </div>
29
-          </div>
30
-        </li>
31
-        <li style="text-align:center">
32
-          <el-button type="primary" size="mini" @click='submit'>保存</el-button>
33
-          <el-button type="danger" size="mini" @click="cancel">取消</el-button>
34
-        </li>
35
-      </ul>
36
-    </form>
37
-  </div>
38
-</template>
39
-
40
-<script>
41
-export default {
42
-  name: '',
43
-  data () {
44
-    return {
45
-      postData: {
46
-        roleId: '', // 角色名
47
-        roleName: '', // 角色姓名
48
-        remark: '' // 备注
49
-      },
50
-    }
51
-  },
52
-  components: {},
53
-  methods: {
54
-    submit () {
55
-      console.log(this.postData)
56
-    },
57
-    cancel () {
58
-      this.$router.go(-1)
59
-    }
60
-  },
61
-  mounted () { }
62
-}
63
-</script>
64
-
65
-<!-- Add "scoped" attribute to limit CSS to this component only -->
66
-<style lang="scss" scoped>
67
-</style>

+ 8
- 7
src/pages/system/systemSet/roleManager/index.vue View File

3
     <div class="system-table-search">
3
     <div class="system-table-search">
4
       <div class="flex-h">
4
       <div class="flex-h">
5
         <div class="flex-item flex-h">
5
         <div class="flex-item flex-h">
6
-          <el-button size="mini" type="success" @click='addRole'>新增角色</el-button>
6
+          <el-button size="mini" type="success" @click='editRole'>新增角色</el-button>
7
         </div>
7
         </div>
8
-        <tableSearch value='分配权限' @exportSearchKey="searchList"></tableSearch>
8
+        <tableSearch value='角色名称' @exportSearchKey="searchList"></tableSearch>
9
       </div>
9
       </div>
10
       <div class="moreFilter"></div>
10
       <div class="moreFilter"></div>
11
     </div>
11
     </div>
13
       <el-table :data="roles.list" stripe style="width: 100%">
13
       <el-table :data="roles.list" stripe style="width: 100%">
14
         <el-table-column prop="RoleName" label="角色名">
14
         <el-table-column prop="RoleName" label="角色名">
15
         </el-table-column>
15
         </el-table-column>
16
-        <el-table-column prop="CreateDate" label="创建时间" width="300">
16
+        <el-table-column label="创建时间" width="300">
17
+          <template slot-scope="scope">
18
+            <label>{{FormatDate(scope.row.CreateDate)}}</label>
19
+          </template>
17
         </el-table-column>
20
         </el-table-column>
18
         <el-table-column fixed='right' label="操作" width="300">
21
         <el-table-column fixed='right' label="操作" width="300">
19
           <template slot-scope="scope">
22
           <template slot-scope="scope">
90
     },
93
     },
91
     handleEdit (index, row) {
94
     handleEdit (index, row) {
92
       // 编辑
95
       // 编辑
93
-      console.log(index, row)
94
-      this.$router.push({ name: 'editRole' })
96
+      this.$router.push({ name: 'editRole', query: { id: row.RoleId } })
95
     },
97
     },
96
     handleDelete (index, row) {
98
     handleDelete (index, row) {
97
       // 删除
99
       // 删除
122
       console.log(node)
124
       console.log(node)
123
     },
125
     },
124
     searchList (key) {
126
     searchList (key) {
125
-      // 搜索列表
126
-      console.log(key)
127
+      this.GetRolesList({name: key})
127
     },
128
     },
128
     addRole () {
129
     addRole () {
129
       this.$router.push({ name: 'addRole' })
130
       this.$router.push({ name: 'addRole' })

+ 9
- 3
src/store/system/role.js View File

12
       state.roleList = payload || []
12
       state.roleList = payload || []
13
     },
13
     },
14
     updateInfo (state, payload) {
14
     updateInfo (state, payload) {
15
-      state.roleInfo = payload || []
15
+      state.roleInfo = payload || {}
16
     },
16
     },
17
   },
17
   },
18
   actions: {
18
   actions: {
19
-    GetRolesList ({ commit }) {
19
+    GetRolesList ({ commit }, payload) {
20
       ajax(api.role.list.url, {
20
       ajax(api.role.list.url, {
21
-        method: api.role.list.method
21
+        method: api.role.list.method,
22
+        queryData: {
23
+          ...payload,
24
+        }
22
       }).then(res => {
25
       }).then(res => {
23
         commit('updateList', res)
26
         commit('updateList', res)
24
       })
27
       })
60
         }
63
         }
61
       }).then(res => {
64
       }).then(res => {
62
       })
65
       })
66
+    },
67
+    SetRoleNull ({ commit }) {
68
+      commit('updateInfo', {})
63
     }
69
     }
64
   }
70
   }
65
 }
71
 }