<template>
  <div class="knowledge-5">
    <div class="query mg-b-8">
      <div class="query-items">
        <div class="query-item">
          <div class="lable">查询内容：</div>
          <div class="search-input">
            <el-input v-model="content" placeholder="请输入查询内容"></el-input>
          </div>
        </div>
      </div>
      <div class="query-actions">
        <button class="btn green" @click="onClickSearch">搜索</button>
      </div>
    </div>
    <div>
      <ComTable :data="tableData" height="85vh"></ComTable>
    </div>
  </div>
</template>

<script>
import ComTable from "@com/coms/table/table.vue";

export default {
  components: { ComTable },
  data() {
    return {
      content: "",
      tableData: {
        column: [
          {
            name: "设备类型",
            field: "modelid",
            is_num: true,
            is_light: false,
          },
          {
            name: "特征名称",
            field: "name",
            is_num: false,
            is_light: false,
          },
          {
            name: "特征描述",
            field: "description",
            is_num: false,
            is_light: false,
          },
          {
            name: "设备结构",
            field: "structureid",
            is_num: false,
            is_light: false,
          },
          {
            name: "设备结构组成",
            field: "componentid",
            is_num: false,
            is_light: false,
          },
          {
            name: "测点统一编码",
            field: "uniformcode",
            is_num: false,
            is_light: false,
          },
          {
            name: "最小值",
            field: "minvalue",
            is_num: false,
            is_light: false,
          },
          {
            name: "最大值",
            field: "maxvalue",
            is_num: false,
            is_light: false,
          },
          {
            name: "正常范围下限",
            field: "normalmin",
            is_num: false,
            is_light: false,
          },
          {
            name: "正常范围上限",
            field: "normalmax",
            is_num: false,
            is_light: false,
          },
          {
            name: "预警值",
            field: "prealertvalue",
            is_num: false,
            is_light: false,
          },
          {
            name: "报警值",
            field: "alertvalue",
            is_num: false,
            is_light: false,
          },
          {
            name: "是否启用",
            field: "enable",
            is_num: false,
            is_light: false,
          },
        ],
        data: [],
      },
    };
  },
  created() {
    this.requestSafeList();
  },
  methods: {
    // 搜索按钮
    onClickSearch() {
      this.requestSafeList();
    },
    requestSafeList() {
      let that = this;
      this.API.requestData({
        method: "GET",
        baseURL: "http://10.155.32.4:8034/",
        subUrl: "/experienceBase/tzcs",
        data: {
          name: that.content,
          pageNum: 1,
          pageSize: 1000,
        }, // 请求所携带参数，默认为空，可缺省
        success(res) {
          if (res.code == 200) {
            that.tableData.data = [];
            res.data.forEach((item) => {
              item.enable = "启用";
              that.tableData.data.push(item);
            });
          }
        },
      });
    },
  },
};
</script>

<style lang="less" scope>
@titleGray: #9ca5a8;
@rowGray: #606769;
@darkBack: #536268;
.knowledge-5 {
  .el-select {
    width: 200px;
  }
  .el-input {
    width: 200px;
  }
}
</style>
