Commit 1cd179700495c20743e0162e2342409a399bf416

Authored by 陈鑫涛
2 parents 7c52ca8a 2da848f8

Merge branch 'main' of http://git.xlyprint.cn/zhangz/xlyUmi into main

src/components/CommonElementEvent/StatementInfo.js
... ... @@ -13,7 +13,7 @@ import {
13 13 UploadOutlined,
14 14 } from '@ant-design/icons';
15 15  
16   -import { Modal, Upload, message } from 'antd-v4';
  16 +import { Modal, Upload, message, Radio, Button } from 'antd-v4';
17 17 import * as commonUtils from '../../utils/utils';
18 18 import * as commonServices from '../../services/services';
19 19 import commonConfig from '../../utils/config';
... ... @@ -28,6 +28,7 @@ export default class StatementInfo extends Component {
28 28 constructor(props) {
29 29 super(props);
30 30 this.state = {
  31 + showUploadModal: false,
31 32 };
32 33 }
33 34  
... ... @@ -223,6 +224,31 @@ export default class StatementInfo extends Component {
223 224 this.props.onSaveState({ [`${name}Data`]: tableData });
224 225 this.handleBtnSave();
225 226 };
  227 + handleShowUpload = () => {
  228 + const { reportSelectedRowKeys, app , sModelsId, formSrcRoute} = this.props;
  229 + if (reportSelectedRowKeys === undefined || reportSelectedRowKeys.length !== 1) {
  230 + message.warn(commonFunc.showMessage(app.commonConst, 'selectedRowKeysNo'));
  231 + return;
  232 + }
  233 + // 根据用户语言决定流程
  234 + if (app.userinfo.sLanguage === 'sChinese') {
  235 + // 中文用户直接触发上传
  236 + this.uploadRef.upload.uploader.fileInput.click();
  237 + } else {
  238 + // 英文用户显示选择类型弹窗
  239 + this.setState({ showUploadModal: true });
  240 + }
  241 + };
  242 +
  243 + handleUploadConfirm = () => {
  244 + this.setState({ showUploadModal: false }); // 关闭Modal
  245 + if (this.uploadRef) {
  246 + this.uploadRef.upload.uploader.fileInput.click();
  247 + } else {
  248 + message.error('Error');
  249 + }
  250 + };
  251 +
226 252 handleOk = () => {
227 253 this.handleBtnSave();
228 254 this.props.onSaveState({
... ... @@ -244,10 +270,11 @@ export default class StatementInfo extends Component {
244 270 } = this.props;
245 271 const pane = app.panes.filter(paneTmp => paneTmp.key === sTabId)[0];
246 272 const { token } = this.props.app;
  273 + // 使用state管理reportType,默认为'zh'
  274 + const reportType = this.reportType || 'sChinese';
247 275 const outProps = {
248   - action: `${commonConfig.file_host_ebc}file/uploadReport?sModelsId=${sModelsId}&token=${token}&sName=${formSrcRoute}`,
249   - onChange: this.handleUploadChange,
250   - accept: '.jasper',
  276 + action: `${commonConfig.file_host_ebc}file/uploadReport?sModelsId=${sModelsId}&token=${token}&sName=${formSrcRoute}&reportType=${reportType}`, onChange: this.handleUploadChange,
  277 + accept: '.xlsx',
251 278 showUploadList: false,
252 279 beforeUpload: () => {
253 280 if (!this.props.reportPropsEnabled) return false;
... ... @@ -267,6 +294,13 @@ export default class StatementInfo extends Component {
267 294 const BtnUpload = commonFunc.showMessage(app.commonConst, 'BtnUpload');/* 上传 */
268 295 const BtnSave = commonFunc.showMessage(app.commonConst, 'BtnSave');/* 保存 */
269 296 const btnTop = commonFunc.showMessage(app.commonConst, 'setTop');/* 置顶 */
  297 + const sLanguage = app.userinfo?.sLanguage;
  298 + const BtnSure = commonFunc.showMessage(app.commonConst, 'BtnSure');/* 置顶 */
  299 + const modalTitle = sLanguage === 'sEnglish' ? 'Please confirm the upload' : '请确认上传';
  300 +
  301 + const sChinseReport = sLanguage === 'sEnglish' ? 'Chinese Report' : '中文报表';
  302 +
  303 + const sEnglishReport = sLanguage === 'sEnglish' ? 'English Report' : '英文报表';
270 304 return (
271 305 <div>
272 306 {(pane?.notCurrentPane ? false : this.props.visibleStatement) ?
... ... @@ -303,10 +337,38 @@ export default class StatementInfo extends Component {
303 337 </a>
304 338 </li>
305 339 <li>
306   - <Upload {...outProps}>
307   - <a {...this.getDisabledProps('BtnUpload')}>
308   - <UploadOutlined />{BtnUpload}
309   - </a>
  340 + <a {...this.getDisabledProps("BtnUpload")} onClick={this.handleShowUpload}>
  341 + <UploadOutlined />
  342 + {BtnUpload}
  343 + </a>
  344 + <Modal
  345 + title={modalTitle}
  346 + visible={this.state.showUploadModal}
  347 + footer={[
  348 + <Button key="submit" type="primary" onClick={this.handleUploadConfirm}>
  349 + {BtnSure}
  350 + </Button>,
  351 + ]}
  352 + width={500} // 设置固定宽度
  353 + bodyStyle={{
  354 + padding: "16px 24px", // 调整内边距
  355 + maxHeight: "60vh", // 限制最大高度
  356 + overflow: "auto", // 添加滚动条
  357 + }}
  358 + >
  359 + <Radio.Group
  360 + defaultValue="zh"
  361 + onChange={e => {
  362 + this.reportType = e.target.value;
  363 + }}
  364 + >
  365 + <Radio value="sChinese">{sChinseReport}</Radio>
  366 + <Radio value="sEnglish">{sEnglishReport}</Radio>
  367 + </Radio.Group>
  368 + </Modal>
  369 +
  370 + <Upload {...outProps} style={{ display: "none" }} ref={ref => (this.uploadRef = ref)}>
  371 + <a style={{ display: "none" }}></a>
310 372 </Upload>
311 373 </li>
312 374 <li>
... ...
src/components/QuickQuote/index.less
... ... @@ -100,7 +100,7 @@
100 100  
101 101 .ant-form-item-control {
102 102 flex: 1;
103   - max-width: calc(100% - 70px) !important;
  103 + max-width: calc(100% - 70px);
104 104 }
105 105  
106 106 .viewStyle {
... ...