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; height: 64px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center;
.custom-content-con { .header-breadcrumb {
height: 64px; margin-left: 30px;
padding-right: 120px;
line-height: 64px;
display: inline-block;
vertical-align: top;
flex: 1; 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> <template>
<div class="header-bar"> <div class="header-bar">
<sider-trigger :collapsed="collapsed" icon="md-menu" @on-change="handleCollpasedChange"></sider-trigger> <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> <custom-bread-crumb class="header-breadcrumb" show-icon :list="breadCrumbList"></custom-bread-crumb>
<div class="custom-content-con"> <div class="header-right-slot">
<slot></slot> <slot></slot>
</div> </div>
</div> </div>

View File

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

View File

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

View File

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

View File

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