重构api包
This commit is contained in:
parent
8a14e2ed3b
commit
44eda2f611
@ -61,3 +61,10 @@ export function getCodeImg() {
|
||||
timeout: 20000,
|
||||
});
|
||||
}
|
||||
|
||||
// 获取路由
|
||||
export const getRouters = () =>
|
||||
request({
|
||||
url: '/getRouters',
|
||||
method: 'get',
|
||||
});
|
||||
@ -1,7 +0,0 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
// 获取路由
|
||||
export const getRouters = () => request({
|
||||
url: '/getRouters',
|
||||
method: 'get',
|
||||
});
|
||||
@ -18,7 +18,7 @@ export function deleteLoginInfo(infoId) {
|
||||
}
|
||||
|
||||
// 清空登录日志
|
||||
export function cleanLoginInfo() {
|
||||
export function deleteAll() {
|
||||
return request({
|
||||
url: '/loginInfo/clean',
|
||||
method: 'delete',
|
||||
@ -18,7 +18,7 @@ export function deleteOperationLog(operationId) {
|
||||
}
|
||||
|
||||
// 清空操作日志
|
||||
export function cleanOperlog() {
|
||||
export function deleteAll() {
|
||||
return request({
|
||||
url: '/operationLog/clean',
|
||||
method: 'delete',
|
||||
@ -10,7 +10,7 @@ export function listDept(query) {
|
||||
}
|
||||
|
||||
// 查询部门列表(排除当前自身节点)
|
||||
export function listDeptExcludeCurrentDeptItself(deptId) {
|
||||
export function listDeptExcludeItself(deptId) {
|
||||
return request({
|
||||
url: `/system/dept/list/exclude/${deptId}`,
|
||||
method: 'get',
|
||||
@ -34,7 +34,7 @@ export function getDeptSelectTree() {
|
||||
}
|
||||
|
||||
// 根据角色ID查询部门树结构
|
||||
export function getDeptTreeSelectByRole(roleId) {
|
||||
export function getDeptSelectTreeByRole(roleId) {
|
||||
return request({
|
||||
url: `/system/dept/dropdownList/role/${roleId}`,
|
||||
method: 'get',
|
||||
@ -67,7 +67,7 @@ export function deleteRole(roleId) {
|
||||
}
|
||||
|
||||
// 查询角色已授权用户列表
|
||||
export function allocatedUserList(query) {
|
||||
export function getRoleAssignedUserList(query) {
|
||||
const { roleId } = query;
|
||||
return request({
|
||||
url: `/system/role/${roleId}/allocated/list`,
|
||||
@ -77,7 +77,7 @@ export function allocatedUserList(query) {
|
||||
}
|
||||
|
||||
// 查询角色未授权用户列表
|
||||
export function unallocatedUserList(query) {
|
||||
export function getRoleUnassignedUserList(query) {
|
||||
const { roleId } = query;
|
||||
return request({
|
||||
url: `/system/role/${roleId}/unallocated/list`,
|
||||
@ -37,7 +37,7 @@ export function updateUser(data) {
|
||||
}
|
||||
|
||||
// 删除用户
|
||||
export function delUser(userId) {
|
||||
export function deleteUser(userId) {
|
||||
return request({
|
||||
url: `/system/user/${userId}`,
|
||||
method: 'delete',
|
||||
@ -45,7 +45,7 @@ export function delUser(userId) {
|
||||
}
|
||||
|
||||
// 用户密码重置
|
||||
export function resetUserPwd(userId, password) {
|
||||
export function resetUserPassword(userId, password) {
|
||||
const data = {
|
||||
userId,
|
||||
password,
|
||||
@ -88,7 +88,7 @@ export function updateUserProfile(data) {
|
||||
}
|
||||
|
||||
// 用户密码重置
|
||||
export function updateUserPwd(oldPassword, newPassword) {
|
||||
export function updateUserPassword(oldPassword, newPassword) {
|
||||
const data = {
|
||||
oldPassword,
|
||||
newPassword,
|
||||
@ -110,7 +110,7 @@ export function uploadAvatar(data) {
|
||||
}
|
||||
|
||||
// 查询授权角色
|
||||
export function getAuthRole(userId) {
|
||||
export function getRoleOfUser(userId) {
|
||||
return request({
|
||||
url: `/system/user/${userId}/role/`,
|
||||
method: 'get',
|
||||
@ -118,7 +118,7 @@ export function getAuthRole(userId) {
|
||||
}
|
||||
|
||||
// 保存授权角色
|
||||
export function updateAuthRole(data) {
|
||||
export function updateRoleOfUser(data) {
|
||||
const { userId } = data.userId;
|
||||
return request({
|
||||
url: `/system/user/${userId}/role/`,
|
||||
@ -120,6 +120,7 @@ function generateRoutes(routes, basePath = '', prefixTitle = []) {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
function querySearch(query) {
|
||||
if (query !== '') {
|
||||
options.value = fuse.value.search(query);
|
||||
|
||||
@ -107,19 +107,6 @@ export const constantRoutes = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/system/dict-data',
|
||||
component: Layout,
|
||||
hidden: true,
|
||||
children: [
|
||||
{
|
||||
path: 'index/:dictId(\\d+)',
|
||||
component: () => import('@/views/system/dict/data'),
|
||||
name: 'Data',
|
||||
meta: { title: '字典数据', activeMenu: '/system/dict' },
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const router = createRouter({
|
||||
|
||||
@ -8,7 +8,6 @@ import { isHttp } from '@/utils/validate';
|
||||
import { isReLogin } from '@/utils/request';
|
||||
|
||||
NProgress.configure({ showSpinner: false });
|
||||
|
||||
const whiteList = ['/login', '/auth-redirect', '/bind', '/register'];
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
@ -16,13 +15,11 @@ router.beforeEach((to, from, next) => {
|
||||
if (getToken()) {
|
||||
to.meta.title && store.dispatch('settings/setTitle', to.meta.title);
|
||||
|
||||
console.log(store.getters.role);
|
||||
/* has token */
|
||||
if (to.path === '/login') {
|
||||
next({ path: '/' });
|
||||
NProgress.done();
|
||||
} else if (!store.getters.role) {
|
||||
console.log('重复获取');
|
||||
isReLogin.show = true;
|
||||
// 判断当前用户是否已拉取完user_info信息
|
||||
store
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { constantRoutes } from '@/router';
|
||||
import { getRouters } from '@/api/menu';
|
||||
// import { getRouters } from '@/api/loginApi';
|
||||
import * as loginApi from '@/api/loginApi';
|
||||
import Layout from '@/layout/index';
|
||||
import ParentView from '@/components/ParentView';
|
||||
import InnerLink from '@/layout/components/InnerLink';
|
||||
@ -35,7 +36,7 @@ const permission = {
|
||||
GenerateRoutes({ commit }) {
|
||||
return new Promise((resolve) => {
|
||||
// 向后端请求路由数据
|
||||
getRouters().then((res) => {
|
||||
loginApi.getRouters().then((res) => {
|
||||
const sdata = JSON.parse(JSON.stringify(res));
|
||||
const rdata = JSON.parse(JSON.stringify(res));
|
||||
const defaultData = JSON.parse(JSON.stringify(res));
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { login, logout, getLoginUserInfo } from '@/api/login';
|
||||
// import { login, logout, getLoginUserInfo } from '@/api/loginApi';
|
||||
import * as loginApi from '@/api/loginApi';
|
||||
import { getToken, setToken, removeToken } from '@/utils/token';
|
||||
import defAva from '@/assets/images/profile.jpg';
|
||||
|
||||
@ -41,7 +42,8 @@ const user = {
|
||||
const { code } = userInfo;
|
||||
const { uuid } = userInfo;
|
||||
return new Promise((resolve, reject) => {
|
||||
login(username, password, code, uuid)
|
||||
loginApi
|
||||
.login(username, password, code, uuid)
|
||||
.then((res) => {
|
||||
setToken(res.token);
|
||||
commit('SET_TOKEN', res.token);
|
||||
@ -56,7 +58,8 @@ const user = {
|
||||
// 获取用户信息
|
||||
GetInfo({ commit, state }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
getLoginUserInfo()
|
||||
loginApi
|
||||
.getLoginUserInfo()
|
||||
.then((res) => {
|
||||
const { user } = res;
|
||||
// console.log(user);
|
||||
@ -85,7 +88,8 @@ const user = {
|
||||
// 退出系统
|
||||
LogOut({ commit, state }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
logout(state.token)
|
||||
loginApi
|
||||
.logout(state.token)
|
||||
.then(() => {
|
||||
commit('SET_TOKEN', '');
|
||||
commit('SET_ROLE', null);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { getDictType } from '@/api/system/config';
|
||||
import { getDictType } from '@/api/system/configApi';
|
||||
import store from '../store';
|
||||
/**
|
||||
* 获取字典数据
|
||||
|
||||
@ -54,7 +54,8 @@
|
||||
|
||||
<script setup>
|
||||
import Cookies from 'js-cookie';
|
||||
import { getCodeImg } from '@/api/login';
|
||||
// import { getCodeImg } from '@/api/loginApi';
|
||||
import * as loginApi from '@/api/loginApi';
|
||||
import { encrypt, decrypt } from '@/utils/rsaUtil';
|
||||
|
||||
const store = useStore();
|
||||
@ -116,7 +117,7 @@ function handleLogin() {
|
||||
}
|
||||
|
||||
function getCode() {
|
||||
getCodeImg().then((res) => {
|
||||
loginApi.getCodeImg().then((res) => {
|
||||
isCaptchaOn.value = res.isCaptchaOn === undefined ? true : res.isCaptchaOn;
|
||||
if (isCaptchaOn.value) {
|
||||
codeUrl.value = `data:image/gif;base64,${res.img}`;
|
||||
|
||||
59
src/views/monitor/cache/index.vue
vendored
59
src/views/monitor/cache/index.vue
vendored
@ -9,33 +9,63 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">Redis版本</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.redis_version }}</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="cache.info">{{ cache.info.redis_version }}</div>
|
||||
</td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">运行模式</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.redis_mode == "standalone" ? "单机" : "集群" }}</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="cache.info">
|
||||
{{ cache.info.redis_mode == 'standalone' ? '单机' : '集群' }}
|
||||
</div>
|
||||
</td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">端口</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.tcp_port }}</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="cache.info">{{ cache.info.tcp_port }}</div>
|
||||
</td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">客户端数</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.connected_clients }}</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="cache.info">{{ cache.info.connected_clients }}</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">运行时间(天)</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.uptime_in_days }}</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="cache.info">{{ cache.info.uptime_in_days }}</div>
|
||||
</td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">使用内存</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.used_memory_human }}</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="cache.info">{{ cache.info.used_memory_human }}</div>
|
||||
</td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">使用CPU</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ parseFloat(cache.info.used_cpu_user_children).toFixed(2) }}</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="cache.info">
|
||||
{{ parseFloat(cache.info.used_cpu_user_children).toFixed(2) }}
|
||||
</div>
|
||||
</td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">内存配置</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.maxmemory_human }}</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="cache.info">{{ cache.info.maxmemory_human }}</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">AOF是否开启</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.aof_enabled == "0" ? "否" : "是" }}</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="cache.info">{{ cache.info.aof_enabled == '0' ? '否' : '是' }}</div>
|
||||
</td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">RDB是否成功</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.rdb_last_bgsave_status }}</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="cache.info">{{ cache.info.rdb_last_bgsave_status }}</div>
|
||||
</td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">Key数量</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.dbSize">{{ cache.dbSize }} </div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="cache.dbSize">{{ cache.dbSize }}</div>
|
||||
</td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">网络入口/出口</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.instantaneous_input_kbps }}kps/{{cache.info.instantaneous_output_kbps}}kps</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="cache.info">
|
||||
{{ cache.info.instantaneous_input_kbps }}kps/{{ cache.info.instantaneous_output_kbps }}kps
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -68,7 +98,8 @@
|
||||
|
||||
<script setup>
|
||||
import * as echarts from 'echarts';
|
||||
import { getCacheInfo } from '@/api/monitor/cache';
|
||||
// import { getCacheInfo } from '@/api/monitor/cache';
|
||||
import * as cacheInfoApi from '@/api/monitor/cacheInfoApi';
|
||||
|
||||
const cache = ref([]);
|
||||
const commandstats = ref(null);
|
||||
@ -77,7 +108,7 @@ const { proxy } = getCurrentInstance();
|
||||
|
||||
function getList() {
|
||||
proxy.$modal.loading('正在加载缓存监控数据,请稍候!');
|
||||
getCacheInfo().then((response) => {
|
||||
cacheInfoApi.getCacheInfo().then((response) => {
|
||||
proxy.$modal.closeLoading();
|
||||
cache.value = response;
|
||||
|
||||
|
||||
@ -58,7 +58,12 @@
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermission="['system:logininfor:export']"
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
v-hasPermission="['system:logininfor:export']"
|
||||
>导出</el-button
|
||||
>
|
||||
</el-col>
|
||||
@ -118,10 +123,11 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Logininfor">
|
||||
import {list, deleteLoginInfo, cleanLoginInfo} from '@/api/monitor/logininfor';
|
||||
// import {list, deleteLoginInfo, cleanLoginInfo} from '@/api/monitor/logininfor';
|
||||
import * as loginInfoApi from '@/api/monitor/loginInfoApi';
|
||||
|
||||
const {proxy} = getCurrentInstance();
|
||||
const {sys_operation_status} = proxy.useDict('sys_operation_status');
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_operation_status } = proxy.useDict('sys_operation_status');
|
||||
|
||||
const logininforList = ref([]);
|
||||
const loading = ref(true);
|
||||
@ -130,7 +136,7 @@ const ids = ref([]);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const dateRange = ref([]);
|
||||
const defaultSort = ref({prop: 'loginTime', order: 'descending'});
|
||||
const defaultSort = ref({ prop: 'loginTime', order: 'descending' });
|
||||
|
||||
// 查询参数
|
||||
const queryParams = ref({
|
||||
@ -146,7 +152,8 @@ const queryParams = ref({
|
||||
/** 查询登录日志列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
list(proxy.addTimeRange(queryParams.value, dateRange.value))
|
||||
loginInfoApi
|
||||
.list(proxy.addTimeRange(queryParams.value, dateRange.value))
|
||||
.then((response) => {
|
||||
logininforList.value = response.rows;
|
||||
total.value = response.total;
|
||||
@ -183,7 +190,7 @@ function handleDelete(row) {
|
||||
const infoIds = row.infoId || ids.value;
|
||||
proxy.$modal
|
||||
.confirm(`是否确认删除访问编号为"${infoIds}"的数据项?`)
|
||||
.then(() => deleteLoginInfo(infoIds))
|
||||
.then(() => loginInfoApi.deleteLoginInfo(infoIds))
|
||||
.then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess('删除成功');
|
||||
@ -194,7 +201,7 @@ function handleDelete(row) {
|
||||
function handleClean() {
|
||||
proxy.$modal
|
||||
.confirm('是否确认清空所有登录日志数据项?')
|
||||
.then(() => cleanLoginInfo())
|
||||
.then(() => loginInfoApi.deleteAll())
|
||||
.then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess('清空成功');
|
||||
|
||||
@ -53,7 +53,8 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Online">
|
||||
import { forceLogout, list as initData } from '@/api/monitor/online';
|
||||
// import { forceLogout, list as initData } from '@/api/monitor/online';
|
||||
import * as onlineUserApi from '@/api/monitor/onlineUserApi';
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
@ -71,7 +72,8 @@ const queryParams = ref({
|
||||
/** 查询登录日志列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
initData(queryParams.value)
|
||||
onlineUserApi
|
||||
.list(queryParams.value)
|
||||
.then((response) => {
|
||||
onlineList.value = response.rows;
|
||||
total.value = response.total;
|
||||
@ -94,7 +96,7 @@ function resetQuery() {
|
||||
function handleForceLogout(row) {
|
||||
proxy.$modal
|
||||
.confirm(`是否确认强退名称为"${row.userName}"的用户?`)
|
||||
.then(() => forceLogout(row.tokenId))
|
||||
.then(() => onlineUserApi.forceLogout(row.tokenId))
|
||||
.then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess('删除成功');
|
||||
|
||||
@ -187,7 +187,8 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Operlog">
|
||||
import { list, deleteOperationLog, cleanOperlog } from '@/api/monitor/operlog';
|
||||
// import { list, deleteOperationLog, cleanOperlog } from '@/api/monitor/operationLogApi';
|
||||
import * as operationLogApi from '@/api/monitor/operationLogApi';
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_operation_type, sys_operation_status } = proxy.useDict('sys_operation_type', 'sys_operation_status');
|
||||
@ -221,7 +222,8 @@ const { queryParams, form } = toRefs(data);
|
||||
/** 查询登录日志 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
list(proxy.addTimeRange(queryParams.value, dateRange.value))
|
||||
operationLogApi
|
||||
.list(proxy.addTimeRange(queryParams.value, dateRange.value))
|
||||
.then((response) => {
|
||||
operlogList.value = response.rows;
|
||||
total.value = response.total;
|
||||
@ -267,7 +269,7 @@ function handleDelete(row) {
|
||||
const operationIds = row.operationId || ids.value;
|
||||
proxy.$modal
|
||||
.confirm(`是否确认删除日志编号为"${operationIds}"的数据项?`)
|
||||
.then(() => deleteOperationLog(operationIds))
|
||||
.then(() => operationLogApi.deleteOperationLog(operationIds))
|
||||
.then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess('删除成功');
|
||||
@ -278,7 +280,7 @@ function handleDelete(row) {
|
||||
function handleClean() {
|
||||
proxy.$modal
|
||||
.confirm('是否确认清空所有操作日志数据项?')
|
||||
.then(() => cleanOperlog())
|
||||
.then(() => operationLogApi.deleteAll())
|
||||
.then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess('清空成功');
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<el-card>
|
||||
<template #header><span>CPU</span></template>
|
||||
<div class="el-table el-table--enable-row-hover el-table--medium">
|
||||
<table cellspacing="0" style="width: 100%;">
|
||||
<table cellspacing="0" style="width: 100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="el-table__cell is-leaf"><div class="cell">属性</div></th>
|
||||
@ -15,19 +15,27 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">核心数</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.cpuInfo">{{ server.cpuInfo.cpuNum }}</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="server.cpuInfo">{{ server.cpuInfo.cpuNum }}</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">用户使用率</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.cpuInfo">{{ server.cpuInfo.used }}%</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="server.cpuInfo">{{ server.cpuInfo.used }}%</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">系统使用率</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.cpuInfo">{{ server.cpuInfo.sys }}%</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="server.cpuInfo">{{ server.cpuInfo.sys }}%</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">当前空闲率</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.cpuInfo">{{ server.cpuInfo.free }}%</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="server.cpuInfo">{{ server.cpuInfo.free }}%</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -39,7 +47,7 @@
|
||||
<el-card>
|
||||
<template #header><span>内存</span></template>
|
||||
<div class="el-table el-table--enable-row-hover el-table--medium">
|
||||
<table cellspacing="0" style="width: 100%;">
|
||||
<table cellspacing="0" style="width: 100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="el-table__cell is-leaf"><div class="cell">属性</div></th>
|
||||
@ -50,23 +58,43 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">总内存</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.memoryInfo">{{ server.memoryInfo.total }}G</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.jvmInfo">{{ server.jvmInfo.total }}M</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="server.memoryInfo">{{ server.memoryInfo.total }}G</div>
|
||||
</td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="server.jvmInfo">{{ server.jvmInfo.total }}M</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">已用内存</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.memoryInfo">{{ server.memoryInfo.used}}G</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.jvmInfo">{{ server.jvmInfo.used}}M</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="server.memoryInfo">{{ server.memoryInfo.used }}G</div>
|
||||
</td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="server.jvmInfo">{{ server.jvmInfo.used }}M</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">剩余内存</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.memoryInfo">{{ server.memoryInfo.free }}G</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.jvmInfo">{{ server.jvmInfo.free }}M</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="server.memoryInfo">{{ server.memoryInfo.free }}G</div>
|
||||
</td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="server.jvmInfo">{{ server.jvmInfo.free }}M</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">使用率</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.memoryInfo" :class="{'text-danger': server.memoryInfo.usage > 80}">{{ server.memoryInfo.usage }}%</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.jvmInfo" :class="{'text-danger': server.jvmInfo.usage > 80}">{{ server.jvmInfo.usage }}%</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="server.memoryInfo" :class="{ 'text-danger': server.memoryInfo.usage > 80 }">
|
||||
{{ server.memoryInfo.usage }}%
|
||||
</div>
|
||||
</td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="server.jvmInfo" :class="{ 'text-danger': server.jvmInfo.usage > 80 }">
|
||||
{{ server.jvmInfo.usage }}%
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -78,19 +106,27 @@
|
||||
<el-card>
|
||||
<template #header><span>服务器信息</span></template>
|
||||
<div class="el-table el-table--enable-row-hover el-table--medium">
|
||||
<table cellspacing="0" style="width: 100%;">
|
||||
<table cellspacing="0" style="width: 100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">服务器名称</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.systemInfo">{{ server.systemInfo.computerName }}</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="server.systemInfo">{{ server.systemInfo.computerName }}</div>
|
||||
</td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">操作系统</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.systemInfo">{{ server.systemInfo.osName }}</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="server.systemInfo">{{ server.systemInfo.osName }}</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">服务器IP</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.systemInfo">{{ server.systemInfo.computerIp }}</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="server.systemInfo">{{ server.systemInfo.computerIp }}</div>
|
||||
</td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">系统架构</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.systemInfo">{{ server.systemInfo.osArch }}</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="server.systemInfo">{{ server.systemInfo.osArch }}</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -102,31 +138,45 @@
|
||||
<el-card>
|
||||
<template #header><span>Java虚拟机信息</span></template>
|
||||
<div class="el-table el-table--enable-row-hover el-table--medium">
|
||||
<table cellspacing="0" style="width: 100%;table-layout:fixed;">
|
||||
<table cellspacing="0" style="width: 100%; table-layout: fixed">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">Java名称</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.jvmInfo">{{ server.jvmInfo.name }}</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="server.jvmInfo">{{ server.jvmInfo.name }}</div>
|
||||
</td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">Java版本</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.jvmInfo">{{ server.jvmInfo.version }}</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="server.jvmInfo">{{ server.jvmInfo.version }}</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">启动时间</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.jvmInfo">{{ server.jvmInfo.startTime }}</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="server.jvmInfo">{{ server.jvmInfo.startTime }}</div>
|
||||
</td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">运行时长</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.jvmInfo">{{ server.jvmInfo.runTime }}</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="server.jvmInfo">{{ server.jvmInfo.runTime }}</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1" class="el-table__cell is-leaf"><div class="cell">安装路径</div></td>
|
||||
<td colspan="3" class="el-table__cell is-leaf"><div class="cell" v-if="server.jvmInfo">{{ server.jvmInfo.home }}</div></td>
|
||||
<td colspan="3" class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="server.jvmInfo">{{ server.jvmInfo.home }}</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1" class="el-table__cell is-leaf"><div class="cell">项目路径</div></td>
|
||||
<td colspan="3" class="el-table__cell is-leaf"><div class="cell" v-if="server.systemInfo">{{ server.systemInfo.userDir }}</div></td>
|
||||
<td colspan="3" class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="server.systemInfo">{{ server.systemInfo.userDir }}</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1" class="el-table__cell is-leaf"><div class="cell">运行参数</div></td>
|
||||
<td colspan="3" class="el-table__cell is-leaf"><div class="cell" v-if="server.jvmInfo">{{ server.jvmInfo.inputArgs }}</div></td>
|
||||
<td colspan="3" class="el-table__cell is-leaf">
|
||||
<div class="cell" v-if="server.jvmInfo">{{ server.jvmInfo.inputArgs }}</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -138,7 +188,7 @@
|
||||
<el-card>
|
||||
<template #header><span>磁盘状态</span></template>
|
||||
<div class="el-table el-table--enable-row-hover el-table--medium">
|
||||
<table cellspacing="0" style="width: 100%;">
|
||||
<table cellspacing="0" style="width: 100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="el-table__cell el-table__cell is-leaf"><div class="cell">盘符路径</div></th>
|
||||
@ -152,13 +202,27 @@
|
||||
</thead>
|
||||
<tbody v-if="server.diskInfos">
|
||||
<tr v-for="(sysFile, index) in server.diskInfos" :key="index">
|
||||
<td class="el-table__cell is-leaf"><div class="cell">{{ sysFile.dirName }}</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">{{ sysFile.sysTypeName }}</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">{{ sysFile.typeName }}</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">{{ sysFile.total }}</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">{{ sysFile.free }}</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell">{{ sysFile.used }}</div></td>
|
||||
<td class="el-table__cell is-leaf"><div class="cell" :class="{'text-danger': sysFile.usage > 80}">{{ sysFile.usage }}%</div></td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell">{{ sysFile.dirName }}</div>
|
||||
</td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell">{{ sysFile.sysTypeName }}</div>
|
||||
</td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell">{{ sysFile.typeName }}</div>
|
||||
</td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell">{{ sysFile.total }}</div>
|
||||
</td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell">{{ sysFile.free }}</div>
|
||||
</td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell">{{ sysFile.used }}</div>
|
||||
</td>
|
||||
<td class="el-table__cell is-leaf">
|
||||
<div class="cell" :class="{ 'text-danger': sysFile.usage > 80 }">{{ sysFile.usage }}%</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -170,14 +234,15 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getServerInfo } from '@/api/monitor/server';
|
||||
// import { getServerInfo } from '@/api/monitor/serverApi';
|
||||
import * as serverApi from '@/api/monitor/serverApi';
|
||||
|
||||
const server = ref([]);
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
function getList() {
|
||||
proxy.$modal.loading('正在加载服务监控数据,请稍候!');
|
||||
getServerInfo().then((response) => {
|
||||
serverApi.getServerInfo().then((response) => {
|
||||
server.value = response;
|
||||
proxy.$modal.closeLoading();
|
||||
});
|
||||
|
||||
@ -72,8 +72,8 @@
|
||||
|
||||
<script setup>
|
||||
import { ElMessageBox } from 'element-plus';
|
||||
import { getCodeImg, register } from '@/api/login';
|
||||
|
||||
// import { getCodeImg, register } from '@/api/loginApi';
|
||||
import * as loginApi from '@/api/loginApi';
|
||||
const router = useRouter();
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
@ -127,7 +127,8 @@ function handleRegister() {
|
||||
proxy.$refs.registerRef.validate((valid) => {
|
||||
if (valid) {
|
||||
loading.value = true;
|
||||
register(registerForm.value)
|
||||
loginApi
|
||||
.register(registerForm.value)
|
||||
.then((res) => {
|
||||
const { username } = registerForm.value;
|
||||
ElMessageBox.alert(`<font color='red'>恭喜你,您的账号 ${username} 注册成功!</font>`, '系统提示', {
|
||||
@ -150,7 +151,7 @@ function handleRegister() {
|
||||
}
|
||||
|
||||
function getCode() {
|
||||
getCodeImg().then((res) => {
|
||||
loginApi.getCodeImg().then((res) => {
|
||||
isCaptchaOn.value = res.isCaptchaOn === undefined ? true : res.isCaptchaOn;
|
||||
if (isCaptchaOn.value) {
|
||||
codeUrl.value = `data:image/gif;base64,${res.img}`;
|
||||
|
||||
@ -136,7 +136,8 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Config">
|
||||
import { listConfig, getConfig, updateConfig, refreshCache } from '@/api/system/config';
|
||||
// import { listConfig, getConfig, updateConfig, refreshCache } from '@/api/system/configApi';
|
||||
import * as configApi from '@/api/system/configApi';
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_yes_no } = proxy.useDict('sys_yes_no');
|
||||
@ -173,7 +174,8 @@ const { queryParams, form, rules } = toRefs(data);
|
||||
/** 查询参数列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listConfig(proxy.addTimeRange(queryParams.value, dateRange.value))
|
||||
configApi
|
||||
.listConfig(proxy.addTimeRange(queryParams.value, dateRange.value))
|
||||
.then((response) => {
|
||||
configList.value = response.rows;
|
||||
total.value = response.total;
|
||||
@ -222,7 +224,7 @@ function handleSelectionChange(selection) {
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const configId = row.configId || ids.value;
|
||||
getConfig(configId).then((response) => {
|
||||
configApi.getConfig(configId).then((response) => {
|
||||
form.value = response;
|
||||
open.value = true;
|
||||
title.value = '修改参数';
|
||||
@ -232,7 +234,7 @@ function handleUpdate(row) {
|
||||
function submitForm() {
|
||||
proxy.$refs.configRef.validate((valid) => {
|
||||
if (valid) {
|
||||
updateConfig(form.value).then(() => {
|
||||
configApi.updateConfig(form.value).then(() => {
|
||||
proxy.$modal.msgSuccess('修改成功');
|
||||
open.value = false;
|
||||
getList();
|
||||
@ -243,7 +245,7 @@ function submitForm() {
|
||||
|
||||
/** 刷新缓存按钮操作 */
|
||||
function handleRefreshCache() {
|
||||
refreshCache().then(() => {
|
||||
configApi.refreshCache().then(() => {
|
||||
proxy.$modal.msgSuccess('刷新缓存成功');
|
||||
});
|
||||
}
|
||||
|
||||
@ -134,14 +134,8 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Dept">
|
||||
import {
|
||||
listDept,
|
||||
getDept,
|
||||
deleteDept,
|
||||
addDept,
|
||||
updateDept,
|
||||
listDeptExcludeCurrentDeptItself,
|
||||
} from '@/api/system/dept';
|
||||
// import { listDept, getDept,deleteDept,addDept,updateDept,listDeptExcludeCurrentDeptItself } from '@/api/system/deptApi';
|
||||
import * as deptApi from '@/api/system/deptApi';
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_status } = proxy.useDict('sys_status');
|
||||
@ -175,7 +169,8 @@ const { queryParams, form, rules } = toRefs(data);
|
||||
/** 查询部门列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listDept(queryParams.value)
|
||||
deptApi
|
||||
.listDept(queryParams.value)
|
||||
.then((response) => {
|
||||
deptList.value = proxy.handleTree(response, 'deptId');
|
||||
})
|
||||
@ -214,7 +209,7 @@ function resetQuery() {
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd(row) {
|
||||
reset();
|
||||
listDept().then((response) => {
|
||||
deptApi.listDept().then((response) => {
|
||||
deptOptions.value = proxy.handleTree(response, 'deptId');
|
||||
});
|
||||
if (row != undefined) {
|
||||
@ -234,10 +229,10 @@ function toggleExpandAll() {
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
listDeptExcludeCurrentDeptItself(row.deptId).then((response) => {
|
||||
deptApi.listDeptExcludeItself(row.deptId).then((response) => {
|
||||
deptOptions.value = proxy.handleTree(response, 'deptId');
|
||||
});
|
||||
getDept(row.deptId).then((response) => {
|
||||
deptApi.getDept(row.deptId).then((response) => {
|
||||
form.value = response;
|
||||
open.value = true;
|
||||
title.value = '修改部门';
|
||||
@ -248,13 +243,13 @@ function submitForm() {
|
||||
proxy.$refs.deptRef.validate((valid) => {
|
||||
if (valid) {
|
||||
if (form.value.deptId != undefined) {
|
||||
updateDept(form.value).then((response) => {
|
||||
deptApi.updateDept(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess('修改成功');
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
addDept(form.value).then((response) => {
|
||||
deptApi.addDept(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess('新增成功');
|
||||
open.value = false;
|
||||
getList();
|
||||
@ -267,7 +262,7 @@ function submitForm() {
|
||||
function handleDelete(row) {
|
||||
proxy.$modal
|
||||
.confirm(`是否确认删除名称为"${row.deptName}"的数据项?`)
|
||||
.then(() => deleteDept(row.deptId))
|
||||
.then(() => deptApi.deleteDept(row.deptId))
|
||||
.then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess('删除成功');
|
||||
|
||||
@ -275,7 +275,8 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Menu">
|
||||
import { addMenu, deleteMenu, getMenu, listMenu, updateMenu } from '@/api/system/menu';
|
||||
// import { addMenu, deleteMenu, getMenu, listMenu, updateMenu } from '@/api/system/menuApi';
|
||||
import * as menuApi from '@/api/system/menuApi';
|
||||
import SvgIcon from '@/components/SvgIcon';
|
||||
import IconSelect from '@/components/IconSelect';
|
||||
|
||||
@ -311,7 +312,8 @@ const { queryParams, form, rules } = toRefs(data);
|
||||
/** 查询菜单列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listMenu(queryParams.value)
|
||||
menuApi
|
||||
.listMenu(queryParams.value)
|
||||
.then((response) => {
|
||||
menuList.value = proxy.handleTree(response, 'menuId');
|
||||
})
|
||||
@ -322,7 +324,7 @@ function getList() {
|
||||
/** 查询菜单下拉树结构 */
|
||||
function getTreeSelect() {
|
||||
menuOptions.value = [];
|
||||
listMenu().then((response) => {
|
||||
menuApi.listMenu().then((response) => {
|
||||
const menu = { menuId: 0, menuName: '主类目', children: [] };
|
||||
menu.children = proxy.handleTree(response, 'menuId');
|
||||
menuOptions.value.push(menu);
|
||||
@ -397,7 +399,7 @@ function toggleExpandAll() {
|
||||
async function handleUpdate(row) {
|
||||
reset();
|
||||
await getTreeSelect();
|
||||
getMenu(row.menuId).then((response) => {
|
||||
menuApi.getMenu(row.menuId).then((response) => {
|
||||
form.value = response;
|
||||
open.value = true;
|
||||
title.value = '修改菜单';
|
||||
@ -408,13 +410,13 @@ function submitForm() {
|
||||
proxy.$refs.menuRef.validate((valid) => {
|
||||
if (valid) {
|
||||
if (form.value.menuId != undefined) {
|
||||
updateMenu(form.value).then((response) => {
|
||||
menuApi.updateMenu(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess('修改成功');
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
addMenu(form.value).then((response) => {
|
||||
menuApi.addMenu(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess('新增成功');
|
||||
open.value = false;
|
||||
getList();
|
||||
@ -427,7 +429,7 @@ function submitForm() {
|
||||
function handleDelete(row) {
|
||||
proxy.$modal
|
||||
.confirm(`是否确认删除名称为"${row.menuName}"的数据项?`)
|
||||
.then(() => deleteMenu(row.menuId))
|
||||
.then(() => menuApi.deleteMenu(row.menuId))
|
||||
.then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess('删除成功');
|
||||
|
||||
@ -147,7 +147,8 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Notice">
|
||||
import { listNotice, getNotice, deleteNotice, addNotice, updateNotice } from '@/api/system/notice';
|
||||
// import { listNotice, getNotice, deleteNotice, addNotice, updateNotice } from '@/api/system/notice';
|
||||
import * as noticeApi from '@/api/system/noticeApi';
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_notice_status, sys_notice_type } = proxy.useDict('sys_notice_status', 'sys_notice_type');
|
||||
@ -182,7 +183,8 @@ const { queryParams, form, rules } = toRefs(data);
|
||||
/** 查询公告列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listNotice(queryParams.value)
|
||||
noticeApi
|
||||
.listNotice(queryParams.value)
|
||||
.then((response) => {
|
||||
noticeList.value = response.rows;
|
||||
total.value = response.total;
|
||||
@ -233,7 +235,7 @@ function handleAdd() {
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const noticeId = row.noticeId || ids.value;
|
||||
getNotice(noticeId).then((response) => {
|
||||
noticeApi.getNotice(noticeId).then((response) => {
|
||||
form.value = response;
|
||||
open.value = true;
|
||||
title.value = '修改公告';
|
||||
@ -244,13 +246,13 @@ function submitForm() {
|
||||
proxy.$refs.noticeRef.validate((valid) => {
|
||||
if (valid) {
|
||||
if (form.value.noticeId !== undefined) {
|
||||
updateNotice(form.value).then((response) => {
|
||||
noticeApi.updateNotice(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess('修改成功');
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
addNotice(form.value).then((response) => {
|
||||
noticeApi.addNotice(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess('新增成功');
|
||||
open.value = false;
|
||||
getList();
|
||||
@ -264,7 +266,7 @@ function handleDelete(row) {
|
||||
const noticeIds = row.noticeId || ids.value;
|
||||
proxy.$modal
|
||||
.confirm(`是否确认删除公告编号为"${noticeIds}"的数据项?`)
|
||||
.then(() => deleteNotice(noticeIds))
|
||||
.then(() => noticeApi.deleteNotice(noticeIds))
|
||||
.then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess('删除成功');
|
||||
|
||||
@ -132,7 +132,8 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Post">
|
||||
import { listPost, addPost, deletePost, getPost, updatePost } from '@/api/system/post';
|
||||
// import { listPost, addPost, deletePost, getPost, updatePost } from '@/api/system/post';
|
||||
import * as postApi from '@/api/system/postApi';
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_status } = proxy.useDict('sys_status');
|
||||
@ -168,7 +169,8 @@ const { queryParams, form, rules } = toRefs(data);
|
||||
/** 查询岗位列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listPost(queryParams.value)
|
||||
postApi
|
||||
.listPost(queryParams.value)
|
||||
.then((response) => {
|
||||
postList.value = response.rows;
|
||||
total.value = response.total;
|
||||
@ -220,7 +222,7 @@ function handleAdd() {
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const postId = row.postId || ids.value;
|
||||
getPost(postId).then((response) => {
|
||||
postApi.getPost(postId).then((response) => {
|
||||
form.value = response;
|
||||
open.value = true;
|
||||
title.value = '修改岗位';
|
||||
@ -231,13 +233,13 @@ function submitForm() {
|
||||
proxy.$refs.postRef.validate((valid) => {
|
||||
if (valid) {
|
||||
if (form.value.postId != undefined) {
|
||||
updatePost(form.value).then((response) => {
|
||||
postApi.updatePost(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess('修改成功');
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
addPost(form.value).then((response) => {
|
||||
postApi.addPost(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess('新增成功');
|
||||
open.value = false;
|
||||
getList();
|
||||
@ -251,7 +253,7 @@ function handleDelete(row) {
|
||||
const postIds = row.postId || ids.value;
|
||||
proxy.$modal
|
||||
.confirm(`是否确认删除岗位编号为"${postIds}"的数据项?`)
|
||||
.then(() => deletePost(postIds))
|
||||
.then(() => postApi.deletePost(postIds))
|
||||
.then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess('删除成功');
|
||||
|
||||
@ -91,7 +91,8 @@
|
||||
|
||||
<script setup name="AuthUser">
|
||||
import selectUser from './selectUser';
|
||||
import { allocatedUserList, deleteRoleOfUser, deleteRoleOfSomeUser } from '@/api/system/role';
|
||||
// import { allocatedUserList, deleteRoleOfUser, deleteRoleOfSomeUser } from '@/api/system/role';
|
||||
import * as roleApi from '@/api/system/roleApi';
|
||||
|
||||
const route = useRoute();
|
||||
const { proxy } = getCurrentInstance();
|
||||
@ -115,7 +116,8 @@ const queryParams = reactive({
|
||||
/** 查询授权用户列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
allocatedUserList(queryParams)
|
||||
roleApi
|
||||
.getRoleAssignedUserList(queryParams)
|
||||
.then((response) => {
|
||||
userList.value = response.rows;
|
||||
total.value = response.total;
|
||||
@ -152,7 +154,7 @@ function openSelectUser() {
|
||||
function cancelAuthUser(row) {
|
||||
proxy.$modal
|
||||
.confirm(`确认要取消该用户"${row.username}"角色吗?`)
|
||||
.then(() => deleteRoleOfSomeUser({ userIds: row.userId }))
|
||||
.then(() => roleApi.deleteRoleOfSomeUser({ userIds: row.userId }))
|
||||
.then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess('取消授权成功');
|
||||
@ -165,7 +167,7 @@ function cancelAuthUserAll(row) {
|
||||
const uIds = userIds.value.join(',');
|
||||
proxy.$modal
|
||||
.confirm('是否取消选中用户授权数据项?')
|
||||
.then(() => deleteRoleOfSomeUser({ roleId, userIds: uIds }))
|
||||
.then(() => roleApi.deleteRoleOfSomeUser({ roleId, userIds: uIds }))
|
||||
.then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess('取消授权成功');
|
||||
|
||||
@ -254,17 +254,12 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Role">
|
||||
import {
|
||||
addRole,
|
||||
changeRoleStatus,
|
||||
changeDataScope,
|
||||
deleteRole,
|
||||
getRole,
|
||||
listRole,
|
||||
updateRole,
|
||||
} from '@/api/system/role';
|
||||
import { getMenuSelectTreeByRole, getMenuSelectTree } from '@/api/system/menu';
|
||||
import { getDeptSelectTree, getDeptTreeSelectByRole } from '@/api/system/dept';
|
||||
// import { addRole, changeRoleStatus, changeDataScope, deleteRole, getRole,listRole,updateRole,} from '@/api/system/role';
|
||||
// import { getMenuSelectTreeByRole, getMenuSelectTree } from '@/api/system/menuApi';
|
||||
// import { getDeptSelectTree, getDeptTreeSelectByRole } from '@/api/system/deptApi';
|
||||
import * as roleApi from '@/api/system/roleApi';
|
||||
import * as menuApi from '@/api/system/menuApi';
|
||||
import * as deptApi from '@/api/system/deptApi';
|
||||
|
||||
const router = useRouter();
|
||||
const { proxy } = getCurrentInstance();
|
||||
@ -320,7 +315,8 @@ const { queryParams, form, rules } = toRefs(data);
|
||||
/** 查询角色列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listRole(proxy.addTimeRange(queryParams.value, dateRange.value))
|
||||
roleApi
|
||||
.listRole(proxy.addTimeRange(queryParams.value, dateRange.value))
|
||||
.then((response) => {
|
||||
roleList.value = response.rows;
|
||||
total.value = response.total;
|
||||
@ -345,7 +341,7 @@ function handleDelete(row) {
|
||||
const roleIds = row.roleId || ids.value;
|
||||
proxy.$modal
|
||||
.confirm(`是否确认删除角色编号为"${roleIds}"的数据项?`)
|
||||
.then(() => deleteRole(roleIds))
|
||||
.then(() => roleApi.deleteRole(roleIds))
|
||||
.then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess('删除成功');
|
||||
@ -373,7 +369,7 @@ function handleStatusChange(row) {
|
||||
const text = row.status === '1' ? '启用' : '停用';
|
||||
proxy.$modal
|
||||
.confirm(`确认要"${text}""${row.roleName}"角色吗?`)
|
||||
.then(() => changeRoleStatus(row.roleId, row.status))
|
||||
.then(() => roleApi.changeRoleStatus(row.roleId, row.status))
|
||||
.then(() => {
|
||||
proxy.$modal.msgSuccess(`${text}成功`);
|
||||
})
|
||||
@ -400,7 +396,7 @@ function handleAuthUser(row) {
|
||||
}
|
||||
/** 查询菜单树结构 */
|
||||
function getMenuTreeSelect() {
|
||||
getMenuSelectTree().then((response) => {
|
||||
menuApi.getMenuSelectTree().then((response) => {
|
||||
menuOptions.value = response;
|
||||
});
|
||||
}
|
||||
@ -448,7 +444,7 @@ function handleUpdate(row) {
|
||||
reset();
|
||||
const roleId = row.roleId || ids.value;
|
||||
const roleMenu = getRoleMenuTreeSelect(roleId);
|
||||
getRole(roleId).then((response) => {
|
||||
roleApi.getRole(roleId).then((response) => {
|
||||
form.value = response;
|
||||
form.value.roleSort = Number(form.value.roleSort);
|
||||
open.value = true;
|
||||
@ -467,18 +463,20 @@ function handleUpdate(row) {
|
||||
}
|
||||
/** 根据角色ID查询菜单树结构 */
|
||||
function getRoleMenuTreeSelect(roleId) {
|
||||
return getMenuSelectTreeByRole(roleId).then((response) => {
|
||||
return menuApi.getMenuSelectTreeByRole(roleId).then((response) => {
|
||||
menuOptions.value = response.menus;
|
||||
return response;
|
||||
});
|
||||
}
|
||||
|
||||
/** 根据角色ID查询部门树结构 */
|
||||
function getRoleDeptTreeSelect(roleId) {
|
||||
return getDeptTreeSelectByRole(roleId).then((response) => {
|
||||
return deptApi.getDeptSelectTreeByRole(roleId).then((response) => {
|
||||
deptOptions.value = response.depts;
|
||||
return response;
|
||||
});
|
||||
}
|
||||
|
||||
/** 树权限(展开/折叠) */
|
||||
function handleCheckedTreeExpand(value, type) {
|
||||
if (type == 'menu') {
|
||||
@ -522,14 +520,14 @@ function submitForm() {
|
||||
if (valid) {
|
||||
if (form.value.roleId != undefined) {
|
||||
form.value.menuIds = getMenuAllCheckedKeys();
|
||||
updateRole(form.value).then((response) => {
|
||||
roleApi.updateRole(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess('修改成功');
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
form.value.menuIds = getMenuAllCheckedKeys();
|
||||
addRole(form.value).then((response) => {
|
||||
roleApi.addRole(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess('新增成功');
|
||||
open.value = false;
|
||||
getList();
|
||||
@ -553,7 +551,7 @@ function dataScopeSelectChange(value) {
|
||||
function handleDataScope(row) {
|
||||
reset();
|
||||
const roleDeptTreeResponse = getRoleDeptTreeSelect(row.roleId);
|
||||
getRole(row.roleId).then((response) => {
|
||||
roleApi.getRole(row.roleId).then((response) => {
|
||||
form.value = response;
|
||||
openDataScope.value = true;
|
||||
nextTick(() => {
|
||||
@ -572,7 +570,7 @@ function handleDataScope(row) {
|
||||
function submitDataScope() {
|
||||
if (form.value.roleId != undefined) {
|
||||
form.value.deptIds = getDeptAllCheckedKeys();
|
||||
changeDataScope(form.value).then((response) => {
|
||||
roleApi.changeDataScope(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess('修改成功');
|
||||
openDataScope.value = false;
|
||||
getList();
|
||||
|
||||
@ -55,7 +55,8 @@
|
||||
</template>
|
||||
|
||||
<script setup name="SelectUser">
|
||||
import {addRoleOfAllUser, unallocatedUserList} from '@/api/system/role';
|
||||
// import {addRoleOfAllUser, unallocatedUserList} from '@/api/system/roleApi';
|
||||
import * as roleApi from '@/api/system/roleApi';
|
||||
|
||||
const props = defineProps({
|
||||
roleId: {
|
||||
@ -63,8 +64,8 @@ const props = defineProps({
|
||||
},
|
||||
});
|
||||
|
||||
const {proxy} = getCurrentInstance();
|
||||
const {sys_status} = proxy.useDict('sys_status');
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_status } = proxy.useDict('sys_status');
|
||||
|
||||
const userList = ref([]);
|
||||
const visible = ref(false);
|
||||
@ -95,7 +96,7 @@ function handleSelectionChange(selection) {
|
||||
}
|
||||
// 查询表数据
|
||||
function getList() {
|
||||
unallocatedUserList(queryParams).then((res) => {
|
||||
roleApi.getRoleUnassignedUserList(queryParams).then((res) => {
|
||||
userList.value = res.rows;
|
||||
total.value = res.total;
|
||||
});
|
||||
@ -113,13 +114,13 @@ function resetQuery() {
|
||||
const emit = defineEmits(['ok']);
|
||||
/** 选择授权用户操作 */
|
||||
function handleSelectUser() {
|
||||
const {roleId} = queryParams;
|
||||
const { roleId } = queryParams;
|
||||
const uIds = userIds.value.join(',');
|
||||
if (userIds.value.length == 0) {
|
||||
proxy.$modal.msgError('请选择要分配的用户');
|
||||
return;
|
||||
}
|
||||
addRoleOfAllUser({roleId, userIds: uIds}).then((res) => {
|
||||
roleApi.addRoleOfAllUser({ roleId, userIds: uIds }).then((res) => {
|
||||
proxy.$modal.msgSuccess('分配角色成功!');
|
||||
// if (res.code === 0) {
|
||||
visible.value = false;
|
||||
|
||||
@ -1,52 +1,60 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<h4 class="form-header h4">基本信息</h4>
|
||||
<el-form :model="form" label-width="80px">
|
||||
<el-row>
|
||||
<el-col :span="8" :offset="2">
|
||||
<el-form-item label="用户昵称" prop="nickName">
|
||||
<el-input v-model="form.nickName" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" :offset="2">
|
||||
<el-form-item label="登录账号" prop="username">
|
||||
<el-input v-model="form.username" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div class="app-container">
|
||||
<h4 class="form-header h4">基本信息</h4>
|
||||
<el-form :model="form" label-width="80px">
|
||||
<el-row>
|
||||
<el-col :span="8" :offset="2">
|
||||
<el-form-item label="用户昵称" prop="nickName">
|
||||
<el-input v-model="form.nickName" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" :offset="2">
|
||||
<el-form-item label="登录账号" prop="username">
|
||||
<el-input v-model="form.username" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<h4 class="form-header h4">角色信息</h4>
|
||||
<el-table v-loading="loading" :row-key="getRowKey" @row-click="clickRow" ref="roleRef" @selection-change="handleSelectionChange" :data="roles.slice((pageNum - 1) * pageSize, pageNum * pageSize)">
|
||||
<el-table-column label="序号" width="55" type="index" align="center">
|
||||
<template #default="scope">
|
||||
<span>{{ (pageNum - 1) * pageSize + scope.$index + 1 }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column type="selection" :reserve-selection="true" width="55"></el-table-column>
|
||||
<el-table-column label="角色编号" align="center" prop="roleId" />
|
||||
<el-table-column label="角色名称" align="center" prop="roleName" />
|
||||
<el-table-column label="权限字符" align="center" prop="roleKey" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<h4 class="form-header h4">角色信息</h4>
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:row-key="getRowKey"
|
||||
@row-click="clickRow"
|
||||
ref="roleRef"
|
||||
@selection-change="handleSelectionChange"
|
||||
:data="roles.slice((pageNum - 1) * pageSize, pageNum * pageSize)"
|
||||
>
|
||||
<el-table-column label="序号" width="55" type="index" align="center">
|
||||
<template #default="scope">
|
||||
<span>{{ (pageNum - 1) * pageSize + scope.$index + 1 }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column type="selection" :reserve-selection="true" width="55"></el-table-column>
|
||||
<el-table-column label="角色编号" align="center" prop="roleId" />
|
||||
<el-table-column label="角色名称" align="center" prop="roleName" />
|
||||
<el-table-column label="权限字符" align="center" prop="roleKey" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="pageNum" v-model:limit="pageSize" />
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="pageNum" v-model:limit="pageSize" />
|
||||
|
||||
<el-form label-width="100px">
|
||||
<div style="text-align: center;margin-left:-120px;margin-top:30px;">
|
||||
<el-button type="primary" @click="submitForm()">提交</el-button>
|
||||
<el-button @click="close()">返回</el-button>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
<el-form label-width="100px">
|
||||
<div style="text-align: center; margin-left: -120px; margin-top: 30px">
|
||||
<el-button type="primary" @click="submitForm()">提交</el-button>
|
||||
<el-button @click="close()">返回</el-button>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="AuthRole">
|
||||
import { getAuthRole, updateAuthRole } from '@/api/system/user';
|
||||
// import { getAuthRole, updateAuthRole } from '@/api/system/user';
|
||||
import * as userApi from '@/api/system/userApi';
|
||||
|
||||
const route = useRoute();
|
||||
const { proxy } = getCurrentInstance();
|
||||
@ -84,7 +92,7 @@ function close() {
|
||||
function submitForm() {
|
||||
const { userId } = form.value;
|
||||
const rIds = roleIds.value.join(',');
|
||||
updateAuthRole({ userId, roleIds: rIds }).then((response) => {
|
||||
userApi.updateRoleOfUser({ userId, roleIds: rIds }).then((response) => {
|
||||
proxy.$modal.msgSuccess('授权成功');
|
||||
close();
|
||||
});
|
||||
@ -94,7 +102,7 @@ function submitForm() {
|
||||
const userId = route.params && route.params.userId;
|
||||
if (userId) {
|
||||
loading.value = true;
|
||||
getAuthRole(userId).then((response) => {
|
||||
userApi.getRoleOfUser(userId).then((response) => {
|
||||
form.value = response.user;
|
||||
// TODO 改
|
||||
roles.value.push(response.role);
|
||||
|
||||
@ -373,8 +373,10 @@
|
||||
|
||||
<script setup name="User">
|
||||
import { getToken } from '@/utils/token';
|
||||
import { getDeptSelectTree } from '@/api/system/dept';
|
||||
import { changeUserStatus, listUser, resetUserPwd, delUser, getUser, updateUser, addUser } from '@/api/system/user';
|
||||
// import { getDeptSelectTree } from '@/api/system/deptApi';
|
||||
import * as deptApi from '@/api/system/deptApi';
|
||||
// import { changeUserStatus, listUser, resetUserPwd, delUser, getUser, updateUser, addUser } from '@/api/system/userApi';
|
||||
import * as userApi from '@/api/system/userApi';
|
||||
|
||||
const router = useRouter();
|
||||
const { proxy } = getCurrentInstance();
|
||||
@ -469,14 +471,15 @@ watch(deptName, (val) => {
|
||||
});
|
||||
/** 查询部门下拉树结构 */
|
||||
function getTreeSelect() {
|
||||
getDeptSelectTree().then((response) => {
|
||||
deptApi.getDeptSelectTree().then((response) => {
|
||||
deptOptions.value = response;
|
||||
});
|
||||
}
|
||||
/** 查询用户列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listUser(proxy.addTimeRange(queryParams.value, dateRange.value))
|
||||
userApi
|
||||
.listUser(proxy.addTimeRange(queryParams.value, dateRange.value))
|
||||
.then((res) => {
|
||||
userList.value = res.rows;
|
||||
total.value = res.total;
|
||||
@ -506,7 +509,7 @@ function handleDelete(row) {
|
||||
const userIds = row.userId || ids.value;
|
||||
proxy.$modal
|
||||
.confirm(`是否确认删除用户编号为"${userIds}"的数据项?`)
|
||||
.then(() => delUser(userIds))
|
||||
.then(() => userApi.deleteUser(userIds))
|
||||
.then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess('删除成功');
|
||||
@ -528,7 +531,7 @@ function handleStatusChange(row) {
|
||||
const text = row.status === '0' ? '停用' : '启用';
|
||||
proxy.$modal
|
||||
.confirm(`确认要"${text}""${row.username}"用户吗?`)
|
||||
.then(() => changeUserStatus(row.userId, row.status))
|
||||
.then(() => userApi.changeUserStatus(row.userId, row.status))
|
||||
.then(() => {
|
||||
proxy.$modal.msgSuccess(`${text}成功`);
|
||||
})
|
||||
@ -565,7 +568,7 @@ function handleResetPwd(row) {
|
||||
inputErrorMessage: '用户密码长度必须介于 5 和 20 之间',
|
||||
})
|
||||
.then(({ value }) => {
|
||||
resetUserPwd(row.userId, value).then((response) => {
|
||||
userApi.resetUserPassword(row.userId, value).then((response) => {
|
||||
proxy.$modal.msgSuccess(`修改成功,新密码是:${value}`);
|
||||
});
|
||||
})
|
||||
@ -610,7 +613,7 @@ function submitFileForm() {
|
||||
function initTreeData() {
|
||||
// 判断部门的数据是否存在,存在不获取,不存在则获取
|
||||
if (deptOptions.value === undefined) {
|
||||
getDeptSelectTree().then((response) => {
|
||||
deptApi.getDeptSelectTree().then((response) => {
|
||||
deptOptions.value = response;
|
||||
});
|
||||
}
|
||||
@ -642,7 +645,7 @@ function cancel() {
|
||||
function handleAdd() {
|
||||
reset();
|
||||
initTreeData();
|
||||
getUser().then((response) => {
|
||||
userApi.getUser().then((response) => {
|
||||
postOptions.value = response.posts;
|
||||
roleOptions.value = response.roles;
|
||||
open.value = true;
|
||||
@ -655,7 +658,7 @@ function handleUpdate(row) {
|
||||
reset();
|
||||
initTreeData();
|
||||
const userId = row.userId || ids.value;
|
||||
getUser(userId).then((response) => {
|
||||
userApi.getUser(userId).then((response) => {
|
||||
form.value = response.user;
|
||||
postOptions.value = response.posts;
|
||||
roleOptions.value = response.roles;
|
||||
@ -671,13 +674,13 @@ function submitForm() {
|
||||
proxy.$refs.userRef.validate((valid) => {
|
||||
if (valid) {
|
||||
if (form.value.userId != undefined) {
|
||||
updateUser(form.value).then((response) => {
|
||||
userApi.updateUser(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess('修改成功');
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
addUser(form.value).then((response) => {
|
||||
userApi.addUser(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess('新增成功');
|
||||
open.value = false;
|
||||
getList();
|
||||
|
||||
@ -1,72 +1,73 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="6" :xs="24">
|
||||
<el-card class="box-card">
|
||||
<template v-slot:header>
|
||||
<div class="clearfix">
|
||||
<span>个人信息</span>
|
||||
</div>
|
||||
</template>
|
||||
<div>
|
||||
<div class="text-center">
|
||||
<userAvatar :user="state.user" />
|
||||
</div>
|
||||
<ul class="list-group list-group-striped">
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="user" />用户名称
|
||||
<div class="pull-right">{{ state.user.username }}</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="phone" />手机号码
|
||||
<div class="pull-right">{{ state.user.phoneNumber }}</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="email" />用户邮箱
|
||||
<div class="pull-right">{{ state.user.email }}</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="tree" />所属部门
|
||||
<div class="pull-right" >{{ state.user.deptName }} / {{ state.postName }}</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="peoples" />所属角色
|
||||
<div class="pull-right">{{ state.roleName }}</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="date" />创建日期
|
||||
<div class="pull-right">{{ parseTime(state.user.createTime) }}</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="18" :xs="24">
|
||||
<el-card>
|
||||
<template v-slot:header>
|
||||
<div class="clearfix">
|
||||
<span>基本资料</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-tabs v-model="activeTab">
|
||||
<el-tab-pane label="基本资料" name="userinfo">
|
||||
<userInfo :user="state.user" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="修改密码" name="resetPwd">
|
||||
<resetPwd :user="state.user" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="app-container">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="6" :xs="24">
|
||||
<el-card class="box-card">
|
||||
<template v-slot:header>
|
||||
<div class="clearfix">
|
||||
<span>个人信息</span>
|
||||
</div>
|
||||
</template>
|
||||
<div>
|
||||
<div class="text-center">
|
||||
<userAvatar :user="state.user" />
|
||||
</div>
|
||||
<ul class="list-group list-group-striped">
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="user" />用户名称
|
||||
<div class="pull-right">{{ state.user.username }}</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="phone" />手机号码
|
||||
<div class="pull-right">{{ state.user.phoneNumber }}</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="email" />用户邮箱
|
||||
<div class="pull-right">{{ state.user.email }}</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="tree" />所属部门
|
||||
<div class="pull-right">{{ state.user.deptName }} / {{ state.postName }}</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="peoples" />所属角色
|
||||
<div class="pull-right">{{ state.roleName }}</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="date" />创建日期
|
||||
<div class="pull-right">{{ parseTime(state.user.createTime) }}</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="18" :xs="24">
|
||||
<el-card>
|
||||
<template v-slot:header>
|
||||
<div class="clearfix">
|
||||
<span>基本资料</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-tabs v-model="activeTab">
|
||||
<el-tab-pane label="基本资料" name="userinfo">
|
||||
<userInfo :user="state.user" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="修改密码" name="resetPwd">
|
||||
<resetPwd :user="state.user" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Profile">
|
||||
import userAvatar from './userAvatar';
|
||||
import userInfo from './userInfo';
|
||||
import resetPwd from './resetPwd';
|
||||
import { getUserProfile } from '@/api/system/user';
|
||||
// import { getUserProfile } from '@/api/system/user';
|
||||
import * as userApi from '@/api/system/userApi';
|
||||
|
||||
const activeTab = ref('userinfo');
|
||||
const state = reactive({
|
||||
@ -76,7 +77,7 @@ const state = reactive({
|
||||
});
|
||||
|
||||
function getUser() {
|
||||
getUserProfile().then((response) => {
|
||||
userApi.getUserProfile().then((response) => {
|
||||
state.user = response.user;
|
||||
state.roleName = response.roleName;
|
||||
state.postName = response.postName;
|
||||
|
||||
@ -1,23 +1,24 @@
|
||||
<template>
|
||||
<el-form ref="pwdRef" :model="user" :rules="rules" label-width="80px">
|
||||
<el-form-item label="旧密码" prop="oldPassword">
|
||||
<el-input v-model="user.oldPassword" placeholder="请输入旧密码" type="password" show-password />
|
||||
</el-form-item>
|
||||
<el-form-item label="新密码" prop="newPassword">
|
||||
<el-input v-model="user.newPassword" placeholder="请输入新密码" type="password" show-password />
|
||||
</el-form-item>
|
||||
<el-form-item label="确认密码" prop="confirmPassword">
|
||||
<el-input v-model="user.confirmPassword" placeholder="请确认密码" type="password" show-password/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-form ref="pwdRef" :model="user" :rules="rules" label-width="80px">
|
||||
<el-form-item label="旧密码" prop="oldPassword">
|
||||
<el-input v-model="user.oldPassword" placeholder="请输入旧密码" type="password" show-password />
|
||||
</el-form-item>
|
||||
<el-form-item label="新密码" prop="newPassword">
|
||||
<el-input v-model="user.newPassword" placeholder="请输入新密码" type="password" show-password />
|
||||
</el-form-item>
|
||||
<el-form-item label="确认密码" prop="confirmPassword">
|
||||
<el-input v-model="user.confirmPassword" placeholder="请确认密码" type="password" show-password />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submit">保存</el-button>
|
||||
<el-button type="danger" @click="close">关闭</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { updateUserPwd } from '@/api/system/user';
|
||||
// import { updateUserPwd } from '@/api/system/userApi';
|
||||
import * as userApi from '@/api/system/userApi';
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
@ -36,17 +37,26 @@ const equalToPassword = (rule, value, callback) => {
|
||||
};
|
||||
const rules = ref({
|
||||
oldPassword: [{ required: true, message: '旧密码不能为空', trigger: 'blur' }],
|
||||
newPassword: [{ required: true, message: '新密码不能为空', trigger: 'blur' }, {
|
||||
min: 6, max: 20, message: '长度在 6 到 20 个字符', trigger: 'blur',
|
||||
}],
|
||||
confirmPassword: [{ required: true, message: '确认密码不能为空', trigger: 'blur' }, { required: true, validator: equalToPassword, trigger: 'blur' }],
|
||||
newPassword: [
|
||||
{ required: true, message: '新密码不能为空', trigger: 'blur' },
|
||||
{
|
||||
min: 6,
|
||||
max: 20,
|
||||
message: '长度在 6 到 20 个字符',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
confirmPassword: [
|
||||
{ required: true, message: '确认密码不能为空', trigger: 'blur' },
|
||||
{ required: true, validator: equalToPassword, trigger: 'blur' },
|
||||
],
|
||||
});
|
||||
|
||||
/** 提交按钮 */
|
||||
function submit() {
|
||||
proxy.$refs.pwdRef.validate((valid) => {
|
||||
if (valid) {
|
||||
updateUserPwd(user.oldPassword, user.newPassword).then((response) => {
|
||||
userApi.updateUserPassword(user.oldPassword, user.newPassword).then((response) => {
|
||||
proxy.$modal.msgSuccess('修改成功');
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,27 +1,29 @@
|
||||
<template>
|
||||
<div class="user-info-head" @click="editCropper()"><img :src="options.img" title="点击上传头像" class="img-circle img-lg" /></div>
|
||||
<el-dialog :title="title" v-model="open" width="800px" append-to-body @opened="modalOpened" @close="closeDialog">
|
||||
<div class="user-info-head" @click="editCropper()">
|
||||
<img :src="options.img" title="点击上传头像" class="img-circle img-lg" />
|
||||
</div>
|
||||
<el-dialog :title="title" v-model="open" width="800px" append-to-body @opened="modalOpened" @close="closeDialog">
|
||||
<el-row>
|
||||
<el-col :xs="24" :md="12" :style="{height: '350px'}">
|
||||
<el-col :xs="24" :md="12" :style="{ height: '350px' }">
|
||||
<vue-cropper
|
||||
ref="cropper"
|
||||
:img="options.img"
|
||||
:info="true"
|
||||
:autoCrop="options.autoCrop"
|
||||
:autoCropWidth="options.autoCropWidth"
|
||||
:autoCropHeight="options.autoCropHeight"
|
||||
:fixedBox="options.fixedBox"
|
||||
@realTime="realTime"
|
||||
v-if="visible"
|
||||
ref="cropper"
|
||||
:img="options.img"
|
||||
:info="true"
|
||||
:autoCrop="options.autoCrop"
|
||||
:autoCropWidth="options.autoCropWidth"
|
||||
:autoCropHeight="options.autoCropHeight"
|
||||
:fixedBox="options.fixedBox"
|
||||
@realTime="realTime"
|
||||
v-if="visible"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :xs="24" :md="12" :style="{height: '350px'}">
|
||||
<el-col :xs="24" :md="12" :style="{ height: '350px' }">
|
||||
<div class="avatar-upload-preview">
|
||||
<img :src="options.previews.url" :style="options.previews.img"/>
|
||||
<img :src="options.previews.url" :style="options.previews.img" />
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<br/>
|
||||
<br />
|
||||
<el-row>
|
||||
<el-col :lg="2" :md="2">
|
||||
<el-upload action="#" :http-request="requestUpload" :show-file-list="false" :before-upload="beforeUpload">
|
||||
@ -31,19 +33,19 @@
|
||||
</el-button>
|
||||
</el-upload>
|
||||
</el-col>
|
||||
<el-col :lg="{span: 1, offset: 2}" :md="2">
|
||||
<el-col :lg="{ span: 1, offset: 2 }" :md="2">
|
||||
<el-button icon="Plus" @click="changeScale(1)"></el-button>
|
||||
</el-col>
|
||||
<el-col :lg="{span: 1, offset: 1}" :md="2">
|
||||
<el-col :lg="{ span: 1, offset: 1 }" :md="2">
|
||||
<el-button icon="Minus" @click="changeScale(-1)"></el-button>
|
||||
</el-col>
|
||||
<el-col :lg="{span: 1, offset: 1}" :md="2">
|
||||
<el-col :lg="{ span: 1, offset: 1 }" :md="2">
|
||||
<el-button icon="RefreshLeft" @click="rotateLeft()"></el-button>
|
||||
</el-col>
|
||||
<el-col :lg="{span: 1, offset: 1}" :md="2">
|
||||
<el-col :lg="{ span: 1, offset: 1 }" :md="2">
|
||||
<el-button icon="RefreshRight" @click="rotateRight()"></el-button>
|
||||
</el-col>
|
||||
<el-col :lg="{span: 2, offset: 6}" :md="2">
|
||||
<el-col :lg="{ span: 2, offset: 6 }" :md="2">
|
||||
<el-button type="primary" @click="uploadImg()">提 交</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -53,7 +55,8 @@
|
||||
<script setup>
|
||||
import 'vue-cropper/dist/index.css';
|
||||
import { VueCropper } from 'vue-cropper';
|
||||
import { uploadAvatar } from '@/api/system/user';
|
||||
// import { uploadAvatar } from '@/api/system/user';
|
||||
import * as userApi from '@/api/system/userApi';
|
||||
|
||||
const store = useStore();
|
||||
const { proxy } = getCurrentInstance();
|
||||
@ -81,8 +84,7 @@ function modalOpened() {
|
||||
visible.value = true;
|
||||
}
|
||||
/** 覆盖默认上传行为 */
|
||||
function requestUpload() {
|
||||
}
|
||||
function requestUpload() {}
|
||||
/** 向左旋转 */
|
||||
function rotateLeft() {
|
||||
proxy.$refs.cropper.rotateLeft();
|
||||
@ -113,7 +115,7 @@ function uploadImg() {
|
||||
proxy.$refs.cropper.getCropBlob((data) => {
|
||||
const formData = new FormData();
|
||||
formData.append('avatarfile', data);
|
||||
uploadAvatar(formData).then((response) => {
|
||||
userApi.uploadAvatar(formData).then((response) => {
|
||||
open.value = false;
|
||||
options.img = import.meta.env.VITE_APP_BASE_API + response.imgUrl;
|
||||
store.commit('SET_AVATAR', options.img);
|
||||
@ -133,7 +135,7 @@ function closeDialog() {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
<style lang="scss" scoped>
|
||||
.user-info-head {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
@ -141,7 +143,7 @@ function closeDialog() {
|
||||
}
|
||||
|
||||
.user-info-head:hover:after {
|
||||
content: "+";
|
||||
content: '+';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
|
||||
@ -1,29 +1,30 @@
|
||||
<template>
|
||||
<el-form ref="userRef" :model="user" :rules="rules" label-width="80px">
|
||||
<el-form-item label="用户昵称" prop="nickName">
|
||||
<el-input v-model="user.nickName" maxlength="30" />
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号码" prop="phoneNumber">
|
||||
<el-input v-model="user.phoneNumber" maxlength="11" />
|
||||
</el-form-item>
|
||||
<el-form-item label="邮箱" prop="email">
|
||||
<el-input v-model="user.email" maxlength="50" />
|
||||
</el-form-item>
|
||||
<el-form-item label="性别">
|
||||
<el-radio-group v-model="user.sex">
|
||||
<el-radio label="0">男</el-radio>
|
||||
<el-radio label="1">女</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-form ref="userRef" :model="user" :rules="rules" label-width="80px">
|
||||
<el-form-item label="用户昵称" prop="nickName">
|
||||
<el-input v-model="user.nickName" maxlength="30" />
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号码" prop="phoneNumber">
|
||||
<el-input v-model="user.phoneNumber" maxlength="11" />
|
||||
</el-form-item>
|
||||
<el-form-item label="邮箱" prop="email">
|
||||
<el-input v-model="user.email" maxlength="50" />
|
||||
</el-form-item>
|
||||
<el-form-item label="性别">
|
||||
<el-radio-group v-model="user.sex">
|
||||
<el-radio label="0">男</el-radio>
|
||||
<el-radio label="1">女</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submit">保存</el-button>
|
||||
<el-button type="danger" @click="close">关闭</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { updateUserProfile } from '@/api/system/user';
|
||||
// import { updateUserProfile } from '@/api/system/userApi';
|
||||
import * as userApi from '@/api/system/userApi';
|
||||
|
||||
const props = defineProps({
|
||||
user: {
|
||||
@ -35,15 +36,21 @@ const { proxy } = getCurrentInstance();
|
||||
|
||||
const rules = ref({
|
||||
nickName: [{ required: true, message: '用户昵称不能为空', trigger: 'blur' }],
|
||||
email: [{ required: true, message: '邮箱地址不能为空', trigger: 'blur' }, { type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }],
|
||||
phoneNumber: [{ required: true, message: '手机号码不能为空', trigger: 'blur' }, { pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: '请输入正确的手机号码', trigger: 'blur' }],
|
||||
email: [
|
||||
{ required: true, message: '邮箱地址不能为空', trigger: 'blur' },
|
||||
{ type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] },
|
||||
],
|
||||
phoneNumber: [
|
||||
{ required: true, message: '手机号码不能为空', trigger: 'blur' },
|
||||
{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: '请输入正确的手机号码', trigger: 'blur' },
|
||||
],
|
||||
});
|
||||
|
||||
/** 提交按钮 */
|
||||
function submit() {
|
||||
proxy.$refs.userRef.validate((valid) => {
|
||||
if (valid) {
|
||||
updateUserProfile(props.user).then((response) => {
|
||||
userApi.updateUserProfile(props.user).then((response) => {
|
||||
proxy.$modal.msgSuccess('修改成功');
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user