import React, {Component} from 'react'; import { View, Text, StatusBar, DeviceEventEmitter, StyleSheet, } from 'react-native'; import {Provider, Toast, Button, List, Picker} from '@ant-design/react-native'; import {connect} from 'react-redux'; import {ComponentsStyles} from '../../components/ComponentsStyles'; @connect(customer => ({...customer})) class DispatchProcess extends Component { // 分配 constructor(props) { super(props); this.state = { customer: this.props.navigation.state.params.customer, order: this.props.navigation.state.params.order, now_process_text: '', next_process: '', PROCESS: [], USERS: [], service: '', }; }; componentDidMount() { this._fetchData(); } _fetchData = () => { this.props.dispatch({ type: 'customer/fetchProcessDict', payload: {customer_id: this.state.customer}, callback: (data) => { let PROCESS = []; data.map((item, index) => { PROCESS.push({ value: item.value, label: item.label, }); }); this.setState({PROCESS}); }, }); this.props.dispatch({ type: 'customer/getUser', callback: (data) => { let USERS = []; data.map((item, index) => { USERS.push({ value: item.value, label: item.lable, }); }); this.setState({USERS}); }, }); this.props.dispatch({ type: 'customer/getProcess', payload: {customer_id: this.state.customer}, callback: (data) => { if (data.error_message) { Toast.info(data.error_message, 2, () => { this.props.navigation.goBack(); }); return; } this.setState({ now_process_text: data.now_process_text, next_process: [data.next_process_id], }); }, }); }; onSave = () => { if (!this.state.next_process.length) { Toast.info('请下一进度', 1); return; } if (!this.state.service.length) { Toast.info('请选择人员', 1); return; } this.props.dispatch({ type: 'customer/dispatchService', payload: this.state, callback: () => { Toast.info('分配成功', 1, () => { DeviceEventEmitter.emit('refeshProcess'); DeviceEventEmitter.emit('backRefesh'); this.props.navigation.goBack(); }); }, }); }; render() { const {loading} = this.props.customer; return ( {this.state.now_process_text}} arrow="empty"> 当前进度 this.setState({next_process: val})} > 下一进度 this.setState({service: val})} > 服务人员 ); } } const styles = StyleSheet.create({ paperBody: { flexDirection: 'row', flexWrap: 'wrap', // borderBottomWidth: 10, // borderBottomColor: '#eee', paddingLeft: 5, }, paperBodyItem: { alignItems: 'center', margin: 2, padding: 5, }, dateInput: { borderWidth: 0, alignItems: 'flex-end', }, infoContent: { flex: 1, marginTop: 5, backgroundColor: '#fff', }, infoItem: { flexDirection: 'row', paddingVertical: 10, borderBottomWidth: 1, borderColor: '#eaeaea', justifyContent: 'space-between', }, infoItemLeft: {color: '#000', fontSize: 19}, infoItemRight: {fontSize: 15, paddingTop: 2}, modelItem: { borderBottomWidth: 1, borderColor: '#eaeaea', textAlign: 'center', paddingVertical: 8, fontSize: 18, color: '#000', }, }); export default DispatchProcess;