提交 995b820b authored 作者: 钟是志's avatar 钟是志

1396 考场监考老师、QQ群等信息能批量导入。

上级 239a06c1
......@@ -14,7 +14,7 @@ import {
getSassApiHeader,
getSysCode
} from '@/webPublic/one_stop_public/2023yunshangguizhou/utils';
import { getServicesNomal, importExecute } from '../Services/services';
import { decodeObjKey, getServicesNomal, importExecute } from '../Services/services';
import { importDataQueryApi, importAnalyseApi } from '../Services/apiConfig';
const Modal = getModal();
......@@ -51,6 +51,7 @@ export default class ImportUtil extends React.PureComponent {
// exportTemplateUrl,
isNextDisabled: false,
trueObjId: '',
};
}
......@@ -129,11 +130,15 @@ export default class ImportUtil extends React.PureComponent {
import() {
const {
importParams,
objId,
} = this.props;
const {
trueObjId
} = this.state;
importExecute({
...(importParams || {}),
cacheKey: this.state.fileCacheKey,
objId: this.props.objId,
objId: trueObjId || objId,
}).then(res => {
if (res && res.sync === false && res.total) {
// 23013 学生事务/学生医保管理/学生平安险/保险办理,2001010248 高职界面已购买 导入 报错【接口超时】
......@@ -142,7 +147,7 @@ export default class ImportUtil extends React.PureComponent {
});
return;
}
this.next();
message.success('导入成功', 1);
this.setState({
......@@ -157,14 +162,16 @@ export default class ImportUtil extends React.PureComponent {
const {
importParams,
importConfig,
objId,
} = this.props;
const { trueObjId } = this.state;
getServicesNomal(importAnalyseApi, {
...(importParams || {}),
isLocal: false,
filePath,
importConfig: importConfig ? JSON.stringify(importConfig) : null,
objId: this.props.objId,
objId: trueObjId || objId,
}).then(res => {
this.setState({
fileCacheKey: res.cacheKey,
......@@ -175,11 +182,13 @@ export default class ImportUtil extends React.PureComponent {
queryFile = (cacheKey) => {
const {
importParams,
objId,
} = this.props;
const { trueObjId } = this.state;
getServicesNomal(importDataQueryApi, {
...(importParams || {}),
cacheKey,
objId: this.props.objId,
objId: trueObjId || objId,
}).then(res => {
this.setState({
current: 1,
......@@ -220,20 +229,34 @@ export default class ImportUtil extends React.PureComponent {
this.setState({ currentKey: activeKey });
};
componentDidMount() { // 1396 考场监考老师、QQ群等信息能批量导入。
if(this.props.importConfig?.objKey && typeof this.props.importConfig.objKey === 'string' &&
this.props.importConfig.objKey.length > 10
){
decodeObjKey(this.props.importConfig.objKey).then((res) => {
if(res && typeof res === 'string' && res.length > 10) {
console.log(res, res.length);
this.setState({
trueObjId: res,
})
}
})
}
}
downloadFile = async () => {
this.setState({ confirmLoading: true });
const {
objId,
fileName,
importParams,
importConfig,
} = this.props;
const { trueObjId } = this.state;
const params = {
...importParams,
importConfig: importConfig ? JSON.stringify(importConfig) : null,
objId,
objId: trueObjId || objId,
fileName,
};
let url = `${config.httpServer}/DataObjApi/importTemplateDownload`;
......@@ -370,6 +393,9 @@ export default class ImportUtil extends React.PureComponent {
className: 'defaultBlue',
...(this.props.btn ? this.props.btn : {}),
};
if(this.state.visible){
console.log(this.props);
}
return (
<span>
......
......@@ -33,3 +33,9 @@ export const importExecute = (params) => {
'导入的文件中可能存在字段不一致、字段类型不匹配、唯一性字段冲突,请检查或联系系统管理员',// 自定义errMsg
});
};
export const decodeObjKey = (code) => {
return apiRequest('/SnowflakeUtilApi/decode', {
code,
});
};
......@@ -166,12 +166,7 @@ export async function request(url, data, options = {}) {
export async function requestOrigin(url, data, options = {
credentials: 'include',
}){
console.log(options);
let version = getVersion();
if (options.method === 'GET') {
const pp = {
...data,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论