2021-03-11 14:33:24 +08:00
|
|
|
<template>
|
|
|
|
<span>
|
2021-07-24 10:19:24 +08:00
|
|
|
<el-tag v-if="!hasDataPermission('manage',param.privileges)" size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
|
2021-07-08 13:50:22 +08:00
|
|
|
<span style="float: left">
|
|
|
|
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
|
|
|
|
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
|
|
|
|
<svg-icon v-if="item.deType === 2 || item.deType === 3" icon-class="field_value" class="field-icon-value" />
|
|
|
|
<svg-icon v-if="item.deType === 5" icon-class="field_location" class="field-icon-location" />
|
2021-08-31 17:42:26 +08:00
|
|
|
<svg-icon v-if="chart.type ==='chart-mix' && item.chartType === 'bar'" icon-class="bar" class-name="field-icon-sort" />
|
|
|
|
<svg-icon v-if="chart.type ==='chart-mix' && item.chartType === 'line'" icon-class="line" class-name="field-icon-sort" />
|
|
|
|
<svg-icon v-if="chart.type ==='chart-mix' && item.chartType === 'scatter'" icon-class="scatter" class-name="field-icon-sort" />
|
2021-07-21 18:17:30 +08:00
|
|
|
<svg-icon v-if="item.sort === 'asc'" icon-class="sort-asc" class-name="field-icon-sort" />
|
|
|
|
<svg-icon v-if="item.sort === 'desc'" icon-class="sort-desc" class-name="field-icon-sort" />
|
2021-07-08 13:50:22 +08:00
|
|
|
</span>
|
2021-07-19 12:36:25 +08:00
|
|
|
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
|
2021-07-07 11:06:53 +08:00
|
|
|
<span v-if="item.summary" class="summary-span">{{ $t('chart.'+item.summary) }}</span>
|
|
|
|
</el-tag>
|
|
|
|
<el-dropdown v-else trigger="click" size="mini" @command="clickItem">
|
2021-03-11 14:33:24 +08:00
|
|
|
<span class="el-dropdown-link">
|
2021-07-28 22:19:50 +08:00
|
|
|
<el-tag size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
|
2021-07-08 13:50:22 +08:00
|
|
|
<span style="float: left">
|
|
|
|
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
|
|
|
|
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
|
|
|
|
<svg-icon v-if="item.deType === 2 || item.deType === 3" icon-class="field_value" class="field-icon-value" />
|
|
|
|
<svg-icon v-if="item.deType === 5" icon-class="field_location" class="field-icon-location" />
|
2021-08-31 17:42:26 +08:00
|
|
|
<svg-icon v-if="chart.type ==='chart-mix' && item.chartType === 'bar'" icon-class="bar" class-name="field-icon-sort" />
|
|
|
|
<svg-icon v-if="chart.type ==='chart-mix' && item.chartType === 'line'" icon-class="line" class-name="field-icon-sort" />
|
|
|
|
<svg-icon v-if="chart.type ==='chart-mix' && item.chartType === 'scatter'" icon-class="scatter" class-name="field-icon-sort" />
|
2021-07-21 18:17:30 +08:00
|
|
|
<svg-icon v-if="item.sort === 'asc'" icon-class="sort-asc" class-name="field-icon-sort" />
|
|
|
|
<svg-icon v-if="item.sort === 'desc'" icon-class="sort-desc" class-name="field-icon-sort" />
|
2021-07-08 13:50:22 +08:00
|
|
|
</span>
|
2021-07-19 12:36:25 +08:00
|
|
|
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
|
2021-04-25 15:10:49 +08:00
|
|
|
<span v-if="item.summary" class="summary-span">{{ $t('chart.'+item.summary) }}</span>
|
2021-07-19 12:36:25 +08:00
|
|
|
<i class="el-icon-arrow-down el-icon--right" style="position: absolute;top: 6px;right: 10px;" />
|
2021-03-11 15:57:54 +08:00
|
|
|
</el-tag>
|
2021-07-07 11:06:53 +08:00
|
|
|
<el-dropdown-menu slot="dropdown">
|
2021-08-31 17:15:20 +08:00
|
|
|
<el-dropdown-item v-show="chart.type ==='chart-mix'">
|
|
|
|
<el-dropdown placement="right-start" size="mini" style="width: 100%" @command="switchChartType">
|
|
|
|
<span class="el-dropdown-link inner-dropdown-menu">
|
|
|
|
<span>
|
|
|
|
<i class="el-icon-s-data" />
|
|
|
|
<span>{{ $t('chart.chart_type') }}</span>
|
|
|
|
</span>
|
|
|
|
<i class="el-icon-arrow-right el-icon--right" />
|
|
|
|
</span>
|
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
|
<el-dropdown-item :command="beforeSwitch('bar')">{{ $t('chart.chart_bar') }}</el-dropdown-item>
|
|
|
|
<el-dropdown-item :command="beforeSwitch('line')">{{ $t('chart.chart_line') }}</el-dropdown-item>
|
|
|
|
<el-dropdown-item :command="beforeSwitch('scatter')">{{ $t('chart.chart_scatter') }}</el-dropdown-item>
|
|
|
|
</el-dropdown-menu>
|
|
|
|
</el-dropdown>
|
|
|
|
</el-dropdown-item>
|
|
|
|
<el-dropdown-item divided>
|
2021-03-23 18:08:56 +08:00
|
|
|
<el-dropdown placement="right-start" size="mini" style="width: 100%" @command="summary">
|
2021-03-23 18:13:23 +08:00
|
|
|
<span class="el-dropdown-link inner-dropdown-menu">
|
2021-03-23 18:08:56 +08:00
|
|
|
<span>
|
|
|
|
<i class="el-icon-notebook-2" />
|
|
|
|
<span>{{ $t('chart.summary') }}</span>
|
2021-07-22 11:02:33 +08:00
|
|
|
<span class="summary-span-item">({{ $t('chart.'+item.summary) }})</span>
|
2021-03-23 18:08:56 +08:00
|
|
|
</span>
|
|
|
|
<i class="el-icon-arrow-right el-icon--right" />
|
2021-03-11 15:57:54 +08:00
|
|
|
</span>
|
|
|
|
<el-dropdown-menu slot="dropdown">
|
2021-07-08 13:50:22 +08:00
|
|
|
<el-dropdown-item v-if="item.id === 'count' || item.deType === 0 || item.deType === 1" :command="beforeSummary('count')">{{ $t('chart.count') }}</el-dropdown-item>
|
|
|
|
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1" :command="beforeSummary('sum')">{{ $t('chart.sum') }}</el-dropdown-item>
|
|
|
|
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1" :command="beforeSummary('avg')">{{ $t('chart.avg') }}</el-dropdown-item>
|
|
|
|
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1" :command="beforeSummary('max')">{{ $t('chart.max') }}</el-dropdown-item>
|
|
|
|
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1" :command="beforeSummary('min')">{{ $t('chart.min') }}</el-dropdown-item>
|
|
|
|
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1" :command="beforeSummary('stddev_pop')">{{ $t('chart.stddev_pop') }}</el-dropdown-item>
|
|
|
|
<el-dropdown-item v-if="item.id !== 'count' && item.deType !== 0 && item.deType !== 1" :command="beforeSummary('var_pop')">{{ $t('chart.var_pop') }}</el-dropdown-item>
|
2021-03-11 15:57:54 +08:00
|
|
|
</el-dropdown-menu>
|
|
|
|
</el-dropdown>
|
|
|
|
</el-dropdown-item>
|
2021-06-11 12:24:19 +08:00
|
|
|
<!-- 快速计算先隐藏-->
|
|
|
|
<!-- <el-dropdown-item v-if="item.id !== 'count'">-->
|
|
|
|
<!-- <el-dropdown placement="right-start" size="mini" style="width: 100%" @command="quickCalc">-->
|
|
|
|
<!-- <span class="el-dropdown-link inner-dropdown-menu">-->
|
|
|
|
<!-- <span>-->
|
|
|
|
<!-- <i class="el-icon-s-grid" />-->
|
|
|
|
<!-- <span>{{ $t('chart.quick_calc') }}</span>-->
|
2021-07-22 11:02:33 +08:00
|
|
|
<!-- <span class="summary-span-item">(无)</span>-->
|
2021-06-11 12:24:19 +08:00
|
|
|
<!-- </span>-->
|
|
|
|
<!-- <i class="el-icon-arrow-right el-icon--right" />-->
|
|
|
|
<!-- </span>-->
|
|
|
|
<!-- <el-dropdown-menu slot="dropdown">-->
|
|
|
|
<!-- <el-dropdown-item :command="beforeQuickCalc('none')">无</el-dropdown-item>-->
|
|
|
|
<!-- </el-dropdown-menu>-->
|
|
|
|
<!-- </el-dropdown>-->
|
|
|
|
<!-- </el-dropdown-item>-->
|
2021-03-23 18:08:56 +08:00
|
|
|
<el-dropdown-item divided>
|
|
|
|
<el-dropdown placement="right-start" size="mini" style="width: 100%" @command="sort">
|
2021-03-23 18:13:23 +08:00
|
|
|
<span class="el-dropdown-link inner-dropdown-menu">
|
2021-03-23 18:08:56 +08:00
|
|
|
<span>
|
|
|
|
<i class="el-icon-sort" />
|
|
|
|
<span>{{ $t('chart.sort') }}</span>
|
2021-07-22 11:02:33 +08:00
|
|
|
<span class="summary-span-item">({{ $t('chart.'+item.sort) }})</span>
|
2021-03-23 18:08:56 +08:00
|
|
|
</span>
|
|
|
|
<i class="el-icon-arrow-right el-icon--right" />
|
|
|
|
</span>
|
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
|
<el-dropdown-item :command="beforeSort('none')">{{ $t('chart.none') }}</el-dropdown-item>
|
|
|
|
<el-dropdown-item :command="beforeSort('asc')">{{ $t('chart.asc') }}</el-dropdown-item>
|
|
|
|
<el-dropdown-item :command="beforeSort('desc')">{{ $t('chart.desc') }}</el-dropdown-item>
|
|
|
|
</el-dropdown-menu>
|
|
|
|
</el-dropdown>
|
|
|
|
</el-dropdown-item>
|
2021-03-25 11:34:46 +08:00
|
|
|
<el-dropdown-item icon="el-icon-files" :command="beforeClickItem('filter')">
|
2021-03-23 18:08:56 +08:00
|
|
|
<span>{{ $t('chart.filter') }}...</span>
|
|
|
|
</el-dropdown-item>
|
2021-03-16 13:32:35 +08:00
|
|
|
<el-dropdown-item icon="el-icon-edit-outline" divided :command="beforeClickItem('rename')">
|
|
|
|
<span>{{ $t('chart.show_name_set') }}</span>
|
2021-03-11 15:57:54 +08:00
|
|
|
</el-dropdown-item>
|
2021-03-23 15:31:57 +08:00
|
|
|
<el-dropdown-item icon="el-icon-delete" divided :command="beforeClickItem('remove')">
|
|
|
|
<span>{{ $t('chart.delete') }}</span>
|
|
|
|
</el-dropdown-item>
|
2021-03-11 15:57:54 +08:00
|
|
|
</el-dropdown-menu>
|
2021-03-11 14:33:24 +08:00
|
|
|
</span>
|
2021-03-11 16:02:28 +08:00
|
|
|
</el-dropdown>
|
2021-03-11 14:33:24 +08:00
|
|
|
</span>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
name: 'QuotaItem',
|
|
|
|
props: {
|
2021-07-06 19:26:15 +08:00
|
|
|
param: {
|
|
|
|
type: Object,
|
|
|
|
required: true
|
|
|
|
},
|
2021-03-11 14:33:24 +08:00
|
|
|
item: {
|
|
|
|
type: Object,
|
|
|
|
required: true
|
2021-03-23 15:31:57 +08:00
|
|
|
},
|
|
|
|
index: {
|
|
|
|
type: Number,
|
|
|
|
required: true
|
2021-08-31 17:15:20 +08:00
|
|
|
},
|
|
|
|
chart: {
|
|
|
|
type: Object,
|
|
|
|
required: true
|
2021-03-11 14:33:24 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
2021-03-16 13:32:35 +08:00
|
|
|
return {
|
|
|
|
}
|
2021-03-11 14:33:24 +08:00
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
|
|
|
|
},
|
|
|
|
methods: {
|
2021-03-23 18:08:56 +08:00
|
|
|
clickItem(param) {
|
|
|
|
if (!param) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
switch (param.type) {
|
|
|
|
case 'rename':
|
|
|
|
this.showRename()
|
|
|
|
break
|
|
|
|
case 'remove':
|
|
|
|
this.removeItem()
|
|
|
|
break
|
2021-03-25 11:34:46 +08:00
|
|
|
case 'filter':
|
|
|
|
this.editFilter()
|
|
|
|
break
|
2021-03-23 18:08:56 +08:00
|
|
|
default:
|
|
|
|
break
|
|
|
|
}
|
|
|
|
},
|
|
|
|
beforeClickItem(type) {
|
|
|
|
return {
|
|
|
|
type: type
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2021-03-11 14:33:24 +08:00
|
|
|
summary(param) {
|
2021-03-11 15:06:13 +08:00
|
|
|
// console.log(param)
|
2021-03-11 14:33:24 +08:00
|
|
|
this.item.summary = param.type
|
2021-03-16 13:32:35 +08:00
|
|
|
this.$emit('onQuotaItemChange', this.item)
|
2021-03-11 14:33:24 +08:00
|
|
|
},
|
|
|
|
beforeSummary(type) {
|
|
|
|
return {
|
|
|
|
type: type
|
|
|
|
}
|
2021-03-16 13:32:35 +08:00
|
|
|
},
|
2021-03-23 18:08:56 +08:00
|
|
|
|
2021-08-31 17:15:20 +08:00
|
|
|
switchChartType(param) {
|
|
|
|
// console.log(param)
|
|
|
|
this.item.chartType = param.type
|
|
|
|
this.$emit('onQuotaItemChange', this.item)
|
|
|
|
},
|
|
|
|
beforeSwitch(type) {
|
|
|
|
return {
|
|
|
|
type: type
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2021-03-16 13:32:35 +08:00
|
|
|
quickCalc(param) {
|
|
|
|
|
|
|
|
},
|
|
|
|
beforeQuickCalc(type) {
|
|
|
|
return {
|
|
|
|
type: type
|
|
|
|
}
|
|
|
|
},
|
2021-03-23 18:08:56 +08:00
|
|
|
|
|
|
|
sort(param) {
|
|
|
|
// console.log(param)
|
|
|
|
this.item.sort = param.type
|
|
|
|
this.$emit('onQuotaItemChange', this.item)
|
2021-03-16 13:32:35 +08:00
|
|
|
},
|
2021-03-23 18:08:56 +08:00
|
|
|
beforeSort(type) {
|
2021-03-16 13:32:35 +08:00
|
|
|
return {
|
|
|
|
type: type
|
|
|
|
}
|
|
|
|
},
|
|
|
|
showRename() {
|
2021-03-25 11:34:46 +08:00
|
|
|
this.item.index = this.index
|
|
|
|
this.item.renameType = 'quota'
|
|
|
|
this.$emit('onNameEdit', this.item)
|
2021-03-23 15:31:57 +08:00
|
|
|
},
|
|
|
|
removeItem() {
|
|
|
|
this.item.index = this.index
|
|
|
|
this.$emit('onQuotaItemRemove', this.item)
|
2021-03-25 11:34:46 +08:00
|
|
|
},
|
|
|
|
editFilter() {
|
|
|
|
this.item.index = this.index
|
|
|
|
this.$emit('editItemFilter', this.item)
|
2021-03-11 14:33:24 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.item-axis {
|
|
|
|
padding: 1px 6px;
|
|
|
|
margin: 0 3px 2px 3px;
|
|
|
|
text-align: left;
|
|
|
|
height: 24px;
|
|
|
|
line-height: 22px;
|
2021-07-19 12:36:25 +08:00
|
|
|
display: flex;
|
2021-03-11 14:33:24 +08:00
|
|
|
border-radius: 4px;
|
|
|
|
box-sizing: border-box;
|
|
|
|
white-space: nowrap;
|
2021-07-19 12:36:25 +08:00
|
|
|
width: 159px;
|
2021-03-11 14:33:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
.item-axis:hover {
|
|
|
|
background-color: #fdfdfd;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
|
|
|
|
span {
|
|
|
|
font-size: 12px;
|
|
|
|
}
|
|
|
|
|
2021-07-22 11:02:33 +08:00
|
|
|
.summary-span-item{
|
|
|
|
margin-left: 4px;
|
|
|
|
color: #878d9f;
|
|
|
|
}
|
|
|
|
|
2021-03-11 14:33:24 +08:00
|
|
|
.summary-span{
|
|
|
|
margin-left: 4px;
|
2021-07-22 10:49:23 +08:00
|
|
|
color: #878d9f;
|
|
|
|
position: absolute;
|
|
|
|
right: 30px;
|
2021-03-11 14:33:24 +08:00
|
|
|
}
|
2021-03-23 18:13:23 +08:00
|
|
|
|
|
|
|
.inner-dropdown-menu{
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
|
|
|
width: 100%
|
|
|
|
}
|
2021-07-19 12:36:25 +08:00
|
|
|
|
|
|
|
.item-span-style{
|
|
|
|
display: inline-block;
|
2021-08-31 17:15:20 +08:00
|
|
|
width: 70px;
|
2021-07-19 12:36:25 +08:00
|
|
|
white-space: nowrap;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
2021-03-11 14:33:24 +08:00
|
|
|
</style>
|