|
@@ -160,9 +160,15 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
*remoteAdd(action, { select, call, put, takeEvery, takeLatest }) {
|
|
*remoteAdd(action, { select, call, put, takeEvery, takeLatest }) {
|
|
|
- const dataConnect = yield select(state => state.present.dataConnect);
|
|
|
|
|
- const model = dataConnect.newOne;
|
|
|
|
|
try {
|
|
try {
|
|
|
|
|
+ yield put({ type: 'remoteValidate' }); // 新增前校验
|
|
|
|
|
+
|
|
|
|
|
+ const dataConnect = yield select(state => state.present.dataConnect);
|
|
|
|
|
+ const model = dataConnect.newOne;
|
|
|
|
|
+
|
|
|
|
|
+ if(model.invalid) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
let body = {
|
|
let body = {
|
|
|
name: model.name,
|
|
name: model.name,
|
|
|
addrass: model.address,
|
|
addrass: model.address,
|
|
@@ -189,11 +195,16 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
*remoteModify(action, { select, call, put }) {
|
|
*remoteModify(action, { select, call, put }) {
|
|
|
- const dataConnect = yield select(state => state.present.dataConnect);
|
|
|
|
|
- let model = dataConnect.newOne;
|
|
|
|
|
- const code = action.code;
|
|
|
|
|
- let list = dataConnect.list;
|
|
|
|
|
try{
|
|
try{
|
|
|
|
|
+ const dataConnect = yield select(state => state.present.dataConnect);
|
|
|
|
|
+ const model = dataConnect.newOne;
|
|
|
|
|
+
|
|
|
|
|
+ if(model.invalid) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const code = action.code;
|
|
|
|
|
+
|
|
|
let data = {
|
|
let data = {
|
|
|
id: code,
|
|
id: code,
|
|
|
name: model.name,
|
|
name: model.name,
|
|
@@ -210,6 +221,7 @@ export default {
|
|
|
body: data
|
|
body: data
|
|
|
});
|
|
});
|
|
|
if(!res.err && res.data.code > 0) {
|
|
if(!res.err && res.data.code > 0) {
|
|
|
|
|
+ let list = dataConnect.list;
|
|
|
list = list.map(l => {
|
|
list = list.map(l => {
|
|
|
if((l.code+'') === (action.code+'')) {
|
|
if((l.code+'') === (action.code+'')) {
|
|
|
l = model;
|
|
l = model;
|