This commit is contained in:
张成
2026-04-13 13:21:48 +08:00
parent 51ff5d5d65
commit daa6a46af6
6 changed files with 44 additions and 66 deletions

View File

@@ -5,14 +5,24 @@
height: 64px;
display: flex;
flex-direction: row;
align-items: center;
.custom-content-con {
height: 64px;
padding-right: 120px;
line-height: 64px;
display: inline-block;
vertical-align: top;
.header-breadcrumb {
margin-left: 30px;
flex: 1;
min-width: 0;
overflow: hidden;
line-height: 64px;
}
.header-right-slot {
flex-shrink: 0;
height: 64px;
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: nowrap;
padding-right: 10px;
line-height: 64px;
}
}

View File

@@ -1,8 +1,8 @@
<template>
<div class="header-bar">
<sider-trigger :collapsed="collapsed" icon="md-menu" @on-change="handleCollpasedChange"></sider-trigger>
<custom-bread-crumb show-icon style="margin-left: 30px;" :list="breadCrumbList"></custom-bread-crumb>
<div class="custom-content-con">
<custom-bread-crumb class="header-breadcrumb" show-icon :list="breadCrumbList"></custom-bread-crumb>
<div class="header-right-slot">
<slot></slot>
</div>
</div>

View File

@@ -19,7 +19,7 @@ export default {
computed: {
iconclass() {
let curClass = 'terminal-icon ml10'
let curClass = 'terminal-icon'
// Terminal 功能暂时禁用
// if (this.isServerRun) {
// curClass += ' run'
@@ -39,6 +39,8 @@ export default {
<style lang="less" scoped>
.terminal-box {
margin-top: 3px;
margin-right: 10px;
flex-shrink: 0;
}
.terminal-icon {
color: #c5c8ce;

View File

@@ -55,9 +55,9 @@ export default {
</script>
<style lang="less" scoped>
.user-avator-dropdown {
position: absolute;
top: 0px;
right: 10px;
display: flex;
align-items: center;
flex-shrink: 0;
}
.loginName-box {

View File

@@ -16,13 +16,15 @@
<Header class="header-con-main">
<headerBar class="header-con" @on-coll-change="collpasedChange" :collapsed="collapsed">
<Terminal></Terminal>
<span
v-if="currentTenant"
class="main-tenant-tag"
:title="'租户:' + currentTenant.name + '' + currentTenant.code + ''"
>{{ currentTenant.name }}</span>
<user :userName="userName" :user-avator="userAvator || ''" />
<div class="header-user-area">
<Terminal></Terminal>
<span
v-if="currentTenant"
class="main-tenant-tag"
:title="'租户:' + currentTenant.name + '' + currentTenant.code + ''"
>{{ currentTenant.name }}</span>
<user :userName="userName" :user-avator="userAvator || ''" />
</div>
</headerBar>
</Header>
<Layout class="main-layout-content">
@@ -155,8 +157,17 @@ export default {
z-index: 999999;
}
.header-user-area {
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: nowrap;
flex-shrink: 0;
}
.main-tenant-tag {
margin-right: 16px;
margin-right: 12px;
flex-shrink: 0;
padding: 0 10px;
height: 28px;
line-height: 28px;

View File

@@ -3,7 +3,6 @@
<Alert v-if="currentTenant" type="info" show-icon closable style="margin-bottom: 12px">
当前租户<strong>{{ currentTenant.name }}</strong>{{ currentTenant.code }}用户按租户隔离
<strong>角色全库共用</strong>下拉中的角色对所有租户一致
<span v-if="isPlatformTenant">平台租户可为他人指定目标租户</span>
</Alert>
<div class="table-head-tool">
@@ -24,7 +23,6 @@
import { mapGetters, mapState } from 'vuex'
import userServer from '@/api/system/userServer'
import roleServer from '@/api/system/roleServer'
import sysTenantServer from '@/api/system/sysTenantServer'
import uiTool from '@/utils/uiTool'
export default {
@@ -100,13 +98,9 @@ export default {
shopList: 'shop/shopList',
}),
...mapState('user', ['currentTenant']),
isPlatformTenant() {
return this.currentTenant && Number(this.currentTenant.is_platform) === 1
},
},
watch: {
currentTenant() {
this.syncTenantSelectColumn()
this.initCol()
},
},
@@ -115,19 +109,11 @@ export default {
this.initCol()
},
methods: {
syncTenantSelectColumn() {
const idx = this.gridOption.columns.findIndex((c) => c.key === 'tenant_id_select')
if (idx !== -1) {
this.gridOption.columns.splice(idx, 1)
}
},
async init() {
let res = await userServer.all()
this.gridOption.data = res.data
},
async initCol() {
this.syncTenantSelectColumn()
let res = await roleServer.list()
this.roles = res.data || []
let roleSource = this.roles.map((p) => {
@@ -141,50 +127,19 @@ export default {
if (roleRow) {
roleRow.source = roleSource
}
if (this.isPlatformTenant) {
try {
const tr = await sysTenantServer.list()
const tenants = (tr && tr.data) || []
const tenantSource = tenants.map((t) => ({
key: t.id,
value: `${t.name}${t.code}`,
}))
this.gridOption.columns.splice(1, 0, {
title: '目标租户',
key: 'tenant_id_select',
com: 'Select',
source: tenantSource,
})
} catch (e) {
console.warn('加载租户列表失败', e)
}
}
},
showAddWarp() {
this.$refs.editModal.addShow({}, async (newRow) => {
const payload = { ...newRow }
if (payload.tenant_id_select != null && payload.tenant_id_select !== '') {
payload.tenant_id = Number(payload.tenant_id_select)
}
delete payload.tenant_id_select
await userServer.add(payload)
this.$Message.success('新增成功!')
this.init()
})
},
showEditWarp(row) {
const rowWithSelect = { ...row }
if (this.isPlatformTenant) {
rowWithSelect.tenant_id_select = row.tenant_id
}
this.$refs.editModal.editShow(rowWithSelect, async (newRow) => {
this.$refs.editModal.editShow({ ...row }, async (newRow) => {
const payload = { ...newRow }
if (payload.tenant_id_select != null && payload.tenant_id_select !== '') {
payload.tenant_id = Number(payload.tenant_id_select)
}
delete payload.tenant_id_select
await userServer.edit(payload)
this.$Message.success('修改成功!')
this.init()