提交 2792a64d authored 作者: 钟是志's avatar 钟是志

优化代码结构

上级 54038f7e
......@@ -44,6 +44,7 @@ export default class Detail extends Component {
if (!id) {
id = getUrlInfo()?.id;
}
console.log(id);
this.state = {
id,
showAll: props.from !== 'onestopApp2.0'
......
......@@ -34,7 +34,7 @@ function giveKey(key, datas) {
return datas;
}
async function countAllValues(datas, item) {
export async function countAllValues(datas, item) {
if (item.setNull) {
datas.allValues = JSON.stringify({});
} else {
......
......@@ -4,6 +4,7 @@ import { queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfi
import { qqCw } from '@/webPublic/one_stop_public/utils/request';
import { isJSON } from '@/webPublic/zyd_public/utils/utils';
import { deepCopy } from '@/webPublic/one_stop_public/utils/myutils';
import { countAllValues } from '@/webPublic/one_stop_public/Base16/SplitBase16Index';
// import strToBinary from './strToBinary'; // 字符串转二进制 混淆代码
// import binaryToStr from './binaryToStr'; // 二进制字符串转JSON字符串 混淆代码
/**
......@@ -47,6 +48,7 @@ function binaryToStr(binaryStr = '') {
function formatDatas(datas, url = '') {
let datasCode = JSON.stringify(datas);
const openIsBinary = window.CONFIG?.IS_BINARY;
console.log(url,datas);
if (openIsBinary) {
datasCode = strToBinary(datasCode);
}
......@@ -74,7 +76,7 @@ function formatDatas(datas, url = '') {
return datasTrue;
}
export function giveFilePostData(datas, url) {
export async function giveFilePostData(datas, url) {
for (let i in datas) {
if (
datas[i] === null ||
......@@ -94,6 +96,7 @@ export function giveFilePostData(datas, url) {
url = url.replace(url, `/safe/${roleGroup}/` + url);
url = url.replaceAll('//', '/');
}
datas = await countAllValues(datas, item);
return new Promise((resolve, reject) => {
resolve({
datas: formatDatas(datas, url),
......@@ -116,9 +119,9 @@ function testPromise(d) {
}
export async function requestFileInfo(url, datas) {
for (let i = 0; i < 100; i++) {
datas = await testPromise(datas);
}
// for (let i = 0; i < 100; i++) {
// datas = await testPromise(datas);
// }
const formData = new FormData();
if (getToken()) {
datas.token = getToken();
......@@ -175,12 +178,11 @@ export async function requestFileInfo(url, datas) {
return false;
}
if (window.location.origin.indexOf('localhost') > -1) {
// console.log({
// datas,
// url,
// res,
// });
if (window.location.origin.indexOf('localhost') > -1 || getUserInfo().test) {
console.log({
url,
res,
});
}
return res;
......
......@@ -578,11 +578,8 @@ export default class TableCom extends Component {
obj,
dataColumn,
init,
json.sqlKey,
json.labelName,
json.valueName,
json,
allValues,
json.isMeta,
);
}
break;
......@@ -1241,7 +1238,11 @@ export default class TableCom extends Component {
}
}
fetchData3 = (obj, dataColumn, init, sqlKey, labelName, valueName, allValues, isMeta) => {
fetchData3 = (obj, dataColumn, init, json, allValues) => {
const {
sqlKey, labelName, valueName,
isMeta, filterSql,
} = json;
const { dispatch } = this.props;
if (init != null && Object.keys(init).length > 0) {
......@@ -1251,6 +1252,7 @@ export default class TableCom extends Component {
sqlKey,
allValues,
isMeta,
filterSql: isMeta ? filterSql || '' : undefined,
},
callback: (options) => {
const optionsx = [];
......@@ -1309,6 +1311,7 @@ export default class TableCom extends Component {
sqlKey,
allValues,
isMeta,
filterSql: isMeta ? filterSql || '' : undefined,
},
callback: (options) => {
// console.log(options);
......
......@@ -129,11 +129,7 @@ const loginUmiRequest = extend({
const getUrl = url => (url.startsWith('/') ? url : '/' + url);
const test = getUrlInfo().test;
export const request = (url, data, options = {}) => {
if (url && test === 'true') {
console.log(url, data);
}
return giveBase16EnCode(data, url)
.then((newData) => {
if (typeof newData === 'object' && newData.url && newData.datas) {
......
......@@ -113,9 +113,9 @@ export default function request(
url = url.replace(config.httpServer, '');
return uaaRequest(url, options.body);
}
// if(process.env.NODE_ENV === 'development' && getIsBei_Dian()){
// url = url.replace('https://yx.bpi.edu.cn/produce', 'http://localhost:8010/produce');
// }
if(process.env.NODE_ENV === 'development' && getIsBei_Dian()){
url = url.replace('https://yx.bpi.edu.cn/produce', 'http://localhost:8010/produce');
}
let sessionFetch = setFetchInfo(url, options);
if (!sessionFetch) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论