|
|
@ -1,5 +1,6 @@
|
|
|
|
import miment from 'miment'
|
|
|
|
import miment from 'miment'
|
|
|
|
import {getData} from '@/api/bigscreen'
|
|
|
|
import {getData} from '@/api/bigscreen'
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
@ -10,7 +11,7 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//日期时间快捷选项
|
|
|
|
//日期时间快捷选项
|
|
|
|
datetimeRangePickerOptions:{
|
|
|
|
datetimeRangePickerOptions: {
|
|
|
|
shortcuts: [{
|
|
|
|
shortcuts: [{
|
|
|
|
text: '今天',
|
|
|
|
text: '今天',
|
|
|
|
onClick(picker) {
|
|
|
|
onClick(picker) {
|
|
|
@ -18,14 +19,14 @@ export default {
|
|
|
|
const start = new Date(new Date(new Date().getTime()).setHours(0, 0, 0, 0));
|
|
|
|
const start = new Date(new Date(new Date().getTime()).setHours(0, 0, 0, 0));
|
|
|
|
picker.$emit('pick', [start, end]);
|
|
|
|
picker.$emit('pick', [start, end]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},{
|
|
|
|
}, {
|
|
|
|
text: '昨天',
|
|
|
|
text: '昨天',
|
|
|
|
onClick(picker) {
|
|
|
|
onClick(picker) {
|
|
|
|
const start=new Date(new Date(new Date().getTime()-24*60*60*1000).setHours(0, 0, 0, 0));
|
|
|
|
const start = new Date(new Date(new Date().getTime() - 24 * 60 * 60 * 1000).setHours(0, 0, 0, 0));
|
|
|
|
const end=new Date(new Date(new Date().getTime()-24*60*60*1000).setHours(23, 59, 59, 999));
|
|
|
|
const end = new Date(new Date(new Date().getTime() - 24 * 60 * 60 * 1000).setHours(23, 59, 59, 999));
|
|
|
|
picker.$emit('pick', [start, end]);
|
|
|
|
picker.$emit('pick', [start, end]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},{
|
|
|
|
}, {
|
|
|
|
text: '最近一周',
|
|
|
|
text: '最近一周',
|
|
|
|
onClick(picker) {
|
|
|
|
onClick(picker) {
|
|
|
|
const end = new Date();
|
|
|
|
const end = new Date();
|
|
|
@ -51,13 +52,12 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}],
|
|
|
|
}],
|
|
|
|
// disabledDate(time){
|
|
|
|
// disabledDate(time){
|
|
|
|
// return time.getTime() > Date.now()
|
|
|
|
// return time.getTime() > Date.now()
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
computed: {},
|
|
|
|
},
|
|
|
|
|
|
|
|
created() {
|
|
|
|
created() {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
mounted() {
|
|
|
@ -66,8 +66,8 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
// 搜索重置搜索页码
|
|
|
|
// 搜索重置搜索页码
|
|
|
|
search(){
|
|
|
|
search() {
|
|
|
|
this.params.currentPage=1;
|
|
|
|
this.params.currentPage = 1;
|
|
|
|
this.queryByPage();
|
|
|
|
this.queryByPage();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 把selectInput中的值赋到params查询对象中
|
|
|
|
// 把selectInput中的值赋到params查询对象中
|
|
|
@ -80,7 +80,7 @@ export default {
|
|
|
|
// console.warn('params has no field:' + keyname)
|
|
|
|
// console.warn('params has no field:' + keyname)
|
|
|
|
// return
|
|
|
|
// return
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
if (keyword !== undefined ) {
|
|
|
|
if (keyword !== undefined) {
|
|
|
|
this.params[keyname] = keyword.trim()
|
|
|
|
this.params[keyname] = keyword.trim()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -90,22 +90,24 @@ export default {
|
|
|
|
data[k] = null
|
|
|
|
data[k] = null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
handlerInputchange(val){
|
|
|
|
handlerInputchange(val) {
|
|
|
|
this.parseParamsBySelectInput(this.selectInput.keyname, val)
|
|
|
|
this.parseParamsBySelectInput(this.selectInput.keyname, val)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 查询echarts 数据
|
|
|
|
// 查询echarts 数据
|
|
|
|
queryEchartsData(params) {
|
|
|
|
queryEchartsData(params) {
|
|
|
|
return new Promise(async(resolve) => {
|
|
|
|
return new Promise(async (resolve) => {
|
|
|
|
const { code, data } = await getData(params);
|
|
|
|
const {code, data} = await getData(params);
|
|
|
|
if(code != 200) return
|
|
|
|
if (code != 200) return
|
|
|
|
const analysisData = this.analysisChartsData(params, data);
|
|
|
|
const analysisData = this.analysisChartsData(params, data);
|
|
|
|
resolve(analysisData)
|
|
|
|
resolve(analysisData)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 解析不同图标的数据
|
|
|
|
// 解析不同图标的数据
|
|
|
|
analysisChartsData(params, data) {
|
|
|
|
analysisChartsData(params, data) {
|
|
|
|
// widget-barchart 柱线图、widget-linechart 折线图、 widget-barlinechart 柱线图、widget-piechart 饼图、widget-hollow-piechart 空心饼图
|
|
|
|
// widget-barchart 柱线图、widget-linechart 折线图、 widget-barlinechart 柱线图
|
|
|
|
// widget-funnel 漏斗图 widget-gauge 仪表盘
|
|
|
|
// widget-piechart 饼图、widget-hollow-piechart 空心饼图、widget-funnel 漏斗图
|
|
|
|
|
|
|
|
// widget-gauge 仪表盘
|
|
|
|
|
|
|
|
// widget-text 文本框
|
|
|
|
const chartType = params.chartType
|
|
|
|
const chartType = params.chartType
|
|
|
|
if (
|
|
|
|
if (
|
|
|
|
chartType == "widget-barchart" ||
|
|
|
|
chartType == "widget-barchart" ||
|
|
|
@ -121,7 +123,10 @@ export default {
|
|
|
|
return this.piechartFn(params.chartProperties, data);
|
|
|
|
return this.piechartFn(params.chartProperties, data);
|
|
|
|
} else if (chartType == "widget-gauge") {
|
|
|
|
} else if (chartType == "widget-gauge") {
|
|
|
|
return this.gaugeFn(params.chartProperties, data);
|
|
|
|
return this.gaugeFn(params.chartProperties, data);
|
|
|
|
|
|
|
|
} else if (chartType == "widget-text") {
|
|
|
|
|
|
|
|
return this.text(params.chartProperties, data)
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 柱状图、折线图、折柱图
|
|
|
|
// 柱状图、折线图、折柱图
|
|
|
@ -192,6 +197,23 @@ export default {
|
|
|
|
return ananysicData[0];
|
|
|
|
return ananysicData[0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
text(chartProperties, data) {
|
|
|
|
|
|
|
|
debugger
|
|
|
|
|
|
|
|
const ananysicData = [];
|
|
|
|
|
|
|
|
for (let i = 0; i < data.length; i++) {
|
|
|
|
|
|
|
|
const obj = {};
|
|
|
|
|
|
|
|
for (const key in chartProperties) {
|
|
|
|
|
|
|
|
const value = chartProperties[key];
|
|
|
|
|
|
|
|
if (value === "name") {
|
|
|
|
|
|
|
|
//obj["name"] = data[i][key];
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
obj["value"] = data[i][key];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ananysicData.push(obj);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return ananysicData;
|
|
|
|
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
watch: {
|
|
|
|
'selectInput.keyname'(newVal, oldVal) {
|
|
|
|
'selectInput.keyname'(newVal, oldVal) {
|
|
|
|
this.resetForm(this.params)
|
|
|
|
this.resetForm(this.params)
|
|
|
@ -200,7 +222,7 @@ export default {
|
|
|
|
this.parseParamsBySelectInput(newVal, this.selectInput.keyword)
|
|
|
|
this.parseParamsBySelectInput(newVal, this.selectInput.keyword)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'selectInput.keyword'(newVal, oldVal) {
|
|
|
|
'selectInput.keyword'(newVal, oldVal) {
|
|
|
|
if (!this.selectInput.keyname) return
|
|
|
|
if (!this.selectInput.keyname) return
|
|
|
|
this.parseParamsBySelectInput(this.selectInput.keyname, newVal)
|
|
|
|
this.parseParamsBySelectInput(this.selectInput.keyname, newVal)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 'selectInput.keyword'(newVal, oldVal) {
|
|
|
|
// 'selectInput.keyword'(newVal, oldVal) {
|
|
|
|