update 整改reducer
This commit is contained in:
@@ -3,7 +3,7 @@ import { Button, Card, Form, Input, Popconfirm, message as Message } from 'antd'
|
|||||||
import { isEqual } from 'lodash'
|
import { isEqual } from 'lodash'
|
||||||
import { AntIcon, Auth, Container, ModalForm, QueryTable, QueryTableActions } from 'components'
|
import { AntIcon, Auth, Container, ModalForm, QueryTable, QueryTableActions } from 'components'
|
||||||
import { api } from 'common/api'
|
import { api } from 'common/api'
|
||||||
import getDicData from 'util/dic'
|
import getDictData from 'util/dic'
|
||||||
import auth from 'components/authorized/handler'
|
import auth from 'components/authorized/handler'
|
||||||
import { toCamelCase } from 'util/format'
|
import { toCamelCase } from 'util/format'
|
||||||
import FormBody from './form'
|
import FormBody from './form'
|
||||||
@@ -134,7 +134,7 @@ export default class index extends Component {
|
|||||||
*/
|
*/
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.table.current.onLoading()
|
this.table.current.onLoading()
|
||||||
getDicData('common_status').then(res => {
|
getDictData('common_status').then(res => {
|
||||||
this.setState({
|
this.setState({
|
||||||
codes: res
|
codes: res
|
||||||
}, () => {
|
}, () => {
|
||||||
@@ -250,12 +250,6 @@ export default class index extends Component {
|
|||||||
onClick={() => this.onOpen(this.addForm)}
|
onClick={() => this.onOpen(this.addForm)}
|
||||||
>新增{name}</Button>
|
>新增{name}</Button>
|
||||||
}
|
}
|
||||||
expandedRowRender={
|
|
||||||
record => {
|
|
||||||
console.log(record)
|
|
||||||
return <div>123</div>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React, { Component } from 'react'
|
|||||||
import { Form, Input, InputNumber, Select, Spin } from 'antd'
|
import { Form, Input, InputNumber, Select, Spin } from 'antd'
|
||||||
import { AntIcon } from 'components'
|
import { AntIcon } from 'components'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
import getDicData from 'util/dic'
|
import getDictData from 'util/dic'
|
||||||
|
|
||||||
const initialValues = {
|
const initialValues = {
|
||||||
sort: 100
|
sort: 100
|
||||||
@@ -40,7 +40,7 @@ export default class form extends Component {
|
|||||||
this.record = cloneDeep(params.record)
|
this.record = cloneDeep(params.record)
|
||||||
//#region 从后端转换成前段所需格式
|
//#region 从后端转换成前段所需格式
|
||||||
|
|
||||||
const codes = await getDicData('dic_areacode_type')
|
const codes = await getDictData('dic_areacode_type')
|
||||||
const exist = !!params.record;
|
const exist = !!params.record;
|
||||||
this.setState({
|
this.setState({
|
||||||
codes,
|
codes,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { api } from 'common/api'
|
|||||||
import auth from 'components/authorized/handler'
|
import auth from 'components/authorized/handler'
|
||||||
import { toCamelCase } from 'util/format'
|
import { toCamelCase } from 'util/format'
|
||||||
import { isEqual } from 'lodash'
|
import { isEqual } from 'lodash'
|
||||||
import getDicData from 'util/dic'
|
import getDictData from 'util/dic'
|
||||||
import FormBody from './form'
|
import FormBody from './form'
|
||||||
|
|
||||||
const apiAction = {
|
const apiAction = {
|
||||||
@@ -118,7 +118,7 @@ export default class index extends Component {
|
|||||||
*/
|
*/
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.table.current.onLoading()
|
this.table.current.onLoading()
|
||||||
getDicData('dic_areacode_type').then(res => {
|
getDictData('dic_areacode_type').then(res => {
|
||||||
this.setState({
|
this.setState({
|
||||||
codes: res
|
codes: res
|
||||||
}, () => {
|
}, () => {
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import { Form, Input, InputNumber, message as Message, Spin } from 'antd'
|
import { Form, message as Message, Spin } from 'antd'
|
||||||
import { AntIcon, IconSelector } from 'components'
|
import { AntIcon } from 'components'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
import * as monaco from 'monaco-editor'
|
|
||||||
import MonacoEditor from 'react-monaco-editor'
|
import MonacoEditor from 'react-monaco-editor'
|
||||||
|
|
||||||
const initialValues = {}
|
const initialValues = {}
|
||||||
@@ -71,7 +70,7 @@ export default class form extends Component {
|
|||||||
if (code.constructor === Object) {
|
if (code.constructor === Object) {
|
||||||
postData.extCode = JSON.stringify(code);
|
postData.extCode = JSON.stringify(code);
|
||||||
} else {
|
} else {
|
||||||
throw 0;
|
throw new Error(0);
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
Message.error('错误的JSON格式')
|
Message.error('错误的JSON格式')
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { Button, Card, Form, Input, Popconfirm, message as Message, InputNumber
|
|||||||
import { isEqual } from 'lodash'
|
import { isEqual } from 'lodash'
|
||||||
import { AntIcon, Auth, Container, ModalForm, QueryTable, QueryTableActions } from 'components'
|
import { AntIcon, Auth, Container, ModalForm, QueryTable, QueryTableActions } from 'components'
|
||||||
import { api } from 'common/api'
|
import { api } from 'common/api'
|
||||||
import getDicData from 'util/dic'
|
import getDictData from 'util/dic'
|
||||||
import auth from 'components/authorized/handler'
|
import auth from 'components/authorized/handler'
|
||||||
import { toCamelCase } from 'util/format'
|
import { toCamelCase } from 'util/format'
|
||||||
import FormBody from './form'
|
import FormBody from './form'
|
||||||
@@ -185,7 +185,7 @@ export default class index extends Component {
|
|||||||
*/
|
*/
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.table.current.onLoading()
|
this.table.current.onLoading()
|
||||||
getDicData('common_status').then(res => {
|
getDictData('common_status').then(res => {
|
||||||
this.setState({
|
this.setState({
|
||||||
codes: res
|
codes: res
|
||||||
}, () => {
|
}, () => {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { api } from 'common/api'
|
|||||||
import auth from 'components/authorized/handler'
|
import auth from 'components/authorized/handler'
|
||||||
import { toCamelCase } from 'util/format'
|
import { toCamelCase } from 'util/format'
|
||||||
import { isEqual } from 'lodash'
|
import { isEqual } from 'lodash'
|
||||||
import getDicData from 'util/dic'
|
import getDictData from 'util/dic'
|
||||||
import FormBody from './form'
|
import FormBody from './form'
|
||||||
import DictData from './dictdata'
|
import DictData from './dictdata'
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ export default class index extends Component {
|
|||||||
*/
|
*/
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.table.current.onLoading()
|
this.table.current.onLoading()
|
||||||
getDicData('common_status').then(res => {
|
getDictData('common_status').then(res => {
|
||||||
this.setState({
|
this.setState({
|
||||||
codes: res
|
codes: res
|
||||||
}, () => {
|
}, () => {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { Auth, Container, QueryTable } from 'components'
|
|||||||
import { api } from 'common/api'
|
import { api } from 'common/api'
|
||||||
import { toCamelCase } from 'util/format'
|
import { toCamelCase } from 'util/format'
|
||||||
import { isEqual } from 'lodash'
|
import { isEqual } from 'lodash'
|
||||||
import getDicData from 'util/dic'
|
import getDictData from 'util/dic'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
|
|
||||||
const { RangePicker } = DatePicker;
|
const { RangePicker } = DatePicker;
|
||||||
@@ -80,7 +80,7 @@ export default class index extends Component {
|
|||||||
*/
|
*/
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.table.current.onLoading()
|
this.table.current.onLoading()
|
||||||
getDicData('op_type').then(res => {
|
getDictData('op_type').then(res => {
|
||||||
this.setState({
|
this.setState({
|
||||||
codes: res
|
codes: res
|
||||||
}, () => {
|
}, () => {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { Auth, Container, QueryTable } from 'components'
|
|||||||
import { api } from 'common/api'
|
import { api } from 'common/api'
|
||||||
import { toCamelCase } from 'util/format'
|
import { toCamelCase } from 'util/format'
|
||||||
import { isEqual } from 'lodash'
|
import { isEqual } from 'lodash'
|
||||||
import getDicData from 'util/dic'
|
import getDictData from 'util/dic'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
|
|
||||||
const { RangePicker } = DatePicker;
|
const { RangePicker } = DatePicker;
|
||||||
@@ -80,7 +80,7 @@ export default class index extends Component {
|
|||||||
*/
|
*/
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.table.current.onLoading()
|
this.table.current.onLoading()
|
||||||
getDicData('vis_type').then(res => {
|
getDictData('vis_type').then(res => {
|
||||||
this.setState({
|
this.setState({
|
||||||
codes: res
|
codes: res
|
||||||
}, () => {
|
}, () => {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React, { Component } from 'react'
|
|||||||
import { Form, Input, InputNumber, Radio, Select, Spin, Switch, TreeSelect } from 'antd'
|
import { Form, Input, InputNumber, Radio, Select, Spin, Switch, TreeSelect } from 'antd'
|
||||||
import { AntIcon, IconSelector } from 'components'
|
import { AntIcon, IconSelector } from 'components'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
import getDicData from 'util/dic'
|
import getDictData from 'util/dic'
|
||||||
import { api } from 'common/api'
|
import { api } from 'common/api'
|
||||||
import { EMPTY_ID } from 'util/global'
|
import { EMPTY_ID } from 'util/global'
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ export default class form extends Component {
|
|||||||
async fillData(params) {
|
async fillData(params) {
|
||||||
this.record = cloneDeep(params.record)
|
this.record = cloneDeep(params.record)
|
||||||
//#region 从后端转换成前段所需格式
|
//#region 从后端转换成前段所需格式
|
||||||
const { menuType, openType } = await getDicData('menu_type', 'open_type')
|
const { menuType, openType } = await getDictData('menu_type', 'open_type')
|
||||||
const appList = await this.onLoadSysApplist()
|
const appList = await this.onLoadSysApplist()
|
||||||
let parentTreeData = []
|
let parentTreeData = []
|
||||||
if (params.isParent) {
|
if (params.isParent) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { Button, Card, Form, Input, Popconfirm, message as Message } from 'antd'
|
|||||||
import { isEqual } from 'lodash'
|
import { isEqual } from 'lodash'
|
||||||
import { AntIcon, Auth, Container, ModalForm, QueryTable, QueryTableActions } from 'components'
|
import { AntIcon, Auth, Container, ModalForm, QueryTable, QueryTableActions } from 'components'
|
||||||
import { api } from 'common/api'
|
import { api } from 'common/api'
|
||||||
import getDicData from 'util/dic'
|
import getDictData from 'util/dic'
|
||||||
import auth from 'components/authorized/handler'
|
import auth from 'components/authorized/handler'
|
||||||
import { toCamelCase } from 'util/format'
|
import { toCamelCase } from 'util/format'
|
||||||
import FormBody from './form'
|
import FormBody from './form'
|
||||||
@@ -130,7 +130,7 @@ export default class index extends Component {
|
|||||||
*/
|
*/
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.table.current.onLoading()
|
this.table.current.onLoading()
|
||||||
getDicData('menu_type', 'menu_weight').then(res => {
|
getDictData('menu_type', 'menu_weight').then(res => {
|
||||||
this.setState({
|
this.setState({
|
||||||
codes: res
|
codes: res
|
||||||
}, () => {
|
}, () => {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React, { Component } from 'react'
|
|||||||
import { Cascader, Form, Input, InputNumber, Select, Spin, TreeSelect } from 'antd'
|
import { Cascader, Form, Input, InputNumber, Select, Spin, TreeSelect } from 'antd'
|
||||||
import { AntIcon } from 'components'
|
import { AntIcon } from 'components'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
import getDicData from 'util/dic'
|
import getDictData from 'util/dic'
|
||||||
import { EMPTY_ID } from 'util/global'
|
import { EMPTY_ID } from 'util/global'
|
||||||
import { api } from 'common/api'
|
import { api } from 'common/api'
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ export default class form extends Component {
|
|||||||
const orgData = await this.loadOrgData()
|
const orgData = await this.loadOrgData()
|
||||||
const areaData = await this.loadAreaData()
|
const areaData = await this.loadAreaData()
|
||||||
|
|
||||||
const codes = await getDicData('org_type')
|
const codes = await getDictData('org_type')
|
||||||
this.setState({
|
this.setState({
|
||||||
codes,
|
codes,
|
||||||
options: {
|
options: {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { api } from 'common/api'
|
|||||||
import auth from 'components/authorized/handler'
|
import auth from 'components/authorized/handler'
|
||||||
import { toCamelCase } from 'util/format'
|
import { toCamelCase } from 'util/format'
|
||||||
import { isEqual } from 'lodash'
|
import { isEqual } from 'lodash'
|
||||||
import getDicData from 'util/dic'
|
import getDictData from 'util/dic'
|
||||||
import FormBody from './form'
|
import FormBody from './form'
|
||||||
|
|
||||||
const apiAction = {
|
const apiAction = {
|
||||||
@@ -120,7 +120,7 @@ export default class index extends Component {
|
|||||||
*/
|
*/
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.table.current.onLoading()
|
this.table.current.onLoading()
|
||||||
getDicData('org_type').then(res => {
|
getDictData('org_type').then(res => {
|
||||||
this.setState({
|
this.setState({
|
||||||
codes: res
|
codes: res
|
||||||
}, () => {
|
}, () => {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { Form, Select, Spin, TreeSelect } from 'antd'
|
|||||||
import { AntIcon } from 'components'
|
import { AntIcon } from 'components'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
import { api } from 'common/api'
|
import { api } from 'common/api'
|
||||||
import getDicData from 'util/dic'
|
import getDictData from 'util/dic'
|
||||||
|
|
||||||
const { SHOW_PARENT } = TreeSelect
|
const { SHOW_PARENT } = TreeSelect
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ export default class data extends Component {
|
|||||||
|
|
||||||
this.record = cloneDeep(params.record)
|
this.record = cloneDeep(params.record)
|
||||||
//#region 从后端转换成前段所需格式
|
//#region 从后端转换成前段所需格式
|
||||||
const { dataScopeType } = await getDicData('data_scope_type')
|
const { dataScopeType } = await getDictData('data_scope_type')
|
||||||
const orgTreeData = await this.onLoadOrgTreeData()
|
const orgTreeData = await this.onLoadOrgTreeData()
|
||||||
const arerTreeData = await this.onLoadAreaTreeData()
|
const arerTreeData = await this.onLoadAreaTreeData()
|
||||||
const orgCheckedKeys = await this.onLoadRoleOwn(this.record.id)
|
const orgCheckedKeys = await this.onLoadRoleOwn(this.record.id)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React, { Component } from 'react'
|
|||||||
import { Cascader, Form, Input, InputNumber, Select, Spin, TreeSelect } from 'antd'
|
import { Cascader, Form, Input, InputNumber, Select, Spin, TreeSelect } from 'antd'
|
||||||
import { AntIcon } from 'components'
|
import { AntIcon } from 'components'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
import getDicData from 'util/dic'
|
import getDictData from 'util/dic'
|
||||||
import { EMPTY_ID } from 'util/global'
|
import { EMPTY_ID } from 'util/global'
|
||||||
import { api } from 'common/api'
|
import { api } from 'common/api'
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ export default class form extends Component {
|
|||||||
const orgData = await this.loadOrgData()
|
const orgData = await this.loadOrgData()
|
||||||
const areaData = await this.loadAreaData()
|
const areaData = await this.loadAreaData()
|
||||||
|
|
||||||
const codes = await getDicData('org_type')
|
const codes = await getDictData('org_type')
|
||||||
this.setState({
|
this.setState({
|
||||||
codes,
|
codes,
|
||||||
options: {
|
options: {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { AntIcon, Auth, Container, Image, ModalForm, QueryList, QueryTreeLayout
|
|||||||
import { api } from 'common/api'
|
import { api } from 'common/api'
|
||||||
import { toCamelCase } from 'util/format'
|
import { toCamelCase } from 'util/format'
|
||||||
import { isEqual } from 'lodash'
|
import { isEqual } from 'lodash'
|
||||||
import getDicData from 'util/dic'
|
import getDictData from 'util/dic'
|
||||||
import FormBody from './form'
|
import FormBody from './form'
|
||||||
|
|
||||||
// 配置页面所需接口函数
|
// 配置页面所需接口函数
|
||||||
@@ -60,7 +60,7 @@ export default class index extends Component {
|
|||||||
*/
|
*/
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.list.current.onLoading()
|
this.list.current.onLoading()
|
||||||
getDicData('sex', 'common_status').then(res => {
|
getDictData('sex', 'common_status').then(res => {
|
||||||
this.setState({
|
this.setState({
|
||||||
codes: res
|
codes: res
|
||||||
}, () => {
|
}, () => {
|
||||||
|
|||||||
@@ -1,52 +0,0 @@
|
|||||||
import { combineReducers } from 'redux'
|
|
||||||
|
|
||||||
const user = (state = {}, action) => {
|
|
||||||
// 写入各种action对应的操作
|
|
||||||
switch (action.type) {
|
|
||||||
case 'SET_USER_ACCOUNT':
|
|
||||||
const _state = { ...state, ...action.user }
|
|
||||||
return _state
|
|
||||||
default:
|
|
||||||
return state
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const layout = (state = {
|
|
||||||
siderCollapsed: false
|
|
||||||
}, action) => {
|
|
||||||
switch (action.type) {
|
|
||||||
// 打开窗口
|
|
||||||
case 'OPEN_WINDOW':
|
|
||||||
return state
|
|
||||||
// 关闭窗口
|
|
||||||
case 'CLOSE_WINDOW':
|
|
||||||
return state
|
|
||||||
// 重新加载窗口
|
|
||||||
case 'RELOAD_WINDOW':
|
|
||||||
return state
|
|
||||||
// 侧边收起状态
|
|
||||||
case 'TOGGLE_COLLAPSED':
|
|
||||||
const _state = { ...state, siderCollapsed: action.siderCollapsed }
|
|
||||||
return _state
|
|
||||||
default:
|
|
||||||
return state
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const dicData = (state = {}, action) => {
|
|
||||||
switch (action.type) {
|
|
||||||
case 'ADD_DIC_DATA':
|
|
||||||
const _state = { ...state, ...action.value }
|
|
||||||
return _state
|
|
||||||
default:
|
|
||||||
return state
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const combine = combineReducers({
|
|
||||||
user,
|
|
||||||
layout,
|
|
||||||
dicData
|
|
||||||
})
|
|
||||||
|
|
||||||
export default combine
|
|
||||||
11
web-react/src/store/reducer/dict-data.js
Normal file
11
web-react/src/store/reducer/dict-data.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
const dictData = (state = {}, action) => {
|
||||||
|
switch (action.type) {
|
||||||
|
case 'ADD_DICT_DATA':
|
||||||
|
const _state = { ...state, ...action.value }
|
||||||
|
return _state
|
||||||
|
default:
|
||||||
|
return state
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default dictData
|
||||||
12
web-react/src/store/reducer/index.js
Normal file
12
web-react/src/store/reducer/index.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { combineReducers } from 'redux'
|
||||||
|
import user from './user'
|
||||||
|
import layout from './layout'
|
||||||
|
import dictData from './dict-data'
|
||||||
|
|
||||||
|
const combine = combineReducers({
|
||||||
|
user,
|
||||||
|
layout,
|
||||||
|
dictData
|
||||||
|
})
|
||||||
|
|
||||||
|
export default combine
|
||||||
23
web-react/src/store/reducer/layout.js
Normal file
23
web-react/src/store/reducer/layout.js
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
const layout = (state = {
|
||||||
|
siderCollapsed: false
|
||||||
|
}, action) => {
|
||||||
|
switch (action.type) {
|
||||||
|
// 打开窗口
|
||||||
|
case 'OPEN_WINDOW':
|
||||||
|
return state
|
||||||
|
// 关闭窗口
|
||||||
|
case 'CLOSE_WINDOW':
|
||||||
|
return state
|
||||||
|
// 重新加载窗口
|
||||||
|
case 'RELOAD_WINDOW':
|
||||||
|
return state
|
||||||
|
// 侧边收起状态
|
||||||
|
case 'TOGGLE_COLLAPSED':
|
||||||
|
const _state = { ...state, siderCollapsed: action.siderCollapsed }
|
||||||
|
return _state
|
||||||
|
default:
|
||||||
|
return state
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default layout
|
||||||
12
web-react/src/store/reducer/user.js
Normal file
12
web-react/src/store/reducer/user.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
const user = (state = {}, action) => {
|
||||||
|
// 写入各种action对应的操作
|
||||||
|
switch (action.type) {
|
||||||
|
case 'SET_USER_ACCOUNT':
|
||||||
|
const _state = { ...state, ...action.user }
|
||||||
|
return _state
|
||||||
|
default:
|
||||||
|
return state
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default user
|
||||||
@@ -5,16 +5,16 @@ import { toCamelCase } from 'util/format'
|
|||||||
|
|
||||||
const { getState, dispatch } = store
|
const { getState, dispatch } = store
|
||||||
|
|
||||||
const getDicData = async (...args) => {
|
const getDictData = async (...args) => {
|
||||||
const dicData = getState('dicData')
|
const dictData = getState('dictData')
|
||||||
let result = {}
|
let result = {}
|
||||||
const code = []
|
const code = []
|
||||||
for (let i = 0; i < args.length; i++) {
|
for (let i = 0; i < args.length; i++) {
|
||||||
const codeName = toCamelCase(args[i])
|
const codeName = toCamelCase(args[i])
|
||||||
if (!dicData.hasOwnProperty(codeName)) {
|
if (!dictData.hasOwnProperty(codeName)) {
|
||||||
code.push(args[i])
|
code.push(args[i])
|
||||||
} else {
|
} else {
|
||||||
result[codeName] = dicData[codeName]
|
result[codeName] = dictData[codeName]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ const getDicData = async (...args) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'ADD_DIC_DATA',
|
type: 'ADD_DICT_DATA',
|
||||||
value
|
value
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ const getDicData = async (...args) => {
|
|||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
return dicData
|
return dictData
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getDicData
|
export default getDictData
|
||||||
Reference in New Issue
Block a user