|
@@ -915,7 +915,7 @@ class TreeService extends Service {
|
|
|
if (!count) count = 1;
|
|
|
const selects = await this.getDataByKidAndCount(mid, kid, count);
|
|
|
if (!selects) throw '降级节点数据错误';
|
|
|
- const first = selects[0];
|
|
|
+ const first = selects[0], last = selects[count - 1];
|
|
|
const pre = await this.getDataByParentAndOrder(mid, first[this.setting.pid], first[this.setting.order] - 1);
|
|
|
if (!pre) throw '节点不可降级';
|
|
|
const preLastChild = await this.getLastChildData(mid, pre[this.setting.kid]);
|
|
@@ -924,7 +924,7 @@ class TreeService extends Service {
|
|
|
this.transaction = await this.db.beginTransaction();
|
|
|
try {
|
|
|
// 选中节点--全部后节点 order--
|
|
|
- await this._updateChildrenOrder(mid, first[this.setting.pid], first[this.setting.order] + 1, -count);
|
|
|
+ await this._updateChildrenOrder(mid, first[this.setting.pid], last[this.setting.order] + 1, -count);
|
|
|
|
|
|
for (const [i, s] of selects.entries()) {
|
|
|
// 选中节点 修改pid, level, order, full_path
|