|
@@ -205,8 +205,14 @@ $(document).ready(() => {
|
|
|
if (info.sheet.zh_setting) {
|
|
|
const select = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
const col = info.sheet.zh_setting.cols[info.col];
|
|
|
- if (materialExponentCol.readOnly.isEdit(select)) {
|
|
|
- return;
|
|
|
+ if (col.field === 'weight_num') {
|
|
|
+ if(materialExponentCol.readOnly.isConstant(select)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if(materialExponentCol.readOnly.isEdit(select)) {
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
if (col.field === 'is_summary') {
|
|
|
if (info.sheet.isEditing()) {
|
|
@@ -227,7 +233,43 @@ $(document).ready(() => {
|
|
|
}
|
|
|
},
|
|
|
deletePress: function (sheet) {
|
|
|
- return;
|
|
|
+ if (sheet.zh_setting && sheet.zh_data) {
|
|
|
+ const sel = sheet.getSelections()[0];
|
|
|
+ if (!sel) return;
|
|
|
+
|
|
|
+ const col = sheet.zh_setting.cols[sel.col];
|
|
|
+ const select = SpreadJsObj.getSelectObject(sheet);
|
|
|
+ const orgValue = select[col.field];
|
|
|
+ if (sel.colCount > 1) {
|
|
|
+ toastr.warning('请勿同时删除多列数据');
|
|
|
+ }
|
|
|
+ if (orgValue === null || col.field === 'type' || col.field === 'is_summary') {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (col.field === 'weight_num') {
|
|
|
+ if(materialExponentCol.readOnly.isConstant(select)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if(materialExponentCol.readOnly.isEdit(select)) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ select[col.field] = null;
|
|
|
+ select.calc_num = materialExponentCol.getValue.calc_num(select);
|
|
|
+ // console.log(select);
|
|
|
+ // 更新至服务器
|
|
|
+ postData(window.location.pathname + '/save', { type:'update', updateData: select }, function (result) {
|
|
|
+ ex_tp = result.ex_tp;
|
|
|
+ ex_expr = result.ex_expr;
|
|
|
+ resetExTpTable();
|
|
|
+ SpreadJsObj.reLoadRowData(sheet, sel.row);
|
|
|
+ materialExponentData.splice(sel.row, 1, select);
|
|
|
+ }, function () {
|
|
|
+ select[col.field] = orgValue;
|
|
|
+ SpreadJsObj.reLoadRowData(sheet, sel.row);
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
clipboardPasted(e, info) {
|
|
|
const hint = {
|