Commit a063cd00 by fanyj

tijiao

parent 56a9954c
......@@ -12,6 +12,10 @@ import { $hostParams } from "./util";
import './index.less';
ConfigProvider.config({
prefixCls: 'yy', // 4.13.0+
});
function render(props) {
const { container, ...restProps } = props;
ReactDOM.render(
......
......@@ -22,6 +22,8 @@ export const httpUtil={
}
},
showError:(data:any,type:number,title?:string)=>{
console.log('error')
console.log((data.data||{}).ApiError||(data||{}).ApiError||(data||{}).message||(data.data||{}).message)
if(data.status&&((data.data||{}).ApiError||(data||{}).ApiError||(data||{}).message||(data.data||{}).message)){
let messages = '未知异常';
try {
......
......@@ -153,6 +153,7 @@ export default function request(options:any, autotip:boolean){
return new Promise((resolve)=>{
let result:any = {}
fetch(options).then(response => {
console.log('response',response)
try {
if(response?.status===200){
if(autotip)
......@@ -184,10 +185,10 @@ export default function request(options:any, autotip:boolean){
}).catch(async (error) => {
if(autotip)
message.error('操作异常')
let data = error;
let data = error.response;
if(data?.ApiError||data?.status){
result.status=500
result.data=data
result.data=data.data
}
resolve(result)
})
......
......@@ -223,7 +223,7 @@ const AssetFlow:React.FC<any>=(props)=>{
<Col span={12}>
<Form.Item
label='送审说明'
name="desc"
name="opinion"
style={{ marginBottom:15 }}
rules={[{ required: true, message: '请填写送审说明!' }]}
>
......
import React,{ useState, useEffect, useRef, useContext, useMemo } from "react";
import { Button, Pagination, Space, Modal, Input, Tooltip, Checkbox, Typography, Dropdown, Menu, Divider, Select, message } from "antd";
import { Button, Pagination, Space, Modal, Input, Tooltip, Checkbox, Typography, Dropdown, Menu, Divider, Select, message, notification } from "antd";
import classNames from 'classnames';
import { Resizable } from 'react-resizable';
import ResizeObserver from 'rc-resize-observer';
......
......@@ -25,7 +25,7 @@ const FlowAcceptDetail:React.FC<any>=(props)=>{
return httpUtil.getQueryVariable('processId',location.search)||''
},[location.search])
const {detail,detalLoading} = useGetProcessDetail({processId})
const {detail,detalLoading,reload} = useGetProcessDetail({processId})
const editmodal = useGetModalInfoAndAction()
useEffect(()=>{
......@@ -153,6 +153,7 @@ const FlowAcceptDetail:React.FC<any>=(props)=>{
const playload = {...detail,...data,submitItems:dataSource}
saveQuestionItemNext(playload,()=>{
showMessage('success','操作成功')
reload?.()
})
}else{
showMessage('info','请选择下一步处理人')
......@@ -176,6 +177,7 @@ const FlowAcceptDetail:React.FC<any>=(props)=>{
const playload = {...detail,...data,submitItems:list}
saveQuestionItemFinal(playload,()=>{
showMessage("success",'操作成功')
reload?.()
})
}else{
showMessage('info','请完成待完成项')
......@@ -203,8 +205,8 @@ const FlowAcceptDetail:React.FC<any>=(props)=>{
</Descriptions.Item>
<Descriptions.Item label="附件">
{
(detail?.attachments||[]).map((item:any)=>{
return <Tag color="blue" style={{cursor:'pointer'}} onClick={()=>{openDetail(item.fileId)}} >{item?.fileName}</Tag>
(detail?.attachments||[]).map((item:any,key:number)=>{
return <Tag color="blue" key={key} style={{cursor:'pointer'}} onClick={()=>{openDetail(item.fileId)}} >{item?.fileName}</Tag>
})
}
</Descriptions.Item>
......@@ -258,8 +260,8 @@ const FlowAcceptDetail:React.FC<any>=(props)=>{
footer={
<div style={{display:'flex',justifyContent:'center',width:'100%'}}>
<Space>
<Button loading={loading} onClick={nextUser} type="primary">转分配</Button>
<Button loading={loading} onClick={finishFlow} type="primary">保存</Button>
<Button loading={loading} disabled={!detail?.operateAble} onClick={nextUser} type="primary">转分配</Button>
<Button loading={loading} disabled={!detail?.operateAble} onClick={finishFlow} type="primary">保存</Button>
</Space>
</div>
}
......
......@@ -85,22 +85,29 @@ export const useGetProcessDetail = (props: {processId: string}) => {
const [loading, setLoading] = useState<boolean>(false);
useEffect(() => {
const fetchData = async () => {
try {
setLoading(true);
const response: any = await assetsManageService.getProcessDetail({processId});
if (httpUtil.checkSuccess(response, 1)) {
setDetail(response.data);
} else {
httpUtil.showError(response, 1);
}
} finally {
setLoading(false);
}
};
if(processId)
fetchData();
}, [processId]);
return { detail, detalLoading:loading };
const fetchData = async () => {
try {
setLoading(true);
const response: any = await assetsManageService.getProcessDetail({processId});
if (httpUtil.checkSuccess(response, 1)) {
setDetail(response.data);
} else {
httpUtil.showError(response, 1);
}
} finally {
setLoading(false);
}
};
const reload=useCallback(()=>{
if(processId)
fetchData();
},[])
return { detail, detalLoading:loading,reload };
};
\ No newline at end of file
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