<template lang="pug">
  <div class='m_i_dialog'>
    <el-dialog title="title" width="800px" :close-on-click-modal='false' :visible.sync='visible' :modal-append-to-body='false'>
      <el-upload action="#" list-type="picture-card" :limit="5" :auto-upload="false">
        <i slot="default" class="el-icon-plus"></i>
        <div slot="file" :file-list="fileList" slot-scope="{file}">
          <img class="el-upload-list__item-thumbnail" :src="file.url" alt="">
          <span class="el-upload-list__item-actions">
            <span class="el-upload-list__item-preview" @click="handlePictureCardPreview(file)">
              <i class="el-icon-zoom-in"></i>
            </span>
          </span>
        </div>
      </el-upload>
    </el-dialog>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  computed: {
    ...mapState('d2admin/user', [
      'info'
    ])
  },
  data () {
    return {
      fileList:[],
      visible:false

    }
  },
  created() {

  },
  methods: {
    init (map,res) {
      this.visible = true;
      this.dataForm.resourceName = map.name;
      this.dataForm.resourceId = map.id;
     if(res){
       this.title = '编辑'
       this.dataForm.name = res.name;
        this.dataForm.orderNum = res.orderNum;
      }else{
        this.title = '新增'
      }
    },

    handlePictureCardPreview(file) {
      console.log(file)
    },
  }
}
</script>
<style>

</style>
