quanyawei
2023-11-08 db3d64468f03313153cee458fc363057034b99be
fix:高值修改
2 files modified
99 ■■■■ changed files
src/assets/json/sensor.json 1 ●●●● patch | view | raw | blame | history
src/views/charts/index.vue 98 ●●●● patch | view | raw | blame | history
src/assets/json/sensor.json
@@ -1,6 +1,7 @@
{
  "flylon": "经度",
  "a00e12": "光照强度",
  "a05001": "光照强度",
  "a00e34": "TSP",
  "a00e13": "噪音",
  "a21005": "一氧化碳",
src/views/charts/index.vue
@@ -12,8 +12,17 @@
        style="width: 354px"
      />
      <!-- <div> -->
      <el-select v-model="value" placeholder="选择因子" style="margin-left: 20px">
        <el-option v-for="(item, index) in newSensor" :key="index" :label="item.label" :value="item.value" />
      <el-select
        v-model="value"
        placeholder="选择因子"
        style="margin-left: 20px"
      >
        <el-option
          v-for="(item, index) in newSensor"
          :key="index"
          :label="item.label"
          :value="item.value"
        />
      </el-select>
      <!-- </div> -->
      <!-- <el-radio-group v-model="radio1" style="margin-left:20px">
@@ -22,8 +31,17 @@
        <el-radio-button label="月报" />
        <el-radio-button label="自定义" />
      </el-radio-group> -->
      <el-select v-model="select1" placeholder="请选择" style="margin-left: 20px; width: 200px">
        <el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value" />
      <el-select
        v-model="select1"
        placeholder="请选择"
        style="margin-left: 20px; width: 200px"
      >
        <el-option
          v-for="item in options1"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        />
      </el-select>
      <component
        :is="dataType"
@@ -35,13 +53,29 @@
      <el-button class="btn1" @click="selectData">查询</el-button>
    </div>
    <div class="topTitle">
      <div style="position: absolute">{{ selectyz }}</div>
      <div style="position: absolute">
        {{ selectyz }}
      </div>
      <!-- <div style="text-align: center;width: 100%;">{{ newData }}·{{ newMac?newMac[0]:'' }}·{{ newMac?newMac[newMac.length - 1][0]:'' }}·{{ value |sensorFilter }}·趋势图</div> -->
    </div>
    <LineChart :chart-data="lineChartData" style="height: 40rem" />
    <div style="padding: 0px 10px;margin-bottom: 50px;">
      <el-table v-if="searchData.length>0" :data="tableData" border size="mini" style="width: 100%" max-height="250" tooltip-effect="dark">
        <el-table-column prop="rankingTitle" label="日期" width="100" align="center" fixed="left">
    <div style="padding: 0px 10px; margin-bottom: 50px">
      <el-table
        v-if="searchData.length > 0"
        :data="tableData"
        border
        size="mini"
        style="width: 100%"
        max-height="250"
        tooltip-effect="dark"
      >
        <el-table-column
          prop="rankingTitle"
          label="日期"
          width="100"
          align="center"
          fixed="left"
        >
          <el-table-column
            prop="rankingTitle"
            class-name="rankingTitle"
@@ -52,15 +86,28 @@
          />
        </el-table-column>
        <template v-for="(th, thIndex) in thArr">
          <el-table-column :key="thIndex" align="center" :label="th.label" :prop="th.prop" :show-overflow-tooltip="true" min-width="120">
          <el-table-column
            :key="thIndex"
            align="center"
            :label="th.label"
            :prop="th.prop"
            :show-overflow-tooltip="true"
            min-width="120"
          >
            <template slot-scope="scope">
              <div style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;" v-html="scope.row[th.prop]" />
              <div
                style="
                  overflow: hidden;
                  white-space: nowrap;
                  text-overflow: ellipsis;
                "
                v-html="scope.row[th.prop]"
              />
            </template>
          </el-table-column>
        </template>
      </el-table>
    </div>
  </div>
</template>
@@ -111,7 +158,7 @@
  },
  filters: {
    sensorFilter: function(value) {
      if (!value) return ''
      if (!value) { return '' }
      return json[value]
    }
  },
@@ -186,14 +233,14 @@
      const sobj = {}
      if (this.searchData.length > 0) {
        this.searchData.forEach((item, index) => {
          if (item.deviceData.length > 0) {
          fobj['souceData' + index] = this.sortFind(item.deviceData)[0].name
          sobj['souceData' + index] = this.sortFind(item.deviceData)[1]?.name ? this.sortFind(item.deviceData)[1]?.name : '--'
          }
        })
      }
      data.push({ ...fobj, rankingTitle: '第一高值' }, { ...sobj, rankingTitle: '第二高值' })
      console.log('firstData', fobj)
      console.log('souceData', sobj)
      console.log('datadatadata', data)
      return data
    }
  },
@@ -299,12 +346,22 @@
      let b = ''
      // const duplicateValue = _.orderBy(this.refrain(data), ['sensorValue'], ['desc']) // 重复值排序
      // console.log('duplicateValue', duplicateValue)
      const originalValue = _.orderBy(data, ['sensorValue'], ['desc'])
      let allData = data.map(item => {
        if (item.sensorValue !== null) {
          return item
        } else {
          item.sensorValue = '0.0'
          return item
        }
      })
      const originalValue = _.orderBy(allData, ['sensorValue'], ['desc'])
      const firstIndex = []
      const fiestDateList = []
      const secondeIndex = []
      const secondeDateList = []
      console.log('originalValue', originalValue)
      console.log('allData', allData)
      if ((Number(originalValue[0].sensorValue) === Number(0))) {
        return [{ name: '--' }, { name: '--' }]
      }
@@ -358,10 +415,7 @@
          })
        }
      }
      console.log('fiestDateList', fiestDateList)
      console.log('secondeDateList', secondeDateList)
      arr = fiestDateList.concat(secondeDateList)
      console.log('arr', arr)
      return arr
      // console.log('refrainrefrainrefrain', this.refrain(data))
      // const arr = []
@@ -567,7 +621,7 @@
}
/*核心代码*/
::v-deep .el-table thead.is-group tr:first-of-type th:first-of-type:before {
  content: "";
  content: '';
  position: absolute;
  width: 1px;
  height: 100px; /*斜线的长度*/
@@ -582,7 +636,7 @@
}
::v-deep .el-table thead.is-group tr:last-of-type th:first-of-type:before {
  content: "";
  content: '';
  position: absolute;
  width: 1px;
  height: 100px; /*斜线的长度*/