Employee.js 2.82 KB
/**
 * Created by DEV005 on 2017/11/13.
 */

/**
 * Created by tdzl2003 on 12/18/16.
 */
import React, {Component} from "react";
import {
    StyleSheet,
    Text,
    TextInput,
    TouchableOpacity,
    View,
    Image,
    NativeModules
} from "react-native";

import { NavigationActions } from 'react-navigation'
import { observable, useStrict, action } from 'mobx';
import { observer } from 'mobx-react';
import AppService from "../service/AppService";
import EmployeeList from './public/EmployeeList';

export default class Employee extends Component {
    static navigationOptions = ({ navigation, screenProps })=>({
        title:"通讯录",
        headerLeft:(<View style={{flexDirection: 'row',flex:1}}>
            <TouchableOpacity style={{flexDirection: 'column',justifyContent: 'center',paddingRight:15,paddingLeft:10}} onPress={navigation.state.params?navigation.state.params._goBack:null}>
                <Image style={{  width:16,height:16}}  source={require('../img/back.png')}  resizeMode="contain"/>
            </TouchableOpacity>
            <TouchableOpacity style={{flexDirection: 'column',justifyContent: 'center',paddingRight:15,paddingLeft:15}} onPress={navigation.state.params?navigation.state.params._close:null}>
                <Image style={{  width:16,height:16}}  source={require('../img/close.png')}  resizeMode="contain"/>
            </TouchableOpacity>
        </View>)

    });
    constructor(props){
        super(props);
        this.state = {
            tenantId:global.tenantId,
            tenantName:global.tenantShortName
        };
    }

    params=this.props.navigation.state.params;

    componentDidMount(){
        let  _this=this;
        //设置头部
        this.props.navigation.setParams({

            _goBack:()=>{
                this.props.navigation.goBack();
            },
            _close:()=>{
                NativeModules.system.navTo("BACK")
            }

        });
    }

    render() {
        return (
            <View style={styles.body}>
                <EmployeeList  tenantId={this.state.tenantId}  name={this.state.tenantName} callback={this.callback}  employeeType="USER"></EmployeeList>
            </View>
        );
    }
    callback=(data)=>{
        let  _this=this;
        //转交
        console.log(data)

        if(_this.params.status=="add"){
            _this.params.callback(data)
            this.props.navigation.goBack();
        }else {
            this.props.navigation.navigate('Comment',{status:_this.params.status,flowId:_this.params.flowId,
                id:_this.params.id,rowVersion:_this.params.rowVersion,submitUser:{name:data.name,id:data.id},
                goBackKey:this.props.navigation.state.key})
        }

    }

}

const styles = StyleSheet.create({
    body:{
        flex:1,
        flexDirection:"column",
        backgroundColor:"#ecf0f3",
    },

});