|
@@ -14,7 +14,9 @@ |
|
|
var clientAsyncData = {}; |
|
|
var clientAsyncData = {}; |
|
|
|
|
|
|
|
|
var clientData = {}; |
|
|
var clientData = {}; |
|
|
|
|
|
|
|
|
|
|
|
var desktopData = {}; |
|
|
|
|
|
var sourceData = {}; |
|
|
|
|
|
var userData = {}; |
|
|
|
|
|
|
|
|
function initLoad(callback) { |
|
|
function initLoad(callback) { |
|
|
var res = loadSate.yes; |
|
|
var res = loadSate.yes; |
|
@@ -278,13 +280,19 @@ |
|
|
init: function () { |
|
|
init: function () { |
|
|
if (clientAsyncData.user.states == loadSate.no) { |
|
|
if (clientAsyncData.user.states == loadSate.no) { |
|
|
clientAsyncData.user.states = loadSate.ing; |
|
|
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) { |
|
|
learun.httpAsync('GET', top.$.rootUrl + '/LR_OrganizationModule/User/GetMap', { ver: ver }, function (data) { |
|
|
if (!data) { |
|
|
if (!data) { |
|
|
clientAsyncData.user.states = loadSate.fail; |
|
|
clientAsyncData.user.states = loadSate.fail; |
|
|
} else { |
|
|
} else { |
|
|
if (data.ver) { |
|
|
if (data.ver) { |
|
|
storage.set("userData", data); |
|
|
|
|
|
|
|
|
userData = data; |
|
|
|
|
|
//storage.set("userData", data); |
|
|
} |
|
|
} |
|
|
clientAsyncData.user.states = loadSate.yes; |
|
|
clientAsyncData.user.states = loadSate.yes; |
|
|
clientAsyncData.dataItem.init(); |
|
|
clientAsyncData.dataItem.init(); |
|
@@ -300,7 +308,8 @@ |
|
|
}, 100);// 如果还在加载100ms后再检测 |
|
|
}, 100);// 如果还在加载100ms后再检测 |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
var data = storage.get("userData").data || {}; |
|
|
|
|
|
|
|
|
//var data = storage.get("userData").data || {}; |
|
|
|
|
|
var data = userData.data || {}; |
|
|
var keys = (op.key || '').split(','); |
|
|
var keys = (op.key || '').split(','); |
|
|
var array=new Array(); |
|
|
var array=new Array(); |
|
|
if (keys.length > 1) { |
|
|
if (keys.length > 1) { |
|
@@ -325,7 +334,8 @@ |
|
|
}, 100);// 如果还在加载100ms后再检测 |
|
|
}, 100);// 如果还在加载100ms后再检测 |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
var data = storage.get("userData").data || {}; |
|
|
|
|
|
|
|
|
//var data = storage.get("userData").data || {}; |
|
|
|
|
|
var data = userData.data || {}; |
|
|
op.callback(data, op); |
|
|
op.callback(data, op); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@@ -487,8 +497,9 @@ |
|
|
}, 100);// 如果还在加载100ms后再检测 |
|
|
}, 100);// 如果还在加载100ms后再检测 |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
var data = storage.get("sourceData_" + op.code).data || []; |
|
|
|
|
|
|
|
|
var data = sourceData["sourceData_" + code] || [];// storage.get("sourceData_" + op.code).data || []; |
|
|
if (!!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); |
|
|
op.callback(clientAsyncData.sourceData.find(op.key, op.keyId, data) || {}, op); |
|
|
} else { |
|
|
} else { |
|
|
op.callback({}, op); |
|
|
op.callback({}, op); |
|
@@ -507,7 +518,8 @@ |
|
|
}, 100);// 如果还在加载100ms后再检测 |
|
|
}, 100);// 如果还在加载100ms后再检测 |
|
|
} |
|
|
} |
|
|
else if (clientAsyncData.sourceData.states[op.code] == loadSate.yes) { |
|
|
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) { |
|
|
if (!!data) { |
|
|
op.callback(data, op); |
|
|
op.callback(data, op); |
|
@@ -517,13 +529,19 @@ |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
load: function (code) { |
|
|
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) { |
|
|
learun.httpAsync('GET', top.$.rootUrl + '/LR_SystemModule/DataSource/GetMap', { code: code, ver: ver }, function (data) { |
|
|
if (!data) { |
|
|
if (!data) { |
|
|
clientAsyncData.sourceData.states[code] = loadSate.fail; |
|
|
clientAsyncData.sourceData.states[code] = loadSate.fail; |
|
|
} else { |
|
|
} else { |
|
|
if (data.ver) { |
|
|
if (data.ver) { |
|
|
storage.set("sourceData_" + code, data); |
|
|
|
|
|
|
|
|
sourceData["sourceData_" + code] = data; |
|
|
|
|
|
//storage.set("sourceData_" + code, data); |
|
|
} |
|
|
} |
|
|
clientAsyncData.sourceData.states[code] = loadSate.yes; |
|
|
clientAsyncData.sourceData.states[code] = loadSate.yes; |
|
|
} |
|
|
} |
|
@@ -650,7 +668,7 @@ |
|
|
init: function () { |
|
|
init: function () { |
|
|
if (clientAsyncData.desktop.states == loadSate.no) { |
|
|
if (clientAsyncData.desktop.states == loadSate.no) { |
|
|
clientAsyncData.desktop.states = loadSate.ing; |
|
|
clientAsyncData.desktop.states = loadSate.ing; |
|
|
var j = storage.get("desktopData").ver || ""; |
|
|
|
|
|
|
|
|
var j = "";//storage.get("desktopData").ver || ""; |
|
|
learun.httpAsync("GET", |
|
|
learun.httpAsync("GET", |
|
|
top.$.rootUrl + "/LR_Desktop/DTTarget/GetMap", |
|
|
top.$.rootUrl + "/LR_Desktop/DTTarget/GetMap", |
|
|
{ |
|
|
{ |
|
@@ -661,7 +679,8 @@ |
|
|
clientAsyncData.desktop.states = loadSate.fail; |
|
|
clientAsyncData.desktop.states = loadSate.fail; |
|
|
} else { |
|
|
} else { |
|
|
if (k.ver) { |
|
|
if (k.ver) { |
|
|
storage.set("desktopData", k); |
|
|
|
|
|
|
|
|
desktopData = k; |
|
|
|
|
|
//storage.set("desktopData", k); |
|
|
} |
|
|
} |
|
|
clientAsyncData.desktop.states = loadSate.yes; |
|
|
clientAsyncData.desktop.states = loadSate.yes; |
|
|
clientAsyncData.department.init(); |
|
|
clientAsyncData.department.init(); |
|
@@ -675,7 +694,7 @@ |
|
|
clientAsyncData.desktop.get(k); |
|
|
clientAsyncData.desktop.get(k); |
|
|
}, 100) |
|
|
}, 100) |
|
|
} else { |
|
|
} else { |
|
|
var j = storage.get("desktopData").data || {}; |
|
|
|
|
|
|
|
|
var j = desktopData;//storage.get("desktopData").data || {}; |
|
|
k.callback(j || {}, k); |
|
|
k.callback(j || {}, k); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|