Commit 5377ba07 authored by Sixiang_Zzb's avatar Sixiang_Zzb

新建服务商提交提示优化

parent 6e123393
import * as service from '../services/tos';
import { message, Modal } from 'antd';
import { history } from 'umi';
import * as service from '../services/tos';
export default {
namespace: 'ServiceProvider',
......@@ -27,7 +28,6 @@ export default {
return { ...state, SaveChooseData };
},
returnCurData(state: object, { CurData }: any) {
console.log(CurData)
return { ...state, CurData };
},
returnResult(state: object, { Result }: any) {
......@@ -39,28 +39,22 @@ export default {
// 获取服务商
*TosTosServiceProviderGet({ playload }: any, { call, put }: any) {
const resp = yield call(service.TosTosServiceProviderGet, playload);
console.log(resp);
if (resp.error_code == '0000') {
let Data = resp.data;
if (resp.error_code === '0000') {
const Data = resp.data;
yield put({ type: 'returnPage', Data });
} else {
console.log(resp);
console.log('请求错误码:' + resp.error_code);
message.error(resp.error_msg);
let Data = undefined;
console.log(playload);
const Data = undefined;
yield put({ type: 'returnPage', Data });
}
},
// 新建服务商
*TosTosServiceProviderSave({ playload }: any, { call, put }: any) {
console.log(playload);
const resp = yield call(service.TosTosServiceProviderSave, playload);
console.log(resp);
// 服务范围选择错误
if (resp.error_code === "0002") {
let CurData: Boolean = false;
const CurData: Boolean = false;
yield put({ type: "returnCurData", CurData });
// message.error("Service scope selection error!!!")
Modal.error({
......@@ -72,7 +66,7 @@ export default {
// 小区选择错误
if (resp.error_code === "0003") {
let CurData: Boolean = false;
const CurData: Boolean = false;
yield put({ type: "returnCurData", CurData });
Modal.error({
title: 'Service selection error',
......@@ -83,7 +77,7 @@ export default {
// 提交失败
if (resp.error_code === "0001") {
let CurData: Boolean = false;
const CurData: Boolean = false;
yield put({ type: 'returnCurData', CurData });
message.error('Creation failed. Please try again!');
return;
......@@ -93,38 +87,35 @@ export default {
if (resp.error_code === "0000") {
// message.success('Operator Success!', 1.5, () => {
// });
window.location.href = '/UserManagement/ServiceProviderManagement';
let CurData: Boolean = true;
const CurData: Boolean = true;
yield put({ type: 'returnCurData', CurData });
window.location.href = '/UserManagement/ServiceProviderManagement';
return;
}
// 小区选择错误
if (resp.error_code === "0004") {
let CurData: Boolean = false;
const CurData: Boolean = false;
yield put({ type: "returnCurData", CurData });
message.error("Company name already exists!")
return;
message.error("Company name already exists!");
}
},
//获取服务商保安根据服务商名
// 获取服务商保安根据服务商名
*TosSecurityGuarderGet({ playload }: any, { call, put }: any) {
console.log(playload);
const resp = yield call(service.TosSecurityGuarderGet, playload);
console.log(resp);
let CurDataFollow = resp.data.rows;
const CurDataFollow = resp.data.rows;
yield put({ type: 'returnCurDataFollow', CurDataFollow });
},
//获取服务商保安详情根据服务商名
// 获取服务商保安详情根据服务商名
*GuarderById({ playload }: any, { call, put }: any) {
let CurDataFollowDetail = playload;
const CurDataFollowDetail = playload;
yield put({ type: 'returnCurDataFollowDetail', CurDataFollowDetail });
},
*SaveChooseData({ playload }: any, { call, put }: any) {
let SaveChooseData = playload;
const SaveChooseData = playload;
yield put({ type: 'returnSaveChooseData', SaveChooseData });
},
......@@ -132,36 +123,31 @@ export default {
*DelServiceProvider({ playload }: any, { call, put }: any) {
const resp = yield call(service.TosTosServiceProviderDel, playload);
if (resp.error_code === '0000') {
let Result = true;
const Result = true;
yield put({ type: 'returnResult', Result });
} else {
let Result = false;
const Result = false;
yield put({ type: 'returnResult', Result });
}
},
*ResultClear({ playload }: any, { call, put }: any) {
console.log('清除数据');
let Result = null;
const Result = null;
yield put({ type: 'returnResult', Result });
},
*DelGuarder({ playload }: any, { call, put }: any) {
console.log('删除保安');
console.log(playload);
const res = yield call(service.TosGuarderDel, playload);
console.log(res);
if (res.error_code === '0000') {
message.success('Safer information deleted successfully!!!');
history.go(-1);
history.goBack();
} else {
message.error('Deletion failed,Please try again');
}
},
*CurDataClear({ playload }: any, { call, put }: any) {
console.log('清除数据');
let CurData = null;
const CurData = null;
yield put({ type: 'returnCurData', CurData });
},
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment