提交 937d23c5 authored 作者: 钟是志's avatar 钟是志

// 2024年8月27日 17:22:11

// 姚鑫国说的 jsParams参数变了没调接口
上级 05b26690
...@@ -80,7 +80,7 @@ export async function giveBase16EncodeAsync(datas, url) { ...@@ -80,7 +80,7 @@ export async function giveBase16EncodeAsync(datas, url) {
// console.log('%c'+ datas[g] , 'color: orange;'); // console.log('%c'+ datas[g] , 'color: orange;');
***/ ***/
// } // }
if (g === 'allValues' && typeof datas[g] !== 'undefined') { if (g === 'allValues' && typeof datas[g] !== 'undefined') { // 传了allValues时调用findParamsKey 接口 获取过滤参数
datas = await countAllValues(datas, item); // 循环中 不要写await datas = await countAllValues(datas, item); // 循环中 不要写await
datas = giveKey('allValues', datas); datas = giveKey('allValues', datas);
} else { } else {
......
...@@ -899,19 +899,19 @@ export default class TableCom extends Component { ...@@ -899,19 +899,19 @@ export default class TableCom extends Component {
otherParams = p1; otherParams = p1;
options = p3 || {}; options = p3 || {};
} }
// console.log(otherParams);
//查缓存 //查缓存
var isChange = false; var isChange = false;
const { sqlKeys } = this.state; const { sqlKeys } = this.state;
if (sqlKeys[sqlKey] != null) { if (sqlKeys[sqlKey] != null) {
const ps = sqlKeys[sqlKey].params; const ps = sqlKeys[sqlKey].params;
if (params.length != ps.length) { if (params.length != ps.length) { // 数组参数个数变化时 调用接口
isChange = true; isChange = true;
} else { } else {
for (var i = 0; i < params.length; i++) { for (var i = 0; i < params.length; i++) {
if (params[i] != ps[i]) { if (params[i] != ps[i]) { // 数组参数某一个变化时 调用接口
isChange = true; isChange = true;
break; break;
} }
...@@ -919,9 +919,13 @@ export default class TableCom extends Component { ...@@ -919,9 +919,13 @@ export default class TableCom extends Component {
} }
if (!isChange) { if (!isChange) {
const os = sqlKeys[sqlKey].options; const os = sqlKeys[sqlKey].options;
if (JSON.stringify(options) !== JSON.stringify(os)) { if (JSON.stringify(options) !== JSON.stringify(os)) { // options 参数改变时调用接口
sqlKeys[sqlKey].options = options; sqlKeys[sqlKey].options = options;
isChange = true; isChange = true;
}else if(otherParams && JSON.stringify(sqlKeys[sqlKey].otherParams) !== JSON.stringify(otherParams)){
// 2024年8月27日 17:22:11
// 姚鑫国说的 jsParams参数变了没调接口
isChange = true;
} else { } else {
for (var k in options) { for (var k in options) {
if (os[k] == null || options[k] != os[k]) { if (os[k] == null || options[k] != os[k]) {
...@@ -935,6 +939,7 @@ export default class TableCom extends Component { ...@@ -935,6 +939,7 @@ export default class TableCom extends Component {
sqlKeys[sqlKey] = { sqlKeys[sqlKey] = {
params: params, params: params,
options: options, options: options,
otherParams: otherParams,
}; };
isChange = true; isChange = true;
} }
......
...@@ -30,7 +30,8 @@ const cacheApiconfig = [ ...@@ -30,7 +30,8 @@ const cacheApiconfig = [
key: 'getSqlData', // 接口唯一的键 key: 'getSqlData', // 接口唯一的键
url: '/DataColumnApi/getSqlData', // 接口地址 url: '/DataColumnApi/getSqlData', // 接口地址
searchParams: 'sqlKey', // 缓存的参数 searchParams: 'sqlKey', // 缓存的参数
// otherParams: 'allValues', // otherParams: 'allValues,jsParams,pageSize,pageNum',
// otherParamsArray: ['allValues','jsParams','pageSize','pageNum'],
time: 600, // 缓存数据有效期. 单位秒 time: 600, // 缓存数据有效期. 单位秒
isCache: true, isCache: true,
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论