diff --git a/src/baseStyle.less b/src/baseStyle.less index e54feab..953f66d 100644 --- a/src/baseStyle.less +++ b/src/baseStyle.less @@ -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 { diff --git a/src/components/LayLeftMenu/index.less b/src/components/LayLeftMenu/index.less index 377dbb8..708148c 100644 --- a/src/components/LayLeftMenu/index.less +++ b/src/components/LayLeftMenu/index.less @@ -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; diff --git a/src/pages/BidEvaluation/components/SupplementFileUpload.tsx b/src/pages/BidEvaluation/components/SupplementFileUpload.tsx new file mode 100644 index 0000000..7e54f45 --- /dev/null +++ b/src/pages/BidEvaluation/components/SupplementFileUpload.tsx @@ -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 = (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 ( + + +
+ + + +
+
+
+ ); +}; + +export default SupplementFileUpload; \ No newline at end of file diff --git a/src/pages/Evaluation/BidDetailed/BidDetailedReview/index.tsx b/src/pages/Evaluation/BidDetailed/BidDetailedReview/index.tsx index d369098..6216fa2 100644 --- a/src/pages/Evaluation/BidDetailed/BidDetailedReview/index.tsx +++ b/src/pages/Evaluation/BidDetailed/BidDetailedReview/index.tsx @@ -171,8 +171,8 @@ const Index: React.FC<{}> = () => { } else { if (record.tdocId) { return ( - // - + // + ) } 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 (
onChange(e, record.scoreMap[item.supplierRegisterId], item.supplierRegisterId)} + onChange={e => onChange(e, scoreResult.data, item.supplierRegisterId)} />
- - + +
) } else { @@ -869,8 +880,8 @@ const Index: React.FC<{}> = () => { options={radioOptions} onChange={e => onChange(e, record, item.supplierRegisterId)} />
- - + + ) } @@ -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)} />
- - + + ) } else { @@ -912,27 +924,28 @@ const Index: React.FC<{}> = () => { value={[]} onChange={e => checkChange(e, record, item.supplierRegisterId)} />
- - + + ) } } else if (record.scoreMethod == '2') { // 人工 - if (record.scoreMap && record.scoreMap[item.supplierRegisterId]) { + const scoreResult = getScoreData(record, item.supplierRegisterId); + if (scoreResult.hasData) { return (
评分区间:{record.lowScore}分~{record.highScore}分} placement="topLeft"> inputChange(e, record.scoreMap[item.supplierRegisterId], item.supplierRegisterId, record.highScore, record.lowScore)} + onChange={e => inputChange(e, scoreResult.data, item.supplierRegisterId, record.highScore, record.lowScore)} />
- - + +
) } else { @@ -942,8 +955,8 @@ const Index: React.FC<{}> = () => { inputChange(e, record, item.supplierRegisterId, record.highScore, record.lowScore)} style={{ width: 160 }} />
- - + + ) } @@ -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 (

- - + +
) @@ -987,8 +1001,8 @@ const Index: React.FC<{}> = () => { }) }
- - + + ) } @@ -1513,12 +1527,12 @@ const Index: React.FC<{}> = () => { isDisabledOffer || isEndProgress ? null :
- + { - smallPrice ? : null + smallPrice ? : null } { - smallPrice ? : null + smallPrice ? : null }
diff --git a/src/pages/Evaluation/BidDetailed/BidDetailedReviewLeader/index.tsx b/src/pages/Evaluation/BidDetailed/BidDetailedReviewLeader/index.tsx index 4bcbc7a..3acc475 100644 --- a/src/pages/Evaluation/BidDetailed/BidDetailedReviewLeader/index.tsx +++ b/src/pages/Evaluation/BidDetailed/BidDetailedReviewLeader/index.tsx @@ -207,7 +207,7 @@ const Index: React.FC<{}> = () => { } else { if (record.tdocId) { return ( - + ) } 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 (
onChange(e, record.scoreMap[item.supplierRegisterId], item.supplierRegisterId)} + onChange={e => onChange(e, scoreResult.data, item.supplierRegisterId)} />
- - + +
) } else { @@ -909,8 +921,8 @@ const Index: React.FC<{}> = () => { options={radioOptions} onChange={e => onChange(e, record, item.supplierRegisterId)} />
- - + + ) } @@ -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)} />
- - + + ) } else { @@ -952,27 +965,28 @@ const Index: React.FC<{}> = () => { value={[]} onChange={e => checkChange(e, record, item.supplierRegisterId)} />
- - + + ) } } else if (record.scoreMethod == '2') { // 人工 - if (record.scoreMap && record.scoreMap[item.supplierRegisterId]) { + const scoreResult = getScoreData(record, item.supplierRegisterId); + if (scoreResult.hasData) { return (
评分区间:{record.lowScore}分~{record.highScore}分} placement="topLeft"> 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)} />
- - + +
) } else { @@ -982,8 +996,8 @@ const Index: React.FC<{}> = () => { inputChange(e, record, item.supplierRegisterId, record.highScore, record.lowScore)} style={{ width: 160 }} />
- - + + ) } @@ -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 (

- - + +
) } else { @@ -1026,8 +1041,8 @@ const Index: React.FC<{}> = () => { }) }
- - + + ) } @@ -1718,12 +1733,12 @@ const Index: React.FC<{}> = () => { isDisabledOffer || isEndProgress ? null :
- + { - smallPrice ? : null + smallPrice ? : null } { - smallPrice ? : null + smallPrice ? : null }
diff --git a/src/pages/System/Role/index.tsx b/src/pages/System/Role/index.tsx index 23a9f2c..3cdfc62 100644 --- a/src/pages/System/Role/index.tsx +++ b/src/pages/System/Role/index.tsx @@ -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(''); const [open, setOpen] = useState(false); - const [checkedKeys, setCheckedKeys] = useState([]); + const [checkedKeys, setCheckedKeys] = useState<{checked: React.Key[], halfChecked: React.Key[]}>({checked: [], halfChecked: []}); const [currentRoleId, setCurrentRoleId] = useState(null); const dictData = JSON.parse(getDict); console.log(dictData) @@ -106,26 +268,32 @@ function createSelect(data: any) { }; // 新增菜单树加载函数 - const loadMenuTree = async () => { + const loadMenuTree = async (): Promise => { 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 = ( { - 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} /> diff --git a/src/services/bidev.js b/src/services/bidev.js index ef31f72..cebd7ac 100644 --- a/src/services/bidev.js +++ b/src/services/bidev.js @@ -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 }); +} diff --git a/src/services/untilService.ts b/src/services/untilService.ts index 68acc42..1bebcdb 100644 --- a/src/services/untilService.ts +++ b/src/services/untilService.ts @@ -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) { diff --git a/src/utils/DownloadUtils.ts b/src/utils/DownloadUtils.ts index 1fca0a1..1875011 100644 --- a/src/utils/DownloadUtils.ts +++ b/src/utils/DownloadUtils.ts @@ -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) */ diff --git a/src/utils/ExtendUpload/index.tsx b/src/utils/ExtendUpload/index.tsx index 3e4571b..d0a3863 100644 --- a/src/utils/ExtendUpload/index.tsx +++ b/src/utils/ExtendUpload/index.tsx @@ -14,11 +14,12 @@ interface ExtendUploadProps { maxCount?: number; maxSize?: number; uploadProps?: UploadProps; + formatValidator?: (file: File) => boolean; } const ExtendUpload: React.FC = (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 = (props) => { const fileBeforeUpload = (curFile: any, curFileList: any) => { const promise = new Promise((resolve, reject) => { + // 格式校验 + if (formatValidator && !formatValidator(curFile)) { + message.error('文件格式校验失败,请检查文件类型'); + reject(false); + return; + } + if (maxSize === 0) { } else { @@ -145,6 +153,7 @@ const ExtendUpload: React.FC = (props) => { {...uploadProps} key={"file" + returnValue} action={uploadAttachmentPath} + accept={uploadProps?.accept || ''} data={{ appCode: 'ebtp-cloud-frontend', objectId: returnValue, diff --git a/src/utils/request.ts b/src/utils/request.ts index e628a8f..1b55f56 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -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); } }