2021-06-16 15:01:58 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<el-table
|
|
|
|
|
|
id="roleTable"
|
|
|
|
|
|
ref="dataTable"
|
|
|
|
|
|
:data="tableData"
|
|
|
|
|
|
:height="height"
|
|
|
|
|
|
border
|
|
|
|
|
|
@header-dragend="dragend"
|
|
|
|
|
|
@sort-change="tableDataSort"
|
|
|
|
|
|
@selection-change="selectionChange"
|
|
|
|
|
|
>
|
|
|
|
|
|
<el-table-column
|
|
|
|
|
|
:resizable="false"
|
|
|
|
|
|
align="center"
|
|
|
|
|
|
type="selection"
|
|
|
|
|
|
width="55">
|
|
|
|
|
|
</el-table-column>
|
2023-05-25 18:34:51 +08:00
|
|
|
|
<!--key只使用item.prop的话,拖拽后,界面无响应,添加index后问题解决-->
|
2021-06-16 15:01:58 +08:00
|
|
|
|
<el-table-column
|
2023-05-25 18:31:26 +08:00
|
|
|
|
v-for="(item, index) in customTableTitles"
|
|
|
|
|
|
:key="item.prop+index"
|
2021-06-16 15:01:58 +08:00
|
|
|
|
:fixed="item.fixed"
|
|
|
|
|
|
:label="item.label"
|
|
|
|
|
|
:min-width="`${item.minWidth}`"
|
|
|
|
|
|
:prop="item.prop"
|
|
|
|
|
|
:resizable="true"
|
|
|
|
|
|
:sort-orders="['ascending', 'descending']"
|
|
|
|
|
|
:sortable="item.sortable"
|
|
|
|
|
|
:width="`${item.width}`"
|
|
|
|
|
|
class="data-column"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template #header>
|
|
|
|
|
|
<span class="data-column__span">{{item.label}}</span>
|
|
|
|
|
|
<div class="col-resize-area"></div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template #default="scope" :column="item">
|
|
|
|
|
|
<template v-if="item.prop === 'name'">
|
|
|
|
|
|
<template v-if="scope.row.i18n">
|
|
|
|
|
|
<span>{{$t(scope.row.i18n)}}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else-if="scope.row.name">
|
|
|
|
|
|
<span>{{scope.row.name}}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else>
|
|
|
|
|
|
<span>-</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<span v-else>{{scope.row[item.prop]}}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2021-06-17 16:56:50 +08:00
|
|
|
|
import table from '@/mixins/table'
|
2021-06-16 15:01:58 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
name: 'roleTable',
|
|
|
|
|
|
mixins: [table],
|
|
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
|
|
|
|
|
tableTitle: [ // 原table列
|
|
|
|
|
|
{
|
|
|
|
|
|
label: 'ID',
|
|
|
|
|
|
prop: 'id',
|
|
|
|
|
|
show: true,
|
2022-04-25 15:29:44 +08:00
|
|
|
|
width: 100,
|
2021-06-17 16:56:50 +08:00
|
|
|
|
sortable: 'custom'
|
2021-06-16 15:01:58 +08:00
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('config.roles.name'),
|
|
|
|
|
|
prop: 'name',
|
|
|
|
|
|
show: true,
|
2021-06-17 16:56:50 +08:00
|
|
|
|
sortable: 'custom'
|
2021-06-16 15:01:58 +08:00
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('overall.remark'),
|
|
|
|
|
|
prop: 'remark',
|
|
|
|
|
|
show: true
|
|
|
|
|
|
}
|
2023-05-25 18:34:51 +08:00
|
|
|
|
]
|
2021-06-16 15:01:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|