|
@@ -3,15 +3,19 @@
|
3
|
3
|
<div class="system-table-search">
|
4
|
4
|
<div class="flex-h">
|
5
|
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='addRole'>新增体检设备</el-button>
|
7
|
7
|
</div>
|
8
|
|
- <tableSearch value='角色名称' @exportSearchKey="searchList"></tableSearch>
|
9
|
8
|
</div>
|
10
|
9
|
<div class="moreFilter"></div>
|
11
|
10
|
</div>
|
12
|
11
|
<div class="system-table-box">
|
13
|
|
- <el-table :data="roles.list" stripe style="width: 100%">
|
14
|
|
- <el-table-column prop="RoleName" label="角色名">
|
|
12
|
+ <el-table :data="list.list" stripe style="width: 100%">
|
|
13
|
+ <el-table-column label="案场名称">
|
|
14
|
+ <template slot-scope="scope">
|
|
15
|
+ <label>{{GetCaseName(scope.row.CaseId)}}</label>
|
|
16
|
+ </template>
|
|
17
|
+ </el-table-column>
|
|
18
|
+ <el-table-column prop="Name" label="体检设备名称">
|
15
|
19
|
</el-table-column>
|
16
|
20
|
<el-table-column label="创建时间" width="300">
|
17
|
21
|
<template slot-scope="scope">
|
|
@@ -22,7 +26,6 @@
|
22
|
26
|
<template slot-scope="scope">
|
23
|
27
|
<el-button size="mini" type="warning" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
|
24
|
28
|
<el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
|
25
|
|
- <el-button size="mini" type="success" @click="handlePermission(scope.$index, scope.row)">分配权限</el-button>
|
26
|
29
|
</template>
|
27
|
30
|
</el-table-column>
|
28
|
31
|
</el-table>
|
|
@@ -33,72 +36,42 @@
|
33
|
36
|
:current-page.sync="currentPage"
|
34
|
37
|
:page-size="10"
|
35
|
38
|
layout="prev, pager, next, jumper"
|
36
|
|
- :total="roles.pagenum">
|
|
39
|
+ :total="list.pagenum">
|
37
|
40
|
</el-pagination>
|
38
|
|
- <el-dialog title="请选择菜单" :visible.sync="dialogTableVisible">
|
39
|
|
- <el-tree
|
40
|
|
- v-if="dialogTableVisible"
|
41
|
|
- class="flxe-h"
|
42
|
|
- :data="menus"
|
43
|
|
- node-key="id"
|
44
|
|
- :default-expand-all="true"
|
45
|
|
- :default-checked-keys="defaultChecked"
|
46
|
|
- ref="tree"
|
47
|
|
- show-checkbox
|
48
|
|
- @node-click="handleNodeClick"></el-tree>
|
49
|
|
- <div class="flex-h" style="justify-content: flex-end;margin-top: 1rem">
|
50
|
|
- <el-button type='success' @click="getCheckedNodes">确定</el-button>
|
51
|
|
- </div>
|
52
|
|
- </el-dialog>
|
53
|
41
|
</div>
|
54
|
42
|
</template>
|
55
|
43
|
|
56
|
44
|
<script>
|
57
|
45
|
import { createNamespacedHelpers, mapState } from 'vuex'
|
58
|
|
-import tableSearch from '@/components/tableSearch/index'
|
59
|
46
|
|
60
|
|
-const { mapState: mapRoleState, mapActions: mapRoleActions } = createNamespacedHelpers('role')
|
|
47
|
+const { mapState: mapDeviceState, mapActions: mapDeviceActions } = createNamespacedHelpers('device')
|
61
|
48
|
|
62
|
49
|
export default {
|
63
|
50
|
name: '',
|
64
|
51
|
data () {
|
65
|
52
|
return {
|
66
|
53
|
currentPage: 0, // 当前页码
|
67
|
|
- key: '',
|
68
|
|
- selid: '',
|
69
|
|
- dialogTableVisible: false,
|
70
|
54
|
}
|
71
|
55
|
},
|
72
|
56
|
computed: {
|
73
|
|
- ...mapRoleState({
|
74
|
|
- roles: x => x.roleList,
|
75
|
|
- roleMenus: x => x.roleMenus,
|
76
|
|
- }),
|
77
|
57
|
...mapState({
|
78
|
|
- menus: x => x.app.menus
|
|
58
|
+ cases: x => x.app.cases.list,
|
|
59
|
+ }),
|
|
60
|
+ ...mapDeviceState({
|
|
61
|
+ list: x => x.deviceList,
|
79
|
62
|
}),
|
80
|
|
- defaultChecked: {
|
81
|
|
- get () {
|
82
|
|
- const sels = (this.roleMenus || []).map(x => x.MenuId)
|
83
|
|
- console.log(sels)
|
84
|
|
- return sels
|
85
|
|
- },
|
86
|
|
- },
|
87
|
|
- },
|
88
|
|
- components: {
|
89
|
|
- tableSearch
|
90
|
63
|
},
|
91
|
64
|
methods: {
|
92
|
|
- ...mapRoleActions([
|
93
|
|
- 'GetRolesList',
|
94
|
|
- 'DelRole',
|
95
|
|
- 'SaveRoleMenus',
|
96
|
|
- 'GetRoleMenu',
|
|
65
|
+ ...mapDeviceActions([
|
|
66
|
+ 'GetDeviceList',
|
|
67
|
+ 'DelDevice',
|
97
|
68
|
]),
|
98
|
69
|
FormatDate (date) {
|
99
|
|
- console.log()
|
100
|
70
|
return this.toolClass.dateFormat(date)
|
101
|
71
|
},
|
|
72
|
+ GetCaseName (caseid) {
|
|
73
|
+ return ((this.cases.filter(x => x.CaseId === caseid) || [])[0] || {}).CaseName
|
|
74
|
+ },
|
102
|
75
|
handleSizeChange (val) {
|
103
|
76
|
console.log(`每页 ${val} 条`)
|
104
|
77
|
},
|
|
@@ -107,18 +80,18 @@ export default {
|
107
|
80
|
},
|
108
|
81
|
handleEdit (index, row) {
|
109
|
82
|
// 编辑
|
110
|
|
- this.$router.push({ name: 'editRole', query: { id: row.RoleId } })
|
|
83
|
+ this.$router.push({ name: 'editDevice', query: { id: row.EquipmentId } })
|
111
|
84
|
},
|
112
|
85
|
handleDelete (index, row) {
|
113
|
86
|
// 删除
|
114
|
87
|
console.log(index, row)
|
115
|
|
- this.$confirm('确认删除此角色?', '提示', {
|
|
88
|
+ this.$confirm('确认删除此设备?', '提示', {
|
116
|
89
|
confirmButtonText: '确定',
|
117
|
90
|
cancelButtonText: '取消',
|
118
|
91
|
type: 'warning'
|
119
|
92
|
})
|
120
|
93
|
.then(() => {
|
121
|
|
- this.DelRole({id: row.RoleId, callback: this.delCallBack})
|
|
94
|
+ this.DelDevice({id: row.EquipmentId, callback: this.delCallBack})
|
122
|
95
|
})
|
123
|
96
|
.catch(() => {
|
124
|
97
|
this.$message({
|
|
@@ -132,42 +105,14 @@ export default {
|
132
|
105
|
type: 'success',
|
133
|
106
|
message: '删除成功!'
|
134
|
107
|
})
|
135
|
|
- this.GetRolesList({name: this.key})
|
136
|
|
- },
|
137
|
|
- handlePermission (index, row) {
|
138
|
|
- this.selid = row.RoleId
|
139
|
|
- this.GetRoleMenu({id: this.selid})
|
140
|
|
- this.dialogTableVisible = true
|
141
|
|
- },
|
142
|
|
- handleNodeClick (node) {
|
143
|
|
- console.log(node)
|
144
|
|
- },
|
145
|
|
- searchList (key) {
|
146
|
|
- this.key = key
|
147
|
|
- this.GetRolesList({name: this.key})
|
|
108
|
+ this.GetDeviceList()
|
148
|
109
|
},
|
149
|
110
|
addRole () {
|
150
|
|
- this.$router.push({ name: 'editRole' })
|
151
|
|
- },
|
152
|
|
- getCheckedNodes () { // 获取选中的节点
|
153
|
|
- const menuids = this.$refs.tree.getCheckedNodes().map(x => x.id).join(',')
|
154
|
|
- console.log(menuids)
|
155
|
|
- this.SaveRoleMenus({
|
156
|
|
- id: this.selid,
|
157
|
|
- menuids: menuids,
|
158
|
|
- callback: this.hideDialog,
|
159
|
|
- })
|
160
|
|
- },
|
161
|
|
- hideDialog () {
|
162
|
|
- this.$message({
|
163
|
|
- type: 'success',
|
164
|
|
- message: '操作成功!'
|
165
|
|
- })
|
166
|
|
- this.dialogTableVisible = false
|
|
111
|
+ this.$router.push({ name: 'editDevice' })
|
167
|
112
|
},
|
168
|
113
|
},
|
169
|
114
|
beforeMount () {
|
170
|
|
- this.GetRolesList()
|
|
115
|
+ this.GetDeviceList()
|
171
|
116
|
},
|
172
|
117
|
}
|
173
|
118
|
</script>
|