quanyawei
2024-03-07 39880bb3cd54d412a0ed8f73f0c82005dbbbee44
fix:断线统计修改
1 files modified
37 ■■■■ changed files
src/views/onlineRate/index.vue 37 ●●●● patch | view | raw | blame | history
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 => {