1
0
mirror of https://github.com/FatttSnake/Pinnacle-OA.git synced 2026-04-05 23:11:24 +08:00

Added a new column in CommonTable

This commit is contained in:
2023-05-16 18:22:57 +08:00
parent 0371eff3c9
commit 6cd9266b09
3 changed files with 23 additions and 10 deletions

View File

@@ -8,14 +8,26 @@
<el-table-column type="selection" /> <el-table-column type="selection" />
<el-table-column type="index" label="序号" /> <el-table-column type="index" label="序号" />
<el-table-column prop="name" label="名称" /> <el-table-column prop="name" label="名称" />
<el-table-column prop="menus" :label="customColumnLabel"> <el-table-column v-if="customColumnLabel_1" :label="customColumnLabel_1">
<template #default="scope"> <template #default="scope">
<el-tag <el-tag
v-if="!scope.row.customColumn || scope.row.customColumn.length === 0" v-if="!scope.row.customColumn_1 || scope.row.customColumn_1.length === 0"
type="info" type="info"
></el-tag ></el-tag
> >
<el-tag v-for="(column, index) in scope.row.customColumn" :key="index">{{ <el-tag v-for="(column, index) in scope.row.customColumn_1" :key="index">{{
column
}}</el-tag>
</template>
</el-table-column>
<el-table-column v-if="customColumnLabel_2" :label="customColumnLabel_2">
<template #default="scope">
<el-tag
v-if="!scope.row.customColumn_2 || scope.row.customColumn_2.length === 0"
type="info"
></el-tag
>
<el-tag v-for="(column, index) in scope.row.customColumn_2" :key="index">{{
column column
}}</el-tag> }}</el-tag>
</template> </template>
@@ -42,7 +54,8 @@ export default {
props: { props: {
tableDate: Array, tableDate: Array,
tableLoading: Boolean, tableLoading: Boolean,
customColumnLabel: String customColumnLabel_1: String,
customColumnLabel_2: String
} }
} }
</script> </script>

View File

@@ -19,7 +19,7 @@
:table-loading="tableLoading" :table-loading="tableLoading"
@onEdit="handleEdit" @onEdit="handleEdit"
@onDelete="handleDelete" @onDelete="handleDelete"
customColumnLabel="角色" custom-column-label_1="角色"
/> />
<el-dialog <el-dialog
:title="dialogTitle" :title="dialogTitle"
@@ -104,10 +104,10 @@ export default {
if (response.code === DATABASE_SELECT_OK) { if (response.code === DATABASE_SELECT_OK) {
const groups = response.data const groups = response.data
for (const group of groups) { for (const group of groups) {
group.customColumn = [] group.customColumn_1 = []
const roles = group.roles const roles = group.roles
for (const role of roles) { for (const role of roles) {
group.customColumn.push(role.name) group.customColumn_1.push(role.name)
} }
} }
this.groupTable = groups this.groupTable = groups

View File

@@ -19,7 +19,7 @@
:table-loading="tableLoading" :table-loading="tableLoading"
@onEdit="handleEdit" @onEdit="handleEdit"
@onDelete="handleDelete" @onDelete="handleDelete"
customColumnLabel="权限" custom-column-label_1="权限"
/> />
<el-dialog <el-dialog
:title="dialogTitle" :title="dialogTitle"
@@ -111,7 +111,7 @@ export default {
if (response.code === DATABASE_SELECT_OK) { if (response.code === DATABASE_SELECT_OK) {
const roles = response.data const roles = response.data
for (const role of roles) { for (const role of roles) {
role.customColumn = [] role.customColumn_1 = []
const menus = role.menus const menus = role.menus
const elements = role.elements const elements = role.elements
const operations = role.operations const operations = role.operations
@@ -133,7 +133,7 @@ export default {
_.forEach(element.operations, (value) => { _.forEach(element.operations, (value) => {
operas.push(value.name) operas.push(value.name)
}) })
role.customColumn.push( role.customColumn_1.push(
`${menu.name}/${element.name}/${_.join(operas, ';')}` `${menu.name}/${element.name}/${_.join(operas, ';')}`
) )
} }