Commit 5af2c243 authored by 涂伟's avatar 涂伟

fix: '1.图片上传下载逻辑优化2.接口添加'

parent fcacc12b
Pipeline #72418 failed with stages
......@@ -6,6 +6,7 @@ import classnames from 'classnames';
import { UploadFile, UploadChangeParam, RcFile } from 'antd/lib/upload/interface';
import { uuid } from '@/utils/tools';
import { get, PUBLISH_SERVICE } from '@/services';
import { DownLoadFiles } from '@/services/common/api';
import styles from './index.less';
import { getImageBases } from '@/services/common/api';
import UploadContext from './context'
......@@ -264,17 +265,26 @@ class PicturesWall extends React.Component<PicturesWallType> {
// })
// }
getImageUrl(path) {
if (path && path.indexOf('http') === 0) {
return path
}
if (path && path.indexOf('data:') === 0) {
return path
}
if (path && path.indexOf('assets') === 0) {
return `${window.location.origin}/civweb4/${path}`.replace(/\\/g, '/')
}
return `${window.location.origin}/${path}`.replace(/\\/g, '/')
getImageUrl(path: string) {
// return new Promise<string>((resolve, reject) => {
// DownLoadFiles({ module: '图库', filePath: path }).then(res=> {
// let reader = new FileReader();
// reader.readAsDataURL(res);
// reader.onload = () => resolve(reader.result as string);
// })
// });
return `/PandaOMS/OMS/FileCenter/DownLoadFiles?module=图库&filePath=${path}`
// if (path && path.indexOf('http') === 0) {
// return path
// }
// if (path && path.indexOf('data:') === 0) {
// return path
// }
// if (path && path.indexOf('assets') === 0) {
// return `${window.location.origin}/civweb4/${path}`.replace(/\\/g, '/')
// }
// return `${window.location.origin}/${path}`.replace(/\\/g, '/')
}
getFileName(path: string) {
......
......@@ -18,6 +18,7 @@ import FlowGroupModal from './workFlowComponents/FlowGroupModal';
import Order from './workFlowComponents/Order';
import styles from './WorkflowHomePage.less';
import { WFGetAllFlow, GetFlowNode, DeleteFlow } from '@/services/workflow/workflow';
import { DownLoadFiles } from '@/services/common/api';
import { UpdateFlowGroup } from '@/services/workflow/workflow';
const plugins = [ScrollToPlugin];
const { Search } = Input;
......@@ -113,6 +114,7 @@ const WorkflowHomePage = () => {
let list = res.data.map((item, index) => {
item.children.forEach(ele => {
flowNameList.push(ele.FlowName);
ele.PreviewImage = getImgUrl(ele.PreviewImage)
});
item.isOld = true;
item.bgType = (index + 1) % 5;
......@@ -263,7 +265,11 @@ const WorkflowHomePage = () => {
getFlowList();
message.success('删除成功');
} else {
message.error({ content: <div style={{ whiteSpace: 'pre-line', textAlign: 'justify' }}>{res.msg}</div> });
message.error({
content: (
<div style={{ whiteSpace: 'pre-line', textAlign: 'justify' }}>{res.msg}</div>
),
});
}
})
.catch(() => {
......@@ -273,6 +279,16 @@ const WorkflowHomePage = () => {
onCancel() {},
});
};
const getImgUrl = img => {
// return new Promise((resolve, reject) => {
// DownLoadFiles({ module: '图库', filePath: img }).then(res => {
// let reader = new FileReader();
// reader.readAsDataURL(res);
// reader.onload = () => resolve(reader.result);
// });
// });a
return `/PandaOMS/OMS/FileCenter/DownLoadFiles?module=图库&filePath=${img}`
};
// tab栏选项渲染
const tabRender = (val, index) => (
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-around' }}>
......@@ -408,9 +424,9 @@ const WorkflowHomePage = () => {
<div className={styles.name} contenteditable="true">
<Input
style={{
width: item.name.length*14 + 'px',
width: item.name.length * 14 + 'px',
fontSize: '14px',
padding: '0'
padding: '0',
}}
placeholder="请输入分组名称"
onBlur={e => {
......@@ -418,8 +434,8 @@ const WorkflowHomePage = () => {
}}
bordered={false}
defaultValue={item.name}
onInput= {e=> {
e.currentTarget.style.width = (e.currentTarget.value.length) * 14 + "px";
onInput={e => {
e.currentTarget.style.width = e.currentTarget.value.length * 14 + 'px';
}}
// onPressEnter={e => {
// console.log(e, '触发咯');
......@@ -492,7 +508,8 @@ const WorkflowHomePage = () => {
// window.location.origin
// }/PandaOMS/OMS/FileCenter/DownLoadFiles?filePath=${ele.PreviewImage}`}
// />
<img src={`${window.location.origin}/${ele.PreviewImage}`} />
// <img src={`${window.location.origin}/${ele.PreviewImage}`} />
<img src={ele.PreviewImage} />
) : (
<img
className={styles.noDataImg}
......
......@@ -27,6 +27,7 @@ import {
EditIntegratedLogin,
GetIntegratedloginSetting,
} from '@/services/integratedLogin/api';
import { DownLoadFiles } from '@/services/common/api';
import { PlusOutlined, LoadingOutlined } from '@ant-design/icons';
import { get, PUBLISH_SERVICE } from '@/services';
import PreviewModal from './PreviewModal';
......@@ -392,6 +393,10 @@ const AddModal = props => {
setFileList(newFileList);
};
const getImg = img => {
return `/PandaOMS/OMS/FileCenter/DownLoadFiles?module=图库\\第三方图标&filePath=${img}`;
};
const handleChange = info => {
setKeepImgeUrl('');
setIm('');
......@@ -401,10 +406,18 @@ const AddModal = props => {
}
if (info.file.status === 'done') {
getBase64(info.file.originFileObj, url => {
setLoading(false);
setImageUrl(url);
});
// DownLoadFiles({ module: '图库\\第三方图标', filePath: info.file.response.data }).then(res => {
// let reader = new FileReader();
// reader.readAsDataURL(res);
// reader.onload = function() {
// setImageUrl(reader.result);
// };
// });
setImageUrl(getImg(info.file.response.data));
// getBase64(info.file.originFileObj, url => {
// setLoading(false);
// setImageUrl(url);
// });
}
};
......
......@@ -18,6 +18,7 @@ import {
SetIntegratedloginSettingSort,
EditIntegratedLogin,
} from '@/services/integratedLogin/api';
import { DownLoadFiles } from '@/services/common/api';
import {
EditTwoTone,
DeleteOutlined,
......@@ -55,6 +56,10 @@ const Integrate = () => {
console.log(tableData);
}, [flag]);
const getImg = img => {
return `/PandaOMS/OMS/FileCenter/DownLoadFiles?module=图库\\第三方图标&filePath=${img}`;
};
const columns = [
{
title: '序号',
......@@ -70,15 +75,16 @@ const Integrate = () => {
},
{
title: '图标',
dataIndex: 'iconUrl',
key: 'iconUrl',
dataIndex: 'showUrl',
key: 'showUrl',
align: 'center',
width: 200,
render: (text, record) => {
if (text) {
return (
<Image
src={`${window.location.origin}/${text}`}
// src={`${window.location.origin}/${text}`}
src={text}
height="50px"
style={{ backgroundColor: '#2881a1' }}
/>
......@@ -315,11 +321,13 @@ const Integrate = () => {
aa.push(i.SystemName);
resnew.data[j].AccountParamKey = i.AccountParam[0].key;
resnew.data[j].AccountParamValue = i.AccountParam[0].value;
resnew.data[j].showUrl = getImg(resnew.data[j].iconUrl)
});
}
console.log(aa);
setKeepSystemName(aa);
console.log(resnew.data);
console.log(resnew.data,'resnew.dataresnew.dataresnew.data');
setTableData(resnew.data);
} else {
notification.error({
......
......@@ -20,6 +20,7 @@ import {
AddIntegratedloginSetting,
GetIntegratedloginSetting,
} from '@/services/integratedLogin/api';
import { DownLoadFiles } from '@/services/common/api';
import { PlusOutlined, LoadingOutlined } from '@ant-design/icons';
import { get, PUBLISH_SERVICE } from '@/services';
import PreviewModal from './PreviewModal';
......@@ -225,11 +226,20 @@ const Master = props => {
return;
}
if (info.file.status === 'done') {
getBase64(info.file.originFileObj, url => {
setLoading(false);
setImageUrl(url);
});
setImageUrl(getImg(info.file.response.data));
// if (info.file.status === 'done') {
// DownLoadFiles({ module: '图库\\第三方图标', filePath: info.file.response.data }).then(res => {
// let reader = new FileReader();
// reader.readAsDataURL(res);
// reader.onload = function() {
// setImageUrl(reader.result);
// };
// });
// getBase64(info.file.originFileObj, url => {
// setLoading(false);
// setImageUrl(url);
// });
}
};
......
......@@ -15,3 +15,8 @@ export const getSysConfigurate = params =>
export const gateWayConfig = params => get(`/PandaCore/GCK/Basis/GateWayConfig`, params);
// 获取网关配置
export const GetGateWay = param => get(`${PUBLISH_SERVICE}/HostManager/GetGateWay`, param);
// 获取图片文件流
export const DownLoadFiles = query =>
get(`/PandaOMS/OMS/FileCenter/DownLoadFiles`, query, {
responseType: 'blob',
});
......@@ -131,6 +131,14 @@ export const CheckImportLedgerConfig = data =>
export const ImportLedgerConfig = data =>
post(`${PUBLISH_SERVICE}/WorkOrderCenter/ImportLedgerConfig`, data);
// 获取台账字段配置数据
// 根据ID获取台账字段配置数据
export const Ledger_QueryLedger = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/Ledger_QueryLedger`, query);
// 根据表名获取台账字段配置数据
export const Ledger_ReloadLedgerFields = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/Ledger_ReloadLedgerFields`, query);
// 提交台账配置数据
export const Ledger_SaveLedger = data =>
post(`${PUBLISH_SERVICE}/WorkOrderCenter/Ledger_SaveLedger`, data);
\ No newline at end of file
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