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

优化代码结构

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