|
|
@ -3,6 +3,8 @@
|
|
|
|
<div style="width: 90%;margin: 0 auto ">
|
|
|
|
<div style="width: 90%;margin: 0 auto ">
|
|
|
|
<div style="margin: 8px 0">
|
|
|
|
<div style="margin: 8px 0">
|
|
|
|
<el-button type="primary" @click="addRequest()">添加</el-button>
|
|
|
|
<el-button type="primary" @click="addRequest()">添加</el-button>
|
|
|
|
|
|
|
|
<el-button type="primary" @click="setInterval()">设置设备获取数据间隔</el-button>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div v-for="(i,k) in requests" style="display: inline-block;margin: 0 8px 8px 0">
|
|
|
|
<div v-for="(i,k) in requests" style="display: inline-block;margin: 0 8px 8px 0">
|
|
|
@ -81,13 +83,13 @@
|
|
|
|
<div style="width: calc(100% - 50px - 150px);height: 100%;display: inline-block;vertical-align: top">
|
|
|
|
<div style="width: calc(100% - 50px - 150px);height: 100%;display: inline-block;vertical-align: top">
|
|
|
|
<div style="width: 100%;height: 50%;padding-left: 12px;line-height: 25px;font-weight: 700">
|
|
|
|
<div style="width: 100%;height: 50%;padding-left: 12px;line-height: 25px;font-weight: 700">
|
|
|
|
<span>
|
|
|
|
<span>
|
|
|
|
{{ i.deviceId || '设备' }}
|
|
|
|
{{ i.deviceName || i.deviceId || '设备' }}
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
<div
|
|
|
|
style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis; width: 175%;height: 50%;padding-left: 12px;line-height: 25px;font-size: 12px;color: #0009">
|
|
|
|
style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis; width: 175%;height: 50%;padding-left: 12px;line-height: 25px;font-size: 12px;color: #0009">
|
|
|
|
<span>
|
|
|
|
<span>
|
|
|
|
{{ i.functionIdentifier || '属性' }}
|
|
|
|
{{ i.functionIdentifierName || i.functionIdentifier || '属性' }}
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
@ -185,6 +187,42 @@
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
</el-dialog>
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-dialog
|
|
|
|
|
|
|
|
title="设置设备获取数据间隔"
|
|
|
|
|
|
|
|
append-to-body
|
|
|
|
|
|
|
|
:visible.sync="setIntervalDialogVisible"
|
|
|
|
|
|
|
|
width="30%">
|
|
|
|
|
|
|
|
<el-form :model="equipmentIntervalForm" label-width="120px">
|
|
|
|
|
|
|
|
<el-form-item label="数据间隔" v-if="false">
|
|
|
|
|
|
|
|
<el-input v-model="equipmentIntervalForm.intervalType"></el-input>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item label="数据间隔">
|
|
|
|
|
|
|
|
<el-select v-model="equipmentIntervalForm.interval" placeholder="请选择" @change="changeInterval">
|
|
|
|
|
|
|
|
<el-option
|
|
|
|
|
|
|
|
v-for="item in intervalOption"
|
|
|
|
|
|
|
|
:key="item.value"
|
|
|
|
|
|
|
|
:label="item.label"
|
|
|
|
|
|
|
|
:value="item.value">
|
|
|
|
|
|
|
|
</el-option>
|
|
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item label="时间周期">
|
|
|
|
|
|
|
|
<el-date-picker
|
|
|
|
|
|
|
|
@change="timeChange"
|
|
|
|
|
|
|
|
v-model="equipmentIntervalForm.time"
|
|
|
|
|
|
|
|
type="datetimerange"
|
|
|
|
|
|
|
|
range-separator="至"
|
|
|
|
|
|
|
|
start-placeholder="开始日期"
|
|
|
|
|
|
|
|
end-placeholder="结束日期">
|
|
|
|
|
|
|
|
</el-date-picker>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
|
|
|
|
|
<el-button @click="setIntervalDialogVisible = false">取 消</el-button>
|
|
|
|
|
|
|
|
<el-button type="primary" @click="setIntervalOk">确 定</el-button>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
|
|
<el-dialog
|
|
|
|
<el-dialog
|
|
|
|
title="网络请求"
|
|
|
|
title="网络请求"
|
|
|
|
append-to-body
|
|
|
|
append-to-body
|
|
|
@ -205,7 +243,7 @@
|
|
|
|
:visible.sync="addEquipmentFormDialogVisible"
|
|
|
|
:visible.sync="addEquipmentFormDialogVisible"
|
|
|
|
width="30%">
|
|
|
|
width="30%">
|
|
|
|
<el-form :model="addEquipmentForm" label-width="120px">
|
|
|
|
<el-form :model="addEquipmentForm" label-width="120px">
|
|
|
|
<EquipmentRequest :form="addEquipmentForm"/>
|
|
|
|
<EquipmentRequest :form="addEquipmentForm" v-if="addEquipmentFormDialogVisible"/>
|
|
|
|
</el-form>
|
|
|
|
</el-form>
|
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
|
<el-button @click="addEquipmentFormDialogVisible = false">取 消</el-button>
|
|
|
|
<el-button @click="addEquipmentFormDialogVisible = false">取 消</el-button>
|
|
|
@ -228,7 +266,7 @@
|
|
|
|
v-model="i.region"
|
|
|
|
v-model="i.region"
|
|
|
|
:options="options" @change="mappingChange(i,k)"></el-cascader>
|
|
|
|
:options="options" @change="mappingChange(i,k)"></el-cascader>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="将数据某一项集合" v-if="i.isArray">
|
|
|
|
<el-form-item label="将数据某一项集合" v-if="(!((limit||{}).isDataSet===false))&& i.isArray">
|
|
|
|
<el-select v-model="i.mapData" clearable placeholder="非必选">
|
|
|
|
<el-select v-model="i.mapData" clearable placeholder="非必选">
|
|
|
|
<el-option :label="i.label" :value="i.value" v-for="i in enumOption"></el-option>
|
|
|
|
<el-option :label="i.label" :value="i.value" v-for="i in enumOption"></el-option>
|
|
|
|
</el-select>
|
|
|
|
</el-select>
|
|
|
@ -262,7 +300,7 @@ export default {
|
|
|
|
InterfaceRequest,
|
|
|
|
InterfaceRequest,
|
|
|
|
EquipmentRequest
|
|
|
|
EquipmentRequest
|
|
|
|
},
|
|
|
|
},
|
|
|
|
props: ['requests'],
|
|
|
|
props: ['requests', 'limit'],
|
|
|
|
data() {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
value: false,
|
|
|
|
value: false,
|
|
|
@ -271,11 +309,13 @@ export default {
|
|
|
|
networkImg,
|
|
|
|
networkImg,
|
|
|
|
customizationRequestImg,
|
|
|
|
customizationRequestImg,
|
|
|
|
addRequestDialogVisible: false,
|
|
|
|
addRequestDialogVisible: false,
|
|
|
|
|
|
|
|
setIntervalDialogVisible: false,
|
|
|
|
addRequestFormDialogVisible: false,
|
|
|
|
addRequestFormDialogVisible: false,
|
|
|
|
addEquipmentFormDialogVisible: false,
|
|
|
|
addEquipmentFormDialogVisible: false,
|
|
|
|
mappingDialogVisible: false,
|
|
|
|
mappingDialogVisible: false,
|
|
|
|
addRequestForm: {},
|
|
|
|
addRequestForm: {},
|
|
|
|
addEquipmentForm: {},
|
|
|
|
addEquipmentForm: {},
|
|
|
|
|
|
|
|
equipmentIntervalForm: {},
|
|
|
|
mappingForm: {},
|
|
|
|
mappingForm: {},
|
|
|
|
option: [],
|
|
|
|
option: [],
|
|
|
|
enumOption: [],
|
|
|
|
enumOption: [],
|
|
|
@ -283,17 +323,88 @@ export default {
|
|
|
|
updateIndex: 0,
|
|
|
|
updateIndex: 0,
|
|
|
|
updateDeviceFlag: false,
|
|
|
|
updateDeviceFlag: false,
|
|
|
|
updateDeviceIndex: 0,
|
|
|
|
updateDeviceIndex: 0,
|
|
|
|
|
|
|
|
intervalOption: [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
label: '时',
|
|
|
|
|
|
|
|
value: '1',
|
|
|
|
|
|
|
|
default: 1
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
label: '日',
|
|
|
|
|
|
|
|
value: '2',
|
|
|
|
|
|
|
|
default: 24
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
label: '周',
|
|
|
|
|
|
|
|
value: '3',
|
|
|
|
|
|
|
|
default: 7
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
label: '月',
|
|
|
|
|
|
|
|
value: '4',
|
|
|
|
|
|
|
|
default: 30
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
label: '年',
|
|
|
|
|
|
|
|
value: '5',
|
|
|
|
|
|
|
|
default: 12
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
mounted() {
|
|
|
|
if (!this.requests || !Array.isArray(this.requests)) {
|
|
|
|
if (!this.requests || !Array.isArray(this.requests)) {
|
|
|
|
this.requests = []
|
|
|
|
this.requests = []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
let firstDevice = this.requests.find(e => e.type === 2)
|
|
|
|
|
|
|
|
this.$set(this, 'equipmentIntervalForm', {
|
|
|
|
|
|
|
|
intervalType: firstDevice.intervalType,
|
|
|
|
|
|
|
|
interval: firstDevice.interval,
|
|
|
|
|
|
|
|
time: [this.$parseTime(firstDevice?.startTime), this.$parseTime(firstDevice?.endTime)]
|
|
|
|
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
addRequest() {
|
|
|
|
addRequest() {
|
|
|
|
this.addRequestDialogVisible = true
|
|
|
|
this.addRequestDialogVisible = true
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
setInterval() {
|
|
|
|
|
|
|
|
this.setIntervalDialogVisible = true
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
changeInterval(e) {
|
|
|
|
|
|
|
|
let data = this.intervalOption.find(v => v.value === e)
|
|
|
|
|
|
|
|
this.$set(this.equipmentIntervalForm, 'intervalType', data.default)
|
|
|
|
|
|
|
|
if (e === '1') {
|
|
|
|
|
|
|
|
this.equipmentIntervalForm.time = [this.$parseTime(new Date().getTime() - (1000 * 60 * 60 * 24)), this.$parseTime(new Date())]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (e === '2') {
|
|
|
|
|
|
|
|
this.equipmentIntervalForm.time = [this.$parseTime(new Date().getTime() - (1000 * 60 * 60 * 24)), this.$parseTime(new Date())]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (e === '3') {
|
|
|
|
|
|
|
|
this.equipmentIntervalForm.time = [this.$parseTime(new Date().getTime() - (1000 * 60 * 60 * 24 * 7)), this.$parseTime(new Date())]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (e === '4') {
|
|
|
|
|
|
|
|
this.equipmentIntervalForm.time = [this.$parseTime(new Date().getTime() - (1000 * 60 * 60 * 24 * 30)), this.$parseTime(new Date())]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (e === '5') {
|
|
|
|
|
|
|
|
this.equipmentIntervalForm.time = [this.$parseTime(new Date().getTime() - (1000 * 60 * 60 * 24 * 365)), this.$parseTime(new Date())]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.$set(this.equipmentIntervalForm, 'startTime', new Date(this.equipmentIntervalForm.time[0]).getTime())
|
|
|
|
|
|
|
|
this.$set(this.equipmentIntervalForm, 'endTime', new Date(this.equipmentIntervalForm.time[1]).getTime())
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
timeChange() {
|
|
|
|
|
|
|
|
this.$set(this.form, 'startTime', new Date(this.time[0]).getTime())
|
|
|
|
|
|
|
|
this.$set(this.form, 'endTime', new Date(this.time[1]).getTime())
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
setIntervalOk() {
|
|
|
|
|
|
|
|
this.requests.forEach((e,k) => {
|
|
|
|
|
|
|
|
if (e.type === 2) {
|
|
|
|
|
|
|
|
this.$set(this.requests[k], 'interval', this.equipmentIntervalForm.interval)
|
|
|
|
|
|
|
|
this.$set(this.requests[k], 'intervalType', this.equipmentIntervalForm.intervalType)
|
|
|
|
|
|
|
|
this.$set(this.requests[k], 'startTime', new Date(this.equipmentIntervalForm.time[0]).getTime())
|
|
|
|
|
|
|
|
this.$set(this.requests[k], 'endTime', new Date(this.equipmentIntervalForm.time[1]).getTime())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
subtractRequest(key) {
|
|
|
|
subtractRequest(key) {
|
|
|
|
if (this.requests?.length > 1) {
|
|
|
|
if (this.requests?.length > 1) {
|
|
|
|
this.$delete(this.requests, key)
|
|
|
|
this.$delete(this.requests, key)
|
|
|
@ -327,9 +438,15 @@ export default {
|
|
|
|
this.addRequestForm = {}
|
|
|
|
this.addRequestForm = {}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
addEquipmentConfirm() {
|
|
|
|
addEquipmentConfirm() {
|
|
|
|
|
|
|
|
console.log('123123,345345,12313',this.addEquipmentForm)
|
|
|
|
|
|
|
|
console.log('123123,345345,12313',this.requests)
|
|
|
|
if (this.updateDeviceFlag) {
|
|
|
|
if (this.updateDeviceFlag) {
|
|
|
|
this.$set(this.requests, this.updateDeviceIndex, Vue.observable({
|
|
|
|
this.$set(this.requests, this.updateDeviceIndex, Vue.observable({
|
|
|
|
...this.addEquipmentForm,
|
|
|
|
...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(),
|
|
|
|
type: 2,
|
|
|
|
type: 2,
|
|
|
|
connectionStatus: -1,
|
|
|
|
connectionStatus: -1,
|
|
|
|
isOpen: true
|
|
|
|
isOpen: true
|
|
|
@ -337,6 +454,10 @@ export default {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
this.requests.push(Vue.observable({
|
|
|
|
this.requests.push(Vue.observable({
|
|
|
|
...this.addEquipmentForm,
|
|
|
|
...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(),
|
|
|
|
type: 2,
|
|
|
|
type: 2,
|
|
|
|
connectionStatus: -1,
|
|
|
|
connectionStatus: -1,
|
|
|
|
isOpen: true
|
|
|
|
isOpen: true
|
|
|
@ -358,7 +479,7 @@ export default {
|
|
|
|
this.$set(this.requests[k], 'connectionStatus', 0)
|
|
|
|
this.$set(this.requests[k], 'connectionStatus', 0)
|
|
|
|
getHistoryData({
|
|
|
|
getHistoryData({
|
|
|
|
deviceModeId: i.deviceModeId,
|
|
|
|
deviceModeId: i.deviceModeId,
|
|
|
|
functionIdentifier: i.functionIdentifier + '1',
|
|
|
|
functionIdentifier: i.functionIdentifier,
|
|
|
|
interval: i.interval,
|
|
|
|
interval: i.interval,
|
|
|
|
"sceneId": 144,
|
|
|
|
"sceneId": 144,
|
|
|
|
"deviceId": i.deviceId,
|
|
|
|
"deviceId": i.deviceId,
|
|
|
@ -472,9 +593,9 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async setDeviceMapping(i, k) {
|
|
|
|
async setDeviceMapping(i, k) {
|
|
|
|
if (!this.requests?.[k]?.request) {
|
|
|
|
if (!this.requests?.[k]?.request) {
|
|
|
|
getHistoryData({
|
|
|
|
await getHistoryData({
|
|
|
|
deviceModeId: i.deviceModeId,
|
|
|
|
deviceModeId: i.deviceModeId,
|
|
|
|
functionIdentifier: i.functionIdentifier + '1',
|
|
|
|
functionIdentifier: i.functionIdentifier,
|
|
|
|
interval: i.interval,
|
|
|
|
interval: i.interval,
|
|
|
|
"sceneId": 144,
|
|
|
|
"sceneId": 144,
|
|
|
|
"deviceId": i.deviceId,
|
|
|
|
"deviceId": i.deviceId,
|
|
|
|