<template>
  <el-dialog
    title="供应商"
    :visible.sync="visible"
    :before-close="handleClose"
    :close-on-click-modal="false"
    top="5vh"
    :close-on-press-escape="false"
    append-to-body
    width="80%"
  >
    <supplierManage :isDialog="true" ref="supplierManageRef"></supplierManage>
    <div class="btns">
      <el-button type="primary" size="small" @click="selected">选择</el-button>
      <el-button size="small" @click="handleClose">关闭</el-button>
    </div>
  </el-dialog>
</template>

<script>
  import supplierManage from '@/views/bpm/handleTask/components/supplierManage/index.vue';

  export default {
    components: {
      supplierManage
    },

    data() {
      return {
        visible: false
      };
    },

    watch: {},
    methods: {
      open() {
        this.visible = true;
   
      },
      selected() {
        let list = this.$refs.supplierManageRef.getList();
        list.forEach((item) => {
          item['supplierId'] = item.id || item.supplierId;
          item['supplierName'] = item.name || item.supplierName;
          item['supplierCode'] = item.code|| item.supplierCode;
          
        });

        this.$emit('supplierManageChange', list);
        this.handleClose();
      },

      handleClose() {
        this.visible = false;
        this.current = null;
        this.radio = '';
      }
    }
  };
</script>

<style lang="scss" scoped>
  .tree_col {
    border: 1px solid #eee;
    padding: 10px 0;
    box-sizing: border-box;
    height: 500px;
    overflow: auto;
  }

  .table_col {
    padding-left: 10px;

    ::v-deep .el-table th.el-table__cell {
      background: #f2f2f2;
    }
  }

  .pagination {
    text-align: right;
    padding: 10px 0;
  }

  .btns {
    text-align: center;
    padding: 10px 0;
  }

  .topsearch {
    margin-bottom: 15px;
  }
</style>
