forked from Gitlink/forgeplus-react
修改bug
This commit is contained in:
parent
507976bf10
commit
bdf3a8e72a
|
@ -17,6 +17,14 @@ export function getUserInfo() {
|
|||
});
|
||||
}
|
||||
|
||||
// 获取用户企业信息
|
||||
export function getCompanyInfo() {
|
||||
return fetch({
|
||||
url: '/api/tasks/getEnterpriseUserInfo',
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
// 获取任务领域
|
||||
export async function getTaskCategory() {
|
||||
let res = await fetch({
|
||||
|
|
|
@ -115,25 +115,28 @@ export default Form.create()(
|
|||
|
||||
// 获取成果列表
|
||||
useEffect(() => {
|
||||
setLoading(true);
|
||||
let params = {
|
||||
taskId: id,
|
||||
orderBy: '',
|
||||
pageSize: 10,
|
||||
curPage,
|
||||
status,
|
||||
}
|
||||
id && getTaskPaper(params).then(data => {
|
||||
if (data && Array.isArray(data.rows)) {
|
||||
for (const item of data.rows) {
|
||||
item.detail = item.paperDetail ? item.paperDetail.content : "";
|
||||
}
|
||||
// 等加载完成果详情再加载成果列表
|
||||
if (detailData.id) {
|
||||
setLoading(true);
|
||||
let params = {
|
||||
taskId: id,
|
||||
orderBy: '',
|
||||
pageSize: 10,
|
||||
curPage,
|
||||
status,
|
||||
}
|
||||
setDataList(data.rows || []);
|
||||
setLoading(false);
|
||||
setTotal(data.total);
|
||||
});
|
||||
}, [id, status, curPage, reload, relaodChildList]);
|
||||
getTaskPaper(params).then(data => {
|
||||
if (data && Array.isArray(data.rows)) {
|
||||
for (const item of data.rows) {
|
||||
item.detail = item.paperDetail ? item.paperDetail.content : "";
|
||||
}
|
||||
}
|
||||
setDataList(data.rows || []);
|
||||
setLoading(false);
|
||||
setTotal(data.total);
|
||||
});
|
||||
}
|
||||
}, [id, status, curPage, reload, relaodChildList, detailData]);
|
||||
|
||||
|
||||
// 流程步骤显示,返回剩余时间
|
||||
|
|
|
@ -6,7 +6,7 @@ import ReactWEditor from 'wangeditor-for-react';
|
|||
import { Link } from "react-router-dom";
|
||||
import Upload from '../../components/Upload';
|
||||
import { httpUrl } from '../../fetch';
|
||||
import { getTaskDetail, addTask, updateTask, getTaskCategory } from '../api';
|
||||
import { getTaskDetail, addTask, updateTask, getTaskCategory, getCompanyInfo } from '../api';
|
||||
import { formItemLayout, formModalLayout } from '../static';
|
||||
import { editorConfig } from '../../components/config';
|
||||
import './index.scss';
|
||||
|
@ -21,14 +21,14 @@ function getSomeDayAfter(nDay) {
|
|||
export default Form.create()(forwardRef(({ current_user, form, showNotification, match, history }, ref) => {
|
||||
|
||||
console.log(current_user);
|
||||
|
||||
|
||||
const [taskCategoryArr, setTaskCategoryArr] = useState([]);
|
||||
const [fileList, setFileList] = useState(null);
|
||||
|
||||
const [publishMode, setPublishMode] = useState('0');
|
||||
const [categoryId, setCategoryId] = useState('7');
|
||||
const [descriptionHtml, setDescriptionHtml] = useState('');
|
||||
const [enterpriseName, setEnterpriseName] = useState('神马科技股份有限公司');
|
||||
const [enterpriseName, setEnterpriseName] = useState('');
|
||||
const [displayTime, setDisplayTime] = useState(() => {
|
||||
return {
|
||||
collectingTime: getSomeDayAfter(30),
|
||||
|
@ -92,7 +92,7 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
|
|||
} else {
|
||||
let formValue = {
|
||||
contactName: current_user.username || current_user.login,
|
||||
contactPhone: current_user.contactPhone || 18888888888,
|
||||
contactPhone: current_user.contactPhone,
|
||||
taskModeId: 1,
|
||||
collectionMode: 1,
|
||||
publishMode: '0',
|
||||
|
@ -107,6 +107,19 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
|
|||
}
|
||||
}, [id]);
|
||||
|
||||
useEffect(() => {
|
||||
getCompanyInfo().then(res => {
|
||||
if (res && res.message === 'success') {
|
||||
setEnterpriseName(res.data.enterpriseName);
|
||||
setFieldsValue({
|
||||
contactPhone:res.data.phone
|
||||
})
|
||||
}else{
|
||||
showNotification(res.message);
|
||||
}
|
||||
});
|
||||
},[]);
|
||||
|
||||
useEffect(() => {
|
||||
getTaskCategory().then(data => {
|
||||
if (data) {
|
||||
|
@ -285,7 +298,7 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
|
|||
<Input
|
||||
className="contact-input"
|
||||
placeholder="请输入联系电话"
|
||||
// disabled
|
||||
disabled
|
||||
/>, '', <Icon className="editPhone" type="edit" onClick={() => { setVisible(true) }} />
|
||||
)}
|
||||
|
||||
|
|
|
@ -5,11 +5,11 @@ import ChooseNav from '../../components/chooseNav';
|
|||
import SortBox from '../../components/sortBox';
|
||||
import ItemListTask from '../components/itemListTask';
|
||||
import { taskTimeArr, taskStatusArr, sortArr, taskModeIdArr } from '../static';
|
||||
import { getTaskList, getTaskCategory } from '../api';
|
||||
import { getTaskList, getTaskCategory, getCompanyInfo } from '../api';
|
||||
import '../index.scss';
|
||||
const Search = Input.Search;
|
||||
|
||||
export default ({ history, current_user}) => {
|
||||
export default ({ history, current_user }) => {
|
||||
console.log(current_user);
|
||||
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
@ -60,7 +60,6 @@ export default ({ history, current_user}) => {
|
|||
}, [categoryId, taskModeId, expiredStartTime, expiredEndTime, statusString, searchInput, orderBy, curPage]);
|
||||
|
||||
|
||||
// function changeOptionId(option, type) {
|
||||
const changeOptionId = useCallback((option, type) => {
|
||||
if (type === 'taskCategory') {
|
||||
setCategoryId(option.dicItemCode);
|
||||
|
@ -93,27 +92,21 @@ export default ({ history, current_user}) => {
|
|||
setOrderBy(sortValue);
|
||||
setCurPage(1);
|
||||
}, []);
|
||||
// function changeSort(sortType) {
|
||||
// console.log('-----sort----');
|
||||
// console.log(sortType);
|
||||
// let sortValue = '';
|
||||
// if (sortType.type !== 'default') {
|
||||
// if (sortType.desc) {
|
||||
// sortValue = sortType.type + 'Desc';
|
||||
// } else {
|
||||
// sortValue = sortType.type + 'Asc';
|
||||
// }
|
||||
// }
|
||||
// setOrderBy(sortValue);
|
||||
// setCurPage(1);
|
||||
// }
|
||||
|
||||
function taskClick(id) {
|
||||
history.push(`/task/taskDetail/${id}`);
|
||||
}
|
||||
|
||||
function goAdd() {
|
||||
history.push("/task/taskAdd");
|
||||
getCompanyInfo().then(res => {
|
||||
if(res){
|
||||
if (res.message === 'success') {
|
||||
history.push("/task/taskAdd");
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
Loading…
Reference in New Issue