fix 代码生成部门id处理,自动刷新token处理

This commit is contained in:
yxh 2024-06-08 23:22:31 +08:00
parent f15377546e
commit b071104e17
4 changed files with 27 additions and 5 deletions

View File

@ -25,4 +25,9 @@ export function resetPwdPersonal(data:object) {
}) })
} }
export function refreshToken() {
return request({
url: '/api/v1/system/personal/refreshToken',
method: 'get'
})
}

View File

@ -1,5 +1,8 @@
import {getToken} from "/@/utils/gfast" import {getToken, getUpFileUrl} from "/@/utils/gfast"
import {noticeStore} from "/@/stores/noticeStore"; import {noticeStore} from "/@/stores/noticeStore";
import {refreshToken} from "/@/api/system/personal";
import {Session} from "/@/utils/storage";
import {useUserInfo} from "/@/stores/userInfo";
const noticeStoreAct = noticeStore() const noticeStoreAct = noticeStore()
const webSocketURL = import.meta.env.VITE_WEBSOCKET_URL const webSocketURL = import.meta.env.VITE_WEBSOCKET_URL
let socket: WebSocket; let socket: WebSocket;
@ -139,6 +142,19 @@ export default (onMessage: Function) => {
noticeStoreAct.setMessages(message.data) noticeStoreAct.setMessages(message.data)
return; return;
} }
//更新token
if(message.event == 'tokenUpdated'){
refreshToken().then((res:any)=>{
const userInfo = res.data.userInfo
userInfo.avatar = getUpFileUrl(userInfo.avatar)
// 存储 token 到浏览器缓存
Session.set('token', res.data.token);
// 存储用户信息到浏览器缓存
Session.set('userInfo', userInfo);
useUserInfo().setUserInfos();
})
return;
}
if (onMessage && !isHeart) { if (onMessage && !isHeart) {
onMessage.call(null, event); onMessage.call(null, event);
} }

View File

@ -33,7 +33,7 @@
<template #header> <template #header>
<el-radio-group v-model="optionsActionValue" @change="setOptionsActionValueHandle"> <el-radio-group v-model="optionsActionValue" @change="setOptionsActionValueHandle">
<template v-for="item in dataScopeOptions" :key="item.value"> <template v-for="item in dataScopeOptions" :key="item.value">
<el-radio v-if="item.value!='2'" :label="item.value" >{{item.label}}</el-radio> <el-radio v-if="item.value!='2'" :value="item.value" >{{item.label}}</el-radio>
</template> </template>
</el-radio-group> </el-radio-group>
</template> </template>
@ -41,7 +41,7 @@
<div class="option-con"> <div class="option-con">
<el-radio-group v-model="menuAuthData[scope.row.id]"> <el-radio-group v-model="menuAuthData[scope.row.id]">
<template v-for="item in dataScopeOptions" :key="item.value"> <template v-for="item in dataScopeOptions" :key="item.value">
<el-radio :label="item.value" @change="setOptionsItemHandle(item.value,scope.row.id)"> <el-radio :value="item.value" @change="setOptionsItemHandle(item.value,scope.row.id)">
<el-badge v-if="item.value=='2' && menuAuthData[scope.row.id]=='2'" type="success" :value="getDeptLen(scope.row.id)" :max="99" class="item" :show-zero="false">{{item.label}}</el-badge> <el-badge v-if="item.value=='2' && menuAuthData[scope.row.id]=='2'" type="success" :value="getDeptLen(scope.row.id)" :max="99" class="item" :show-zero="false">{{item.label}}</el-badge>
<span v-else>{{item.label}}</span> <span v-else>{{item.label}}</span>
</el-radio> </el-radio>

View File

@ -59,6 +59,7 @@
:disabled=" :disabled="
scope.row.isPk == '1' || scope.row.isPk == '1' ||
scope.row.columnName == 'created_at' || scope.row.columnName == 'created_at' ||
scope.row.columnName == 'dept_id' ||
scope.row.columnName == 'created_by' || scope.row.columnName == 'created_by' ||
scope.row.columnName == 'updated_by' scope.row.columnName == 'updated_by'
" "
@ -164,7 +165,7 @@
</el-table-column> </el-table-column>
<el-table-column label="详情起新行" width="50"> <el-table-column label="详情起新行" width="50">
<template #default="scope"> <template #default="scope">
<el-checkbox true-label="1" v-model="scope.row.isRowStart"></el-checkbox> <el-checkbox true-value="1" v-model="scope.row.isRowStart"></el-checkbox>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="字典类型" width="160"> <el-table-column label="字典类型" width="160">