<!--
 * @Description: 创建采购单-查看行项目附件信息弹框
 * @Author: gmy
 * @Date: 2020-8-04 11:06:30
-->
<template>
  <div>
    <el-dialog
      v-dialogDrag
      :visible.sync="dialogData.dialog"
      :close-on-click-modal="false"
      :lock-scroll="false"
      append-to-body
      title="附件列表"
      width="756px"
      custom-class="el-dialog__body-height el-dialog_table"
    >
      <div>
        <upload
          v-if="dialogData.type!=='00'"
          ref="upload"
          :title="''"
          :on-change="principalFile"
          :data="lineItemFileType"
          :file-list="principalList"
          :auto-delete="true"
          :auto-upload="true"
          tip-text="上传附件格式（*.doc;*.docx;*.pdf;*.png;*.jpg;*.zip;*.jpeg;*.txt;*.xlsx;*.xls;*.ppt;*.pptx;*.rar）"
          accept=".doc,.docx,.pdf,.png,.jpg,.zip;.jpeg;.txt;.xlsx;.xls;.ppt;.pptx;.rar"
          file-ref="fileRef"
          but-text="点击上传"
        />
        <downloadFile v-else :data="lineItemFileType" :dis-block="'block'" />
      </div>
      <span v-if="dialogData.type!=='00'" slot="footer" class="dialog-footer">
        <el-button type="primary" @click="okdialog">确认</el-button>
        <el-button @click="dialogData.dialog = false">取消</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
/* 公共组件 */
import downloadFile from '@comp/common/updownload/downloadFile'
import upload from '@comp/common/updownload/upload'// 文件上传组件
import { procurementMixins } from '../../mixins/procurementMixins'
export default {
  components: {
    upload,
    downloadFile
  },
  mixins: [procurementMixins],
  props: {
    dialogData: {
      type: Object,
      default: function() {
        return
      }
    }
  },
  data() {
    return {
      principalList: []
    }
  },
  created() {
    // 获取行项目的附件id
    this.lineItemFileType.bizId = this.dialogData.bizId
  },
  methods: {
    // 附件上传
    principalFile(file, fileList) {
      this.principalList = []
    },
    // 确认
    okdialog() {
      this.lineItemFileType.bizId = ''
      this.dialogData.bizId = ''
      this.dialogData.dialog = false
    }
  }
}
</script>

<style>

</style>
