<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"
      />
      <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 style="margin: 0 12px 0 0"><DeleteOutlined />删除</a-button>
      <a-button type="primary" style="margin: 0 12px 0 0">绑定设备</a-button>
      <a-button type="primary" style="margin: 0 12px 0 0">解绑设备</a-button>
      <a-button type="primary" style="margin: 0 12px 0 0">导入</a-button>
      <a-button type="primary" style="margin: 0 12px 0 0">导出</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>
