Bladeren bron

storage优化

金隅分支
zhangli 3 jaren geleden
bovenliggende
commit
937569b54e
2 gewijzigde bestanden met toevoegingen van 35 en 16 verwijderingen
  1. +4
    -4
      Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDesktop/Index.js
  2. +31
    -12
      Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-clientdata.js

+ 4
- 4
Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDesktop/Index.js Bestand weergeven

@@ -313,10 +313,10 @@ $(function () {
$(".lr-desktop-panel").lrscroll();
top.learun.clientdata.getAsync("desktop",
{
callback: function(g) {
c(g.list || []);
e(g.target || []);
a(g.chart || []);
callback: function (g) {
c(g.data.list || []);
e(g.data.target || []);
a(g.data.chart || []);
}

});


+ 31
- 12
Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-clientdata.js Bestand weergeven

@@ -14,7 +14,9 @@
var clientAsyncData = {};

var clientData = {};

var desktopData = {};
var sourceData = {};
var userData = {};

function initLoad(callback) {
var res = loadSate.yes;
@@ -278,13 +280,19 @@
init: function () {
if (clientAsyncData.user.states == loadSate.no) {
clientAsyncData.user.states = loadSate.ing;
var ver = storage.get("userData").ver || "";
//var ver = storage.get("userData").ver || "";
var ver = "";
if (userData) {
ver = userData.ver || "";
}

learun.httpAsync('GET', top.$.rootUrl + '/LR_OrganizationModule/User/GetMap', { ver: ver }, function (data) {
if (!data) {
clientAsyncData.user.states = loadSate.fail;
} else {
if (data.ver) {
storage.set("userData", data);
userData = data;
//storage.set("userData", data);
}
clientAsyncData.user.states = loadSate.yes;
clientAsyncData.dataItem.init();
@@ -300,7 +308,8 @@
}, 100);// 如果还在加载100ms后再检测
}
else {
var data = storage.get("userData").data || {};
//var data = storage.get("userData").data || {};
var data = userData.data || {};
var keys = (op.key || '').split(',');
var array=new Array();
if (keys.length > 1) {
@@ -325,7 +334,8 @@
}, 100);// 如果还在加载100ms后再检测
}
else {
var data = storage.get("userData").data || {};
//var data = storage.get("userData").data || {};
var data = userData.data || {};
op.callback(data, op);
}
}
@@ -487,8 +497,9 @@
}, 100);// 如果还在加载100ms后再检测
}
else {
var data = storage.get("sourceData_" + op.code).data || [];
var data = sourceData["sourceData_" + code] || [];// storage.get("sourceData_" + op.code).data || [];
if (!!data) {
//op.callback(sourceData["sourceData_" + code].find(op.key, op.keyId, data) || {}, op);
op.callback(clientAsyncData.sourceData.find(op.key, op.keyId, data) || {}, op);
} else {
op.callback({}, op);
@@ -507,7 +518,8 @@
}, 100);// 如果还在加载100ms后再检测
}
else if (clientAsyncData.sourceData.states[op.code] == loadSate.yes) {
var data = storage.get("sourceData_" + op.code).data || [];
//var data = storage.get("sourceData_" + op.code).data || [];
var data = sourceData["sourceData_" + op.code].data || [];

if (!!data) {
op.callback(data, op);
@@ -517,13 +529,19 @@
}
},
load: function (code) {
var ver = storage.get("sourceData_" + code).ver || "";
// var ver = storage.get("sourceData_" + code).ver || "";
var ver = "";
if (sourceData["sourceData_" + code]) {
ver = sourceData["sourceData_" + code].ver || "";
}
//var ver = sourceData["sourceData_" + code].ver || "";//storage.get("sourceData_" + code).ver || "";
learun.httpAsync('GET', top.$.rootUrl + '/LR_SystemModule/DataSource/GetMap', { code: code, ver: ver }, function (data) {
if (!data) {
clientAsyncData.sourceData.states[code] = loadSate.fail;
} else {
if (data.ver) {
storage.set("sourceData_" + code, data);
sourceData["sourceData_" + code] = data;
//storage.set("sourceData_" + code, data);
}
clientAsyncData.sourceData.states[code] = loadSate.yes;
}
@@ -650,7 +668,7 @@
init: function () {
if (clientAsyncData.desktop.states == loadSate.no) {
clientAsyncData.desktop.states = loadSate.ing;
var j = storage.get("desktopData").ver || "";
var j = "";//storage.get("desktopData").ver || "";
learun.httpAsync("GET",
top.$.rootUrl + "/LR_Desktop/DTTarget/GetMap",
{
@@ -661,7 +679,8 @@
clientAsyncData.desktop.states = loadSate.fail;
} else {
if (k.ver) {
storage.set("desktopData", k);
desktopData = k;
//storage.set("desktopData", k);
}
clientAsyncData.desktop.states = loadSate.yes;
clientAsyncData.department.init();
@@ -675,7 +694,7 @@
clientAsyncData.desktop.get(k);
}, 100)
} else {
var j = storage.get("desktopData").data || {};
var j = desktopData;//storage.get("desktopData").data || {};
k.callback(j || {}, k);
}
}


Laden…
Annuleren
Opslaan