修改问题

master
夜笙歌 4 days ago
parent dc9d0306ed
commit 1eddf7e7ee

@ -1,7 +1,8 @@
<template>
<div style="display: inline-block;width: 100%;height: 100% ">
<div style="background-color: #094170">
<div class="scrollTable" style="font-weight: bold;" :style="`width:calc(${100/defaultData.th.length}%)`" v-for="i in defaultData.th">
<div class="scrollTable" style="font-weight: bold;" :style="`width:calc(${100/defaultData.th.length}%)`"
v-for="i in defaultData.th">
{{ i }}
</div>
</div>
@ -66,11 +67,13 @@ export default {
}
},
async mounted() {
setTimeout(async () => {
await this.getData()
}, 500)
this.getOption()
setInterval(async () => {
await this.getData()
}, 1000*10)
}, 1000 * 60)
},
methods: {
async getData(e) {
@ -79,7 +82,6 @@ export default {
},
getOption() {
this.tableData = this.defaultTableData
console.log('this.tableData',this.tableData)
},
},
}

@ -53,10 +53,6 @@
</div>
</el-form>
<div style="text-align: center;height: 60px;line-height: 60px">
<el-button type="primary" @click="onSubmit"></el-button>
<el-button>重置</el-button>
</div>
</div>
</el-collapse-item>
<el-collapse-item title="数据配置" name="2">
@ -65,6 +61,10 @@
</div>
</el-collapse-item>
</el-collapse>
<div style="text-align: center;height: 60px;line-height: 60px">
<el-button type="primary" @click="onSubmit"></el-button>
<el-button>重置</el-button>
</div>
</div>
</el-col>
<el-col :span="12" style="height: 100%">

@ -57,10 +57,6 @@
</div>
</el-form>
<div style="text-align: center;height: 60px;line-height: 60px">
<el-button type="primary" @click="onSubmit"></el-button>
<el-button>重置</el-button>
</div>
</div>
</el-collapse-item>
<el-collapse-item title="数据配置" name="2">
@ -69,6 +65,10 @@
</div>
</el-collapse-item>
</el-collapse>
<div style="text-align: center;height: 60px;line-height: 60px">
<el-button type="primary" @click="onSubmit"></el-button>
<el-button>重置</el-button>
</div>
</div>
</el-col>
<el-col :span="12" style="height: 100%">

@ -30,10 +30,6 @@
</el-form-item>
</el-form>
<div style="text-align: center;height: 60px;line-height: 60px">
<el-button type="primary" @click="onSubmit"></el-button>
<el-button>重置</el-button>
</div>
</div>
</el-collapse-item>
<el-collapse-item title="数据配置" name="2">
@ -42,6 +38,10 @@
</div>
</el-collapse-item>
</el-collapse>
<div style="text-align: center;height: 60px;line-height: 60px">
<el-button type="primary" @click="onSubmit"></el-button>
<el-button>重置</el-button>
</div>
</div>
</el-col>
<el-col :span="12" style="height: 100%">

@ -48,10 +48,6 @@
</el-form-item>
</el-form>
<div style="text-align: center;height: 60px;line-height: 60px">
<el-button type="primary" @click="onSubmit"></el-button>
<el-button>重置</el-button>
</div>
</div>
</el-collapse-item>
<el-collapse-item title="数据配置" name="2">
@ -60,6 +56,10 @@
</div>
</el-collapse-item>
</el-collapse>
<div style="text-align: center;height: 60px;line-height: 60px">
<el-button type="primary" @click="onSubmit"></el-button>
<el-button>重置</el-button>
</div>
</div>
</el-col>
<el-col :span="12" style="height: 100%">

