Commit 66735bd1 authored by 李翠鸿's avatar 李翠鸿

第二轮测试

parent 7c625929
...@@ -23,9 +23,10 @@ ...@@ -23,9 +23,10 @@
/*每个页面公共css */ /*每个页面公共css */
page { page {
background-color: #f2f2f2; background-color: #f2f2f2;
font-family: PingFang TC; font-family: 'PingFang TC';
/* padding:0 24rpx; */ /* padding:0 24rpx; */
} }
// .uni-tabbar{ // .uni-tabbar{
// box-shadow: 0px -8px 8px 0px rgba(220, 220, 220, 0.24); // box-shadow: 0px -8px 8px 0px rgba(220, 220, 220, 0.24);
......
...@@ -21,4 +21,66 @@ ...@@ -21,4 +21,66 @@
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
\ No newline at end of file
@font-face {
font-family: "KaiTi";
src: url("fonts/KaiTi.ttf");
// font-weight: bold;
}
@font-face {
font-family: "PingFangSC";
src: url("fonts/PingFangMedium.ttf");
// font-weight: bold;
}
@font-face {
font-family: "SourceHanSansCN";
src: url("fonts/SourceHanSansCN-Medium.otf");
// font-weight: bold;
}
@font-face {
font-family:"FangSong";
src: url("fonts/FangSong.TTF");
// font-weight: bold;
}
@font-face {
font-family: "YouYuan";
src: url("fonts/YouYuan.TTF");
// font-weight: bold;
}
@font-face {
font-family: "FZShuTi";
src: url("fonts/FZShuTi.TTF");
// font-weight: bold;
}
@font-face {
font-family: "LiSu";
src: url("fonts/LiSu.TTF");
// font-weight: bold;
}
@font-face {
font-family: "FZYaoti";
src: url("fonts/FZYaoti.ttf");
// font-weight: bold;
}
@font-face {
font-family: "SimHei";
src: url("fonts/SimHei.TTF");
// font-weight: bold;
}
@font-face {
font-family: "Microsoft YaHei";
src: url("fonts/MicrosoftYaHei.ttf");
// font-weight: bold;
}
@font-face {
font-family: "SimSun";
src: url("fonts/SimSun.TTF");
// font-weight: bold;
}
...@@ -32,3 +32,34 @@ export const historyApiData = (startTime,date,variables,level,skipTime) => { ...@@ -32,3 +32,34 @@ export const historyApiData = (startTime,date,variables,level,skipTime) => {
} }
return getData return getData
} }
//统计数据源 startTime-开始时间,date-结束时间,variables-变量集合,level-时间层级,skipTime-是否分层,timeSetting-时间表类型
export const statisticApiData = (startTime,date,variables,level,skipTime,timeSetting) => {
let getData = {
"filterControls": [{
"value1": startTime,
"controlType": "AssociateDateTimePicker",
"pickerType": "BeginTime",
"name": "a1"
},
{
"value1": date,
"controlType": "AssociateDateTimePicker",
"pickerType": "EndTime",
"name": "a2"
}
],
"variables": variables,
"layoutSettings": level,
"skipTime":skipTime,
"sourceType": "Statistic",
"statisticsSettings": {
"shiftName": "AAA",
"valueMethod": "Origin",
"xAxisSetting": "Time",
"timeSetting":timeSetting,
"shiftsType": "All"
}
}
return getData
}
//8位hex颜色转rgba //8位hex颜色转rgba
export const getRgbaFun = (sHex,a) => { export const getRgbaFun = (sHex, a) => {
// 十六进制颜色值的正则表达式 // 十六进制颜色值的正则表达式
var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/ var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/
/* 16进制颜色转为RGB格式 */ /* 16进制颜色转为RGB格式 */
...@@ -63,6 +63,17 @@ export const colorRgba = (sHex, a) => { ...@@ -63,6 +63,17 @@ export const colorRgba = (sHex, a) => {
} }
} }
//判断字符串是否是数字
export const isNumber = (val) => {
var regPos = /^\d+(\.\d+)?$/; //非负浮点数
var regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //负浮点数
if (regPos.test(val) || regNeg.test(val)) {
return true;
} else {
return false;
}
}
export const unique = (arr) => { export const unique = (arr) => {
var newArr = []; var newArr = [];
for (var i = 0; i < arr.length; i++) { for (var i = 0; i < arr.length; i++) {
...@@ -197,7 +208,7 @@ export const getTimeType = (str) => { ...@@ -197,7 +208,7 @@ export const getTimeType = (str) => {
type = 'Quarter' type = 'Quarter'
} else if (str == '年') { } else if (str == '年') {
type = 'Year' type = 'Year'
}else if(str == '最新'){ } else if (str == '最新') {
type = 'Second' type = 'Second'
} }
return type return type
...@@ -264,9 +275,13 @@ export const heavyCount = (list) => { ...@@ -264,9 +275,13 @@ export const heavyCount = (list) => {
return list2 return list2
} }
export const getBoxShadow = (boxShadow) => { export const getBoxShadow = (boxShadow,location) => {
let str = boxShadow.horizontal + ' ' + boxShadow.vertical + ' ' + boxShadow.size + ' ' + boxShadow.color + ' ' + let str = boxShadow.horizontal + ' ' + boxShadow.vertical + ' ' + boxShadow.size + ' ' + boxShadow.color
boxShadow.location if(location){
str = str + ' ' + location
}else{
str += boxShadow.location?' '+boxShadow.location:''
}
return str return str
} }
......
...@@ -6,6 +6,7 @@ import interceptor from './js/interceptor.js' ...@@ -6,6 +6,7 @@ import interceptor from './js/interceptor.js'
import api from './request/api.js' import api from './request/api.js'
import uView from "uview-ui" import uView from "uview-ui"
import MyTooltip from './pages/common/tooltip.vue' import MyTooltip from './pages/common/tooltip.vue'
import TipsPage from './pages/common/tips-page.vue'
// import VConsole from 'vconsole' // import VConsole from 'vconsole'
// const vConsole = new VConsole() // const vConsole = new VConsole()
...@@ -18,6 +19,7 @@ Vue.prototype.$toast = $ ...@@ -18,6 +19,7 @@ Vue.prototype.$toast = $
App.mpType = 'app' App.mpType = 'app'
Vue.component("my-tooltip", MyTooltip); Vue.component("my-tooltip", MyTooltip);
Vue.component("tips-page", TipsPage);
const app = new Vue({ const app = new Vue({
...App, ...App,
......
...@@ -940,7 +940,7 @@ ...@@ -940,7 +940,7 @@
var Runsymbol var Runsymbol
var ArrValue var ArrValue
var resValueNumber = data[j].Value var resValueNumber = data[j].Value
resValue = data[j].Value.toLowerCase() resValue = data[j].Value
ArrValue = TextAnimation.Compare == null ? ArrValue = TextAnimation.Compare == null ?
TextAnimation.Compare : TextAnimation.Compare.toLowerCase() TextAnimation.Compare : TextAnimation.Compare.toLowerCase()
Runsymbol = TextAnimation.Condition Runsymbol = TextAnimation.Condition
...@@ -1541,7 +1541,7 @@ ...@@ -1541,7 +1541,7 @@
var Runsymbol var Runsymbol
var ArrValue var ArrValue
var resValueNumber = Value var resValueNumber = Value
resValue = Value.toLowerCase() resValue = Value
ArrValue = textColorListArr.Compare == null ? textColorListArr.Compare : textColorListArr.Compare ArrValue = textColorListArr.Compare == null ? textColorListArr.Compare : textColorListArr.Compare
.toLowerCase() .toLowerCase()
Runsymbol = textColorListArr.Condition Runsymbol = textColorListArr.Condition
......
...@@ -630,12 +630,16 @@ ...@@ -630,12 +630,16 @@
var wantnum; var wantnum;
var end = {}; var end = {};
setTimeout(() => { setTimeout(() => {
// console.log(this.cavantable)
for (let i = 0; i < this.cavantable.length; i++) { for (let i = 0; i < this.cavantable.length; i++) {
this.page[i] = { this.page[i] = {
pageIndex: 0, pageIndex: 0,
pageNum: [1] pageNum: [1]
} }
var z = 0; var z = 0;
if(!this.cavantable[i].ParameterReportItemtList) break
if(!this.cavantable[i].ParameterReportItemtList.dd) break
if (parseInt(this.cavantable[i].ParameterReportItemtList.dd.startpoy)) { if (parseInt(this.cavantable[i].ParameterReportItemtList.dd.startpoy)) {
z = parseInt(this.cavantable[i].ParameterReportItemtList.dd.startpoy) z = parseInt(this.cavantable[i].ParameterReportItemtList.dd.startpoy)
} else { } else {
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
styleConfig.margin = arrayToString(styleConfig.margin) styleConfig.margin = arrayToString(styleConfig.margin)
styleConfig.padding = arrayToString(styleConfig.padding) styleConfig.padding = arrayToString(styleConfig.padding)
styleConfig.borderRadius = arrayToString(styleConfig.borderRadius) styleConfig.borderRadius = arrayToString(styleConfig.borderRadius)
styleConfig.boxShadow = getBoxShadow(styleConfig.boxShadow) // styleConfig.boxShadow = getBoxShadow(styleConfig.boxShadow)
let componentConfig = item.componentConfig let componentConfig = item.componentConfig
item.layout = item.componentConfig.layout item.layout = item.componentConfig.layout
this.styleConfigList.push(styleConfig) this.styleConfigList.push(styleConfig)
......
...@@ -7,8 +7,10 @@ ...@@ -7,8 +7,10 @@
:style="';width:'+(100/Number(layout.column))+'%'"> :style="';width:'+(100/Number(layout.column))+'%'">
<view @click="jumpView(item1,index1)" <view @click="jumpView(item1,index1)"
:style="'background:'+item1.color+';min-height: 30px;margin:6px;text-align: center;border-radius: 4px;'" :style="'background:'+item1.color+';min-height: 30px;margin:6px;text-align: center;border-radius: 4px;'"
style="display: flex;justify-content: center;align-items: center;line-height: 20px;padding: 5px;"> style="display: flex;justify-content: center;align-items: center;line-height: 20px;padding: 5px;height: calc(100% - 22px)">
<view>{{item1.title}}</view> <view style="height: 100%;display: flex;justify-content: center;align-items: center;">
<view> {{item1.title}}</view>
</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -56,10 +58,12 @@ ...@@ -56,10 +58,12 @@
styleConfig.margin = arrayToString(styleConfig.margin) styleConfig.margin = arrayToString(styleConfig.margin)
styleConfig.padding = arrayToString(styleConfig.padding) styleConfig.padding = arrayToString(styleConfig.padding)
styleConfig.borderRadius = arrayToString(styleConfig.borderRadius) styleConfig.borderRadius = arrayToString(styleConfig.borderRadius)
styleConfig.boxShadow = getBoxShadow(styleConfig.boxShadow) // styleConfig.boxShadow = getBoxShadow(styleConfig.boxShadow)
let componentConfig = item.componentConfig let componentConfig = item.componentConfig
this.layout = componentConfig.layout this.layout = componentConfig.layout
this.cardListData = componentConfig.list // this.cardListData = componentConfig.list
this.cardListData = JSON.parse(JSON.stringify(componentConfig.list))
this.getTextHeightFun() //获取列表高度
item.layout = item.componentConfig.layout item.layout = item.componentConfig.layout
this.styleConfigList.push(styleConfig) this.styleConfigList.push(styleConfig)
this.componentList.push(item) this.componentList.push(item)
...@@ -67,12 +71,26 @@ ...@@ -67,12 +71,26 @@
//跳转页面 //跳转页面
jumpView(item, index) { jumpView(item, index) {
this.$emit('jump-view', item) this.$emit('jump-view', item)
console.log(item) console.log(item)
// this.$parent.test() // this.$parent.test()
uni.navigateTo({ uni.navigateTo({
url: '/pages/data/jump-view/index?viewName=' + item.pageName + '&viewId=' + item.pageId url: '/pages/data/jump-view/index?viewName=' + item.pageName + '&viewId=' + item.pageId
}); });
// console.log(JSON.stringify(item.pageId)) // console.log(JSON.stringify(item.pageId))
},
getTextHeightFun() {
let cardListData = this.cardListData
let _this = this
// async cardListData.forEach((item,index1) => {
// this.$nextTick(function(){
// await uni.createSelectorQuery().in(this).select('.cardListText'+_this.index+'-'+index1).boundingClientRect((data) => {
// console.log(data)
// }) .exec();
// })
// })
}, },
getHistoryExternalData() {} getHistoryExternalData() {}
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
styleConfig.padding = arrayToString(styleConfig.padding) styleConfig.padding = arrayToString(styleConfig.padding)
styleConfig.borderRadius = arrayToString(styleConfig.borderRadius) styleConfig.borderRadius = arrayToString(styleConfig.borderRadius)
// let boxShadow = styleConfig.boxShadow // let boxShadow = styleConfig.boxShadow
styleConfig.boxShadow = getBoxShadow(styleConfig.boxShadow) // styleConfig.boxShadow = getBoxShadow(styleConfig.boxShadow)
let componentConfig = this.componentsData.componentConfig let componentConfig = this.componentsData.componentConfig
this.imgName = componentConfig.imgName this.imgName = componentConfig.imgName
this.styleConfigList.push(styleConfig) this.styleConfigList.push(styleConfig)
......
...@@ -26,7 +26,8 @@ ...@@ -26,7 +26,8 @@
<view :style="componentsData.componentConfig.numericalFormat" style="margin-bottom: 8px;"> <view :style="componentsData.componentConfig.numericalFormat" style="margin-bottom: 8px;">
<text>{{item1.value != null?item1.value:'--'}}</text> <text>{{item1.value != null?item1.value:'--'}}</text>
</view> </view>
<view :style="componentsData.componentConfig.nameFormat" v-if="theme !== 'theme6'" class="text-style33"> <view :style="componentsData.componentConfig.nameFormat" v-if="theme !== 'theme6'"
class="text-style33">
<text>{{item1.name}}</text> <text>{{item1.name}}</text>
</view> </view>
</view> </view>
...@@ -55,7 +56,8 @@ ...@@ -55,7 +56,8 @@
getBoxShadow getBoxShadow
} from '../../js/tool.js' } from '../../js/tool.js'
import { import {
historyApiData historyApiData,
statisticApiData
} from '../../js/data.js' } from '../../js/data.js'
export default { export default {
name: 'Kpi', name: 'Kpi',
...@@ -120,7 +122,7 @@ ...@@ -120,7 +122,7 @@
styleConfig.margin = arrayToString(styleConfig.margin) styleConfig.margin = arrayToString(styleConfig.margin)
styleConfig.padding = arrayToString(styleConfig.padding) styleConfig.padding = arrayToString(styleConfig.padding)
styleConfig.borderRadius = arrayToString(styleConfig.borderRadius) styleConfig.borderRadius = arrayToString(styleConfig.borderRadius)
styleConfig.boxShadow = getBoxShadow(styleConfig.boxShadow) // styleConfig.boxShadow = getBoxShadow(styleConfig.boxShadow)
this.numerical = this.componentsData.componentConfig.numerical this.numerical = this.componentsData.componentConfig.numerical
let componentConfig = item.componentConfig let componentConfig = item.componentConfig
componentConfig.nameFormat.textAlign = componentConfig.nameFormat.alignHorizontal componentConfig.nameFormat.textAlign = componentConfig.nameFormat.alignHorizontal
...@@ -160,10 +162,11 @@ ...@@ -160,10 +162,11 @@
//历史、统计、外部 //历史、统计、外部
async getHistoryExternalData() { async getHistoryExternalData() {
if (!this.componentConfig) return if (!this.componentConfig) return
if(this.variables.length <= 0) return //无选择变量不请求 if (this.variables.length <= 0) return //无选择变量不请求
let dataset = this.componentConfig.dataset let dataset = this.componentConfig.dataset
// let variables = [] // let variables = []
let getData = null let getData = null
let getData1 = null
if (dataset.dataType === this.$store.state.dataType[1]) { //历史数据 if (dataset.dataType === this.$store.state.dataType[1]) { //历史数据
let filterConfig = this.componentsData.filterConfig let filterConfig = this.componentsData.filterConfig
// let listData = filterConfig.list[0] // let listData = filterConfig.list[0]
...@@ -177,8 +180,8 @@ ...@@ -177,8 +180,8 @@
let timeType = getTimeType(content.substr(content.indexOf(",") + 1)) let timeType = getTimeType(content.substr(content.indexOf(",") + 1))
let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date()) let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date())
let date1 = dateFtt("yyyy-MM-dd hh:mm:ss", new Date()) let date1 = dateFtt("yyyy-MM-dd hh:mm:ss", new Date())
if(timeType != 'Hour' && timeType != 'Second'){ if (timeType != 'Hour' && timeType != 'Second') {
date1 = dateFtt("yyyy-MM-dd", new Date())+' 00:00:00' date1 = dateFtt("yyyy-MM-dd", new Date()) + ' 00:00:00'
} }
let startTime = date let startTime = date
await this.$api.getStartTime(date1, recent, timeType).then(res => { await this.$api.getStartTime(date1, recent, timeType).then(res => {
...@@ -186,53 +189,20 @@ ...@@ -186,53 +189,20 @@
}).catch(err => { }).catch(err => {
console.log(err) console.log(err)
}) })
if(content.substr(content.indexOf(",") + 1) == '最新'){ if (content.substr(content.indexOf(",") + 1) == '最新') {
console.log(content.substr(content.indexOf(",") + 1)) // console.log(content.substr(content.indexOf(",") + 1))
getData = { getData1 = {
"variables": this.variables, "variables": this.variables,
"sourceType": "Realy", "sourceType": "History",
// "layoutSettings":true,
"skipTime":true,
"relaySettings": {
"timeType": "Now",
"valueMethod": "Origin",
"xAxisSetting": "Variable",
}
} }
}else{ } else {
//历史请求参数 //历史请求参数
getData = historyApiData(startTime,date,this.variables,'Second',true) getData = historyApiData(startTime, date, this.variables, 'Second', true)
// getData = {
// "filterControls": [{
// "value1": startTime,
// "controlType": "AssociateDateTimePicker",
// "pickerType": "BeginTime",
// "name": "a1"
// },
// {
// "value1": date,
// "controlType": "AssociateDateTimePicker",
// "pickerType": "EndTime",
// "name": "a2"
// }
// ],
// "variables": this.variables,
// "sourceType": "History",
// "layoutSettings": 'Second',
// "skipTime": true,
// "historySettings": {
// "timeType": "Recent",
// "valueMethod": "Origin",
// "xAxisSetting": "Time",
// // "recent": timeType.recent,
// // "timeSetting": timeType.timeSetting
// }
// }
} }
} else if (dataset.dataType === this.$store.state.dataType[2]) { //统计数据 } else if (dataset.dataType === this.$store.state.dataType[2]) { //统计数据
let filterConfig = this.componentsData.filterConfig let filterConfig = this.componentsData.filterConfig
...@@ -247,8 +217,8 @@ ...@@ -247,8 +217,8 @@
let timeType = getTimeType(content1.substr(content1.indexOf(",") + 1)) let timeType = getTimeType(content1.substr(content1.indexOf(",") + 1))
let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date()) let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date())
let date1 = dateFtt("yyyy-MM-dd hh:mm:ss", new Date()) let date1 = dateFtt("yyyy-MM-dd hh:mm:ss", new Date())
if(timeType != 'Hour' && timeType != 'Second'){ if (timeType != 'Hour' && timeType != 'Second') {
date1 = dateFtt("yyyy-MM-dd", new Date())+' 00:00:00' date1 = dateFtt("yyyy-MM-dd", new Date()) + ' 00:00:00'
} }
let startTime = date let startTime = date
await this.$api.getStartTime(date1, recent, timeType).then(res => { await this.$api.getStartTime(date1, recent, timeType).then(res => {
...@@ -256,31 +226,44 @@ ...@@ -256,31 +226,44 @@
}).catch(err => { }).catch(err => {
console.log(err) console.log(err)
}) })
getData = {
"filterControls": [{ if (content1.substr(content1.indexOf(",") + 1) == '最新') {
"value1": startTime, getData1 = {
"controlType": "AssociateDateTimePicker", "variables": this.variables,
"pickerType": "BeginTime", "sourceType": "Statistic",
"name": "a1" "statisticsSettings": {
}, "timeSetting": "Hour",
{
"value1": date,
"controlType": "AssociateDateTimePicker",
"pickerType": "EndTime",
"name": "a2"
} }
],
"variables": this.variables,
"layoutSettings": "Second",
"skipTime": true,
"sourceType": "Statistic",
"statisticsSettings": {
"shiftName": "AAA",
"valueMethod": "Origin",
"xAxisSetting": "Time",
"timeSetting":"Hour",
"shiftsType": "All"
} }
} else {
getData = statisticApiData(startTime, date, this.variables, 'Second', true, 'Hour')
// getData = {
// "filterControls": [{
// "value1": startTime,
// "controlType": "AssociateDateTimePicker",
// "pickerType": "BeginTime",
// "name": "a1"
// },
// {
// "value1": date,
// "controlType": "AssociateDateTimePicker",
// "pickerType": "EndTime",
// "name": "a2"
// }
// ],
// "variables": this.variables,
// "layoutSettings": "Second",
// "skipTime": true,
// "sourceType": "Statistic",
// "statisticsSettings": {
// "shiftName": "AAA",
// "valueMethod": "Origin",
// "xAxisSetting": "Time",
// "timeSetting":"Hour",
// "shiftsType": "All"
// }
// }
} }
} else if (dataset.dataType === this.$store.state.dataType[3]) { //外部数据 } else if (dataset.dataType === this.$store.state.dataType[3]) { //外部数据
...@@ -289,15 +272,21 @@ ...@@ -289,15 +272,21 @@
if (this.tabContent) { if (this.tabContent) {
contentList = this.tabContent contentList = this.tabContent
} }
let newDataType = 0
let newDataValue = null
// console.log(this.tabContent) // console.log(this.tabContent)
let filterControls = [] //过滤控件组合 let filterControls = [] //过滤控件组合
let filterItems = [] let filterItems = []
for (let i = 0; i < contentList.length; i++) { for (let i = 0; i < contentList.length; i++) {
let item = contentList[i] let item = contentList[i]
let content = item.content let content = item.content
if (item.type == '时间日期') { if (item.type == '时间日期' && item.variable != '') {
let recent = Number(content.substr(0, content.indexOf(","))) let recent = Number(content.substr(0, content.indexOf(",")))
let timeType = getTimeType(content.substr(content.indexOf(",") + 1)) let timeType = getTimeType(content.substr(content.indexOf(",") + 1))
if (content.substr(content.indexOf(",") + 1) == '最新') {
newDataType += 1
newDataValue = item
}
let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date()) let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date())
let startTime = date let startTime = date
await this.$api.getStartTime(date, recent, timeType).then(res => { await this.$api.getStartTime(date, recent, timeType).then(res => {
...@@ -310,7 +299,6 @@ ...@@ -310,7 +299,6 @@
"controlType": 'AssociateDateTimePicker', "controlType": 'AssociateDateTimePicker',
"pickerType": "BeginTime", "pickerType": "BeginTime",
"value1": startTime, "value1": startTime,
} }
let filterData2 = { let filterData2 = {
"name": item.variable + '2_' + i, "name": item.variable + '2_' + i,
...@@ -358,55 +346,107 @@ ...@@ -358,55 +346,107 @@
} }
let dataSetId = dataset.externalDataId let dataSetId = dataset.externalDataId
getData = { // console.log(newDataType)
"filterControls": filterControls, // JSON.stringify()
"variables": this.variables, if (newDataType > 0) {
"layoutSettings": "Second", let variables = JSON.parse(JSON.stringify(this.variables))
"skipTime": true, variables.push({
"sourceType": "External", "name": newDataValue.variable,
"externalSettings": { "layoutSettings": "Day"
"valueMethod": "Sum", })
"dataSetId": dataSetId, getData1 = {
"xAxisFields": [""], "variables": variables,
"filterItems": filterItems "sourceType": "External",
"externalSettings": {
"dataSetId": dataSetId
}
}
} else {
getData = {
"filterControls": filterControls,
"variables": this.variables,
"layoutSettings": "Second",
"skipTime": false,
"sourceType": "External",
"externalSettings": {
"valueMethod": "Sum",
"dataSetId": dataSetId,
"xAxisFields": [""],
"filterItems": filterItems
}
} }
} }
}
if (getData) {
this.$api.getQueryMulitySource(getData).then(res => {
let data = res.data
if (!data || !Object.keys(data).length) return
if (dataset.dataType === this.$store.state.dataType[1]) {
this.calculateHistoryData(data)
} else if (dataset.dataType === this.$store.state.dataType[2]) {
this.calculateStatisticData(data)
} else if (dataset.dataType === this.$store.state.dataType[3]) {
this.calculateExternalData(data)
}
}).catch(err => {})
}
if (getData1) {
this.$api.getNewest(getData1).then(res => {
let data = res.data
// console.log(res.data)
if (!data || !Object.keys(data).length) return
if (dataset.dataType === this.$store.state.dataType[1]) {
this.calculateHistoryData(data, 'newData')
} else if (dataset.dataType === this.$store.state.dataType[2]) {
this.calculateStatisticData(data, 'newData')
} else if (dataset.dataType === this.$store.state.dataType[3]) {
this.calculateExternalData(data, 'newData')
}
})
} }
if (!getData) return
this.$api.getQueryMulitySource(getData).then(res => {
let data = res.data
if (!data) return
if (dataset.dataType === this.$store.state.dataType[1]) {
this.calculateHistoryData(data)
} else if (dataset.dataType === this.$store.state.dataType[2]) {
this.calculateStatisticData(data)
} else if (dataset.dataType === this.$store.state.dataType[3]) {
this.calculateExternalData(data)
}
}).catch(err => {})
}, },
//集合外部数据 //集合外部数据
calculateExternalData(data) { calculateExternalData(data, type) {
if (this.numerical) { if (this.numerical) {
this.variables1.forEach((item2, index) => { this.variables1.forEach((item2, index) => {
this.$set(this.numerical[index], 'value', data[item2][0]) if (type == 'newData') {
// for(let key in data[0]){
// if(key == this.numerical[index].variable){
// this.$set(this.numerical[index], 'value', data[0][key])
// }
// }
this.$set(this.numerical[index], 'value', data[index][this.numerical[index].variable])
} else {
this.$set(this.numerical[index], 'value', data[item2][0])
}
}) })
} }
}, },
//统计历史数据 //统计历史数据
calculateHistoryData(data) { calculateHistoryData(data, type) {
if (this.numerical) { if (this.numerical) {
this.variables1.forEach((item2, index) => { if (type == 'newData') {
this.$set(this.numerical[index], 'value', data[item2][0]) this.numerical.forEach((item, index) => {
if (data[index]) {
this.$set(this.numerical[index], 'value', data[index].Value)
}
}) })
} else {
this.variables1.forEach((item2, index) => {
this.$set(this.numerical[index], 'value', data[item2][0])
})
}
} }
}, },
//聚合统计数据 //聚合统计数据
calculateStatisticData(data) { calculateStatisticData(data, type) {
let filterConfig = this.componentsData.filterConfig let filterConfig = this.componentsData.filterConfig
let content = filterConfig.list[1].content let content = filterConfig.list[1].content
if (this.tabContent) { if (this.tabContent) {
...@@ -424,6 +464,11 @@ ...@@ -424,6 +464,11 @@
let item = this.numerical[index] let item = this.numerical[index]
let dataList = [] let dataList = []
let value = null let value = null
if (type == 'newData') {
value = data[index].Value
} else {
value = data[item2][0]
}
// if (contentList.length > 0 && timeType != "Hour" && timeType != "Second") { // if (contentList.length > 0 && timeType != "Hour" && timeType != "Second") {
// contentList.forEach((item1, index1) => { // contentList.forEach((item1, index1) => {
// let refName = '$' + item2 + '@' + item1 // let refName = '$' + item2 + '@' + item1
...@@ -450,7 +495,7 @@ ...@@ -450,7 +495,7 @@
// } // }
// } // }
value = data[item2][0]
this.$set(this.numerical[index], 'value', value) this.$set(this.numerical[index], 'value', value)
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
</view> </view>
<view style="height:300px !important;z-index: 2;"> <view style="height:300px !important;z-index: 2;">
<qiun-data-charts :echartsApp="true" :echartsH5="true" type="column" :chartData="chartData" <qiun-data-charts :echartsApp="true" :echartsH5="true" type="column" :chartData="chartData"
:eopts="option" /> :eopts="option"/>
</view> </view>
</view> </view>
</template> </template>
...@@ -23,10 +23,12 @@ ...@@ -23,10 +23,12 @@
avgNumber, avgNumber,
getMaxOrMin, getMaxOrMin,
getSameStrName, getSameStrName,
getBoxShadow getBoxShadow,
isNumber
} from '../../js/tool.js' } from '../../js/tool.js'
import { import {
historyApiData historyApiData,
statisticApiData
} from '../../js/data.js' } from '../../js/data.js'
export default { export default {
name: 'LineBarChart', name: 'LineBarChart',
...@@ -50,22 +52,22 @@ ...@@ -50,22 +52,22 @@
name: 'chartLineBar', name: 'chartLineBar',
componentList: [], //组件列表 componentList: [], //组件列表
styleConfigList: [], //样式列表 styleConfigList: [], //样式列表
chartData: { chartData: { //图表数据
categories: [], categories: [],//x轴数据
series: [] series: [] //x轴数据
}, },
localdata: [], localdata: [],
option: {}, option: {},//图表样式设置
numerical: [], numerical: [],//配置变量列表
RealTimeDataList: [], RealTimeDataList: [],//实时请求变量列表
chartOption: {}, chartOption: {},//图表配置数据
componentConfig: null, componentConfig: null,//组件配置
variables: [], variables: [],//变量列表
variables1: [], variables1: [],//有重复变量列表
tabContent: null, tabContent: null,//点击选项卡数据
dimension: [], dimension: [],//维度配置
decimal: 0, decimal: 0,//小数点
yAxisIndex: 0 yAxisIndex: 0//y轴位置
} }
}, },
created() { created() {
...@@ -73,12 +75,69 @@ ...@@ -73,12 +75,69 @@
this.getComponentList() this.getComponentList()
}, },
methods: { methods: {
//获取组件数据
getComponentList() {
if (!this.componentsData || this.componentsData == {}) return
// console.log(this.componentsData)
let item = this.componentsData
if (item.type !== this.name) return
let styleConfig = item.styleConfig
styleConfig.margin = arrayToString(styleConfig.margin)
styleConfig.padding = arrayToString(styleConfig.padding)
styleConfig.borderRadius = arrayToString(styleConfig.borderRadius)
// styleConfig.boxShadow = getBoxShadow(styleConfig.boxShadow)
let componentConfig = item.componentConfig
this.dimension = componentConfig.dimension
this.chartOption.title = componentConfig.chartTitle
this.numerical = componentConfig.numerical
this.RealTimeDataList = []
this.decimal = Number(componentConfig.numericalFormat.decimal)
this.numerical.forEach(item => {
this.RealTimeDataList.push(null)
})
this.componentConfig = componentConfig
this.variables = []
// if (this.numerical) {
// this.numerical.forEach(item => {
for (let i = 0; i < this.numerical.length; i++) {
let item1 = this.numerical[i]
// console.log(item1)
if (Number(item1.yAxis) > this.yAxisIndex) {
this.yAxisIndex = Number(item1.yAxis)
}
if (!item1.variable) break
this.variables.push({
"name": item1.variable,
"digit": this.decimal,
"valueMethod": getCalculateData(item1.statistical)
})
let num = getSameStrName(item1.variable, this.variables1)
if (this.dimension.length > 0 && item1.variable == this.dimension[0].variable) {
num += 1
}
if (num) {
this.variables1.push(item1.variable + '_' + num)
} else {
this.variables1.push(item1.variable)
}
}
// })
// }
item.layout = item.componentConfig.layout
this.styleConfigList.push(styleConfig)
this.componentList.push(item)
this.setOptionStyle()
},
//历史、统计、外部 //历史、统计、外部
async getHistoryExternalData() { async getHistoryExternalData() {
if (!this.componentConfig) return if (!this.componentConfig) return
if (this.variables.length <= 0) return //无选择变量不请求 if (this.variables.length <= 0) return //无选择变量不请求
let dataset = this.componentConfig.dataset let dataset = this.componentConfig.dataset
let getData = null let getData = null
let getData1 = null
if (dataset.dataType === this.$store.state.dataType[1]) { if (dataset.dataType === this.$store.state.dataType[1]) {
let filterConfig = this.componentsData.filterConfig let filterConfig = this.componentsData.filterConfig
let dimension = this.componentConfig.dimension[0] let dimension = this.componentConfig.dimension[0]
...@@ -92,12 +151,12 @@ ...@@ -92,12 +151,12 @@
return return
} }
let recent = Number(content.substr(0, content.indexOf(","))) let recent = Number(content.substr(0, content.indexOf(",")))
let timeType = getTimeType(content.substr(content.indexOf(",") + 1)) let timeType = getTimeType(content.substr(content.indexOf(",") + 1))
let date1 = dateFtt("yyyy-MM-dd hh:mm:ss", new Date()) let date1 = dateFtt("yyyy-MM-dd hh:mm:ss", new Date())
if(timeType != 'Hour' && timeType != 'Second'){ if (timeType != 'Hour' && timeType != 'Second') {
date1 = dateFtt("yyyy-MM-dd", new Date())+' 00:00:00' date1 = dateFtt("yyyy-MM-dd", new Date()) + ' 00:00:00'
} }
let startTime = date1 let startTime = date1
await this.$api.getStartTime(date1, recent, timeType).then(res => { await this.$api.getStartTime(date1, recent, timeType).then(res => {
...@@ -106,33 +165,15 @@ ...@@ -106,33 +165,15 @@
console.log(err) console.log(err)
}) })
let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date()) let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date())
// console.log('startTime=>'+startTime) if (content.substr(content.indexOf(",") + 1) == '最新') {
// console.log('startTime=>'+date) getData1 = {
getData = historyApiData(startTime,date,this.variables,getTimeType(level),false) "variables": this.variables,
// getData = { "sourceType": "History",
// "filterControls": [{ "layoutSettings": getTimeType(level),
// "value1": startTime, }
// "controlType": "AssociateDateTimePicker", } else {
// "pickerType": "BeginTime", getData = historyApiData(startTime, date, this.variables, getTimeType(level), false)
// "name": "a1" }
// },
// {
// "value1": date,
// "controlType": "AssociateDateTimePicker",
// "pickerType": "EndTime",
// "name": "a2"
// }
// ],
// "variables": this.variables,
// "sourceType": "History",
// "layoutSettings": getTimeType(level),
// "skipTime": false,
// "historySettings": {
// "timeType": "Recent",
// "valueMethod": "Origin",
// "xAxisSetting": "Time",
// }
// }
} else if (dataset.dataType === this.$store.state.dataType[2]) { } else if (dataset.dataType === this.$store.state.dataType[2]) {
let dimension = this.componentConfig.dimension[0] let dimension = this.componentConfig.dimension[0]
...@@ -151,36 +192,25 @@ ...@@ -151,36 +192,25 @@
}).catch(err => { }).catch(err => {
console.log(err) console.log(err)
}) })
getData = { if (content1.substr(content1.indexOf(",") + 1) == '最新') {
"filterControls": [{ getData1 = {
"value1": startTime, "variables": this.variables,
"controlType": "AssociateDateTimePicker", "sourceType": "Statistic",
"pickerType": "BeginTime", "layoutSettings": getTimeType(level),
"name": "a1" "statisticsSettings": {
}, "timeSetting": getTimeType(level),
{
"value1": date,
"controlType": "AssociateDateTimePicker",
"pickerType": "EndTime",
"name": "a2"
} }
],
"variables": this.variables,
"layoutSettings": getTimeType(level),
"skipTime": false,
"sourceType": "Statistic",
"statisticsSettings": {
"shiftName": "AAA",
"valueMethod": "Origin",
"xAxisSetting": "Time",
"timeSetting": getTimeType(level),
"shiftsType": "All"
} }
} else {
getData = statisticApiData(startTime, date, this.variables, getTimeType(level), false,
getTimeType(level))
} }
} else if (dataset.dataType === this.$store.state.dataType[3]) { } else if (dataset.dataType === this.$store.state.dataType[3]) {
let dimension = this.dimension let dimension = this.dimension
let variablesList = JSON.parse(JSON.stringify(this.variables)) let variablesList = JSON.parse(JSON.stringify(this.variables))
let layoutSettings = "Second"
for (let i = 0; i < dimension.length; i++) { for (let i = 0; i < dimension.length; i++) {
let item = dimension[i] let item = dimension[i]
if (!item.variable) break if (!item.variable) break
...@@ -190,6 +220,7 @@ ...@@ -190,6 +220,7 @@
name: item.variable, name: item.variable,
layoutSettings: getTimeType(item.level), layoutSettings: getTimeType(item.level),
} }
layoutSettings = getTimeType(item.level)
variablesList.unshift(tagData) variablesList.unshift(tagData)
} else { } else {
tagData = { tagData = {
...@@ -206,11 +237,17 @@ ...@@ -206,11 +237,17 @@
} }
let filterControls = [] //过滤控件组合 let filterControls = [] //过滤控件组合
let filterItems = [] let filterItems = []
let newDataType = 0
let newDataValue = null
for (let i = 0; i < contentList.length; i++) { for (let i = 0; i < contentList.length; i++) {
let item = contentList[i] let item = contentList[i]
let content = item.content let content = item.content
if (item.type == '时间日期') { if (item.type == '时间日期' && item.variable != '') {
if (content.substr(content.indexOf(",") + 1) == '最新') {
newDataType += 1
newDataValue = item
}
let recent = Number(content.substr(0, content.indexOf(","))) let recent = Number(content.substr(0, content.indexOf(",")))
let timeType = getTimeType(content.substr(content.indexOf(",") + 1)) let timeType = getTimeType(content.substr(content.indexOf(",") + 1))
let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date()) let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date())
...@@ -273,79 +310,155 @@ ...@@ -273,79 +310,155 @@
} }
let dataSetId = dataset.externalDataId let dataSetId = dataset.externalDataId
getData = { if (newDataType > 0) {
"filterControls": filterControls, let variables = JSON.parse(JSON.stringify(this.variables))
"variables": variablesList, let dataNum = 0
"layoutSettings": "Second", if (dimension.length > 0) {
"skipTime": false, dimension.forEach((item, index) => {
"sourceType": "External", let tagData = null
"externalSettings": { if (item.variableType.indexOf('DateTime') > 1) {
"valueMethod": "Sum", tagData = {
"dataSetId": dataSetId, name: item.variable,
"xAxisFields": [""], layoutSettings: layoutSettings,
"filterItems": filterItems }
dataNum += 1
} else {
tagData = {
name: item.variable,
valueMethod: "Sum"
}
}
// variables.splice(index,0,tagData)
variables.push(tagData)
})
if (dataNum <= 0) {
variables.push({
"name": newDataValue.variable,
"layoutSettings": layoutSettings
})
}
} else {
variables.push({
"name": newDataValue.variable,
"layoutSettings": layoutSettings
})
}
getData1 = {
"variables": variables,
"sourceType": "External",
"layoutSettings": layoutSettings,
"externalSettings": {
"dataSetId": dataSetId
}
}
} else {
getData = {
"filterControls": filterControls,
"variables": variablesList,
"layoutSettings": "Second",
"skipTime": false,
"sourceType": "External",
"externalSettings": {
"valueMethod": "Sum",
"dataSetId": dataSetId,
"xAxisFields": [""],
"filterItems": filterItems
}
} }
} }
} }
if (!getData) return if (getData) {
this.$api.getQueryMulitySource(getData).then(res => { this.$api.getQueryMulitySource(getData).then(res => {
let data = res.data let data = res.data
if (data.code == 1) { if (data.code == 1) {
this.chartData = { this.chartData = {
series: [{}], series: [{}],
categories: [] categories: []
}
return
}
if (!data || !Object.keys(data).length) return
if (dataset.dataType === this.$store.state.dataType[1]) {
this.calculateHistoryData(data)
} else if (dataset.dataType === this.$store.state.dataType[2]) {
this.calculateStatisticData(data)
} else if (dataset.dataType === this.$store.state.dataType[3]) {
this.calculateExternalData(data)
} }
return
}
if (dataset.dataType === this.$store.state.dataType[1]) {
this.calculateHistoryData(data)
} else if (dataset.dataType === this.$store.state.dataType[2]) {
this.calculateStatisticData(data)
} else if (dataset.dataType === this.$store.state.dataType[3]) {
this.calculateExternalData(data)
}
}).catch(err => {})
}
if (getData1) {//筛选条件时间为最新
this.$api.getNewest(getData1).then(res => {
let data = res.data
// console.log(res.data)
if (data.code == 1) {
this.chartData = {
series: [{}],
categories: []
}
return
}
if (!data || !Object.keys(data).length) {
this.chartData = {
series: [{}],
categories: []
}
return
}
if (dataset.dataType === this.$store.state.dataType[1]) {
this.calculateHistoryData(data, 'newData')
} else if (dataset.dataType === this.$store.state.dataType[2]) {
this.calculateStatisticData(data, 'newData')
} else if (dataset.dataType === this.$store.state.dataType[3]) {
this.calculateExternalData(data, 'newData')
}
})
}
}).catch(err => {})
}, },
//聚合外部数据 //聚合外部数据
calculateExternalData(data) { calculateExternalData(data, type) {
this.chartData = {
categories: [],
series: []
}
let dimension = this.dimension[0] let dimension = this.dimension[0]
let len = data[dimension.variable].length let numerical = this.numerical
if (type == 'newData') {//筛选时间为最新
this.$nextTick(function() { let item1 = data[this.variables1.length]
this.chartData = { this.variables.forEach((item2, index) => {
categories: [],
series: []
}
let numerical = this.numerical
this.variables1.forEach((item2, index) => {
let item = numerical[index] let item = numerical[index]
let seriesData = { let item3 = data[index]
name: item.name, if (item3[item.variable]) {
type: item.chartType, let item = numerical[index]
yAxisIndex: item.yAxis, let seriesData = this.initData(item)//初始化图形数据
data: data[item2], seriesData.data.push(item3[item2.name])
smooth: true, seriesData.data = this.setBarItemStyle(seriesData.data)
barMaxWidth: 30, this.chartData.series.push(seriesData)
itemStyle: this.getItemStyle(item),
markLine: this.getMarkLine(item)
} }
this.chartData.series.push(seriesData)
}) })
this.chartData.categories = data[dimension.variable] this.chartData.categories.push(item1[dimension.variable])
} else {
let len = data[dimension.variable].length
// this.$nextTick(function() {
this.variables1.forEach((item2, index) => {
let item = numerical[index]
let seriesData = this.initData(item)//初始化图形数据
seriesData.data = data[item2]
seriesData.data = this.setBarItemStyle(seriesData.data)
this.chartData.series.push(seriesData)
})
this.chartData.categories = data[dimension.variable]
// })
}
})
}, },
//聚合统计数据 //聚合统计数据
calculateStatisticData(data) { calculateStatisticData(data, type) {
let len = data.RecordXValue ? data.RecordXValue.length : 0 let len = data.RecordXValue ? data.RecordXValue.length : 0
let filterConfig = this.componentsData.filterConfig let filterConfig = this.componentsData.filterConfig
let content = filterConfig.list[1].content let content = filterConfig.list[1].content
...@@ -353,7 +466,11 @@ ...@@ -353,7 +466,11 @@
content = this.tabContent[1].content content = this.tabContent[1].content
} }
let dimension = this.componentConfig.dimension[0] let dimension = this.componentConfig.dimension[0]
let level = dimension.level //展示层级 let content1 = filterConfig.list[0].content
if (this.tabContent) {
content1 = this.tabContent[0].content
}
let timeType = getTimeType(content1.substr(content1.indexOf(",") + 1))
let contentList = [] let contentList = []
if (content != "" && content != null) { if (content != "" && content != null) {
contentList = content.split(",") contentList = content.split(",")
...@@ -363,101 +480,143 @@ ...@@ -363,101 +480,143 @@
categories: [], categories: [],
series: [] series: []
} }
this.chartData.categories = [] // this.chartData.categories = []
if (type == 'newData') {
this.chartData.categories.push(data[0].Time)
} else {
this.chartData.categories = data.RecordXValue
}
let numerical = this.numerical let numerical = this.numerical
this.variables1.forEach((item2, index) => { this.variables1.forEach((item2, index) => {
let item = numerical[index] let item = numerical[index]
let seriesData = { let seriesData = this.initData(item)//初始化图形数据
name: item.name, // console.log(seriesData)
type: item.chartType, if (type == 'newData') {
yAxisIndex: item.yAxis, if (contentList.length > 0 && timeType != 'Hour') { //有筛选班次并时间层级不为小时,小时没有班次
data: [],
smooth: true,
itemStyle: this.getItemStyle(item),
barMaxWidth: 30,
markLine: this.getMarkLine(item)
}
console.log(seriesData)
if (contentList.length > 0 && getTimeType(level) != 'Hour') {
let keyList = []
for (let i = 0; i < len; i++) {
let dataList = [] let dataList = []
let value = null let value = null
let item3 = data[index]
// console.log(contentList)
// let keyList = []
contentList.forEach((item1, index1) => { contentList.forEach((item1, index1) => {
if (item3[item1]) {
// let refName = '!' + item.variable + '@' + item1 dataList.push(item3[item1])
let refName = '$' + item2 + '@' + item1
if (data[refName]) {
dataList.push(data[refName][i])
} }
}) })
if (item.statistical === '合计') { value = this.getStatisticalData(item.statistical, dataList, this.decimal)
value = sumNumber(dataList) seriesData.data.push(value)
}
if (item.statistical === '平均') { } else {
value = avgNumber(dataList) ? avgNumber(dataList).toFixed(this
.decimal) : avgNumber(dataList) let item3 = data[index]
} if (item3.Variable == item2) {
if (item.statistical === '最大') { seriesData.data.push(item3.Value)
value = getMaxOrMin(dataList, 'max')
}
if (item.statistical === '最小') {
value = getMaxOrMin(dataList, 'min')
} }
keyList.push(value)
} }
this.$set(this.numerical[index], 'value', keyList) // this.chartData.series.push(seriesData)
seriesData.data = keyList
this.chartData.series.push(seriesData)
} else { } else {
if (data[item2]) { if (contentList.length > 0 && timeType != 'Hour') {
seriesData.data = data[item2] let keyList = []
this.chartData.series.push(seriesData) for (let i = 0; i < len; i++) {
let dataList = []
let value = null
contentList.forEach((item1, index1) => {
// let refName = '!' + item.variable + '@' + item1
let refName = '$' + item2 + '@' + item1
if (data[refName]) {
dataList.push(data[refName][i])
}
})
value = this.getStatisticalData(item.statistical, dataList, this
.decimal)
keyList.push(value)
}
this.$set(this.numerical[index], 'value', keyList)
seriesData.data = keyList
// this.chartData.series.push(seriesData)
} else {
if (data[item2]) {
seriesData.data = data[item2]
// this.chartData.series.push(seriesData)
}
} }
} }
seriesData.data = this.setBarItemStyle(seriesData.data)
this.chartData.series.push(seriesData)
}) })
this.chartData.categories = data.RecordXValue
// console.log(this.chartData)
}) })
}, },
//聚合班次数据
getStatisticalData(statistical, dataList, decimal) {
let value = null
if (statistical === '合计') {
value = sumNumber(dataList)
}
if (statistical === '平均') {
value = avgNumber(dataList) ? avgNumber(dataList).toFixed() : avgNumber(dataList)
}
if (statistical === '最大') {
value = getMaxOrMin(dataList, 'max')
}
if (statistical === '最小') {
value = getMaxOrMin(dataList, 'min')
}
return value
},
//统计历史数据 //统计历史数据
calculateHistoryData(data) { calculateHistoryData(data, type) {
this.$nextTick(function() { this.$nextTick(function() {
this.chartData = { this.chartData = {
categories: [], categories: [],
series: [] series: []
} }
if (type == 'newData') {
this.chartData.categories.push(data[0].Time)
} else {
this.chartData.categories = data.RecordXValue
}
let numerical = this.numerical let numerical = this.numerical
numerical.forEach((item, index) => { this.variables1.forEach((item1, index) => {
let seriesData = { let item = numerical[index]
name: item.name, let seriesData = this.initData(item)
type: item.chartType, if (type == 'newData') {
yAxisIndex: item.yAxis, let item2 = data[index]
itemStyle: this.getItemStyle(item), if (item2.Variable == item.variable) {
data: [], seriesData.data.push(item2.Value)
smooth: true, }
barMaxWidth: 30,
markLine: this.getMarkLine(item)
}
if (data[item.variable + '_' + index]) {
this.$set(this.numerical[index], 'value', data[item.variable + '_' + index])
seriesData.data = data[item.variable + '_' + index]
} else { } else {
if (data[item.variable]) { if (data[item1]) {
this.$set(this.numerical[index], 'value', data[item.variable]) this.$set(this.numerical[index], 'value', data[item1])
seriesData.data = data[item.variable] // let seriesDataList = JSON.parse(JSON.)
seriesData.data = data[item1]
} }
} }
seriesData.data = this.setBarItemStyle(seriesData.data)
// console.log(seriesData)
this.chartData.series.push(seriesData) this.chartData.series.push(seriesData)
}) })
this.chartData.categories = data.RecordXValue
}) })
}, },
//设置柱状图柱形图形
setBarItemStyle(list) {
let list1 = list.map(function(item) {
return {
value: item,
itemStyle: {
barBorderRadius: isNumber(item) && Number(item) >= 0 ? [15, 15, 0, 0] : [0, 0, 15, 15]
}
}
})
return list1
},
//实时数据刷新 //实时数据刷新
getRealTimeData(newTagDataArr) { getRealTimeData(newTagDataArr) {
if (newTagDataArr) { if (newTagDataArr) {
...@@ -479,21 +638,8 @@ ...@@ -479,21 +638,8 @@
this.$set(this.numerical[j], 'value', newTagDataArr[i].Value) this.$set(this.numerical[j], 'value', newTagDataArr[i].Value)
this.chartData.categories.push(item.name) this.chartData.categories.push(item.name)
RealTimeDataList[j] = newTagDataArr[i].Value RealTimeDataList[j] = newTagDataArr[i].Value
// let list = RealTimeDataList.slice(0,j+1) let seriesData = this.initData(item,1)
// let RealTimeDataList = newTagDataArr[i].Value seriesData.data = this.setBarItemStyle(RealTimeDataList)
// this.chartData.series.push(seriesData)
let seriesData = {
name: item.name,
type: item.chartType,
data: RealTimeDataList,
yAxisIndex: item.yAxis,
itemStyle: this.getItemStyle(item),
smooth: true,
stack: 1,
barMaxWidth: 30,
// lineStyle: this.getLineStyle(item),
markLine: this.getMarkLine(item)
}
this.chartData.series.push(seriesData) this.chartData.series.push(seriesData)
...@@ -511,68 +657,95 @@ ...@@ -511,68 +657,95 @@
}) })
} }
}, },
//初始化饼图 //初始化图形配置数据
init() { initData(item,stack) {
this.chartData = { let seriesData = {
series: [], name: item.name,
categories: [] type: item.chartType,
data: [],
yAxisIndex: item.yAxis,
itemStyle: this.getItemStyle(item),
smooth: true,
stack:stack,
barMaxWidth: 30,
// lineStyle: this.getLineStyle(item),
markLine: this.getMarkLine(item)
} }
return seriesData
}, },
//获取组件数据
getComponentList() { //添加辅助线
if (!this.componentsData || this.componentsData == {}) return getMarkLine(item) {
console.log(this.componentsData) let markLine = {}
let item = this.componentsData let markLineData = this.componentConfig.markLine
if (item.type !== this.name) return let list = markLineData.list
let styleConfig = item.styleConfig markLine.data = []
styleConfig.margin = arrayToString(styleConfig.margin) markLine.symbol = 'none' //去掉箭头
styleConfig.padding = arrayToString(styleConfig.padding) markLine.label = {
styleConfig.borderRadius = arrayToString(styleConfig.borderRadius) show: true,
styleConfig.boxShadow = getBoxShadow(styleConfig.boxShadow) // position:'middle'
let componentConfig = item.componentConfig
this.dimension = componentConfig.dimension }
this.chartOption.title = componentConfig.chartTitle for (let i = 0; i < list.length; i++) {
this.numerical = componentConfig.numerical let item1 = list[i]
this.RealTimeDataList = [] let data = null
this.decimal = Number(componentConfig.numericalFormat.decimal) if (item1.statistical == '固定值') {
this.numerical.forEach(item => { data = {
this.RealTimeDataList.push(null) name: item1.name,
}) yAxis: item1.number,
lineStyle: {
this.componentConfig = componentConfig color: item1.color,
this.variables = [] type: 'solid'
// if (this.numerical) { }
// this.numerical.forEach(item => { }
for (let i = 0; i < this.numerical.length; i++) { markLine.data.push(data)
let item1 = this.numerical[i]
// console.log(item1)
if (Number(item1.yAxis) > this.yAxisIndex) {
this.yAxisIndex = Number(item1.yAxis)
}
if (!item1.variable) break
this.variables.push({
"name": item1.variable,
"digit": this.decimal,
"valueMethod": getCalculateData(item1.statistical)
})
let num = getSameStrName(item1.variable, this.variables1)
if (this.dimension.length > 0 && item1.variable == this.dimension[0].variable) {
num += 1
}
if (num) {
this.variables1.push(item1.variable + '_' + num)
} else { } else {
this.variables1.push(item1.variable) if (item1.numerical == item.name) {
if (item1.statistical == '平均值') {
data = {
name: item1.name,
type: 'average',
lineStyle: {
color: item1.color,
type: 'solid'
}
}
} else if (item1.statistical == '最大值') {
data = {
name: item1.name,
type: 'max',
lineStyle: {
color: item1.color,
type: 'solid'
}
}
} else if (item1.statistical == '最小值') {
data = {
name: item1.name,
type: 'min',
lineStyle: {
color: item1.color,
type: 'solid'
}
}
}
markLine.data.push(data)
}
} }
} }
// }) return markLine
// }
item.layout = item.componentConfig.layout },
this.styleConfigList.push(styleConfig) //设置图形样式
this.componentList.push(item) getItemStyle(item, data) {
this.setOptionStyle() let itemStyle = {}
itemStyle.color = item.color
if (item.chartType === "bar") {
itemStyle.barBorderRadius = [15, 15, 0, 0]
}
return itemStyle
}, },
//设置折线柱状图样式 //设置折线柱状图样式
setOptionStyle() { setOptionStyle() {
...@@ -581,24 +754,7 @@ ...@@ -581,24 +754,7 @@
let xAxisFormat = this.componentConfig.xAxisFormat let xAxisFormat = this.componentConfig.xAxisFormat
let numericalFormat = this.componentConfig.numericalFormat let numericalFormat = this.componentConfig.numericalFormat
this.option = { this.option = {
// title: {
// text: this.chartOption.title,
// textStyle: {
// fontSize: parseInt(nameFormat.fontSize),
// fontFamily: nameFormat.fontFamily,
// fontWeight: nameFormat.fontWeight,
// color: nameFormat.color,
// fontStyle: nameFormat.fontStyle,
// textDecoration: nameFormat.textDecoration,
// lineHeight: 13,
// },
// top: '5px',
// left: '10px',
// },
tooltip: { tooltip: {
//confine:true
// trigger:'item',
}, },
legend: { legend: {
show: true, show: true,
...@@ -667,90 +823,14 @@ ...@@ -667,90 +823,14 @@
], ],
grid: { grid: {
left: '3%', left: '3%',
right: markLineData.list.length > 0 && this.yAxisIndex == 0 ? '10%' : '4%', right: markLineData.list.length > 0 && this.yAxisIndex == 0 ? '12%' : '4%',
bottom: '3%', bottom: '3%',
top: '45px', top: '45px',
containLabel: true containLabel: true
}, },
} }
}, },
//添加辅助线
getMarkLine(item) {
let markLine = {}
let markLineData = this.componentConfig.markLine
let list = markLineData.list
markLine.data = []
markLine.symbol = 'none' //去掉箭头
markLine.label = {
show: true,
// position:'middle'
}
for (let i = 0; i < list.length; i++) {
let item1 = list[i]
let data = null
if (item1.statistical == '固定值') {
data = {
name: item1.name,
yAxis: item1.number,
lineStyle: {
color: item1.color,
type: 'solid'
}
}
markLine.data.push(data)
} else {
if (item1.numerical == item.name) {
if (item1.statistical == '平均值') {
data = {
name: item1.name,
type: 'average',
lineStyle: {
color: item1.color,
type: 'solid'
}
}
} else if (item1.statistical == '最大值') {
data = {
name: item1.name,
type: 'max',
lineStyle: {
color: item1.color,
type: 'solid'
}
}
} else if (item1.statistical == '最小值') {
data = {
name: item1.name,
type: 'min',
lineStyle: {
color: item1.color,
type: 'solid'
}
}
}
markLine.data.push(data)
}
}
}
return markLine
},
//设置图形样式
getItemStyle(item) {
// console.log(item)
let itemStyle = {}
itemStyle.color = item.color
if (item.chartType === "bar") {
itemStyle.barBorderRadius = [15, 15, 0, 0]
}
return itemStyle
},
} }
} }
</script> </script>
......
<!-- 这是表格控件 --> <!-- 这是表格控件 -->
<template> <template>
<view class="data-conponent-style" :class="'list'+index"> <view class="data-conponent-style" :class="'list'+index">
<scroll-view scroll-x="true" :class="'list-style-'+theme" style="max-height: 300px;" scroll-y="true" > <scroll-view scroll-x="true" :class="'list-style-'+theme" style="max-height: 300px;" scroll-y="true">
<uni-table stripe emptyText="暂无更多数据" > <uni-table stripe emptyText="暂无更多数据">
<!-- 表头行 --> <!-- 表头行 -->
<!-- <u-sticky offset-top="0"> --> <!-- <u-sticky offset-top="0"> -->
<uni-tr> <uni-tr>
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
</uni-tr> </uni-tr>
<!-- </u-sticky> --> <!-- </u-sticky> -->
<!-- 表格数据行 --> <!-- 表格数据行 -->
<uni-tr v-for="(item3,index3) in tableData" :key="'tr'+index3"> <uni-tr v-for="(item3,index3) in tableData" :key="'tr'+index3">
<uni-td :style="componentsData.componentConfig.numericalFormat" v-for="(item4,index4) in item3" <uni-td :style="componentsData.componentConfig.numericalFormat" v-for="(item4,index4) in item3"
:key="'td'+index4">{{item4}}</uni-td> :key="'td'+index4">{{item4}}</uni-td>
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</uni-tr> </uni-tr>
</uni-table> </uni-table>
</scroll-view> </scroll-view>
</view> </view>
</template> </template>
...@@ -45,8 +45,13 @@ ...@@ -45,8 +45,13 @@
getTimeType, getTimeType,
dateFtt, dateFtt,
getSameStrName, getSameStrName,
getBoxShadow getBoxShadow,
isNumber
} from '../../js/tool.js' } from '../../js/tool.js'
import {
historyApiData,
statisticApiData
} from '../../js/data.js'
export default { export default {
name: 'List', name: 'List',
// props: ['componentsData', 'index'], // props: ['componentsData', 'index'],
...@@ -70,7 +75,8 @@ ...@@ -70,7 +75,8 @@
rowSummary: { rowSummary: {
show: false, //是否显示行总汇 show: false, //是否显示行总汇
}, },
tableData: [], tableDataList:[],//总的列表数据
tableData: [],//当前页面数据
columnData: [], columnData: [],
columnSummary: { columnSummary: {
show: false, //是否显示列总汇 show: false, //是否显示列总汇
...@@ -84,8 +90,8 @@ ...@@ -84,8 +90,8 @@
componentConfig: '', componentConfig: '',
tabContent: null, //选项卡历史数据 tabContent: null, //选项卡历史数据
dimension: [], dimension: [],
theme: 'theme1' ,//主题 theme: 'theme1', //主题
tableLoading:false tableLoading: false
} }
}, },
methods: { methods: {
...@@ -96,7 +102,8 @@ ...@@ -96,7 +102,8 @@
let tableData1 = [] let tableData1 = []
let dataSum = null let dataSum = null
this.tableData = [] this.tableData = []
if(this.variables.length <= 0) return this.tableDataList = []
if (this.variables.length <= 0) return
numerical.forEach((item, index) => { numerical.forEach((item, index) => {
this.numerical[index].value = null this.numerical[index].value = null
for (let i = 0; i < newTagDataArr.length; i++) { for (let i = 0; i < newTagDataArr.length; i++) {
...@@ -132,7 +139,7 @@ ...@@ -132,7 +139,7 @@
styleConfig.margin = arrayToString(styleConfig.margin) styleConfig.margin = arrayToString(styleConfig.margin)
styleConfig.padding = arrayToString(styleConfig.padding) styleConfig.padding = arrayToString(styleConfig.padding)
styleConfig.borderRadius = arrayToString(styleConfig.borderRadius) styleConfig.borderRadius = arrayToString(styleConfig.borderRadius)
styleConfig.boxShadow = getBoxShadow(styleConfig.boxShadow) // styleConfig.boxShadow = getBoxShadow(styleConfig.boxShadow)
let componentConfig = item.componentConfig let componentConfig = item.componentConfig
this.nameTextAlign = componentConfig.nameFormat.alignHorizontal this.nameTextAlign = componentConfig.nameFormat.alignHorizontal
componentConfig.numericalFormat.textAlign = componentConfig.numericalFormat componentConfig.numericalFormat.textAlign = componentConfig.numericalFormat
...@@ -189,11 +196,12 @@ ...@@ -189,11 +196,12 @@
}, },
//历史、统计、外部 //历史、统计、外部
async getHistoryExternalData() { async getHistoryExternalData() {
// console.log(444) // console.log(444)
if (!this.componentConfig) return if (!this.componentConfig) return
if(this.variables.length <= 0) return //无选择变量不请求 if (this.variables.length <= 0) return //无选择变量不请求
let dataset = this.componentConfig.dataset let dataset = this.componentConfig.dataset
let getData = null let getData = null
let getData1 = null
if (dataset.dataType === this.$store.state.dataType[1]) { if (dataset.dataType === this.$store.state.dataType[1]) {
let filterConfig = this.componentsData.filterConfig let filterConfig = this.componentsData.filterConfig
let dimension = this.componentConfig.dimension[0] let dimension = this.componentConfig.dimension[0]
...@@ -212,8 +220,8 @@ ...@@ -212,8 +220,8 @@
let timeType = getTimeType(content.substr(content.indexOf(",") + 1)) let timeType = getTimeType(content.substr(content.indexOf(",") + 1))
let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date()) let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date())
let date1 = dateFtt("yyyy-MM-dd hh:mm:ss", new Date()) let date1 = dateFtt("yyyy-MM-dd hh:mm:ss", new Date())
if(timeType != 'Hour' && timeType != 'Second'){ if (timeType != 'Hour' && timeType != 'Second') {
date1 = dateFtt("yyyy-MM-dd", new Date())+' 00:00:00' date1 = dateFtt("yyyy-MM-dd", new Date()) + ' 00:00:00'
} }
let startTime = date let startTime = date
await this.$api.getStartTime(date1, recent, timeType).then(res => { await this.$api.getStartTime(date1, recent, timeType).then(res => {
...@@ -221,38 +229,20 @@ ...@@ -221,38 +229,20 @@
}).catch(err => { }).catch(err => {
console.log(err) console.log(err)
}) })
// let timeType = getTimeSettings(Number(content.substr(0, content.indexOf(","))), content.substr( if (content.substr(content.indexOf(",") + 1) == '最新') {
// content.indexOf(",") + 1)) // console.log(content.substr(content.indexOf(",") + 1))
getData = { getData1 = {
"filterControls": [{ "variables": this.variables,
"value1": startTime, "sourceType": "History",
"controlType": "AssociateDateTimePicker", "layoutSettings": getTimeType(level),
"pickerType": "BeginTime",
"name": "a1"
},
{
"value1": date,
"controlType": "AssociateDateTimePicker",
"pickerType": "EndTime",
"name": "a2"
}
],
"variables": this.variables,
"sourceType": "History",
"layoutSettings": getTimeType(level),
"skipTime": false,
"historySettings": {
"timeType": "Recent",
"valueMethod": "Origin",
"xAxisSetting": "Time",
// "recent": timeType.recent,
// "timeSetting": timeType.timeSetting
} }
} else {
getData = historyApiData(startTime, date, this.variables, getTimeType(level), false)
} }
} else if (dataset.dataType === this.$store.state.dataType[2]) { //统计数据
} else if (dataset.dataType === this.$store.state.dataType[2]) {
let filterConfig = this.componentsData.filterConfig let filterConfig = this.componentsData.filterConfig
let dimension = this.componentConfig.dimension[0] let dimension = this.componentConfig.dimension[0]
let level = dimension.level //展示层级 let level = dimension.level //展示层级
...@@ -264,72 +254,69 @@ ...@@ -264,72 +254,69 @@
let timeType = getTimeType(content1.substr(content1.indexOf(",") + 1)) let timeType = getTimeType(content1.substr(content1.indexOf(",") + 1))
let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date()) let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date())
let date1 = dateFtt("yyyy-MM-dd hh:mm:ss", new Date()) let date1 = dateFtt("yyyy-MM-dd hh:mm:ss", new Date())
if(timeType != 'Hour' && timeType != 'Second'){ if (timeType != 'Hour' && timeType != 'Second') {
date1 = dateFtt("yyyy-MM-dd", new Date())+' 00:00:00' date1 = dateFtt("yyyy-MM-dd", new Date()) + ' 00:00:00'
} }
let startTime = date let startTime = date
await this.$api.getStartTime(date1, recent, timeType).then(res => { await this.$api.getStartTime(date1, recent, timeType).then(res => {
startTime = res.data startTime = res.data
}).catch(err => {}) }).catch(err => {})
getData = { if (content1.substr(content1.indexOf(",") + 1) == '最新') {
"filterControls": [{ getData1 = {
"value1": startTime, "variables": this.variables,
"controlType": "AssociateDateTimePicker", "sourceType": "Statistic",
"pickerType": "BeginTime", "layoutSettings": getTimeType(level),
"name": "a1" "statisticsSettings": {
}, "timeSetting": getTimeType(level),
{
"value1": date,
"controlType": "AssociateDateTimePicker",
"pickerType": "EndTime",
"name": "a2"
} }
],
"variables": this.variables,
"layoutSettings": getTimeType(level),
"skipTime": false,
"sourceType": "Statistic",
"statisticsSettings": {
"shiftName": "AAA",
"valueMethod": "Origin",
"xAxisSetting": "Time",
"timeSetting":getTimeType(level),
"shiftsType": "All"
} }
} else {
getData = statisticApiData(startTime, date, this.variables, getTimeType(level), false,
getTimeType(level))
} }
} else if (dataset.dataType === this.$store.state.dataType[3]) { } else if (dataset.dataType === this.$store.state.dataType[3]) { //外部数据
let dimension = this.dimension let dimension = this.dimension
let variablesList = JSON.parse(JSON.stringify(this.variables)) let variablesList = JSON.parse(JSON.stringify(this.variables))
dimension.forEach((item, index) => { let layoutSettings = "Second"
let tagData = null if (dimension.length > 0) {
if (item.variableType.indexOf('DateTime') > 1) { dimension.forEach((item, index) => {
tagData = { let tagData = null
name: item.variable, if (item.variableType.indexOf('DateTime') > 1) {
layoutSettings: getTimeType(item.level), tagData = {
} name: item.variable,
variablesList.unshift(tagData) layoutSettings: getTimeType(item.level),
} else { }
tagData = { layoutSettings = getTimeType(item.level)
name: item.variable, variablesList.unshift(tagData)
layoutSettings: "Day" } else {
tagData = {
name: item.variable,
layoutSettings: "Day"
}
variablesList.unshift(tagData)
} }
variablesList.unshift(tagData)
}
}) })
}
let filterConfig = this.componentsData.filterConfig let filterConfig = this.componentsData.filterConfig
let contentList = filterConfig.list let contentList = filterConfig.list
if (this.tabContent) { if (this.tabContent) {
contentList = this.tabContent contentList = this.tabContent
} }
let newDataType = 0
let newDataValue = null
let filterControls = [] //过滤控件组合 let filterControls = [] //过滤控件组合
let filterItems = [] let filterItems = []
for (let i = 0; i < contentList.length; i++) { for (let i = 0; i < contentList.length; i++) {
let item = contentList[i] let item = contentList[i]
let content = item.content let content = item.content
if (item.type == '时间日期') { if (item.type == '时间日期' && item.variable != '') {
if (content.substr(content.indexOf(",") + 1) == '最新') {
newDataType += 1
newDataValue = item
}
let recent = Number(content.substr(0, content.indexOf(","))) let recent = Number(content.substr(0, content.indexOf(",")))
let timeType = getTimeType(content.substr(content.indexOf(",") + 1)) let timeType = getTimeType(content.substr(content.indexOf(",") + 1))
let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date()) let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date())
...@@ -392,48 +379,142 @@ ...@@ -392,48 +379,142 @@
} }
let dataSetId = dataset.externalDataId let dataSetId = dataset.externalDataId
getData = {
"filterControls": filterControls, if (newDataType > 0) {
"variables": variablesList, let variables = JSON.parse(JSON.stringify(this.variables))
"layoutSettings": "Second", let dataNum = 0
"skipTime": false, if (dimension.length > 0) {
"sourceType": "External", dimension.forEach((item, index) => {
"externalSettings": { let tagData = null
"valueMethod": "Sum", if (item.variableType.indexOf('DateTime') > 1) {
"dataSetId": dataSetId, tagData = {
"xAxisFields": [""], name: item.variable,
"filterItems": filterItems layoutSettings: getTimeType(item.level),
}
dataNum += 1
} else {
tagData = {
name: item.variable,
valueMethod: "Sum"
}
}
variables.splice(index, 0, tagData)
})
if (dataNum <= 0) {
variables.unshift({
"name": newDataValue.variable,
"layoutSettings": layoutSettings
})
}
} else {
variables.unshift({
"name": newDataValue.variable,
"layoutSettings": layoutSettings
})
}
getData1 = {
"variables": variables,
"sourceType": "External",
"layoutSettings": layoutSettings,
"externalSettings": {
"dataSetId": dataSetId
}
}
} else {
getData = {
"filterControls": filterControls,
"variables": variablesList,
"layoutSettings": "Second",
"skipTime": false,
"sourceType": "External",
"externalSettings": {
"valueMethod": "Sum",
"dataSetId": dataSetId,
"xAxisFields": [""],
"filterItems": filterItems
}
} }
} }
} }
if (!getData) return if (getData) {
// this.tableLoading = true this.$api.getQueryMulitySource(getData).then(res => {
this.$api.getQueryMulitySource(getData).then(res => { let data = res.data
let data = res.data if (!data || !Object.keys(data).length) return
// this.tableLoading = false if (dataset.dataType === this.$store.state.dataType[1]) {
if (!data) return this.calculateHistoryData(data)
if (dataset.dataType === this.$store.state.dataType[1]) { } else if (dataset.dataType === this.$store.state.dataType[2]) {
this.calculateHistoryData(data) this.calculateStatisticData(data)
} else if (dataset.dataType === this.$store.state.dataType[2]) { } else if (dataset.dataType === this.$store.state.dataType[3]) {
this.calculateStatisticData(data) this.calculateExternalData(data)
} else if (dataset.dataType === this.$store.state.dataType[3]) { }
this.calculateExternalData(data)
} }).catch(err => {})
}).catch(err => {}) }
if (getData1) {
this.$api.getNewest(getData1).then(res => {
let data = res.data
// console.log(res.data)
if (!data || !Object.keys(data).length) return
if (dataset.dataType === this.$store.state.dataType[1]) {
this.calculateHistoryData(data, 'newData')
} else if (dataset.dataType === this.$store.state.dataType[2]) {
this.calculateStatisticData(data, 'newData')
} else if (dataset.dataType === this.$store.state.dataType[3]) {
this.calculateExternalData(data, 'newData')
}
})
}
}, },
//集合外部数据 //集合外部数据
calculateExternalData(data) { calculateExternalData(data, type) {
// console.log(data)
this.tableData = [] this.tableData = []
this.columnData = [] this.columnData = []
let len = 0 let len = 0
for (let key in data) { if (type == 'newData') {
if (len <= data[key].length) { len = 1
len = data[key].length let tableData1 = []
let dataSum = 0
let row = 0
// for(let key in item){
// if(isNumber(item[key])){
// row += 1
// dataSum += Number(item[key])
// }
// tableData1.push(item[key])
// }
for (let i = 0; i < this.variables1.length; i++) {
let item = data[i]
for (let key in item) {
if (isNumber(item[key])) {
row += 1
dataSum += Number(item[key])
}
tableData1.push(item[key])
}
} }
} if (this.rowSummary.isShow) { //显示行统计
if (this.numerical) {
if (this.rowSummary.type == 'total') {
tableData1.push(dataSum.toFixed(this.decimal))
} else {
tableData1.push((dataSum / row).toFixed(this.decimal))
}
}
this.tableData.push(tableData1)
this.getColumnSummary(len)
} else {
for (let key in data) {
if (len <= data[key].length) {
len = data[key].length
}
}
if (!this.numerical) return
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
let tableData1 = [] let tableData1 = []
let dataSum = 0 let dataSum = 0
...@@ -448,7 +529,7 @@ ...@@ -448,7 +529,7 @@
// } // }
this.variables1.forEach(item => { this.variables1.forEach(item => {
if (data[item]) { if (data[item]) {
if (Number(data[item][i]) || Number(data[item][i]) == 0) { if (isNumber(data[item][i])) {
// console.log(JSON.stringify(Number(data[key][i]))) // console.log(JSON.stringify(Number(data[key][i])))
row += 1 row += 1
dataSum += Number(data[item][i]) dataSum += Number(data[item][i])
...@@ -469,27 +550,29 @@ ...@@ -469,27 +550,29 @@
// console.log(tableData1) // console.log(tableData1)
} }
this.getColumnSummary(len) this.getColumnSummary(len)
} }
}, },
//统计历史数据 //统计历史数据
calculateHistoryData(data) { calculateHistoryData(data, type) {
let len = data.RecordXValue.length if (type == 'newData') {
this.tableData = [] let len = 1
this.columnData = [] this.tableData = []
for (let i = 0; i < len; i++) { this.columnData = []
let tableData1 = [] let tableData1 = []
let dataSum = 0 let dataSum = 0
let row = 0 let row = 0
tableData1.push(data[0].Time)
for (let key in data) { for (let key in data) {
if (Number(data[key][i]) || Number(data[key][i]) == 0) { if (Number(data[key].Value) || Number(data[key].Value) == 0) {
// console.log(JSON.stringify(Number(data[key][i]))) // console.log(JSON.stringify(Number(data[key][i])))
row += 1 row += 1
dataSum += Number(data[key][i]) dataSum += Number(data[key].Value)
} }
tableData1.push(data[key][i]) tableData1.push(data[key].Value)
} }
if (this.rowSummary.isShow) { //显示行统计 if (this.rowSummary.isShow) {
if (this.rowSummary.type == 'total') { if (this.rowSummary.type == 'total') {
tableData1.push(dataSum.toFixed(this.decimal)) tableData1.push(dataSum.toFixed(this.decimal))
} else { } else {
...@@ -497,38 +580,171 @@ ...@@ -497,38 +580,171 @@
} }
} }
this.tableData.push(tableData1) this.tableData.push(tableData1)
this.getColumnSummary(len)
} else {
let len = data.RecordXValue.length
this.tableData = []
this.columnData = []
for (let i = 0; i < len; i++) {
let tableData1 = []
let dataSum = 0
let row = 0
for (let key in data) {
if (isNumber(data[key][i])) {
// console.log(JSON.stringify(Number(data[key][i])))
row += 1
dataSum += Number(data[key][i])
}
tableData1.push(data[key][i])
}
if (this.rowSummary.isShow) { //显示行统计
if (this.rowSummary.type == 'total') {
tableData1.push(dataSum.toFixed(this.decimal))
} else {
tableData1.push((dataSum / row).toFixed(this.decimal))
}
}
this.tableData.push(tableData1)
}
this.getColumnSummary(len)
} }
this.getColumnSummary(len)
}, },
//聚合统计数据 //聚合统计数据
calculateStatisticData(data) { calculateStatisticData(data, type) {
let len = data.RecordXValue.length
let filterConfig = this.componentsData.filterConfig let filterConfig = this.componentsData.filterConfig
let content = filterConfig.list[1].content let content = filterConfig.list[1].content
if (this.tabContent) { if (this.tabContent) {
content = this.tabContent[1].content content = this.tabContent[1].content
} }
let dimension = this.componentConfig.dimension[0] let content1 = filterConfig.list[0].content
let level = dimension.level //展示层级 if (this.tabContent) {
content1 = this.tabContent[0].content
}
let timeType = getTimeType(content1.substr(content1.indexOf(",") + 1))
this.tableData = [] this.tableData = []
this.columnData = [] this.columnData = []
// let contentList = content.split(",")
let contentList = [] let contentList = []
if (content != "" && content != null) { if (content != "" && content != null) {
contentList = content.split(",") contentList = content.split(",")
} }
if (contentList.length > 0 && getTimeType(level) != 'Hour') { //是否有筛选班次 if (type == 'newData') {
contentList.forEach((item1, index1) => { let len = 1
if (contentList.length > 0 && timeType != 'Hour') { //是否有筛选班次
if (data.length <= 0) return
let data1 = data[0]
// for (let key in data1) {
contentList.forEach((item, index) => {
let tableData1 = []
let dataSum = 0
let row = 0
let showDate = 0
data.forEach((item1, index1) => {
if (item1[item]) {
row += 1
dataSum += Number(item1[item])
tableData1.push(item1[item])
showDate += 1
}
})
if (showDate > 0) {
tableData1.unshift(item)
tableData1.unshift(data[0].Time)
if (this.rowSummary.isShow) { //显示行统计
if (this.rowSummary.type == 'total') {
tableData1.push(dataSum.toFixed(this.decimal))
} else {
tableData1.push((dataSum / row).toFixed(this.decimal > 0 ? this
.decimal :
1))
}
}
this.tableData.push(tableData1)
}
})
// }
// for(let key)
this.getColumnSummary(len * contentList.length)
} else {
let tableData1 = []
let dataSum = 0
let row = 0
tableData1.push(data[0].Time)
tableData1.push('')
data.forEach((item, index) => {
row += 1
dataSum += Number(item.Value)
tableData1.push(item.Value)
})
if (this.rowSummary.isShow) { //显示行统计
if (this.rowSummary.type == 'total') {
tableData1.push(dataSum.toFixed(this.decimal))
} else {
tableData1.push((dataSum / row).toFixed(this.decimal > 0 ? this
.decimal :
1))
}
}
this.tableData.push(tableData1)
this.getColumnSummary(len)
}
} else {
let len = data.RecordXValue.length
if (contentList.length > 0 && timeType != 'Hour') { //是否有筛选班次
contentList.forEach((item1, index1) => {
for (let i = 0; i < len; i++) {
let tableData1 = []
let dataSum = 0
let row = 0
this.variables1.forEach((item2, index) => {
let refName = '$' + item2 + '@' + item1
if (data[refName]) {
if ((Number(data[refName][i]) || Number(data[refName][i]) == 0) &&
data[refName][i]) {
row += 1
dataSum += Number(data[refName][i])
}
tableData1.push(data[refName][i])
}
})
if (tableData1.length > 0) {
tableData1.unshift(item1) //若有班次插入班次名称
tableData1.unshift(data.RecordXValue[i]) //插入时间
if (this.rowSummary.isShow) { //显示行统计
if (this.rowSummary.type == 'total') {
tableData1.push(dataSum.toFixed(this.decimal))
} else {
tableData1.push((dataSum / row).toFixed(this.decimal > 0 ? this
.decimal :
1))
}
}
}
this.tableData.push(tableData1)
}
})
this.getColumnSummary(len * contentList.length)
} else { //无筛选班次
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
let tableData1 = [] let tableData1 = []
let dataSum = 0 let dataSum = 0
let row = 0 let row = 0
this.variables1.forEach((item2, index) => { this.variables1.forEach((item, index) => {
let refName = '$' + item2 + '@' + item1 let refName = item
if (data[refName]) { if (data[refName]) {
if ((Number(data[refName][i]) || Number(data[refName][i]) == 0) && if (isNumber(data[refName][i]) && data[refName][i]) {
data[refName][i]) {
row += 1 row += 1
dataSum += Number(data[refName][i]) dataSum += Number(data[refName][i])
} }
...@@ -537,91 +753,59 @@ ...@@ -537,91 +753,59 @@
}) })
if (tableData1.length > 0) { if (tableData1.length > 0) {
tableData1.unshift(item1) //若有班次插入班次名称 tableData1.unshift(null) //若有班次插入班次名称
tableData1.unshift(data.RecordXValue[i]) //插入时间 tableData1.unshift(data.RecordXValue[i]) //插入时间
if (this.rowSummary.isShow) { //显示行统计 if (this.rowSummary.isShow) { //显示行统计
if (this.rowSummary.type == 'total') { if (this.rowSummary.type == 'total') {
tableData1.push(dataSum.toFixed(this.decimal)) tableData1.push(dataSum)
} else { } else {
tableData1.push((dataSum / row).toFixed(this.decimal > 0 ? this.decimal : tableData1.push((dataSum / row).toFixed(this.decimal > 0 ? this.decimal : 1))
1))
} }
} }
} }
this.tableData.push(tableData1) this.tableData.push(tableData1)
} }
}) this.getColumnSummary(len)
this.getColumnSummary(len * contentList.length)
} else { //无筛选班次
for (let i = 0; i < len; i++) {
let tableData1 = []
let dataSum = 0
let row = 0
this.variables1.forEach((item, index) => {
let refName = item
if (data[refName]) {
if ((Number(data[refName][i]) || Number(data[refName][i]) == 0) && data[refName][
i
]) {
row += 1
dataSum += Number(data[refName][i])
}
tableData1.push(data[refName][i])
}
})
if (tableData1.length > 0) {
tableData1.unshift(null) //若有班次插入班次名称
tableData1.unshift(data.RecordXValue[i]) //插入时间
if (this.rowSummary.isShow) { //显示行统计
if (this.rowSummary.type == 'total') {
tableData1.push(dataSum)
} else {
tableData1.push((dataSum / row).toFixed(this.decimal > 0 ? this.decimal : 1))
}
}
}
this.tableData.push(tableData1)
} }
this.getColumnSummary(len)
} }
}, },
//统计表格列 //统计表格列
getColumnSummary(len) { getColumnSummary(len) {
if (this.columnSummary.isShow) { //显示列统计 if (this.columnSummary.isShow) { //显示列统计
// console.log(len) // console.log(len)
let columnLen = this.tableData[0].length let columnLen = this.tableData[0].length
let tableData = this.tableData let tableData = this.tableData
// console.log(columnLen)
for (let i = 0; i < columnLen; i++) { for (let i = 0; i < columnLen; i++) {
let columnSum = null let columnSum = null
let numberAvg = 0 let numberAvg = 0
for (let j = 0; j < len; j++) { for (let j = 0; j < len; j++) {
if (Number(tableData[j][i]) || Number(tableData[j][i]) == 0) { if (!tableData[j]) break;
var a = tableData[j][i];
if (isNumber(a)) {
numberAvg += 1 numberAvg += 1
columnSum += Number(tableData[j][i]) columnSum += Number(a)
} }
} }
// console.log(columnSum) // console.log(columnSum)
if (this.columnSummary.type == 'total') { if (this.columnSummary.type == 'total') {
let columnAvg = null let columnAvg = null
if (columnSum || columnSum == 0) { if (isNumber(columnSum)) {
columnAvg = Number(columnSum).toFixed(this.decimal) columnAvg = Number(columnSum).toFixed(this.decimal)
} }
this.columnData.push(columnAvg) this.columnData.push(columnAvg)
// this.columnData.push(columnSum) // this.columnData.push(columnSum)
} } else {
else {
let columnAvg = null let columnAvg = null
if (columnSum || columnSum == 0) { if (isNumber(columnSum)) {
columnAvg = (columnSum / numberAvg).toFixed(this.decimal > 0 ? this.decimal : 1) columnAvg = (columnSum / numberAvg).toFixed(this.decimal > 0 ? this.decimal : 1)
} }
this.columnData.push(columnAvg) this.columnData.push(columnAvg)
} }
} }
} }
......
...@@ -2,10 +2,11 @@ ...@@ -2,10 +2,11 @@
<template> <template>
<view class="data-conponent-style" :class="'chartPie'+index" style="position: relative;" <view class="data-conponent-style" :class="'chartPie'+index" style="position: relative;"
:style="{'height':styleConfigWidth<=defaultWidth?'300px':'250px'}"> :style="{'height':styleConfigWidth<=defaultWidth?'300px':'250px'}">
<view class="pieTitle"> <view class="pieTitle">
<image src="../../static/img/eChartTitle.png" style="height:21px;width: 21px;vertical-align: middle" mode="aspectFill"></image> <image src="../../static/img/eChartTitle.png" style="height:21px;width: 21px;vertical-align: middle"
<text :style="componentsData.componentConfig.nameFormat">{{pieTitle}}</text> mode="aspectFill"></image>
</view> <text :style="componentsData.componentConfig.nameFormat">{{pieTitle}}</text>
</view>
<view :class="{'widthStyle1':styleConfigWidth>defaultWidth,'widthStyle2':styleConfigWidth<=defaultWidth}"> <view :class="{'widthStyle1':styleConfigWidth>defaultWidth,'widthStyle2':styleConfigWidth<=defaultWidth}">
<qiun-data-charts :echartsApp="true" :echartsH5="true" type="pie" :chartData="chartData2" <qiun-data-charts :echartsApp="true" :echartsH5="true" type="pie" :chartData="chartData2"
...@@ -23,7 +24,8 @@ ...@@ -23,7 +24,8 @@
<view <view
:style="'background-color:'+item.color+';position: absolute;width: 16px;height:16px;border-radius:4px;top:0;margin-top: 3px;'"> :style="'background-color:'+item.color+';position: absolute;width: 16px;height:16px;border-radius:4px;top:0;margin-top: 3px;'">
</view> </view>
<view @longtap="showTips($event,item)" @touchend="stopTooltip" class="text-style33" style="float: left;margin-left: 5px;width: 30%;margin-left: 20px;"> <view @longtap="showTips($event,item)" @touchend="stopTooltip" class="text-style33"
style="float: left;margin-left: 5px;width: 30%;margin-left: 20px;">
<text style="font-size:14px;font-family: PingFang SC;font-weight: 500;color: #000000;"> <text style="font-size:14px;font-family: PingFang SC;font-weight: 500;color: #000000;">
{{item.name}} {{item.name}}
</text> </text>
...@@ -46,9 +48,8 @@ ...@@ -46,9 +48,8 @@
</view> </view>
<!-- <view v-show="isTooltip"> --> <!-- <view v-show="isTooltip"> -->
<my-tooltip v-show="isTooltip" :text="tooltipText" :topNum="topNum" :heightNum="heightNum" :leftNum="leftNum"></my-tooltip> <my-tooltip v-show="isTooltip" :text="tooltipText" :topNum="topNum" :heightNum="heightNum" :leftNum="leftNum">
</view> </my-tooltip>
</view> </view>
</template> </template>
...@@ -63,8 +64,13 @@ ...@@ -63,8 +64,13 @@
avgNumber, avgNumber,
getMaxOrMin, getMaxOrMin,
getSameStrName, getSameStrName,
getBoxShadow getBoxShadow,
isNumber
} from '../../js/tool.js' } from '../../js/tool.js'
import {
historyApiData,
statisticApiData
} from '../../js/data.js'
export default { export default {
props: { props: {
componentsData: { componentsData: {
...@@ -107,12 +113,12 @@ ...@@ -107,12 +113,12 @@
dimensionField: null, //维度字段 dimensionField: null, //维度字段
styleConfigWidth: '100%', styleConfigWidth: '100%',
defaultWidth: 320, defaultWidth: 320,
isTooltip:false, isTooltip: false,
topNum:0, topNum: 0,
leftNum:0, leftNum: 0,
heightNum:20, heightNum: 20,
tooltipText:'' tooltipText: ''
} }
}, },
...@@ -122,25 +128,25 @@ ...@@ -122,25 +128,25 @@
}, },
methods: { methods: {
//关闭气泡窗 //关闭气泡窗
stopTooltip(){ stopTooltip() {
this.isTooltip = false this.isTooltip = false
}, },
//显示名称 //显示名称
showTips(e,item){ showTips(e, item) {
if(e.type == 'longpress'){ if (e.type == 'longpress') {
let lenHeight = item.name.length/4*14 let lenHeight = item.name.length / 4 * 14
this.isTooltip = true this.isTooltip = true
this.heightNum = lenHeight this.heightNum = lenHeight
let changedTouche = e.changedTouches[0] let changedTouche = e.changedTouches[0]
let target = e.target let target = e.target
let clientX = changedTouche.clientX-target.offsetLeft-50 let clientX = changedTouche.clientX - target.offsetLeft - 50
let clientY = changedTouche.clientY-lenHeight-70 let clientY = changedTouche.clientY - lenHeight - 70
this.topNum = clientY this.topNum = 0
this.leftNum = clientX this.leftNum = 0
this.tooltipText = item.name this.tooltipText = item.name
} }
}, },
//历史、统计、外部 //历史、统计、外部
async getHistoryExternalData() { async getHistoryExternalData() {
...@@ -148,6 +154,7 @@ ...@@ -148,6 +154,7 @@
if (this.variables.length <= 0) return //无选择变量不请求 if (this.variables.length <= 0) return //无选择变量不请求
let dataset = this.componentConfig.dataset let dataset = this.componentConfig.dataset
let getData = null let getData = null
let getData1 = null
if (dataset.dataType === this.$store.state.dataType[1]) { //dataset.dataType-历史数据 if (dataset.dataType === this.$store.state.dataType[1]) { //dataset.dataType-历史数据
let filterConfig = this.componentsData.filterConfig let filterConfig = this.componentsData.filterConfig
let dimension = this.componentConfig.dimension[0] let dimension = this.componentConfig.dimension[0]
...@@ -164,8 +171,8 @@ ...@@ -164,8 +171,8 @@
let timeType = getTimeType(content.substr(content.indexOf(",") + 1)) let timeType = getTimeType(content.substr(content.indexOf(",") + 1))
let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date()) let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date())
let date1 = dateFtt("yyyy-MM-dd hh:mm:ss", new Date()) let date1 = dateFtt("yyyy-MM-dd hh:mm:ss", new Date())
if(timeType != 'Hour' && timeType != 'Second'){ if (timeType != 'Hour' && timeType != 'Second') {
date1 = dateFtt("yyyy-MM-dd", new Date())+' 00:00:00' date1 = dateFtt("yyyy-MM-dd", new Date()) + ' 00:00:00'
} }
let startTime = date let startTime = date
await this.$api.getStartTime(date1, recent, timeType).then(res => { await this.$api.getStartTime(date1, recent, timeType).then(res => {
...@@ -173,31 +180,16 @@ ...@@ -173,31 +180,16 @@
}).catch(err => { }).catch(err => {
console.log(err) console.log(err)
}) })
getData = { if (content.substr(content.indexOf(",") + 1) == '最新') {
"filterControls": [{ // console.log(content.substr(content.indexOf(",") + 1))
"value1": startTime, getData1 = {
"controlType": "AssociateDateTimePicker", "variables": this.variables,
"pickerType": "BeginTime", "sourceType": "History",
"name": "a1"
},
{
"value1": date,
"controlType": "AssociateDateTimePicker",
"pickerType": "EndTime",
"name": "a2"
}
],
"variables": this.variables,
"sourceType": "History",
"layoutSettings": 'Second',
"skipTime": true,
"historySettings": {
"timeType": "Recent",
"valueMethod": "Origin",
"xAxisSetting": "Time",
} }
} else {
getData = historyApiData(startTime, date, this.variables, 'Second', true)
} }
if (!getData) return
} else if (dataset.dataType === this.$store.state.dataType[2]) { //dataset.dataType-统计数据 } else if (dataset.dataType === this.$store.state.dataType[2]) { //dataset.dataType-统计数据
let filterConfig = this.componentsData.filterConfig let filterConfig = this.componentsData.filterConfig
let content1 = filterConfig.list[0].content let content1 = filterConfig.list[0].content
...@@ -208,8 +200,8 @@ ...@@ -208,8 +200,8 @@
let timeType = getTimeType(content1.substr(content1.indexOf(",") + 1)) let timeType = getTimeType(content1.substr(content1.indexOf(",") + 1))
let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date()) let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date())
let date1 = dateFtt("yyyy-MM-dd hh:mm:ss", new Date()) let date1 = dateFtt("yyyy-MM-dd hh:mm:ss", new Date())
if(timeType != 'Hour' && timeType != 'Second'){ if (timeType != 'Hour' && timeType != 'Second') {
date1 = dateFtt("yyyy-MM-dd", new Date())+' 00:00:00' date1 = dateFtt("yyyy-MM-dd", new Date()) + ' 00:00:00'
} }
let startTime = date let startTime = date
await this.$api.getStartTime(date1, recent, timeType).then(res => { await this.$api.getStartTime(date1, recent, timeType).then(res => {
...@@ -217,32 +209,18 @@ ...@@ -217,32 +209,18 @@
}).catch(err => { }).catch(err => {
console.log(err) console.log(err)
}) })
getData = { if (content1.substr(content1.indexOf(",") + 1) == '最新') {
"filterControls": [{ getData1 = {
"value1": startTime, "variables": this.variables,
"controlType": "AssociateDateTimePicker", "sourceType": "Statistic",
"pickerType": "BeginTime", "statisticsSettings": {
"name": "a1" "timeSetting": "Hour",
},
{
"value1": date,
"controlType": "AssociateDateTimePicker",
"pickerType": "EndTime",
"name": "a2"
} }
],
"variables": this.variables,
"layoutSettings": "Second",
"skipTime": true,
"sourceType": "Statistic",
"statisticsSettings": {
"shiftName": "AAA",
"valueMethod": "Origin",
"xAxisSetting": "Time",
"timeSetting": "Hour",
"shiftsType": "All"
} }
} else {
getData = statisticApiData(startTime, date, this.variables, 'Second', true, 'Hour')
} }
} else if (dataset.dataType === this.$store.state.dataType[3]) { //dataset.dataType-外部数据 } else if (dataset.dataType === this.$store.state.dataType[3]) { //dataset.dataType-外部数据
let filterConfig = this.componentsData.filterConfig let filterConfig = this.componentsData.filterConfig
let contentList = filterConfig.list let contentList = filterConfig.list
...@@ -250,10 +228,12 @@ ...@@ -250,10 +228,12 @@
let dimensionField = this.dimensionField let dimensionField = this.dimensionField
let dimension = this.dimension let dimension = this.dimension
let variableList = JSON.parse(JSON.stringify(this.variables)) let variableList = JSON.parse(JSON.stringify(this.variables))
let skipTime = true let skipTime = false
let newDataType = 0
let newDataValue = null
if (dimensionField && dimension.length > 0) { if (dimensionField && dimension.length > 0) {
// console.log(dimension) // console.log(dimension)
skipTime = false // skipTime = false
variableList.unshift({ variableList.unshift({
"name": dimensionField, "name": dimensionField,
layoutSettings: "Day" layoutSettings: "Day"
...@@ -268,7 +248,11 @@ ...@@ -268,7 +248,11 @@
for (let i = 0; i < contentList.length; i++) { for (let i = 0; i < contentList.length; i++) {
let item = contentList[i] let item = contentList[i]
let content = item.content let content = item.content
if (item.type == '时间日期') { if (item.type == '时间日期' && item.variable != '') {
if (content.substr(content.indexOf(",") + 1) == '最新') {
newDataType += 1
newDataValue = item
}
let recent = Number(content.substr(0, content.indexOf(","))) let recent = Number(content.substr(0, content.indexOf(",")))
let timeType = getTimeType(content.substr(content.indexOf(",") + 1)) let timeType = getTimeType(content.substr(content.indexOf(",") + 1))
let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date()) let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date())
...@@ -330,39 +314,80 @@ ...@@ -330,39 +314,80 @@
} }
} }
let dataSetId = dataset.externalDataId let dataSetId = dataset.externalDataId
getData = { if (newDataType > 0) {
"filterControls": filterControls, let variables = JSON.parse(JSON.stringify(this.variables))
"variables": variableList, if (dimensionField && dimension.length > 0) {
"layoutSettings": "Second", variables.unshift({
"skipTime": skipTime, "name": newDataValue.variable,
"sourceType": "External", "layoutSettings": "Day"
"externalSettings": { })
"valueMethod": "Sum", variables.unshift({
"dataSetId": dataSetId, "name": dimensionField,
"xAxisFields": [""], "valueMethod": "Sum"
"filterItems": filterItems })
// variables = variableList
} else {
variables.push({
"name": newDataValue.variable,
"layoutSettings": "Day"
})
}
getData1 = {
"variables": variables,
"sourceType": "External",
"externalSettings": {
"dataSetId": dataSetId
}
}
} else {
getData = {
"filterControls": filterControls,
"variables": variableList,
"layoutSettings": "Second",
"skipTime": skipTime,
"sourceType": "External",
"externalSettings": {
"valueMethod": "Sum",
"dataSetId": dataSetId,
"xAxisFields": [""],
"filterItems": filterItems
}
} }
} }
} }
if (!getData) return if (getData) {
this.$api.getQueryMulitySource(getData).then(res => { this.$api.getQueryMulitySource(getData).then(res => {
let data = res.data let data = res.data
if (!data) return if (!data || !Object.keys(data).length) return
if (dataset.dataType === this.$store.state.dataType[1]) { if (dataset.dataType === this.$store.state.dataType[1]) {
this.calculateHistoryData(data) this.calculateHistoryData(data)
} else if (dataset.dataType === this.$store.state.dataType[2]) { } else if (dataset.dataType === this.$store.state.dataType[2]) {
this.calculateStatisticData(data) this.calculateStatisticData(data)
} else if (dataset.dataType === this.$store.state.dataType[3]) { } else if (dataset.dataType === this.$store.state.dataType[3]) {
this.calculateExternalData(data) this.calculateExternalData(data)
} }
}).catch(err => {})
}).catch(err => {})
}
if (getData1) {
this.$api.getNewest(getData1).then(res => {
let data = res.data
// console.log(res.data)
if (!data || !Object.keys(data).length) return
if (dataset.dataType === this.$store.state.dataType[1]) {
this.calculateHistoryData(data, 'newData')
} else if (dataset.dataType === this.$store.state.dataType[2]) {
this.calculateStatisticData(data, 'newData')
} else if (dataset.dataType === this.$store.state.dataType[3]) {
this.calculateExternalData(data, 'newData')
}
})
}
}, },
//集合外部数据 //集合外部数据
calculateExternalData(data) { calculateExternalData(data, type) {
if (!this.numerical) return if (!this.numerical) return
this.$nextTick(function() { this.$nextTick(function() {
this.chartData = { this.chartData = {
...@@ -372,9 +397,7 @@ ...@@ -372,9 +397,7 @@
series: [] series: []
} }
let seriesData2 = [] let seriesData2 = []
// console.log(this.variables1)
if (this.variables1.length <= 0) { if (this.variables1.length <= 0) {
// console.log(this.variables1)
this.numerical.forEach(item => { this.numerical.forEach(item => {
seriesData2.push({ seriesData2.push({
value: 0, value: 0,
...@@ -387,27 +410,46 @@ ...@@ -387,27 +410,46 @@
}) })
} }
let dimension = this.componentConfig.dimension let dimension = this.componentConfig.dimension
// let seriesData2 = []
this.valueSum = 0 this.valueSum = 0
this.variables1.forEach((item2, index) => { this.variables1.forEach((item2, index) => {
let item = this.numerical[index] let item = this.numerical[index]
if (data[item2]) { if (type == 'newData') {
this.valueSum += Number(data[item2][0]) // console.log(data[index][item.variable])
if (isNumber(data[index][item.variable])) {
this.valueSum += Number(data[index][item.variable])
}
seriesData2.push({ seriesData2.push({
value: Number(data[item2][0]) >= 0 ? data[item2][0] : null,
name: item.name,
itemStyle: { itemStyle: {
color: item.color color: item.color
} },
value: isNumber(data[index][item.variable]) ? data[index][item
.variable
] : null,
name: item.name,
}) })
this.$set(this.numerical[index], 'value', data[item2][0]) this.$set(this.numerical[index], 'value', data[index][item.variable])
} else {
if (data[item2]) {
this.valueSum += Number(data[item2][0])
seriesData2.push({
itemStyle: {
color: item.color
},
value: Number(data[item2][0]) >= 0 ? data[item2][0] : null,
name: item.name,
})
this.$set(this.numerical[index], 'value', data[item2][0])
}
} }
}) })
if (dimension.length > 0) { if (dimension.length > 0) {
// console.log(this.variables1[0]) // console.log(data)
seriesData2 = [] seriesData2 = []
for (let i = 0; i < dimension.length; i++) { for (let i = 0; i < dimension.length; i++) {
let item = dimension[i] let item = dimension[i]
let dimensionText = data[this.dimensionField] let dimensionText = data[this.dimensionField]
...@@ -424,18 +466,33 @@ ...@@ -424,18 +466,33 @@
} }
}) })
for (let key = 0; key < dimensionText.length; key++) {
if (item.typeName === dimensionText[key]) { if (type == 'newData') {
seriesData2[i].value = data[this.variables1[0]][key] this.valueSum = null
numerical.value = data[this.variables1[0]][key] let item = seriesData2[i]
let key = data[0][this.dimensionField]
if (key === item.name) {
// console.log(this.variables[0].name)
this.valueSum += Number(data[2][this.variables[0].name])
seriesData2[i].value = data[2][this.variables[0].name]
numerical.value = data[2][this.variables[0].name]
}
} else {
for (let key = 0; key < dimensionText.length; key++) {
if (item.typeName === dimensionText[key]) {
seriesData2[i].value = data[this.variables1[0]][key]
numerical.value = data[this.variables1[0]][key]
}
// break
} }
// break
} }
this.$set(this.numerical, i, numerical) this.$set(this.numerical, i, numerical)
} }
} }
this.seriesData.data = seriesData2 this.seriesData.data = seriesData2
this.seriesData2.data = seriesData2 this.seriesData2.data = seriesData2
this.chartData.series.push(this.seriesData) this.chartData.series.push(this.seriesData)
...@@ -443,7 +500,9 @@ ...@@ -443,7 +500,9 @@
}) })
}, },
//统计历史数据 //统计历史数据
calculateHistoryData(data) { calculateHistoryData(data, type) {
// console.log(333)
// console.log(data)
if (!this.numerical) return if (!this.numerical) return
this.$nextTick(function() { this.$nextTick(function() {
this.chartData = { this.chartData = {
...@@ -456,20 +515,35 @@ ...@@ -456,20 +515,35 @@
this.valueSum = 0 this.valueSum = 0
this.variables1.forEach((item2, index) => { this.variables1.forEach((item2, index) => {
let item = this.numerical[index] let item = this.numerical[index]
if (data[item2]) { if (type == 'newData') {
this.valueSum += Number(data[item2][0]) this.valueSum += Number(data[index].Value)
seriesData2.push({ seriesData2.push({
itemStyle: { itemStyle: {
color: item.color color: item.color
}, },
value: Number(data[item2][0]) >= 0 ? data[item2][0] : null, value: Number(data[index].Value) >= 0 ? data[index].Value : null,
name: item.name, name: item.name,
}) })
this.$set(this.numerical[index], 'value', data[item2][0]) this.$set(this.numerical[index], 'value', data[index].Value)
} else {
if (data[item2]) {
this.valueSum += Number(data[item2][0])
seriesData2.push({
itemStyle: {
color: item.color
},
value: Number(data[item2][0]) >= 0 ? data[item2][0] : null,
name: item.name,
})
this.$set(this.numerical[index], 'value', data[item2][0])
}
} }
}) })
// console.log(seriesData2)
this.seriesData.data = seriesData2 this.seriesData.data = seriesData2
this.seriesData2.data = seriesData2 this.seriesData2.data = seriesData2
this.chartData.series.push(this.seriesData) this.chartData.series.push(this.seriesData)
...@@ -477,7 +551,7 @@ ...@@ -477,7 +551,7 @@
}) })
}, },
//聚合统计数据 //聚合统计数据
calculateStatisticData(data) { calculateStatisticData(data, type) {
let filterConfig = this.componentsData.filterConfig let filterConfig = this.componentsData.filterConfig
let content = filterConfig.list[1].content let content = filterConfig.list[1].content
if (this.tabContent) { if (this.tabContent) {
...@@ -529,10 +603,15 @@ ...@@ -529,10 +603,15 @@
// value = data[item2][0] // value = data[item2][0]
// } // }
// } // }
if (data[item2]) { // if (data[item2]) {
value = data[item2][0] // value = data[item2][0]
} // }
if (type == 'newData') {
value = data[index].Value
} else {
value = data[item2][0]
}
this.valueSum += Number(value) this.valueSum += Number(value)
...@@ -613,7 +692,7 @@ ...@@ -613,7 +692,7 @@
styleConfig.margin = arrayToString(styleConfig.margin) styleConfig.margin = arrayToString(styleConfig.margin)
styleConfig.padding = arrayToString(styleConfig.padding) styleConfig.padding = arrayToString(styleConfig.padding)
styleConfig.borderRadius = arrayToString(styleConfig.borderRadius) styleConfig.borderRadius = arrayToString(styleConfig.borderRadius)
styleConfig.boxShadow = getBoxShadow(styleConfig.boxShadow) // styleConfig.boxShadow = getBoxShadow(styleConfig.boxShadow)
let componentConfig = item.componentConfig let componentConfig = item.componentConfig
// this.styleConfigWidth = parseFloat(styleConfig.width) // this.styleConfigWidth = parseFloat(styleConfig.width)
// console.log(this.styleConfigWidth) // console.log(this.styleConfigWidth)
...@@ -647,8 +726,8 @@ ...@@ -647,8 +726,8 @@
}) })
// let variables2 = this.variables1 // let variables2 = this.variables1
let num = getSameStrName(item.variable, this.variables1) let num = getSameStrName(item.variable, this.variables1)
if(this.dimensionField == item.variable && this.dimension.length>0){ if (this.dimensionField == item.variable && this.dimension.length > 0) {
num +=1 num += 1
} }
if (num) { if (num) {
this.variables1.push(item.variable + '_' + num) this.variables1.push(item.variable + '_' + num)
...@@ -698,7 +777,7 @@ ...@@ -698,7 +777,7 @@
// backgroundColor: { // backgroundColor: {
// image: '../../static/img/eChartTitle.png' // image: '../../static/img/eChartTitle.png'
// }, // },
// } // }
// } // }
// }, // },
...@@ -803,7 +882,7 @@ ...@@ -803,7 +882,7 @@
height: 100%; height: 100%;
position: absolute; position: absolute;
right: 0; right: 0;
top:0 top: 0
} }
.widthStyle4 { .widthStyle4 {
...@@ -813,7 +892,8 @@ ...@@ -813,7 +892,8 @@
// left: 0; // left: 0;
top: 180px top: 180px
} }
.pieTitle{
.pieTitle {
// position: absolute; // position: absolute;
z-index: 1; z-index: 1;
width: 100%; width: 100%;
......
<!-- 这是进度条控件 --> <!-- 这是进度条控件 -->
<template> <template>
<view :class="'ProgressBar'+index"> <view :class="'ProgressBar'+index">
<view v-for="(item,index) in numerical" :key="index" style="padding: 10px 0;"> <view v-for="(item,index) in numerical" :key="index" style="padding: 10px 0;">
<view style="overflow:hidden;padding:0 0 5px 0;"> <view style="overflow:hidden;padding:0 0 5px 0;">
<view :style="componentsData.componentConfig.nameFormat" <view :style="componentsData.componentConfig.nameFormat"
style="float: left;margin-left:5%;text-align: center;max-width: 30%;" class="text-style33">{{item.name}}</view> style="float: left;margin-left:5%;text-align: center;max-width: 30%;" class="text-style33">
{{item.name}}
<view :style="componentsData.componentConfig.numericalFormat"
style="float: right; text-align: center;margin-right: 5%;">{{item.value}}</view>
</view> </view>
<view style="height:8px;width: 90%;margin-left: 5%;position: relative;">
<view <view :style="componentsData.componentConfig.numericalFormat"
style="height:8px;position: relative;background-color: #EAF0FD;width: 100%;border-radius: 4px;overflow: hidden"> style="float: right; text-align: center;margin-right: 5%;">{{item.value}}</view>
<view style="height: 100%;position: absolute;border-radius: 4px;" </view>
:style="'width:'+(Number(item.value)/item.numericalUp<=1?Number(item.value)/item.numericalUp:1)*100+'%;background:-webkit-linear-gradient(left,'+startColor+' 0%,'+endColor+' 100%);'"> <view style="height:8px;width: 90%;margin-left: 5%;position: relative;">
</view> <view
style="height:8px;position: relative;background-color: #EAF0FD;width: 100%;border-radius: 4px;overflow: hidden">
<view style="height: 100%;position: absolute;border-radius: 4px;"
:style="'width:'+(Number(item.value)/item.numericalUp<=1?Number(item.value)/item.numericalUp:1)*100+'%;background:-webkit-linear-gradient(left,'+startColor+' 0%,'+endColor+' 100%);'">
</view> </view>
<view v-if="progress.show" :style="'position: absolute;top:-20px;width:100%;text-align:center'"> </view>
<view :style="'color:'+endColor+';font-size: 14px;font-weight: 800'"> <view v-if="progress.show" :style="'position: absolute;top:-20px;width:100%;text-align:center'">
{{progress.type == 'numerical'?item.value+'/'+item.numericalUp:(Number(item.value)/item.numericalUp*100).toFixed(decimal>0?decimal:1)+'%'}} <view :style="'color:'+endColor+';font-size: 14px;font-weight: 800'">
</view> {{progress.type == 'numerical'?item.value+'/'+item.numericalUp:(Number(item.value)/item.numericalUp*100).toFixed(decimal>0?decimal:1)+'%'}}
</view> </view>
</view> </view>
</view>
</view>
</view> </view>
</view>
</template> </template>
<script> <script>
...@@ -41,6 +43,10 @@ ...@@ -41,6 +43,10 @@
getSameStrName, getSameStrName,
getBoxShadow getBoxShadow
} from '../../js/tool.js' } from '../../js/tool.js'
import {
historyApiData,
statisticApiData
} from '../../js/data.js'
export default { export default {
name: 'ProgressBar', name: 'ProgressBar',
// props: ['componentsData', 'index'], // props: ['componentsData', 'index'],
...@@ -103,7 +109,7 @@ ...@@ -103,7 +109,7 @@
styleConfig.margin = arrayToString(styleConfig.margin) styleConfig.margin = arrayToString(styleConfig.margin)
styleConfig.padding = arrayToString(styleConfig.padding) styleConfig.padding = arrayToString(styleConfig.padding)
styleConfig.borderRadius = arrayToString(styleConfig.borderRadius) styleConfig.borderRadius = arrayToString(styleConfig.borderRadius)
styleConfig.boxShadow = getBoxShadow(styleConfig.boxShadow) // styleConfig.boxShadow = getBoxShadow(styleConfig.boxShadow)
let componentConfig = this.componentsData.componentConfig let componentConfig = this.componentsData.componentConfig
this.progress = componentConfig.progress this.progress = componentConfig.progress
this.numerical = componentConfig.numerical this.numerical = componentConfig.numerical
...@@ -114,34 +120,31 @@ ...@@ -114,34 +120,31 @@
this.componentConfig = componentConfig this.componentConfig = componentConfig
this.variables = [] this.variables = []
this.variables1 = [] this.variables1 = []
// if (this.numerical) { for (let i = 0; i < this.numerical.length; i++) {
// this.numerical.forEach(item => { let item = this.numerical[i]
for(let i = 0;i<this.numerical.length;i++){ if (!item.variable) break
let item = this.numerical[i] this.variables.push({
if(!item.variable) break "name": item.variable,
this.variables.push({ "digit": this.decimal,
"name": item.variable, "valueMethod": getCalculateData(item.statistical)
"digit": this.decimal, })
"valueMethod": getCalculateData(item.statistical) let num = getSameStrName(item.variable, this.variables1) //判断是否有相同变量
}) if (num) {
let num = getSameStrName(item.variable, this.variables1) //判断是否有相同变量 this.variables1.push(item.variable + '_' + num)
if (num) { } else {
this.variables1.push(item.variable + '_' + num) this.variables1.push(item.variable)
} else { }
this.variables1.push(item.variable) }
}
}
// })
// }
this.styleConfigList.push(styleConfig) this.styleConfigList.push(styleConfig)
this.componentList.push(item) this.componentList.push(item)
}, },
//历史、统计、外部 //历史、统计、外部
async getHistoryExternalData() { async getHistoryExternalData() {
if (!this.componentConfig) return if (!this.componentConfig) return
if(this.variables.length <= 0) return //无选择变量不请求 if (this.variables.length <= 0) return //无选择变量不请求
let dataset = this.componentConfig.dataset let dataset = this.componentConfig.dataset
let getData = null let getData = null
let getData1 = null
if (dataset.dataType === this.$store.state.dataType[1]) { if (dataset.dataType === this.$store.state.dataType[1]) {
let filterConfig = this.componentsData.filterConfig let filterConfig = this.componentsData.filterConfig
let content = filterConfig.list[0].content let content = filterConfig.list[0].content
...@@ -156,8 +159,8 @@ ...@@ -156,8 +159,8 @@
let timeType = getTimeType(content.substr(content.indexOf(",") + 1)) let timeType = getTimeType(content.substr(content.indexOf(",") + 1))
let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date()) let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date())
let date1 = dateFtt("yyyy-MM-dd hh:mm:ss", new Date()) let date1 = dateFtt("yyyy-MM-dd hh:mm:ss", new Date())
if(timeType != 'Hour' && timeType != 'Second'){ if (timeType != 'Hour' && timeType != 'Second') {
date1 = dateFtt("yyyy-MM-dd", new Date())+' 00:00:00' date1 = dateFtt("yyyy-MM-dd", new Date()) + ' 00:00:00'
} }
let startTime = date let startTime = date
await this.$api.getStartTime(date1, recent, timeType).then(res => { await this.$api.getStartTime(date1, recent, timeType).then(res => {
...@@ -165,31 +168,18 @@ ...@@ -165,31 +168,18 @@
}).catch(err => { }).catch(err => {
console.log(err) console.log(err)
}) })
getData = { if (content.substr(content.indexOf(",") + 1) == '最新') {
"filterControls": [{ // console.log(content.substr(content.indexOf(",") + 1))
"value1": startTime, getData1 = {
"controlType": "AssociateDateTimePicker", "variables": this.variables,
"pickerType": "BeginTime", "sourceType": "History",
"name": "a1"
},
{
"value1": date,
"controlType": "AssociateDateTimePicker",
"pickerType": "EndTime",
"name": "a2"
}
],
"variables": this.variables,
"sourceType": "History",
"layoutSettings": 'Second',
"skipTime": true,
"historySettings": {
"timeType": "Recent",
"valueMethod": "Origin",
"xAxisSetting": "Time",
} }
} else {
getData = historyApiData(startTime, date, this.variables, 'Second', true)
} }
} else if (dataset.dataType === this.$store.state.dataType[2]) { } else if (dataset.dataType === this.$store.state.dataType[2]) {
let filterConfig = this.componentsData.filterConfig let filterConfig = this.componentsData.filterConfig
let content1 = filterConfig.list[0].content let content1 = filterConfig.list[0].content
...@@ -200,8 +190,8 @@ ...@@ -200,8 +190,8 @@
let timeType = getTimeType(content1.substr(content1.indexOf(",") + 1)) let timeType = getTimeType(content1.substr(content1.indexOf(",") + 1))
let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date()) let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date())
let date1 = dateFtt("yyyy-MM-dd hh:mm:ss", new Date()) let date1 = dateFtt("yyyy-MM-dd hh:mm:ss", new Date())
if(timeType != 'Hour' && timeType != 'Second'){ if (timeType != 'Hour' && timeType != 'Second') {
date1 = dateFtt("yyyy-MM-dd", new Date())+' 00:00:00' date1 = dateFtt("yyyy-MM-dd", new Date()) + ' 00:00:00'
} }
let startTime = date let startTime = date
await this.$api.getStartTime(date1, recent, timeType).then(res => { await this.$api.getStartTime(date1, recent, timeType).then(res => {
...@@ -210,45 +200,37 @@ ...@@ -210,45 +200,37 @@
}).catch(err => { }).catch(err => {
// console.log(err) // console.log(err)
}) })
getData = { if (content1.substr(content1.indexOf(",") + 1) == '最新') {
"filterControls": [{ getData1 = {
"value1": startTime, "variables": this.variables,
"controlType": "AssociateDateTimePicker", "sourceType": "Statistic",
"pickerType": "BeginTime", "statisticsSettings": {
"name": "a1" "timeSetting": "Hour",
},
{
"value1": date,
"controlType": "AssociateDateTimePicker",
"pickerType": "EndTime",
"name": "a2"
} }
],
"variables": this.variables,
"layoutSettings": "Second",
"skipTime": true,
"sourceType": "Statistic",
"statisticsSettings": {
"shiftName": "AAA",
"valueMethod": "Origin",
"xAxisSetting": "Time",
"timeSetting":"Hour",
"shiftsType": "All"
} }
} else {
getData = statisticApiData(startTime, date, this.variables, 'Second', true, 'Hour')
} }
} else if (dataset.dataType === this.$store.state.dataType[3]) { } else if (dataset.dataType === this.$store.state.dataType[3]) {
let filterConfig = this.componentsData.filterConfig let filterConfig = this.componentsData.filterConfig
let contentList = filterConfig.list let contentList = filterConfig.list
if (this.tabContent) { if (this.tabContent) {
contentList = this.tabContent contentList = this.tabContent
} }
let newDataType = 0
let newDataValue = null
let filterControls = [] //过滤控件组合 let filterControls = [] //过滤控件组合
let filterItems = [] let filterItems = []
for (let i = 0; i < contentList.length; i++) { for (let i = 0; i < contentList.length; i++) {
let item = contentList[i] let item = contentList[i]
let content = item.content let content = item.content
if (item.type == '时间日期') { if (item.type == '时间日期' && item.variable != '') {
if (content.substr(content.indexOf(",") + 1) == '最新') {
newDataType += 1
newDataValue = item
}
let recent = Number(content.substr(0, content.indexOf(","))) let recent = Number(content.substr(0, content.indexOf(",")))
let timeType = getTimeType(content.substr(content.indexOf(",") + 1)) let timeType = getTimeType(content.substr(content.indexOf(",") + 1))
let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date()) let date = dateFtt("yyyy-MM-dd hh:mm:ss", new Date())
...@@ -311,59 +293,109 @@ ...@@ -311,59 +293,109 @@
} }
let dataSetId = dataset.externalDataId let dataSetId = dataset.externalDataId
getData = { if (newDataType > 0) {
"filterControls": filterControls, let variables = JSON.parse(JSON.stringify(this.variables))
"variables": this.variables, variables.push({
"layoutSettings": "Second", "name": newDataValue.variable,
"skipTime": true, "layoutSettings": "Day"
"sourceType": "External", })
"externalSettings": { getData1 = {
"valueMethod": "Sum", "variables": variables,
"dataSetId": dataSetId, "sourceType": "External",
"xAxisFields": [""], "externalSettings": {
"filterItems": filterItems "dataSetId": dataSetId
}
}
} else {
getData = {
"filterControls": filterControls,
"variables": this.variables,
"layoutSettings": "Second",
"skipTime": false,
"sourceType": "External",
"externalSettings": {
"valueMethod": "Sum",
"dataSetId": dataSetId,
"xAxisFields": [""],
"filterItems": filterItems
}
} }
} }
} }
if (!getData) return if (getData) {
this.$api.getQueryMulitySource(getData).then(res => { this.$api.getQueryMulitySource(getData).then(res => {
let data = res.data let data = res.data
if (!data) return if (!data || !Object.keys(data).length) return
if (dataset.dataType === this.$store.state.dataType[1]) { if (dataset.dataType === this.$store.state.dataType[1]) {
this.calculateHistoryData(data) this.calculateHistoryData(data)
} else if (dataset.dataType === this.$store.state.dataType[2]) { } else if (dataset.dataType === this.$store.state.dataType[2]) {
this.calculateStatisticData(data) this.calculateStatisticData(data)
} else if (dataset.dataType === this.$store.state.dataType[3]) { } else if (dataset.dataType === this.$store.state.dataType[3]) {
this.calculateExternalData(data) this.calculateExternalData(data)
} }
}).catch(err => {})
}).catch(err => {})
}
if (getData1) {
this.$api.getNewest(getData1).then(res => {
let data = res.data
// console.log(res.data)
if (!data || !Object.keys(data).length) return
if (dataset.dataType === this.$store.state.dataType[1]) {
this.calculateHistoryData(data, 'newData')
} else if (dataset.dataType === this.$store.state.dataType[2]) {
this.calculateStatisticData(data, 'newData')
} else if (dataset.dataType === this.$store.state.dataType[3]) {
this.calculateExternalData(data, 'newData')
}
})
}
}, },
//集合外部数据 //集合外部数据
calculateExternalData(data) { calculateExternalData(data, type) {
if (this.numerical) { if (this.numerical) {
this.variables1.forEach((item2, index) => { this.variables1.forEach((item2, index) => {
this.$set(this.numerical[index], 'value', data[item2][0]) if (type == 'newData') {
// for (let key in data[0]) {
// if (key == this.numerical[index].variable) {
// this.$set(this.numerical[index], 'value', data[0][key])
// }
// }
this.$set(this.numerical[index], 'value', data[index][this.numerical[index].variable])
} else {
this.$set(this.numerical[index], 'value', data[item2][0])
}
}) })
} }
// if (this.numerical) {
// this.variables1.forEach((item2, index) => {
// this.$set(this.numerical[index], 'value', data[item2][0])
// })
// }
}, },
//统计历史数据 //统计历史数据
calculateHistoryData(data) { calculateHistoryData(data, type) {
if (this.numerical) { if (this.numerical) {
this.numerical.forEach((item, index) => { if (type == 'newData') {
if (data[item.variable + '_' + index]) { this.numerical.forEach((item, index) => {
this.$set(this.numerical[index], 'value', data[item.variable + '_' + index][0]) if (data[index]) {
} else { this.$set(this.numerical[index], 'value', data[index].Value)
if (data[item.variable]) {
this.$set(this.numerical[index], 'value', data[item.variable][0])
} }
}
}) })
} else {
this.variables1.forEach((item2, index) => {
this.$set(this.numerical[index], 'value', data[item2][0])
})
}
} }
}, },
//聚合统计数据 //聚合统计数据
calculateStatisticData(data) { calculateStatisticData(data, type) {
let filterConfig = this.componentsData.filterConfig let filterConfig = this.componentsData.filterConfig
let content = filterConfig.list[1].content let content = filterConfig.list[1].content
if (this.tabContent) { if (this.tabContent) {
...@@ -381,6 +413,11 @@ ...@@ -381,6 +413,11 @@
let item = this.numerical[index] let item = this.numerical[index]
let dataList = [] let dataList = []
let value = null let value = null
if (type == 'newData') {
value = data[index].Value
} else {
value = data[item2][0]
}
// if (contentList.length > 0 && timeType != "Hour" && timeType != "Second") { // if (contentList.length > 0 && timeType != "Hour" && timeType != "Second") {
// contentList.forEach((item1, index1) => { // contentList.forEach((item1, index1) => {
// // let refName = '!' + item.variable + '@' + item1 // // let refName = '!' + item.variable + '@' + item1
...@@ -415,12 +452,12 @@ ...@@ -415,12 +452,12 @@
// if (data[item2]) { // if (data[item2]) {
// value = data[item2][0] // value = data[item2][0]
// } // }
value = data[item2][0] // value = data[item2][0]
// if(data[item.variable + '_' + index]){ // if(data[item.variable + '_' + index]){
// value = data[item.variable + '_' + index][0] // value = data[item.variable + '_' + index][0]
// }else{ // }else{
// value = data[item.variable][0] // value = data[item.variable][0]
// } // }
// } // }
this.$set(this.numerical[index], 'value', value) this.$set(this.numerical[index], 'value', value)
......
<!-- 数据组件-选项卡 --> <!-- 数据组件-选项卡 -->
<template> <template>
<view :class="'tabs'+index"> <view :class="'tabs'+index" style="position: relative;">
<view :class="{'stopTop':stopTop,'data-conponent-style':stopTop}" <view :class="{'stopTop':stopTop,'data-conponent-style':stopTop}"
:style="stopTop?componentsData.styleConfig:''"> :style="stopTop?componentsData.styleConfig:''">
<view :style="{'height':theme=='theme3'?'40px':'auto'}"> <view :style="{'height':theme=='theme3'?'40px':'auto'}">
...@@ -111,28 +111,6 @@ ...@@ -111,28 +111,6 @@
// windowHeight = res.windowHeight // windowHeight = res.windowHeight
windowHeight = res.screenHeight windowHeight = res.screenHeight
// if(detail.y+40>= windowHeight){
// console.log(data.height)
// // let heightNum =data.height+140
// // console.log(heightNum)
// uni.pageScrollTo({
// scrollTop:3000,
// duration: 300
// });
// let obj = uni.createSelectorQuery(_this).select('.mainStyleConfigCalss')
// obj.boundingClientRect(function(data) { // data - 各种参数
// let detail = e.detail
// console.log(detail)
// if(detail.y+40>= windowHeight){
// console.log(data.height)
// // let heightNum =data.height+140
// // console.log(heightNum)
// uni.pageScrollTo({
// scrollTop:3000,
// duration: 300
// });
// }
// }).exec()
} }
}); });
uni.pageScrollTo({ uni.pageScrollTo({
...@@ -152,19 +130,41 @@ ...@@ -152,19 +130,41 @@
this.isTooltip = false this.isTooltip = false
}, },
//显示名称 //显示名称
showTips(e, item) { async showTips(e, item) {
if (e.type == 'longpress') { // console.log(this.componentsData)
let lenHeight = item.name.length / 4 * 14 let _this = this
this.isTooltip = true let windowHeight = 665
this.heightNum = lenHeight await uni.getSystemInfo({
let changedTouche = e.changedTouches[0] success: function (res) {
let target = e.target windowHeight = res.windowHeight
let clientX = changedTouche.clientX - 30
let clientY = changedTouche.clientY - lenHeight - 60 }
this.topNum = clientY });
this.leftNum = clientX await uni.createSelectorQuery().in(this).select(".tabs"+_this.index).boundingClientRect((data) => {
this.tooltipText = item.name console.log(e)
} let dataHeight = data.height
let dataTop = data.top
let dataBottom = data.bottom
if (e.type == 'longpress') {
let lenHeight = item.name.length / 4 * 14
_this.isTooltip = true
_this.heightNum = lenHeight
let changedTouche = e.changedTouches[0]
let target = e.target
let currentTarget = e.currentTarget
let pageY = changedTouche.pageY
let pageX = changedTouche.pageX
_this.topNum = dataHeight+10
if(dataBottom+lenHeight+dataHeight>windowHeight){
_this.topNum = -dataHeight-lenHeight
}
_this.leftNum = changedTouche.clientX-4 * 14
_this.tooltipText = item.name
}
})
.exec();
}, },
//获取组件列表 //获取组件列表
...@@ -177,7 +177,7 @@ ...@@ -177,7 +177,7 @@
styleConfig.margin = arrayToString(styleConfig.margin) styleConfig.margin = arrayToString(styleConfig.margin)
styleConfig.padding = arrayToString(styleConfig.padding) styleConfig.padding = arrayToString(styleConfig.padding)
styleConfig.borderRadius = arrayToString(styleConfig.borderRadius) styleConfig.borderRadius = arrayToString(styleConfig.borderRadius)
styleConfig.boxShadow = getBoxShadow(styleConfig.boxShadow) // styleConfig.boxShadow = getBoxShadow(styleConfig.boxShadow)
// this.$set(this.styleConfig,item.styleConfig) // this.$set(this.styleConfig,item.styleConfig)
// this.styleConfig = { // this.styleConfig = {
// "background-color":styleConfig.backgroundColor, // "background-color":styleConfig.backgroundColor,
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
styleConfig.margin = arrayToString(styleConfig.margin) styleConfig.margin = arrayToString(styleConfig.margin)
styleConfig.padding = arrayToString(styleConfig.padding) styleConfig.padding = arrayToString(styleConfig.padding)
styleConfig.borderRadius = arrayToString(styleConfig.borderRadius) styleConfig.borderRadius = arrayToString(styleConfig.borderRadius)
styleConfig.boxShadow = getBoxShadow(styleConfig.boxShadow) // styleConfig.boxShadow = getBoxShadow(styleConfig.boxShadow)
let componentConfig = item.componentConfig let componentConfig = item.componentConfig
// componentConfig.textContent = componentConfig.textContent.replace(/'↵'/g, '<br/>') // componentConfig.textContent = componentConfig.textContent.replace(/'↵'/g, '<br/>')
this.$set(componentConfig.nameFormat,'textAlign',componentConfig.nameFormat.alignHorizontal) this.$set(componentConfig.nameFormat,'textAlign',componentConfig.nameFormat.alignHorizontal)
......
<!-- 数据页面 --> <!-- 数据页面 -->
<template> <template>
<view class="mainStyleConfigCalss" style="overflow:auto;height: auto;" :style="mainStyleConfig"> <view class="mainStyleConfigCalss" style="overflow:auto;height: auto;" :style="mainStyleConfig">
<view class="data-style data-conponent-style" v-if="isShowCompons" v-for="(item,index) in componentsChildren" :key="index" :style="item.styleConfig"> <view class="data-style data-conponent-style" v-if="isShowCompons" v-for="(item,index) in componentsChildren"
:key="index" :style="item.styleConfig">
<rectangular v-if="item.type == 'rectangular'" :ref="'rectangular'+index" :componentsData="item"> <rectangular v-if="item.type == 'rectangular'" :ref="'rectangular'+index" :componentsData="item">
</rectangular> </rectangular>
<kpi v-if="item.type == 'kpi'" :ref="item.type+index" :componentsData="item" :index="index" imgType="0"></kpi> <kpi v-if="item.type == 'kpi'" :ref="item.type+index" :componentsData="item" :index="index" imgType="0">
<text-item v-if="item.type == 'text'" :ref="item.type+index" :componentsData="item" :index="index"></text-item> </kpi>
<list-item v-if="item.type == 'list'" :ref="item.type+index" :index="index" :componentsData="item"></list-item> <text-item v-if="item.type == 'text'" :ref="item.type+index" :componentsData="item" :index="index">
</text-item>
<list-item v-if="item.type == 'list'" :ref="item.type+index" :index="index" :componentsData="item">
</list-item>
<progress-bar v-if="item.type == 'progressBar'" :ref="item.type+index" :index="index" <progress-bar v-if="item.type == 'progressBar'" :ref="item.type+index" :index="index"
:componentsData="item"></progress-bar> :componentsData="item"></progress-bar>
<pie-echart v-if="item.type == 'chartPie'" :ref="item.type+index" :componentsData="item" :index="index"> <pie-echart v-if="item.type == 'chartPie'" :ref="item.type+index" :componentsData="item" :index="index">
</pie-echart> </pie-echart>
<line-bar-echart v-if="item.type == 'chartLineBar'" :ref="item.type+index" :index="index" <line-bar-echart v-if="item.type == 'chartLineBar'" :ref="item.type+index" :index="index"
:componentsData="item"></line-bar-echart> :componentsData="item"></line-bar-echart>
<banner v-if="item.type == 'banner'" :ref="item.type+index" :componentsData="item" :index="index" :homeViewName="homeViewName" @jump-view="jumpView"></banner> <banner v-if="item.type == 'banner'" :ref="item.type+index" :componentsData="item" :index="index"
<card-list v-if="item.type == 'cardList'" :ref="item.type+index" :index="index" :componentsData="item" @jump-view="jumpView"> :homeViewName="homeViewName" @jump-view="jumpView"></banner>
<card-list v-if="item.type == 'cardList'" :ref="item.type+index" :index="index" :componentsData="item"
@jump-view="jumpView">
</card-list> </card-list>
<tabs v-if="item.type == 'tabs'" :ref="item.type+index" :componentsData="item" :index="index" <tabs v-if="item.type == 'tabs'" :ref="item.type+index" :componentsData="item" :index="index"
@select-tab-fun="selectTabFun" class="tabs-box"></tabs> @select-tab-fun="selectTabFun" class="tabs-box"></tabs>
...@@ -25,12 +31,15 @@ ...@@ -25,12 +31,15 @@
<button @click="test">fhsjsh</button> <button @click="test">fhsjsh</button>
</div> --> </div> -->
</view> </view>
<tips-page v-if="showTips" :text="tipsText"></tips-page>
</view> </view>
</template> </template>
<script> <script>
import { import {
arrayToString,getBoxShadow arrayToString,
getBoxShadow
} from '../../js/tool.js' } from '../../js/tool.js'
import jsonData from '../../js/test.json' import jsonData from '../../js/test.json'
import Rectangular from '../data-conponent/rectangular.vue' import Rectangular from '../data-conponent/rectangular.vue'
...@@ -71,10 +80,12 @@ ...@@ -71,10 +80,12 @@
newTagDataArr: '', //实时变量数据, newTagDataArr: '', //实时变量数据,
tagArr: [], //控件绑定变量集合 tagArr: [], //控件绑定变量集合
timer1: null, //实时定时轮询 timer1: null, //实时定时轮询
timer2:null,//历史,统计、外部轮询 timer2: null, //历史,统计、外部轮询
realTimeList: [], //实时组件列表 realTimeList: [], //实时组件列表
historyExternalList: [], //历史、外部、统计组件列表 historyExternalList: [], //历史、外部、统计组件列表
tabsList:[],//选项卡列表 tabsList: [], //选项卡列表
showTips: false,
tipsText: '暂无数据~'
// children:null // children:null
} }
...@@ -87,24 +98,19 @@ ...@@ -87,24 +98,19 @@
}, },
onResize() { onResize() {
try { try {
const res = uni.getSystemInfoSync(); const res = uni.getSystemInfoSync();
console.log(res.model);
console.log(res.pixelRatio);
console.log(res.windowWidth);
console.log(res.windowHeight);
console.log(res.screenWidth);
console.log(res.screenHeight);
} catch (e) { } catch (e) {
// error // error
} }
this.getViewJson() this.getViewJson()
}, },
methods: { methods: {
//跳转页面 //跳转页面
jumpView(){ jumpView() {
this.eliminateTimer() this.eliminateTimer()
// console.log('主页面') // console.log('主页面')
}, },
...@@ -112,33 +118,37 @@ ...@@ -112,33 +118,37 @@
selectTabFun(dataType, associatedComponent, tabData) { selectTabFun(dataType, associatedComponent, tabData) {
// console.log(tabData) // console.log(tabData)
// if (dataType === '历史数据') { // if (dataType === '历史数据') {
this.$nextTick(function() { this.$nextTick(function() {
let filter = tabData.filter[0] let filter = tabData.filter[0]
let content = filter.content let content = filter.content
if(dataType == this.$store.state.dataType[3] || dataType == this.$store.state.dataType[2]){ if (dataType == this.$store.state.dataType[3] || dataType == this.$store.state.dataType[2]) {
content = tabData.filter content = tabData.filter
} }
this.componentsChildren.forEach((item, index) => { this.componentsChildren.forEach((item, index) => {
for (let i = 0; i < associatedComponent.length; i++) { for (let i = 0; i < associatedComponent.length; i++) {
if (associatedComponent[i].id == item.id) { if (associatedComponent[i].id == item.id) {
let refName = item.type + index let refName = item.type + index
this.$refs[refName][0].tabContent = content this.$refs[refName][0].tabContent = content
this.$refs[refName][0].getHistoryExternalData() this.$refs[refName][0].getHistoryExternalData()
}
} }
}) }
}) })
})
}, },
//获取页面数据 //获取页面数据
getViewJson() { getViewJson() {
let projectInfo = uni.getStorageSync('projectInfo') let projectInfo = uni.getStorageSync('projectInfo')
console.log(JSON.stringify(projectInfo))
this.homeViewName = projectInfo.homeViewName this.homeViewName = projectInfo.homeViewName
if(this.homeViewName.indexOf("\\")>-1){ if (this.homeViewName.indexOf("\\") > -1) {
this.homeViewName =this.homeViewName.substring(this.homeViewName.indexOf("\\")+1); this.homeViewName = this.homeViewName.substring(this.homeViewName.indexOf("\\") + 1);
} }
let homeViewId = projectInfo.homeViewId let homeViewId = projectInfo.homeViewId
if (!homeViewId) {
this.showTips = true
this.tipsText = '页面找不到,请重新刷新喔~'
return
}
this.projectName = projectInfo.projectName this.projectName = projectInfo.projectName
this.tagArr = [] this.tagArr = []
this.realTimeList = [] this.realTimeList = []
...@@ -146,91 +156,107 @@ ...@@ -146,91 +156,107 @@
this.componentsData = null this.componentsData = null
this.componentsChildren = [] this.componentsChildren = []
this.$api.getView(this.projectName, homeViewId).then(res => { this.$api.getView(this.projectName, homeViewId).then(res => {
uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
if (res.data) { if (!res.data) {
// console.log(JSON.stringify(res.data)) this.showTips = true
this.componentsData = res.data this.tipsText = '页面找不到,请重新刷新喔~'
let _this = this return
let realTime = 0 }
let showHistoryExternal = 0 // console.log(JSON.parse(JSON.stringify(res.data)))
if (this.componentsData) { this.componentsData = JSON.parse(JSON.stringify(res.data))
this.componentsChildren = this.componentsData.children let _this = this
let children = this.componentsData.children let realTime = 0
this.realTimeList = [] let showHistoryExternal = 0
for (let i = 0; i < children.length; i++) { if (this.componentsData) {
let componentConfig = children[i].componentConfig this.componentsChildren = this.componentsData.children
let styleConfig = children[i].styleConfig let children = this.componentsData.children
let widthList = JSON.parse(JSON.stringify(styleConfig.margin)) this.realTimeList = []
let width = parseFloat(styleConfig.width)+parseFloat(widthList[1])+parseFloat(widthList[3]) for (let i = 0; i < children.length; i++) {
styleConfig.width = (width>100?parseFloat(styleConfig.width)-(width-100):parseFloat(styleConfig.width))+'%' let componentConfig = children[i].componentConfig
if (componentConfig) { let styleConfig = children[i].styleConfig
if (componentConfig.dataset) { let widthList = JSON.parse(JSON.stringify(styleConfig.margin))
let dataset = componentConfig.dataset let width = parseFloat(styleConfig.width) + parseFloat(widthList[1]) + parseFloat(
if (dataset.dataType == this.$store.state.dataType[0]) { widthList[3]) //获取组件总长度
realTime = 1 styleConfig.width = (width > 100 ? parseFloat(styleConfig.width) - (width - 100) :
let refName = children[i].type + i parseFloat(styleConfig.width)) + '%' //计算组件的宽度
this.realTimeList.push(refName) if (styleConfig.boxShadow.internal && styleConfig.boxShadow.internal) {
} else if(dataset.dataType == this.$store.state.dataType[1] || dataset.dataType == this.$store.state.dataType[2] || dataset.dataType == this.$store.state.dataType[3]){ let internal = getBoxShadow(styleConfig.boxShadow.internal, 'inset')
showHistoryExternal = 1 let external = getBoxShadow(styleConfig.boxShadow.external)
let refName = children[i].type + i styleConfig.boxShadow = internal + ',' + external
this.historyExternalList.push(refName) } else {
} styleConfig.boxShadow = getBoxShadow(styleConfig.boxShadow)
} }
//获取实时数值变量
if (componentConfig.numerical) { // console.log(styleConfig)
let numerical = componentConfig.numerical if (componentConfig) {
numerical.forEach((item, index) => { if (componentConfig.dataset) {
this.tagArr.push(item.variable) let dataset = componentConfig.dataset
}) if (dataset.dataType == this.$store.state.dataType[0]) {
realTime = 1
let refName = children[i].type + i
this.realTimeList.push(refName)
} else if (dataset.dataType == this.$store.state.dataType[1] || dataset
.dataType == this.$store.state.dataType[2] || dataset.dataType == this
.$store.state.dataType[3]) {
showHistoryExternal = 1
let refName = children[i].type + i
this.historyExternalList.push(refName)
} }
} }
if(children[i].type == 'tabs'){ //获取实时数值变量
this.tabsList.push({ if (componentConfig.numerical) {
index:i, let numerical = componentConfig.numerical
name:children[i].type+i numerical.forEach((item, index) => {
this.tagArr.push(item.variable)
}) })
} }
} }
if (children[i].type == 'tabs') {
//设置标题 this.tabsList.push({
// console.log(23) index: i,
uni.setNavigationBarTitle({ name: children[i].type + i
title: _this.componentsData.pageTitle })
});
this.setMainStyle()
//是否要实时轮询
this.eliminateTimer()
if (realTime == 1) {
// let tagArrList =
this.tagArr = [...new Set(this.tagArr)]
this.showTimer = 1
this.postRediusTestFun(this.tagArr)
this.timer1 = setInterval(() => {
this.postRediusTestFun(this.tagArr)
}, 3000)
} }
//是否要定时查询历史、外部数据 }
if (showHistoryExternal == 1) {
//设置标题
// console.log(23)
uni.setNavigationBarTitle({
title: _this.componentsData.pageTitle
});
this.setMainStyle()
//是否要实时轮询
this.eliminateTimer()
if (realTime == 1) {
// let tagArrList =
this.tagArr = [...new Set(this.tagArr)]
this.showTimer = 1
this.postRediusTestFun(this.tagArr)
this.timer1 = setInterval(() => {
this.postRediusTestFun(this.tagArr)
}, 3000)
}
//是否要定时查询历史、外部数据
if (showHistoryExternal == 1) {
this.getHistoryExternal()
this.timer2 = setInterval(() => {
this.getHistoryExternal() this.getHistoryExternal()
this.timer2 = setInterval(() => { }, 6000)
this.getHistoryExternal()
}, 6000)
}
} }
} }
}).catch(err=>{ }).catch(err => {
uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
this.$toast.toast(err) this.$toast.toast(err)
}) })
}, },
getHistoryExternal() { getHistoryExternal() {
this.$nextTick(function() { this.$nextTick(function() {
// setTimeout(() => { // setTimeout(() => {
this.historyExternalList.forEach(item => { this.historyExternalList.forEach(item => {
this.$refs[item][0].getHistoryExternalData() this.$refs[item][0].getHistoryExternalData()
}) })
// }) // })
}) })
...@@ -281,7 +307,7 @@ ...@@ -281,7 +307,7 @@
}, },
//添加定时器 //添加定时器
getTimer(){ getTimer() {
this.eliminateTimer() this.eliminateTimer()
console.log('添加定时器') console.log('添加定时器')
this.timer1 = setInterval(() => { this.timer1 = setInterval(() => {
...@@ -292,7 +318,7 @@ ...@@ -292,7 +318,7 @@
}, 6000) }, 6000)
}, },
//消除定时器 //消除定时器
eliminateTimer(){ eliminateTimer() {
console.log('消除定时器') console.log('消除定时器')
if (this.timer1) { if (this.timer1) {
clearInterval(Number(this.timer1)) clearInterval(Number(this.timer1))
...@@ -311,26 +337,26 @@ ...@@ -311,26 +337,26 @@
}, },
//监听页面滚动 //监听页面滚动
onPageScroll:function(e) { //nvue暂不支持滚动监听,可用bindingx代替 onPageScroll: function(e) { //nvue暂不支持滚动监听,可用bindingx代替
// console.log("滚动距离为:" + e.scrollTop); // console.log("滚动距离为:" + e.scrollTop);
// let _this = this // let _this = this
// console.log(this.tabsList) // console.log(this.tabsList)
let tabsList = this.tabsList let tabsList = this.tabsList
for(let i=0;i<tabsList.length;i++){ for (let i = 0; i < tabsList.length; i++) {
this.$refs[tabsList[i].name][0].shopTop(e.scrollTop,tabsList[i].name,tabsList[i].index) this.$refs[tabsList[i].name][0].shopTop(e.scrollTop, tabsList[i].name, tabsList[i].index)
} }
}, },
//下拉刷新 //下拉刷新
onPullDownRefresh() { onPullDownRefresh() {
this.getViewJson() this.getViewJson()
// console.log('refresh'); // console.log('refresh');
// setTimeout(function () { // setTimeout(function () {
// uni.stopPullDownRefresh(); // uni.stopPullDownRefresh();
// }, 1000); // }, 1000);
}, },
onShow() { onShow() {
this.$nextTick(function(){ this.$nextTick(function() {
this.getTimer() this.getTimer()
}) })
// this.getViewJson() // this.getViewJson()
...@@ -352,6 +378,11 @@ ...@@ -352,6 +378,11 @@
beforeDestroy() { beforeDestroy() {
this.eliminateTimer() this.eliminateTimer()
}, },
onLoad() {
// #ifdef APP-PLUS
plus.screen.lockOrientation('portrait-primary'); //锁定
// #endif
}
} }
</script> </script>
...@@ -362,16 +393,17 @@ ...@@ -362,16 +393,17 @@
.data-style { .data-style {
// position: relative; // position: relative;
float: left; float: left;
// position: absolute;; // position: absolute;;
// width: 100%; // width: 100%;
// min-height: 100%; // min-height: 100%;
// background: red; // background: red;
} }
.stopTop { .stopTop {
position: fixed; position: fixed;
top: 50px; top: 50px;
z-index: 20; z-index: 20;
} }
</style> </style>
...@@ -97,9 +97,13 @@ ...@@ -97,9 +97,13 @@
}, },
onLoad(option){ onLoad(option){
console.log(6473)
console.log(JSON.stringify(option)) console.log(JSON.stringify(option))
this.homeViewName = option.viewName this.homeViewName = option.viewName
this.homeViewId = option.viewId this.homeViewId = option.viewId
// #ifdef APP-PLUS
plus.screen.lockOrientation('portrait-primary'); //锁定
// #endif
// this.getViewJson() // this.getViewJson()
}, },
methods: { methods: {
...@@ -110,7 +114,6 @@ ...@@ -110,7 +114,6 @@
//添加定时器 //添加定时器
getTimer(){ getTimer(){
this.eliminateTimer() this.eliminateTimer()
console.log('添加定时器1')
this.timer1 = setInterval(() => { this.timer1 = setInterval(() => {
this.postRediusTestFun(this.tagArr) this.postRediusTestFun(this.tagArr)
}, 3000) }, 3000)
...@@ -120,7 +123,6 @@ ...@@ -120,7 +123,6 @@
}, },
//选项卡点击 dataType-数据类型 associatedComponent-绑定控件ID tabData点击选项卡筛选数据 //选项卡点击 dataType-数据类型 associatedComponent-绑定控件ID tabData点击选项卡筛选数据
selectTabFun(dataType, associatedComponent, tabData) { selectTabFun(dataType, associatedComponent, tabData) {
console.log(tabData)
// if (dataType === '历史数据') { // if (dataType === '历史数据') {
this.$nextTick(function() { this.$nextTick(function() {
let filter = tabData.filter[0] let filter = tabData.filter[0]
...@@ -145,12 +147,12 @@ ...@@ -145,12 +147,12 @@
getViewJson() { getViewJson() {
let projectInfo = uni.getStorageSync('projectInfo') let projectInfo = uni.getStorageSync('projectInfo')
// this.homeViewName = projectInfo.homeViewName // this.homeViewName = projectInfo.homeViewName
if(this.homeViewName && this.homeViewName.indexOf("\\")>-1){ // if(this.homeViewName && this.homeViewName.indexOf("\\")>-1){
this.homeViewName =this.homeViewName.substring(this.homeViewName.indexOf("\\")+1); // this.homeViewName =this.homeViewName.substring(this.homeViewName.indexOf("\\")+1);
} // }
if(this.homeViewName.indexOf('.view')< 0){ // if(this.homeViewName.indexOf('.view')< 0){
this.homeViewName = this.homeViewName +'.view' // this.homeViewName = this.homeViewName +'.view'
} // }
// this.homeViewName = '标准组件' // this.homeViewName = '标准组件'
// console.log(JSON.stringify(projectInfo)) // console.log(JSON.stringify(projectInfo))
this.projectName = projectInfo.projectName this.projectName = projectInfo.projectName
...@@ -162,8 +164,9 @@ ...@@ -162,8 +164,9 @@
this.$api.getView(this.projectName, this.homeViewId).then(res => { this.$api.getView(this.projectName, this.homeViewId).then(res => {
uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
if (res.data) { if (res.data) {
console.log(res.data) console.log(JSON.parse(JSON.stringify(res.data)))
this.componentsData = res.data this.componentsData = JSON.parse(JSON.stringify(res.data))
console.log(this.componentsData)
let _this = this let _this = this
let realTime = 0 let realTime = 0
let showHistoryExternal = 0 let showHistoryExternal = 0
...@@ -177,6 +180,13 @@ ...@@ -177,6 +180,13 @@
let widthList = JSON.parse(JSON.stringify(styleConfig.margin)) let widthList = JSON.parse(JSON.stringify(styleConfig.margin))
let width = parseFloat(styleConfig.width)+parseFloat(widthList[1])+parseFloat(widthList[3]) let width = parseFloat(styleConfig.width)+parseFloat(widthList[1])+parseFloat(widthList[3])
styleConfig.width = (width>100?parseFloat(styleConfig.width)-(width-100):parseFloat(styleConfig.width))+'%' styleConfig.width = (width>100?parseFloat(styleConfig.width)-(width-100):parseFloat(styleConfig.width))+'%'
if(styleConfig.boxShadow.internal && styleConfig.boxShadow.external){
let internal = getBoxShadow(styleConfig.boxShadow.internal,'inset')
let external = getBoxShadow(styleConfig.boxShadow.external)
styleConfig.boxShadow = internal+','+external
}else{
styleConfig.boxShadow = getBoxShadow(styleConfig.boxShadow)
}
if (componentConfig) { if (componentConfig) {
if (componentConfig.dataset) { if (componentConfig.dataset) {
let dataset = componentConfig.dataset let dataset = componentConfig.dataset
...@@ -353,6 +363,7 @@ ...@@ -353,6 +363,7 @@
// } // }
}, },
} }
</script> </script>
......
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
data() { data() {
return { return {
height: '100vh', height: '100vh',
userName: 'SuperAdmin', userName: '',
password: 'SYC888888', password: '',
logoImg: '../../static/img/hello.png' logoImg: '../../static/img/hello.png'
} }
}, },
......
<!-- 消息页面 --> <!-- 消息页面 -->
<template> <template>
<view></view> <view>
<tips-page :text="'功能开发中,请敬请期待~'"></tips-page>
</view>
</template> </template>
<script> <script>
......
<!-- 监控列表页面 --> <!-- 监控列表页面 -->
<template> <template>
<view class="page-view"> <view>
<view v-for="(item,index) in dataList" :key="index" style="margin-bottom: 10px;"> <view v-if="!showTips" class="page-view">
<collapse :data="item" @collaspe-item-fun="getMonitoringViewInfo"></collapse> <view v-for="(item,index) in dataList" :key="index" style="margin-bottom: 10px;">
<collapse :data="item" @collaspe-item-fun="getMonitoringViewInfo"></collapse>
</view>
</view> </view>
<tips-page v-if="showTips" :text="'暂无配置~'"></tips-page>
</view> </view>
</template> </template>
...@@ -16,8 +19,9 @@ ...@@ -16,8 +19,9 @@
}, },
data() { data() {
return { return {
projectName:'', projectName: '',
dataList: [] dataList: [],
showTips: false
} }
}, },
...@@ -34,10 +38,11 @@ ...@@ -34,10 +38,11 @@
let title = item.SCMSChildMenuKey let title = item.SCMSChildMenuKey
let id = item.SCMSChildMenuID let id = item.SCMSChildMenuID
uni.navigateTo({ uni.navigateTo({
url: '/pages/monitoring/monitoring-view/index?id=' + id + '&title=' + title+'&projectName='+this.projectName url: '/pages/monitoring/monitoring-view/index?id=' + id + '&title=' + title +
'&projectName=' + this.projectName
}) })
}else{ } else {
this.$toast.toast('此菜单不是监控画面,不可查看') this.$toast.toast('此菜单不是监控画面,不可查看')
} }
...@@ -91,9 +96,14 @@ ...@@ -91,9 +96,14 @@
// this.$store.state.routerInfo = JSON.stringify(data.data) // this.$store.state.routerInfo = JSON.stringify(data.data)
uni.removeStorageSync('routerChildMenusInfo') uni.removeStorageSync('routerChildMenusInfo')
uni.setStorageSync('routerChildMenusInfo', childMenus); uni.setStorageSync('routerChildMenusInfo', childMenus);
if (mainMenus.length <= 0) {
this.showTips = true
}
// const value = uni.getStorageSync('routerChildMenusInfo'); // const value = uni.getStorageSync('routerChildMenusInfo');
// console.log(childMenus) // console.log(mainMenus)
mainMenus.sort(function(a, b){return a.SCMSMainMenuKey - b.SCMSMainMenuKey}); mainMenus.sort(function(a, b) {
return a.SCMSMainMenuRank - b.SCMSMainMenuRank
});
let lastVistInfos = data1.lastVistInfos let lastVistInfos = data1.lastVistInfos
mainMenus.forEach(item => { mainMenus.forEach(item => {
item.title = item.SCMSMainMenuName item.title = item.SCMSMainMenuName
...@@ -101,14 +111,20 @@ ...@@ -101,14 +111,20 @@
for (let i = 0; i < childMenus.length; i++) { for (let i = 0; i < childMenus.length; i++) {
let childMenusItem = childMenus[i] let childMenusItem = childMenus[i]
let SCMSChildMenuKey = childMenusItem.SCMSChildMenuKey let SCMSChildMenuKey = childMenusItem.SCMSChildMenuKey
let SCMSChildMenuRank = childMenusItem.SCMSChildMenuRank
if (childMenusItem.SCMSMainMenuID == item.SCMSMainMenuID) { if (childMenusItem.SCMSMainMenuID == item.SCMSMainMenuID) {
childMenusItem.img = '../../static/img1/jiankongBg.png' childMenusItem.img = '../../static/img1/jiankongBg.png'
childMenusItem.textTitle = childMenusItem.SCMSChildMenuName childMenusItem.textTitle = childMenusItem.SCMSChildMenuName
childMenusItem.textTime = lastVistInfos[SCMSChildMenuKey]?lastVistInfos[SCMSChildMenuKey].lastTime:null childMenusItem.textTime = lastVistInfos[SCMSChildMenuKey] ?
lastVistInfos[SCMSChildMenuKey].lastTime : null
item.textList.push(childMenusItem) item.textList.push(childMenusItem)
} }
} }
item.textList.sort(function(a, b) {
return a.SCMSChildMenuRank - b.SCMSChildMenuRank
});
}) })
this.dataList = mainMenus this.dataList = mainMenus
...@@ -121,7 +137,7 @@ ...@@ -121,7 +137,7 @@
console.log(err) console.log(err)
}) })
}, },
}, },
mounted() { mounted() {
......
...@@ -307,14 +307,11 @@ ...@@ -307,14 +307,11 @@
}, },
//图表历史,业务数据初始化查询 //图表历史,业务数据初始化查询
async initEchart() { async initEchart() {
console.log('434=>')
this.$nextTick(() => { this.$nextTick(() => {
// console.log('444=>'+JSON.stringify(this.$refs.queryButton25.dataValue)) // console.log('444=>'+JSON.stringify(this.$refs.queryButton25.dataValue))
let queryButtonList = this.$refs.queryButton25.dataValue let queryButtonList = this.$refs.queryButton25.dataValue
queryButtonList.forEach((item, index) => { queryButtonList.forEach((item, index) => {
console.log('434=>545434') this.searchBtnFun(item)
this.searchBtnFun(item)
}) })
}) })
...@@ -340,15 +337,26 @@ ...@@ -340,15 +337,26 @@
} }
var myPicker = new Set(picker) var myPicker = new Set(picker)
var pickerArray = [...myPicker] var pickerArray = [...myPicker]
let dataValue = this.$refs.dataTimePicker282.dataValue let dataValue = this.$refs.dataTimePicker282.dataValue //时间控件
let ComboboxList = this.$refs.combobox299.dataValue //下拉控件
console.log(ComboboxList)
let getDataTimeList = {} let getDataTimeList = {}
for (let i = 0; i < dataValue.length; i++) { for (let i = 0; i < dataValue.length; i++) {
for (let j = 0; j < pickerArray.length; j++) { getDataTimeList[dataValue[i].class] = {
if (dataValue[i].class == pickerArray[j]) { Value: dataValue[i].value
getDataTimeList[pickerArray[j]] = { }
Value: dataValue[i].value // for (let j = 0; j < pickerArray.length; j++) {
} // if (dataValue[i].class == pickerArray[j]) {
} // getDataTimeList[pickerArray[j]] = {
// Value: dataValue[i].value
// }
// }
// }
}
for (let i = 0; i < ComboboxList.length; i++) {
let ComboboxData = ComboboxList[i]
getDataTimeList[ComboboxData.class] = {
Value: ComboboxData.value
} }
} }
let queryChartData = { let queryChartData = {
...@@ -362,7 +370,7 @@ ...@@ -362,7 +370,7 @@
// console.log(22+JSON.stringify(getDataTimeList)) // console.log(22+JSON.stringify(getDataTimeList))
} }
await this.$nextTick(function() { await this.$nextTick(function() {
this.$refs.customreport.searchReport(item) this.$refs.customreport.searchReport(item)
}) })
// setTimeout(()=>{ // setTimeout(()=>{
...@@ -682,11 +690,11 @@ ...@@ -682,11 +690,11 @@
// this.initEchart() // this.initEchart()
setTimeout(() => { setTimeout(() => {
this.initEchart() this.initEchart()
},1000) }, 1000)
// this.$nextTick(function(){ // this.$nextTick(function(){
// }) // })
}, },
//获取画布数据 //获取画布数据
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<template> <template>
<view class="charts-box"> <view class="charts-box">
<!-- <qiun-data-charts type="column" :chartData="chartData" /> --> <!-- <qiun-data-charts type="column" :chartData="chartData" /> -->
<tips-page :text="'功能开发中,请敬请期待~'"></tips-page>
</view> </view>
</template> </template>
...@@ -66,6 +67,10 @@ ...@@ -66,6 +67,10 @@
} }
</script> </script>
<style> <style lang="scss" scoped>
.charts-box{
position: relative;
height: 100%;
}
</style> </style>
...@@ -136,6 +136,11 @@ function getStartTime(time,recent,setting){ ...@@ -136,6 +136,11 @@ function getStartTime(time,recent,setting){
return api.baseRequest(`/api/Data/GetTime?endTime=${time}&recent=${recent}&setting=${setting}`,"GET",1) return api.baseRequest(`/api/Data/GetTime?endTime=${time}&recent=${recent}&setting=${setting}`,"GET",1)
} }
//获取最新时间点数据
function getNewest(data){
return api.baseRequest(`/api/Data/GetNewest`,"POST",1,data)
}
export default { export default {
...@@ -164,8 +169,7 @@ export default { ...@@ -164,8 +169,7 @@ export default {
getGlobalProps, getGlobalProps,
getQueryMulitySource, getQueryMulitySource,
getStartTime, getStartTime,
checkTag checkTag,
getNewest
} }
...@@ -69,9 +69,9 @@ const store = new Vuex.Store({ ...@@ -69,9 +69,9 @@ const store = new Vuex.Store({
// #endif // #endif
// #ifndef APP-PLUS || APP-NVUE // #ifndef APP-PLUS || APP-NVUE
uni.removeStorageSync('projectInfo'); uni.removeStorageSync('projectInfo');
// let projectName = 'http://192.168.1.85:5000/api/view/GetAppInfo?projectName=0826APP项目A' // let projectName = 'http://192.168.1.85:5000/api/view/GetAppInfo?projectName=0826APP项目A'
let projectName = 'http://192.168.1.85:5002/api/view/GetAppInfo?projectName=Test02' // let projectName = 'http://192.168.1.85:5002/api/view/GetAppInfo?projectName=Test02'
// let projectName = 'http://192.168.1.85:5000/api/view/GetAppInfo?projectName=测试项目' let projectName = 'http://192.168.1.85:5000/api/view/GetAppInfo?projectName=测试项目'
$api.getAppInfo(projectName).then(res => { $api.getAppInfo(projectName).then(res => {
const code = res.data.code const code = res.data.code
if (code == 1) { if (code == 1) {
......
...@@ -58,13 +58,13 @@ module.exports = { ...@@ -58,13 +58,13 @@ module.exports = {
} }
for (let i in res) { for (let i in res) {
let value = '--' let value = '--'
if (res[i].data !== null) { if (res[i].value != null) {
if(isNaN(res[i].axisValueLabel)&&!isNaN(Date.parse(res[i].axisValueLabel))){ if(isNaN(res[i].axisValueLabel)&&!isNaN(Date.parse(res[i].axisValueLabel))){
//   result += res[0].axisValueLabel //   result += res[0].axisValueLabel
}else{ }else{
result += res[i].axisValueLabel result += res[i].axisValueLabel
} }
value = res[i].data value = res[i].value
// #ifdef H5 // #ifdef H5
result += '\n' + res[i].seriesName + ':' + value result += '\n' + res[i].seriesName + ':' + value
// #endif // #endif
...@@ -77,6 +77,33 @@ module.exports = { ...@@ -77,6 +77,33 @@ module.exports = {
} }
return result; return result;
}, },
webTooltipfun1:function(res){
console.log(res)
let result = ''
// if(isNaN(res[0].axisValueLabel)&&!isNaN(Date.parse(res[0].axisValueLabel))){
//   result += res[0].axisValueLabel
// }
// for (let i in res) {
// let value = '--'
// if (res[i].data !== null) {
// if(isNaN(res[i].axisValueLabel)&&!isNaN(Date.parse(res[i].axisValueLabel))){
// //   result += res[0].axisValueLabel
// }else{
// result += res[i].axisValueLabel
// }
// value = res[i].data
// // #ifdef H5
// result += '\n' + res[i].seriesName + ':' + value
// // #endif
// // #ifdef APP-PLUS
// result += '<br/>' + res[i].marker + res[i].seriesName + ':' + value
// // #endif
// }
// }
return res;
},
legendFormat: function(name) { legendFormat: function(name) {
return "自定义图例+" + name; return "自定义图例+" + name;
}, },
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
var isReady=false;var onReadyCallbacks=[]; var isReady=false;var onReadyCallbacks=[];
var isServiceReady=false;var onServiceReadyCallbacks=[]; var isServiceReady=false;var onServiceReadyCallbacks=[];
var __uniConfig = {"pages":["pages/scan-code/index","pages/login/index","pages/monitoring/index","pages/data/index","pages/working/index","pages/message/index","pages/my/index","pages/monitoring/monitoring-view/index","pages/scan-code/app-scan/index","pages/data/jump-view/index"],"window":{"navigationBarTextStyle":"white","navigationBarTitleText":"cms","navigationBarBackgroundColor":"#00B2A5","backgroundColor":"#f2f2f2","pageOrientation":"portrait-primary"},"tabBar":{"color":"#2D2D2D","selectedColor":"#2D2D2D","borderStyle":"rgba(220, 220, 220, 0.24)","backgroundColor":"#ffffff","height":"50px","fontSize":"10px","iconWidth":"22px","spacing":"2px","list":[{"pagePath":"pages/monitoring/index","iconPath":"static/img1/jiankong.png","selectedIconPath":"static/img1/jiankong1.png","text":"监控"},{"pagePath":"pages/data/index","iconPath":"static/img1/shuju.png","selectedIconPath":"static/img1/shuju1.png","text":"数据"},{"pagePath":"pages/working/index","iconPath":"static/img1/gongzuo.png","selectedIconPath":"static/img1/gongzuo1.png","text":"工作"},{"pagePath":"pages/message/index","iconPath":"static/img1/xiaoxi.png","selectedIconPath":"static/img1/xiaoxi1.png","text":"消息","backgroundColor":"#000"},{"pagePath":"pages/my/index","iconPath":"static/img1/wo.png","selectedIconPath":"static/img1/wo1.png","text":"我的"}]},"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"SYC","compilerVersion":"3.1.22","entryPagePath":"pages/scan-code/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}}; var __uniConfig = {"pages":["pages/scan-code/index","pages/login/index","pages/monitoring/index","pages/data/index","pages/working/index","pages/message/index","pages/my/index","pages/monitoring/monitoring-view/index","pages/scan-code/app-scan/index","pages/data/jump-view/index"],"window":{"navigationBarTextStyle":"white","navigationBarTitleText":"cms","navigationBarBackgroundColor":"#00B2A5","backgroundColor":"#f2f2f2","pageOrientation":"portrait-primary"},"tabBar":{"color":"#2D2D2D","selectedColor":"#2D2D2D","borderStyle":"rgba(220, 220, 220, 0.24)","backgroundColor":"#ffffff","height":"50px","fontSize":"10px","iconWidth":"22px","spacing":"2px","list":[{"pagePath":"pages/monitoring/index","iconPath":"static/img1/jiankong.png","selectedIconPath":"static/img1/jiankong1.png","text":"监控"},{"pagePath":"pages/data/index","iconPath":"static/img1/shuju.png","selectedIconPath":"static/img1/shuju1.png","text":"数据"},{"pagePath":"pages/working/index","iconPath":"static/img1/gongzuo.png","selectedIconPath":"static/img1/gongzuo1.png","text":"工作"},{"pagePath":"pages/message/index","iconPath":"static/img1/xiaoxi.png","selectedIconPath":"static/img1/xiaoxi1.png","text":"消息","backgroundColor":"#000"},{"pagePath":"pages/my/index","iconPath":"static/img1/wo.png","selectedIconPath":"static/img1/wo1.png","text":"我的"}]},"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"SYC","compilerVersion":"3.1.22","entryPagePath":"pages/scan-code/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
var __uniRoutes = [{"path":"/pages/scan-code/index","meta":{"isQuit":true},"window":{"navigationBarTitleText":"扫码","titleNView":false}},{"path":"/pages/login/index","meta":{},"window":{"titleNView":false}},{"path":"/pages/monitoring/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"监控"}},{"path":"/pages/data/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"数据"}},{"path":"/pages/working/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"工作"}},{"path":"/pages/message/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"消息"}},{"path":"/pages/my/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"我的"}},{"path":"/pages/monitoring/monitoring-view/index","meta":{},"window":{"titleNView":false,"bounce":false}},{"path":"/pages/scan-code/app-scan/index","meta":{"isNVue":true},"window":{"navigationBarTitleText":"扫码"}},{"path":"/pages/data/jump-view/index","meta":{},"window":{}}]; var __uniRoutes = [{"path":"/pages/scan-code/index","meta":{"isQuit":true},"window":{"navigationBarTitleText":"扫码","titleNView":false}},{"path":"/pages/login/index","meta":{},"window":{"titleNView":false}},{"path":"/pages/monitoring/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"监控"}},{"path":"/pages/data/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"数据","enablePullDownRefresh":true}},{"path":"/pages/working/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"工作"}},{"path":"/pages/message/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"消息"}},{"path":"/pages/my/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"我的"}},{"path":"/pages/monitoring/monitoring-view/index","meta":{},"window":{"titleNView":false,"bounce":false}},{"path":"/pages/scan-code/app-scan/index","meta":{"isNVue":true},"window":{"navigationBarTitleText":"扫码"}},{"path":"/pages/data/jump-view/index","meta":{},"window":{"enablePullDownRefresh":true}}];
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); __uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); __uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}}); service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}});
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=8)}([function(e,t,n){"use strict";var o=n(5),r=n(2),i=n(7);var a=Object(i.a)(r.default,o.b,o.c,!1,null,null,"0f56f2e1",!1,o.a,void 0);(function(e){this.options.style||(this.options.style={}),Vue.prototype.__merge_style&&Vue.prototype.__$appStyle__&&Vue.prototype.__merge_style(Vue.prototype.__$appStyle__,this.options.style),Vue.prototype.__merge_style?Vue.prototype.__merge_style(n(6).default,this.options.style):Object.assign(this.options.style,n(6).default)}).call(a),t.default=a.exports},function(e,t){e.exports={".page-view":{"":{paddingTop:["12",0,0,16],paddingRight:["12",0,0,16],paddingBottom:["12",0,0,16],paddingLeft:["12",0,0,16]}},".uni-input":{"":{backgroundColor:["#FFFFFF",0,0,17],borderWidth:["1",0,0,17],borderStyle:["solid",0,0,17],borderColor:["#CECECE",0,0,17],borderRadius:["5",0,0,17],height:["47",0,0,17]}},".base-style":{"":{position:["absolute",0,0,18]}},".data-conponent-style":{"":{boxSizing:["border-box",0,0,19]}},".text-style33":{"":{overflow:["hidden",0,0,20],whiteSpace:["nowrap",0,0,20],textOverflow:["ellipsis",0,0,20]}},"@VERSION":2}},function(e,t,n){"use strict";var o=n(3),r=n.n(o);t.default=r.a},function(e,t,n){"use strict";(function(e,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o={onLoad:function(){},data:function(){return{fil:[0,1,2,3]}},methods:{success:function(t){this.$refs.barcode.cancel(),e("log","success1:"+JSON.stringify(t)," at pages/scan-code/app-scan/index.nvue:23"),uni.redirectTo({url:"/pages/login/index"})},fail1:function(t){this.$refs.barcode.cancel(),e("log","fail1:"+JSON.stringify(t)," at pages/scan-code/app-scan/index.nvue:30")},toStart:function(){this.$refs.barcode.start({conserve:!0,filename:"_doc/barcode/"})},tocancel:function(){this.$refs.barcode.cancel()},toFlash:function(){this.$refs.barcode.setFlash(!0)},toscan:function(){e("log","scan:"," at pages/scan-code/app-scan/index.nvue:46"),n("barcodeScan").scan("/static/barcode1.png",(function(t){e("log","scan_error:"+JSON.stringify(t)," at pages/scan-code/app-scan/index.nvue:50")}))}},mounted:function(){this.$refs.barcode.start({vibrate:!0})}};t.default=o}).call(this,n(11).default,n(12).default)},function(e,t){e.exports={".barcode":{"":{backgroundColor:["#808080",0,0,0]}},"@VERSION":2}},function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"c",(function(){return r})),n.d(t,"a",(function(){}));var o=function(){var e=this.$createElement,t=this._self._c||e;return t("scroll-view",{staticStyle:{flexDirection:"column"},attrs:{scrollY:!0,showScrollbar:!0,enableBackToTop:!0,bubble:"true"}},[t("view",{staticStyle:{flex:"1"}},[t("barcode",{ref:"barcode",staticClass:["barcode"],staticStyle:{flex:"1"},attrs:{id:"1",autostart:"true",background:"rgb(0,0,0)",frameColor:"#1C86EE",scanbarColor:"#1C86EE",filters:this.fil},on:{marked:this.success,error:this.fail1}})],1)])},r=[]},function(e,t,n){"use strict";n.r(t);var o=n(4),r=n.n(o);for(var i in o)"default"!==i&&function(e){n.d(t,e,(function(){return o[e]}))}(i);t.default=r.a},function(e,t,n){"use strict";function o(e,t,n,o,r,i,a,s,c,u){var l,f="function"==typeof e?e.options:e;if(c){f.components||(f.components={});var p=Object.prototype.hasOwnProperty;for(var d in c)p.call(c,d)&&!p.call(f.components,d)&&(f.components[d]=c[d])}if(u&&((u.beforeCreate||(u.beforeCreate=[])).unshift((function(){this[u.__module]=this})),(f.mixins||(f.mixins=[])).push(u)),t&&(f.render=t,f.staticRenderFns=n,f._compiled=!0),o&&(f.functional=!0),i&&(f._scopeId="data-v-"+i),a?(l=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),r&&r.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},f._ssrRegister=l):r&&(l=s?function(){r.call(this,this.$root.$options.shadowRoot)}:r),l)if(f.functional){f._injectStyles=l;var _=f.render;f.render=function(e,t){return l.call(t),_(e,t)}}else{var y=f.beforeCreate;f.beforeCreate=y?[].concat(y,l):[l]}return{exports:e,options:f}}n.d(t,"a",(function(){return o}))},function(e,t,n){"use strict";n.r(t);n(9);var o=n(0);"undefined"==typeof Promise||Promise.prototype.finally||(Promise.prototype.finally=function(e){var t=this.constructor;return this.then((function(n){return t.resolve(e()).then((function(){return n}))}),(function(n){return t.resolve(e()).then((function(){throw n}))}))}),o.default.mpType="page",o.default.route="pages/scan-code/app-scan/index",o.default.el="#root",new Vue(o.default)},function(e,t,n){Vue.prototype.__$appStyle__={},Vue.prototype.__merge_style&&Vue.prototype.__merge_style(n(10).default,Vue.prototype.__$appStyle__)},function(e,t,n){"use strict";n.r(t);var o=n(1),r=n.n(o);for(var i in o)"default"!==i&&function(e){n.d(t,e,(function(){return o[e]}))}(i);t.default=r.a},function(e,t,n){"use strict";function o(e){var t=Object.prototype.toString.call(e);return t.substring(8,t.length-1)}function r(){return"string"==typeof __channelId__&&__channelId__}function i(e,t){switch(o(t)){case"Function":return"function() { [native code] }";default:return t}}Object.defineProperty(t,"__esModule",{value:!0}),t.log=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];console[e].apply(console,n)},t.default=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var a=t.shift();if(r())return t.push(t.pop().replace("at ","uni-app:///")),console[a].apply(console,t);var s=t.map((function(e){var t=Object.prototype.toString.call(e).toLowerCase();if("[object object]"===t||"[object array]"===t)try{e="---BEGIN:JSON---"+JSON.stringify(e,i)+"---END:JSON---"}catch(n){e=t}else if(null===e)e="---NULL---";else if(void 0===e)e="---UNDEFINED---";else{var n=o(e).toUpperCase();e="NUMBER"===n||"BOOLEAN"===n?"---BEGIN:"+n+"---"+e+"---END:"+n+"---":String(e)}return e})),c="";if(s.length>1){var u=s.pop();c=s.join("---COMMA---"),0===u.indexOf(" at ")?c+=u:c+="---COMMA---"+u}else c=s[0];console[a](c)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return weex.requireModule(e)}}]); !function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=8)}([function(t,e,n){"use strict";var o=n(5),r=n(2),i=n(7);var a=Object(i.a)(r.default,o.b,o.c,!1,null,null,"0f56f2e1",!1,o.a,void 0);(function(t){this.options.style||(this.options.style={}),Vue.prototype.__merge_style&&Vue.prototype.__$appStyle__&&Vue.prototype.__merge_style(Vue.prototype.__$appStyle__,this.options.style),Vue.prototype.__merge_style?Vue.prototype.__merge_style(n(6).default,this.options.style):Object.assign(this.options.style,n(6).default)}).call(a),e.default=a.exports},function(t,e){t.exports={".page-view":{"":{paddingTop:["12",0,0,16],paddingRight:["12",0,0,16],paddingBottom:["12",0,0,16],paddingLeft:["12",0,0,16]}},".uni-input":{"":{backgroundColor:["#FFFFFF",0,0,17],borderWidth:["1",0,0,17],borderStyle:["solid",0,0,17],borderColor:["#CECECE",0,0,17],borderRadius:["5",0,0,17],height:["47",0,0,17]}},".base-style":{"":{position:["absolute",0,0,18]}},".data-conponent-style":{"":{boxSizing:["border-box",0,0,19]}},".text-style33":{"":{overflow:["hidden",0,0,20],whiteSpace:["nowrap",0,0,20],textOverflow:["ellipsis",0,0,20]}},"@FONT-FACE":[{fontFamily:"KaiTi",src:'url("fonts/KaiTi.ttf")'},{fontFamily:"PingFangSC",src:'url("fonts/PingFangMedium.ttf")'},{fontFamily:"SourceHanSansCN",src:'url("fonts/SourceHanSansCN-Medium.otf")'},{fontFamily:"FangSong",src:'url("fonts/FangSong.TTF")'},{fontFamily:"YouYuan",src:'url("fonts/YouYuan.TTF")'},{fontFamily:"FZShuTi",src:'url("fonts/FZShuTi.TTF")'},{fontFamily:"LiSu",src:'url("fonts/LiSu.TTF")'},{fontFamily:"FZYaoti",src:'url("fonts/FZYaoti.ttf")'},{fontFamily:"SimHei",src:'url("fonts/SimHei.TTF")'},{fontFamily:"Microsoft YaHei",src:'url("fonts/MicrosoftYaHei.ttf")'},{fontFamily:"SimSun",src:'url("fonts/SimSun.TTF")'}],"@VERSION":2}},function(t,e,n){"use strict";var o=n(3),r=n.n(o);e.default=r.a},function(t,e,n){"use strict";(function(t,n){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o={onLoad:function(){},data:function(){return{fil:[0,1,2,3]}},methods:{success:function(e){this.$refs.barcode.cancel(),t("log","success1:"+JSON.stringify(e)," at pages/scan-code/app-scan/index.nvue:23"),uni.redirectTo({url:"/pages/login/index"})},fail1:function(e){this.$refs.barcode.cancel(),t("log","fail1:"+JSON.stringify(e)," at pages/scan-code/app-scan/index.nvue:30")},toStart:function(){this.$refs.barcode.start({conserve:!0,filename:"_doc/barcode/"})},tocancel:function(){this.$refs.barcode.cancel()},toFlash:function(){this.$refs.barcode.setFlash(!0)},toscan:function(){t("log","scan:"," at pages/scan-code/app-scan/index.nvue:46"),n("barcodeScan").scan("/static/barcode1.png",(function(e){t("log","scan_error:"+JSON.stringify(e)," at pages/scan-code/app-scan/index.nvue:50")}))}},mounted:function(){this.$refs.barcode.start({vibrate:!0})}};e.default=o}).call(this,n(11).default,n(12).default)},function(t,e){t.exports={".barcode":{"":{backgroundColor:["#808080",0,0,0]}},"@VERSION":2}},function(t,e,n){"use strict";n.d(e,"b",(function(){return o})),n.d(e,"c",(function(){return r})),n.d(e,"a",(function(){}));var o=function(){var t=this.$createElement,e=this._self._c||t;return e("scroll-view",{staticStyle:{flexDirection:"column"},attrs:{scrollY:!0,showScrollbar:!0,enableBackToTop:!0,bubble:"true"}},[e("view",{staticStyle:{flex:"1"}},[e("barcode",{ref:"barcode",staticClass:["barcode"],staticStyle:{flex:"1"},attrs:{id:"1",autostart:"true",background:"rgb(0,0,0)",frameColor:"#1C86EE",scanbarColor:"#1C86EE",filters:this.fil},on:{marked:this.success,error:this.fail1}})],1)])},r=[]},function(t,e,n){"use strict";n.r(e);var o=n(4),r=n.n(o);for(var i in o)"default"!==i&&function(t){n.d(e,t,(function(){return o[t]}))}(i);e.default=r.a},function(t,e,n){"use strict";function o(t,e,n,o,r,i,a,s,u,c){var l,f="function"==typeof t?t.options:t;if(u){f.components||(f.components={});var d=Object.prototype.hasOwnProperty;for(var p in u)d.call(u,p)&&!d.call(f.components,p)&&(f.components[p]=u[p])}if(c&&((c.beforeCreate||(c.beforeCreate=[])).unshift((function(){this[c.__module]=this})),(f.mixins||(f.mixins=[])).push(c)),e&&(f.render=e,f.staticRenderFns=n,f._compiled=!0),o&&(f.functional=!0),i&&(f._scopeId="data-v-"+i),a?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(a)},f._ssrRegister=l):r&&(l=s?function(){r.call(this,this.$root.$options.shadowRoot)}:r),l)if(f.functional){f._injectStyles=l;var y=f.render;f.render=function(t,e){return l.call(e),y(t,e)}}else{var _=f.beforeCreate;f.beforeCreate=_?[].concat(_,l):[l]}return{exports:t,options:f}}n.d(e,"a",(function(){return o}))},function(t,e,n){"use strict";n.r(e);n(9);var o=n(0);"undefined"==typeof Promise||Promise.prototype.finally||(Promise.prototype.finally=function(t){var e=this.constructor;return this.then((function(n){return e.resolve(t()).then((function(){return n}))}),(function(n){return e.resolve(t()).then((function(){throw n}))}))}),o.default.mpType="page",o.default.route="pages/scan-code/app-scan/index",o.default.el="#root",new Vue(o.default)},function(t,e,n){Vue.prototype.__$appStyle__={},Vue.prototype.__merge_style&&Vue.prototype.__merge_style(n(10).default,Vue.prototype.__$appStyle__)},function(t,e,n){"use strict";n.r(e);var o=n(1),r=n.n(o);for(var i in o)"default"!==i&&function(t){n.d(e,t,(function(){return o[t]}))}(i);e.default=r.a},function(t,e,n){"use strict";function o(t){var e=Object.prototype.toString.call(t);return e.substring(8,e.length-1)}function r(){return"string"==typeof __channelId__&&__channelId__}function i(t,e){switch(o(e)){case"Function":return"function() { [native code] }";default:return e}}Object.defineProperty(e,"__esModule",{value:!0}),e.log=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),o=1;o<e;o++)n[o-1]=arguments[o];console[t].apply(console,n)},e.default=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var a=e.shift();if(r())return e.push(e.pop().replace("at ","uni-app:///")),console[a].apply(console,e);var s=e.map((function(t){var e=Object.prototype.toString.call(t).toLowerCase();if("[object object]"===e||"[object array]"===e)try{t="---BEGIN:JSON---"+JSON.stringify(t,i)+"---END:JSON---"}catch(n){t=e}else if(null===t)t="---NULL---";else if(void 0===t)t="---UNDEFINED---";else{var n=o(t).toUpperCase();t="NUMBER"===n||"BOOLEAN"===n?"---BEGIN:"+n+"---"+t+"---END:"+n+"---":String(t)}return t})),u="";if(s.length>1){var c=s.pop();u=s.join("---COMMA---"),0===c.indexOf(" at ")?u+=c:u+="---COMMA---"+c}else u=s[0];console[a](u)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){return weex.requireModule(t)}}]);
\ No newline at end of file \ No newline at end of file
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment