| | |
| | | |
| | | class ExcelInButton extends Component { |
| | | static propTpyes = { |
| | | show: PropTypes.any, // 显示样式 |
| | | BID: PropTypes.string, // 主表ID |
| | | BData: PropTypes.any, // 主表数据 |
| | | selectedData: PropTypes.any, // 子表中选择数据 |
| | | Tab: PropTypes.any, // 如果当前元素为标签时,tab为标签信息 |
| | | MenuID: PropTypes.string, // 菜单ID |
| | | btn: PropTypes.object, // 按钮 |
| | | columns: PropTypes.array, // 字段列 |
| | | setting: PropTypes.any, // 页面通用设置 |
| | | ContainerId: PropTypes.any, // tab页面ID,用于弹窗控制 |
| | | updateStatus: PropTypes.func, // 按钮状态更新 |
| | | triggerBtn: PropTypes.any, |
| | | } |
| | |
| | | }) |
| | | this.updateStatus('over') |
| | | return |
| | | } else if (data.length * btn.verify.columns.length > 30000) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '当前导入数据量过大,如遇错误提示,请分批导入!', |
| | | duration: 5 |
| | | }) |
| | | } |
| | | |
| | | let result = Utils.getExcelInSql(btn, data, this.state.dict) |
| | |
| | | } |
| | | |
| | | param.excel_in_type = 'true' |
| | | param.LText_insert = Utils.formatOptions(result.insert) |
| | | param.LText_bottom = Utils.formatOptions(result.bottom) |
| | | param.LText1 = Utils.formatOptions(result.insert) |
| | | param.LText2 = Utils.formatOptions(result.bottom) |
| | | param.LText = Utils.formatOptions(result.sql) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { btn } = this.props |
| | | const { btn, show } = this.props |
| | | const { loading } = this.state |
| | | |
| | | return ( |
| | | <div className="mk-btn-wrap"> |
| | | <Button |
| | | {!show ? <Button |
| | | className={'mk-btn mk-' + btn.class} |
| | | icon={btn.icon} |
| | | onClick={() => {this.actionTrigger()}} |
| | | loading={loading} |
| | | >{btn.label}</Button> |
| | | <ExcelIn MenuID={this.props.MenuID} btn={btn} triggerExcelIn={() => this.updateStatus('start')} returndata={this.getexceldata} ref="excelIn" /> |
| | | >{btn.label}</Button> : null} |
| | | {show === 'icon' ? <Button |
| | | className="import-icon" |
| | | icon="upload" |
| | | onClick={() => {this.actionTrigger()}} |
| | | loading={loading} |
| | | title={btn.label} |
| | | ></Button> : null} |
| | | <ExcelIn btn={btn} triggerExcelIn={() => this.updateStatus('start')} returndata={this.getexceldata} ref="excelIn" /> |
| | | </div> |
| | | ) |
| | | } |