|
@@ -2399,6 +2399,37 @@ $(document).ready(() => {
|
|
}
|
|
}
|
|
return;
|
|
return;
|
|
};
|
|
};
|
|
|
|
+ xmjSpreadObj.setAllValuation = function (is_valuation) {
|
|
|
|
+ const select = SpreadJsObj.getSelectObject(changeSpreadSheet);
|
|
|
|
+ if (!select) {
|
|
|
|
+ toastr.error('未选中清单');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (!select.children || select.children.length === 0) {
|
|
|
|
+ toastr.warning('暂无清单无法设置清单计价');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ const needChangeList = _.filter(select.children, { is_valuation: is_valuation ? 0 : 1 });
|
|
|
|
+ if (needChangeList.length === 0) {
|
|
|
|
+ toastr.warning('全部已设置清单'+ (is_valuation ? '' : '不') +'计价');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ const realNeedChangeList = [];
|
|
|
|
+ for (const nc of needChangeList) {
|
|
|
|
+ if (_.findIndex(changeUsedData, { cbid: nc.id }) === -1) {
|
|
|
|
+ realNeedChangeList.push(nc.id);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (realNeedChangeList.length === 0) {
|
|
|
|
+ toastr.warning('全部已设置清单'+ (is_valuation ? '' : '不') +'计价');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ postData(window.location.pathname + '/save', { type:'set_all_valuation', ids: realNeedChangeList, is_valuation }, function (result) {
|
|
|
|
+ changeList = result;
|
|
|
|
+ const [newChangeList, updateOrderList] = changeSpreadObj.makeNewChangeList();
|
|
|
|
+ changeSpreadObj.reloadSheet(newChangeList);
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
|
|
// 表达式判断
|
|
// 表达式判断
|
|
$('#xmj-camount-expr').change(function () {
|
|
$('#xmj-camount-expr').change(function () {
|
|
@@ -2735,18 +2766,34 @@ $(document).ready(() => {
|
|
},
|
|
},
|
|
sprEdit: '----',
|
|
sprEdit: '----',
|
|
'allNotValuation': {
|
|
'allNotValuation': {
|
|
- name: '设置全部清单不计价',
|
|
|
|
|
|
+ name: '设置全部不计价',
|
|
icon: 'fa-magic',
|
|
icon: 'fa-magic',
|
|
callback: function (key, opt) {
|
|
callback: function (key, opt) {
|
|
- changeSpreadObj.setAllValuation(0);
|
|
|
|
|
|
+ xmjSpreadObj.setAllValuation(0);
|
|
},
|
|
},
|
|
|
|
+ disabled: function (key, opt) {
|
|
|
|
+ const select = SpreadJsObj.getSelectObject(changeSpreadSheet);
|
|
|
|
+ if (select.children && select.children.length > 0) {
|
|
|
|
+ return false;
|
|
|
|
+ } else {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
},
|
|
},
|
|
'allValuation': {
|
|
'allValuation': {
|
|
- name: '设置全部清单计价',
|
|
|
|
|
|
+ name: '设置全部计价',
|
|
icon: 'fa-magic',
|
|
icon: 'fa-magic',
|
|
callback: function (key, opt) {
|
|
callback: function (key, opt) {
|
|
- changeSpreadObj.setAllValuation(1);
|
|
|
|
|
|
+ xmjSpreadObj.setAllValuation(1);
|
|
},
|
|
},
|
|
|
|
+ disabled: function (key, opt) {
|
|
|
|
+ const select = SpreadJsObj.getSelectObject(changeSpreadSheet);
|
|
|
|
+ if (select.children && select.children.length > 0) {
|
|
|
|
+ return false;
|
|
|
|
+ } else {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
},
|
|
},
|
|
}
|
|
}
|
|
});
|
|
});
|