Merge branch 'master' of gitee.com:youlaitech/vue3-element-admin
This commit is contained in:
@@ -135,15 +135,10 @@
|
|||||||
label="上级部门"
|
label="上级部门"
|
||||||
prop="parentId"
|
prop="parentId"
|
||||||
>
|
>
|
||||||
<TreeSelect
|
<tree-select
|
||||||
:treeProps="dataMap.props"
|
|
||||||
:options="dataMap.deptOptions"
|
:options="dataMap.deptOptions"
|
||||||
placeholder="选择上级部门"
|
placeholder="选择上级部门"
|
||||||
:originOptions="dataMap.originOptions"
|
v-model:value="dataMap.formVal.parentId"
|
||||||
:defalut="dataMap.formVal.parentId"
|
|
||||||
:user="true"
|
|
||||||
@callBack="getDeptId"
|
|
||||||
:disabled="dataMap.disabled"
|
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="部门名称" prop="name">
|
<el-form-item label="部门名称" prop="name">
|
||||||
@@ -296,25 +291,10 @@ function resetQuery() {
|
|||||||
handleQuery()
|
handleQuery()
|
||||||
}
|
}
|
||||||
|
|
||||||
function flatten(origin: any) {
|
|
||||||
let result: any = []
|
|
||||||
for (let i = 0; i < origin.length; i++) {
|
|
||||||
const item = origin[i]
|
|
||||||
if (Array.isArray(item.children)) {
|
|
||||||
result = result.concat(flatten(item.children))
|
|
||||||
result.push(item)
|
|
||||||
} else {
|
|
||||||
result.push(item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 查询部门下拉树结构 */
|
/** 查询部门下拉树结构 */
|
||||||
function getTreeselect() {
|
function getTreeselect() {
|
||||||
getDeptSelectList().then(response => {
|
getDeptSelectList().then(response => {
|
||||||
dataMap.deptOptions = response.data
|
dataMap.deptOptions = response.data
|
||||||
dataMap.originOptions = flatten(response?.data) as any
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -264,6 +264,7 @@
|
|||||||
width="600px"
|
width="600px"
|
||||||
append-to-body
|
append-to-body
|
||||||
@opened="showDialog"
|
@opened="showDialog"
|
||||||
|
@close="cancel"
|
||||||
>
|
>
|
||||||
<el-form
|
<el-form
|
||||||
ref="addForm"
|
ref="addForm"
|
||||||
@@ -288,14 +289,10 @@
|
|||||||
label="归属部门"
|
label="归属部门"
|
||||||
prop="deptId"
|
prop="deptId"
|
||||||
>
|
>
|
||||||
<Treeselect
|
<tree-select
|
||||||
:treeProps="dataMap.props"
|
|
||||||
:options="dataMap.deptOptions"
|
:options="dataMap.deptOptions"
|
||||||
placeholder="请选择归属部门"
|
placeholder="请选择归属部门"
|
||||||
:originOptions="dataMap.originOptions"
|
v-model:value="dataMap.formVal.deptId"
|
||||||
:defalut="dataMap.formVal.deptId"
|
|
||||||
:user="true"
|
|
||||||
@callBack="getDeptId"
|
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -340,18 +337,19 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item
|
<el-form-item label="状态">
|
||||||
v-if="dataMap.formVal.id === undefined"
|
<el-radio-group v-model="dataMap.formVal.status">
|
||||||
label="用户密码"
|
<el-radio
|
||||||
prop="password"
|
v-for="dict in dataMap.statusOptions"
|
||||||
>
|
:key="dict.dictValue"
|
||||||
<el-input
|
:label="dict.dictValue"
|
||||||
v-model="dataMap.formVal.password"
|
>
|
||||||
placeholder="请输入用户密码"
|
{{ dict.dictLabel }}
|
||||||
type="password"
|
</el-radio>
|
||||||
/>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@@ -369,21 +367,6 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="状态">
|
|
||||||
<el-radio-group v-model="dataMap.formVal.status">
|
|
||||||
<el-radio
|
|
||||||
v-for="dict in dataMap.statusOptions"
|
|
||||||
:key="dict.dictValue"
|
|
||||||
:label="dict.dictValue"
|
|
||||||
>
|
|
||||||
{{ dict.dictLabel }}
|
|
||||||
</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="角色">
|
<el-form-item label="角色">
|
||||||
<el-select
|
<el-select
|
||||||
@@ -402,6 +385,23 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
|
||||||
|
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item
|
||||||
|
v-if="dataMap.formVal.id === undefined"
|
||||||
|
label="用户密码"
|
||||||
|
prop="password"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="dataMap.formVal.password"
|
||||||
|
placeholder="请输入用户密码"
|
||||||
|
type="password"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div
|
<div
|
||||||
@@ -428,7 +428,7 @@
|
|||||||
import {listUser, getUser, delUser, addUser, updateUser, patch} from '@/api/system/user'
|
import {listUser, getUser, delUser, addUser, updateUser, patch} from '@/api/system/user'
|
||||||
|
|
||||||
import {getDeptSelectList} from '@/api/system/dept'
|
import {getDeptSelectList} from '@/api/system/dept'
|
||||||
import Treeselect from '@/components/TreeSelect/Index.vue'
|
import TreeSelect from '@/components/TreeSelect/Index.vue'
|
||||||
import {listRoles} from '@/api/system/role'
|
import {listRoles} from '@/api/system/role'
|
||||||
import {Search, Plus, Edit, Refresh, Delete} from '@element-plus/icons'
|
import {Search, Plus, Edit, Refresh, Delete} from '@element-plus/icons'
|
||||||
|
|
||||||
@@ -607,8 +607,8 @@ function handleNodeClick(data: { [key: string]: any }) {
|
|||||||
// 用户状态修改
|
// 用户状态修改
|
||||||
function handleStatusChange(row: { [key: string]: any }) {
|
function handleStatusChange(row: { [key: string]: any }) {
|
||||||
if (dataMap.tigger) {
|
if (dataMap.tigger) {
|
||||||
const text = row.status === '1' ? '启用' : '停用'
|
const text = row.status === 1 ? '启用' : '停用'
|
||||||
ElMessageBox.confirm('确认要"' + text + '""' + row.username + '"用户吗?', '警告', {
|
ElMessageBox.confirm('确认要' + text + ''+ row.username + '用户吗?', '警告', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
@@ -617,7 +617,7 @@ function handleStatusChange(row: { [key: string]: any }) {
|
|||||||
}).then(() => {
|
}).then(() => {
|
||||||
ElMessage.success(text + '成功')
|
ElMessage.success(text + '成功')
|
||||||
}).catch( ()=>{
|
}).catch( ()=>{
|
||||||
row.status = row.status === '1' ? 1 : 0
|
row.status = row.status === 1 ? 0 : 1
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -666,11 +666,7 @@ function handleSelectionChange(selection: any) {
|
|||||||
|
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
console.log(dataMap.formVal)
|
|
||||||
dataMap.addformFlag = true
|
dataMap.addformFlag = true
|
||||||
resetForm()
|
|
||||||
dataMap.originOptions = []
|
|
||||||
// loadDeptOptions()
|
|
||||||
dataMap.open = true
|
dataMap.open = true
|
||||||
dataMap.title = '添加用户'
|
dataMap.title = '添加用户'
|
||||||
dataMap.formVal.password = "123456"
|
dataMap.formVal.password = "123456"
|
||||||
@@ -696,15 +692,12 @@ function resetForm() {
|
|||||||
|
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
async function handleUpdate(row: { [key: string]: any }) {
|
async function handleUpdate(row: { [key: string]: any }) {
|
||||||
resetForm()
|
|
||||||
const userId = row.id || dataMap.ids
|
const userId = row.id || dataMap.ids
|
||||||
const response = await getUser(userId);
|
const response = await getUser(userId);
|
||||||
dataMap.formVal = response.data
|
dataMap.formVal = response.data
|
||||||
console.log(response.data)
|
|
||||||
dataMap.title = '修改用户'
|
dataMap.title = '修改用户'
|
||||||
dataMap.formVal.password = ''
|
dataMap.formVal.password = ''
|
||||||
dataMap.formVal.deptId = 1
|
dataMap.formVal.deptId =response.data.deptId
|
||||||
// dataMap.formVal.deptId = parseInt(response.data.deptId)
|
|
||||||
dataMap.open = true
|
dataMap.open = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -754,9 +747,6 @@ function cancel() {
|
|||||||
resetForm()
|
resetForm()
|
||||||
}
|
}
|
||||||
|
|
||||||
function getParentValue(event: any) {
|
|
||||||
console.log(event)
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDeptId(e: any) {
|
function getDeptId(e: any) {
|
||||||
dataMap.formVal.deptId = e
|
dataMap.formVal.deptId = e
|
||||||
@@ -787,6 +777,7 @@ onMounted(() => {
|
|||||||
|
|
||||||
function showDialog() {
|
function showDialog() {
|
||||||
loadDeptOptions()
|
loadDeptOptions()
|
||||||
|
loadRoleOptions()
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user