<template>
  <div class="div-container">
    <div class="top">
      <span style="margin: 0 12px 0 0">关键字</span>
      <a-input
        v-model:value="value"
        placeholder="请输入设备类型名称,统计单位"
        style="margin: 0 12px 0 0"
      />
      <span style="margin: 0 12px 0 0">所属类别</span>
      <a-input
        v-model:value="value"
        placeholder="请输入设备类型名称,统计单位"
        style="margin: 0 12px 0 0"
      />
      <span style="margin: 0 12px 0 0">所属对象</span>
      <a-input
        v-model:value="value"
        placeholder="请输入设备类型名称,统计单位"
        style="margin: 0 12px 0 0"
      />
      <span style="margin: 0 12px 0 0">设备状态</span>
      <a-input
        v-model:value="value"
        placeholder="请输入设备类型名称,统计单位"
        style="margin: 0 12px 0 0"
      />
      <a-button type="primary" style="margin: 0 12px 0 0"><SearchOutlined />查询</a-button>
      <a-button type="primary" style="margin: 0 12px 0 0" @click="addInfo"
        ><PlusOutlined />添加</a-button
      >
      <a-button type="primary" danger><DeleteOutlined />删除</a-button>
    </div>
    <div class="table-body">
      <wtable :tableData="tableData" />
    </div>
    <dialogForm ref="dialog" />
  </div>
</template>
<script setup lang="ts">
  import { SearchOutlined, PlusOutlined, DeleteOutlined } from '@ant-design/icons-vue';
  import { ref, reactive, onMounted } from 'vue';
  import wtable from '../../../compt/wtable.vue';
  import dialogForm from './dialogForm.vue';

  const dialog = ref();
  const value = ref('');
  onMounted(() => {
    console.log(dialog.value); // Proxy {…}
  });
  let tableData = reactive({
    columns: [
      {
        title: '序号',
        width: '100px',
        dataIndex: 'index',
        key: 'index',
        customRender: (text) => {
          return text.index + 1;
        },
      },
      {
        title: '设备名称',
        dataIndex: 'name',
      },
      {
        title: '设备编码',
        dataIndex: 'age',
      },
      {
        title: '设备类型',
        dataIndex: 'address',
      },
      {
        title: '设备型号',
        dataIndex: 'address',
      },
      {
        title: '设备状态',
        dataIndex: 'address',
      },
      {
        title: '监测类型',
        dataIndex: 'address',
      },
      {
        title: '所属类别',
        dataIndex: 'address',
      },
      {
        title: '所属对象',
        dataIndex: 'address',
      },
      {
        title: '操作',
        dataIndex: 'address',
      },
    ],
  });

  function addInfo() {
    dialog.value.show();
  }
</script>

<style lang="less" scoped>
  .div-container {
    width: 100%;
    height: 100%;
    background: #fff;
    padding: 10px;
    margin-right: 0;

    .top {
      width: 100%;
      height: 40px;
      background: #fff;
      line-height: 40px;
    }

    .ant-input {
      width: 240px;
      height: 30px;
    }

    .table-body {
      height: 100%;
    }
  }
</style>
