Browse Source

fix(bug): bug

bug

fix #359, fix #360, fix #376, fix #382
master
wpxp123456 5 years ago
parent
commit
9357792fd1
  1. 59
      src/controllers/server.js
  2. 2
      src/function/functionImplementation.js
  3. 8
      src/global/getdata.js

59
src/controllers/server.js

@ -154,7 +154,12 @@ const server = {
let _this = this; let _this = this;
if('WebSocket' in window){ if('WebSocket' in window){
_this.websocket = new WebSocket(_this.updateUrl + "?t=111&g=" + encodeURIComponent(_this.gridKey)); let wxUrl = _this.updateUrl + "?t=111&g=" + encodeURIComponent(_this.gridKey);
if(_this.updateUrl.indexOf('?') > -1){
wxUrl = _this.updateUrl + "&t=111&g=" + encodeURIComponent(_this.gridKey);
}
_this.websocket = new WebSocket(wxUrl);
//连接建立时触发 //连接建立时触发
_this.websocket.onopen = function() { _this.websocket.onopen = function() {
@ -163,7 +168,7 @@ const server = {
_this.wxErrorCount = 0; _this.wxErrorCount = 0;
//防止websocket长时间不发送消息导致断连 //防止websocket长时间不发送消息导致断连
_this.retryTimer = setInterval(function(){ _this.retryTimer = setInterval(function(){
_this.websocket.send("rub"); _this.websocket.send("rub");
}, 60000); }, 60000);
} }
@ -322,13 +327,13 @@ const server = {
//连接关闭时触发 //连接关闭时触发
_this.websocket.onclose = function(e){ _this.websocket.onclose = function(e){
console.info(locale().websocket.close); console.info(locale().websocket.close);
if(e.code === 1000){ if(e.code === 1000){
clearInterval(_this.retryTimer) clearInterval(_this.retryTimer)
_this.retryTimer = null _this.retryTimer = null
}else{ }else{
alert(locale().websocket.contact); alert(locale().websocket.contact);
} }
} }
} }
else{ else{
@ -648,19 +653,42 @@ const server = {
let rc = item.rc, let rc = item.rc,
st_i = value.index, st_i = value.index,
len = value.len, len = value.len,
addData = value.data, addData = value.data,
direction = value.direction,
mc = value.mc, mc = value.mc,
borderInfo = value.borderInfo; borderInfo = value.borderInfo;
let data = file.data; let data = $.extend(true, [], file.data);
if(rc == "r"){ if(rc == "r"){
file["row"] += len; file["row"] += len;
//空行模板
let row = [];
for(let c = 0; c < data[0].length; c++){
row.push(null);
}
let arr = []; let arr = [];
for(let i = 0; i < len; i++){ for(let i = 0; i < len; i++){
arr.push(JSON.stringify(addData[i])); if(addData[i] == null){
} arr.push(JSON.stringify(row));
new Function("data","return " + 'data.splice(' + st_i + ', 0, ' + arr.join(",") + ')')(data); }
else{
arr.push(JSON.stringify(addData[i]));
}
}
if(direction == "lefttop"){
if(st_i == 0){
new Function("data","return " + 'data.unshift(' + arr.join(",") + ')')(data);
}
else{
new Function("data","return " + 'data.splice(' + st_i + ', 0, ' + arr.join(",") + ')')(data);
}
}
else{
new Function("data","return " + 'data.splice(' + (st_i + 1) + ', 0, ' + arr.join(",") + ')')(data);
}
} }
else{ else{
file["column"] += len; file["column"] += len;
@ -675,6 +703,7 @@ const server = {
data[r][c].mc = mc[x]; data[r][c].mc = mc[x];
} }
file.data = data;
file["config"].merge = mc; file["config"].merge = mc;
file["config"].borderInfo = borderInfo; file["config"].borderInfo = borderInfo;

2
src/function/functionImplementation.js

@ -3256,7 +3256,7 @@ const functionImplementation = {
return 0; return 0;
} }
criteria = data_criteria.data; criteria = data_criteria.data.v;
} }
else{ else{
criteria = data_criteria; criteria = data_criteria;

8
src/global/getdata.js

@ -493,19 +493,19 @@ export function checkstatusByCell(cell, a){
foucsStatus = "1"; foucsStatus = "1";
} }
} }
else if(a == "vt"){ else if(a == "vt"){//默认垂直居中
if(foucsStatus == null){ if(foucsStatus == null){
foucsStatus = "2"; foucsStatus = "0";
} }
else{ else{
foucsStatus = foucsStatus[a]; foucsStatus = foucsStatus[a];
if(foucsStatus == null){ if(foucsStatus == null){
foucsStatus = "2"; foucsStatus = "0";
} }
} }
if(["0", "1", "2"].indexOf(foucsStatus.toString()) == -1){ if(["0", "1", "2"].indexOf(foucsStatus.toString()) == -1){
foucsStatus = "2"; foucsStatus = "0";
} }
} }
else if(a == "ct"){ else if(a == "ct"){

Loading…
Cancel
Save