2021-04-13 20:33:12 +08:00
|
|
|
<template>
|
|
|
|
|
<el-table
|
|
|
|
|
id="roleTable"
|
|
|
|
|
ref="dataTable"
|
|
|
|
|
:data="tableData"
|
|
|
|
|
:height="height"
|
|
|
|
|
border
|
2022-03-04 13:59:25 +08:00
|
|
|
:default-sort="orderBy"
|
2021-04-13 20:33:12 +08:00
|
|
|
@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"
|
|
|
|
|
v-if="item.show"
|
|
|
|
|
:key="`col-${index}`"
|
|
|
|
|
:fixed="item.fixed"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:min-width="`${item.minWidth}`"
|
|
|
|
|
:prop="item.prop"
|
|
|
|
|
:resizable="true"
|
|
|
|
|
:sort-orders="['ascending', 'descending']"
|
2021-05-07 19:10:28 +08:00
|
|
|
:sortable="item.sortable"
|
2021-04-13 20:33:12 +08:00
|
|
|
:width="`${item.width}`"
|
|
|
|
|
class="data-column"
|
|
|
|
|
>
|
|
|
|
|
<template slot="header">
|
2021-05-25 17:58:38 +08:00
|
|
|
<span class="data-column__span">{{item.label}}</span>
|
2021-04-13 20:33:12 +08:00
|
|
|
<div class="col-resize-area"></div>
|
|
|
|
|
</template>
|
|
|
|
|
<template slot-scope="scope" :column="item">
|
2022-06-23 13:40:20 +08:00
|
|
|
<template v-if="item.prop === 'name'">
|
2022-10-20 17:08:16 +08:00
|
|
|
<copy :copyData='scope.row[item.prop]' :showInfo='scope.row[item.prop]'>
|
|
|
|
|
<template slot="copy-text">
|
|
|
|
|
{{scope.row[item.prop]?scope.row[item.prop]:'-'}}
|
|
|
|
|
</template>
|
|
|
|
|
</copy>
|
2022-06-23 13:40:20 +08:00
|
|
|
</template>
|
|
|
|
|
<template v-else-if="item.prop === 'expression'">
|
2022-10-20 17:08:16 +08:00
|
|
|
<copy :copyData='scope.row[item.prop]' :showInfo='scope.row[item.prop]'>
|
|
|
|
|
<template slot="copy-text">
|
|
|
|
|
{{scope.row[item.prop]?scope.row[item.prop]:'-'}}
|
|
|
|
|
</template>
|
|
|
|
|
</copy>
|
2022-06-23 13:40:20 +08:00
|
|
|
</template>
|
|
|
|
|
<span v-else-if="scope.row[item.prop]">{{scope.row[item.prop] || '-'}}</span>
|
2021-04-13 20:33:12 +08:00
|
|
|
<template v-else>-</template>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column
|
|
|
|
|
:resizable="false"
|
|
|
|
|
:width="operationWidth"
|
|
|
|
|
fixed="right">
|
|
|
|
|
<div slot="header" class="table-operation-title">{{$t('overall.option')}}</div>
|
|
|
|
|
<div slot-scope="scope" class="table-operation-items">
|
2022-07-01 09:39:20 +08:00
|
|
|
<button class="table-operation-item" v-has="'expressionTemplate_edit'" @click="tableOperation(['edit', scope.row])" :title="$t('overall.edit')"><i class="nz-icon nz-icon-edit"></i></button>
|
2021-10-25 17:16:40 +08:00
|
|
|
<el-dropdown size="medium" v-has="['expressionTemplate_add','expressionTemplate_delete']" trigger="click" @command="tableOperation">
|
2022-07-01 09:39:20 +08:00
|
|
|
<div class="table-operation-item table-operation-item--more" :title="$t('overall.moreOperations')">
|
2021-05-27 13:53:42 +08:00
|
|
|
<i class="nz-icon nz-icon-more3"></i>
|
2021-04-13 20:33:12 +08:00
|
|
|
</div>
|
2021-10-29 12:02:34 +08:00
|
|
|
<el-dropdown-menu slot="dropdown" class="right-box-select-top right-public-box-dropdown-top">
|
2021-08-26 14:51:38 +08:00
|
|
|
<el-dropdown-item v-has="'expressionTemplate_add'" :command="['copy', scope.row]"><i class="nz-icon nz-icon-override"></i><span class="operation-dropdown-text">{{$t('overall.duplicate')}}</span></el-dropdown-item>
|
2023-01-04 11:10:03 +08:00
|
|
|
<el-dropdown-item v-has="'expressionTemplate_delete'" :command="['delete-rel', scope.row, {forceDeleteShow:false, single:true}]"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item>
|
2021-04-13 20:33:12 +08:00
|
|
|
</el-dropdown-menu>
|
|
|
|
|
</el-dropdown>
|
|
|
|
|
</div>
|
|
|
|
|
</el-table-column>
|
2021-10-22 19:39:49 +08:00
|
|
|
<template slot="empty">
|
2021-10-25 14:45:28 +08:00
|
|
|
<div v-if="!loading" class="table-no-data">
|
2021-10-22 17:47:42 +08:00
|
|
|
<svg class="icon" aria-hidden="true">
|
|
|
|
|
<use xlink:href="#nz-icon-no-data-list"></use>
|
|
|
|
|
</svg>
|
2021-10-28 17:53:27 +08:00
|
|
|
<div class="table-no-data__title">No results found</div>
|
2021-10-22 17:47:42 +08:00
|
|
|
</div>
|
2021-10-22 19:39:49 +08:00
|
|
|
<div v-else> </div>
|
2021-10-22 17:47:42 +08:00
|
|
|
</template>
|
2021-04-13 20:33:12 +08:00
|
|
|
</el-table>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import table from '@/components/common/mixin/table'
|
2022-10-20 17:08:16 +08:00
|
|
|
import copy from '@/components/common/copy'
|
2021-04-13 20:33:12 +08:00
|
|
|
export default {
|
2021-06-17 11:24:38 +08:00
|
|
|
name: 'exprTmplTable',
|
2021-04-13 20:33:12 +08:00
|
|
|
mixins: [table],
|
2023-01-04 11:10:03 +08:00
|
|
|
components: { copy },
|
2021-10-22 17:47:42 +08:00
|
|
|
props: {
|
|
|
|
|
loading: Boolean
|
|
|
|
|
},
|
2021-04-13 20:33:12 +08:00
|
|
|
data () {
|
|
|
|
|
return {
|
|
|
|
|
tableTitle: [
|
|
|
|
|
{
|
|
|
|
|
label: 'ID',
|
|
|
|
|
prop: 'id',
|
|
|
|
|
show: true,
|
2021-05-07 19:10:28 +08:00
|
|
|
width: 80,
|
2021-07-23 15:49:18 +08:00
|
|
|
sortable: 'custom'
|
2021-04-13 20:33:12 +08:00
|
|
|
}, {
|
2022-06-16 15:58:17 +08:00
|
|
|
label: this.$t('overall.name'),
|
2021-04-13 20:33:12 +08:00
|
|
|
prop: 'name',
|
2021-05-07 19:10:28 +08:00
|
|
|
show: true,
|
2021-07-23 15:49:18 +08:00
|
|
|
sortable: 'custom'
|
2021-04-13 20:33:12 +08:00
|
|
|
}, {
|
2023-03-17 12:46:56 +08:00
|
|
|
label: this.$t('dashboard.dashboard.chartForm.group'),
|
2021-04-13 20:33:12 +08:00
|
|
|
prop: 'gname',
|
2021-05-07 19:10:28 +08:00
|
|
|
show: true,
|
2021-07-23 15:49:18 +08:00
|
|
|
sortable: 'custom'
|
2021-04-13 20:33:12 +08:00
|
|
|
}, {
|
|
|
|
|
label: this.$t('config.exprTemp.expression'),
|
|
|
|
|
prop: 'expression',
|
|
|
|
|
show: true
|
|
|
|
|
}, {
|
2021-06-08 09:44:32 +08:00
|
|
|
label: this.$t('overall.remark'),
|
2021-04-13 20:33:12 +08:00
|
|
|
prop: 'remark',
|
|
|
|
|
show: true
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|