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>
|
|
|
|
|
<el-table-column
|
|
|
|
|
v-for="(item, index) in customTableTitle"
|
|
|
|
|
:key="`col-${index}`"
|
|
|
|
|
: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-column
|
|
|
|
|
:resizable="false"
|
|
|
|
|
:width="operationWidth"
|
|
|
|
|
fixed="right">
|
|
|
|
|
<template #header>
|
|
|
|
|
<div class="table-operation-title">{{$t('overall.option')}}</div>
|
|
|
|
|
</template>
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<div class="table-operation-items">
|
2021-06-22 17:46:05 +08:00
|
|
|
<button class="table-operation-item" @click="tableOperation(['edit', scope.row])"><i class="cn-icon cn-icon-edit"></i></button>
|
2021-06-16 15:01:58 +08:00
|
|
|
<el-dropdown size="medium" trigger="hover" @command="tableOperation">
|
|
|
|
|
<div class="table-operation-item table-operation-item--more">
|
2021-06-20 13:31:55 +08:00
|
|
|
<i class="cn-icon cn-icon-more-arrow-down"></i>
|
2021-06-16 15:01:58 +08:00
|
|
|
</div>
|
|
|
|
|
<template #dropdown>
|
|
|
|
|
<el-dropdown-menu >
|
2021-06-18 15:25:13 +08:00
|
|
|
<el-dropdown-item v-has="'user_edit'" :command="['edit', scope.row]"><i class="cn-icon cn-icon-edit"></i><span class="operation-dropdown-text">{{$t('overall.edit')}}</span></el-dropdown-item>
|
|
|
|
|
<el-dropdown-item v-has="'user_delete'" :command="['delete', scope.row]" :disabled="scope.row.id === 1"><i class="cn-icon cn-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item>
|
2021-06-16 15:01:58 +08:00
|
|
|
</el-dropdown-menu>
|
|
|
|
|
</template>
|
|
|
|
|
</el-dropdown>
|
|
|
|
|
</div>
|
|
|
|
|
</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,
|
|
|
|
|
width: 80,
|
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
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|