gms-app.vue 2.67 KB
Newer Older
wangcong committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
<template>
  <div class="fileList">
    <div class="fileList-title">
      <span class="fileList-title-side"></span>
      资料下载
      <span class="fileList-title-more" @click="handleMore">
        <span>更多</span>
        <Icon type="ios-arrow-forward" class="more-icon"/>
      </span>
    </div>
    <div class="fileList-content">
      <file-item v-for="item in fileList" :file="item" :key="item.id" :fileWidth="fileWidth"></file-item>
    </div>

    <Modal class-name="file-modal" v-model="modalShow" title="资料下载">
      <div style="height:500px;overflow:auto">
        <file-item v-for="item in fileList" :file="item" :key="item.id"></file-item>
      </div>
    </Modal>
  </div>
</template>
<script>

import fileItem from './fileItem.vue'

export default {
  components: {
    fileItem
  },
  props: {
    itemSetting: {
      type: Array,
      default: () => [],
    },
  },
  data() {
    return {
      fileList: [],
      fileWidth: '100%',
      modalShow: false
    }
  },
  created() {
    let prop = this.itemSetting.properties
    if (prop && Array.isArray(prop)) {
      let num = prop[0]? prop[0].num: 2
      let str = Math.floor(100 / num) + '%'
      this.fileWidth = `calc(${str} - 10px)`
    }
  },
  mounted() {
    this.getFileLList()
  },

  methods: {
    async getFileLList() {
      const url = `/common/attachment/owner/00000000-0000-0000-0000-000000000000`
      const { data } = await GMS.$http.get(url)
      this.fileList = data
      console.log({ data })
    },
    handleMore() {
      this.modalShow = true
      
    }
  },
}
</script>
<style lang="less" scoped>
.fileList {
  height: 100%;
  padding: 16px;
  border-radius: 6px;
  border: 1px solid #E5E5E5;
  overflow: hidden;
  background-color: white;
  &-title {
    text-align: left;
    font-size: 16px;
    font-weight: 500;
    height: 22px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #0f0f0f;
    line-height: 22px;
    margin-bottom: 16px;
    &-side {
      display: inline-block;
      width: 3px;
      height: 14px;
      background: #5369d8;
      border-radius: 2px;
      margin-right: 5px;
    }
    &-more {
      float: right;
      width: 45px;
      height: 20px;
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #5369d8;
      line-height: 20px;
      cursor: pointer;
      .more-icon {
        background: rgba(83, 105, 216, 0.11);
        border-radius: 2px;
      }
    }
  }
  &-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
  }

}
.file-modal {
  /deep/ .ivu-modal {
    .ivu-modal-body {
      height: 500px;
      overflow: auto;
    }
  }

}
</style>