|
@@ -518,7 +518,7 @@ $(document).ready(() => {
|
|
|
const node = sortData[info.row], updateData = {};
|
|
|
|
|
|
const orgValue = node[col.field];
|
|
|
- let newValue = info.editingText;
|
|
|
+ let newValue = trimInvalidChar(info.editingText);
|
|
|
if (orgValue == newValue || ((!orgValue || orgValue === '') && (!newValue || newValue === ''))) {
|
|
|
return;
|
|
|
}
|
|
@@ -708,7 +708,7 @@ $(document).ready(() => {
|
|
|
if (nodePos && nodePos.length > 0) continue;
|
|
|
}
|
|
|
|
|
|
- const text = sheet.getText(curRow, curCol);
|
|
|
+ const text = trimInvalidChar(sheet.getText(curRow, curCol));
|
|
|
if (setting.dgnUpFields.indexOf(col.field) !== -1) {
|
|
|
const num = _.toNumber(text);
|
|
|
if (num) {
|
|
@@ -922,7 +922,8 @@ $(document).ready(() => {
|
|
|
const posData = sortData ? sortData[info.row] : null;
|
|
|
const col = info.sheet.zh_setting.cols[info.col];
|
|
|
const orgText = posData ? posData[col.field] : null;
|
|
|
- if (orgText === info.editingText || ((!orgText || orgText === '') && (info.editingText === ''))) {
|
|
|
+ const newText = trimInvalidChar(info.editingText);
|
|
|
+ if (orgText === info.editingText || ((!orgText || orgText === '') && (newText === ''))) {
|
|
|
return;
|
|
|
}
|
|
|
// 台账模式下,不可新增
|
|
@@ -938,11 +939,11 @@ $(document).ready(() => {
|
|
|
toastr.warning('数据错误, 请刷新页面后再试');
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
return;
|
|
|
- } else if (info.editingText !== '' && node.children && node.children > 0) {
|
|
|
+ } else if (newText !== '' && node.children && node.children > 0) {
|
|
|
toastr.error('父节点不可插入计量单元');
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
return;
|
|
|
- } else if (info.editingText !== '' && !node.b_code || node.b_code === '') {
|
|
|
+ } else if (newText !== '' && !node.b_code || node.b_code === '') {
|
|
|
toastr.error('项目节不可插入计量单元');
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
return;
|
|
@@ -950,22 +951,22 @@ $(document).ready(() => {
|
|
|
// 生成提交数据
|
|
|
const data = {};
|
|
|
if (col.field === 'name') {
|
|
|
- if ((!info.editingText || info.editingText === '') && posData) {
|
|
|
+ if ((!newText || newText === '') && posData) {
|
|
|
toastr.error('部位名称不可为空');
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
return;
|
|
|
} else if (!posData) {
|
|
|
- if (info.editingText !== '') {
|
|
|
+ if (newText !== '') {
|
|
|
data.updateType = 'add';
|
|
|
const order = (!sortData || sortData.length === 0) ? 1 : Math.max(sortData[sortData.length - 1].porder + 1, sortData.length + 1);
|
|
|
- data.updateData = {name: info.editingText, lid: node.id, tid: tender.id, porder: order};
|
|
|
+ data.updateData = {name: newText, lid: node.id, tid: tender.id, porder: order};
|
|
|
} else {
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
return;
|
|
|
}
|
|
|
} else {
|
|
|
data.updateType = 'update';
|
|
|
- data.updateData = {pid: posData.id, lid: posData.lid, name: info.editingText};
|
|
|
+ data.updateData = {pid: posData.id, lid: posData.lid, name: newText};
|
|
|
}
|
|
|
} else if (!posData) {
|
|
|
toastr.warning('新增部位请先输入名称');
|
|
@@ -973,12 +974,12 @@ $(document).ready(() => {
|
|
|
data.updateType = 'update';
|
|
|
data.updateData = {pid: posData.id, lid: posData.lid};
|
|
|
if (col.type === 'Number') {
|
|
|
- const num = _.toNumber(info.editingText);
|
|
|
+ const num = _.toNumber(newText);
|
|
|
if (num) {
|
|
|
data.updateData[col.field] = num;
|
|
|
} else {
|
|
|
try {
|
|
|
- data.updateData[col.field] = math.evaluate(transExpr(info.editingText));
|
|
|
+ data.updateData[col.field] = math.evaluate(transExpr(newText));
|
|
|
} catch(err) {
|
|
|
toastr.error('输入的表达式非法');
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
@@ -986,7 +987,7 @@ $(document).ready(() => {
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- data.updateData[col.field] = info.editingText;
|
|
|
+ data.updateData[col.field] = newText;
|
|
|
}
|
|
|
}
|
|
|
// 提交数据到服务器
|
|
@@ -1060,7 +1061,7 @@ $(document).ready(() => {
|
|
|
for (let iCol = 0; iCol < info.cellRange.colCount; iCol++) {
|
|
|
const curCol = info.cellRange.col + iCol;
|
|
|
const colSetting = info.sheet.zh_setting.cols[curCol];
|
|
|
- newData[colSetting.field] = info.sheet.getText(curRow, curCol);
|
|
|
+ newData[colSetting.field] = trimInvalidChar(info.sheet.getText(curRow, curCol));
|
|
|
if (colSetting.type === 'Number') {
|
|
|
const num = _.toNumber(newData[colSetting.field]);
|
|
|
if (num) {
|
|
@@ -1089,7 +1090,7 @@ $(document).ready(() => {
|
|
|
for (let iCol = 0; iCol < info.cellRange.colCount; iCol++) {
|
|
|
const curCol = info.cellRange.col + iCol;
|
|
|
const colSetting = info.sheet.zh_setting.cols[curCol];
|
|
|
- newData[colSetting.field] = info.sheet.getText(curRow, curCol);
|
|
|
+ newData[colSetting.field] = trimInvalidChar(info.sheet.getText(curRow, curCol));
|
|
|
if (colSetting.type === 'Number') {
|
|
|
const num = _.toNumber(newData[colSetting.field]);
|
|
|
if (num) {
|
|
@@ -1109,7 +1110,6 @@ $(document).ready(() => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- console.log(data);
|
|
|
postData(window.location.pathname + '/update', {pos: data}, function (result) {
|
|
|
if (result.pos) {
|
|
|
stagePos.updateDatas(result.pos.pos);
|