11
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<div class="content-view">
|
||||
<Alert type="warning" show-icon style="margin-bottom: 12px">
|
||||
仅<strong>平台租户</strong>(is_platform=1)可维护租户列表;普通租户登录后本页仅能看到自身租户信息。
|
||||
需在数据库执行迁移脚本创建 <code>sys_tenant</code> 表及默认数据。
|
||||
新增租户时<strong>租户编码由服务端自动生成</strong>,列表中可查看;需在数据库执行迁移脚本创建 <code>sys_tenant</code> 表及默认数据。
|
||||
</Alert>
|
||||
<div class="table-head-tool">
|
||||
<Button type="primary" @click="showAddWarp">新增租户</Button>
|
||||
@@ -27,7 +27,7 @@ export default {
|
||||
columns: [
|
||||
{ title: 'id', key: 'id' },
|
||||
{ title: '名称', key: 'name' },
|
||||
{ title: '编码', key: 'code' },
|
||||
{ title: '编码', key: 'code', name: 'code', display: true },
|
||||
{ title: '备注', key: 'remark' },
|
||||
{
|
||||
title: '状态',
|
||||
@@ -44,6 +44,7 @@ export default {
|
||||
{
|
||||
title: '平台租户',
|
||||
key: 'is_platform',
|
||||
com: 'Switch',
|
||||
render(h, p) {
|
||||
return h('span', Number(p.row.is_platform) === 1 ? '是' : '否')
|
||||
}
|
||||
@@ -78,6 +79,11 @@ export default {
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
normalizeTenantRow(row) {
|
||||
const r = { ...row }
|
||||
r.is_platform = r.is_platform === true || r.is_platform === 1 || r.is_platform === '1' ? 1 : 0
|
||||
return r
|
||||
},
|
||||
async init() {
|
||||
const res = await sysTenantServer.list()
|
||||
if (res && res.code === 0) {
|
||||
@@ -86,9 +92,9 @@ export default {
|
||||
},
|
||||
showAddWarp() {
|
||||
this.$refs.editModal.addShow(
|
||||
{ status: 1 },
|
||||
{ status: 1, is_platform: 0 },
|
||||
async (row) => {
|
||||
await sysTenantServer.add(row)
|
||||
await sysTenantServer.add(this.normalizeTenantRow(row))
|
||||
this.$Message.success('新增成功')
|
||||
this.init()
|
||||
}
|
||||
@@ -96,7 +102,7 @@ export default {
|
||||
},
|
||||
showEditWarp(row) {
|
||||
this.$refs.editModal.editShow(row, async (newRow) => {
|
||||
await sysTenantServer.edit(newRow)
|
||||
await sysTenantServer.edit(this.normalizeTenantRow(newRow))
|
||||
this.$Message.success('修改成功')
|
||||
this.init()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user