添加 dic 组件,select 和 value text
This commit is contained in:
40
admin-web/src/models/dictionary/dictionarySelect.js
Normal file
40
admin-web/src/models/dictionary/dictionarySelect.js
Normal file
@@ -0,0 +1,40 @@
|
||||
import { queryKey, queryText } from '../../services/dictionary';
|
||||
|
||||
export default {
|
||||
namespace: 'dictionarySelect',
|
||||
|
||||
state: {
|
||||
list: [],
|
||||
text: '',
|
||||
},
|
||||
|
||||
effects: {
|
||||
*query({ payload }, { call, put }) {
|
||||
const response = yield call(queryKey, payload);
|
||||
yield put({
|
||||
type: 'querySuccess',
|
||||
payload: {
|
||||
list: response.list,
|
||||
},
|
||||
});
|
||||
},
|
||||
*queryText({ payload }, { call, put }) {
|
||||
const response = yield call(queryText, payload);
|
||||
yield put({
|
||||
type: 'querySuccess',
|
||||
payload: {
|
||||
text: response.text,
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
reducers: {
|
||||
querySuccess(state, { payload }) {
|
||||
return {
|
||||
...state,
|
||||
...payload,
|
||||
};
|
||||
},
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user