index.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import React, {Component} from 'react';
  2. import './index.less';
  3. // import {high} from 'nc-lightapp-front';
  4. // const {NCUploader} = high;
  5. import NCUploader from 'uap/common/components/NCUploader';
  6. class Uploader extends Component {
  7. constructor(props) {
  8. super(props);
  9. this.beforeUpload = this.beforeUpload.bind(this);
  10. this.getGroupList = this.getGroupList.bind(this);
  11. this.onHideUploader = this.onHideUploader.bind(this);
  12. this.getBillId = this.getBillId.bind(this);
  13. }
  14. getBillId() {
  15. const {billId, table, clickRow: clickRowProps} = this.props;
  16. if (billId) return billId;
  17. const clickRow = table.getClickRowIndex('ncc600704list') || clickRowProps;
  18. return clickRow && clickRow.record.values.pk_psndoc.value;
  19. }
  20. onHideUploader() {
  21. this.props.onClose && this.props.onClose();
  22. }
  23. //获取当前附件列表
  24. getGroupList(list) {
  25. }
  26. beforeUpload(billId, fullPath, file, fileList) {
  27. // 参数:单据id,当前选中分组path、当前上传文件对象,当前文件列表
  28. const isLt2M = file.size / 1024 / 1024 < 10;
  29. if (!isLt2M) {
  30. alert(this.props.language['gx6008-000117'])/* 国际化处理: 上传大小小于2M*/
  31. }
  32. return isLt2M;
  33. // 备注: return false 不执行上传 return true 执行上传
  34. }
  35. render() {
  36. return (
  37. <div className='uploader'>
  38. <NCUploader
  39. billId={this.props.billId}
  40. //getGroupList={this.getGroupList}
  41. onHide={this.onHideUploader} // 关闭功能
  42. //beforeUpload={this.beforeUpload}
  43. />
  44. </div>
  45. );
  46. }
  47. }
  48. export default Uploader;