perf:project asset 二级页面统一定时刷新

This commit is contained in:
wangwenrui
2020-06-09 10:54:06 +08:00
parent f42e33e1b5
commit ed085bcfe5
3 changed files with 23 additions and 13 deletions

View File

@@ -176,6 +176,7 @@
'#f58220', '#c37e00', '#00ae9d', '#f26522', '#76becc', '#f58220', '#c37e00', '#00ae9d', '#f26522', '#76becc',
'#76624c', '#d71345', '#2468a2', '#ca8687', '#1b315e', '#76624c', '#d71345', '#2468a2', '#ca8687', '#1b315e',
], ],
stackTotalColor:null,
firstShow: false, // 默认不显示操作按钮, firstShow: false, // 默认不显示操作按钮,
caretShow:false, caretShow:false,
dropdownMenuShow:false, dropdownMenuShow:false,
@@ -515,9 +516,13 @@
str += `</div>`; str += `</div>`;
}); });
if(self.data.type==='stackArea' || self.isStackArea){ if(self.data.type==='stackArea' || self.isStackArea){
if(!self.stackTotalColor||self.stackTotalColor==''){
self.stackTotalColor=randomcolor();
}
sum = parseFloat(Number(sum).toFixed(2)); sum = parseFloat(Number(sum).toFixed(2));
str +=`<div style="white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis;display: flex; justify-content: space-between; min-width: 150px; max-width: 600px; line-height: 18px; font-size: 12px;">`; str +=`<div style="white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis;display: flex; justify-content: space-between; min-width: 150px; max-width: 600px; line-height: 18px; font-size: 12px;">`;
str +=`<div style="line-height: 18px; font-size: 12px;padding-left:20px;">` str +=`<div style="line-height: 18px; font-size: 12px;padding-left:0px;">`
str +=`<span style='display:inline-block;margin-right:5px;border-radius:10px;width:15px;height:5px;background-color: ${self.stackTotalColor};}'></span>`;
str +=self.$t("dashboard.panel.chartTotal"); str +=self.$t("dashboard.panel.chartTotal");
str +=`</div>`; str +=`</div>`;
str +=`<div style="padding-left: 10px;">`; str +=`<div style="padding-left: 10px;">`;

View File

@@ -22,7 +22,7 @@
<i slot="suffix" class="el-input__icon el-icon-search" @click="focusInput" style="float: right"></i> <i slot="suffix" class="el-input__icon el-icon-search" @click="focusInput" style="float: right"></i>
</el-input> </el-input>
</div> </div>
<div class="panel-calendar margin-r-20" v-if="from == 'asset'"> <!--<div class="panel-calendar margin-r-20" v-if="from == 'asset'">
<time-picker ref="calendarPanel" class="nz-dashboard-picker" @change="dateChange" style="height: 26px; margin-top: -1px;"></time-picker> <time-picker ref="calendarPanel" class="nz-dashboard-picker" @change="dateChange" style="height: 26px; margin-top: -1px;"></time-picker>
</div> </div>
<div class="nz-btn-group nz-btn-group-size-small nz-btn-group-light margin-r-20" style="height: 24px;" v-if="from == 'asset'"> <div class="nz-btn-group nz-btn-group-size-small nz-btn-group-light margin-r-20" style="height: 24px;" v-if="from == 'asset'">
@@ -42,7 +42,8 @@
<i style="font-size: 12px" class="nz-icon nz-icon-arrow-down"></i> <i style="font-size: 12px" class="nz-icon nz-icon-arrow-down"></i>
</button> </button>
</el-popover> </el-popover>
</div> </div>-->
<pick-time :refresh-data-func="dateChange" v-model="searchTime" :use-chart-unit="false" v-if="from=='asset'"></pick-time>
<button @click="toAddChart" :title="$t('overall.createChart')" v-if="from != 'alertRule'" <button @click="toAddChart" :title="$t('overall.createChart')" v-if="from != 'alertRule'"
class="nz-btn nz-btn-size-normal nz-btn-style-light "> class="nz-btn nz-btn-size-normal nz-btn-style-light ">
<i class="nz-icon-create-square nz-icon"></i> <i class="nz-icon-create-square nz-icon"></i>
@@ -64,7 +65,7 @@
</el-input> </el-input>
</div> </div>
<div class="panel-calendar margin-r-20"> <!--<div class="panel-calendar margin-r-20">
<div class="block"> <div class="block">
<time-picker ref="calendarPanel" class="nz-dashboard-picker" @change="dateChange"></time-picker> <time-picker ref="calendarPanel" class="nz-dashboard-picker" @change="dateChange"></time-picker>
</div> </div>
@@ -87,7 +88,8 @@
<i style="font-size: 12px" class="nz-icon nz-icon-arrow-down"></i> <i style="font-size: 12px" class="nz-icon nz-icon-arrow-down"></i>
</button> </button>
</el-popover> </el-popover>
</div> </div>-->
<pick-time :refresh-data-func="dateChange" v-model="searchTime" :use-chart-unit="false"></pick-time>
<button @click="toAddChart" :title="$t('overall.createChart')" <button @click="toAddChart" :title="$t('overall.createChart')"
class="nz-btn nz-btn-size-normal nz-btn-style-light "> class="nz-btn nz-btn-size-normal nz-btn-style-light ">
<i class="nz-icon-create-square nz-icon"></i> <i class="nz-icon-create-square nz-icon"></i>
@@ -314,7 +316,7 @@
/*时间条件查询--start*/ /*时间条件查询--start*/
// 选择日期变化 // 选择日期变化
dateChange(val) { dateChange(val) {
this.searchTime = [...val]; // this.searchTime = [...val];
this.filter.start_time = bus.timeFormate(this.searchTime[0], 'yyyy-MM-dd hh:mm:ss'); this.filter.start_time = bus.timeFormate(this.searchTime[0], 'yyyy-MM-dd hh:mm:ss');
this.filter.end_time = bus.timeFormate(this.searchTime[1], 'yyyy-MM-dd hh:mm:ss'); this.filter.end_time = bus.timeFormate(this.searchTime[1], 'yyyy-MM-dd hh:mm:ss');
this.filter.panelId = this.panelId; this.filter.panelId = this.panelId;

View File

@@ -58,13 +58,13 @@
</el-input> </el-input>
</div> </div>
<div class="panel-calendar margin-r-20"> <!--<div class="panel-calendar margin-r-20">
<div class="block"> <div class="block">
<time-picker ref="calendarPanel" class="nz-dashboard-picker" @change="dateChange"></time-picker> <time-picker ref="calendarPanel" class="nz-dashboard-picker" @change="dateChange"></time-picker>
</div> </div>
</div> </div>-->
<div class="nz-btn-group nz-btn-group-size-normal nz-btn-group-light margin-r-20"> <!--<div class="nz-btn-group nz-btn-group-size-normal nz-btn-group-light margin-r-20">
<button style="border-right: 1px solid rgba(162,162,162,0.50);" type="button" <button style="border-right: 1px solid rgba(162,162,162,0.50);" type="button"
class="nz-btn nz-btn-size-normal nz-btn-style-light" @click="Refresh()"> class="nz-btn nz-btn-size-normal nz-btn-style-light" @click="Refresh()">
<i style="font-size: 12px" class="global-active-color nz-icon nz-icon-refresh"></i> <i style="font-size: 12px" class="global-active-color nz-icon nz-icon-refresh"></i>
@@ -81,7 +81,8 @@
<i style="font-size: 12px" class="nz-icon nz-icon-arrow-down"></i> <i style="font-size: 12px" class="nz-icon nz-icon-arrow-down"></i>
</button> </button>
</el-popover> </el-popover>
</div> </div>-->
<pick-time :refresh-data-func="dateChange" v-model="searchTime" :use-chart-unit="false"></pick-time>
<button @click="toAddChart" :title="$t('overall.createChart')" <button @click="toAddChart" :title="$t('overall.createChart')"
class="nz-btn nz-btn-size-normal nz-btn-style-light "> class="nz-btn nz-btn-size-normal nz-btn-style-light ">
<i class="nz-icon-create-square nz-icon"></i> <i class="nz-icon-create-square nz-icon"></i>
@@ -112,6 +113,7 @@
import bus from '../../../libs/bus'; import bus from '../../../libs/bus';
import timePicker from '../../common/timePicker' import timePicker from '../../common/timePicker'
import draggable from 'vuedraggable' import draggable from 'vuedraggable'
import pickTime from "../../common/pickTime";
export default { export default {
name: "panel", name: "panel",
data() { data() {
@@ -205,6 +207,7 @@
'chart-list': ChartList, 'chart-list': ChartList,
'time-picker':timePicker, 'time-picker':timePicker,
draggable, draggable,
'pick-time':pickTime,
}, },
methods: { methods: {
//刷新 //刷新
@@ -379,9 +382,9 @@
/*时间条件查询--start*/ /*时间条件查询--start*/
// 选择日期变化 // 选择日期变化
dateChange(val) { dateChange(val) {
if(val){ // if(val){
this.searchTime = [...val]; // this.searchTime = [...val];
} // }
this.filter.start_time = bus.timeFormate(this.searchTime[0], 'yyyy-MM-dd hh:mm:ss'); this.filter.start_time = bus.timeFormate(this.searchTime[0], 'yyyy-MM-dd hh:mm:ss');
this.filter.end_time = bus.timeFormate(this.searchTime[1], 'yyyy-MM-dd hh:mm:ss'); this.filter.end_time = bus.timeFormate(this.searchTime[1], 'yyyy-MM-dd hh:mm:ss');
this.filter.panelId = this.showPanel.id; this.filter.panelId = this.showPanel.id;