Commit 7a463d8f authored by alwayOnlie's avatar alwayOnlie

优化代码

parent 157e4c6d
...@@ -51,10 +51,6 @@ const Add: React.FC<{}> = (props: any) => { ...@@ -51,10 +51,6 @@ const Add: React.FC<{}> = (props: any) => {
] ]
const submit = async () => { const submit = async () => {
let msg = message.loading({
content: '正在操作',
duration: 0,
});
setLoading(true); setLoading(true);
if (!Loading) { if (!Loading) {
const basicsVO = await currentBasic.current.get(); const basicsVO = await currentBasic.current.get();
...@@ -66,14 +62,16 @@ const Add: React.FC<{}> = (props: any) => { ...@@ -66,14 +62,16 @@ const Add: React.FC<{}> = (props: any) => {
} }
PublicApi.postContractApplyAmountSave(data).then(res => { PublicApi.postContractApplyAmountSave(data).then(res => {
console.log(res); console.log(res);
setLoading(false);
if (res.code === 1000) { if (res.code === 1000) {
history.push('/memberCenter/contract/funds/addbill') history.push('/memberCenter/contract/funds/addbill')
} }
}).finally(() => { }).finally(() => {
msg(); }).catch((err) => {
// resolve([]);
}); });
setTimeout(() => {
setLoading(false);
}, 2000)
} }
} }
......
...@@ -461,7 +461,7 @@ const AddInfo = (props: any) => { ...@@ -461,7 +461,7 @@ const AddInfo = (props: any) => {
<Drawer <Drawer
visible={visible} visible={visible}
onClose={() => setvisible(!visible)} onClose={() => setvisible(!visible)}
title="选择待请款单据" title="选择采购合同"
width={1000} width={1000}
footer={ footer={
<div <div
......
...@@ -340,7 +340,7 @@ const table = (props: any) => { ...@@ -340,7 +340,7 @@ const table = (props: any) => {
<Drawer <Drawer
visible={visible} visible={visible}
onClose={() => setvisible(!visible)} onClose={() => setvisible(!visible)}
title="选择采购合同" title="选择待请款单据"
width={1000} width={1000}
footer={ footer={
<div <div
......
...@@ -14,18 +14,14 @@ import SearchSelect from '@/components/NiceForm/components/SearchSelect' ...@@ -14,18 +14,14 @@ import SearchSelect from '@/components/NiceForm/components/SearchSelect'
import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePickerUnix' import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePickerUnix'
import moment from 'moment'; import moment from 'moment';
import "../../constants/index.less" import "../../constants/index.less"
import { history, Redirect } from 'umi';
const { TextArea } = Input; const { TextArea } = Input;
const Bill: React.FC<{}> = () => { const Bill: React.FC<{}> = () => {
const ref = useRef<any>({}); const ref = useRef<any>({});
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]) const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
const [selectRow, setSelectRow] = useState<any[]>([]) // 模态框选择的行数据 const [selectRow, setSelectRow] = useState<any[]>([]) // 模态框选择的行数据
const [id, setId] = useState('');
const [isModalVisible, setIsModalVisible] = useState(false);
const today = moment(); // 当天日期
const [isAllMember, setIsAllMember] = useState(true)
const [reason, setDatareason] = useState('')
;
//表头 //表头
const columns: ColumnType<any>[] = [{ const columns: ColumnType<any>[] = [{
title: '请款单号/摘要', title: '请款单号/摘要',
...@@ -101,24 +97,26 @@ const Bill: React.FC<{}> = () => { ...@@ -101,24 +97,26 @@ const Bill: React.FC<{}> = () => {
render: (text: any, record: any) => { render: (text: any, record: any) => {
// 作废:待付款、已付款、待提交审核状态的不能作废 // 作废:待付款、已付款、待提交审核状态的不能作废
let node = null;
let edit = <span style={{ color: '#00B37A', marginRight: 20, cursor: 'pointer', }} onClick={() => history.push(`/memberCenter/contract/funds/bill/details?applyId=${record.id}&type=pageDetailList`)}>作废</span>
const showEdit = [7, 1, 8, 9]
if (showEdit.indexOf(record.status) === -1) {
node = edit;
} else {
node = null;
}
console.log(record.status)
return ( return (
<> <>
{ {
// 0.全部,1.待提交审核,2.待审核(一级),3.审核不通过(一级),4.待审核(二级),5.审核不通过(二级),6.待提交财务付款,7.待付款,8.已付款,9.已作废 // 0.全部,1.待提交审核,2.待审核(一级),3.审核不通过(一级),4.待审核(二级),5.审核不通过(二级),6.待提交财务付款,7.待付款,8.已付款,9.已作废
record.status != 7 || record.status != 8 || record.status != 1 || record.status != 9 && <span style={{ color: '#00B37A', marginRight: 20, cursor: 'pointer', }} onClick={() => invalid(record.id)}>作废</span> node
} }
</> </>
) )
} }
}] }]
const handleIsAllMemberChange = (v: any) => {
setIsAllMember(v.target.value)
}
const invalid = (id) => {
setId(id)
setIsModalVisible(!isModalVisible)
}
// 模拟请求 // 模拟请求
const fetchData = (params?: any) => { const fetchData = (params?: any) => {
console.log(params)//可以直接打印参数 console.log(params)//可以直接打印参数
...@@ -151,36 +149,6 @@ const Bill: React.FC<{}> = () => { ...@@ -151,36 +149,6 @@ const Bill: React.FC<{}> = () => {
} }
}; };
/* 作废 */
const oninvalid = () => {
let res_data: any = {
applyId: id,
reason,
}
if (isAllMember) {
const msg = message.loading({
content: '正在操作',
duration: 0,
});
PublicApi.postContractApplyAmountInvalid(res_data).then(res => {
if (res.code === 1000) {
handleCancel()
ref.current.reload();
}
}).finally(() => {
msg();
})
} else {
handleCancel()
}
}
const setreason = (e) => {
setDatareason(e.target.value);
}
const handleCancel = () => {
setIsModalVisible(!isModalVisible);
};
return ( return (
<PageHeaderWrapper> <PageHeaderWrapper>
<Card> <Card>
...@@ -217,14 +185,7 @@ const Bill: React.FC<{}> = () => { ...@@ -217,14 +185,7 @@ const Bill: React.FC<{}> = () => {
}} }}
/> />
</Card> </Card>
<Modal title="单据作废" visible={isModalVisible} onCancel={handleCancel} onOk={oninvalid}>
<Radio.Group onChange={handleIsAllMemberChange} defaultValue={isAllMember} value={isAllMember}>
<Radio value={true}>作废</Radio>
<Radio value={false}>不作废</Radio>
</Radio.Group>
<p style={{ padding: 10, margin: 0 }}>单据作废原因 <span style={{ color: 'red' }}>*</span></p>
<TextArea placeholder="在此输入你的原因,最多60个汉字" maxLength={120} onChange={(e) => setreason(e)} />
</Modal>
</PageHeaderWrapper> </PageHeaderWrapper>
) )
......
...@@ -106,11 +106,15 @@ const BillDetails = (props: any) => { ...@@ -106,11 +106,15 @@ const BillDetails = (props: any) => {
} }
/* 显示审核弹出 */ /* 显示审核弹出 */
const submitExaminefunds = () => { const submitExaminefunds = () => {
const msg = message.loading({ if (type == 'pageDetailList') {
content: '正在操作', setIsModalVisible(!isModalVisible);
duration: 0, return
}); }
if (type == 'submitExamine') { if (type == 'submitExamine') {
const msg = message.loading({
content: '正在操作',
duration: 0,
});
PublicApi.postContractApplyAmountSubmitExamine({ applyId }).then(res => { PublicApi.postContractApplyAmountSubmitExamine({ applyId }).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
setTimeout(() => { setTimeout(() => {
...@@ -120,7 +124,12 @@ const BillDetails = (props: any) => { ...@@ -120,7 +124,12 @@ const BillDetails = (props: any) => {
}).finally(() => { }).finally(() => {
msg(); msg();
}); });
} else if (type == 'PageToBeSubmit') { } if (type == 'pageToBeSubmit') {
console.log('type')
const msg = message.loading({
content: '正在操作',
duration: 0,
});
PublicApi.postContractApplyAmountSubmit({ applyId }).then(res => { PublicApi.postContractApplyAmountSubmit({ applyId }).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
setTimeout(() => { setTimeout(() => {
...@@ -130,12 +139,13 @@ const BillDetails = (props: any) => { ...@@ -130,12 +139,13 @@ const BillDetails = (props: any) => {
}).finally(() => { }).finally(() => {
msg(); msg();
}); });
return;
} else { } else {
setExamineFlag(true) setExamineFlag(true)
} }
} }
/* 作废 */ /* 作废 */
const oninvalid = () => { const Void = () => {
let res_data: any = { let res_data: any = {
applyId, applyId,
reason, reason,
...@@ -148,6 +158,9 @@ const BillDetails = (props: any) => { ...@@ -148,6 +158,9 @@ const BillDetails = (props: any) => {
PublicApi.postContractApplyAmountInvalid(res_data).then(res => { PublicApi.postContractApplyAmountInvalid(res_data).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
handleCancel() handleCancel()
setTimeout(() => {
history.goBack();
}, 2000);
} }
}).finally(() => { }).finally(() => {
msg(); msg();
...@@ -266,7 +279,7 @@ const BillDetails = (props: any) => { ...@@ -266,7 +279,7 @@ const BillDetails = (props: any) => {
<ColumnsList applyId={applyId} /> <ColumnsList applyId={applyId} />
</div> </div>
{/* 单据作废 */} {/* 单据作废 */}
<Modal title="单据作废" visible={isModalVisible} onCancel={handleCancel} onOk={oninvalid}> <Modal title="单据作废" visible={isModalVisible} onCancel={handleCancel} onOk={Void}>
<Radio.Group onChange={handleIsAllMemberChange} defaultValue={isAllMember} value={isAllMember}> <Radio.Group onChange={handleIsAllMemberChange} defaultValue={isAllMember} value={isAllMember}>
<Radio value={true}>作废</Radio> <Radio value={true}>作废</Radio>
<Radio value={false}>不作废</Radio> <Radio value={false}>不作废</Radio>
......
...@@ -75,14 +75,32 @@ const QueryList = () => { ...@@ -75,14 +75,32 @@ const QueryList = () => {
dataIndex: 'sourceNo', dataIndex: 'sourceNo',
align: 'left', align: 'left',
render: (text, record) => { render: (text, record) => {
let url = '';
if (record.sourceId) {
switch (record.sourceType) {
case 1: {
if (record.turn && record.sourceId) {
url = `/memberCenter/procurementAbility/confirmOffer/offerInquire/preview?id=${record.sourceId}&turn=${record.turn}`
}
break;
};
case 2: {
url = `/memberCenter/procurementAbility/callForBids/callForBidsSearch/detail?id=${record.sourceId}`
break;
};
case 3: {
url = `/memberCenter/procurementAbility/purchaseBid/search/detail?id=${record.sourceId}&number=${record.sourceNo}`
break;
};
}
}
return ( return (
<div> <div>
{ {
text && record.sourceId && text && record.sourceId &&
<EyePreview <EyePreview
type={record.sourceType == 1 ? record.sourceId ? 'link' : "button" : 'link'} type={record.sourceId ? 'link' : "button"}
url={record.sourceType == 1 ? `/memberCenter/procurementAbility/confirmOffer/offerInquire/demand/preview?id=${record.sourceId}&number${record.sourceNo}` : `/memberCenter/procurementAbility/callForBids/callForBidsSearch/detail?id=${record.sourceId}`} url={url}
> >
{text} {text}
</EyePreview> </EyePreview>
...@@ -91,7 +109,6 @@ const QueryList = () => { ...@@ -91,7 +109,6 @@ const QueryList = () => {
</div> </div>
) )
} }
}, },
{ {
title: '外部状态', title: '外部状态',
......
...@@ -16,13 +16,10 @@ import Submit from '@/components/NiceForm/components/Submit' ...@@ -16,13 +16,10 @@ import Submit from '@/components/NiceForm/components/Submit'
import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePickerUnix' import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePickerUnix'
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import { PlayCircleOutlined, PoweroffOutlined } from '@ant-design/icons' import { PlayCircleOutlined, PoweroffOutlined } from '@ant-design/icons'
import ExamineFrom from '../../components/examine'
import moment from 'moment'; import moment from 'moment';
const Examine = () => { const Examine = () => {
const ref = useRef<any>({}); const ref = useRef<any>({});
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]) const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
const [Visible, setIsModalVisible] = useState<boolean>(false)
const [id, setid] = useState("")
const getdate = (time) => { const getdate = (time) => {
return new Date(Date.parse(time.replace(/-/g, "/"))).getTime() / 1000; return new Date(Date.parse(time.replace(/-/g, "/"))).getTime() / 1000;
} }
...@@ -127,13 +124,6 @@ const Examine = () => { ...@@ -127,13 +124,6 @@ const Examine = () => {
) )
} }
}] }]
/* 提交表单 */
const submitExamine = (id) => {
setid(id)
setIsModalVisible(!Visible)
}
// 列表数据 // 列表数据
const fetchData = (params?: any) => { const fetchData = (params?: any) => {
console.log(params)//可以直接打印参数 console.log(params)//可以直接打印参数
...@@ -144,7 +134,9 @@ const Examine = () => { ...@@ -144,7 +134,9 @@ const Examine = () => {
...params, ...params,
}).then(res => { }).then(res => {
resolve(res.data) resolve(res.data)
}) }).catch((err) => {
resolve([]);
});
}) })
} }
...@@ -155,14 +147,7 @@ const Examine = () => { ...@@ -155,14 +147,7 @@ const Examine = () => {
} }
}; };
/* 提交审核的回调 */
const getfetchData = (data) => {
console.log(data)
setIsModalVisible(data.ExamineFlag)
if (data.code === 1000) {
ref.current.reload()
}
}
return ( return (
<PageHeaderWrapper> <PageHeaderWrapper>
<Card> <Card>
...@@ -197,12 +182,7 @@ const Examine = () => { ...@@ -197,12 +182,7 @@ const Examine = () => {
} }
}} }}
/> />
<ExamineFrom
ExamineFlag={Visible}
getfetchData={getfetchData}
applyId={id}
type="ManageSubmitExamine"
/>
</Card> </Card>
</PageHeaderWrapper> </PageHeaderWrapper>
) )
......
...@@ -15,7 +15,7 @@ import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePicke ...@@ -15,7 +15,7 @@ import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePicke
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import { history, Redirect } from 'umi'; import { history, Redirect } from 'umi';
import { PlayCircleOutlined, PoweroffOutlined } from '@ant-design/icons' import { PlayCircleOutlined, PoweroffOutlined } from '@ant-design/icons'
import ExamineFrom from '../../components/examine'
import moment from 'moment'; import moment from 'moment';
...@@ -25,8 +25,6 @@ const Levelexamine = () => { ...@@ -25,8 +25,6 @@ const Levelexamine = () => {
return new Date(Date.parse(time.replace(/-/g, "/"))).getTime() / 1000; return new Date(Date.parse(time.replace(/-/g, "/"))).getTime() / 1000;
} }
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]) const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
const [Visible, setIsModalVisible] = useState<boolean>(false)
const [id, setid] = useState("")
//表头 //表头
const columns: ColumnType<any>[] = [{ const columns: ColumnType<any>[] = [{
title: '合同编号/摘要', title: '合同编号/摘要',
...@@ -129,11 +127,7 @@ const Levelexamine = () => { ...@@ -129,11 +127,7 @@ const Levelexamine = () => {
) )
} }
}] }]
/* 提交表单 */
const submitExamine = (id) => {
setid(id)
setIsModalVisible(!Visible)
}
// 列表数据 // 列表数据
const fetchData = (params?: any) => { const fetchData = (params?: any) => {
console.log(params)//可以直接打印参数 console.log(params)//可以直接打印参数
...@@ -144,7 +138,9 @@ const Levelexamine = () => { ...@@ -144,7 +138,9 @@ const Levelexamine = () => {
...params, ...params,
}).then(res => { }).then(res => {
resolve(res.data) resolve(res.data)
}) }).catch((err) => {
resolve([]);
});
}) })
} }
...@@ -154,14 +150,7 @@ const Levelexamine = () => { ...@@ -154,14 +150,7 @@ const Levelexamine = () => {
setSelectedRowKeys(selectedRowKeys) setSelectedRowKeys(selectedRowKeys)
} }
}; };
/* 提交审核的回调 */
const getfetchData = (data) => {
console.log(data)
setIsModalVisible(data.ExamineFlag)
if (data.code === 1000) {
ref.current.reload()
}
}
return ( return (
<PageHeaderWrapper> <PageHeaderWrapper>
<Card> <Card>
...@@ -197,12 +186,6 @@ const Levelexamine = () => { ...@@ -197,12 +186,6 @@ const Levelexamine = () => {
}} }}
/> />
</Card> </Card>
<ExamineFrom
ExamineFlag={Visible}
getfetchData={getfetchData}
applyId={id}
type="ManageExamineStepOne"
/>
</PageHeaderWrapper> </PageHeaderWrapper>
) )
} }
......
...@@ -136,7 +136,9 @@ const PurchaseList = () => { ...@@ -136,7 +136,9 @@ const PurchaseList = () => {
...params, ...params,
}).then(res => { }).then(res => {
resolve(res.data) resolve(res.data)
}) }).catch((err) => {
resolve([]);
});
}) })
} }
......
...@@ -14,7 +14,6 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte ...@@ -14,7 +14,6 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte
import Submit from '@/components/NiceForm/components/Submit' import Submit from '@/components/NiceForm/components/Submit'
import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePickerUnix' import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePickerUnix'
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import ExamineFrom from '../../components/examine'
import moment from 'moment'; import moment from 'moment';
import { history } from 'umi'; import { history } from 'umi';
...@@ -73,14 +72,32 @@ const Secondaryexamine = () => { ...@@ -73,14 +72,32 @@ const Secondaryexamine = () => {
dataIndex: 'sourceNo', dataIndex: 'sourceNo',
align: 'left', align: 'left',
render: (text, record) => { render: (text, record) => {
let url = '';
if (record.sourceId) {
switch (record.sourceType) {
case 1: {
if (record.turn && record.sourceId) {
url = `/memberCenter/procurementAbility/confirmOffer/offerInquire/preview?id=${record.sourceId}&turn=${record.turn}`
}
break;
};
case 2: {
url = `/memberCenter/procurementAbility/callForBids/callForBidsSearch/detail?id=${record.sourceId}`
break;
};
case 3: {
url = `/memberCenter/procurementAbility/purchaseBid/search/detail?id=${record.sourceId}&number=${record.sourceNo}`
break;
};
}
}
return ( return (
<div> <div>
{ {
text && record.sourceId && text && record.sourceId &&
<EyePreview <EyePreview
type={record.sourceType == 1 ? record.sourceId ? 'link' : "button" : 'link'} type={record.sourceId ? 'link' : "button"}
url={record.sourceType == 1 ? `/memberCenter/procurementAbility/confirmOffer/offerInquire/demand/preview?id=${record.sourceId}&number${record.sourceNo}` : `/memberCenter/procurementAbility/callForBids/callForBidsSearch/detail?id=${record.sourceId}`} url={url}
> >
{text} {text}
</EyePreview> </EyePreview>
...@@ -126,11 +143,6 @@ const Secondaryexamine = () => { ...@@ -126,11 +143,6 @@ const Secondaryexamine = () => {
} }
}] }]
/* 提交表单 */
const submitExamine = (id) => {
setid(id)
setIsModalVisible(!Visible)
}
// 列表数据 // 列表数据
const fetchData = (params?: any) => { const fetchData = (params?: any) => {
console.log(params)//可以直接打印参数 console.log(params)//可以直接打印参数
...@@ -141,7 +153,9 @@ const Secondaryexamine = () => { ...@@ -141,7 +153,9 @@ const Secondaryexamine = () => {
...params, ...params,
}).then(res => { }).then(res => {
resolve(res.data) resolve(res.data)
}) }).catch((err) => {
resolve([]);
});
}) })
} }
...@@ -151,14 +165,7 @@ const Secondaryexamine = () => { ...@@ -151,14 +165,7 @@ const Secondaryexamine = () => {
setSelectedRowKeys(selectedRowKeys) setSelectedRowKeys(selectedRowKeys)
} }
}; };
/* 提交审核的回调 */
const getfetchData = (data) => {
console.log(data)
setIsModalVisible(data.ExamineFlag)
if (data.code === 1000) {
ref.current.reload()
}
}
return ( return (
<PageHeaderWrapper> <PageHeaderWrapper>
<Card> <Card>
...@@ -194,12 +201,6 @@ const Secondaryexamine = () => { ...@@ -194,12 +201,6 @@ const Secondaryexamine = () => {
}} }}
/> />
</Card> </Card>
<ExamineFrom
ExamineFlag={Visible}
getfetchData={getfetchData}
applyId={id}
type="PageToBeExamineStepTwo"
/>
</PageHeaderWrapper> </PageHeaderWrapper>
) )
} }
......
...@@ -143,7 +143,6 @@ const Signacontract = () => { ...@@ -143,7 +143,6 @@ const Signacontract = () => {
// 列表数据 // 列表数据
const fetchData = (params?: any) => { const fetchData = (params?: any) => {
console.log(params)//可以直接打印参数
params.startTime = params.startTime ? moment(Number(params.startTime)).format('YYYY-MM-DD') : ''; params.startTime = params.startTime ? moment(Number(params.startTime)).format('YYYY-MM-DD') : '';
params.endTime = params.endTime ? moment(Number(params.endTime)).format('YYYY-MM-DD') : ''; params.endTime = params.endTime ? moment(Number(params.endTime)).format('YYYY-MM-DD') : '';
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
...@@ -151,7 +150,9 @@ const Signacontract = () => { ...@@ -151,7 +150,9 @@ const Signacontract = () => {
...params, ...params,
}).then(res => { }).then(res => {
resolve(res.data) resolve(res.data)
}) }).catch(() => {
reject();
});
}) })
} }
// 多选操作 // 多选操作
......
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