Commit 7a463d8f authored by alwayOnlie's avatar alwayOnlie

优化代码

parent 157e4c6d
......@@ -51,10 +51,6 @@ const Add: React.FC<{}> = (props: any) => {
]
const submit = async () => {
let msg = message.loading({
content: '正在操作',
duration: 0,
});
setLoading(true);
if (!Loading) {
const basicsVO = await currentBasic.current.get();
......@@ -66,14 +62,16 @@ const Add: React.FC<{}> = (props: any) => {
}
PublicApi.postContractApplyAmountSave(data).then(res => {
console.log(res);
setLoading(false);
if (res.code === 1000) {
history.push('/memberCenter/contract/funds/addbill')
}
}).finally(() => {
msg();
}).catch((err) => {
// resolve([]);
});
setTimeout(() => {
setLoading(false);
}, 2000)
}
}
......
......@@ -461,7 +461,7 @@ const AddInfo = (props: any) => {
<Drawer
visible={visible}
onClose={() => setvisible(!visible)}
title="选择待请款单据"
title="选择采购合同"
width={1000}
footer={
<div
......
......@@ -340,7 +340,7 @@ const table = (props: any) => {
<Drawer
visible={visible}
onClose={() => setvisible(!visible)}
title="选择采购合同"
title="选择待请款单据"
width={1000}
footer={
<div
......
......@@ -14,18 +14,14 @@ import SearchSelect from '@/components/NiceForm/components/SearchSelect'
import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePickerUnix'
import moment from 'moment';
import "../../constants/index.less"
import { history, Redirect } from 'umi';
const { TextArea } = Input;
const Bill: React.FC<{}> = () => {
const ref = useRef<any>({});
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
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>[] = [{
title: '请款单号/摘要',
......@@ -101,24 +97,26 @@ const Bill: React.FC<{}> = () => {
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 (
<>
{
// 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) => {
console.log(params)//可以直接打印参数
......@@ -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 (
<PageHeaderWrapper>
<Card>
......@@ -217,14 +185,7 @@ const Bill: React.FC<{}> = () => {
}}
/>
</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>
)
......
......@@ -106,11 +106,15 @@ const BillDetails = (props: any) => {
}
/* 显示审核弹出 */
const submitExaminefunds = () => {
if (type == 'pageDetailList') {
setIsModalVisible(!isModalVisible);
return
}
if (type == 'submitExamine') {
const msg = message.loading({
content: '正在操作',
duration: 0,
});
if (type == 'submitExamine') {
PublicApi.postContractApplyAmountSubmitExamine({ applyId }).then(res => {
if (res.code === 1000) {
setTimeout(() => {
......@@ -120,7 +124,12 @@ const BillDetails = (props: any) => {
}).finally(() => {
msg();
});
} else if (type == 'PageToBeSubmit') {
} if (type == 'pageToBeSubmit') {
console.log('type')
const msg = message.loading({
content: '正在操作',
duration: 0,
});
PublicApi.postContractApplyAmountSubmit({ applyId }).then(res => {
if (res.code === 1000) {
setTimeout(() => {
......@@ -130,12 +139,13 @@ const BillDetails = (props: any) => {
}).finally(() => {
msg();
});
return;
} else {
setExamineFlag(true)
}
}
/* 作废 */
const oninvalid = () => {
const Void = () => {
let res_data: any = {
applyId,
reason,
......@@ -148,6 +158,9 @@ const BillDetails = (props: any) => {
PublicApi.postContractApplyAmountInvalid(res_data).then(res => {
if (res.code === 1000) {
handleCancel()
setTimeout(() => {
history.goBack();
}, 2000);
}
}).finally(() => {
msg();
......@@ -266,7 +279,7 @@ const BillDetails = (props: any) => {
<ColumnsList applyId={applyId} />
</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 value={true}>作废</Radio>
<Radio value={false}>不作废</Radio>
......
......@@ -75,14 +75,32 @@ const QueryList = () => {
dataIndex: 'sourceNo',
align: 'left',
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 (
<div>
{
text && record.sourceId &&
<EyePreview
type={record.sourceType == 1 ? record.sourceId ? 'link' : "button" : 'link'}
url={record.sourceType == 1 ? `/memberCenter/procurementAbility/confirmOffer/offerInquire/demand/preview?id=${record.sourceId}&number${record.sourceNo}` : `/memberCenter/procurementAbility/callForBids/callForBidsSearch/detail?id=${record.sourceId}`}
type={record.sourceId ? 'link' : "button"}
url={url}
>
{text}
</EyePreview>
......@@ -91,7 +109,6 @@ const QueryList = () => {
</div>
)
}
},
{
title: '外部状态',
......
......@@ -16,13 +16,10 @@ import Submit from '@/components/NiceForm/components/Submit'
import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePickerUnix'
import { PublicApi } from '@/services/api';
import { PlayCircleOutlined, PoweroffOutlined } from '@ant-design/icons'
import ExamineFrom from '../../components/examine'
import moment from 'moment';
const Examine = () => {
const ref = useRef<any>({});
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
const [Visible, setIsModalVisible] = useState<boolean>(false)
const [id, setid] = useState("")
const getdate = (time) => {
return new Date(Date.parse(time.replace(/-/g, "/"))).getTime() / 1000;
}
......@@ -127,13 +124,6 @@ const Examine = () => {
)
}
}]
/* 提交表单 */
const submitExamine = (id) => {
setid(id)
setIsModalVisible(!Visible)
}
// 列表数据
const fetchData = (params?: any) => {
console.log(params)//可以直接打印参数
......@@ -144,7 +134,9 @@ const Examine = () => {
...params,
}).then(res => {
resolve(res.data)
})
}).catch((err) => {
resolve([]);
});
})
}
......@@ -155,14 +147,7 @@ const Examine = () => {
}
};
/* 提交审核的回调 */
const getfetchData = (data) => {
console.log(data)
setIsModalVisible(data.ExamineFlag)
if (data.code === 1000) {
ref.current.reload()
}
}
return (
<PageHeaderWrapper>
<Card>
......@@ -197,12 +182,7 @@ const Examine = () => {
}
}}
/>
<ExamineFrom
ExamineFlag={Visible}
getfetchData={getfetchData}
applyId={id}
type="ManageSubmitExamine"
/>
</Card>
</PageHeaderWrapper>
)
......
......@@ -15,7 +15,7 @@ import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePicke
import { PublicApi } from '@/services/api';
import { history, Redirect } from 'umi';
import { PlayCircleOutlined, PoweroffOutlined } from '@ant-design/icons'
import ExamineFrom from '../../components/examine'
import moment from 'moment';
......@@ -25,8 +25,6 @@ const Levelexamine = () => {
return new Date(Date.parse(time.replace(/-/g, "/"))).getTime() / 1000;
}
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
const [Visible, setIsModalVisible] = useState<boolean>(false)
const [id, setid] = useState("")
//表头
const columns: ColumnType<any>[] = [{
title: '合同编号/摘要',
......@@ -129,11 +127,7 @@ const Levelexamine = () => {
)
}
}]
/* 提交表单 */
const submitExamine = (id) => {
setid(id)
setIsModalVisible(!Visible)
}
// 列表数据
const fetchData = (params?: any) => {
console.log(params)//可以直接打印参数
......@@ -144,7 +138,9 @@ const Levelexamine = () => {
...params,
}).then(res => {
resolve(res.data)
})
}).catch((err) => {
resolve([]);
});
})
}
......@@ -154,14 +150,7 @@ const Levelexamine = () => {
setSelectedRowKeys(selectedRowKeys)
}
};
/* 提交审核的回调 */
const getfetchData = (data) => {
console.log(data)
setIsModalVisible(data.ExamineFlag)
if (data.code === 1000) {
ref.current.reload()
}
}
return (
<PageHeaderWrapper>
<Card>
......@@ -197,12 +186,6 @@ const Levelexamine = () => {
}}
/>
</Card>
<ExamineFrom
ExamineFlag={Visible}
getfetchData={getfetchData}
applyId={id}
type="ManageExamineStepOne"
/>
</PageHeaderWrapper>
)
}
......
......@@ -136,7 +136,9 @@ const PurchaseList = () => {
...params,
}).then(res => {
resolve(res.data)
})
}).catch((err) => {
resolve([]);
});
})
}
......
......@@ -14,7 +14,6 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte
import Submit from '@/components/NiceForm/components/Submit'
import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePickerUnix'
import { PublicApi } from '@/services/api';
import ExamineFrom from '../../components/examine'
import moment from 'moment';
import { history } from 'umi';
......@@ -73,14 +72,32 @@ const Secondaryexamine = () => {
dataIndex: 'sourceNo',
align: 'left',
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 (
<div>
{
text && record.sourceId &&
<EyePreview
type={record.sourceType == 1 ? record.sourceId ? 'link' : "button" : 'link'}
url={record.sourceType == 1 ? `/memberCenter/procurementAbility/confirmOffer/offerInquire/demand/preview?id=${record.sourceId}&number${record.sourceNo}` : `/memberCenter/procurementAbility/callForBids/callForBidsSearch/detail?id=${record.sourceId}`}
type={record.sourceId ? 'link' : "button"}
url={url}
>
{text}
</EyePreview>
......@@ -126,11 +143,6 @@ const Secondaryexamine = () => {
}
}]
/* 提交表单 */
const submitExamine = (id) => {
setid(id)
setIsModalVisible(!Visible)
}
// 列表数据
const fetchData = (params?: any) => {
console.log(params)//可以直接打印参数
......@@ -141,7 +153,9 @@ const Secondaryexamine = () => {
...params,
}).then(res => {
resolve(res.data)
})
}).catch((err) => {
resolve([]);
});
})
}
......@@ -151,14 +165,7 @@ const Secondaryexamine = () => {
setSelectedRowKeys(selectedRowKeys)
}
};
/* 提交审核的回调 */
const getfetchData = (data) => {
console.log(data)
setIsModalVisible(data.ExamineFlag)
if (data.code === 1000) {
ref.current.reload()
}
}
return (
<PageHeaderWrapper>
<Card>
......@@ -194,12 +201,6 @@ const Secondaryexamine = () => {
}}
/>
</Card>
<ExamineFrom
ExamineFlag={Visible}
getfetchData={getfetchData}
applyId={id}
type="PageToBeExamineStepTwo"
/>
</PageHeaderWrapper>
)
}
......
......@@ -143,7 +143,6 @@ const Signacontract = () => {
// 列表数据
const fetchData = (params?: any) => {
console.log(params)//可以直接打印参数
params.startTime = params.startTime ? moment(Number(params.startTime)).format('YYYY-MM-DD') : '';
params.endTime = params.endTime ? moment(Number(params.endTime)).format('YYYY-MM-DD') : '';
return new Promise((resolve, reject) => {
......@@ -151,7 +150,9 @@ const Signacontract = () => {
...params,
}).then(res => {
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