Merge remote-tracking branch 'origin/master'
This commit is contained in:
@ -178,8 +178,8 @@
|
||||
.myselfContent .ant-menu-submenu-title {
|
||||
padding-right: 34px;
|
||||
text-align: center;
|
||||
color: #b30000;
|
||||
border-top: 2px solid #b30000;
|
||||
color: @primary-color;
|
||||
border-top: 2px solid @primary-color;
|
||||
//background: #b30000;
|
||||
}
|
||||
.myselfContent .ant-menu-submenu-title i {
|
||||
|
@ -23,9 +23,9 @@
|
||||
text-align: center;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
.ant-menu-item:hover{
|
||||
background-color: rgb(247, 221, 217);
|
||||
}
|
||||
// .ant-menu-item:hover{
|
||||
// background-color: rgb(247, 221, 217);
|
||||
// }
|
||||
}
|
||||
.xsy-menu-style::-webkit-scrollbar {
|
||||
width:0px;
|
||||
|
122
src/pages/BidEvaluation/components/SupplementFileUpload.tsx
Normal file
122
src/pages/BidEvaluation/components/SupplementFileUpload.tsx
Normal file
@ -0,0 +1,122 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Modal, Form, Spin, message } from 'antd';
|
||||
import ExtendUpload from '@/utils/ExtendUpload';
|
||||
import { saveSupplementFile } from '../../../services/bidev';
|
||||
|
||||
// 支持的文件格式
|
||||
const SUPPORTED_FILE_TYPES = {
|
||||
'zip': ['.zip'],
|
||||
'rar': ['.rar'],
|
||||
'pdf': ['.pdf'],
|
||||
'word': ['.doc', '.docx'],
|
||||
'excel': ['.xls', '.xlsx']
|
||||
};
|
||||
|
||||
const ACCEPT_TYPES = '.zip,.rar,.pdf,.doc,.docx,.xls,.xlsx';
|
||||
|
||||
// 文件格式验证函数
|
||||
const validateFileFormat = (file: File): boolean => {
|
||||
const fileName = file.name.toLowerCase();
|
||||
const fileExtension = fileName.substring(fileName.lastIndexOf('.'));
|
||||
const supportedExtensions = Object.values(SUPPORTED_FILE_TYPES).flat();
|
||||
return supportedExtensions.includes(fileExtension);
|
||||
};
|
||||
|
||||
interface SupplementFileUploadProps {
|
||||
modalVisible: boolean;
|
||||
onCancel: (fileId?: string) => void;
|
||||
onOk: (fileId: string) => void;
|
||||
fileId?: string;
|
||||
readOnly?: boolean;
|
||||
recordData?: any;
|
||||
}
|
||||
|
||||
const layout = {
|
||||
labelCol: { span: 4 },
|
||||
wrapperCol: { span: 20 },
|
||||
};
|
||||
|
||||
const modalHeight = window.innerHeight * 96 / 100;
|
||||
|
||||
/**
|
||||
* 补充评审文件上传组件
|
||||
* @param props
|
||||
* @returns
|
||||
*/
|
||||
const SupplementFileUpload: React.FC<SupplementFileUploadProps> = (props) => {
|
||||
const { modalVisible, onCancel, onOk, fileId, readOnly, recordData } = props;
|
||||
const [form] = Form.useForm();
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const handleOk = async () => {
|
||||
const annexId = form.getFieldValue('annexId');
|
||||
const finalFileId = annexId || fileId || '';
|
||||
|
||||
if (!readOnly && !finalFileId) {
|
||||
message.warning('请先上传文件');
|
||||
return;
|
||||
}
|
||||
|
||||
setLoading(true);
|
||||
try {
|
||||
const params = {
|
||||
id: recordData?.id,
|
||||
supplementReviewFile: finalFileId,
|
||||
};
|
||||
|
||||
const res = await saveSupplementFile(params);
|
||||
if (res.code === 200 && res.success) {
|
||||
message.success('补充评审文件保存成功');
|
||||
onOk(finalFileId);
|
||||
} else {
|
||||
message.error(res.message || '保存失败');
|
||||
}
|
||||
} catch (error) {
|
||||
message.error('保存失败,请重试');
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
const annexId = form.getFieldValue('annexId');
|
||||
onCancel(annexId);
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal
|
||||
destroyOnClose
|
||||
title={`${readOnly ? '查看' : '上传'}补充评审文件`}
|
||||
visible={modalVisible}
|
||||
onCancel={handleCancel}
|
||||
onOk={readOnly ? undefined : handleOk}
|
||||
okText={readOnly ? undefined : "保存"}
|
||||
cancelText="返回"
|
||||
okButtonProps={{ hidden: readOnly }}
|
||||
style={{ maxHeight: modalHeight }}
|
||||
bodyStyle={{ maxHeight: modalHeight - 107, overflowY: 'auto' }}
|
||||
centered
|
||||
>
|
||||
<Spin spinning={loading}>
|
||||
<Form name="supplement-file-form" {...layout} form={form}>
|
||||
<Form.Item
|
||||
name="annexId"
|
||||
label="附件"
|
||||
extra={readOnly ? null : '支持zip、rar、PDF、Word、Excel格式文件,每个文件最大30MB,限制上传1个文件'}
|
||||
>
|
||||
<ExtendUpload
|
||||
bid={fileId}
|
||||
btnName="上传"
|
||||
maxSize={30}
|
||||
maxCount={1}
|
||||
formatValidator={validateFileFormat}
|
||||
uploadProps={{ name: "file", disabled: readOnly, accept: ACCEPT_TYPES }}
|
||||
/>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Spin>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
export default SupplementFileUpload;
|
@ -171,8 +171,8 @@ const Index: React.FC<{}> = () => {
|
||||
} else {
|
||||
if (record.tdocId) {
|
||||
return (
|
||||
// <Button type="link" danger onClick={() => lookFile(record.detailId, record.supplierRegisterId)}>查看</Button>
|
||||
<Button type="link" danger onClick={() => window.open("/viewOfTenderDocumentsSecond?id=" + record.tdocId + "&supplierId=" + record.supplierRegisterId + "&offerType=1")}>查看</Button>
|
||||
// <Button type="link" onClick={() => lookFile(record.detailId, record.supplierRegisterId)}>查看</Button>
|
||||
<Button type="link" onClick={() => window.open("/viewOfTenderDocumentsSecond?id=" + record.tdocId + "&supplierId=" + record.supplierRegisterId + "&offerType=1")}>查看</Button>
|
||||
)
|
||||
} else {
|
||||
return (
|
||||
@ -835,6 +835,16 @@ const Index: React.FC<{}> = () => {
|
||||
setCurrent(page)
|
||||
let currentDate = (page - 1) * 3
|
||||
let newColumns = [...columns];
|
||||
|
||||
// 辅助函数:优先获取scoreMap,如果不存在则获取managerScoreMap
|
||||
const getScoreData = (record: any, supplierRegisterId: string) => {
|
||||
if (record.scoreMap && record.scoreMap[supplierRegisterId]) {
|
||||
return { data: record.scoreMap[supplierRegisterId], hasData: true };
|
||||
} else if (record.managerScoreMap && record.managerScoreMap[supplierRegisterId]) {
|
||||
return { data: record.managerScoreMap[supplierRegisterId], hasData: true };
|
||||
}
|
||||
return { data: null, hasData: false };
|
||||
};
|
||||
totalSupplierColumns.slice(currentDate, currentDate + 3).map((item: any) => {
|
||||
supplierId.push(item.supplierRegisterId)
|
||||
newColumns.push({
|
||||
@ -847,17 +857,18 @@ const Index: React.FC<{}> = () => {
|
||||
record.standardList.map((item: any) => {
|
||||
radioOptions.push({ label: item.standardName + '(' + item.standardDetailScore + '分)', value: item.standardDetailScore + '-' + item.id })
|
||||
})
|
||||
if (record.scoreMap && record.scoreMap[item.supplierRegisterId]) {
|
||||
const scoreResult = getScoreData(record, item.supplierRegisterId);
|
||||
if (scoreResult.hasData) {
|
||||
return (
|
||||
<div>
|
||||
<Radio.Group
|
||||
disabled={disabled || endProgress}
|
||||
value={record.scoreMap[item.supplierRegisterId].resultValue + '-' + record.scoreMap[item.supplierRegisterId].standardId}
|
||||
value={scoreResult.data.resultValue + '-' + scoreResult.data.standardId}
|
||||
options={radioOptions}
|
||||
onChange={e => onChange(e, record.scoreMap[item.supplierRegisterId], item.supplierRegisterId)}
|
||||
onChange={e => onChange(e, scoreResult.data, item.supplierRegisterId)}
|
||||
/><br />
|
||||
<Button onClick={() => getRemark(record.scoreMap[item.supplierRegisterId], item.supplierRegisterId)} type="link" danger>备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" danger onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
<Button onClick={() => getRemark(scoreResult.data, item.supplierRegisterId)} type="link">备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
</div>
|
||||
)
|
||||
} else {
|
||||
@ -869,8 +880,8 @@ const Index: React.FC<{}> = () => {
|
||||
options={radioOptions}
|
||||
onChange={e => onChange(e, record, item.supplierRegisterId)}
|
||||
/><br />
|
||||
<Button onClick={() => getRemark(record, item.supplierRegisterId)} type="link" danger>备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" danger onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
<Button onClick={() => getRemark(record, item.supplierRegisterId)} type="link">备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -879,8 +890,9 @@ const Index: React.FC<{}> = () => {
|
||||
record.standardList.map((item: any) => {
|
||||
checkboxOptions.push({ label: item.standardName + '(' + item.standardDetailScore + '分)', value: item.standardDetailScore + '-' + item.id })
|
||||
})
|
||||
if (record?.scoreMap && record?.scoreMap[item.supplierRegisterId] && (record?.scoreMap[item.supplierRegisterId]?.standardId || record?.scoreMap[item.supplierRegisterId]?.id)) {
|
||||
let defaultArr = record.scoreMap[item.supplierRegisterId].standardId.split(",")
|
||||
const scoreResult = getScoreData(record, item.supplierRegisterId);
|
||||
if (scoreResult.hasData && (scoreResult.data?.standardId || scoreResult.data?.id)) {
|
||||
let defaultArr = scoreResult.data.standardId.split(",")
|
||||
let defaultValue: any = []
|
||||
record.standardList.map((item: any) => {
|
||||
defaultArr.map((val: any) => {
|
||||
@ -896,10 +908,10 @@ const Index: React.FC<{}> = () => {
|
||||
disabled={disabled || endProgress}
|
||||
options={checkboxOptions}
|
||||
value={defaultValue}
|
||||
onChange={e => checkChange(e, record.scoreMap[item.supplierRegisterId], item.supplierRegisterId)}
|
||||
onChange={e => checkChange(e, scoreResult.data, item.supplierRegisterId)}
|
||||
/><br />
|
||||
<Button type="link" danger onClick={() => getRemark(record.scoreMap[item.supplierRegisterId], item.supplierRegisterId)}>备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" danger onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
<Button type="link" onClick={() => getRemark(scoreResult.data, item.supplierRegisterId)}>备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
</div>
|
||||
)
|
||||
} else {
|
||||
@ -912,27 +924,28 @@ const Index: React.FC<{}> = () => {
|
||||
value={[]}
|
||||
onChange={e => checkChange(e, record, item.supplierRegisterId)}
|
||||
/><br />
|
||||
<Button type="link" danger onClick={() => getRemark(record, item.supplierRegisterId)}>备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" danger onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
<Button type="link" onClick={() => getRemark(record, item.supplierRegisterId)}>备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
} else if (record.scoreMethod == '2') { // 人工
|
||||
if (record.scoreMap && record.scoreMap[item.supplierRegisterId]) {
|
||||
const scoreResult = getScoreData(record, item.supplierRegisterId);
|
||||
if (scoreResult.hasData) {
|
||||
return (
|
||||
<div>
|
||||
<Tooltip trigger={['focus']} title={<span>评分区间:{record.lowScore}分~{record.highScore}分</span>} placement="topLeft">
|
||||
<Input
|
||||
disabled={disabled || endProgress}
|
||||
min={1} max={record.highScore}
|
||||
value={record.scoreMap[item.supplierRegisterId].resultValue}
|
||||
value={scoreResult.data.resultValue}
|
||||
style={{ width: 160 }}
|
||||
onChange={e => inputChange(e, record.scoreMap[item.supplierRegisterId], item.supplierRegisterId, record.highScore, record.lowScore)}
|
||||
onChange={e => inputChange(e, scoreResult.data, item.supplierRegisterId, record.highScore, record.lowScore)}
|
||||
/>
|
||||
</Tooltip>
|
||||
<br />
|
||||
<Button type="link" danger onClick={() => getRemark(record.scoreMap[item.supplierRegisterId], item.supplierRegisterId)}>备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" danger onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
<Button type="link" onClick={() => getRemark(scoreResult.data, item.supplierRegisterId)}>备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
</div>
|
||||
)
|
||||
} else {
|
||||
@ -942,8 +955,8 @@ const Index: React.FC<{}> = () => {
|
||||
<Input disabled={disabled || endProgress} min={1} max={record.highScore} onChange={e => inputChange(e, record, item.supplierRegisterId, record.highScore, record.lowScore)} style={{ width: 160 }} />
|
||||
</Tooltip>
|
||||
<br />
|
||||
<Button type="link" danger onClick={() => getRemark(record, item.supplierRegisterId)}>备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" danger onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
<Button type="link" onClick={() => getRemark(record, item.supplierRegisterId)}>备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -953,14 +966,15 @@ const Index: React.FC<{}> = () => {
|
||||
for (let i = 1; i <= optionLength; i++) {
|
||||
optionArr.push(record.lowScore * i)
|
||||
}
|
||||
if (record.scoreMap && record.scoreMap[item.supplierRegisterId]) {
|
||||
const scoreResult = getScoreData(record, item.supplierRegisterId);
|
||||
if (scoreResult.hasData) {
|
||||
return (
|
||||
<div>
|
||||
<Select
|
||||
disabled={disabled || endProgress}
|
||||
value={record.scoreMap[item.supplierRegisterId].resultValue}
|
||||
value={scoreResult.data.resultValue}
|
||||
style={{ width: 160 }}
|
||||
onChange={e => handleChange(e, record.scoreMap[item.supplierRegisterId], item.supplierRegisterId)}
|
||||
onChange={e => handleChange(e, scoreResult.data, item.supplierRegisterId)}
|
||||
>
|
||||
{
|
||||
optionArr.map((item: any) => {
|
||||
@ -970,8 +984,8 @@ const Index: React.FC<{}> = () => {
|
||||
})
|
||||
}
|
||||
</Select><br />
|
||||
<Button type="link" danger onClick={() => getRemark(record.scoreMap[item.supplierRegisterId], item.supplierRegisterId)}>备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" danger onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
<Button type="link" onClick={() => getRemark(scoreResult.data, item.supplierRegisterId)}>备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
|
||||
</div>
|
||||
)
|
||||
@ -987,8 +1001,8 @@ const Index: React.FC<{}> = () => {
|
||||
})
|
||||
}
|
||||
</Select><br />
|
||||
<Button type="link" danger onClick={() => getRemark(record, item.supplierRegisterId)}>备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" danger onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
<Button type="link" onClick={() => getRemark(record, item.supplierRegisterId)}>备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -1513,12 +1527,12 @@ const Index: React.FC<{}> = () => {
|
||||
isDisabledOffer || isEndProgress ? null :
|
||||
<div>
|
||||
<Space>
|
||||
<Button onClick={setQuotation} type="primary" danger>确定</Button>
|
||||
<Button onClick={setQuotation} type="primary">确定</Button>
|
||||
{
|
||||
smallPrice ? <Button onClick={saveOfferSorce} type="primary" danger>保存</Button> : null
|
||||
smallPrice ? <Button onClick={saveOfferSorce} type="primary">保存</Button> : null
|
||||
}
|
||||
{
|
||||
smallPrice ? <Button onClick={submit} type="primary" danger>提交</Button> : null
|
||||
smallPrice ? <Button onClick={submit} type="primary">提交</Button> : null
|
||||
}
|
||||
</Space>
|
||||
</div>
|
||||
|
@ -207,7 +207,7 @@ const Index: React.FC<{}> = () => {
|
||||
} else {
|
||||
if (record.tdocId) {
|
||||
return (
|
||||
<Button type="link" danger onClick={() => window.open("/viewOfTenderDocumentsSecond?id=" + record.tdocId + "&supplierId=" + record.supplierRegisterId + "&offerType=1")}>查看</Button>
|
||||
<Button type="link" onClick={() => window.open("/viewOfTenderDocumentsSecond?id=" + record.tdocId + "&supplierId=" + record.supplierRegisterId + "&offerType=1")}>查看</Button>
|
||||
)
|
||||
} else {
|
||||
return (
|
||||
@ -875,6 +875,17 @@ const Index: React.FC<{}> = () => {
|
||||
setCurrent(page)
|
||||
let currentDate = (page - 1) * 3
|
||||
let newColumns = [...columns];
|
||||
|
||||
// 辅助函数:优先获取scoreMap,如果不存在则获取managerScoreMap
|
||||
const getScoreData = (record: any, supplierRegisterId: string) => {
|
||||
if (record.scoreMap && record.scoreMap[supplierRegisterId]) {
|
||||
return { data: record.scoreMap[supplierRegisterId], hasData: true };
|
||||
} else if (record.managerScoreMap && record.managerScoreMap[supplierRegisterId]) {
|
||||
return { data: record.managerScoreMap[supplierRegisterId], hasData: true };
|
||||
}
|
||||
return { data: null, hasData: false };
|
||||
};
|
||||
|
||||
totalSupplierColumns.slice(currentDate, currentDate + 3).map((item: any) => {
|
||||
supplierId.push(item.supplierRegisterId)
|
||||
newColumns.push({
|
||||
@ -887,17 +898,18 @@ const Index: React.FC<{}> = () => {
|
||||
record?.standardList?.map((item: any) => {
|
||||
radioOptions.push({ label: item.standardName + '(' + item.standardDetailScore + '分)', value: item.standardDetailScore + '-' + item.id })
|
||||
})
|
||||
if (record.scoreMap && record.scoreMap[item.supplierRegisterId]) {
|
||||
const scoreResult = getScoreData(record, item.supplierRegisterId);
|
||||
if (scoreResult.hasData) {
|
||||
return (
|
||||
<div>
|
||||
<Radio.Group
|
||||
disabled={disabled || endProgress}
|
||||
value={record.scoreMap[item.supplierRegisterId].resultValue + '-' + record.scoreMap[item.supplierRegisterId].standardId}
|
||||
value={scoreResult.data.resultValue + '-' + scoreResult.data.standardId}
|
||||
options={radioOptions}
|
||||
onChange={e => onChange(e, record.scoreMap[item.supplierRegisterId], item.supplierRegisterId)}
|
||||
onChange={e => onChange(e, scoreResult.data, item.supplierRegisterId)}
|
||||
/><br />
|
||||
<Button onClick={() => getRemark(record.scoreMap[item.supplierRegisterId], item.supplierRegisterId)} type="link" danger>备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" danger onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
<Button onClick={() => getRemark(scoreResult.data, item.supplierRegisterId)} type="link">备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
</div>
|
||||
)
|
||||
} else {
|
||||
@ -909,8 +921,8 @@ const Index: React.FC<{}> = () => {
|
||||
options={radioOptions}
|
||||
onChange={e => onChange(e, record, item.supplierRegisterId)}
|
||||
/><br />
|
||||
<Button onClick={() => getRemark(record, item.supplierRegisterId)} type="link" danger>备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" danger onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
<Button onClick={() => getRemark(record, item.supplierRegisterId)} type="link">备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -919,8 +931,9 @@ const Index: React.FC<{}> = () => {
|
||||
record?.standardList?.map((item: any) => {
|
||||
checkboxOptions.push({ label: item.standardName + '(' + item.standardDetailScore + '分)', value: item.standardDetailScore + '-' + item.id })
|
||||
})
|
||||
if (record?.scoreMap && record?.scoreMap[item.supplierRegisterId] && (record?.scoreMap[item.supplierRegisterId]?.standardId || record?.scoreMap[item.supplierRegisterId]?.id)) {
|
||||
let defaultArr = record.scoreMap[item.supplierRegisterId].standardId.split(",")
|
||||
const scoreResult = getScoreData(record, item.supplierRegisterId);
|
||||
if (scoreResult.hasData && (scoreResult.data?.standardId || scoreResult.data?.id)) {
|
||||
let defaultArr = scoreResult.data.standardId.split(",")
|
||||
let defaultValue: any = []
|
||||
record?.standardList?.map((item: any) => {
|
||||
defaultArr.map((val: any) => {
|
||||
@ -936,10 +949,10 @@ const Index: React.FC<{}> = () => {
|
||||
disabled={disabled || endProgress}
|
||||
options={checkboxOptions}
|
||||
value={defaultValue}
|
||||
onChange={e => checkChange(e, record.scoreMap[item.supplierRegisterId], item.supplierRegisterId)}
|
||||
onChange={e => checkChange(e, scoreResult.data, item.supplierRegisterId)}
|
||||
/><br />
|
||||
<Button type="link" danger onClick={() => getRemark(record.scoreMap[item.supplierRegisterId], item.supplierRegisterId)}>备注</Button>
|
||||
<Button type="link" danger onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
<Button type="link" onClick={() => getRemark(scoreResult.data, item.supplierRegisterId)}>备注</Button>
|
||||
<Button type="link" onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
</div>
|
||||
)
|
||||
} else {
|
||||
@ -952,27 +965,28 @@ const Index: React.FC<{}> = () => {
|
||||
value={[]}
|
||||
onChange={e => checkChange(e, record, item.supplierRegisterId)}
|
||||
/><br />
|
||||
<Button type="link" danger onClick={() => getRemark(record, item.supplierRegisterId)}>备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" danger onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
<Button type="link" onClick={() => getRemark(record, item.supplierRegisterId)}>备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
} else if (record.scoreMethod == '2') { // 人工
|
||||
if (record.scoreMap && record.scoreMap[item.supplierRegisterId]) {
|
||||
const scoreResult = getScoreData(record, item.supplierRegisterId);
|
||||
if (scoreResult.hasData) {
|
||||
return (
|
||||
<div>
|
||||
<Tooltip trigger={['focus']} title={<span>评分区间:{record.lowScore}分~{record.highScore}分</span>} placement="topLeft">
|
||||
<Input
|
||||
disabled={disabled || endProgress}
|
||||
value={record.scoreMap[item.supplierRegisterId].resultValue}
|
||||
value={scoreResult.data.resultValue}
|
||||
style={{ width: 160 }}
|
||||
onChange={e => inputChange(e, record.scoreMap[item.supplierRegisterId], item.supplierRegisterId, record.highScore, record.lowScore)}
|
||||
onChange={e => inputChange(e, scoreResult.data, item.supplierRegisterId, record.highScore, record.lowScore)}
|
||||
// onFocus={e => inputFocus(e, record.scoreMap[item.supplierRegisterId], item.supplierRegisterId)}
|
||||
/>
|
||||
</Tooltip>
|
||||
<br />
|
||||
<Button type="link" danger onClick={() => getRemark(record.scoreMap[item.supplierRegisterId], item.supplierRegisterId)}>备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" danger onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
<Button type="link" onClick={() => getRemark(scoreResult.data, item.supplierRegisterId)}>备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
</div>
|
||||
)
|
||||
} else {
|
||||
@ -982,8 +996,8 @@ const Index: React.FC<{}> = () => {
|
||||
<Input disabled={disabled || endProgress} onChange={e => inputChange(e, record, item.supplierRegisterId, record.highScore, record.lowScore)} style={{ width: 160 }} />
|
||||
</Tooltip>
|
||||
<br />
|
||||
<Button type="link" danger onClick={() => getRemark(record, item.supplierRegisterId)}>备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" danger onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
<Button type="link" onClick={() => getRemark(record, item.supplierRegisterId)}>备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -993,14 +1007,15 @@ const Index: React.FC<{}> = () => {
|
||||
for (let i = 1; i <= optionLength; i++) {
|
||||
optionArr.push(record.lowScore * i)
|
||||
}
|
||||
if (record.scoreMap && record.scoreMap[item.supplierRegisterId]) {
|
||||
const scoreResult = getScoreData(record, item.supplierRegisterId);
|
||||
if (scoreResult.hasData) {
|
||||
return (
|
||||
<div>
|
||||
<Select
|
||||
disabled={disabled || endProgress}
|
||||
value={record.scoreMap[item.supplierRegisterId].resultValue}
|
||||
value={scoreResult.data.resultValue}
|
||||
style={{ width: 160 }}
|
||||
onChange={e => handleChange(e, record.scoreMap[item.supplierRegisterId], item.supplierRegisterId)}
|
||||
onChange={e => handleChange(e, scoreResult.data, item.supplierRegisterId)}
|
||||
>
|
||||
{
|
||||
optionArr.map((item: any) => {
|
||||
@ -1010,8 +1025,8 @@ const Index: React.FC<{}> = () => {
|
||||
})
|
||||
}
|
||||
</Select><br />
|
||||
<Button type="link" danger onClick={() => getRemark(record.scoreMap[item.supplierRegisterId], item.supplierRegisterId)}>备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" danger onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
<Button type="link" onClick={() => getRemark(scoreResult.data, item.supplierRegisterId)}>备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
</div>
|
||||
)
|
||||
} else {
|
||||
@ -1026,8 +1041,8 @@ const Index: React.FC<{}> = () => {
|
||||
})
|
||||
}
|
||||
</Select><br />
|
||||
<Button type="link" danger onClick={() => getRemark(record, item.supplierRegisterId)}>备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" danger onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
<Button type="link" onClick={() => getRemark(record, item.supplierRegisterId)}>备注</Button>
|
||||
<Button hidden={btnAuthority(['ebtp-expert'])} type="link" onClick={() => lookFile(record.id, item.supplierRegisterId)}>查看{showNameT.tb}文件</Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -1718,12 +1733,12 @@ const Index: React.FC<{}> = () => {
|
||||
isDisabledOffer || isEndProgress ? null :
|
||||
<div>
|
||||
<Space>
|
||||
<Button onClick={setQuotation} type="primary" hidden={btnAuthority(['ebtp-expert'])} danger>确定</Button>
|
||||
<Button onClick={setQuotation} type="primary" hidden={btnAuthority(['ebtp-expert'])}>确定</Button>
|
||||
{
|
||||
smallPrice ? <Button hidden={btnAuthority(['ebtp-expert'])} onClick={saveOfferSorce} type="primary" danger>保存</Button> : null
|
||||
smallPrice ? <Button hidden={btnAuthority(['ebtp-expert'])} onClick={saveOfferSorce} type="primary">保存</Button> : null
|
||||
}
|
||||
{
|
||||
smallPrice ? <Button hidden={btnAuthority(['ebtp-expert'])} onClick={submit} type="primary" danger>提交</Button> : null
|
||||
smallPrice ? <Button hidden={btnAuthority(['ebtp-expert'])} onClick={submit} type="primary">提交</Button> : null
|
||||
}
|
||||
</Space>
|
||||
</div>
|
||||
|
@ -8,6 +8,168 @@ import TextArea from 'antd/lib/input/TextArea';
|
||||
import { proTableValueEnum } from '@/utils/CommonUtils';
|
||||
import tableProps from '@/utils/tableProps';
|
||||
|
||||
// 处理树形选择的级联逻辑
|
||||
const handleTreeCascadeCheck = (
|
||||
treeData: any[],
|
||||
currentChecked: {checked: React.Key[], halfChecked: React.Key[]},
|
||||
clickedKey: React.Key,
|
||||
isChecked: boolean
|
||||
): {checked: React.Key[], halfChecked: React.Key[]} => {
|
||||
const newChecked = new Set([...currentChecked.checked]);
|
||||
const newHalfChecked = new Set([...currentChecked.halfChecked]);
|
||||
|
||||
// 递归获取所有子节点ID
|
||||
const getAllChildrenIds = (nodes: any[]): React.Key[] => {
|
||||
const childIds: React.Key[] = [];
|
||||
const traverse = (nodeList: any[]) => {
|
||||
nodeList.forEach(node => {
|
||||
childIds.push(node.key);
|
||||
if (node.children && node.children.length > 0) {
|
||||
traverse(node.children);
|
||||
}
|
||||
});
|
||||
};
|
||||
traverse(nodes);
|
||||
return childIds;
|
||||
};
|
||||
|
||||
// 查找节点及其子节点
|
||||
const findNodeAndChildren = (nodes: any[], targetKey: React.Key): {node: any, children: React.Key[]} | null => {
|
||||
for (const node of nodes) {
|
||||
if (node.key === targetKey) {
|
||||
const children = node.children ? getAllChildrenIds(node.children) : [];
|
||||
return { node, children };
|
||||
}
|
||||
if (node.children) {
|
||||
const result = findNodeAndChildren(node.children, targetKey);
|
||||
if (result) return result;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
const nodeInfo = findNodeAndChildren(treeData, clickedKey);
|
||||
|
||||
if (!nodeInfo) return currentChecked;
|
||||
|
||||
if (isChecked) {
|
||||
// 选中节点:将节点及其所有子节点添加到checked,从halfChecked中移除
|
||||
newChecked.add(clickedKey);
|
||||
newHalfChecked.delete(clickedKey);
|
||||
|
||||
nodeInfo.children.forEach(childId => {
|
||||
newChecked.add(childId);
|
||||
newHalfChecked.delete(childId);
|
||||
});
|
||||
} else {
|
||||
// 取消选中节点:将节点及其所有子节点从checked和halfChecked中移除
|
||||
newChecked.delete(clickedKey);
|
||||
newHalfChecked.delete(clickedKey);
|
||||
|
||||
nodeInfo.children.forEach(childId => {
|
||||
newChecked.delete(childId);
|
||||
newHalfChecked.delete(childId);
|
||||
});
|
||||
}
|
||||
|
||||
// 重新计算父节点状态
|
||||
const updateParentStates = (nodes: any[]) => {
|
||||
nodes.forEach(node => {
|
||||
if (node.children && node.children.length > 0) {
|
||||
// 先递归处理子节点
|
||||
updateParentStates(node.children);
|
||||
|
||||
// 统计子节点状态
|
||||
let checkedCount = 0;
|
||||
let totalCount = node.children.length;
|
||||
|
||||
node.children.forEach((child: any) => {
|
||||
if (newChecked.has(child.key)) {
|
||||
checkedCount++;
|
||||
} else if (newHalfChecked.has(child.key)) {
|
||||
checkedCount += 0.5; // 半选中算0.5
|
||||
}
|
||||
});
|
||||
|
||||
// 更新父节点状态
|
||||
if (checkedCount === totalCount) {
|
||||
// 所有子节点都选中 → 父节点完全选中
|
||||
newChecked.add(node.key);
|
||||
newHalfChecked.delete(node.key);
|
||||
} else if (checkedCount > 0) {
|
||||
// 部分子节点选中 → 父节点半选中
|
||||
newChecked.delete(node.key);
|
||||
newHalfChecked.add(node.key);
|
||||
} else {
|
||||
// 无子节点选中 → 父节点未选中
|
||||
newChecked.delete(node.key);
|
||||
newHalfChecked.delete(node.key);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
updateParentStates(treeData);
|
||||
|
||||
return {
|
||||
checked: Array.from(newChecked),
|
||||
halfChecked: Array.from(newHalfChecked)
|
||||
};
|
||||
};
|
||||
|
||||
// 计算Tree组件的checked和halfChecked状态
|
||||
const calculateTreeCheckState = (treeData: any[], selectedIds: string[]): {checked: string[], halfChecked: string[]} => {
|
||||
const checkedKeys: string[] = [];
|
||||
const halfCheckedKeys: string[] = [];
|
||||
|
||||
// 递归处理节点,返回当前子树的选中状态
|
||||
const traverse = (nodes: any[]): {hasChecked: boolean, allChecked: boolean} => {
|
||||
let hasAnyChecked = false;
|
||||
let allNodesChecked = nodes.length > 0; // 初始假设所有节点都选中
|
||||
|
||||
for (const node of nodes) {
|
||||
if (node.children && node.children.length > 0) {
|
||||
// 父节点:递归处理子节点
|
||||
const childResult = traverse(node.children);
|
||||
|
||||
if (childResult.allChecked && childResult.hasChecked) {
|
||||
// 所有子节点都完全选中 → 父节点完全选中
|
||||
checkedKeys.push(node.key);
|
||||
hasAnyChecked = true;
|
||||
} else if (childResult.hasChecked) {
|
||||
// 部分子节点选中 → 父节点半选中
|
||||
halfCheckedKeys.push(node.key);
|
||||
hasAnyChecked = true;
|
||||
allNodesChecked = false;
|
||||
} else {
|
||||
// 子节点都未选中 → 父节点未选中
|
||||
allNodesChecked = false;
|
||||
}
|
||||
} else {
|
||||
// 叶子节点:直接检查是否在selectedIds中
|
||||
if (selectedIds.includes(node.key)) {
|
||||
checkedKeys.push(node.key);
|
||||
hasAnyChecked = true;
|
||||
} else {
|
||||
allNodesChecked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
hasChecked: hasAnyChecked,
|
||||
allChecked: allNodesChecked
|
||||
};
|
||||
};
|
||||
|
||||
traverse(treeData);
|
||||
|
||||
return {
|
||||
checked: checkedKeys,
|
||||
halfChecked: halfCheckedKeys
|
||||
};
|
||||
};
|
||||
|
||||
const entrust: React.FC<{}> = () => {
|
||||
//获取字典
|
||||
const getDict: any = getDicData();
|
||||
@ -16,7 +178,7 @@ const entrust: React.FC<{}> = () => {
|
||||
const [title, setTitle] = useState<string>('');
|
||||
const [open, setOpen] = useState<boolean>(false);
|
||||
|
||||
const [checkedKeys, setCheckedKeys] = useState<React.Key[]>([]);
|
||||
const [checkedKeys, setCheckedKeys] = useState<{checked: React.Key[], halfChecked: React.Key[]}>({checked: [], halfChecked: []});
|
||||
const [currentRoleId, setCurrentRoleId] = useState<number | null>(null);
|
||||
const dictData = JSON.parse(getDict);
|
||||
console.log(dictData)
|
||||
@ -106,26 +268,32 @@ function createSelect(data: any) {
|
||||
};
|
||||
|
||||
// 新增菜单树加载函数
|
||||
const loadMenuTree = async () => {
|
||||
const loadMenuTree = async (): Promise<any[]> => {
|
||||
setMenuLoading(true);
|
||||
try {
|
||||
const res = await getMenuTreeAll();
|
||||
if (res?.code === 200 && Array.isArray(res.data)) {
|
||||
setMenuOptions(formatMenuOptions(res.data));
|
||||
const formattedOptions = formatMenuOptions(res.data);
|
||||
setMenuOptions(formattedOptions);
|
||||
setMenuLoading(false);
|
||||
return formattedOptions;
|
||||
} else {
|
||||
setMenuOptions([]);
|
||||
message.error('菜单数据获取失败');
|
||||
setMenuLoading(false);
|
||||
return [];
|
||||
}
|
||||
} catch (e) {
|
||||
setMenuOptions([]);
|
||||
message.error('菜单数据获取异常');
|
||||
setMenuLoading(false);
|
||||
return [];
|
||||
}
|
||||
setMenuLoading(false);
|
||||
};
|
||||
|
||||
const handleAdd = async () => {
|
||||
form.resetFields();
|
||||
setCheckedKeys([]);
|
||||
setCheckedKeys({checked: [], halfChecked: []});
|
||||
await loadMenuTree();
|
||||
setOpen(true);
|
||||
setTitle('添加角色');
|
||||
@ -134,11 +302,15 @@ function createSelect(data: any) {
|
||||
const handleUpdate = async (record: any) => {
|
||||
form.resetFields();
|
||||
const role = await getDataById(record.roleId);
|
||||
await loadMenuTree();
|
||||
setCheckedKeys(role.data.menuIds || []);
|
||||
const currentMenuOptions = await loadMenuTree();
|
||||
console.log("menuOptions", currentMenuOptions, role.data.menuIds)
|
||||
// 计算正确的checked和halfChecked状态
|
||||
const checkState = calculateTreeCheckState(currentMenuOptions, role.data.menuIds || []);
|
||||
console.log("checkState", checkState)
|
||||
setCheckedKeys(checkState);
|
||||
form.setFieldsValue({
|
||||
...role.data,
|
||||
menuIds: role.data.menuIds || [],
|
||||
menuIds: [...checkState.checked, ...checkState.halfChecked],
|
||||
});
|
||||
setCurrentRoleId(record.roleId);
|
||||
setOpen(true);
|
||||
@ -148,7 +320,7 @@ function createSelect(data: any) {
|
||||
const closeModal = async () => {
|
||||
actionRef.current?.reload();
|
||||
form.resetFields();
|
||||
setCheckedKeys([]);
|
||||
setCheckedKeys({checked: [], halfChecked: []});
|
||||
setOpen(false);
|
||||
};
|
||||
|
||||
@ -181,7 +353,7 @@ function createSelect(data: any) {
|
||||
const checkSupModal = (
|
||||
<Modal
|
||||
title={title}
|
||||
visible={open}
|
||||
open={open}
|
||||
width="70%"
|
||||
centered
|
||||
destroyOnClose={true}
|
||||
@ -213,10 +385,24 @@ function createSelect(data: any) {
|
||||
<Tree
|
||||
defaultExpandAll
|
||||
checkable
|
||||
checkStrictly={true}
|
||||
checkedKeys={checkedKeys}
|
||||
onCheck={(checkedKeys) => {
|
||||
setCheckedKeys(checkedKeys as React.Key[]);
|
||||
form.setFieldsValue({ menuIds: checkedKeys });
|
||||
onCheck={(newCheckedKeys, info) => {
|
||||
console.log("onCheck - info:", info);
|
||||
console.log("onCheck - newCheckedKeys:", newCheckedKeys);
|
||||
|
||||
// 处理树形级联选择逻辑
|
||||
const updatedCheckState = handleTreeCascadeCheck(
|
||||
menuOptions,
|
||||
checkedKeys,
|
||||
info.node.key,
|
||||
info.checked
|
||||
);
|
||||
|
||||
console.log("onCheck - updatedCheckState:", updatedCheckState);
|
||||
setCheckedKeys(updatedCheckState);
|
||||
const allSelected = [...updatedCheckState.checked, ...updatedCheckState.halfChecked];
|
||||
form.setFieldsValue({ menuIds: allSelected });
|
||||
}}
|
||||
treeData={menuOptions}
|
||||
/>
|
||||
|
@ -95,3 +95,8 @@ export async function getCheckedByRoomId(params) {
|
||||
export async function checkOpenBidSupplier(params) {
|
||||
return request(`/api/biz-service-ebtp-tender/v1/supplier_register/tender/count/${params}`)
|
||||
}
|
||||
|
||||
//保存补充评审文件
|
||||
export async function saveSupplementFile(params) {
|
||||
return request(`/api/biz-service-ebtp-process/v1/bizassessroom`, { method: 'POST', data: params });
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
import request from '@/utils/request';
|
||||
import {doc} from "prettier";
|
||||
|
||||
/*雪花id获取*/
|
||||
export async function SnowflakeID() {
|
||||
return request('/api/core-service-ebtp-updownload/v1/business/id', {method: 'get'})
|
||||
return request('/api/sys-manager-ebtp-project/v1/business/id', {method: 'get'})
|
||||
}
|
||||
/*文档中心 根据bid获取文件列表 直接返回 upload组件 fileList 格式*/
|
||||
export async function getFileBidList(BidID: any) {
|
||||
|
@ -13,35 +13,35 @@ import { isEmpty, isNotEmpty } from "./CommonUtils";
|
||||
/**
|
||||
* 文件上传
|
||||
*/
|
||||
export const uploadAttachmentPath = '/api/doc/v1.0/files/upload';
|
||||
export const uploadAttachmentPath = '/api/sys-manager-ebtp-project/v1.0/files/upload';
|
||||
/**
|
||||
* 获取密钥
|
||||
*/
|
||||
export const downloadSecretKeyPath = '/api/doc/api/data-service-document-center/outer/v1.0/files/getSecretKey';
|
||||
export const downloadSecretKeyPath = '/api/sys-manager-ebtp-project/v1.0/files/getSecretKey';
|
||||
/**
|
||||
* 文件下载(必须有密钥)
|
||||
*/
|
||||
export const downloadAttachmentPath = '/api/doc/api/data-service-document-center/outer/v1.0/files/getDownload';
|
||||
export const downloadAttachmentPath = '/api/sys-manager-ebtp-project/v1.0/files/getDownload';
|
||||
/**
|
||||
* 获取雪花id
|
||||
*/
|
||||
export const getSnowIdPath = '/api/core-service-ebtp-updownload/v1/business/id';
|
||||
export const getSnowIdPath = '/api/sys-manager-ebtp-project/v1/business/id';
|
||||
/**
|
||||
* 文件物理删除
|
||||
*/
|
||||
export const removeFilePath = '/api/doc/v1.0/files/disk';
|
||||
export const removeFilePath = '/api/sys-manager-ebtp-project/v1.0/files/disk';
|
||||
/**
|
||||
* 查询文件列表(根据objectId)
|
||||
*/
|
||||
export const findFilelistPath = '/api/doc/v1.0/files/queryReturn';
|
||||
export const findFilelistPath = '/api/sys-manager-ebtp-project/v1.0/files/queryReturn';
|
||||
/**
|
||||
* 图片展示
|
||||
*/
|
||||
export const pictureDisplayPath = '/api/doc/v1.0/files/display';
|
||||
export const pictureDisplayPath = '/api/sys-manager-ebtp-project/v1.0/files/display';
|
||||
/**
|
||||
* 文件下载(不用文件流)
|
||||
*/
|
||||
export const downloadPath = '/api/doc/v1.0/files/download';
|
||||
export const downloadPath = '/api/sys-manager-ebtp-project/v1.0/files/download';
|
||||
/**
|
||||
* 查询文件列表(根据2.0 bid)
|
||||
*/
|
||||
|
@ -14,11 +14,12 @@ interface ExtendUploadProps {
|
||||
maxCount?: number;
|
||||
maxSize?: number;
|
||||
uploadProps?: UploadProps;
|
||||
formatValidator?: (file: File) => boolean;
|
||||
}
|
||||
const ExtendUpload: React.FC<ExtendUploadProps> = (props) => {
|
||||
|
||||
|
||||
const { bid, onChange, btnName, maxCount, maxSize, uploadProps } = {
|
||||
const { bid, onChange, btnName, maxCount, maxSize, uploadProps, formatValidator } = {
|
||||
maxCount: 0,
|
||||
maxSize: 30,
|
||||
btnName: "上传",
|
||||
@ -54,6 +55,13 @@ const ExtendUpload: React.FC<ExtendUploadProps> = (props) => {
|
||||
|
||||
const fileBeforeUpload = (curFile: any, curFileList: any) => {
|
||||
const promise = new Promise<File | void>((resolve, reject) => {
|
||||
// 格式校验
|
||||
if (formatValidator && !formatValidator(curFile)) {
|
||||
message.error('文件格式校验失败,请检查文件类型');
|
||||
reject(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (maxSize === 0) {
|
||||
|
||||
} else {
|
||||
@ -145,6 +153,7 @@ const ExtendUpload: React.FC<ExtendUploadProps> = (props) => {
|
||||
{...uploadProps}
|
||||
key={"file" + returnValue}
|
||||
action={uploadAttachmentPath}
|
||||
accept={uploadProps?.accept || ''}
|
||||
data={{
|
||||
appCode: 'ebtp-cloud-frontend',
|
||||
objectId: returnValue,
|
||||
|
@ -128,7 +128,7 @@ request.interceptors.response.use(async (response) => {
|
||||
});
|
||||
} else {
|
||||
//2021.9.7 zhoujianlong 新增风险防控专用错误码4004
|
||||
if (data.code != undefined && data.code != '200' && data.code != '4004' && data.code !== '1') {
|
||||
if (data.code != undefined && data.code != '200' && data.code != '4004' && data.code != '1') {
|
||||
message.error(data.message, 3);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user