
export default {
  data() {
    return {}
  },
  methods: {
    synchronizationClick() {
      const resultMap = this.tableData.reduce((result, current, currentIndex) => {
        const {
          name,
          socialCreditCode,
          phoneNumber,
          domicileAddress,
          permanentAddress,
          validFrom,
          validTo,
          email
        } = current
        if (!result[name]) {
          if (name) {
            result[name] = {
              phoneNumber,
              domicileAddress,
              permanentAddress,
              validFrom,
              validTo,
              email,
              socialCreditCode: socialCreditCode,
              frontFile: this.$refs.commTable.$refs[`idcardStorage_front_${currentIndex}`].getFileLists,
              backFile: this.$refs.commTable.$refs[`idcardStorage_back_${currentIndex}`].getFileLists,
              // files: this.$refs.commTable.$refs[`idcardStorage${currentIndex}`].getFileLists
            }
          }
        }
        return result
      }, {})
      this.tableData = this.tableData.map(item => {
        const { name } = item
        return {
          ...item,
          ...resultMap[name]
        }
      })
    }
  }
}
