|
@@ -1057,7 +1057,39 @@ const checkUtils = {
|
|
|
: data.end_contract_qty < data.deal_final_1_qty || data.end_contract_qty > 0;
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
+ compareCode(str1, str2, symbol = '-') {
|
|
|
+ if (!str1) {
|
|
|
+ return 1;
|
|
|
+ } else if (!str2) {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+
|
|
|
+ function compareSubCode(code1, code2) {
|
|
|
+ if (numReg.test(code1)) {
|
|
|
+ if (numReg.test(code2)) {
|
|
|
+ return parseInt(code1) - parseInt(code2);
|
|
|
+ } else {
|
|
|
+ return -1
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (numReg.test(code2)) {
|
|
|
+ return 1;
|
|
|
+ } else {
|
|
|
+ return code1 === code2 ? 0 : (code1 < code2 ? -1 : 1); //code1.localeCompare(code2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const numReg = /^[0-9]+$/;
|
|
|
+ const aCodes = str1.split(symbol), bCodes = str2.split(symbol);
|
|
|
+ for (let i = 0, iLength = Math.min(aCodes.length, bCodes.length); i < iLength; ++i) {
|
|
|
+ const iCompare = compareSubCode(aCodes[i], bCodes[i]);
|
|
|
+ if (iCompare !== 0) {
|
|
|
+ return iCompare;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return aCodes.length - bCodes.length;
|
|
|
+ },
|
|
|
};
|
|
|
|
|
|
Number.prototype.format2Str = function (pattern) {
|
|
@@ -1167,4 +1199,4 @@ const spreadColor = {
|
|
|
|
|
|
$(document).ready(function () {
|
|
|
$('.modal').draggable({handle: '.modal-header'});
|
|
|
-});
|
|
|
+});
|