diff --git a/src/military/fetch.js b/src/military/fetch.js index 45a48ed7..2ea879b5 100644 --- a/src/military/fetch.js +++ b/src/military/fetch.js @@ -5,8 +5,8 @@ import cookie from 'react-cookies'; let actionUrl = ''; if (window.location.href.indexOf('localhost') > -1) { - // actionUrl = 'http://117.50.100.12:8008'; - actionUrl='http://192.168.31.72:8081'; + actionUrl = 'http://117.50.100.12:8008'; + // actionUrl='http://192.168.31.73:8081'; } else if (window.location.href.indexOf('117.50.100.12') > -1) { actionUrl = "http://117.50.100.12:8008"; axios.defaults.withCredentials = true; diff --git a/src/military/task/agreementManage/index.js b/src/military/task/agreementManage/index.js index 8fee7247..c7e5355d 100644 --- a/src/military/task/agreementManage/index.js +++ b/src/military/task/agreementManage/index.js @@ -1,4 +1,4 @@ -import React, { useCallback, forwardRef, useEffect, useState } from 'react'; +import React, { useCallback, useEffect, useState } from 'react'; import { Input, Button, Form, Select } from 'antd'; import AdminRouter from '../components/adminRouter'; import ItemAgreementManage from '../components/itemAgreementManage'; @@ -9,10 +9,10 @@ import '../index.scss'; const Option = Select.Option; const agreementOptionArr = agreementArr.slice(0, 2); -export default Form.create()(({ current_user, form, showNotification, match, history }) => { +export default Form.create()(({ form, showNotification, match, history }) => { - const { getFieldDecorator, validateFields, setFieldsValue, getFieldsValue } = form; + const { getFieldDecorator, validateFields, setFieldsValue, } = form; const [approve, setApprove] = useState(1); const [loading, setLoading] = useState(false); @@ -25,6 +25,9 @@ export default Form.create()(({ current_user, form, showNotification, match, his const [reload, setReload] = useState(0); + const [loadPaper, setLoadPaper] = useState(0); + + // 加载审核协议列表 useEffect(() => { const params = { ...searchObj, @@ -36,14 +39,41 @@ export default Form.create()(({ current_user, form, showNotification, match, his setLoading(true); agreementList(params).then(data => { if (data) { + if (loadPaper === 0 && data.rows.length === 0) { + setLoadPaper(1); + } else { + setLoadPaper(2); + } setTaskList(data.rows); setTotal(data.total); } setLoading(false); - }) + }); }, [reload, status, curPage, searchObj, type]); + // 如果第一次加载任务协议审核发现没有数据,那么切换成审核成果协议列表 + useEffect(() => { + if (loadPaper === 1) { + const params = { + status: '2', + type: '2', + currentPage: 1, + pageSize: 10, + }; + setLoading(true); + agreementList(params).then(data => { + if (data && data.rows.length > 0) { + setTaskList(data.rows); + setTotal(data.total); + setType('2'); + setLoadPaper(2); + } + setLoading(false); + }); + } + }, [loadPaper]); + // form表单公共处理函数 const helper = useCallback( (name, rules, widget, initialValue) => (