Socket
Socket
Sign inDemoInstall

ac-attachment

Package Overview
Dependencies
151
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ac-attachment

``` npm install ac-attachment -S


Version published
Maintainers
1
Install size
43.5 MB
Created

Readme

Source

上传列表 AcAttachment

何时使用

如何使用

npm install ac-attachment -S

import AcAttachment from 'ac-attachment';

import 'ac-attachment/dist/ac-attachment.css';

代码演示

API

参数

名称类型默认值是否必填描述
recordIdstring单据相关的唯一标示,一般包含单据ID,如果有多个附件的时候由业务自己制定规则
groupnamestring分组名
permissionstringOss权限(read,private,full),read是可读=公有,private=私有,当这个参数不传的时候会默认private
tenantstring附件查询使用,租户id,不写会自动从系统获取
urlstring里传true或false。为true,则返回附件的连接地址存到数据库中;如果isencrypt设置为true,url不能设置为true否则不能上传,提示:对于加密文件不能返回url,返回了也无法访问
isencryptbooleanfalse是否加密,默认false不加密
baseUrlstring应用平台的地址(IP地址或域名)
uploadUrlstring/iuap-saas-filesystem-service/file/upload应用平台上传附件的地址
queryUrlstring/iuap-saas-filesystem-service/file/query应用平台查询附件的地址
deleteUrlstring/iuap-saas-filesystem-service/file/delete应用平台删除单个附件的地址
downloadUrlstring/iuap-saas-filesystem-service/file/download应用平台下载附件的地址
batchDeleteUrlstring/iuap-saas-filesystem-service/file/batchDeleteByIds应用平台批量删除附件地址
fileTypestring允许上传的文件类型, 使用MIME类型限制文件类型。例如:txt文档类型为text/plain, png图片类型为image/png。可以使用*通配符,image/*代表所有图片类型。多个文件类型使用逗号隔开,例如:'image/*, text/plain'。详见 File Type, MIME类型
fileMaxSizenumber10单个上传文件的大小上限,默认是10M,单位是M
fileNumnumber999上传文件的总数量限制
multiplebooleantrue是否支持一次多个文件上传,在文件选择框中,按shift或ctrl键,同时选择多个文件,点击确定即可
disabledbooleanfalse上传,下载,删除按钮是否禁用
classNamestring附件容器的自定义class
checkDuplicatebooleantrue文件上传是否检测文件名重复
localestringzh组件语言类型,默认是简体中文,目前支持英文(en或en_US),简体中文(zh_CN),繁体中文(zh_TW)

事件

名称类型描述
onFileTypeOverfile,当前上传的文件对象文件类型超出限制回调
onFileSizeOverfile,当前上传的文件对象文件大小超出限制回调
onFileNumOverfile,当前上传的文件对象文件数量超出限制回调
onDeleteattach参数attach为附件组件实例,调用attach.fDelete(),可以调起接口删除附件
onUploadSuccessdata,上传成功返回值上传成功回调
onUploadErrordata,上传出错返回值上传出错回调
onUploadDeletedata,上传删除返回值上传删除回调
onDeleteFiledata,删除文件返回值删除文件回调

注意事项

文件列表刷新

组件在recordId发生变化,会自动刷新文件列表,也可以手动刷新文件列表,用法如下:

<AcAttachment ref={(c) => {this.attach = c.attach}} recordId='' groupname='' />

//手动刷新文件列表
this.attach.fLoadFileList();

自定义弹框删除文件

<AcAttachment ref={(c) => {this.attach = c.attach}} recordId='' groupname='' />

//手动删除文件
this.attach.fDelete();
//自定义弹出框删除文件
<AcAttachment recordId='' groupname='' 
    onDelete={(attach) => {
        if(confirm('确定删除记录吗?')){
            attach.fDelete();
        }
    }}
/>

更新日志

FAQs

Last updated on 26 May 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc