| | |
| | | |
| | | class NormalTimeline extends Component { |
| | | static propTpyes = { |
| | | BID: PropTypes.any, // 父级Id |
| | | data: PropTypes.array, // 统一查询数据 |
| | | config: PropTypes.object, // 组件配置信息 |
| | | mainSearch: PropTypes.any, // 外层搜索条件 |
| | |
| | | sync: false, // 是否统一请求数据 |
| | | data: null, // 数据 |
| | | BData: '', |
| | | card: null |
| | | card: null, |
| | | description: false |
| | | } |
| | | |
| | | /** |
| | |
| | | * 1、 initdata 为打印时使用的数据集 |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const { data, initdata, BID, BData } = this.props |
| | | const { data, initdata } = this.props |
| | | let _config = fromJS(this.props.config).toJS() |
| | | let _cols = new Map() |
| | | |
| | | let _data = null |
| | | let card = null |
| | | let _sync = _config.setting.sync === 'true' |
| | | |
| | | let BID = '' |
| | | let BData = '' |
| | | |
| | | if (_config.setting.supModule) { |
| | | BData = window.GLOB.CacheData.get(_config.setting.supModule) |
| | | } else { |
| | | BData = window.GLOB.CacheData.get(_config.$pageId) |
| | | } |
| | | if (BData) { |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | if (_config.setting.sync === 'true' && data) { |
| | | _data = data[_config.dataName] || [] |
| | |
| | | /** |
| | | * @description 导出Excel时,获取页面搜索排序等参数 |
| | | */ |
| | | queryModuleParam = (menuId, btnId) => { |
| | | queryModuleParam = (menuId, callback) => { |
| | | const { mainSearch } = this.props |
| | | const { arr_field, config } = this.state |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | MKEmitter.emit('returnModuleParam', config.uuid, btnId, { |
| | | callback({ |
| | | arr_field: arr_field, |
| | | orderBy: config.setting.order || '', |
| | | search: searches, |
| | |
| | | async loadData () { |
| | | const { mainSearch } = this.props |
| | | const { config, arr_field, BID, BData } = this.state |
| | | |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | | data: [], |
| | | }) |
| | | return |
| | | } |
| | | |
| | | if (config.setting.interType === 'inner' && config.setting.innerFunc === 'z_mk_express') { |
| | | this.getExpress() |
| | | return |
| | | } |
| | | |
| | |
| | | if (requireFields.length > 0) { |
| | | return |
| | | } |
| | | |
| | | // if (config.setting.interType === 'inner' && config.setting.innerFunc === 'z_mk_express') { |
| | | // this.getExpress() |
| | | // return |
| | | // } |
| | | |
| | | this.setState({ |
| | | loading: true |
| | |
| | | } |
| | | |
| | | getExpress = () => { |
| | | const { BData } = this.state |
| | | |
| | | let code = '' |
| | | let order = '' |
| | | if (BData) { |
| | | Object.keys(BData).forEach(key => { |
| | | if (key.toLowerCase() === 'expresscode') { |
| | | code = BData[key] |
| | | } else if (key.toLowerCase() === 'expressno') { |
| | | order = BData[key] |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (!code || !order) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未获取到快递' + (!code ? '公司编码。' : '单号。'), |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | Api.wxNginxRequest(`express/yuantong/YT6590674317601`, 'get').then(res => { |
| | | Api.wxNginxRequest(`express/${code}/${order}`, 'get').then(res => { |
| | | if (!res || typeof(res) !== 'string') { |
| | | notification.error({ |
| | | top: 92, |
| | | message: '未获取到快递信息', |
| | | duration: 10 |
| | | }) |
| | | } else if (/查询无结果/.test(res)) { |
| | | this.setState({description: res, data: [], loading: false}) |
| | | } else { |
| | | let data = res.split(/\n/).filter(Boolean) |
| | | |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { config, loading, data } = this.state |
| | | const { config, loading, data, description } = this.state |
| | | |
| | | return ( |
| | | <div className="normal-timeline-box" id={'anchor' + config.uuid} style={{...config.style}}> |
| | |
| | | {data.map(item => this.getMknodes(item))} |
| | | </div> : null} |
| | | {data && data.length === 0 ? <div className="card-row-list" style={{height: config.wrap.contentHeight}}> |
| | | <Empty description={false}/> |
| | | <Empty description={description}/> |
| | | </div> : null} |
| | | </div> |
| | | ) |