// 函数式组件
// 函数式组件
import React, { useEffect, useReducer, useState } from 'react';
import { observer } from 'mobx-react';
import { toJS } from 'mobx';
import { Input, Button, InputNumber, Modal } from 'antd';
import style from './style.less';
const initState = {
companyKey: '',
};
const reducer = (state, action) => {
return { ...state, ...action.params };
};
export default observer(props => {
const [queryParams, dispatch] = useReducer(reducer, initState);
const handleChange = (val, key) => {
dispatch({ params: { [key]: val } });
};
const handleCancelAuthorization = () => { };
const handleSaveAuthorization = async () => { };
return (
<Modal
width={590}
title={`${props.type === 'add' ? '添加授权' : '编辑授权'}`}
visible={true}
maskClosable={false}
onOk={handleSaveAuthorization}
onCancel={handleCancelAuthorization}
footer={[
<Button className={style.query_btn_bg} key="submit" type="primary" loading={loading} onClick={handleSaveAuthorization}>
保存
</Button>,
<Button className={style.cancel_btn} key="back" onClick={handleCancelAuthorization}>
取消
</Button>
]}>
<div className={style.modal_c}>
<Input value={queryParams.companyKey} onChange={e => handleChange(e.target.value, 'companyKey')} />
</div>
</Modal>
);
});
// 类组件
// 类组件
import React, {Component} from 'react';
import {observer} from 'mobx-react';
import {Table, Input, Button, InputNumber, Select, Popconfirm, Modal} from 'antd';
import noticeStore from '@stores/Notice';
import {toJS} from 'mobx';
import {filtergQparams} from '@lib';
import style from './style.less';
@observer
export default class Index extends Component {
constructor(props) {
super(props);
this.state = {
};
}
async componentDidMount() {}
render() {
return (
<div className={style.page_box}>
111111
</div>
);
}
}