antdesign table中使用upload传行信息

<a-table
        :columns="columns1"
        :data-source="data"
        class="components-table-demo-nested"
      >
        <span slot="action" slot-scope="record">
          <a-upload
            :action="url1"
            :default-file-list="defaultFileList"
            :show-upload-list="false"
            :beforeUpload="(info) =>handleChangeWs(info,record)"
          >
            <a-button type="primary"><a-icon type="upload"/> 文书上传 </a-button>
        </a-upload>
        </span>
</a-table>
handleChangeWs(file,record) {
      // console.log(file,record,'file,record')
      this.confirmLoading = true
      let formData = new FormData()
      formData.append('multipartFiles', file)
      formData.append('xfjId', record.xfjId)
      formData.append('xfrId', record.id)
      httpAction(this.url.uploadZmcl, formData, 'post').then(res => {
        if (res.success) {
          this.$message.success('上传成功')
        } else {
          this.$message.warning(res.message)
        }
      }).finally(()=>{
        this.confirmLoading = false
      })
    },
posted @ 2022-07-18 13:46  阖彩  阅读(337)  评论(0编辑  收藏  举报