|
@@ -85,6 +85,7 @@ var ExcelUtil = /** @class */ (function () {
|
|
var type = '';
|
|
var type = '';
|
|
var isUniq = false; // 重复的行
|
|
var isUniq = false; // 重复的行
|
|
var isArray = false; // 是否是数组
|
|
var isArray = false; // 是否是数组
|
|
|
|
+ var canZeroStr = false; // 是否允许为0的字符串
|
|
if (ls != -1 && le != -1 && le > ls + 1) {
|
|
if (ls != -1 && le != -1 && le > ls + 1) {
|
|
var s = name_1.substring(ls + 1, le);
|
|
var s = name_1.substring(ls + 1, le);
|
|
name_1 = name_1.substring(0, ls);
|
|
name_1 = name_1.substring(0, ls);
|
|
@@ -107,9 +108,12 @@ var ExcelUtil = /** @class */ (function () {
|
|
else if (s[i] == 'a') { // array
|
|
else if (s[i] == 'a') { // array
|
|
isArray = true;
|
|
isArray = true;
|
|
}
|
|
}
|
|
- else if (s[i] == 'k') { // array
|
|
|
|
|
|
+ else if (s[i] == 'k') { // key
|
|
Config_1.Config.objectKey = name_1;
|
|
Config_1.Config.objectKey = name_1;
|
|
}
|
|
}
|
|
|
|
+ else if (s[i] == 'z') {
|
|
|
|
+ canZeroStr = true;
|
|
|
|
+ }
|
|
else {
|
|
else {
|
|
Config_1.Config.checkState(Config_1.RetCode.EXCEL_DATA_ERROR, "".concat(StringUtil_1.default.getCheckString(address, ret), " \n\u610F\u5916\u7684\u8868\u5934\u5B9A\u4E49\uFF01").concat(s));
|
|
Config_1.Config.checkState(Config_1.RetCode.EXCEL_DATA_ERROR, "".concat(StringUtil_1.default.getCheckString(address, ret), " \n\u610F\u5916\u7684\u8868\u5934\u5B9A\u4E49\uFF01").concat(s));
|
|
}
|
|
}
|
|
@@ -118,7 +122,7 @@ var ExcelUtil = /** @class */ (function () {
|
|
if (ret.keys.findIndex(function (v) { return v == name_1; }) != -1) {
|
|
if (ret.keys.findIndex(function (v) { return v == name_1; }) != -1) {
|
|
Config_1.Config.checkState(Config_1.RetCode.COL_NAME_REPEAT, "".concat(StringUtil_1.default.getCheckString(address, ret), " \n\u540C\u4E00\u4E2A\u8868\u4E2D\u53D1\u73B0\u5217\u540D\u91CD\u590D\uFF01").concat(name_1));
|
|
Config_1.Config.checkState(Config_1.RetCode.COL_NAME_REPEAT, "".concat(StringUtil_1.default.getCheckString(address, ret), " \n\u540C\u4E00\u4E2A\u8868\u4E2D\u53D1\u73B0\u5217\u540D\u91CD\u590D\uFF01").concat(name_1));
|
|
}
|
|
}
|
|
- ret.keys.push({ name: name_1, outputclient: outputclient, outputserver: outputserver, type: type, isUniq: isUniq, isArray: isArray });
|
|
|
|
|
|
+ ret.keys.push({ name: name_1, outputclient: outputclient, outputserver: outputserver, type: type, isUniq: isUniq, isArray: isArray, canZeroStr: canZeroStr });
|
|
delete worksheet[address]; // 删除表头信息
|
|
delete worksheet[address]; // 删除表头信息
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -169,7 +173,7 @@ var ExcelUtil = /** @class */ (function () {
|
|
}
|
|
}
|
|
return ret;
|
|
return ret;
|
|
};
|
|
};
|
|
- ExcelUtil.tryGetArray = function (value, isMult, isNumber) {
|
|
|
|
|
|
+ ExcelUtil.tryGetArray = function (value, isMult, isNumber, canZeroStr) {
|
|
var ret = '';
|
|
var ret = '';
|
|
value = StringUtil_1.default.replaceAll(value, '<color=#', '<color=@');
|
|
value = StringUtil_1.default.replaceAll(value, '<color=#', '<color=@');
|
|
var threeArr = value.split(Config_1.Config.THREEE_ARRAY_SYMBOL);
|
|
var threeArr = value.split(Config_1.Config.THREEE_ARRAY_SYMBOL);
|
|
@@ -187,6 +191,8 @@ var ExcelUtil = /** @class */ (function () {
|
|
ret += oneUnit;
|
|
ret += oneUnit;
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
|
|
+ if (!canZeroStr && oneUnit.toString() == '0')
|
|
|
|
+ oneUnit = '';
|
|
ret += "'".concat(oneUnit, "'"); // 支持字符串数组
|
|
ret += "'".concat(oneUnit, "'"); // 支持字符串数组
|
|
}
|
|
}
|
|
if (oneIndex != oneArr.length - 1) {
|
|
if (oneIndex != oneArr.length - 1) {
|
|
@@ -241,7 +247,7 @@ var ExcelUtil = /** @class */ (function () {
|
|
else if (headInfo.keys[i].type == 'string' || headInfo.keys[i].type == 'string[]') {
|
|
else if (headInfo.keys[i].type == 'string' || headInfo.keys[i].type == 'string[]') {
|
|
if (isArray[i]) {
|
|
if (isArray[i]) {
|
|
headInfo.keys[i].type = 'string[]';
|
|
headInfo.keys[i].type = 'string[]';
|
|
- temp = this.tryGetArray(temp, isMultArr[i]);
|
|
|
|
|
|
+ temp = this.tryGetArray(temp, isMultArr[i], false, headInfo.keys[i].canZeroStr);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
cobj[headInfo.keys[i].name] = temp;
|
|
cobj[headInfo.keys[i].name] = temp;
|