|
@@ -231,7 +231,10 @@ let coeOprObj = {
|
|
|
{ headerName: "名称", headerWidth: 200, dataCode: "name", dataType: "String", hAlign: "left", vAlign: "center", readOnly: false },
|
|
|
{ headerName: "内容", headerWidth: 150, dataCode: "content", dataType: "String", hAlign: "left", vAlign: "center", readOnly: false },
|
|
|
{ headerName: "原人材机编码", headerWidth: 90, dataCode: "original_code", dataType: "String", hAlign: "center", vAlign: "center", readOnly: false },
|
|
|
- { headerName: "可选人材机编码", headerWidth: 150, dataCode: "option_codes", dataType: "String", hAlign: "center", vAlign: "center", readOnly: false }
|
|
|
+ { headerName: "可选人材机编码", headerWidth: 150, dataCode: "option_codes", dataType: "String", hAlign: "center", vAlign: "center", readOnly: false },
|
|
|
+ { headerName: "实际值", headerWidth: 60, dataCode: "actualVal", dataType: "String", hAlign: "center", vAlign: "center", readOnly: false },
|
|
|
+ { headerName: "最大值", headerWidth: 60, dataCode: "maxVal", dataType: "String", hAlign: "center", vAlign: "center", readOnly: false },
|
|
|
+ { headerName: "最小值", headerWidth: 60, dataCode: "minVal", dataType: "String", hAlign: "center", vAlign: "center", readOnly: false },
|
|
|
]
|
|
|
},
|
|
|
buildSheet: function (container) {
|
|
@@ -293,8 +296,10 @@ let coeOprObj = {
|
|
|
alert('该编号已存在!');
|
|
|
args.sheet.setValue(args.row, args.col, updateObj[dataCode] + '');
|
|
|
}
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else if (['actualVal', 'maxVal', 'minVal'].includes(dataCode) && isNaN(inputT)) {
|
|
|
+ alert('只能输入数值!');
|
|
|
+ args.sheet.setValue(args.row, args.col, updateObj[dataCode] || '');
|
|
|
+ } else {
|
|
|
updateObj[dataCode] = inputT;
|
|
|
me.setOptionList(dataCode, inputT, updateObj);
|
|
|
updateArr.push(updateObj);
|
|
@@ -323,6 +328,9 @@ let coeOprObj = {
|
|
|
args.sheet.setValue(args.row, args.col, '');
|
|
|
alert('该编号已存在!');
|
|
|
}
|
|
|
+ } else if (['actualVal', 'maxVal', 'minVal'].includes(dataCode) && isNaN(inputT)) {
|
|
|
+ alert('只能输入数值!');
|
|
|
+ args.sheet.setValue(args.row, args.col, updateObj[dataCode] + '');
|
|
|
}
|
|
|
else {
|
|
|
newCoe.serialNo = ++me.currentMaxNo;
|
|
@@ -359,6 +367,12 @@ let coeOprObj = {
|
|
|
let items = sheetCommonObj.analyzePasteData(me.setting, info);
|
|
|
let uniqItems = me.makeUniqItems(items);
|
|
|
for (let i = 0, len = uniqItems.length; i < len; i++) {
|
|
|
+ for (let attr in uniqItems[i]) {
|
|
|
+ if (['actualVal', 'maxVal', 'minVal'].includes(attr) && isNaN(uniqItems[i][attr])) {
|
|
|
+ uniqItems[i][attr] = undefined;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
let row = i + info.cellRange.row;
|
|
|
//update
|
|
|
if (row < me.currentCoeList.length) {
|
|
@@ -562,8 +576,18 @@ let coeOprObj = {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ keepNumber: function (arr) {
|
|
|
+ arr.forEach(item => {
|
|
|
+ Object.keys(item).forEach(key => {
|
|
|
+ if (['actualVal', 'maxVal', 'minVal'].includes(key)) {
|
|
|
+ item[key] = +item[key];
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
save: function (addArr, updateArr, deleteArr, refresh, callback) {
|
|
|
let me = coeOprObj;
|
|
|
+ // me.keepNumber(updateArr);
|
|
|
$.ajax({
|
|
|
type: "POST",
|
|
|
url: "api/saveCoeList",
|
|
@@ -599,7 +623,7 @@ let coeOprObj = {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-// 验证数量的有效性:可以输入数值,也可以输入表达式,eg: [人材机编码]*1.5+1
|
|
|
+// 验证数量的有效性:可以输入数值,也可以输入表达式,eg: [人材机编码]*1.5+1,1+([v]-50)/100。 [v]代表前台调用时,子目换算实际值
|
|
|
const validateAmount = (amountStr) => {
|
|
|
if (!amountStr) {
|
|
|
return true;
|
|
@@ -609,7 +633,8 @@ const validateAmount = (amountStr) => {
|
|
|
return true;
|
|
|
}
|
|
|
try {
|
|
|
- str = amountStr.replace(/\s/g, '').replace(/\[\d+\]/g, '0');
|
|
|
+ debugger;
|
|
|
+ str = amountStr.replace(/\s/g, '').replace(/\[v\]/g, '0').replace(/\[\d+\]/g, '0');
|
|
|
eval(str);
|
|
|
|
|
|
} catch (error) {
|
|
@@ -723,7 +748,7 @@ let gljAdjOprObj = {
|
|
|
dataCode = me.setting.header[args.col].dataCode;
|
|
|
if (args.editingText && args.editingText.toString().trim().length > 0) {
|
|
|
if (dataCode === 'amount' && !validateAmount(args.editingText)) {
|
|
|
- alert("请输入数值或者表达式,如:[人材机编码]*0.3+1");
|
|
|
+ alert("请输入数值或者表达式,如:[人材机编码]*0.3+1、1+([v]-50)/100");
|
|
|
args.sheet.setValue(args.row, args.col, typeof me.currentGljAdjList[args.row] !== 'undefined' && typeof me.currentGljAdjList[args.row][dataCode] !== 'undefined'
|
|
|
? me.currentGljAdjList[args.row][dataCode] + '' : '');
|
|
|
}
|
|
@@ -891,6 +916,7 @@ let gljAdjOprObj = {
|
|
|
onDelOpr: function (workBook, setting) {
|
|
|
let me = gljAdjOprObj;
|
|
|
workBook.commandManager().register('gljAdjDel', function () {
|
|
|
+ debugger;
|
|
|
let sheet = workBook.getSheet(0);
|
|
|
let sels = sheet.getSelections();
|
|
|
let isUpdate = false;
|