| | |
| | | import request from '@/utils/request' |
| | | import request from "@/utils/request"; |
| | | import { parseStrEmpty } from "@/utils/ruoyi"; |
| | | |
| | | // 查询用户列表 |
| | | export function listUser(query) { |
| | | return request({ |
| | | url: '/system/user/list', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | url: "/system/user/list", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // 查询用户详细 |
| | | export function getUser(userId) { |
| | | return request({ |
| | | url: '/system/user/' + parseStrEmpty(userId), |
| | | method: 'get' |
| | | }) |
| | | url: "/system/user/" + parseStrEmpty(userId), |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | // 新增用户 |
| | | export function addUser(data) { |
| | | return request({ |
| | | url: '/system/user', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | url: "/system/user", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // 修改用户 |
| | | export function updateUser(data) { |
| | | return request({ |
| | | url: '/system/user', |
| | | method: 'put', |
| | | data: data |
| | | }) |
| | | url: "/system/user", |
| | | method: "put", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // 删除用户 |
| | | export function delUser(userId) { |
| | | return request({ |
| | | url: '/system/user/' + userId, |
| | | method: 'delete' |
| | | }) |
| | | url: "/system/user/" + userId, |
| | | method: "delete", |
| | | }); |
| | | } |
| | | |
| | | // 用户密码重置 |
| | | export function resetUserPwd(userId, password) { |
| | | const data = { |
| | | userId, |
| | | password |
| | | } |
| | | password, |
| | | }; |
| | | return request({ |
| | | url: '/system/user/resetPwd', |
| | | method: 'put', |
| | | data: data |
| | | }) |
| | | url: "/system/user/resetPwd", |
| | | method: "put", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // 用户状态修改 |
| | | export function changeUserStatus(userId, status) { |
| | | const data = { |
| | | userId, |
| | | status |
| | | } |
| | | status, |
| | | }; |
| | | return request({ |
| | | url: '/system/user/changeStatus', |
| | | method: 'put', |
| | | data: data |
| | | }) |
| | | url: "/system/user/changeStatus", |
| | | method: "put", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // 查询用户个人信息 |
| | | export function getUserProfile() { |
| | | return request({ |
| | | url: '/system/user/profile', |
| | | method: 'get' |
| | | }) |
| | | url: "/system/user/profile", |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | // 修改用户个人信息 |
| | | export function updateUserProfile(data) { |
| | | return request({ |
| | | url: '/system/user/profile', |
| | | method: 'put', |
| | | data: data |
| | | }) |
| | | url: "/system/user/profile", |
| | | method: "put", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // 用户密码重置 |
| | | export function updateUserPwd(oldPassword, newPassword) { |
| | | const data = { |
| | | oldPassword, |
| | | newPassword |
| | | } |
| | | newPassword, |
| | | }; |
| | | return request({ |
| | | url: '/system/user/profile/updatePwd', |
| | | method: 'put', |
| | | data: data |
| | | }) |
| | | url: "/system/user/profile/updatePwd", |
| | | method: "put", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // 用户头像上传 |
| | | export function uploadAvatar(data) { |
| | | return request({ |
| | | url: '/system/user/profile/avatar', |
| | | method: 'post', |
| | | headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, |
| | | data: data |
| | | }) |
| | | url: "/system/user/profile/avatar", |
| | | method: "post", |
| | | headers: { "Content-Type": "application/x-www-form-urlencoded" }, |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // 查询授权角色 |
| | | export function getAuthRole(userId) { |
| | | return request({ |
| | | url: '/system/user/authRole/' + userId, |
| | | method: 'get' |
| | | }) |
| | | url: "/system/user/authRole/" + userId, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | // 保存授权角色 |
| | | export function updateAuthRole(data) { |
| | | return request({ |
| | | url: '/system/user/authRole', |
| | | method: 'put', |
| | | params: data |
| | | }) |
| | | url: "/system/user/authRole", |
| | | method: "put", |
| | | params: data, |
| | | }); |
| | | } |
| | | |
| | | // 查询部门下拉树结构 |
| | | export function deptTreeSelect() { |
| | | return request({ |
| | | url: '/system/user/deptTree', |
| | | method: 'get' |
| | | }) |
| | | url: "/system/user/deptTree", |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | // 获取人事系统组织 |
| | | export function selectCompaniesList() { |
| | | return request({ |
| | | url: '/companies/selectCompaniesList', |
| | | method: 'get' |
| | | }) |
| | | url: "/companies/selectCompaniesList", |
| | | method: "get", |
| | | }); |
| | | } |
| | | // 获取人事系统组织下的人员 |
| | | export function selectSimpleList(data) { |
| | | return request({ |
| | | url: '/companies/selectSimpleList', |
| | | method: 'post', |
| | | params: data |
| | | }) |
| | | url: "/companies/selectSimpleList", |
| | | method: "post", |
| | | params: data, |
| | | }); |
| | | } |
| | | // 获取人事系统组织下的人员 |
| | | export function addPersonUser(data) { |
| | | return request({ |
| | | url: '/companies/addPersonUser', |
| | | method: 'post', |
| | | params: data |
| | | }) |
| | | url: "/companies/addPersonUser", |
| | | method: "post", |
| | | params: data, |
| | | }); |
| | | } |
| | | // 获取角色 |
| | | export function selectRoleList() { |
| | | return request({ |
| | | url: '/role/selectRoleList', |
| | | method: 'get', |
| | | }) |
| | | url: "/role/selectRoleList", |
| | | method: "get", |
| | | }); |
| | | } |
| | | // 获取单位 |
| | | export function selectCustomEnum() { |
| | | return request({ |
| | | url: '/system/custom/selectCustomEnum', |
| | | method: 'get', |
| | | }) |
| | | url: "/system/custom/selectCustomEnum", |
| | | method: "get", |
| | | }); |
| | | } |
| | | // 提交添加架构信息 |
| | | export function addDepartment(params) { |
| | | export function addDepartment(data) { |
| | | return request({ |
| | | url: '/department/addDepartment', |
| | | method: 'post', |
| | | params: params |
| | | }) |
| | | url: "/department/addDepartment", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | // 获取当前登录人员部门 |
| | | export function selectUserDepartmentLimsName(query) { |
| | | return request({ |
| | | url: '/system/newUser/selectUserDepartmentLimsName', |
| | | method: 'get' |
| | | }) |
| | | url: "/system/newUser/selectUserDepartmentLimsName", |
| | | method: "get", |
| | | }); |
| | | } |
| | | // 获取用户列表 |
| | | export function selectUserCondition(query) { |
| | |
| | | </div> |
| | | <!-- 图片 --> |
| | | <div v-else-if="item.dataType == 'image'"> |
| | | <img :src="javaApi + '/img/' + item.prop" alt="" style="width: 40px; height: 40px; margin-top: 10px" /> |
| | | <img :src="javaApi + '/img/' + scope.row[item.prop]" alt="" |
| | | style="width: 40px; height: 40px; margin-top: 10px" /> |
| | | </div> |
| | | |
| | | <!-- tag --> |
| | |
| | | <div class="app-container"> |
| | | <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"> |
| | | <el-form-item label="部门名称" prop="deptName"> |
| | | <el-input |
| | | v-model="queryParams.deptName" |
| | | placeholder="请输入部门名称" |
| | | clearable |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | <el-input v-model="queryParams.deptName" placeholder="请输入部门名称" clearable @keyup.enter.native="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="状态" prop="status"> |
| | | <el-select v-model="queryParams.status" placeholder="部门状态" clearable> |
| | | <el-option |
| | | v-for="dict in dict.type.sys_normal_disable" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | <el-option v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.label" |
| | | :value="dict.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | |
| | | |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="primary" |
| | | plain |
| | | icon="el-icon-plus" |
| | | size="mini" |
| | | @click="handleAdd" |
| | | v-hasPermi="['system:dept:add']" |
| | | >新增</el-button> |
| | | <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" |
| | | v-hasPermi="['system:dept:add']">新增</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="info" |
| | | plain |
| | | icon="el-icon-sort" |
| | | size="mini" |
| | | @click="toggleExpandAll" |
| | | >展开/折叠</el-button> |
| | | <el-button type="info" plain icon="el-icon-sort" size="mini" @click="toggleExpandAll">展开/折叠</el-button> |
| | | </el-col> |
| | | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | | |
| | | <el-table |
| | | v-if="refreshTable" |
| | | v-loading="loading" |
| | | :data="deptList" |
| | | row-key="deptId" |
| | | :default-expand-all="isExpandAll" |
| | | :tree-props="{children: 'children', hasChildren: 'hasChildren'}" |
| | | > |
| | | <el-table v-if="refreshTable" v-loading="loading" :data="deptList" row-key="deptId" |
| | | :default-expand-all="isExpandAll" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"> |
| | | <el-table-column prop="deptName" label="部门名称" width="260"></el-table-column> |
| | | <el-table-column prop="orderNum" label="排序" width="200"></el-table-column> |
| | | <el-table-column prop="status" label="状态" width="100"> |
| | | <template slot-scope="scope"> |
| | | <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/> |
| | | <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="创建时间" align="center" prop="createTime" width="200"> |
| | |
| | | </el-table-column> |
| | | <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-edit" |
| | | @click="handleUpdate(scope.row)" |
| | | v-hasPermi="['system:dept:edit']" |
| | | >修改</el-button> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-plus" |
| | | @click="handleAdd(scope.row)" |
| | | v-hasPermi="['system:dept:add']" |
| | | >新增</el-button> |
| | | <el-button |
| | | v-if="scope.row.parentId != 0" |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-delete" |
| | | @click="handleDelete(scope.row)" |
| | | v-hasPermi="['system:dept:remove']" |
| | | >删除</el-button> |
| | | <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" |
| | | v-hasPermi="['system:dept:edit']">修改</el-button> |
| | | <el-button size="mini" type="text" icon="el-icon-plus" @click="handleAdd(scope.row)" |
| | | v-hasPermi="['system:dept:add']">新增</el-button> |
| | | <el-button v-if="scope.row.parentId != 0" size="mini" type="text" icon="el-icon-delete" |
| | | @click="handleDelete(scope.row)" v-hasPermi="['system:dept:remove']">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | <el-row> |
| | | <el-col :span="24" v-if="form.parentId !== 0"> |
| | | <el-form-item label="上级部门" prop="parentId"> |
| | | <treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级部门" /> |
| | | <treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" |
| | | placeholder="选择上级部门" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | <el-col :span="12"> |
| | | <el-form-item label="部门状态"> |
| | | <el-radio-group v-model="form.status"> |
| | | <el-radio |
| | | v-for="dict in dict.type.sys_normal_disable" |
| | | :key="dict.value" |
| | | :label="dict.value" |
| | | >{{dict.label}}</el-radio> |
| | | <el-radio v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.value">{{ |
| | | dict.label |
| | | }}</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | this.title = "添加部门"; |
| | | listDept().then(response => { |
| | | this.deptOptions = this.handleTree(response.data, "deptId"); |
| | | this.deptOptions = this.limitTreeDepth(this.deptOptions, 2) |
| | | }); |
| | | }, |
| | | /** 展开/折叠操作 */ |
| | |
| | | const noResultsOptions = { deptId: this.form.parentId, deptName: this.form.parentName, children: [] }; |
| | | this.deptOptions.push(noResultsOptions); |
| | | } |
| | | this.deptOptions = this.limitTreeDepth(this.deptOptions, 2) |
| | | }); |
| | | }); |
| | | }, |
| | | /** 提交按钮 */ |
| | | submitForm: function() { |
| | | submitForm: function () { |
| | | this.$refs["form"].validate(valid => { |
| | | if (valid) { |
| | | if (this.form.deptId != undefined) { |
| | |
| | | }, |
| | | /** 删除按钮操作 */ |
| | | handleDelete(row) { |
| | | this.$modal.confirm('是否确认删除名称为"' + row.deptName + '"的数据项?').then(function() { |
| | | this.$modal.confirm('是否确认删除名称为"' + row.deptName + '"的数据项?').then(function () { |
| | | return delDept(row.deptId); |
| | | }).then(() => { |
| | | this.getList(); |
| | | this.$modal.msgSuccess("删除成功"); |
| | | }).catch(() => {}); |
| | | }).catch(() => { }); |
| | | }, |
| | | // 递归函数,用于限制树的深度 |
| | | limitTreeDepth(options, maxDepth, currentDepth = 1) { |
| | | return options.map(option => { |
| | | const newOption = { ...option }; |
| | | if (currentDepth < maxDepth && option.children) { |
| | | // 如果当前深度小于最大深度且存在子节点,则递归处理子节点 |
| | | newOption.children = this.limitTreeDepth(option.children, maxDepth, currentDepth + 1); |
| | | } else { |
| | | // 否则移除子节点 |
| | | delete newOption.children; |
| | | } |
| | | return newOption; |
| | | }); |
| | | } |
| | | } |
| | | }; |
| | |
| | | handleCheckedTreeConnect(value, type) { |
| | | if (type == 'menu') { |
| | | this.form.menuCheckStrictly = value ? true : false; |
| | | this.menuNodeAll = false |
| | | this.$refs.menu.setCheckedNodes([]); |
| | | } else if (type == 'dept') { |
| | | this.form.deptCheckStrictly = value ? true : false; |
| | | } |
| | |
| | | <div class="head-container addButton"> |
| | | <el-input v-model="deptName" placeholder="部门名称" clearable size="small" prefix-icon="el-icon-search" |
| | | style="margin-bottom: 20px" /> |
| | | <el-button style="margin-left: 4px" type="primary" plain icon="el-icon-plus" size="mini" circle |
| | | @click="addSchema"></el-button> |
| | | <!-- <el-button style="margin-left: 4px" type="primary" plain icon="el-icon-plus" size="mini" circle |
| | | @click="addSchema"></el-button> --> |
| | | </div> |
| | | <div class="head-container"> |
| | | <el-tree :data="deptOptions" :props="defaultProps" :expand-on-click-node="false" |
| | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="归属部门" prop="deptId"> |
| | | <treeselect v-model="form.deptId" :options="enabledDeptOptions" :show-count="true" placeholder="请选择归属部门" /> |
| | | <treeselect v-model="form.deptId" :options="enabledDeptOptions" :show-count="true" |
| | | placeholder="请选择归属部门" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |