diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/Intermodulation/components/LineChartForTraffic/chart.js b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/Intermodulation/components/LineChartForTraffic/chart.js index 95649615..7a4282db 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/Intermodulation/components/LineChartForTraffic/chart.js +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/Intermodulation/components/LineChartForTraffic/chart.js @@ -13,7 +13,7 @@ export const lineChartOption = { padding: [0, -15, 0, 0], }, boundaryGap: false, - data: ["0", "2", "4", "6", "8", "10", "12", "14", "16", "18", "20", "22"], + data: [], axisTick: { show: false, }, @@ -27,9 +27,7 @@ export const lineChartOption = { }, }, }, - yAxis: { - max: 1, name: "辆", type: "value", nameTextStyle: { @@ -85,7 +83,7 @@ export const lineChartOption = { }, series: [ { - data: [0, 0.3, 0.6, 0.24, 0.15, 0.66, 0.9, 0, 0.36, 0.51, 0.72, 0.6, 0.3], + data: [], type: "line", showSymbol: false, smooth: true, diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/Intermodulation/components/LineChartForTraffic/index.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/Intermodulation/components/LineChartForTraffic/index.vue index 31d73d94..b08b4147 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/Intermodulation/components/LineChartForTraffic/index.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/Intermodulation/components/LineChartForTraffic/index.vue @@ -8,8 +8,21 @@ import { lineChartOption } from "./chart" export default { name: 'LineChart', + props: { + xData: { + type: Array, + default: () => [] + }, + yData: { + type: Array, + default: () => [] + } + }, mounted() { const chartIns = echarts.init(this.$refs.LineChartRef); + console.log('lineChartOption', lineChartOption) + lineChartOption.xAxis.data = this.xData; + lineChartOption.series[0].data = this.yData; chartIns.setOption(lineChartOption); }, } diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/Intermodulation/index.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/Intermodulation/index.vue index 3e846243..ee3653bb 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/Intermodulation/index.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/Intermodulation/index.vue @@ -9,12 +9,10 @@ - - 当前车流量: 999辆 - + + 当前车流量: {{ carNum }}辆 + @@ -42,6 +40,7 @@ import { dialogDelayVisible } from "./../mixin"; import request from "@/utils/request"; import { Message } from "element-ui"; import RadioGroup from "@screen/components/FormConfig/components/RadioGroup/index.vue"; +import moment from 'moment/moment'; // 广播发布 export default { @@ -71,10 +70,19 @@ export default { brand: "XXX厂家", deviceState: "0", }, - + carNum: 0, + objectValue: { + '1': 0, + '3': 0 + }, + xData: [], + yData: [], + hzYData: [], + jnYData: [], + isShowCar: true, roadTypeList: [ - { key: "1", label: "济南方向" }, - { key: "3", label: "菏泽方向" }, + { key: "1", label: "菏泽方向" }, + { key: "3", label: "济南方向" }, ], roadType: "1", list: [ @@ -135,7 +143,51 @@ export default { const roadInfo = await getRoadInfoByStakeMark(this.dialogData.stakeMark); if (roadInfo) this.data.roadName = roadInfo.roadName; + + if (this.dialogData.iotDeviceId) { + this.getPropertiesHistory(this.dialogData.iotDeviceId); + } }, + methods: { + changeRadio(value) { + this.carNum = this.objectValue[value + '']; + this.isShowCar = false; + if (value == 3) { + this.yData = this.jnYData; + } else { + this.yData = this.hzYData; + } + console.log('xdata', this.xData); + console.log('ydata', this.hzYData); + console.log('rdata', this.jnYData); + setTimeout(() => { + this.isShowCar = true; + }, 1000) + }, + getPropertiesHistory(deviceId) { + this.xData = []; + this.yData = []; + this.hzYData = []; + this.jnYData = []; + + this.isShowCar = false; + request({ + url: `/business/device/properties/history/day/${deviceId}/01`, + method: "get", + }).then((result) => { + if (result.code != 200) return Message.error(result?.msg); + this.objectValue = result.data[0]; + this.carNum = result.data[0]['1']; + result.data.forEach(it => { + this.xData.push(moment(it.timestamp).format("HH:mm")); + this.hzYData.push(it['1']); + this.jnYData.push(it['3']); + this.yData = this.hzYData; + }) + this.isShowCar = true; + }); + } + } }; @@ -188,7 +240,7 @@ div.switcher { align-items: center; justify-content: end; - > div { + >div { font-size: 16px; padding: 6px 12px; } diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/control/event/plan/addAndEditDialog/index.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/control/event/plan/addAndEditDialog/index.vue index 22a37fea..97459bb7 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/control/event/plan/addAndEditDialog/index.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/control/event/plan/addAndEditDialog/index.vue @@ -32,7 +32,7 @@ - 执行操作: + *执行操作: @@ -42,7 +42,7 @@ - 恢复操作: + *恢复操作: @@ -312,22 +312,32 @@ export default { // this.submitting = false; let secondFormTable = this.$refs['secondFormTable'].tableData || []; let thirdFormTable = this.$refs['thirdFormTable'].tableData || []; - console.log('12', thirdFormTable); + let flg = false; + for (let item of secondFormTable) { + if (this.areAllValuesEmpty(item)) { flg = true; break }; + } + if (flg) return Message.warning('执行操作子项不能为空!'); + for (let item of thirdFormTable) { + if (this.areAllValuesEmpty(item)) { flg = true; break }; + } + if (flg) return Message.warning('恢复操作子项不能为空!'); + console.log('12', secondFormTable); + console.log('34', thirdFormTable); let dcArr = []; - let id = ''; - if (this.dialogType == 2) id = this.planId; - secondFormTable.forEach(it => { - dcArr.push(this.formatData(it, 1, id)); - }) - thirdFormTable.forEach(it => { - dcArr.push(this.formatData(it, 2, id)); - }) - - // console.log({ - // ...this.formData, - // dcExecuteAction: dcArr + // let id = ''; + // if (this.dialogType == 2) id = this.planId; + // secondFormTable.forEach(it => { + // dcArr.push(this.formatData(it, 1, id)); // }) - // return; + // thirdFormTable.forEach(it => { + // dcArr.push(this.formatData(it, 2, id)); + // }) + + console.log({ + ...this.formData, + dcExecuteAction: dcArr + }) + return; if (this.dialogType == 1) {//新增 request({ url: `/business/plans`, @@ -373,6 +383,18 @@ export default { }) + }, + areAllValuesEmpty(obj) { + console.log('ass',obj) + return Object.keys(obj).every(function (key) { + const value = obj[key]; + return ( + value == null || + value === '' || + (Array.isArray(value) && value.length === 0) || + (value instanceof Object && Object.keys(value).length === 0) + ); + }); } } }