|
@@ -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,58 @@ $(document).ready(() => {
|
|
|
}
|
|
|
},
|
|
|
deletePress: function (sheet) {
|
|
|
- return;
|
|
|
+ if (sheet.zh_setting && sheet.zh_data) {
|
|
|
+ const sel = sheet.getSelections()[0];
|
|
|
+ if (!sel) return;
|
|
|
+ const sortData = sheet.zh_data || [];
|
|
|
+ const data = [];
|
|
|
+ for (let iRow = sel.row; iRow < sel.row + sel.rowCount; iRow++) {
|
|
|
+ // let bPaste = true;
|
|
|
+ const exData = sortData[iRow];
|
|
|
+ const materialExData = { id: sortData[iRow].id };
|
|
|
+ for (let iCol = 0; iCol < sel.colCount; iCol++) {
|
|
|
+ const curCol = sel.col + iCol;
|
|
|
+ const colSetting = sheet.zh_setting.cols[curCol];
|
|
|
+ if (!colSetting) continue;
|
|
|
+ const orgValue = sortData[iRow][colSetting.field];
|
|
|
+ if(orgValue === null) {
|
|
|
+ // bPaste = false;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (exData.type === materialType.ex_type[0].value && colSetting.field !== 'weight_num') {
|
|
|
+ // bPaste = false;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (colSetting.field === 'type' || colSetting.field === 'calc_num' || colSetting.field === 'is_summary'){
|
|
|
+ // bPaste = false;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ materialExData[colSetting.field] = null;
|
|
|
+ sortData[iRow][colSetting.field] = null;
|
|
|
+ }
|
|
|
+ if (exData.type !== materialType.ex_type[0].value) materialExData.calc_num = materialExponentCol.getValue.calc_num(sortData[iRow]);
|
|
|
+ const arr = Object.keys(materialExData);
|
|
|
+ if (arr.length !== 1) {
|
|
|
+ data.push(materialExData);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (data.length === 0) {
|
|
|
+ SpreadJsObj.reLoadSheetData(sheet);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // console.log(data);
|
|
|
+ // 更新至服务器
|
|
|
+ postData(window.location.pathname + '/save', { type:'paste', updateData: data }, function (result) {
|
|
|
+ materialExponentData = result.info;
|
|
|
+ SpreadJsObj.loadSheetData(materialExponentSpread.getActiveSheet(), SpreadJsObj.DataType.Data, materialExponentData);
|
|
|
+ ex_tp = result.ex_tp;
|
|
|
+ ex_expr = result.ex_expr;
|
|
|
+ resetExTpTable();
|
|
|
+ }, function () {
|
|
|
+ SpreadJsObj.reLoadSheetData(sheet);
|
|
|
+ return;
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
clipboardPasted(e, info) {
|
|
|
const hint = {
|
|
@@ -302,7 +359,6 @@ $(document).ready(() => {
|
|
|
continue;
|
|
|
}
|
|
|
const total_weight = ZhCalc.add(ZhCalc.sub(_.sumBy(materialExponentData, 'weight_num'), parseFloat(orgValue)), num);
|
|
|
- console.log(total_weight, _.sumBy(materialExponentData, 'weight_num'), orgValue, num);
|
|
|
if (total_weight > 1) {
|
|
|
toastMessageUniq(getPasteHint(hint.weightNumberCan, hintRow));
|
|
|
bPaste = false;
|