Authored by 王涛

Merge branch 'master-500-dev-lushangqing' into 'master-500-dev'

系统信息加上默认图片,下拉列表数据获取



See merge request !74
... ... @@ -222,6 +222,65 @@ export const monitorSelectOption = {
],
],
data: [
{
type: 'el-radio-group',
label: '数据类型',
name: 'dataType',
require: false,
placeholder: '',
selectValue: true,
selectOptions: [
{
code: 'staticData',
name: '静态数据',
},
{
code: 'dynamicData',
name: '动态数据',
},
],
value: 'staticData',
},
{
type: 'el-switch',
label: '是否刷新',
name: 'isRefresh',
relactiveDom: 'dataType',
relactiveDomValue: 'dynamicData',
value: false
},
{
type: 'el-input-number',
label: '刷新时间(毫秒)',
name: 'refreshTime',
relactiveDom: 'dataType',
relactiveDomValue: 'dynamicData',
value: 30000
},
{
type: 'el-button',
label: '静态数据',
name: 'staticData',
required: false,
placeholder: '',
relactiveDom: 'dataType',
relactiveDomValue: 'staticData',
value: [{value:1,label:'选项1',disabled:false},{value:2,label:'选项3',disabled:true}],
},
{
type: 'dycustComponents',
label: '',
name: 'dynamicData',
required: false,
placeholder: '',
relactiveDom: 'dataType',
relactiveDomValue: 'dynamicData',
chartType: 'widget-table',
dictKey: 'TEXT_PROPERTIES', //表格的暂不起作用
value: '',
},
],
position: [
{
type: 'el-input-number',
... ...
... ... @@ -33,12 +33,6 @@ export default {
optionsSetUp: {},
optionsPosition:{},
optionsData:{},
//按钮组
btnGroup:[
{name:'月',code:'month',isDisplay:'true'},
{name:'季度',code:'quarter',isDisplay:'true'},
{name:'年',code:'year',isDisplay:'true'},
],
btnActive:'month',
dataTitle:''
}
... ... @@ -123,10 +117,9 @@ export default {
handler(val) {
this.options = val;
this.optionsSetUp = val.setup;
this.optionsData = val.data;
this.optionsPosition = val.position;
this.handlerData();
this.pushAll();
this.btnDisplay();
},
deep: true
... ... @@ -136,17 +129,17 @@ export default {
// this.initImageUrl();
this.options=this.value;
this.optionsSetUp = this.value.setup;
this.optionsData = this.value.data;
this.optionsPosition = this.value.position;
this.handlerData();
this.pushAll();
this.btnDisplay();
// this.selectChange(null)
},
methods: {
//选项是否加全部
pushAll(){
if(this.optionsSetUp.isAll){
this.selectOption.unshift({label:'全部',value:'all'})
this.selectOption.unshift({label:'全部',value:null})
}
},
//select的change事件
... ... @@ -158,56 +151,44 @@ export default {
this.$store.commit('SELECT_VAL_ARR', data);
},
//计算按钮是否显示
btnDisplay(){
this.btnGroup.map((item,index)=>{
if(item.code=='year'){
item.isDisplay=this.transStyle.isYear;
}else if(item.code=='quarter'){
item.isDisplay=this.transStyle.isQuarter;
}else{
item.isDisplay=this.transStyle.isMonth;
}
})
this.btnGroup.some((item, index) => {
if(item.isDisplay){
this.btnActive=item.code;
return true;//当内部return true时跳出整个循环
}
});
this.setBtnVal(this.btnActive);
},
changeType(item){
this.btnActive=item.code;
this.setBtnVal(item.code);
},
//传值-vuex-按钮值
setBtnVal(val){
this.$store.commit('CHANGE_BUTTON',val);
},
handlerData() {
const resData = this.optionsData;
resData.dataType == "staticData"
? this.handlerStaticData(resData.staticData)
: this.handlerDynamicData(resData.dynamicData, resData.refreshTime);
: this.handlerDynamicData(resData.dynamicData, resData.refreshTime,resData.isRefresh);
},
handlerStaticData(data) {
console.log("abcd",data)
this.selectOption=data;
// this.pushAll();
},
handlerDynamicData(data, refreshTime) {
handlerDynamicData(data, refreshTime,isRefresh) {
if (!data) return;
/* if (this.ispreview) {
if (this.ispreview && isRefresh) {
this.getEchartData(data);
this.flagInter = setInterval(() => {
this.getEchartData(data);
}, refreshTime);
} else {
this.getEchartData(data);
}*/
}
}
},
getEchartData(val) {
const data = this.queryEchartsData(val);
data.then(res => {
console.log("abc",res)
this.selectOption=res;
this.pushAll();
this.hackResetFun();
});
},
// vue hack 之强制刷新组件
hackResetFun() {
this.hackReset = false;
this.$nextTick(() => {
this.hackReset = true;
});
},
},
... ...
... ... @@ -11,7 +11,7 @@
<div class="system-item" :style="itemStyle" v-for="(item,index) in systemData" :key="index">
<div class="system-img">
<!-- <img :src="'/src/assets/images/monitor/capacityAnalysis/'+item.resType+'.png'" alt="">-->
<img :src="'/static/capacityAnalysis/'+item.resType+'.png'" alt="">
<img :src="'/static/capacityAnalysis/'+(item.resType?item.resType:'VIRTUALIZATION_VMWARE')+'.png'" alt="">
</div>
<div class="system-info" :style="titleProposalStyle">
... ...