Files
fe_service_ebtp_frontend/src/models/bidev.js
2021-01-16 11:29:42 +08:00

187 lines
6.1 KiB
JavaScript

import { fetchManagerList,openBizassessroom,resetVerificationCode,fetchJuryList,fetchSupplierList
,fetchJuryMemInfo,updateJuryMemInfo,validateVerificationCode,fetchbidslist
,fetchPreSupplierList,fetchPreList,fetchPreListt,pushRedirectRe,getCheckedByRoomId } from '../services/bidev';
import { message } from 'antd';
import { getProId } from '@/utils/session';
// import { message } from 'antd';
// import { stringify } from 'qs';
export default {
namespace: 'bidev',
state: {
supplierList:[],
managerList:[],
JuryList:[],
JuryInfo:[],
bidslist:[]
},
effects: {
// 查询招标代理列表
*fetchManagerList({payload,callback}, { call, put }){
const response =yield call(fetchManagerList,payload)
if(response.code==200){
yield put({ type: 'save', payload: {managerList:response.data} });
}else{
message.error("查询错误!")
}
},
// 开启评审室
*openBizassessroom({payload,callback}, { call, put }){
const response =yield call(openBizassessroom,payload)
if(response.code==200){
// 查询招标代理列表
const params={
pageNo:1,
pageSize:10,
roomType:2,
tpId:getProId()//项目id
}
yield put({ type: 'fetchManagerList', payload: {...params} });
message.success("开启成功!")
}else{
message.error("开启失败!")
}
},
// 重置校验码
*resetVerificationCode({payload,callback}, { call, put }){
const response =yield call(resetVerificationCode,payload)
if(response.code==200){
// 查询招标代理列表
const params={
pageNo:payload.pageNo,
pageSize:payload.pageSize,
roomType:2,
tpId:payload.tpId//项目id
}
yield put({ type: 'fetchManagerList', payload: {...params} });
}else{
message.error("重置失败!")
}
},
// 查询专家地列表
*fetchJuryList({payload,callback}, { call, put }){
const response =yield call(fetchJuryList,payload)
if(response.code==200){
console.log(response);
yield put({ type: 'save', payload: {JuryList:response.data} });
}else{
message.error("查询错误!")
}
},
*fetchSupplierList({payload,callback}, { call, put }){
const response =yield call(fetchSupplierList,payload)
if(response.code==200){
yield put({ type: 'save', payload: {supplierList:response.data} });
}else{
message.error("查询错误!")
}
},
*fetchJuryMemInfo({payload,callback}, { call, put }){
const response =yield call(fetchJuryMemInfo,payload)
if(response.code==200){
yield put({ type: 'save', payload: {JuryInfo:response.data} });
if(callback) callback(response,"success")
}else{
if(callback) callback(response,"fail")
message.error("查询专家信息错误!")
}
},
// 新更新评委信息
*updateJuryMemInfo({payload,callback}, { call, put }){
const response =yield call(updateJuryMemInfo,payload)
if(response.code==200){
if(callback) callback(response,"success")
}else{
if(callback) callback(response,"fail")
message.error("修改专家信息失败!")
}
},
*validateVerificationCode({payload,callback}, { call, put }){
const response =yield call(validateVerificationCode,payload)
if(response.code==200){
if(response.success==true){
if(callback) callback(response,"success")
}else{
if(callback) callback(response,"fail")
message.error("校验码错误!")
}
}
},
*fetchbidslist({payload,callback}, { call, put }){
const response =yield call(fetchbidslist,payload)
if(response.code==200){
yield put({ type: 'save', payload: {bidslist:response.data} });
}else{
message.error("查询投标人信息错误!")
}
},
// 获取初审汇总表title
*fetchPreList({payload,callback}, { call, put }){
const response =yield call(fetchPreList,payload)
// const response=preList;
if(response.code==200){
if(callback) callback(response,"success")
yield put({ type: 'save', payload: {preList:response.data} });
}else{
if(callback) callback(response,"fail")
message.error("查询错误!")
}
},
// 获取初审汇总表datasource
*fetchPreSupplierList({payload,callback}, { call, put }){
const response =yield call(fetchPreSupplierList,payload)
// const response =preSupplierList;
if(response.code==200){
if(callback) callback(response,"success")
yield put({ type: 'save', payload: {preSupplierList:response.data}});
}else{
if(callback) callback(response,"fail")
message.error("查询错误!")
}
},
*fetchPreListt({payload,callback}, { call, put }){
const response =yield call(fetchPreListt,payload)
// const response =preSupplierList;
if(response.code==200){
if(callback) callback(response,"success")
yield put({ type: 'save', payload: {preSupplierList:response.data}});
}else{
if(callback) callback(response,"fail")
message.error("查询错误!")
}
},
*pushRedirectRe({payload,callback}, { call, put }){
const response =yield call(pushRedirectRe,payload)
if(response.code==200){
if(response.success==true){
if(callback) callback(response,"success")
}else{
if(callback) callback(response,"fail")
message.error("专家承诺书确认出现错误,请重试!")
}
}
},
*getCheckedByRoomId({payload,callback}, { call, put }){
const response =yield call(getCheckedByRoomId,payload)
if(response.code==200){
if(response.success==true){
if(callback) callback(response)
}else{
if(callback) callback(response)
message.error("获取状态失败")
}
}
},
},
reducers: {
save(state, { payload }) {
return {
...state,
...payload,
};
}
}
}