<template>
  <div class="knowledge-4">
    <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: "station",
            is_num: true,
            is_light: false,
          },
          {
            name: "位置",
            field: "location",
            is_num: false,
            is_light: false,
          },
          {
            name: "工作内容",
            field: "content",
            is_num: false,
            is_light: false,
          },
          {
            name: "描述",
            field: "describe",
            is_num: false,
            is_light: false,
          },
          {
            name: "添加时间",
            field: "addtime",
            is_num: false,
            is_light: false,
          },
          {
            name: "状态",
            field: "state",
            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/zyzdzs",
        data: {
          name: that.content,
          pageNum: 1,
          pageSize: 1000,
        }, // 请求所携带参数，默认为空，可缺省
        success(res) {
          if (res.code == 200) {
            that.tableData.data = [];
             res.data.forEach((item) => {
              item.addtime = new Date(item.addtime).formatDate("yyyy-MM-dd hh:mm:ss")
              that.tableData.data.push(item);
            });
          }
        },
      });
    },
  },
};
</script>

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