|
@@ -59,8 +59,15 @@ $(document).ready(() => {
|
|
|
if (col.type === 'Number') {
|
|
|
const data = SpreadJsObj.getSelectObject(sheet);
|
|
|
if (data) {
|
|
|
- $('#bills-expr').val(data[col.field]).attr('field', col.field).attr('org', data[col.field])
|
|
|
- .attr('readOnly', readOnly || cell.locked() || (data.children && data.children.length > 0));
|
|
|
+ $('#bills-expr').val(data[col.field]).attr('field', col.field).attr('org', data[col.field]);
|
|
|
+
|
|
|
+ if (col.field.indexOf('dgn') >= 0) {
|
|
|
+ $('#bills-expr').attr('readOnly', readOnly || cell.locked() || data.b_code);
|
|
|
+ } else if (col.field === 'unit_price') {
|
|
|
+ $('#bills-expr').attr('readOnly', readOnly || cell.locked() || (data.children && data.children.length > 0) || node.used);
|
|
|
+ } else {
|
|
|
+ $('#bills-expr').attr('readOnly', readOnly || cell.locked() || (data.children && data.children.length > 0));
|
|
|
+ }
|
|
|
} else {
|
|
|
$('#bills-expr').val('').attr('readOnly', true);
|
|
|
}
|
|
@@ -563,6 +570,12 @@ $(document).ready(() => {
|
|
|
$('a[name="base-opr"]').click(function () {
|
|
|
billsTreeSpreadObj.baseOpr(billsSheet, this.getAttribute('type'));
|
|
|
});
|
|
|
+ $('a[name=cpc]').click(function () {
|
|
|
+ billsSpread.commandManager().execute({
|
|
|
+ cmd: this.getAttribute('type'),
|
|
|
+ sheetName: billsSpread.getActiveSheet().name()
|
|
|
+ });
|
|
|
+ });
|
|
|
|
|
|
$('#bills-expr').bind('change mouseleave', function () {
|
|
|
if (this.readOnly) return;
|
|
@@ -577,16 +590,20 @@ $(document).ready(() => {
|
|
|
tender_id: select.tender_id,
|
|
|
ledger_id: select.ledger_id
|
|
|
};
|
|
|
- const num = _.toNumber(newValue);
|
|
|
- if (num) {
|
|
|
- data[field] = num;
|
|
|
- } else {
|
|
|
- try {
|
|
|
- data[field] = math.evaluate(transExpr(newValue));
|
|
|
- } catch (err) {
|
|
|
- toastr.error('输入的表达式非法');
|
|
|
- return;
|
|
|
+ if (newValue !== '') {
|
|
|
+ const num = _.toNumber(newValue);
|
|
|
+ if (num) {
|
|
|
+ data[field] = num;
|
|
|
+ } else {
|
|
|
+ try {
|
|
|
+ data[field] = math.evaluate(transExpr(newValue));
|
|
|
+ } catch (err) {
|
|
|
+ toastr.error('输入的表达式非法');
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
+ } else {
|
|
|
+ data[field] = null;
|
|
|
}
|
|
|
|
|
|
// 更新至服务器
|
|
@@ -1001,16 +1018,20 @@ $(document).ready(() => {
|
|
|
if (orgValue === newValue || (!orgValue && newValue == '')) { return; }
|
|
|
|
|
|
const data = {id: select.id};
|
|
|
- const num = _.toNumber(newValue);
|
|
|
- if (num) {
|
|
|
- data[field] = num;
|
|
|
- } else {
|
|
|
- try {
|
|
|
- data[field] = math.evaluate(transExpr(newValue));
|
|
|
- } catch (err) {
|
|
|
- toastr.error('输入的表达式非法');
|
|
|
- return;
|
|
|
+ if (newValue !== '') {
|
|
|
+ const num = _.toNumber(newValue);
|
|
|
+ if (num) {
|
|
|
+ data[field] = num;
|
|
|
+ } else {
|
|
|
+ try {
|
|
|
+ data[field] = math.evaluate(transExpr(newValue));
|
|
|
+ } catch (err) {
|
|
|
+ toastr.error('输入的表达式非法');
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
+ } else {
|
|
|
+ data[field] = null;
|
|
|
}
|
|
|
|
|
|
// 更新至服务器
|