|
|
@@ -6262,8 +6262,14 @@ function findDecimal(unit) {
|
|
|
|
|
|
// 编号排序,多重判断
|
|
|
function sortByCode(a, b, code = 'b_code') {
|
|
|
- let code1 = a[code].split('-');
|
|
|
- let code2 = b[code].split('-');
|
|
|
+ const codeValue1 = a && a[code] != null ? String(a[code]) : '';
|
|
|
+ const codeValue2 = b && b[code] != null ? String(b[code]) : '';
|
|
|
+ // 空编号排在最后,两者都为空时保持原顺序。
|
|
|
+ if (codeValue1 === '' || codeValue2 === '') {
|
|
|
+ return codeValue1 === codeValue2 ? 0 : (codeValue1 === '' ? 1 : -1);
|
|
|
+ }
|
|
|
+ let code1 = codeValue1.split('-');
|
|
|
+ let code2 = codeValue2.split('-');
|
|
|
let code1length = code1.length;
|
|
|
let code2length = code2.length;
|
|
|
for (let i = 0; i < code1length; i ++) {
|