2021-04-23 11:47:38 +08:00
|
|
|
<template>
|
|
|
|
|
<el-table
|
|
|
|
|
id="roleTable"
|
|
|
|
|
ref="dataTable"
|
|
|
|
|
:data="tableData"
|
|
|
|
|
:height="height"
|
|
|
|
|
border
|
|
|
|
|
@header-dragend="dragend"
|
|
|
|
|
@sort-change="tableDataSort"
|
|
|
|
|
@selection-change="selectionChange"
|
2021-05-25 15:37:33 +08:00
|
|
|
@row-dblclick="(row)=>{showBottomBox('panel', row)}"
|
2021-04-23 11:47:38 +08:00
|
|
|
>
|
|
|
|
|
<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-23 11:47:38 +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-23 11:47:38 +08:00
|
|
|
<div class="col-resize-area"></div>
|
|
|
|
|
</template>
|
|
|
|
|
<template slot-scope="scope" :column="item">
|
2021-08-03 16:56:49 +08:00
|
|
|
<span v-if="item.prop==='varType'">{{scope.row[item.prop] === 1 ? 'Asset' : 'Endpoint'}}</span>
|
2021-04-27 11:25:24 +08:00
|
|
|
<span v-else-if="item.prop==='type'">
|
|
|
|
|
<i :class="typeIcon(scope.row)"/>
|
2021-05-27 14:09:02 +08:00
|
|
|
{{findTypeLabel(scope.row)}}
|
2021-04-25 20:17:14 +08:00
|
|
|
</span>
|
2021-04-23 18:10:25 +08:00
|
|
|
<span v-else-if="scope.row[item.prop]">{{scope.row[item.prop] || '-'}}</span>
|
2021-04-23 11:47:38 +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">
|
2021-04-23 18:10:25 +08:00
|
|
|
<button class="table-operation-item" title="Copy" @click="showBottomBox('panel', scope.row)"><i class="nz-icon nz-icon-view1"></i></button>
|
2021-05-19 14:26:09 +08:00
|
|
|
<el-dropdown size="medium" v-has="['panel_chart_edit','panel_chart_delete']" trigger="hover" @command="tableOperation">
|
2021-04-23 11:47:38 +08:00
|
|
|
<div class="table-operation-item table-operation-item--more">
|
2021-05-27 13:53:42 +08:00
|
|
|
<i class="nz-icon nz-icon-more3"></i>
|
2021-04-23 11:47:38 +08:00
|
|
|
</div>
|
|
|
|
|
<el-dropdown-menu slot="dropdown">
|
2021-05-19 14:04:16 +08:00
|
|
|
<el-dropdown-item v-has="'panel_chart_edit'" :command="['edit', scope.row]"><i class="nz-icon nz-icon-edit"></i><span class="operation-dropdown-text">{{$t('overall.edit')}}</span></el-dropdown-item>
|
|
|
|
|
<el-dropdown-item v-has="'panel_chart_delete'" :command="['delete', scope.row]"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item>
|
2021-05-20 14:07:58 +08:00
|
|
|
<el-dropdown-item v-has="'panel_chart_edit'" :command="['sync', scope.row]"><i class="nz-icon nz-icon-sync"></i><span class="operation-dropdown-text">{{$t('overall.syncChart')}}</span></el-dropdown-item>
|
2021-04-23 11:47:38 +08:00
|
|
|
</el-dropdown-menu>
|
|
|
|
|
</el-dropdown>
|
|
|
|
|
</div>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import table from '@/components/common/mixin/table'
|
2021-05-10 15:59:39 +08:00
|
|
|
import { chart as chartConstant } from '@/components/common/js/constants'
|
2021-04-23 11:47:38 +08:00
|
|
|
export default {
|
2021-06-17 11:24:38 +08:00
|
|
|
name: 'chartTmplTable',
|
2021-04-23 11:47:38 +08:00
|
|
|
mixins: [table],
|
|
|
|
|
data () {
|
|
|
|
|
return {
|
2021-05-10 15:59:39 +08:00
|
|
|
chartTypeList: chartConstant.type,
|
2021-04-23 11:47:38 +08:00
|
|
|
tableTitle: [
|
|
|
|
|
{
|
|
|
|
|
label: 'ID',
|
|
|
|
|
prop: 'id',
|
|
|
|
|
show: true,
|
2021-05-07 19:10:28 +08:00
|
|
|
width: 80,
|
2021-05-10 16:27:27 +08:00
|
|
|
sortable: 'custom'
|
2021-04-23 11:47:38 +08:00
|
|
|
}, {
|
|
|
|
|
label: this.$t('config.exprTemp.name'),
|
|
|
|
|
prop: 'name',
|
2021-05-07 19:10:28 +08:00
|
|
|
show: true,
|
2021-07-22 10:00:29 +08:00
|
|
|
minWidth: 200,
|
2021-05-10 16:27:27 +08:00
|
|
|
sortable: 'custom'
|
2021-04-25 14:58:03 +08:00
|
|
|
}, {
|
|
|
|
|
label: this.$t('config.exprTemp.type'),
|
|
|
|
|
prop: 'type',
|
2021-05-07 19:10:28 +08:00
|
|
|
show: true,
|
2021-07-22 10:00:29 +08:00
|
|
|
minWidth: 200,
|
2021-05-10 16:27:27 +08:00
|
|
|
sortable: 'custom'
|
2021-04-23 18:10:25 +08:00
|
|
|
}, {
|
|
|
|
|
label: this.$t('config.exprTemp.varType'),
|
|
|
|
|
prop: 'varType',
|
2021-05-07 19:10:28 +08:00
|
|
|
show: true,
|
2021-07-22 10:00:29 +08:00
|
|
|
minWidth: 200,
|
2021-05-10 16:27:27 +08:00
|
|
|
sortable: 'custom'
|
2021-04-23 11:47:38 +08:00
|
|
|
}, {
|
2021-06-08 09:44:32 +08:00
|
|
|
label: this.$t('overall.remark'),
|
2021-04-23 11:47:38 +08:00
|
|
|
prop: 'remark',
|
2021-07-22 10:00:29 +08:00
|
|
|
show: true,
|
2021-07-23 15:49:18 +08:00
|
|
|
minWidth: 200
|
2021-04-23 11:47:38 +08:00
|
|
|
}
|
2021-05-10 16:27:27 +08:00
|
|
|
]
|
2021-04-23 11:47:38 +08:00
|
|
|
}
|
2021-04-25 16:28:09 +08:00
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
typeIcon (row) {
|
2021-04-27 11:25:24 +08:00
|
|
|
let str = 'nz-icon '
|
2021-04-25 16:28:09 +08:00
|
|
|
switch (row.type) {
|
|
|
|
|
case 'line':
|
2021-04-27 16:42:07 +08:00
|
|
|
str += 'nz-icon-link-chart'
|
2021-04-27 11:25:24 +08:00
|
|
|
break
|
|
|
|
|
case 'bar':
|
2021-04-27 16:42:07 +08:00
|
|
|
str += 'nz-icon-bar-chart'
|
2021-04-27 11:25:24 +08:00
|
|
|
break
|
|
|
|
|
case 'stackArea':
|
2021-04-27 16:42:07 +08:00
|
|
|
str += 'nz-icon-stack-area'
|
2021-04-27 11:25:24 +08:00
|
|
|
break
|
|
|
|
|
case 'singleStat':
|
2021-04-27 16:42:07 +08:00
|
|
|
str += 'nz-icon-single-value'
|
2021-04-27 11:25:24 +08:00
|
|
|
break
|
|
|
|
|
case 'pie':
|
2021-04-27 16:42:07 +08:00
|
|
|
str += 'nz-icon-pie-chart'
|
2021-04-27 11:25:24 +08:00
|
|
|
break
|
|
|
|
|
case 'table':
|
2021-04-27 16:42:07 +08:00
|
|
|
str += 'nz-icon-table1'
|
2021-04-27 11:25:24 +08:00
|
|
|
break
|
|
|
|
|
case 'alertList':
|
2021-04-27 16:42:07 +08:00
|
|
|
str += 'nz-icon-alert-list'
|
2021-04-27 11:25:24 +08:00
|
|
|
break
|
|
|
|
|
case 'text':
|
2021-04-27 16:42:07 +08:00
|
|
|
str += 'nz-icon-text1'
|
2021-04-27 11:25:24 +08:00
|
|
|
break
|
|
|
|
|
case 'url':
|
2021-04-27 16:42:07 +08:00
|
|
|
str += 'nz-icon-url'
|
2021-04-27 11:25:24 +08:00
|
|
|
break
|
|
|
|
|
case 'group':
|
2021-04-27 16:42:07 +08:00
|
|
|
str += 'nz-icon-group'
|
2021-04-25 16:28:09 +08:00
|
|
|
break
|
|
|
|
|
default :
|
2021-04-27 16:42:07 +08:00
|
|
|
str += 'nz-icon-table1'
|
2021-04-25 16:28:09 +08:00
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
return str
|
2021-05-27 14:09:02 +08:00
|
|
|
},
|
|
|
|
|
findTypeLabel (row) {
|
|
|
|
|
const typeItem = this.chartTypeList.find(title => title.value === row.type)
|
|
|
|
|
return typeItem ? typeItem.label : '-'
|
2021-04-25 16:28:09 +08:00
|
|
|
}
|
2021-04-23 11:47:38 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|