feat: 新增账号状态管理、头像功能与报表工具,完善账号系统
新增账号状态字段与停用校验,支持账号头像上传管理,新增物料收发汇总表合并工具,优化银行卡检查脚本,新增ERP登录复用模块,重构账号数据库迁移与管理接口
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
<section class="pcard">
|
||||
<div class="cover"></div>
|
||||
<div class="pcard-main">
|
||||
<el-avatar :size="60" :src="store.avatarUrl" @error="onAvatarError" class="avatar">
|
||||
<el-avatar :size="60" :src="accountAvatar()" @error="onAvatarError" class="avatar">
|
||||
<span>{{ displayName.slice(0, 1).toUpperCase() }}</span>
|
||||
</el-avatar>
|
||||
<div class="pcard-id">
|
||||
@@ -20,9 +20,14 @@
|
||||
<em v-if="store.isAdmin" class="admin">管理员</em>
|
||||
</div>
|
||||
<span class="dept">{{ store.dept || '未设置部门' }}</span>
|
||||
<span class="avatar-act" @click="pickAvatar">更换头像</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pcard-rows">
|
||||
<div class="crow">
|
||||
<span>工号</span>
|
||||
<span class="mono">{{ store.current }}</span>
|
||||
</div>
|
||||
<div class="crow">
|
||||
<span>已授权插件</span>
|
||||
<span class="mono">{{ store.plugins.length }}</span>
|
||||
@@ -100,8 +105,8 @@
|
||||
import { ref, reactive, computed } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Connection, Box } from '@element-plus/icons-vue'
|
||||
import { store, log, clearAvatarCache } from '../store'
|
||||
import { loginPlatform, logoutPlatform, adminPassword } from '../api'
|
||||
import { store, log, clearAvatarCache, accountAvatar } from '../store'
|
||||
import { loginPlatform, logoutPlatform, adminPassword, adminAvatarUpload } from '../api'
|
||||
|
||||
const emit = defineEmits(['close'])
|
||||
// 由父组件 v-if 控制挂载,挂载即展开;关闭经 @close 通知父组件卸载
|
||||
@@ -115,6 +120,29 @@ function onAvatarError() {
|
||||
clearAvatarCache()
|
||||
}
|
||||
|
||||
// 更换头像:选图上传到中心机(webhost 代理),成功后即显示账号头像
|
||||
const fileInput = (() => {
|
||||
const el = document.createElement('input')
|
||||
el.type = 'file'
|
||||
el.accept = 'image/*'
|
||||
return el
|
||||
})()
|
||||
function pickAvatar() {
|
||||
fileInput.onchange = async () => {
|
||||
const f = fileInput.files && fileInput.files[0]
|
||||
fileInput.value = ''
|
||||
if (!f) return
|
||||
try {
|
||||
const r = await adminAvatarUpload(f)
|
||||
store.avatar = r.avatar || ''
|
||||
ElMessage.success('头像已更新')
|
||||
} catch (e) {
|
||||
ElMessage.error('上传失败:' + (e.message || e))
|
||||
}
|
||||
}
|
||||
fileInput.click()
|
||||
}
|
||||
|
||||
const activeNames = ref(['platforms', 'plugins'])
|
||||
const busy = ref('')
|
||||
|
||||
@@ -250,6 +278,12 @@ async function changePwd() {
|
||||
letter-spacing: .04em;
|
||||
}
|
||||
.dept { font-size: 12px; color: var(--text-faint); }
|
||||
.avatar-act {
|
||||
display: inline-block; margin-top: 5px;
|
||||
font-size: 11px; color: #d04a24; cursor: pointer;
|
||||
border-bottom: 1px dashed rgba(208, 74, 36, .4);
|
||||
}
|
||||
.avatar-act:hover { color: #b23c1b; }
|
||||
|
||||
.pcard-rows { border-top: 1px solid var(--border); }
|
||||
.crow {
|
||||
|
||||
Reference in New Issue
Block a user