<template>
  <div class="ele-body">
    <el-card shadow="never" v-loading="loading">
      <div class="ele-border-lighter form-content" v-loading="loading">
        <!-- <contact-search @search="reload"> </contact-search> -->

        <!-- 数据表格 -->
        <ele-pro-table
          ref="table"
          :columns="columns"
          :datasource="datasource"
          height="calc(100vh - 300px)"
          full-height="calc(100vh - 116px)"
          tool-class="ele-toolbar-form"
          :selection.sync="selection"
          cache-key="eomContactPageTable"
        >
        </ele-pro-table>
      </div>
    </el-card>
  </div>
</template>

<script>
  // import ContactSearch from './components/contactSearch.vue';
  import {
    contactPage,
  } from '@/api/bpm/components/saleManage/contact';
  import dictMixins from '@/mixins/dictMixins';

  export default {
    mixins: [dictMixins],
    props: {
    },
    components: {

    },
    data() {
      return {
        selection: [],
        delVisible: false,
        // 加载状态
        loading: false,
        columns: [
          {
            width: 45,
            type: 'selection',
            columnKey: 'selection',
            align: 'center'
          },
          {
            columnKey: 'index',
            label: '序号',
            type: 'index',
            width: 55,
            align: 'center',
            showOverflowTooltip: true,
            fixed: 'left'
          },
          {
            prop: 'code',
            label: '供应商编码',
            align: 'center',
            showOverflowTooltip: true,
            minWidth: 140
          },
          {
            prop: 'name',
            label: '供应商名称',
            align: 'center',
            slot: 'name',
            showOverflowTooltip: true,
            minWidth: 200
          },
          {
            prop: 'serialNo',
            label: '供应商代号',
            align: 'center',
            showOverflowTooltip: true,
            minWidth: 140
          },
          {
            prop: 'phone',
            label: '供应商电话',
            align: 'center',
            showOverflowTooltip: true,
            minWidth: 120
          },
          {
            prop: 'addressName',
            label: '单位地址',
            align: 'center',
            showOverflowTooltip: true,
            minWidth: 120,
            formatter: (_row, _column, cellValue) => {
              let addr =
                '' + _row.addressName
                  ? _row.addressName.replaceAll(',', '')
                  : '';
              addr += _row.address ? _row.address : '';
              return addr;
            }
          },
          {
            prop: 'linkName',
            label: '联系人',
            align: 'center',
            showOverflowTooltip: true,
            minWidth: 120
          },
          {
            prop: 'linkPhone',
            label: '联系人电话',
            align: 'center',
            showOverflowTooltip: true,
            minWidth: 120
          },
          {
            prop: 'status',
            label: '状态',
            align: 'center',
            showOverflowTooltip: true,
            minWidth: 100,
            formatter: (_row, _column, cellValue) => {
              return _row.status === 1 ? '启用' : '禁用';
            }
          },
          {
            prop: 'createUsername',
            label: '创建人',
            align: 'center',
            showOverflowTooltip: true,
            minWidth: 100
          },
          {
            prop: 'createTime',
            label: '创建时间',
            align: 'center',
            showOverflowTooltip: true,
            minWidth: 160,
            formatter: (_row, _column, cellValue) => {
              return this.$util.toDateString(cellValue);
            }
          }
        ],
        current: {},
        curNodeData: {},
        treeList: [],
        treeLoading: false,
        formData: {},
        rootTreeId: null,
        defaultProps: {
          children: 'children',
          label: 'name'
        },
        showEdit: true
      };
    },
    computed: {},
    created() {
    
    },
    methods: {
      /* 表格数据源 */
      datasource({ page, limit, where, order }) {
        return contactPage({
          pageNum: page,
          size: limit,
          type: 2,
          ...where
        });
      },

      handleNodeClick(data, node) {
        this.curNodeData = data;
        this.reload({ categoryId: data.id });
      },
     
    
      getList() {
        return this.selection;
      },
     
    }
  };
</script>

<style lang="scss" scoped>
  :deep(.el-link--inner) {
    margin-left: 0px !important;
  }

  .sys-organization-list {
    height: calc(100vh - 264px);
    box-sizing: border-box;
    border-width: 1px;
    border-style: solid;
    overflow: auto;
  }
  .sys-organization-list :deep(.el-tree-node__content) {
    height: 40px;
    & > .el-tree-node__expand-icon {
      margin-left: 10px;
    }
  }
</style>
