fix bug 48 - 56

This commit is contained in:
MustangDeng 2022-06-16 20:58:54 +08:00
parent e31dbd18d8
commit 70a5d3ae7b
4 changed files with 46 additions and 27 deletions

View File

@ -14,7 +14,8 @@ export default class ModalStep1 extends React.Component {
this.state = {
datetime: "",
taxAgentId: "",
hasData: "0"
hasData: "0",
fileList: []
}
}
@ -23,6 +24,36 @@ export default class ModalStep1 extends React.Component {
fetchTaxAgentOption();
}
handleChange(info) {
let fileList = info.fileList;
// 1. 上传列表数量的限制
// 只显示最近上传的一个,旧的会被新的顶掉
fileList = fileList.slice(-1);
// 2. 读取远程路径并显示链接
fileList = fileList.map((file) => {
if (file.response) {
// 组件会将 file.url 作为链接进行展示
file.url = file.response.url;
}
return file;
});
// 3. 按照服务器返回信息筛选成功上传的文件
fileList = fileList.filter((file) => {
if (file.response) {
return file.response.status === 1;
}
return true;
});
if(fileList && fileList.length > 0 && fileList[0].response && fileList[0].response.status === 1) {
this.props.onFileIdChange(fileList[0].response.data.fileid)
}
this.setState({ fileList });
}
render() {
const { datetime, taxAgentId, hasData } = this.state
const { taxAgentStore: {taxAgentOption}, isInit } = this.props;
@ -35,16 +66,7 @@ export default class ModalStep1 extends React.Component {
multiple: false,
action: "/api/doc/upload/uploadFile", //上传地址
onChange: (info) => {
const { status } = info.file;
if (status !== 'uploading') {
//获得服务端返回的资源url
console.log(info.file.response.data);
}
if (status === 'done') {
this.props.onFileIdChange(info.file.response.data.fileid)
} else if (status === 'error') {
message.error(`${info.file.name} file upload failed.`);
}
this.handleChange(info)
},
};
return (
@ -66,7 +88,7 @@ export default class ModalStep1 extends React.Component {
导入excel
</div>
<div>
<Dragger {...dragger}>
<Dragger {...dragger} fileList={this.state.fileList}>
<div style={{ padding: '25px 0' }}>
<p className="ant-upload-drag-icon">
<Icon type="inbox" />

View File

@ -222,9 +222,9 @@ export default class DefaultSlideForm extends React.Component {
<div className="tableWrapper">
{
this.state.selectItem == "个人" ?
<Table dataSource={defaultPersonDataSource} columns={insertUpdateColumns} />
<Table dataSource={defaultPersonDataSource} columns={insertUpdateColumns} pagination={false}/>
:
<Table dataSource={defaultCompanyDataSource} columns={insertUpdateColumns} />
<Table dataSource={defaultCompanyDataSource} columns={insertUpdateColumns} pagination={false}/>
}
</div>
</div>

View File

@ -204,12 +204,6 @@ export default class Programme extends React.Component {
}
const rightMenu = [// 右键菜单
{
key: 'BTN_COLUMN',
icon: <i className='icon-coms-Custom' />,
content: '显示列定制',
onClick: this.showColumn
},
];
const collectParams = { // 收藏功能配置
favname: '社保福利方案',

View File

@ -224,14 +224,17 @@ export class ProgrammeStore {
validateCustomRequest() {
let flag = true;
this.formCondition.forEach(item => {
if(item.rules == "required") {
if(!notNull(this.customRequest[item.domkey[0]])) {
message.warning(item.label + "不能为空")
flag = false
try {
this.formCondition.forEach(item => {
if(item.rules == "required") {
if(!notNull(this.customRequest[item.domkey[0]])) {
message.warning(item.label + "不能为空")
throw new Error(item.label + "不能为空")
}
}
}
})
})
} catch(e) {
flag = false }
return flag;
}