From 418594d0a3e441eeb7df2abbd70e54a0c72284c6 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期五, 30 十月 2026 16:35:46 +0800
Subject: [PATCH] feat(order): 添加送样日期校验和权限刷新机制 - 在委托单新增表单中为送样日期添加占位提示和保存校验 - 在检验审核、检验任务、报告编制、样品接收、报告结果、用印台账等页面添加送样时间列 - 加载委托模板时清空送样日期并清除校验状态
---
src/store/modules/user.js | 36 +++++++++++++++++++++++++++---------
1 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 66ed920..c93a35b 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -15,19 +15,29 @@
id: '',
name: '',
nickName: '',
+ nameEn: '',
+ userName: '',
avatar: '',
roles: [],
permissions: []
}),
actions: {
+ // 鏇存柊鎸夐挳鏉冮檺锛屼笉閲嶅瑙﹀彂鐧诲綍鏃剁殑瀵嗙爜鎻愮ず銆�
+ async refreshPermissions() {
+ const token = this.token
+ const res = await getInfo()
+ if (this.token === token) {
+ this.roles = res.roles?.length ? res.roles : ['ROLE_DEFAULT']
+ this.permissions = res.permissions || []
+ }
+ return res
+ },
// 鐧诲綍
login(userInfo) {
const username = userInfo.username.trim()
const password = userInfo.password
- const code = userInfo.code
- const uuid = userInfo.uuid
return new Promise((resolve, reject) => {
- login(username, password, code, uuid).then(res => {
+ login(username, password).then(res => {
setToken(res.token)
this.token = res.token
useLockStore().unlockScreen()
@@ -55,6 +65,8 @@
this.id = user.userId
this.name = user.userName
this.nickName = user.nickName
+ this.nameEn = user.nameEn
+ this.userName = user.userName
this.avatar = avatar
cache.session.set('pwrChrtype', res.pwdChrtype)
/* 鍒濆瀵嗙爜鎻愮ず */
@@ -78,12 +90,18 @@
// 閫�鍑虹郴缁�
logOut() {
return new Promise((resolve, reject) => {
- logout(this.token).then(() => {
- this.token = ''
- this.roles = []
- this.permissions = []
- removeToken()
- resolve()
+ logout(this.token).then((res) => {
+ // 涓氬姟瀹氬埗锛氬悗绔繑鍥炶烦杞湴鍧�鏃惰蛋缁熶竴璁よ瘉鐧诲嚭锛堝 SSO 鍗曠偣閫�鍑猴級锛�
+ // 杩斿洖绌哄垯鎸夊父瑙勫墠绔櫥鍑哄鐞�
+ if (res.data) {
+ window.location.href = res.data
+ } else {
+ this.token = ''
+ this.roles = []
+ this.permissions = []
+ removeToken()
+ resolve()
+ }
}).catch(error => {
reject(error)
})
--
Gitblit v1.9.3