/*
 * @Description: 
 * @Author: @liulin
 * @Date: 2023-04-12 14:14:15
 * @LastEditors: liulin liulin19981227@163.com
 * @LastEditTime: 2024-03-11 15:40:12
 */
import fileUpload from '@/components/upload/fileUploadProject.vue'
export const uploadMixin = {
  components: {
    fileUpload
  },
  data() {
    return {
      dadToSon: {
        bizPath: 'specialproject',
        fileList: []
      },
      accessories: [],
    }
  },
  methods: {
    sonToDad(data) {
      console.log(data)
      let arr = data
    //   data.forEach(item => {
    //     arr.push({
    //       isDele: item.isDele,
    //       attachmentName: item.name,
    //       attachmentPath: item.url,
    //       attachmentSuffix: item.suffix,
    //       attachmentType: item.type,
    //       type: 0
    //     })
    //   })
      this.accessories = arr
      this.form.accessories = arr
      this.formEdit.accessories = arr
      // 防止用户打开了文件选择框之后不选择文件而出现效验失败
      if (this.form.accessories) {
        this.$refs.ruleForm.clearValidate('accessories')
      }
    },

    handleClose(done) {
      this.dadToSon.fileList = []
      done()
    },
    handleCancel() {
      this.dialogVisible = false
      this.form = {}
      this.tableData = []
      this.dadToSon.fileList = []
    },
    sonToDadTable(files, index) {
        this.tableData[index].detailAccessories = files
    }
  }
}
