|
@@ -986,12 +986,20 @@ $(document).ready(function() {
|
|
|
const select = SpreadJsObj.getSelectObject(sheet);
|
|
|
if (!select || !select.code) return;
|
|
|
|
|
|
- const recursiveSortCode = function (data, parentCode, children) {
|
|
|
+ const getChildSort = function (i, split) {
|
|
|
+ if (i <= 0) throw '参数错误';
|
|
|
+ switch(split) {
|
|
|
+ case '0': return i < 10 ? split + i : i + '';
|
|
|
+ case '-': return split + i;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ const recursiveSortCode = function (data, parentCode, children, split) {
|
|
|
if (!children || children.length === 0) return;
|
|
|
|
|
|
for (const [i, child] of children.entries()) {
|
|
|
if (!child.b_code || child.b_code === '') {
|
|
|
- const code = parentCode + '-' + (i + 1);
|
|
|
+ const code = parentCode + getChildSort(i + 1, split);
|
|
|
const cData = tree.getNodeKeyData(child);
|
|
|
cData.code = code;
|
|
|
data.push(cData);
|
|
@@ -1002,7 +1010,7 @@ $(document).ready(function() {
|
|
|
}
|
|
|
};
|
|
|
const data = [];
|
|
|
- recursiveSortCode(data, select.code, select.children);
|
|
|
+ recursiveSortCode(data, select.code, select.children, tree.getCodeSplit());
|
|
|
if (data.length > 0) {
|
|
|
postData(window.location.pathname + '/update', {postType: 'update', postData: data}, function (result) {
|
|
|
const refreshNode = tree.loadPostData(result);
|
|
@@ -1420,12 +1428,12 @@ $(document).ready(function() {
|
|
|
icon: 'fa-sort-numeric-asc',
|
|
|
disabled: function (key, opt) {
|
|
|
const node = SpreadJsObj.getSelectObject(ledgerSpread.getActiveSheet());
|
|
|
- return !node || !node.code || !node.children || node.children === 0 || node.code.indexOf('-') < 0;
|
|
|
+ return !node || !node.code || !node.children || node.children === 0;// || node.code.indexOf('-') < 0;
|
|
|
},
|
|
|
callback: function (key, opt) {
|
|
|
treeOperationObj.sortCode(ledgerSpread.getActiveSheet());
|
|
|
},
|
|
|
- visible: function (key, opt) {;
|
|
|
+ visible: function (key, opt) {
|
|
|
return !readOnly;
|
|
|
}
|
|
|
};
|