feat:复制图表添加提示 & table类型图表背景色样式调整

This commit is contained in:
wangwenrui
2020-12-16 13:02:53 +08:00
parent d5be0c99a2
commit c72e92ffe8
11 changed files with 157 additions and 116 deletions

View File

@@ -839,24 +839,30 @@ export default {
},
duplicate(){
this.dropdownMenuShow=false;
const param = {id:this.data.id};
this.$post('panel/'+ this.data.panelId+'/charts/duplicate',(param)).then(response => {
if (response.code === 200) {
this.$message({
duration: 2000,
type: 'success',
message: this.$t("tip.duplicateSuccess")
});
this.$emit('on-duplicate-chart-block', this.data.id,response.data);
}else {
if(response.msg){
this.$message.error(response.msg);
}else if(response.error){
this.$message.error(response.error);
this.$confirm(this.$t("tip.confirmDuplicate"), {
confirmButtonText: this.$t("tip.yes"),
cancelButtonText: this.$t("tip.no"),
type: 'info'
}).then(() => {
const param = {id:this.data.id};
this.$post('panel/'+ this.data.panelId+'/charts/duplicate',(param)).then(response => {
if (response.code === 200) {
this.$message({
duration: 2000,
type: 'success',
message: this.$t("tip.duplicateSuccess")
});
this.$emit('on-duplicate-chart-block', this.data.id,response.data);
}else {
this.$message.error(response);
if(response.msg){
this.$message.error(response.msg);
}else if(response.error){
this.$message.error(response.error);
}else {
this.$message.error(response);
}
}
}
});
});
},
// 全屏查看

View File

@@ -359,24 +359,30 @@ export default {
},
duplicate(){
this.dropdownMenuShow=false;
const param = {id:this.data.id};
this.$post('panel/'+ this.data.panelId+'/charts/duplicate',(param)).then(response => {
if (response.code === 200) {
this.$message({
duration: 2000,
type: 'success',
message: this.$t("tip.duplicateSuccess")
});
this.$emit('on-duplicate-chart-block', this.data.id,response.data);
}else {
if(response.msg){
this.$message.error(response.msg);
}else if(response.error){
this.$message.error(response.error);
this.$confirm(this.$t("tip.confirmDuplicate"), {
confirmButtonText: this.$t("tip.yes"),
cancelButtonText: this.$t("tip.no"),
type: 'info'
}).then(() => {
const param = {id:this.data.id};
this.$post('panel/'+ this.data.panelId+'/charts/duplicate',(param)).then(response => {
if (response.code === 200) {
this.$message({
duration: 2000,
type: 'success',
message: this.$t("tip.duplicateSuccess")
});
this.$emit('on-duplicate-chart-block', this.data.id,response.data);
}else {
this.$message.error(response);
if(response.msg){
this.$message.error(response.msg);
}else if(response.error){
this.$message.error(response.error);
}else {
this.$message.error(response);
}
}
}
});
});
},
// 全屏查看

View File

@@ -62,10 +62,10 @@
{{ scope.row.element.alias?scope.row.element.alias:scope.row.element.element}}
</template>
</el-table-column>
<el-table-column sortable prop="value" :label="$t('dashboard.panel.chartTableColumn.value')" min-width="90"
<el-table-column sortable prop="value" :label="$t('dashboard.panel.chartTableColumn.value')" min-width="90" class-name="costom-value"
:resizable="false" :sort-orders="['ascending', 'descending']" :sortable="'custom'">
<template slot-scope="scope">
<div :style="{color:scope.row.mapping?scope.row.mapping.color.text:'#000',background:scope.row.mapping?scope.row.mapping.color.bac:'#fff',margin: '10px 0'}">{{ scope.row.value}}</div>
<div :style="{color:scope.row.mapping?scope.row.mapping.color.text:'#000',background:scope.row.mapping?scope.row.mapping.color.bac:'#fff'}" >{{ scope.row.value}}</div>
</template>
</el-table-column>
</el-table>
@@ -98,7 +98,7 @@
<el-table-column sortable prop="value" :label="$t('dashboard.panel.chartTableColumn.value')" min-width="90"
:resizable="false" :sort-orders="['ascending', 'descending']" :sortable="'custom'">
<template slot-scope="scope">
<div :style="{color:mapping?mapping.color.text:'#000',background:mapping?mapping.color.bac:'#fff',margin: '10px 0'}">{{ scope.row.value}}</div>
<div :style="{color:mapping?mapping.color.text:'#000',background:mapping?mapping.color.bac:'#fff'}">{{ scope.row.value}}</div>
</template>
</el-table-column>
</el-table>
@@ -334,26 +334,32 @@
clearChart() {
this.data = {};
},
duplicate() {
this.dropdownMenuShow = false;
const param = {id: this.data.id};
this.$post('panel/' + this.data.panelId + '/charts/duplicate', (param)).then(response => {
if (response.code === 200) {
this.$message({
duration: 2000,
type: 'success',
message: this.$t("tip.duplicateSuccess")
});
this.$emit('on-duplicate-chart-block', this.data.id, response.data);
} else {
if (response.msg) {
this.$message.error(response.msg);
} else if (response.error) {
this.$message.error(response.error);
} else {
this.$message.error(response);
duplicate(){
this.dropdownMenuShow=false;
this.$confirm(this.$t("tip.confirmDuplicate"), {
confirmButtonText: this.$t("tip.yes"),
cancelButtonText: this.$t("tip.no"),
type: 'info'
}).then(() => {
const param = {id:this.data.id};
this.$post('panel/'+ this.data.panelId+'/charts/duplicate',(param)).then(response => {
if (response.code === 200) {
this.$message({
duration: 2000,
type: 'success',
message: this.$t("tip.duplicateSuccess")
});
this.$emit('on-duplicate-chart-block', this.data.id,response.data);
}else {
if(response.msg){
this.$message.error(response.msg);
}else if(response.error){
this.$message.error(response.error);
}else {
this.$message.error(response);
}
}
}
});
});
},
// 全屏查看

View File

@@ -230,24 +230,30 @@ export default {
},
duplicate(){
this.dropdownMenuShow=false;
const param = {id:this.data.id};
this.$post('panel/'+ this.data.panelId+'/charts/duplicate',(param)).then(response => {
if (response.code === 200) {
this.$message({
duration: 2000,
type: 'success',
message: this.$t("tip.duplicateSuccess")
});
this.$emit('on-duplicate-chart-block', this.data.id,response.data);
}else {
if(response.msg){
this.$message.error(response.msg);
}else if(response.error){
this.$message.error(response.error);
this.$confirm(this.$t("tip.confirmDuplicate"), {
confirmButtonText: this.$t("tip.yes"),
cancelButtonText: this.$t("tip.no"),
type: 'info'
}).then(() => {
const param = {id:this.data.id};
this.$post('panel/'+ this.data.panelId+'/charts/duplicate',(param)).then(response => {
if (response.code === 200) {
this.$message({
duration: 2000,
type: 'success',
message: this.$t("tip.duplicateSuccess")
});
this.$emit('on-duplicate-chart-block', this.data.id,response.data);
}else {
this.$message.error(response);
if(response.msg){
this.$message.error(response.msg);
}else if(response.error){
this.$message.error(response.error);
}else {
this.$message.error(response);
}
}
}
});
});
},
setLoadFrameFull(){

View File

@@ -663,3 +663,7 @@
background-color: rgba(0,0,0,.1);
z-index: 100;
}*/
.chart-table .nz-table .el-table__row .costom-value .cell{
padding: 1px 0;
}

View File

@@ -3,7 +3,6 @@
* index:yAxis 默认第二个参数 y轴的位置
* type:自定义参数用于区分是y轴调用还是tooltip调用,以设置不同精度 type =1 y轴调用 type=2 tooltip调用
* */
import {parse} from "echarts/extension-src/dataTool/gexf";
import bus from "../../libs/bus"
function none(value, index){
@@ -680,14 +679,14 @@ export default {
if(type ==='Time'){
return value
}
if(type==='Data'){
if(value>1){
while(value>1024){
pow++;
value=value/1024
}
if(flow==='ceil'){
let length=JSON.stringify(Math.ceil(value)).length;
value=value/Math.pow(10,length-1);
@@ -701,14 +700,14 @@ export default {
return value
}
}
if(type==='Misc' || type==='DataRate'){
if(value>1){
while(value>1000){
pow++;
value=value/1000
}
if(flow==='ceil'){
let length=JSON.stringify(Math.ceil(value)).length;
value=value/Math.pow(10,length-1);
@@ -722,9 +721,9 @@ export default {
return value
}
}
return value;
},
copies:function(value){
switch(parseInt(value)){
@@ -747,7 +746,7 @@ export default {
}
return value?value:1;
}
if(value<1024&&type==='Data'){
let interVal=value/copies;
return interVal

View File

@@ -1311,24 +1311,30 @@
},
duplicate(){
this.dropdownMenuShow=false;
const param = {id:this.data.id};
this.$post('panel/'+ this.data.panelId+'/charts/duplicate',(param)).then(response => {
if (response.code === 200) {
this.$message({
duration: 2000,
type: 'success',
message: this.$t("tip.duplicateSuccess")
});
this.$emit('on-duplicate-chart-block', this.data.id, response.data);
}else {
if(response.msg){
this.$message.error(response.msg);
}else if(response.error){
this.$message.error(response.error);
this.$confirm(this.$t("tip.confirmDuplicate"), {
confirmButtonText: this.$t("tip.yes"),
cancelButtonText: this.$t("tip.no"),
type: 'info'
}).then(() => {
const param = {id:this.data.id};
this.$post('panel/'+ this.data.panelId+'/charts/duplicate',(param)).then(response => {
if (response.code === 200) {
this.$message({
duration: 2000,
type: 'success',
message: this.$t("tip.duplicateSuccess")
});
this.$emit('on-duplicate-chart-block', this.data.id,response.data);
}else {
this.$message.error(response);
if(response.msg){
this.$message.error(response.msg);
}else if(response.error){
this.$message.error(response.error);
}else {
this.$message.error(response);
}
}
}
});
});
},
dateChange(time) {

View File

@@ -170,24 +170,30 @@
},
duplicate(){
this.dropdownMenuShow=false;
const param = {id:this.data.id};
this.$post('panel/'+ this.data.panelId+'/charts/duplicate',(param)).then(response => {
if (response.code === 200) {
this.$message({
duration: 2000,
type: 'success',
message: this.$t("tip.duplicateSuccess")
});
this.$emit('on-duplicate-chart-block', this.data.id,response.data);
}else {
if(response.msg){
this.$message.error(response.msg);
}else if(response.error){
this.$message.error(response.error);
this.$confirm(this.$t("tip.confirmDuplicate"), {
confirmButtonText: this.$t("tip.yes"),
cancelButtonText: this.$t("tip.no"),
type: 'info'
}).then(() => {
const param = {id:this.data.id};
this.$post('panel/'+ this.data.panelId+'/charts/duplicate',(param)).then(response => {
if (response.code === 200) {
this.$message({
duration: 2000,
type: 'success',
message: this.$t("tip.duplicateSuccess")
});
this.$emit('on-duplicate-chart-block', this.data.id,response.data);
}else {
this.$message.error(response);
if(response.msg){
this.$message.error(response.msg);
}else if(response.error){
this.$message.error(response.error);
}else {
this.$message.error(response);
}
}
}
});
});
},
// 全屏查看

View File

@@ -403,6 +403,7 @@ const cn = {
syncTip:"此操作可能造成原有数据或图表被覆盖,确认同步吗?",
noImportFile:'没有可导入的文件',
noAccess: "无访问权限",
confirmDuplicate:"确认复制吗?"
},
asset: {
asset: "资产",

View File

@@ -407,6 +407,7 @@ const en = {
syncTip:'This operation may cause the original data or chart to be overwritten. Are you sure to synchronize?',
noImportFile:'No import file found',
noAccess: "No access",
confirmDuplicate:"Are you sure to duplicate this chart?"
},
asset:{
asset: 'Asset',

View File

@@ -25,9 +25,9 @@
<i v-if="lang != 'cn'" @click="changeLang('cn')" class="nz-icon nz-icon-lang-zh"></i>
</div>
</div>
<div class="login-foot-buildOn">
<span><a target="_blank" rel="noopener norefferrer" href='https://prometheus.io'>@build on prometheus</a></span>
</div>
</div>
<div class="login-foot-buildOn">
<span><a target="_blank" rel="noopener norefferrer" href='https://prometheus.io'>Build on Prometheus</a></span>
</div>
</div>
</template>
@@ -229,9 +229,9 @@ export default {
transform: translateX(-50%);
}
.login-foot-buildOn{
width: 460px;
text-align: center;
padding-top: 45px;
position: fixed;
bottom: 30px;
left: calc(50% - 90px);
a{
color: white;
text-decoration: none;