@ -206,7 +206,14 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="时间周期">
<el-form-item label="是否按照实时时间计算" >
<el-switch
v-model="equipmentIntervalForm.isRealTime"
active-color="#13ce66"
inactive-color="#ff4949">
</el-switch>
</el-form-item>
<el-form-item label="时间周期" v-if="!equipmentIntervalForm.isRealTime">
<el-date-picker
@change="timeChange"
v-model="equipmentIntervalForm.time"
@ -360,6 +367,7 @@ export default {
this.$set(this, 'equipmentIntervalForm', {
intervalType: firstDevice.intervalType,
interval: firstDevice.interval,
isRealTime: firstDevice.isRealTime,
time: [this.$parseTime(firstDevice?.startTime), this.$parseTime(firstDevice?.endTime)]
})
},
@ -444,8 +452,9 @@ export default {
...this.addEquipmentForm,
interval: this.equipmentIntervalForm.interval,
intervalType: this.equipmentIntervalForm.intervalType,
startTime: new Date(this.equipmentIntervalForm.time[0]).getTime(),
endTime: new Date(this.equipmentIntervalForm.time[1]).getTime(),
isRealTime:this.equipmentIntervalForm.isRealTime,
startTime: new Date(this.equipmentIntervalForm.time?.[0]).getTime(),
endTime: new Date(this.equipmentIntervalForm.time?.[1]).getTime(),
type: 2,
connectionStatus: -1,
isOpen: true
@ -455,8 +464,9 @@ export default {
...this.addEquipmentForm,
interval: this.equipmentIntervalForm.interval,
intervalType: this.equipmentIntervalForm.intervalType,
startTime: new Date(this.equipmentIntervalForm.time[0]).getTime(),
endTime: new Date(this.equipmentIntervalForm.time[1]).getTime(),
isRealTime:this.equipmentIntervalForm.isRealTime,
startTime: new Date(this.equipmentIntervalForm.time?.[0]).getTime(),
endTime: new Date(this.equipmentIntervalForm.time?.[1]).getTime(),
type: 2,
connectionStatus: -1,
isOpen: true

@ -28,17 +28,127 @@ const mappingFunction = async (data, method) => {
}
if (data.type === 2) {
let getTime = (e) => {
if (e === '1') {
return [(new Date().getTime() - (1000 * 60 * 60 * 24)), (new Date().getTime())]
}
if (e === '2') {
return [(new Date().getTime() - (1000 * 60 * 60 * 24)), (new Date().getTime())]
}
if (e === '3') {
return [(new Date().getTime() - (1000 * 60 * 60 * 24 * 7)), (new Date().getTime())]
}
if (e === '4') {
return [(new Date().getTime() - (1000 * 60 * 60 * 24 * 30)), (new Date().getTime())]
}
if (e === '5') {
return [(new Date().getTime() - (1000 * 60 * 60 * 24 * 365)), (new Date().getTime())]
}
}
const getTimeList = (e, isRealTime, startTimeArg, endTimeArg) => {
let startTime, endTime
if (!isRealTime) {
startTime = startTimeArg
endTime = endTimeArg
} else {
startTime = getTime(e)[0]
endTime = getTime(e)[1]
}
if (e === '1') {
let scope = Math.ceil((endTime - startTime) / (1000 * 60 * 60)) || 0
let arr = Array(scope).fill(1).map((v, k) => {
return parseTime(endTime - (1000 * 60 * 60) * k, '{y}-{m}-{d} {h}:{i}')
})
return arr
}
if (e === '2') {
let scope = Math.ceil((endTime - startTime) / (1000 * 60 * 60)) || 0
let arr = Array(scope).fill(1).map((v, k) => {
return parseTime(endTime - (1000 * 60 * 60) * k, '{y}-{m}-{d} {h}')
})
return arr
}
if (e === '3') {
let scope = Math.ceil((endTime - startTime) / (1000 * 60 * 60 * 24)) || 0
let arr = Array(scope).fill(1).map((v, k) => {
return parseTime(endTime - (1000 * 60 * 60 * 24) * k, '{y}-{m}-{d}')
})
return arr
}
if (e === '4') {
let scope = Math.ceil((endTime - startTime) / (1000 * 60 * 60 * 24)) || 0
let arr = Array(scope).fill(1).map((v, k) => {
return parseTime(endTime - (1000 * 60 * 60 * 24) * k, '{y}-{m}-{d}')
})
return arr
}
if (e === '5') {
let scope = Math.ceil((endTime - startTime) / (1000 * 60 * 60 * 24 * 30)) || 0
let arr = Array(scope).fill(1).map((v, k) => {
return parseTime(endTime - (1000 * 60 * 60 * 24 * 30) * k, '{y}-{m}')
})
return arr
}
}
let res2 = await getHistoryData({
deviceModeId: data.deviceModeId,
functionIdentifier: data.functionIdentifier,
interval: data.interval,
"sceneId": 144,
"deviceId": data.deviceId,
startTime: data.startTime,
endTime: data.endTime,
startTime: data.isRealTime ? getTime(data.interval)?.[0] : data.startTime,
endTime: data.isRealTime ? getTime(data.interval)?.[1] : data.endTime,
intervalType: 1 || data.intervalType,
})
console.log('datadata', data.interval)
console.log('datadata', data)
if (data.isRealTime) {
if (data.interval === '1') {
let arr = getTimeList(data.interval, data.isRealTime)
res2.data.groupDeviceData.dataList = arr.map(v => {
let data = res2.data.groupDeviceData.dataList.find(vv => parseTime(vv.time, '{y}-{m}-{d} {h}:{i}') === v)
return {...data, time: v}
})
}
if (data.interval === '2') {
let arr = getTimeList(data.interval, data.isRealTime)
res2.data.groupDeviceData.dataList = arr.map(v => {
let data = res2.data.groupDeviceData.dataList.find(vv => parseTime(vv.time, '{y}-{m}-{d} {h}') === v)
return {...data, time: v}
})
}
if (data.interval === '3') {
let arr = getTimeList(data.interval, data.isRealTime)
console.log('arr', arr)
res2.data.groupDeviceData.dataList = arr.map(v => {
let data = res2.data.groupDeviceData.dataList.find(vv => parseTime(vv.time, '{y}-{m}-{d}') === v)
return {...data, time: v}
})
}
if (data.interval === '4') {
let arr = getTimeList(data.interval, data.isRealTime)
console.log('arr', arr)
res2.data.groupDeviceData.dataList = arr.map(v => {
let data = res2.data.groupDeviceData.dataList.find(vv => parseTime(vv.time, '{y}-{m}-{d}') === v)
return {...data, time: v}
})
}
if (data.interval === '5') {
let arr = getTimeList(data.interval, data.isRealTime)
console.log('arr', arr)
res2.data.groupDeviceData.dataList = arr.map(v => {
let data = res2.data.groupDeviceData.dataList.find(vv => parseTime(vv.time, '{y}-{m}') === v)
return {...data, time: v}
})
}
} else {
if (data.interval === '5') {
res2.data.groupDeviceData.dataList = res2.data.groupDeviceData.dataList.map(e => {
return {...e, time: parseTime(e.time, '{y}-{m}')}
@ -52,6 +162,8 @@ const mappingFunction = async (data, method) => {
return {...e, time: parseTime(e.time, '{y}-{m}-{d} {h}:{i}:{s}')}
})
}
}
console.log(res2)
let returnRes = {}
method?.mappingArr?.forEach(v => {
let res = res2.data
@ -64,6 +176,7 @@ const mappingFunction = async (data, method) => {
}
}
if (v?.isArray && v?.mapData && Array.isArray(res)) {
console.log(res)
res = res.map(e => e[v.mapData])
}
returnRes = {

Loading…
Cancel
Save