|
@@ -102,12 +102,6 @@ $(document).ready(() => {
|
|
|
headerFont: '12px 微软雅黑',
|
|
|
font: '12px 微软雅黑',
|
|
|
readOnly: true,
|
|
|
- // getColor: function (sheet, data, row, col, defaultColor) {
|
|
|
- // return data && data.valid ? defaultColor : '#ddd';
|
|
|
- // },
|
|
|
- getForeColor: function (sheet, data, row, col, defaultColor) {
|
|
|
- return data && data.valid ? defaultColor : '#ddd';
|
|
|
- },
|
|
|
};
|
|
|
sjsSettingObj.setFxTreeStyle(priceBwSpreadSetting, sjsSettingObj.FxTreeStyle.jz);
|
|
|
const priceChangeSpreadSetting = {
|
|
@@ -159,19 +153,12 @@ $(document).ready(() => {
|
|
|
return a.order - b.order;
|
|
|
});
|
|
|
}
|
|
|
- analysisRelaLid(price) {
|
|
|
- const tree = this.tree;
|
|
|
- const rela_lid = price.rela_lid ? price.rela_lid.split(',') : [];
|
|
|
- price.rela_hint = rela_lid.map(x => {
|
|
|
- const node = tree.getItems(parseInt(x));
|
|
|
- return node ? node.code || node.name : '';
|
|
|
- }).join(',');
|
|
|
- }
|
|
|
loadDatas(datas, treeData, changeData) {
|
|
|
this.data = datas;
|
|
|
this.tree.loadDatas(treeData);
|
|
|
this.resortData();
|
|
|
this.change = changeData;
|
|
|
+ this.relaChange = [];
|
|
|
if (this.data.length > 0) this.refreshRela(this.data[0]);
|
|
|
}
|
|
|
loadUpdateData(updateData) {
|
|
@@ -207,25 +194,14 @@ $(document).ready(() => {
|
|
|
}
|
|
|
refreshTreeRela(price, samePrice) {
|
|
|
if (price.rela_lid) {
|
|
|
- const choose = price.rela_lid.split(',');
|
|
|
- for (const node of this.tree.nodes) {
|
|
|
- node.rela = choose.indexOf(node.ledger_id + '') >= 0;
|
|
|
- }
|
|
|
- for (const node of this.tree.nodes) {
|
|
|
- node.valid = node.rela || this.tree.checkParent(node, 'rela') || this.tree.checkChildren(node, 'rela');
|
|
|
- }
|
|
|
+ this.tree.loadFilter(price.rela_lid);
|
|
|
} else {
|
|
|
const invalid = [];
|
|
|
for (const sp of samePrice) {
|
|
|
const lid = sp.rela_lid ? sp.rela_lid.split(',') : [];
|
|
|
invalid.push(...lid);
|
|
|
}
|
|
|
- for (const node of this.tree.nodes) {
|
|
|
- node.rela = invalid.indexOf(node.ledger_id + '') >= 0;
|
|
|
- }
|
|
|
- for (const node of this.tree.nodes) {
|
|
|
- node.valid = !(node.rela || this.tree.checkParent(node, 'rela'));
|
|
|
- }
|
|
|
+ this.tree.loadFilter(invalid.join(','), 'access');
|
|
|
}
|
|
|
}
|
|
|
refreshChangeRela(price, samePrice) {
|
|
@@ -253,6 +229,11 @@ $(document).ready(() => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ this.relaChange.length = 0;
|
|
|
+
|
|
|
+ for (const c of this.change) {
|
|
|
+ if (c.valid) this.relaChange.push(c);
|
|
|
+ }
|
|
|
}
|
|
|
refreshRela(price) {
|
|
|
const samePrice = this.getSamePrice(price);
|
|
@@ -458,10 +439,8 @@ $(document).ready(() => {
|
|
|
selectionChanged: function () {
|
|
|
const price = SpreadJsObj.getSelectObject(priceSheet);
|
|
|
revisePrice.refreshRela(price);
|
|
|
- // SpreadJsObj.reloadRowBackColor(priceBwSheet, 0, priceBwSheet.getRowCount());
|
|
|
- // SpreadJsObj.reloadRowBackColor(priceChangeSheet, 0, priceChangeSheet.getRowCount());
|
|
|
- SpreadJsObj.reloadRowForeColor(priceBwSheet, 0, priceBwSheet.getRowCount());
|
|
|
- SpreadJsObj.reloadRowForeColor(priceChangeSheet, 0, priceChangeSheet.getRowCount());
|
|
|
+ SpreadJsObj.refreshTreeRowVisible(priceBwSheet);
|
|
|
+ SpreadJsObj.reLoadSheetData(priceChangeSheet);
|
|
|
},
|
|
|
};
|
|
|
if (!readOnly) {
|
|
@@ -864,7 +843,6 @@ $(document).ready(() => {
|
|
|
}
|
|
|
};
|
|
|
SpreadJsObj.initSheet(this.sheet, spreadSetting);
|
|
|
- const self = this;
|
|
|
this.spread.bind(spreadNS.Events.ButtonClicked, function (e, info) {
|
|
|
const sheet = info.sheet, cellType = sheet.getCellType(info.row, info.col);
|
|
|
if (!sheet.zh_setting) return;
|
|
@@ -903,11 +881,11 @@ $(document).ready(() => {
|
|
|
for (const c of this.change) {
|
|
|
c.check = this.choose.indexOf(c.cid + '') >= 0;
|
|
|
c.invalid = this.invalid.indexOf(c.cid + '') >= 0;
|
|
|
- if (!c.check && c.invalid) {
|
|
|
+ if (!c.check && !c.invalid) {
|
|
|
const exist = c.bills.find(x => {
|
|
|
return x.code === price.b_code && x.name === price.name && x.unit === price.unit && x.unit_price === price.org_price;
|
|
|
});
|
|
|
- c.invalid = !exist;
|
|
|
+ c.visible = !exist;
|
|
|
}
|
|
|
}
|
|
|
$('#choose-rela-change').modal('show');
|
|
@@ -922,7 +900,7 @@ $(document).ready(() => {
|
|
|
chooseRelaBw.loadTree(result.bills);
|
|
|
chooseRelaChange.loadChange(result.change);
|
|
|
SpreadJsObj.loadSheetData(priceBwSheet, SpreadJsObj.DataType.Tree, revisePrice.tree);
|
|
|
- SpreadJsObj.loadSheetData(priceChangeSheet, SpreadJsObj.DataType.Data, revisePrice.change);
|
|
|
+ SpreadJsObj.loadSheetData(priceChangeSheet, SpreadJsObj.DataType.Data, revisePrice.relaChange);
|
|
|
$("[content='#ledgerGcl']").click();
|
|
|
});
|
|
|
|