|
@@ -1613,7 +1613,25 @@ let repositoryGljObj = {
|
|
|
}
|
|
|
},
|
|
|
sortGljDeep: function (datas) {
|
|
|
- if(this.currentOprParent){
|
|
|
+ function recurCompare(a, b, index){
|
|
|
+ if (a[index] && b[index]) {
|
|
|
+ let aV = a[index],
|
|
|
+ bV = b[index];
|
|
|
+ if (!isNaN(aV) && !isNaN(bV)) {
|
|
|
+ aV = parseFloat(a[index]),
|
|
|
+ bV = parseFloat(b[index]);
|
|
|
+ }
|
|
|
+ if (aV > bV) {
|
|
|
+ return 1;
|
|
|
+ } else if (aV < bV) {
|
|
|
+ return -1;
|
|
|
+ } else {
|
|
|
+ return recurCompare(a, b, index + 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ /* if(this.currentOprParent){
|
|
|
datas.sort(function (a, b) {
|
|
|
let rst = 0;
|
|
|
if(a.code > b.code){
|
|
@@ -1625,33 +1643,14 @@ let repositoryGljObj = {
|
|
|
return rst;
|
|
|
});
|
|
|
}
|
|
|
- else {
|
|
|
+ else {*/
|
|
|
//排序符号-
|
|
|
datas.sort(function (a, b) {
|
|
|
- let rst = 0;
|
|
|
- let splitA = a.code.split('-'),
|
|
|
- splitB = b.code.split('-');
|
|
|
- if(splitA[0] > splitB[0]){
|
|
|
- rst = 1;
|
|
|
- }
|
|
|
- else if(splitA[0] < splitB[0]){
|
|
|
- rst = -1;
|
|
|
- }
|
|
|
- else {
|
|
|
- if(splitA[1] && splitB[1]){
|
|
|
- let floatA = parseFloat(splitA[1]),
|
|
|
- floatB = parseFloat(splitB[1]);
|
|
|
- if(floatA > floatB){
|
|
|
- rst = 1;
|
|
|
- }
|
|
|
- else if(floatA < floatB){
|
|
|
- rst = -1;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return rst;
|
|
|
+ let aArr = a.code.split('-'),
|
|
|
+ bArr = b.code.split('-');
|
|
|
+ return recurCompare(aArr, bArr, 0);
|
|
|
});
|
|
|
- }
|
|
|
+ // }
|
|
|
},
|
|
|
//工料机排序
|
|
|
sortGlj: function() {
|