import { fetchDowntlist, fetchprojectRecords, fetchJuryUpList, fetchJuryDownlist, fetchSupplierUpList, fetchDisposalList, fetchParticipants, fetchSupplierDownLeftList, fetchSupplierDownRightList, fetchtlist, fetchtlistre, fetchtPageList, fetchtShotList, fetchtClarify, fetchProjectFileList } from '../services/dashboard'; import { message } from 'antd'; import { getProId } from '@/utils/session'; import { getURLInformation } from '@/utils/CommonUtils'; // import { message } from 'antd'; // import { stringify } from 'qs'; const procurementmodelist = [ { "id": 11, "code": "procurement_mode_1", "dicName": "公开招标", "parentCode": "procurement_mode", "parentType": "procurement_mode=entrust", "useFlag": "0", "defaultFlag": null, "orderFlag": 1, "description": "采购方式" }, { "id": 12, "code": "procurement_mode_2", "dicName": "邀请招标", "parentCode": "procurement_mode", "parentType": "procurement_mode=entrust", "useFlag": "0", "defaultFlag": null, "orderFlag": 2, "description": "采购方式" }, { "id": 13, "code": "procurement_mode_3", "dicName": "公开比选", "parentCode": "procurement_mode", "parentType": "procurement_mode=entrust", "useFlag": "0", "defaultFlag": null, "orderFlag": 3, "description": "采购方式" }, { "id": 16, "code": "procurement_mode_4", "dicName": "公开招募", "parentCode": "procurement_mode", "parentType": "procurement_mode=entrust", "useFlag": "0", "defaultFlag": null, "orderFlag": 4, "description": "采购方式" }, { "id": 17, "code": "procurement_mode_5", "dicName": "竞争性谈判", "parentCode": "procurement_mode", "parentType": "procurement_mode=entrust", "useFlag": "0", "defaultFlag": null, "orderFlag": 5, "description": "采购方式" }, { "id": 65, "code": "procurement_mode_6", "dicName": "单一来源", "parentCode": "procurement_mode", "parentType": "procurement_mode=entrust", "useFlag": "0", "defaultFlag": null, "orderFlag": 6, "description": "采购方式" }, { "id": 66, "code": "procurement_mode_7", "dicName": "公开询价", "parentCode": "procurement_mode", "parentType": "procurement_mode=entrust", "useFlag": "0", "defaultFlag": null, "orderFlag": 7, "description": "采购方式" }, { "id": 67, "code": "procurement_mode_8", "dicName": "竞拍", "parentCode": "procurement_mode", "parentType": "procurement_mode=entrust", "useFlag": "0", "defaultFlag": null, "orderFlag": 8, "description": "采购方式" }, { "id": 130, "code": "procurement_mode_9", "dicName": "单一来源简化流程", "parentCode": "procurement_mode", "parentType": "procurement_mode=entrust", "useFlag": "0", "defaultFlag": null, "orderFlag": 9, "description": "采购方式" } ] const sttlist = [ { id: 1, title: "公开招标", description: "公开招标的数量", valid: ["procurement_mode_1", "procurement_mode_2"], count: 0 }, { id: 2, title: "公开比选", description: "公开比选的数量", valid: ["procurement_mode_3"], count: 0 }, { id: 3, title: "谈判", description: "谈判的数量", valid: ["procurement_mode_5", "procurement_mode_6"], count: 0 }, { id: 4, title: "招募", description: "招募的数量", valid: ["procurement_mode_4"], count: 0 }, { id: 5, title: "询价", description: "询价的数量", valid: ["procurement_mode_7"], count: 0 }, { id: 6, title: "竞拍", description: "竞拍的数量", valid: ["procurement_mode_8"], count: 0 } ] const data = [{ projectCount: "100", bidMethodDict: "procurement_mode_1" }, { projectCount: "100", bidMethodDict: "procurement_mode_3" }, { projectCount: "100", bidMethodDict: "procurement_mode_5" }] export default { namespace: 'dashboard', state: { projectInProgressList: [], projectInProgeressObj: {}, downlist: [], projectlist: [], Juryuplist: [], Jurydownlist: [], supplieruplist: [], supplierleftlist: [], supplierrightlist: [], staloading: false, tlist: [], trelist: [], idList: [], dateNum: 0, pagelist: [], shotList: [], disposalList: 0, Participants: 0 }, effects: { // 项目经理 *fetchDowntlist({ payload, callback }, { call, put }) { const response = yield call(fetchDowntlist, payload) if (response.code == 200) { yield put({ type: 'save', payload: { downlist: response.data } }) } }, *fetchProjectFileList({ payload, callback }, { call, put }) { const response = yield call(fetchProjectFileList, payload) console.log(123) if (response.code == 200) { yield put({ type: 'save', payload: { projectInProgressList: response.data.records } }) } }, *fetchprojectRecords({ payload, callback }, { call, put }) { const response = yield call(fetchprojectRecords, payload) if (response.code == 200 && response.data.length > 0) { let newlist = [ { id: 1, title: "公开招标", description: "公开招标的数量", valid: ["procurement_mode_1", "procurement_mode_2"], count: 0 }, { id: 2, title: "公开比选", description: "公开比选的数量", valid: ["procurement_mode_3"], count: 0 }, { id: 3, title: "谈判", description: "谈判的数量", valid: ["procurement_mode_5", "procurement_mode_6"], count: 0 }, { id: 4, title: "招募", description: "招募的数量", valid: ["procurement_mode_4"], count: 0 }, { id: 5, title: "询价", description: "询价的数量", valid: ["procurement_mode_7"], count: 0 }, ] // for(let t of procurementmodelist){ for (let z of newlist) { for (let k of response.data) { if (z.valid.indexOf(k.bidMethodDict) != -1) { z.count = parseInt(z.count) + parseInt(k.projectCount) } } } // } // let newtlist=newlist.filter((item)=>{ // return item.count!=0 // }) yield put({ type: 'save', payload: { projectlist: newlist, staloading: false } }); } else { yield put({ type: 'save', payload: { projectlist: [], staloading: false } }); } }, // 专家 *fetchJuryUpList({ payload, callback }, { call, put }) { const response = yield call(fetchJuryUpList, payload) if (response.code == 200) { const keys = Object.keys(response.data); let t = 0; const Juryuplist = keys.map(item => { t++; return { id: t, key: item, value: response.data[item], description: item + "的数量" }; }) yield put({ type: 'save', payload: { Juryuplist: Juryuplist } }); } yield put({ type: 'save', payload: { staloading: false } }); }, *fetchJuryDownlist({ payload, callback }, { call, put }) { const response = yield call(fetchJuryDownlist, payload) if (response.code == 200) { yield put({ type: 'save', payload: { Jurydownlist: response.data.records } }); } }, // 供应商 *fetchSupplierUpList({ payload, callback }, { call, put }) { const response = yield call(fetchSupplierUpList, payload) if (response.code == 200) { let newlist = response.data; if (newlist.length > 0) { for (let t of newlist) { t.description = t.title + "的数量" } } yield put({ type: 'save', payload: { supplieruplist: newlist } }); } yield put({ type: 'save', payload: { staloading: false } }); }, *fetchSupplierDownLeftList({ payload, callback }, { call, put }) { const response = yield call(fetchSupplierDownLeftList, payload) if (response.code == 200) { yield put({ type: 'save', payload: { supplierleftlist: response.data } }); } }, *fetchSupplierDownRightList({ payload, callback }, { call, put }) { const response = yield call(fetchSupplierDownRightList, payload) if (response.code == 200) { yield put({ type: 'save', payload: { supplierrightlist: response.data.records } }); } }, *fetchtlist({ payload, callback }, { call, put }) { const response = yield call(fetchtlist, payload) if (response.code == 200) { let tlist = response.data.records if (tlist.length > 0) { let k = 1; for (let t of tlist) { t.sort = k; t++; } } yield put({ type: 'save', payload: { tlist: tlist } }); } }, *fetchtlistre({ payload, callback }, { call, put }) { const response = yield call(fetchtlistre, payload) if (response.code == 200) { let trelist = response?.records?.slice(0,6) if (trelist.length > 0) { let k = 1; for (let t of trelist) { t.sort = k; t++; } } yield put({ type: 'save', payload: { trelist: trelist } }); } }, *fetchtClarify({ payload, callback }, { call, put }) { // 首页澄清列表 const response = yield call(fetchtClarify, payload) // if (response.code == 200) { if(response.length > 0){ let clarifyList = response let idList = [] let dateNum = clarifyList[0].datanum if (clarifyList.length > 0) { clarifyList.map((item, index) => { idList.push(item.id) }) } yield put({ type: 'save', payload: { idList: idList, dateNum: dateNum } }); } // } }, // 内拍处置经理 *fetchtPageList({ payload, callback }, { call, put }) { const response = yield call(fetchtPageList, payload) if (response.code == 200) { yield put({ type: 'save', payload: { pagelist: response.data.records } }) } }, *fetchDisposalList({ payload, callback }, { call, put }) { const response = yield call(fetchDisposalList, payload) if (response.code == 200) { yield put({ type: 'save', payload: { disposalList: response.data, staloading: false } }); } }, // 内拍参拍人 *fetchtShotList({ payload, callback }, { call, put }) { const response = yield call(fetchtShotList, payload) if (response.code == 200) { yield put({ type: 'save', payload: { shotList: response.data.records } }) } }, *fetchParticipants({ payload, callback }, { call, put }) { const response = yield call(fetchParticipants, payload) if (response.code == 200) { yield put({ type: 'save', payload: { Participants: response.data, staloading: false } }); } }, }, reducers: { save(state, { payload }) { return { ...state, ...payload, }; } } }