mirror of
https://gitee.com/xiongmao1988/rax-medical.git
synced 2025-08-24 13:04:57 +08:00
parent
2b42615aca
commit
03c27fd31b
2
.env
2
.env
|
@ -1,3 +1,5 @@
|
||||||
VITE_PWD_ENC_KEY='thanks,rax4cloud'
|
VITE_PWD_ENC_KEY='thanks,rax4cloud'
|
||||||
|
|
||||||
VITE_OAUTH2_PASSWORD_CLIENT='rax:rax'
|
VITE_OAUTH2_PASSWORD_CLIENT='rax:rax'
|
||||||
|
|
||||||
|
VITE_RAX_BASE_URL='/api'
|
|
@ -1,11 +1,10 @@
|
||||||
import axios from "axios";
|
|
||||||
import * as other from "@/utils/other";
|
import * as other from "@/utils/other";
|
||||||
import {get, HOST, post} from "@/utils/request";
|
|
||||||
import {ElMessage} from "element-plus";
|
import {ElMessage} from "element-plus";
|
||||||
|
import request, {CommonHeaderEnum, postData} from "@/utils/request";
|
||||||
|
|
||||||
const FORM_CONTENT_TYPE = 'application/x-www-form-urlencoded';
|
|
||||||
const registerUrl = "/admin/register/user"
|
const registerUrl = "/admin/register/user"
|
||||||
|
|
||||||
|
const logoutUrl = "/admin/token/logout"
|
||||||
|
|
||||||
export const login = (data: any) => {
|
export const login = (data: any) => {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
|
@ -19,30 +18,46 @@ export const login = (data: any) => {
|
||||||
data.grant_type = 'password';
|
data.grant_type = 'password';
|
||||||
data.scope = 'server';
|
data.scope = 'server';
|
||||||
|
|
||||||
axios.request({
|
request({
|
||||||
url: '/api/admin/oauth2/token',
|
url: '/admin/oauth2/token',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: {...data, password: encPassword},
|
data: {...data, password: encPassword},
|
||||||
headers: {
|
headers: {
|
||||||
skipToken: true,
|
skipToken: true,
|
||||||
Authorization: basicAuth,
|
Authorization: basicAuth,
|
||||||
'Content-Type': FORM_CONTENT_TYPE,
|
'Content-Type': CommonHeaderEnum.FORM_CONTENT_TYPE,
|
||||||
},
|
},
|
||||||
}).then(res => {
|
}).then((res: any) => {
|
||||||
resolve(res.data);
|
resolve(res.data ? res.data : res.response.data)
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
if (err && err.response && err.response.data && err.response.data.msg) {
|
resolve(err)
|
||||||
ElMessage.error(err.response.data.msg)
|
handleError(err)
|
||||||
} else {
|
|
||||||
ElMessage.error('系统异常请联系管理员')
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
export const register = (data: any) => {
|
export const register = (data: any) => {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
console.log(data)
|
postData(registerUrl, data).then(res => {
|
||||||
resolve(true)
|
resolve(res.data)
|
||||||
|
}).catch(err => {
|
||||||
|
resolve(err)
|
||||||
|
handleError(err)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function logout() {
|
||||||
|
return request({
|
||||||
|
url: logoutUrl,
|
||||||
|
method: "DELETE"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleError(err: any) {
|
||||||
|
if (err && err.msg) {
|
||||||
|
ElMessage.error(err.msg)
|
||||||
|
} else {
|
||||||
|
ElMessage.error('系统异常请联系管理员')
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,3 +22,56 @@ export const reqUserInfo = () =>
|
||||||
//退出登录
|
//退出登录
|
||||||
export const reqLogout = () => request.post<any, any>(API.LOGOUT_URL)
|
export const reqLogout = () => request.post<any, any>(API.LOGOUT_URL)
|
||||||
*/
|
*/
|
||||||
|
import request, {getData} from "@/utils/request";
|
||||||
|
|
||||||
|
const userInfoUrl = '/admin/user/info'
|
||||||
|
|
||||||
|
const editUserUrl = '/admin/user/edit'
|
||||||
|
|
||||||
|
const editPasswordUrl = '/admin/user/password'
|
||||||
|
|
||||||
|
const userPageUrl = '/admin/user/page'
|
||||||
|
|
||||||
|
export function getUserInfo() {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
getData(userInfoUrl).then((data: any) => {
|
||||||
|
resolve(data.data)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateUserInfo(data: any) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
request.request({
|
||||||
|
url: editUserUrl,
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
}).then((res: any) => {
|
||||||
|
resolve(res.data)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function editPassword(data: any) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
request.request({
|
||||||
|
url: editPasswordUrl,
|
||||||
|
method: "PUT",
|
||||||
|
data
|
||||||
|
}).then((res: any) => {
|
||||||
|
resolve(res.data)
|
||||||
|
}).catch(err => {
|
||||||
|
resolve(err)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function userPage(data: any) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
getData(userPageUrl, data).then((res: any) => {
|
||||||
|
resolve(res.data)
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
import request from "@/utils/request";
|
||||||
|
|
||||||
|
export const fileUploadUrl = '/admin/sys-file/upload'
|
||||||
|
|
||||||
|
export const handleHttpUpload = (options: any) => {
|
||||||
|
let formData = new FormData();
|
||||||
|
formData.append('file', options.file);
|
||||||
|
formData.append('dir', options.dir)
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
try {
|
||||||
|
request({
|
||||||
|
url: fileUploadUrl,
|
||||||
|
method: 'post',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'multipart/form-data',
|
||||||
|
},
|
||||||
|
data: formData,
|
||||||
|
}).then((res: any) => {
|
||||||
|
resolve(res.data)
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
reject(error)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
|
@ -1,16 +1,15 @@
|
||||||
import axios from "axios";
|
import request, {CommonHeaderEnum} from "@/utils/request";
|
||||||
|
|
||||||
const getHospitalListUrl = "/api/admin/hospital/getHospitalList"
|
const getHospitalListUrl = "/admin/hospital/getHospitalList"
|
||||||
const getHospitalPageUrl = "/api/admin/hospital/getHospitalPage"
|
const getHospitalPageUrl = "/admin/hospital/getHospitalPage"
|
||||||
const FORM_CONTENT_TYPE = 'application/x-www-form-urlencoded'
|
|
||||||
|
|
||||||
export const getHospitalList = () => {
|
export const getHospitalList = () => {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
axios.request({
|
request({
|
||||||
url: getHospitalListUrl,
|
url: getHospitalListUrl,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': FORM_CONTENT_TYPE,
|
'Content-Type': CommonHeaderEnum.FORM_CONTENT_TYPE,
|
||||||
},
|
},
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
resolve(res.data);
|
resolve(res.data);
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
import request, {CommonHeaderEnum} from "@/utils/request";
|
||||||
|
|
||||||
|
const getMonthlyLogCountUrl = '/admin/log/getMonthlyLogCount'
|
||||||
|
|
||||||
|
export function getMonthlyLogCount(startTime: string, endTime: string) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
request({
|
||||||
|
url: getMonthlyLogCountUrl,
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
startTime,
|
||||||
|
endTime
|
||||||
|
},
|
||||||
|
headers: {
|
||||||
|
'Content-Type': CommonHeaderEnum.FORM_CONTENT_TYPE,
|
||||||
|
},
|
||||||
|
}).then(res => {
|
||||||
|
resolve(res.data);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
|
@ -8,13 +8,14 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="custom-tabs">
|
<div class="custom-tabs">
|
||||||
<div class="tabs-item" v-for="(item, index) in ['基础信息', '安全信息']" :key="item"
|
<div class="tabs-item" v-for="(item, index) in ['基础信息', '安全信息']" :key="item"
|
||||||
:class="{ 'active': tabActive === index }" @click="tabActive = index">{{ item }}</div>
|
:class="{ 'active': tabActive === index }" @click="tabActive = index">{{ item }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="60">
|
<el-form ref="formRef" :model="formData" :rules="rules" label-width="60">
|
||||||
<template v-if="tabActive === 0">
|
<template v-if="tabActive === 0">
|
||||||
<el-upload action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15" :limit="1"
|
<el-upload action="#" :limit="1" :http-request="handleUpload" ref="uploadRef"
|
||||||
:show-file-list="false" :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload">
|
:show-file-list="false" :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload">
|
||||||
<img v-if="formData.avatar" :src="formData.avatar" class="avatar" />
|
<img v-if="formData.avatar" :src="'/api' + formData.avatar" class="avatar"/>
|
||||||
<img v-else src="@/assets/imgs/home/avatar.png" class="avatar"/>
|
<img v-else src="@/assets/imgs/home/avatar.png" class="avatar"/>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
<el-form-item label="用户名" prop="account">
|
<el-form-item label="用户名" prop="account">
|
||||||
|
@ -38,7 +39,8 @@
|
||||||
<el-input v-model="formData.newPassword" type="password" show-password placeholder="请输入新密码"></el-input>
|
<el-input v-model="formData.newPassword" type="password" show-password placeholder="请输入新密码"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="确认密码" prop="confirmPassword" label-width="100">
|
<el-form-item label="确认密码" prop="confirmPassword" label-width="100">
|
||||||
<el-input v-model="formData.confirmPassword" type="password" show-password placeholder="请输入新密码"></el-input>
|
<el-input v-model="formData.confirmPassword" type="password" show-password
|
||||||
|
placeholder="请输入新密码"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</template>
|
</template>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
@ -53,12 +55,27 @@ import { onMounted, reactive, ref, toRefs, watch } from 'vue'
|
||||||
import {ElMessage} from 'element-plus'
|
import {ElMessage} from 'element-plus'
|
||||||
import type {UploadProps} from 'element-plus'
|
import type {UploadProps} from 'element-plus'
|
||||||
import {useLoginStore} from '@/stores/user-info-store'
|
import {useLoginStore} from '@/stores/user-info-store'
|
||||||
|
import {editPassword, getUserInfo, updateUserInfo} from "@/api/acl/user";
|
||||||
|
import {handleHttpUpload} from "@/api/file-upload";
|
||||||
|
|
||||||
const emit = defineEmits(['close'])
|
const emit = defineEmits(['close'])
|
||||||
|
|
||||||
const userInfo = useLoginStore().getlogin()
|
// const userInfo = useLoginStore().getlogin()
|
||||||
|
|
||||||
const formRef = ref()
|
const formRef = ref()
|
||||||
|
const uploadRef = ref()
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getUserInfo().then((res: any) => {
|
||||||
|
if (res.data) {
|
||||||
|
formData.value.account = res.data.sysUser.username
|
||||||
|
formData.value.name = res.data.sysUser.name
|
||||||
|
formData.value.phone = res.data.sysUser.phone
|
||||||
|
formData.value.mailbox = res.data.sysUser.email
|
||||||
|
formData.value.avatar = res.data.sysUser.avatar
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
const validatePassword = (rule: any, value: any, callback: any) => {
|
const validatePassword = (rule: any, value: any, callback: any) => {
|
||||||
if (formData.value.newPassword !== formData.value.confirmPassword) {
|
if (formData.value.newPassword !== formData.value.confirmPassword) {
|
||||||
|
@ -117,9 +134,9 @@ const rules = reactive({
|
||||||
const tabActive = ref(0)
|
const tabActive = ref(0)
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
avatar: '',
|
avatar: '',
|
||||||
account: userInfo.account,
|
account: "",
|
||||||
phone: '',
|
phone: '',
|
||||||
name: userInfo.name,
|
name: "",
|
||||||
mailbox: '',
|
mailbox: '',
|
||||||
password: '',
|
password: '',
|
||||||
newPassword: '',
|
newPassword: '',
|
||||||
|
@ -129,11 +146,34 @@ const formData = ref({
|
||||||
const close = () => {
|
const close = () => {
|
||||||
emit('close')
|
emit('close')
|
||||||
}
|
}
|
||||||
const handleAvatarSuccess: UploadProps['onSuccess'] = (
|
function handleAvatarSuccess(uploadFile: any) {
|
||||||
uploadFile
|
|
||||||
) => {
|
|
||||||
formData.value.avatar = URL.createObjectURL(uploadFile.raw!)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleUpload(options: any) {
|
||||||
|
handleHttpUpload(options).then((res: any) => {
|
||||||
|
console.log(res)
|
||||||
|
if (res && res.code == 0) {
|
||||||
|
formData.value.avatar = res.data.url
|
||||||
|
const param = {
|
||||||
|
avatar: formData.value.avatar,
|
||||||
|
username: formData.value.account
|
||||||
|
}
|
||||||
|
updateUserInfo(param).then((res: any) => {
|
||||||
|
uploadRef.value.clearFiles();
|
||||||
|
if (res && res.code != 0) {
|
||||||
|
ElMessage.error(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
ElMessage.error('图片格式错误')
|
||||||
|
}
|
||||||
|
|
||||||
|
}).catch(err => {
|
||||||
|
ElMessage.error('图片格式错误')
|
||||||
|
options.onError(err);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const beforeAvatarUpload: UploadProps['beforeUpload'] = (rawFile) => {
|
const beforeAvatarUpload: UploadProps['beforeUpload'] = (rawFile) => {
|
||||||
if (rawFile.type !== 'image/jpeg') {
|
if (rawFile.type !== 'image/jpeg') {
|
||||||
ElMessage.error('图片必须为jpg格式!')
|
ElMessage.error('图片必须为jpg格式!')
|
||||||
|
@ -149,14 +189,42 @@ const submitForm = async () => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
// console.log('submit!')
|
// console.log('submit!')
|
||||||
// 更改用户名
|
// 更改用户名
|
||||||
useLoginStore().setlogin('name', formData.value.name)
|
// useLoginStore().setlogin('name', formData.value.name)
|
||||||
|
if (tabActive.value == 0) {
|
||||||
|
const param = {
|
||||||
|
name: formData.value.name,
|
||||||
|
phone: formData.value.phone,
|
||||||
|
email: formData.value.mailbox,
|
||||||
|
username: formData.value.account
|
||||||
|
}
|
||||||
|
updateUserInfo(param).then((res: any) => {
|
||||||
|
if (res && res.code == 0) {
|
||||||
ElMessage.success('更新成功')
|
ElMessage.success('更新成功')
|
||||||
close()
|
close()
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
editPassword({
|
||||||
|
password: formData.value.password,
|
||||||
|
newpassword1: formData.value.newPassword
|
||||||
|
}).then((res: any) => {
|
||||||
|
if (res && res.code == 0) {
|
||||||
|
formRef.value.resetFields(['password', 'newPassword', 'confirmPassword'])
|
||||||
|
ElMessage.success("修改密码成功")
|
||||||
|
close()
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// console.log('error submit!', fields)
|
// console.log('error submit!', fields)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
|
@ -182,12 +250,14 @@ const submitForm = async () => {
|
||||||
color: #606266;
|
color: #606266;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
img.avatar {
|
img.avatar {
|
||||||
width: 128px;
|
width: 128px;
|
||||||
height: 148px;
|
height: 148px;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
margin: 0 0 20px 60px;
|
margin: 0 0 20px 60px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.submit-box {
|
.submit-box {
|
||||||
padding-left: 60px;
|
padding-left: 60px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,11 +34,11 @@ export const getMessageType = () => {
|
||||||
|
|
||||||
export const getLogType = () => {
|
export const getLogType = () => {
|
||||||
const type = []
|
const type = []
|
||||||
type.push({ label: '正常', value: '正常' })
|
type.push({ label: '正常', value: '0' })
|
||||||
type.push({ label: '异常', value: '异常' })
|
type.push({ label: '异常', value: '9' })
|
||||||
type.push({ label: '添加', value: '添加' })
|
type.push({ label: '添加', value: '1' })
|
||||||
type.push({ label: '删除', value: '删除' })
|
type.push({ label: '删除', value: '2' })
|
||||||
type.push({ label: '编辑', value: '编辑' })
|
type.push({ label: '编辑', value: '3' })
|
||||||
return type
|
return type
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,3 +88,7 @@ export function getDays(date: any, days: number) {
|
||||||
return new Date(time);
|
return new Date(time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getEndOfMonth(year: number, month: number) {
|
||||||
|
return new Date(year, month, 0).getDate()
|
||||||
|
}
|
|
@ -1,16 +1,29 @@
|
||||||
//进行axios二次封装:使用请求与响应拦截器
|
//进行axios二次封装:使用请求与响应拦截器
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
import {Session} from "@/utils/storage";
|
||||||
|
import {decryption, encryption} from "@/utils/other";
|
||||||
|
import {ElMessageBox} from "element-plus";
|
||||||
/*
|
/*
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
//引入用户相关的仓库
|
//引入用户相关的仓库
|
||||||
import useUserStore from '@/stores/modules/user'
|
import useUserStore from '@/stores/modules/user'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const HOST = 'http://localhost:9999';
|
const BASE_URL = import.meta.env.VITE_RAX_BASE_URL
|
||||||
const BASE_URL = import.meta.env.BASE_URL
|
|
||||||
|
export enum CommonHeaderEnum {
|
||||||
|
'TENANT_ID' = 'TENANT-ID',
|
||||||
|
'ENC_FLAG' = 'Enc-Flag',
|
||||||
|
'AUTHORIZATION' = 'Authorization',
|
||||||
|
'FORM_CONTENT_TYPE' = 'application/x-www-form-urlencoded'
|
||||||
|
}
|
||||||
|
|
||||||
|
const axiosInstance = axios.create({
|
||||||
|
baseURL: BASE_URL
|
||||||
|
});
|
||||||
|
|
||||||
export const get = (url: any, params: any, success: any) => {
|
export const get = (url: any, params: any, success: any) => {
|
||||||
axios.get(HOST + url, params)
|
axiosInstance.get(url, params)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
success(res);
|
success(res);
|
||||||
})
|
})
|
||||||
|
@ -18,19 +31,63 @@ export const get = (url: any, params: any, success: any) => {
|
||||||
success(err);
|
success(err);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
export const post = (url: any, params: any, config?: any) => {
|
export const post = (url: any, params: any, success: any) => {
|
||||||
return axios.post(HOST + url, params, config);
|
axiosInstance.post(url, params)
|
||||||
|
.then(res => {
|
||||||
|
success(res);
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
success(err);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
export const getMapJson = (name: string) => {
|
export const getMapJson = (name: string) => {
|
||||||
return axios.post(BASE_URL + '/static/json/' + name)
|
return axiosInstance.post(BASE_URL+'/static/json/' + name)
|
||||||
}
|
}
|
||||||
export const getData = (url: string, params?: any) => {
|
export const getData = (url: string, params?: any) => {
|
||||||
return axios.get(url, params)
|
return axiosInstance.get(url, params)
|
||||||
}
|
}
|
||||||
export const postData = (url: string, params?: any) => {
|
export const postData = (url: string, params?: any) => {
|
||||||
return axios.post(url, params)
|
return axiosInstance.post(url, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
axiosInstance.interceptors.request.use(data => {
|
||||||
|
const token = Session.getToken()
|
||||||
|
if (token && !data.headers?.skipToken) {
|
||||||
|
data.headers[CommonHeaderEnum.AUTHORIZATION] = `Bearer ${token}`
|
||||||
|
}
|
||||||
|
if (data.headers[CommonHeaderEnum.ENC_FLAG]) {
|
||||||
|
const val = encryption(JSON.stringify(data.data), import.meta.env.VITE_PWD_ENC_KEY)
|
||||||
|
data.data = {
|
||||||
|
encryption: val
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
})
|
||||||
|
|
||||||
|
function handleResponse(response: any) {
|
||||||
|
if (response.data.code == 1) throw response.data
|
||||||
|
if (response.data.encryption) {
|
||||||
|
const val = JSON.parse(decryption(response.data.encryption, import.meta.env.VITE_PWD_ENC_KEY))
|
||||||
|
response.data = val
|
||||||
|
}
|
||||||
|
return response
|
||||||
|
}
|
||||||
|
|
||||||
|
axiosInstance.interceptors.response.use(handleResponse, error => {
|
||||||
|
const code = error.response.status || 200
|
||||||
|
if (code == 424) {
|
||||||
|
ElMessageBox.confirm('令牌状态已过期,请点击重新登录', "系统提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: 'warning',
|
||||||
|
});
|
||||||
|
Session.clear();
|
||||||
|
window.location.href = '/';
|
||||||
|
}
|
||||||
|
return error
|
||||||
|
})
|
||||||
|
|
||||||
|
export default axiosInstance
|
||||||
|
|
||||||
/*
|
/*
|
||||||
//第一步:利用axios对象的create方法,去创建axios实例(其他的配置:基础路径、超时的时间)
|
//第一步:利用axios对象的create方法,去创建axios实例(其他的配置:基础路径、超时的时间)
|
||||||
|
|
|
@ -5,8 +5,10 @@
|
||||||
<img src="@/assets/imgs/logo.png"/>
|
<img src="@/assets/imgs/logo.png"/>
|
||||||
</div>
|
</div>
|
||||||
<ul class="menu-box">
|
<ul class="menu-box">
|
||||||
<li class="menu-item" v-for="item in menus" :key="item.path" :class="{ 'active': menuActive.indexOf(item.path) === 0 }"
|
<li class="menu-item" v-for="item in menus" :key="item.path"
|
||||||
@click="menuToPath(item)"><i :class="item.icon"></i><span>{{ item.label
|
:class="{ 'active': menuActive.indexOf(item.path) === 0 }"
|
||||||
|
@click="menuToPath(item)"><i :class="item.icon"></i><span>{{
|
||||||
|
item.label
|
||||||
}}</span></li>
|
}}</span></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="user-box">
|
<div class="user-box">
|
||||||
|
@ -66,6 +68,8 @@ import { useLoginStore } from '@/stores/user-info-store'
|
||||||
import {getHospitalsData} from '@/static-data/core'
|
import {getHospitalsData} from '@/static-data/core'
|
||||||
import userInfoForm from '@/components/user-info.vue'
|
import userInfoForm from '@/components/user-info.vue'
|
||||||
import {wsApi} from "@/api/ws";
|
import {wsApi} from "@/api/ws";
|
||||||
|
import {Session} from "@/utils/storage";
|
||||||
|
import {logout} from "@/api/acl/login";
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
@ -138,9 +142,10 @@ const selectHospital = (e: any) => {
|
||||||
draggable: true
|
draggable: true
|
||||||
}
|
}
|
||||||
).then(() => {
|
).then(() => {
|
||||||
useLoginStore().setlogin('hospital', e)
|
// useLoginStore().setlogin('hospital', e)
|
||||||
router.push('/login')
|
router.push('/login')
|
||||||
}).catch(() => { })
|
}).catch(() => {
|
||||||
|
})
|
||||||
}
|
}
|
||||||
const toggleFullscreen = () => {
|
const toggleFullscreen = () => {
|
||||||
if (document.fullscreenElement) {
|
if (document.fullscreenElement) {
|
||||||
|
@ -149,11 +154,13 @@ const toggleFullscreen = () => {
|
||||||
document.documentElement.requestFullscreen();
|
document.documentElement.requestFullscreen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const userCommand = (e: string) => {
|
const userCommand = async (e: string) => {
|
||||||
switch (e) {
|
switch (e) {
|
||||||
case 'logout':
|
case 'logout':
|
||||||
useLoginStore().logout()
|
// useLoginStore().logout()
|
||||||
router.push('/login')
|
await logout()
|
||||||
|
Session.clear();
|
||||||
|
window.location.reload();
|
||||||
break;
|
break;
|
||||||
case 'info':
|
case 'info':
|
||||||
isShowUserInfoDrawer.value = true
|
isShowUserInfoDrawer.value = true
|
||||||
|
@ -162,15 +169,6 @@ const userCommand = (e: string) => {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*wsApi.init("").then(() => {
|
|
||||||
wsApi.openListener(fn1);
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
function fn1(res:any) {
|
|
||||||
console.log(res);
|
|
||||||
}*/
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
|
@ -187,6 +185,7 @@ function fn1(res:any) {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.logo-box {
|
.logo-box {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
@ -279,6 +278,7 @@ function fn1(res:any) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
& > .main-content {
|
& > .main-content {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: calc(100% - 70px);
|
height: calc(100% - 70px);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<div class="right-content">
|
<div class="right-content">
|
||||||
<div class="select-hospital-box">
|
<div class="select-hospital-box">
|
||||||
<el-select class="select-hospital" v-model="currentHospital" size="small" @change="selectHospital">
|
<el-select class="select-hospital" v-model="currentHospital" size="small" @change="selectHospital">
|
||||||
<el-option v-for="item in hospitals" :key="item.value" :label="item.label" :value="item.value"/>
|
<el-option v-for="item in hospitals" :key="item.id" :label="item.name" :value="item.id"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -94,8 +94,8 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="医院" prop="hospital">
|
<el-form-item label="医院" prop="hospital">
|
||||||
<el-select v-model="registerParams.hospital" style="width: 100%;">
|
<el-select v-model="registerParams.hospital" style="width: 100%;">
|
||||||
<el-option v-for="item in hospitals" :key="item.value" :label="item.label"
|
<el-option v-for="item in hospitals" :key="item.id" :label="item.name"
|
||||||
:value="item.value"/>
|
:value="item.id"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="性别" prop="sex">
|
<el-form-item label="性别" prop="sex">
|
||||||
|
@ -121,20 +121,18 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<SliderVerify v-model:isShowSelf="sliderVConf.isShowSelf" :width="sliderVConf.width" :imgUrl="sliderImgUrl"
|
<SliderVerify v-model:isShowSelf="sliderVConf.isShowSelf" :width="sliderVConf.width" :imgUrl="sliderImgUrl"
|
||||||
:height="sliderVConf.height" @success="sliderSuccess"></SliderVerify>
|
:height="sliderVConf.height" @success="sliderSuccess" @close="sliderClose"></SliderVerify>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
import {ElNotification} from 'element-plus';
|
import {ElMessage, ElMessageBox, ElNotification} from 'element-plus';
|
||||||
//引入获取当前时间的函数
|
//引入获取当前时间的函数
|
||||||
import {getTime} from '@/utils/time';
|
import {getTime} from '@/utils/time';
|
||||||
import {onMounted, reactive, ref, toRefs, watch} from 'vue'
|
import {onMounted, reactive, ref} from 'vue'
|
||||||
import {useRouter, useRoute} from 'vue-router'
|
import {useRoute, useRouter} from 'vue-router'
|
||||||
import {ElMessage, ElMessageBox} from 'element-plus'
|
|
||||||
import {useLoginStore} from '@/stores/user-info-store'
|
import {useLoginStore} from '@/stores/user-info-store'
|
||||||
import {getHospitalsData, getPhoneAreasData} from '@/static-data/core'
|
import {getPhoneAreasData} from '@/static-data/core'
|
||||||
import {v4} from "uuid";
|
import {v4} from "uuid";
|
||||||
import {HOST, post} from "@/utils/request";
|
|
||||||
import SliderVerify from "@/components/SliderVerify/index.vue";
|
import SliderVerify from "@/components/SliderVerify/index.vue";
|
||||||
import * as loginApi from "@/api/acl/login";
|
import * as loginApi from "@/api/acl/login";
|
||||||
import {Session} from "@/utils/storage";
|
import {Session} from "@/utils/storage";
|
||||||
|
@ -147,10 +145,7 @@ import * as hospitalApi from "@/api/hospital";
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const hospitals = ref([] as any)
|
const hospitals = ref([])
|
||||||
getHospitalsData().then((res: any) => {
|
|
||||||
hospitals.value = res
|
|
||||||
})
|
|
||||||
const phoneAreas: any = getPhoneAreasData()
|
const phoneAreas: any = getPhoneAreasData()
|
||||||
|
|
||||||
//定义变量控制按钮加载效果
|
//定义变量控制按钮加载效果
|
||||||
|
@ -269,9 +264,13 @@ const sliderImgUrl = ref('')
|
||||||
let randomStr = ""
|
let randomStr = ""
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
hospitalApi.getHospitalList().then(data => {
|
hospitalApi.getHospitalList().then((res: any) => {
|
||||||
console.log(data)
|
if (res.data) {
|
||||||
});
|
hospitals.value = res.data
|
||||||
|
} else {
|
||||||
|
hospitals.value.length = 0
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
const selectHospital = (e: string) => {
|
const selectHospital = (e: string) => {
|
||||||
|
@ -324,47 +323,18 @@ const sendCode = () => {
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
const login = async (type: string) => {
|
const login = async (type: string) => {
|
||||||
//加载效果:开始加载
|
|
||||||
loading.value=true;
|
|
||||||
const obj = loginParams.value
|
const obj = loginParams.value
|
||||||
if (!currentHospital.value) {
|
if (!currentHospital.value) {
|
||||||
ElMessage.warning('请在右上角选择院区')
|
ElMessage.warning('请在右上角选择院区')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
//加载效果:开始加载
|
||||||
|
loading.value = true;
|
||||||
//保证全部表单正常再发请求
|
//保证全部表单正常再发请求
|
||||||
await loginFormRef.value.validate((valid: any, fields: any) => {
|
await loginFormRef.value.validate((valid: any, fields: any) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
// console.log('submit!')
|
|
||||||
sliderVConf.value.isShowSelf = true;
|
sliderVConf.value.isShowSelf = true;
|
||||||
|
|
||||||
} else {
|
|
||||||
// console.log('error submit!', fields)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*try {
|
|
||||||
//保证登录成功
|
|
||||||
await useStore.userLogin(loginFormRef);
|
|
||||||
//编程式导航跳转到展示数据首页
|
|
||||||
//判断登录的时候,路由路径当中是否有query参数,如果有就往query参数挑战,没有跳转到首页
|
|
||||||
let redirect: any = $route.query.redirect;
|
|
||||||
$router.push({ path: redirect || '/' });
|
|
||||||
|
|
||||||
//登录成功加载效果也消失
|
|
||||||
loading.value = false;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
/*} catch (error) {
|
|
||||||
//登录失败加载效果消息
|
|
||||||
loading.value = false;
|
|
||||||
//登录失败的提示信息
|
|
||||||
ElNotification({
|
|
||||||
type: 'error',
|
|
||||||
message: (error as Error).message
|
|
||||||
})*/
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -385,13 +355,24 @@ function sliderSuccess() {
|
||||||
password: loginParams.value.password, // 密码
|
password: loginParams.value.password, // 密码
|
||||||
randomStr: v4()
|
randomStr: v4()
|
||||||
}).then((data: any) => {
|
}).then((data: any) => {
|
||||||
|
sliderVConf.value.isShowSelf = false
|
||||||
|
if (data.code == 1) {
|
||||||
|
ElMessage.error(data.msg)
|
||||||
|
loading.value = false
|
||||||
|
} else {
|
||||||
// 存储token 信息
|
// 存储token 信息
|
||||||
Session.set('token', data.access_token);
|
Session.set('token', data.access_token);
|
||||||
Session.set('refresh_token', data.refresh_token);
|
Session.set('refresh_token', data.refresh_token);
|
||||||
|
console.log(data)
|
||||||
toHome()
|
toHome()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sliderClose() {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
|
||||||
const toHome = () => {
|
const toHome = () => {
|
||||||
|
|
||||||
ElNotification({
|
ElNotification({
|
||||||
|
|
|
@ -21,7 +21,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="button-part" style="justify-content: space-between;">
|
<div class="button-part" style="justify-content: space-between;">
|
||||||
<el-button icon="Delete" @click="removeData()">删除</el-button>
|
<el-button icon="Delete" @click="removeData()">删除</el-button>
|
||||||
<TableAbility @searchBtn="isSearch = !isSearch" @refreshBtn="queryData({})" @downloadBtn="exportData('日志数据', tableData)"></TableAbility>
|
<TableAbility @searchBtn="isSearch = !isSearch" @refreshBtn="queryData({})"
|
||||||
|
@downloadBtn="exportData('日志数据', tableData)"></TableAbility>
|
||||||
</div>
|
</div>
|
||||||
<div class="table-part">
|
<div class="table-part">
|
||||||
<el-table ref="tableRef" v-loading="loading" :data="tableData" height="100%" border show-overflow-tooltip
|
<el-table ref="tableRef" v-loading="loading" :data="tableData" height="100%" border show-overflow-tooltip
|
||||||
|
@ -64,7 +65,8 @@ import CommonPagination from '@/components/common-pagination.vue'
|
||||||
import LogForm from './form/log-form.vue'
|
import LogForm from './form/log-form.vue'
|
||||||
import {tableRemoveRow, exportData} from '@/utils/table-util'
|
import {tableRemoveRow, exportData} from '@/utils/table-util'
|
||||||
import {getLogType} from '@/static-data/core'
|
import {getLogType} from '@/static-data/core'
|
||||||
import { dateFormater } from '@/utils/date-util'
|
import {dateFormater, getEndOfMonth} from '@/utils/date-util'
|
||||||
|
import * as logManageApi from '@/api/log-manage'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
@ -120,6 +122,17 @@ const tableRowClick = (row: any) => {
|
||||||
const paginationChange = (page: number, size: number) => {
|
const paginationChange = (page: number, size: number) => {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getMonthlyLogCount(startTime: string, endTime: string) {
|
||||||
|
logManageApi.getMonthlyLogCount(startTime, endTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
const month = dateFormater('yyyy-MM');
|
||||||
|
const startTime = month + '-01'
|
||||||
|
const endTime = month + '-' + getEndOfMonth(new Date().getFullYear(), new Date().getMonth() + 1);
|
||||||
|
getMonthlyLogCount(startTime, endTime);
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
|
|
|
@ -64,6 +64,7 @@ import { tableRemoveRow, exportData } from '@/utils/table-util'
|
||||||
import CommonPagination from '@/components/common-pagination.vue'
|
import CommonPagination from '@/components/common-pagination.vue'
|
||||||
import DoctorForm from './form/doctor-form.vue'
|
import DoctorForm from './form/doctor-form.vue'
|
||||||
import ImportDialog from '@/components/import-dialog.vue'
|
import ImportDialog from '@/components/import-dialog.vue'
|
||||||
|
import {userPage} from "@/api/acl/user";
|
||||||
|
|
||||||
const tableRef = ref()
|
const tableRef = ref()
|
||||||
const doctorFormRef = ref()
|
const doctorFormRef = ref()
|
||||||
|
@ -76,6 +77,8 @@ const queryParams = ref({
|
||||||
userName: ''
|
userName: ''
|
||||||
} as any)
|
} as any)
|
||||||
const tableData = ref([] as any)
|
const tableData = ref([] as any)
|
||||||
|
let current = 0;
|
||||||
|
const size = 10;
|
||||||
|
|
||||||
queryData()
|
queryData()
|
||||||
|
|
||||||
|
@ -102,6 +105,11 @@ function queryData(e?: any) {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
|
userPage({
|
||||||
|
current,
|
||||||
|
size,
|
||||||
|
name: queryParams.value.userName
|
||||||
|
})
|
||||||
}
|
}
|
||||||
const addData = () => {
|
const addData = () => {
|
||||||
isFormDialog.value = true
|
isFormDialog.value = true
|
||||||
|
|
|
@ -174,7 +174,10 @@ function getSurgeryData(username: string, db: string) {
|
||||||
console.log(username, db);
|
console.log(username, db);
|
||||||
surgeryClient.publish({
|
surgeryClient.publish({
|
||||||
destination: "/front/getSurgeryData",
|
destination: "/front/getSurgeryData",
|
||||||
body: JSON.stringify({status: "start", db, token: Session.get('token')})
|
headers: {
|
||||||
|
token: Session.get('token')
|
||||||
|
},
|
||||||
|
body: JSON.stringify({status: "start", db})
|
||||||
});
|
});
|
||||||
const account = "admin";
|
const account = "admin";
|
||||||
surgeryClient.subscribe('/topic/user/' + account + ":" + db + '/surgeryData', (data: any) => {
|
surgeryClient.subscribe('/topic/user/' + account + ":" + db + '/surgeryData', (data: any) => {
|
||||||
|
|
|
@ -24,14 +24,14 @@ export default defineConfig({
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
//target: 'http://192.168.137.235:9999', // 目标服务器地址
|
//target: 'http://192.168.137.235:9999', // 目标服务器地址
|
||||||
target: 'http://192.168.71.44:9999', // 目标服务器地址
|
target: 'http://localhost:8888', // 目标服务器地址
|
||||||
ws: true, // 是否启用 WebSocket
|
ws: true, // 是否启用 WebSocket
|
||||||
changeOrigin: true, // 是否修改请求头中的 Origin 字段
|
changeOrigin: true, // 是否修改请求头中的 Origin 字段
|
||||||
rewrite: (path) => path.replace(/^\/api/, ''),
|
rewrite: (path) => path.replace(/^\/api/, ''),
|
||||||
},
|
},
|
||||||
'/socket.io': {
|
'/socket.io': {
|
||||||
//target: 'ws://192.168.137.235:9999',
|
//target: 'ws://192.168.137.235:9999',
|
||||||
target: 'ws://192.168.71.44:9999',
|
target: 'ws://localhost:8888',
|
||||||
ws: true,
|
ws: true,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (path) => path.replace(/^\/socket.io/, ''),
|
rewrite: (path) => path.replace(/^\/socket.io/, ''),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user