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

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

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