|
@@ -31,7 +31,7 @@
|
|
<template #extraToHeader>
|
|
<template #extraToHeader>
|
|
<el-button hc-btn type="primary" @click="addUserClick">新增</el-button>
|
|
<el-button hc-btn type="primary" @click="addUserClick">新增</el-button>
|
|
<el-button hc-btn type="danger" @click="delUserClick">删除</el-button>
|
|
<el-button hc-btn type="danger" @click="delUserClick">删除</el-button>
|
|
- <el-button hc-btn type="info">角色配置</el-button>
|
|
|
|
|
|
+ <el-button hc-btn type="info" @click="roleUserClick">角色配置</el-button>
|
|
<el-button hc-btn type="warning">密码重置</el-button>
|
|
<el-button hc-btn type="warning">密码重置</el-button>
|
|
<el-button hc-btn type="info">平台配置</el-button>
|
|
<el-button hc-btn type="info">平台配置</el-button>
|
|
<el-button hc-btn type="danger">账号封禁</el-button>
|
|
<el-button hc-btn type="danger">账号封禁</el-button>
|
|
@@ -54,6 +54,8 @@
|
|
</hc-card>
|
|
</hc-card>
|
|
<!-- 新增编辑 -->
|
|
<!-- 新增编辑 -->
|
|
<HcDataDialog v-model="isUserDataShow" :info="userItem" @finish="getTableData" />
|
|
<HcDataDialog v-model="isUserDataShow" :info="userItem" @finish="getTableData" />
|
|
|
|
+ <!-- 角色配置 -->
|
|
|
|
+ <HcRoleDialog v-model="isUserRoleShow" :users="userIds" :roles="userRoles" @finish="getTableData" />
|
|
</hc-body>
|
|
</hc-body>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -63,6 +65,7 @@ import { HcDelMsg } from 'hc-vue3-ui'
|
|
import { getDictionaryData } from '~uti/tools'
|
|
import { getDictionaryData } from '~uti/tools'
|
|
import { arrToId, getArrValue, isNullES } from 'js-fast-way'
|
|
import { arrToId, getArrValue, isNullES } from 'js-fast-way'
|
|
import HcDataDialog from './modules/user/data.vue'
|
|
import HcDataDialog from './modules/user/data.vue'
|
|
|
|
+import HcRoleDialog from './modules/user/role.vue'
|
|
import deptApi from '~api/system/dept'
|
|
import deptApi from '~api/system/dept'
|
|
import mainApi from '~api/system/user'
|
|
import mainApi from '~api/system/user'
|
|
|
|
|
|
@@ -199,5 +202,33 @@ const delUserData = async (id) => {
|
|
const { isRes } = await mainApi.del(id)
|
|
const { isRes } = await mainApi.del(id)
|
|
if (!isRes) return
|
|
if (!isRes) return
|
|
window.$message.success('删除成功')
|
|
window.$message.success('删除成功')
|
|
|
|
+ getTableData().then()
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//角色配置
|
|
|
|
+const userRoles = ref([])
|
|
|
|
+const userIds = ref([])
|
|
|
|
+const isUserRoleShow = ref(false)
|
|
|
|
+const roleUserClick = () => {
|
|
|
|
+ const rows = tableCheckKeys.value
|
|
|
|
+ if (rows.length <= 0) {
|
|
|
|
+ window.$message.warning('请先勾选要操作的用户')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ //处理数据
|
|
|
|
+ let newRoleUser = '', users = []
|
|
|
|
+ for (let i = 0; i < rows.length; i++) {
|
|
|
|
+ users.push(rows[i].id)
|
|
|
|
+ if (isNullES(newRoleUser)) {
|
|
|
|
+ newRoleUser = rows[i].roleId || ''
|
|
|
|
+ } else {
|
|
|
|
+ newRoleUser += ',' + rows[i].roleId || ''
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ userIds.value = users
|
|
|
|
+ //转为数组以及数组去重
|
|
|
|
+ const roleUser = newRoleUser.split(',')
|
|
|
|
+ userRoles.value = Array.from(new Set(roleUser))
|
|
|
|
+ isUserRoleShow.value = true
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|