许成详 6 лет назад
Родитель
Сommit
41d27f84dc

+ 92
- 0
src/pages/system/caseManager/deviceManager/add.vue Просмотреть файл

@@ -0,0 +1,92 @@
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="detail.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="detail.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
+import { createNamespacedHelpers, mapState } from 'vuex'
42
+
43
+const { mapState: mapRoleState, mapActions: mapRoleActions } = createNamespacedHelpers('role')
44
+export default {
45
+  name: '',
46
+  data () {
47
+    return {}
48
+  },
49
+  components: {},
50
+  computed: {
51
+    ...mapRoleState({
52
+      detail: x => x.roleInfo,
53
+    }),
54
+    ...mapState({
55
+      caseid: x => x.app.cases.default,
56
+      orgid: x => x.app.user.OrgId,
57
+    })
58
+  },
59
+  methods: {
60
+    ...mapRoleActions([
61
+      'GetRoleByID',
62
+      'AddRole',
63
+      'UpdateRole',
64
+      'SetRoleNull',
65
+    ]),
66
+    submit () {
67
+      if ((this.detail.RoleId || '') === '') {
68
+        this.detail.CaseId = this.caseid
69
+        this.detail.OrgId = this.orgid
70
+        this.AddRole(this.detail)
71
+      } else {
72
+        this.UpdateRole(this.detail)
73
+      }
74
+    },
75
+    cancel () {
76
+      this.$router.go(-1)
77
+    }
78
+  },
79
+  beforeMount () {
80
+    const { id } = this.$route.query
81
+    if (id && id !== '') {
82
+      this.GetRoleByID({ roleid: id })
83
+    } else {
84
+      this.SetRoleNull()
85
+    }
86
+  }
87
+}
88
+</script>
89
+
90
+<!-- Add "scoped" attribute to limit CSS to this component only -->
91
+<style lang="scss" scoped>
92
+</style>

+ 177
- 0
src/pages/system/caseManager/deviceManager/index.vue Просмотреть файл

@@ -0,0 +1,177 @@
1
+<template>
2
+  <div class="subPage">
3
+    <div class="system-table-search">
4
+      <div class="flex-h">
5
+        <div class="flex-item flex-h">
6
+          <el-button size="mini" type="success" @click='addRole'>新增角色</el-button>
7
+        </div>
8
+        <tableSearch value='角色名称' @exportSearchKey="searchList"></tableSearch>
9
+      </div>
10
+      <div class="moreFilter"></div>
11
+    </div>
12
+    <div class="system-table-box">
13
+      <el-table :data="roles.list" stripe style="width: 100%">
14
+        <el-table-column prop="RoleName" label="角色名">
15
+        </el-table-column>
16
+        <el-table-column label="创建时间" width="300">
17
+          <template slot-scope="scope">
18
+            <label>{{FormatDate(scope.row.CreateDate)}}</label>
19
+          </template>
20
+        </el-table-column>
21
+        <el-table-column fixed='right' label="操作" width="300">
22
+          <template slot-scope="scope">
23
+            <el-button size="mini" type="warning" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
24
+            <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
+          </template>
27
+        </el-table-column>
28
+      </el-table>
29
+    </div>
30
+    <el-pagination
31
+    @size-change="handleSizeChange"
32
+    @current-change="handleCurrentChange"
33
+    :current-page.sync="currentPage"
34
+    :page-size="10"
35
+    layout="prev, pager, next, jumper"
36
+    :total="roles.pagenum">
37
+    </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
+  </div>
54
+</template>
55
+
56
+<script>
57
+import { createNamespacedHelpers, mapState } from 'vuex'
58
+import tableSearch from '@/components/tableSearch/index'
59
+
60
+const { mapState: mapRoleState, mapActions: mapRoleActions } = createNamespacedHelpers('role')
61
+
62
+export default {
63
+  name: '',
64
+  data () {
65
+    return {
66
+      currentPage: 0, // 当前页码
67
+      key: '',
68
+      selid: '',
69
+      dialogTableVisible: false,
70
+    }
71
+  },
72
+  computed: {
73
+    ...mapRoleState({
74
+      roles: x => x.roleList,
75
+      roleMenus: x => x.roleMenus,
76
+    }),
77
+    ...mapState({
78
+      menus: x => x.app.menus
79
+    }),
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
+  },
91
+  methods: {
92
+    ...mapRoleActions([
93
+      'GetRolesList',
94
+      'DelRole',
95
+      'SaveRoleMenus',
96
+      'GetRoleMenu',
97
+    ]),
98
+    FormatDate (date) {
99
+      console.log()
100
+      return this.toolClass.dateFormat(date)
101
+    },
102
+    handleSizeChange (val) {
103
+      console.log(`每页 ${val} 条`)
104
+    },
105
+    handleCurrentChange (val) {
106
+      console.log(`当前页: ${val}`)
107
+    },
108
+    handleEdit (index, row) {
109
+      // 编辑
110
+      this.$router.push({ name: 'editRole', query: { id: row.RoleId } })
111
+    },
112
+    handleDelete (index, row) {
113
+      // 删除
114
+      console.log(index, row)
115
+      this.$confirm('确认删除此角色?', '提示', {
116
+        confirmButtonText: '确定',
117
+        cancelButtonText: '取消',
118
+        type: 'warning'
119
+      })
120
+        .then(() => {
121
+          this.DelRole({id: row.RoleId, callback: this.delCallBack})
122
+        })
123
+        .catch(() => {
124
+          this.$message({
125
+            type: 'info',
126
+            message: '已取消删除'
127
+          })
128
+        })
129
+    },
130
+    delCallBack () {
131
+      this.$message({
132
+        type: 'success',
133
+        message: '删除成功!'
134
+      })
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})
148
+    },
149
+    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
167
+    },
168
+  },
169
+  beforeMount () {
170
+    this.GetRolesList()
171
+  },
172
+}
173
+</script>
174
+
175
+<!-- Add "scoped" attribute to limit CSS to this component only -->
176
+<style lang="scss" scoped>
177
+</style>

+ 12
- 0
src/pages/system/page.js Просмотреть файл

@@ -12,6 +12,8 @@ import caseManager from './caseManager/index' // 案场管理
12 12
 import caseInfo from './caseManager/caseInfo/index' // 案场信息
13 13
 import addCase from './caseManager/caseInfo/addCase/index' // 新增案场
14 14
 import editCase from './caseManager/caseInfo/editCase/index' // 新增案场
15
+import deviceManager from './caseManager/caseInfo/deviceManager/index' // 体检设备
16
+import editDevice from './caseManager/caseInfo/deviceManager/add' // 添加体检设备
15 17
 import pplConcerned from './caseManager/caseInfo/pplConcerned/index' // 相关人员
16 18
 import editPPLConcerned from './caseManager/caseInfo/pplConcerned/editPPLConcerned/index' // 编辑相关人员
17 19
 import keyManager from './caseManager/keyManager/index' // 钥匙管理
@@ -118,6 +120,16 @@ export default {
118 120
             name: 'editCase',
119 121
             component: editCase,
120 122
             children: []
123
+          }, { // 体检设备
124
+            path: 'deviceManager',
125
+            name: 'deviceManager',
126
+            component: deviceManager,
127
+            children: []
128
+          }, { // 添加体检设备
129
+            path: 'editDevice',
130
+            name: 'editDevice',
131
+            component: editDevice,
132
+            children: []
121 133
           }, { // 相关人员
122 134
             path: 'pplConcerned',
123 135
             name: 'pplConcerned',