From 39880bb3cd54d412a0ed8f73f0c82005dbbbee44 Mon Sep 17 00:00:00 2001 From: quanyawei <401863037@qq.com> Date: Thu, 07 Mar 2024 15:07:42 +0800 Subject: [PATCH] fix:断线统计修改 --- src/views/onlineRate/index.vue | 37 +++++++++++++++++++++++++++---------- 1 files changed, 27 insertions(+), 10 deletions(-) diff --git a/src/views/onlineRate/index.vue b/src/views/onlineRate/index.vue index e62b284..de31d70 100644 --- a/src/views/onlineRate/index.vue +++ b/src/views/onlineRate/index.vue @@ -7,7 +7,7 @@ class="demo-form-inline" > <el-form-item label="������������:"> - <el-select + <!-- <el-select v-model="formInline.organizationId" placeholder="������������" > @@ -17,7 +17,16 @@ :label="item.name" :value="item.id" /> - </el-select> + </el-select> --> + <el-cascader + ref="cascader" + :show-all-levels="false" + :options="orgData" + collapse-tags + :props="props" + clearable + @change="changeCascader" + /> </el-form-item> <el-form-item> <el-radio-group @@ -209,7 +218,7 @@ data () { return { formInline: { - organizationId: '', + macs: [], hourState: '', state: '', startTime: '', @@ -220,6 +229,7 @@ macDate: {}, macOnlineData: {}, orgData: [], + props: { multiple: true, label: 'name', value: 'id', children: 'monitorPoint' }, tableData: [], handleShow: false, loading: false, @@ -298,13 +308,20 @@ } }, mounted () { + this.getOrganizationId() this.$set(this.selectTime, 0, new Date(dayjs().startOf('day').format('YYYY-MM-DD HH:mm'))) this.$set(this.selectTime, 1, new Date(dayjs().format('YYYY-MM-DD HH:mm'))) }, created () { - this.getOrganizationId() + }, methods: { + changeCascader (val) { + let nodesInfo = this.$refs['cascader'].getCheckedNodes() + let macList = nodesInfo.map(({ data: { mac } }) => mac) + this.formInline.macs = macList.filter(item => item !== undefined) + console.log(macList) + }, changeDay () { console.log('this.selectTime', this.selectTime) if (this.selectTime !== null) { @@ -328,15 +345,15 @@ console.log(this.macDate) }, handleSearch () { - this.getOnlineData() console.log(' this.formInline', this.formInline) - if (this.formInline.organizationId !== '') { + if (this.formInline.macs.length > 0) { if (this.time === '������') { console.log('������������') this.formInline.startTime = dayjs().startOf('day').format('YYYY-MM-DD HH:mm') this.formInline.endTime = dayjs().subtract(1, 'hour').format('YYYY-MM-DD HH:mm') } this.loading = true + this.getOnlineData() this.$request({ url: '/onlineRate/page', method: 'post', @@ -358,9 +375,9 @@ getOnlineData () { this.$request({ url: '/onlineRate/state', - method: 'get', - params: { - organizationId: this.formInline.organizationId + method: 'post', + data: { + macs: this.formInline.macs } }) .then(res => { @@ -372,7 +389,7 @@ }, getOrganizationId () { this.$request({ - url: '/organization/getOrganizationId', + url: '/organization/queryDevices', method: 'get' }) .then(res => { -- Gitblit v1.8.0