|
@@ -47,8 +47,8 @@
|
|
|
<Delete />
|
|
|
</el-icon>
|
|
|
</el-button>
|
|
|
- <el-button plain :disabled="curSelectionRows.length === 0" @click="assignRoleVisibile = true"> 分配角色 </el-button>
|
|
|
- <el-button plain :disabled="curSelectionRows.length === 0"> 分配部门 </el-button>
|
|
|
+ <el-button plain :disabled="curSelectionRows.length === 0" @click="chooseThing('role')"> 分配角色 </el-button>
|
|
|
+ <el-button plain :disabled="curSelectionRows.length === 0" @click="chooseThing('department')"> 分配部门 </el-button>
|
|
|
<el-button plain :disabled="curSelectionRows.length === 0" @click="resetPwdVisibile = true"> 密码重置 </el-button>
|
|
|
</template>
|
|
|
|
|
@@ -94,6 +94,7 @@
|
|
|
v-if="assignRoleVisibile"
|
|
|
v-model="assignRoleVisibile"
|
|
|
:user-ids="curSelectionRows.map(item => item.id)"
|
|
|
+ :type-model="typeModel"
|
|
|
@successFn="updateParams()"
|
|
|
@closed="assignRoleVisibile = false"
|
|
|
></assign-role-dialog>
|
|
@@ -110,6 +111,7 @@
|
|
|
<script lang="tsx" setup>
|
|
|
import role from '@/api/system/role'
|
|
|
import user from '@/api/system/user'
|
|
|
+import department from '@/api/system/department'
|
|
|
import { computed, nextTick, ref, watch } from 'vue'
|
|
|
import { ElMessage, ElTree } from 'element-plus'
|
|
|
import { useTablePage } from '@/hooks/useTablePage'
|
|
@@ -178,7 +180,7 @@ const formsDialog = [
|
|
|
options: []
|
|
|
},
|
|
|
{
|
|
|
- prop: 'roleIds1',
|
|
|
+ prop: 'departments',
|
|
|
label: '所属部门',
|
|
|
itemType: 'select',
|
|
|
multiple: true,
|
|
@@ -223,6 +225,7 @@ const filterNode = (value: string, data: Tree) => {
|
|
|
}
|
|
|
|
|
|
const treeData = ref([])
|
|
|
+const typeModel = ref('')
|
|
|
|
|
|
// 获取左侧菜单数据
|
|
|
const getGroup = async () => {
|
|
@@ -245,6 +248,18 @@ const getRolesList = async () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// 获取全部的部门列表
|
|
|
+const getDepartmentsList = async () => {
|
|
|
+ try {
|
|
|
+ const data = await department.departmentListAllApi()
|
|
|
+ formOptions.value.forms[8].options = data.map(item => {
|
|
|
+ return { value: item.id, label: item.name }
|
|
|
+ })
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
// 左侧菜单点击
|
|
|
const roleClick = data => {
|
|
|
console.log(data.id, 'data.id')
|
|
@@ -394,7 +409,7 @@ const table_edit = async row => {
|
|
|
try {
|
|
|
const data = await user.userRoleIdsApi({ id: row.id })
|
|
|
isCreate.value = false
|
|
|
- activeData.value = { ...row, status: row.status ? true : false, roleIds: data }
|
|
|
+ activeData.value = { ...row, status: row.status ? true : false, roleIds: data?.roleIds }
|
|
|
visible.value = true
|
|
|
} catch (e) {
|
|
|
ElMessage.error(`获取用户所属角色失败~`)
|
|
@@ -424,9 +439,15 @@ const addHandler = () => {
|
|
|
visible.value = true
|
|
|
}
|
|
|
|
|
|
+const chooseThing = item => {
|
|
|
+ assignRoleVisibile.value = true
|
|
|
+ typeModel.value = item
|
|
|
+}
|
|
|
+
|
|
|
nextTick(() => {
|
|
|
getGroup()
|
|
|
getRolesList()
|
|
|
+ getDepartmentsList()
|
|
|
queryList()
|
|
|
})
|
|
|
|