<template>

  <div   class="container">


    <div class="tool-bar">
      <div>
        <span class="title-name">仪表盘标题</span>
        <span>解释信息</span>
      </div>
      <div  style="position:absolute;top:170px;right:100px;z-index:1">
        <el-button class="miniSuccess" @click="control_edit()">编辑</el-button>
        <el-button class="successBorder" @click="handleLinkChart">
          添加图表
        </el-button>
      </div>
     
    </div>

    <div>
      <draggable v-model="boardList" group="itxst"   animation="300" :group="{name: 'dashboard',pull: true}" @start="onStart" @end="onEnd">
        <transition-group>

        <el-card class="box-card board-card" key="1" v-for="item in boardList">
          <div slot="header" class="clearfix">
            <span>{{item.title}}</span>
       

            <div  style="float: right; padding: 3px 0;display:inline-block;">
              <i  class="el-icon-edit" style="color:#009C69;cursor:pointer;" />
              <i  class="el-icon-delete" style="color:#009C69;cursor:pointer;"  />

            </div>

          </div>
          <div  class="text item"> 
            图表内容
          </div>
        </el-card>
                  
                       
        </transition-group>
    </draggable>

    </div>
 
    
  </div>

</template>

<script>
import draggable from 'vuedraggable'
 
import { GetDataByName } from '@/api/common'
import Cookies from 'js-cookie'
 
export default {
  name: 'Addboard2',
  components: {  draggable },
  data() {
    return {
      isRoleEdit: [],

      boardList: [

        {title:'图标1'},
        {title:'图标2'},
        {title:'图标3'},
       ],

      isEdit: 'view',
      dashboardList: [],
      currentDashboard: undefined,
      editDialogVisible: false,
      dbObj: {},
      loading: false,
      isCollapse: false,
      did: undefined,
      isTitle: '2',
      editBtn: false,
      control_btn: '编辑',
      control_btn_l: false,

 

    }
  },

  created() {
    // console.log('this.$route.params.id', this.$route.params.id)
    // const isEdit = this.$route.params.isEdit

    // this.isEdit = isEdit
 
    this.getList()
  },

  methods: {




       onStart(){
      console.log(2222)
    },
    onEnd(){
      console.log(this.boardList)

  
    },
     

    getList() {
      this.loading = true

      // if (this.$route.params.id) {
      //   this.did = this.$route.params.id
      // } else {
      //   this.did = this.did
      // }

     
    },
       handleLinkChart() {
      var send_data = {
        name: 'getChartListV2',
        page: 1,
        offset: 1,
        pagecount: 10,
        returntype: 'Map',
        parammaps: {
          pastureid: Cookies.get('pastureid'),
          empid: Cookies.get('employeid')
        }
      }
      GetDataByName(send_data).then(response => {
        console.log('table数据', response.data.list)
        if (response.data.list !== null) {
          this.myChartList = response.data.list
          this.showChartList = true
        } else {
          this.myChartList = []
          this.showChartList = true
        }
      })
    },
   
  }
}
</script>
<style scoped>
.board{
  width:300px;height:300px;border:1px soild #333;display:inline-block;background: #2ed1f9;padding: 5px 5px;margin-right: 15px;margin-bottom: 15px;
}


.tool-bar {
  display: block; border-top: none;
  height: 45px;
  line-height: 45px;
  color: #303133;
  padding: 0 10px;
  position: relative;
 
}
 .title-name {
    font-size: 12px;
    font-weight: 600;
    color: #909399;
    margin-left: 0;
  }
  /* span {
    color: #c0c4cc;
    font-size: 12px;
    margin-left: 10px;
  }

  .text {
    font-size: 14px;
  }

  .item {
    margin-bottom: 18px;
  } */

  .clearfix:before,
  .clearfix:after {
    display: table;
    content: "";
  }
  .clearfix:after {
    clear: both
  }

  .board-card {
    width: 250px;min-height: 100%;
    padding: 20px 10px;
    display: inline-block;
    margin: 0px 0px 20px 20px;
  }
</style>

<style lang="scss" scoped>


</style>
