quanyawei
2024-01-15 c9fc948cfa3cf91c072a13787aed5cb50fb31669
src/views/Equipment/index.vue
@@ -2,7 +2,10 @@
  <div style="padding: 20px">
    <el-card>
      <div style="display: flex">
        <div class="timee" style="margin-top: 0.5rem">
        <div
          class="timee"
          style="margin-top: 0.5rem"
        >
          {{ time }}
        </div>
        <div style="margin-left: 1.5rem">
@@ -13,10 +16,10 @@
            :props="props"
            collapse-tags
            clearable
            @change="changeYz"
            placeholder="选择设备"
            style="width: 25rem"
          ></el-cascader>
            @change="changeYz"
          />
        </div>
        <div style="margin-left: 1.5rem">
          <span>选择因子:</span>
@@ -27,10 +30,15 @@
            collapse-tags
            clearable
            @change="res"
          ></el-cascader>
          />
        </div>
        <div style="margin-left: 1.5rem">
          <el-button type="primary" @click="Equisel">查询</el-button>
          <el-button
            type="primary"
            @click="Equisel"
          >
            查询
          </el-button>
        </div>
      </div>
    </el-card>
@@ -42,12 +50,11 @@
    >
      <el-table-column
        v-for="item in columnList"
        :key="item"
        :prop="item"
        :label="item"
        width="180px"
        :key="item"
      >
      </el-table-column>
      />
    </el-table>
  </div>
</template>        
@@ -97,10 +104,24 @@
      }
    },
  },
  // 生命周期 - 创建完成(可以访问当前 this 实例)
  created () {
    this.time = this.dateTypeFormat('YYYY-mm-dd HH:MM:SS', new Date())
    this.getData()
  },
  // 生命周期 - 挂载完成(可以访问 DOM 元素)
  mounted () {},
  beforeCreate () {}, // 生命周期 - 创建之前
  beforeMount () {}, // 生命周期 - 挂载之前
  beforeUpdate () {}, // 生命周期 - 更新之前
  updated () {}, // 生命周期 - 更新之后
  beforeDestroy () {}, // 生命周期 - 销毁之前
  destroyed () {}, // 生命周期 - 销毁完成
  activated () {},
  //方法集合
  methods: {
    res(res){
      console.log(res.toString());
      console.log(res.toString())
    },
    getData() {
      this.$request({
@@ -118,6 +139,7 @@
              label: this.defaultData[i].name,
            })
            this.options[i].children = []
            if (this.defaultData[i].devices) {
            for (let j = 0; j < this.defaultData[i].devices.length; j++) {
              this.options[i].children.push({
                value: [
@@ -128,13 +150,14 @@
              })
            }
          }
          }
        })
        .catch((error) => {
          console.log(error)
        })
    },
    changeYz(){
      this.getSensor();
      this.getSensor()
    },
     getSensor() {
      this.$request({
@@ -145,7 +168,7 @@
        },
      })
        .then((result) => {
          console.log(result);
          console.log(result)
          var sensor = result.data
          for (var i in sensor) {
            this.newSensor.push({ value: i, label: sensor[i] })
@@ -165,7 +188,7 @@
          sensorCode:this.value1
        }
      }).then((res)=>{
        console.log(res);
        console.log(res)
        this.tableData = res.data
        console.log(this.tableData, 'this.tableData')
        for (let key in this.tableData[0]) {
@@ -176,21 +199,7 @@
        }
      })
    }
  },
  //生命周期 - 创建完成(可以访问当前 this 实例)
  created() {
    this.time = this.dateTypeFormat('YYYY-mm-dd HH:MM:SS', new Date())
    this.getData();
  },
  //生命周期 - 挂载完成(可以访问 DOM 元素)
  mounted() {},
  beforeCreate() {}, //生命周期 - 创建之前
  beforeMount() {}, //生命周期 - 挂载之前
  beforeUpdate() {}, //生命周期 - 更新之前
  updated() {}, //生命周期 - 更新之后
  beforeDestroy() {}, //生命周期 - 销毁之前
  destroyed() {}, //生命周期 - 销毁完成
  activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  }, // 如果页面有keep-alive缓存功能,这个函数会触发
}
</script>
<style scoped>