提交 9bfdfdcc 作者: ZhangLingKun

功能:招标快讯文件回显

上级 a528149d
...@@ -10,6 +10,7 @@ VITE_REQUEST_BASE_URL='/api' ...@@ -10,6 +10,7 @@ VITE_REQUEST_BASE_URL='/api'
#VITE_REQUEST_BASE_URL='http://192.168.3.22:10001' #VITE_REQUEST_BASE_URL='http://192.168.3.22:10001'
#VITE_REQUEST_BASE_URL='http://192.168.3.17:8099' #VITE_REQUEST_BASE_URL='http://192.168.3.17:8099'
#VITE_REQUEST_BASE_URL='http://192.168.3.23:35150' #VITE_REQUEST_BASE_URL='http://192.168.3.23:35150'
#VITE_REQUEST_BASE_URL='http://192.168.3.111:10001'
#版本 #版本
NODE_ENV='development' NODE_ENV='development'
VERSION='2.2.4.230217.Release' VERSION='2.2.4.230217.Release'
...@@ -31,6 +31,7 @@ export type releaseTenderNews = InterListFunction< ...@@ -31,6 +31,7 @@ export type releaseTenderNews = InterListFunction<
port: number; port: number;
tenderName: string; tenderName: string;
using: number; using: number;
url: string;
} }
>; >;
// 新增招标快讯 // 新增招标快讯
......
...@@ -5,6 +5,7 @@ import { releaseTenderNewsUpdate, releaseTenderNews } from '~/api/interface/reso ...@@ -5,6 +5,7 @@ import { releaseTenderNewsUpdate, releaseTenderNews } from '~/api/interface/reso
import { ResourceManageAPI } from '~/api'; import { ResourceManageAPI } from '~/api';
import { Uploader } from '~/components/uploader'; import { Uploader } from '~/components/uploader';
import { UploadOutlined } from '@ant-design/icons'; import { UploadOutlined } from '@ant-design/icons';
import { uploadFile } from '~/utils/uploadFile';
// 列表的类型 // 列表的类型
type TableType = InterListType<releaseTenderNews>; type TableType = InterListType<releaseTenderNews>;
...@@ -48,11 +49,23 @@ const AddEditModal: React.FC<propType> = (props) => { ...@@ -48,11 +49,23 @@ const AddEditModal: React.FC<propType> = (props) => {
}; };
// 提交事件 // 提交事件
const handleSubmit = async (values: ReqType & { file: any[] }) => { const handleSubmit = async (values: ReqType & { file: any[] }) => {
// 上传文件
const filePath = await uploadFile(values?.file?.at(-1));
// 新建formData
const formData = new FormData(); const formData = new FormData();
formData.append('file', values?.file?.at(-1)); formData.append('file', values?.file?.at(-1));
const blob = new Blob([JSON.stringify({ ...values, id: data?.id ? data?.id : null })], { const blob = new Blob(
type: 'application/json', [
}); JSON.stringify({
...values,
id: data?.id ? data?.id : null,
url: filePath ? filePath : null,
}),
],
{
type: 'application/json',
},
);
formData.append('tenderNewsVO', blob); formData.append('tenderNewsVO', blob);
const res = await ResourceManageAPI[ const res = await ResourceManageAPI[
data?.id ? 'releaseTenderNewsUpdate' : 'releaseTenderNewsAdd' data?.id ? 'releaseTenderNewsUpdate' : 'releaseTenderNewsAdd'
...@@ -115,6 +128,7 @@ const AddEditModal: React.FC<propType> = (props) => { ...@@ -115,6 +128,7 @@ const AddEditModal: React.FC<propType> = (props) => {
onChange={(e) => { onChange={(e) => {
form.setFieldValue('file', e); form.setFieldValue('file', e);
}} }}
defaultFileList={data?.url ? [{ url: data?.url }] : []}
> >
<Button icon={<UploadOutlined />} type={'primary'}> <Button icon={<UploadOutlined />} type={'primary'}>
上传 上传
......
import { CommonAPI } from '~/api';
import { message } from 'antd';
// 上传文件
export const uploadFile = (file: any): Promise<string> =>
new Promise((resolve, reject) => {
// 上传到服务器
const formData = new FormData();
formData.append('uploadFile', file);
CommonAPI.uploadOssBP(formData).then((res) => {
if (res && res.code === '200') {
resolve(res.result);
return;
} else {
reject(res);
message.error('文件上传失败').then();
return;
}
});
});
...@@ -13,6 +13,8 @@ export default defineConfig({ ...@@ -13,6 +13,8 @@ export default defineConfig({
'/api': { '/api': {
// target: 'http://192.168.3.111:8099', // 后端女pms // target: 'http://192.168.3.111:8099', // 后端女pms
// target: 'http://192.168.3.111:8077', // 后端女oms // target: 'http://192.168.3.111:8077', // 后端女oms
// target: 'http://192.168.3.111:10001', // 后端女release
// target: 'http://192.168.3.111:35150', // 后端女user
// target: 'http://192.168.3.17:8099', // 狗旺 // target: 'http://192.168.3.17:8099', // 狗旺
target: 'https://test.iuav.shop', target: 'https://test.iuav.shop',
changeOrigin: true, changeOrigin: true,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论