添加 dic 组件,select 和 value text

This commit is contained in:
sin
2019-03-07 21:56:05 +08:00
parent 03f6b2b82c
commit 657eb1c980
61 changed files with 432 additions and 0 deletions

View File

@@ -87,6 +87,7 @@ class RoleList extends PureComponent {
};
handleAdd = ({ fields, modalType, initValues }) => {
console.log('add ->>>', fields);
const { dispatch, data } = this.props;
const queryParams = {
pageNo: data.pageNo,

View File

@@ -0,0 +1,26 @@
import React, { PureComponent } from 'react';
import { connect } from 'dva';
import DictionarySelect from '../../components/Dictionary/DictionarySelect';
@connect(({ dictionarySelect, loading }) => ({
data: dictionarySelect,
loading: loading.models.dictionarySelect,
}))
class DictionaryValueSelect extends PureComponent {
componentDidMount() {
const { dataKey, dispatch } = this.props;
dispatch({
type: 'dictionarySelect/query',
payload: {
dataKey,
},
});
}
render() {
const { data } = this.props;
return <DictionarySelect {...this.props} list={data.list} />;
}
}
export default DictionaryValueSelect;

View File

@@ -0,0 +1,26 @@
import React, { PureComponent } from 'react';
import { connect } from 'dva';
@connect(({ dictionarySelect, loading }) => ({
data: dictionarySelect,
loading: loading.models.dictionarySelect,
}))
class DictionaryValueText extends PureComponent {
componentDidMount() {
const { dataKey, dispatch } = this.props;
dispatch({
type: 'dictionarySelect/queryText',
payload: {
dataKey,
value: 1,
},
});
}
render() {
const { data } = this.props;
return <span>{data.text}</span>;
}
}
export default DictionaryValueText;

View File

@@ -2,6 +2,8 @@ import React, { Component } from 'react';
import { Button } from 'antd';
import AuthorityControl from '../../components/AuthorityControl';
import UrlsContext from '../../layouts/UrlsContext';
import DictionaryValueSelect from '../Dictionary/DictionaryValueSelect';
import DictionaryValueText from '../Dictionary/DictionaryValueText';
export default class Home extends Component {
state = {};
@@ -22,6 +24,9 @@ export default class Home extends Component {
<Button type="primary">按钮 控制</Button>
</AuthorityControl>
<h1>home...</h1>
<DictionaryValueSelect dataKey="gender" defaultValue={1} />
<DictionaryValueText dataKey="gender" value="1" />
</UrlsContext.Provider>
);
}