|
@@ -632,6 +632,13 @@ class TreeService extends Service {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 节点成为父项时,可能需要修改父项数据,供子类继承
|
|
|
+ * @param data
|
|
|
+ */
|
|
|
+ clearParentingData(data) {
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 升级selectData, 同步修改所有子节点
|
|
|
* @param {Object} selectData - 升级操作,选中节点
|
|
|
* @return {Object}
|
|
@@ -763,11 +770,7 @@ class TreeService extends Service {
|
|
|
const nexts = await this.getNextsData(mid, parent[this.setting.kid], last[this.setting.order]);
|
|
|
if (nexts.length > 0) {
|
|
|
updateData.is_leaf = false;
|
|
|
- // updateData.unit_price = null;
|
|
|
- // updateData.quantity = null;
|
|
|
- // updateData.total_price = null;
|
|
|
- // updateData.deal_qty = null;
|
|
|
- // updateData.deal_tp = null;
|
|
|
+ this.clearParentingData(updateData);
|
|
|
}
|
|
|
}
|
|
|
await this.transaction.update(this.tableName, updateData);
|
|
@@ -832,9 +835,6 @@ class TreeService extends Service {
|
|
|
* @return {Array} - 发生改变的数据
|
|
|
*/
|
|
|
async downLevelNode(mid, kid, count) {
|
|
|
- console.log(mid);
|
|
|
- console.log(kid);
|
|
|
- console.log(count);
|
|
|
if (!count) count = 1;
|
|
|
const selects = await this.getDataByKidAndCount(mid, kid, count);
|
|
|
if (!selects) throw '降级节点数据错误';
|
|
@@ -842,8 +842,6 @@ class TreeService extends Service {
|
|
|
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]);
|
|
|
- console.log(selects);
|
|
|
- console.log(pre);
|
|
|
|
|
|
const newPath = [];
|
|
|
this.transaction = await this.db.beginTransaction();
|
|
@@ -868,11 +866,7 @@ class TreeService extends Service {
|
|
|
// 选中节点--前兄弟节点 is_leaf应为false, 清空计算相关字段
|
|
|
const updateData2 = { id: pre.id };
|
|
|
updateData2[this.setting.isLeaf] = false;
|
|
|
- // updateData2.unit_price = null;
|
|
|
- // updateData2.quantity = null;
|
|
|
- // updateData2.total_price = null;
|
|
|
- // updateData2.deal_qty = null;
|
|
|
- // updateData2.deal_tp = null;
|
|
|
+ this.clearParentingData(updateData2);
|
|
|
await this.transaction.update(this.tableName, updateData2);
|
|
|
await this.transaction.commit();
|
|
|
this.transaction = null;
|