|
@@ -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) {
|
|
@@ -837,117 +837,6 @@ $(document).ready(() => {
|
|
|
slSpread.bind(spreadNS.Events.ClipboardPasted, stageTreeSpreadObj.clipboardPasted);
|
|
|
slSpread.bind(spreadNS.Events.TopRowChanged, stageTreeSpreadObj.topRowChanged);
|
|
|
SpreadJsObj.addDeleteBind(slSpread, stageTreeSpreadObj.deletePress);
|
|
|
- $.contextMenu({
|
|
|
- selector: '#stage-ledger',
|
|
|
- build: function ($trigger, e) {
|
|
|
- const target = SpreadJsObj.safeRightClickSelection($trigger, e, slSpread);
|
|
|
- return target.hitTestType === spreadNS.SheetArea.viewport || target.hitTestType === spreadNS.SheetArea.rowHeader;
|
|
|
- },
|
|
|
- items: {
|
|
|
- 'measureAll': {
|
|
|
- name: '计量其下所有计量单元',
|
|
|
- icon: 'fa-rocket',
|
|
|
- callback: function (key, opt) {
|
|
|
- const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
- stageTreeSpreadObj.measureAllPosInNode(node);
|
|
|
- },
|
|
|
- visible: function (key, opt) {
|
|
|
- const select = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
- return select;
|
|
|
- }
|
|
|
- },
|
|
|
- 'measureAllFiveTenth': {
|
|
|
- name: '计量其下所有计量单元(计量50%)',
|
|
|
- icon: 'fa-plane',
|
|
|
- callback: function (key, opt) {
|
|
|
- const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
- stageTreeSpreadObj.measureAllPosInNode(node, 0.5);
|
|
|
- },
|
|
|
- visible: function (key, opt) {
|
|
|
- const select = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
- return select;
|
|
|
- }
|
|
|
- },
|
|
|
- 'measureAllOneTenth': {
|
|
|
- name: '计量其下所有计量单元(计量10%)',
|
|
|
- icon: 'fa-car',
|
|
|
- callback: function (key, opt) {
|
|
|
- const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
- stageTreeSpreadObj.measureAllPosInNode(node, 0.1);
|
|
|
- },
|
|
|
- visible: function (key, opt) {
|
|
|
- const select = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
- return select;
|
|
|
- }
|
|
|
- },
|
|
|
- 'hint1': {
|
|
|
- name: '最多计量200条清单下1000条计量单元',
|
|
|
- className: 'text-danger',
|
|
|
- visible: function (key, opt) {
|
|
|
- const select = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
- return select;
|
|
|
- },
|
|
|
- disabled: function (key, opt) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- },
|
|
|
- 'hint1_1': {
|
|
|
- name: '(计数以清单为准,会计完清单下全部部位)',
|
|
|
- className: 'text-danger',
|
|
|
- visible: function (key, opt) {
|
|
|
- const select = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
- return select;
|
|
|
- },
|
|
|
- disabled: function (key, opt) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- },
|
|
|
- 'hint2': {
|
|
|
- name: '可再次使用该功能计量剩下的节点',
|
|
|
- className: 'text-danger',
|
|
|
- visible: function (key, opt) {
|
|
|
- const select = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
- return select;
|
|
|
- },
|
|
|
- disabled: function (key, opt) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- },
|
|
|
- 'hint2_2': {
|
|
|
- name: '(凡是计量的部位,不论计量多少,均不再计量)',
|
|
|
- className: 'text-danger',
|
|
|
- visible: function (key, opt) {
|
|
|
- const select = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
- return select;
|
|
|
- },
|
|
|
- disabled: function (key, opt) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- },
|
|
|
- 'hint3': {
|
|
|
- name: '如提示数据过多后,未成功,请缩小范围再试',
|
|
|
- className: 'text-danger',
|
|
|
- visible: function (key, opt) {
|
|
|
- const select = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
- return select;
|
|
|
- },
|
|
|
- disabled: function (key, opt) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- },
|
|
|
- 'hint4': {
|
|
|
- name: '该功能仅供测试用,请勿滥用,可能导致服务挂掉',
|
|
|
- className: 'text-danger',
|
|
|
- visible: function (key, opt) {
|
|
|
- const select = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
- return select;
|
|
|
- },
|
|
|
- disabled: function (key, opt) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- },
|
|
|
- }
|
|
|
- });
|
|
|
if (!readOnly) {
|
|
|
$('#bills-expr').bind('change mouseleave', function () {
|
|
|
if (this.readOnly) return;
|
|
@@ -1033,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;
|
|
|
}
|
|
|
// 台账模式下,不可新增
|
|
@@ -1049,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;
|
|
@@ -1061,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('新增部位请先输入名称');
|
|
@@ -1084,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);
|
|
@@ -1097,7 +987,7 @@ $(document).ready(() => {
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- data.updateData[col.field] = info.editingText;
|
|
|
+ data.updateData[col.field] = newText;
|
|
|
}
|
|
|
}
|
|
|
// 提交数据到服务器
|
|
@@ -1164,14 +1054,15 @@ $(document).ready(() => {
|
|
|
self.loadCurPosData();
|
|
|
return;
|
|
|
}
|
|
|
+ const lastOrder = sortData.length > 0 ? sortData[sortData.length - 1].porder + 1 : 1;
|
|
|
for (let iRow = 0; iRow < info.cellRange.rowCount; iRow++) {
|
|
|
const curRow = info.cellRange.row + iRow;
|
|
|
- const newData = {lid: node.id};
|
|
|
+ const newData = {lid: node.id, porder: lastOrder + curRow - sortData.length};
|
|
|
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);
|
|
|
- if (col.type === 'Number') {
|
|
|
+ newData[colSetting.field] = trimInvalidChar(info.sheet.getText(curRow, curCol));
|
|
|
+ if (colSetting.type === 'Number') {
|
|
|
const num = _.toNumber(newData[colSetting.field]);
|
|
|
if (num) {
|
|
|
newData[colSetting.field] = num;
|
|
@@ -1199,8 +1090,8 @@ $(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);
|
|
|
- if (col.type === 'Number') {
|
|
|
+ newData[colSetting.field] = trimInvalidChar(info.sheet.getText(curRow, curCol));
|
|
|
+ if (colSetting.type === 'Number') {
|
|
|
const num = _.toNumber(newData[colSetting.field]);
|
|
|
if (num) {
|
|
|
newData[colSetting.field] = num;
|
|
@@ -1219,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);
|
|
@@ -1513,7 +1403,7 @@ $(document).ready(() => {
|
|
|
cols: [
|
|
|
{title: '项目节编号', field: 'code', hAlign: 0, width: 120, formatter: '@'},
|
|
|
{title: '清单编号', field: 'b_code', hAlign: 0, width: 80, formatter: '@'},
|
|
|
- {title: '名称', field: 'name', width: 230, hAlign: 0, formatter: '@'},
|
|
|
+ {title: '名称', field: 'name', width: 150, hAlign: 0, formatter: '@'},
|
|
|
{title: '单位', field: 'unit', width: 50, hAlign: 1, formatter: '@'},
|
|
|
{title: '单价', field: 'unit_price', hAlign: 2, width: 50},
|
|
|
{title: '数量', field: 'quantity', hAlign: 2, width: 50},
|
|
@@ -1796,11 +1686,11 @@ $(document).ready(() => {
|
|
|
this.spreadSetting = {
|
|
|
cols: [
|
|
|
{title: '编号', colSpan: '1', rowSpan: '1', field: 'code', hAlign: 0, width: 80, formatter: '@', readOnly: true},
|
|
|
- {title: '中间计量表号', colSpan: '1', rowSpan: '1', field: 'im_code', hAlign: 0, width: 150, formatter: '@', readOnly: true},
|
|
|
- {title: '交工证书/凭证号', colSpan: '1', rowSpan: '1', field: 'doc_code', hAlign: 0, width: 180, formatter: '@'},
|
|
|
+ {title: '中间计量表号', colSpan: '1', rowSpan: '1', field: 'im_code', hAlign: 0, width: 85, formatter: '@', readOnly: true},
|
|
|
+ {title: '交工证书/凭证号', colSpan: '1', rowSpan: '1', field: 'doc_code', hAlign: 0, width: 110, formatter: '@'},
|
|
|
{
|
|
|
title: stage.im_type === imType.tz.value ? '本期计量金额' : '本期计量数量',
|
|
|
- colSpan: '1', rowSpan: '1', field: 'jl', hAlign: 2, width: 220, formatter: '@', readOnly: true
|
|
|
+ colSpan: '1', rowSpan: '1', field: 'jl', hAlign: 2, width: 85, formatter: '@', readOnly: true
|
|
|
},
|
|
|
],
|
|
|
headRows: 1,
|
|
@@ -1830,7 +1720,7 @@ $(document).ready(() => {
|
|
|
}
|
|
|
const data = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
if (data) {
|
|
|
- const updateData = {lid: data.lid};
|
|
|
+ const updateData = {lid: data.lid, pid: data.pid};
|
|
|
if (data.uuid) {
|
|
|
updateData.uuid = data.uuid;
|
|
|
} else {
|
|
@@ -1869,7 +1759,7 @@ $(document).ready(() => {
|
|
|
const curRow = info.cellRange.row + iRow;
|
|
|
const data = info.sheet.zh_data[curRow];
|
|
|
if (data) {
|
|
|
- const updateData = {lid: data.lid};
|
|
|
+ const updateData = {lid: data.lid, pid: data.pid};
|
|
|
if (data.uuid) {
|
|
|
updateData.uuid = data.uuid;
|
|
|
} else {
|
|
@@ -2322,7 +2212,7 @@ $(document).ready(() => {
|
|
|
const itemStyle = 'top:' + item.top + ';' + 'left:' + item.left + ';' + 'width:' + item.width + ';' + 'height:' + item.height + ';';
|
|
|
html.push('<div class="img-item" style="' + itemStyle + '">');
|
|
|
html.push('<div class="img-bar">');
|
|
|
- html.push('<a href="javascript: void(0);" class="text-danger" title="删除"><i class="fa fa-remove"></i></a>');
|
|
|
+ html.push('<a href="javascript: void(0);" class="text-danger" title="删除"><i class="fa fa-remove" style="font-size: 24px"></i></a>');
|
|
|
html.push('</div>');
|
|
|
html.push('<div class="focus" style="width:100%; height:100%"><img src="', item.src, '" id="draggable" style="width:100%; height:100%"></div>');
|
|
|
html.push('</div>');
|
|
@@ -2350,13 +2240,14 @@ $(document).ready(() => {
|
|
|
const html = [];
|
|
|
html.push('<div class="img-item">');
|
|
|
html.push('<div class="img-bar">');
|
|
|
- html.push('<a href="javascript: void(0);" class="text-danger" title="删除"><i class="fa fa-remove"></i></a>');
|
|
|
+ html.push('<a href="javascript: void(0);" class="text-danger" title="删除"><i class="fa fa-remove" style="font-size: 24px"></i></a>');
|
|
|
html.push('</div>');
|
|
|
html.push('<div class="focus" style="width:100%; height:100%"><img src="', '/' + result, '" id="draggable" style="width:100%; height:100%"></div>');
|
|
|
html.push('</div>');
|
|
|
$('.img-view').append(html.join(''));
|
|
|
$('.img-bar').click(removeImageItem);
|
|
|
setdraggrable();
|
|
|
+ $('#upload-img-file').val('');
|
|
|
});
|
|
|
}
|
|
|
});
|
|
@@ -2392,7 +2283,7 @@ $(document).ready(() => {
|
|
|
ctx.drawImage(img, pos.left, pos.top, img.width, img.height);
|
|
|
}
|
|
|
// 生成上传数据
|
|
|
- const updateData = {updateType: 'update', lid: data.lid};
|
|
|
+ const updateData = {updateType: 'update', lid: data.lid, pid: data.pid};
|
|
|
if (data.uuid) {
|
|
|
updateData.uuid = data.uuid;
|
|
|
} else {
|
|
@@ -2409,7 +2300,7 @@ $(document).ready(() => {
|
|
|
$('#edit-img').modal('hide');
|
|
|
});
|
|
|
} else if (data.calc_img) {
|
|
|
- postData(window.location.pathname + '/detail/merge-img', {updateType: 'clear', lid: data.lid, uuid: data.uuid}, function (result) {
|
|
|
+ postData(window.location.pathname + '/detail/merge-img', {updateType: 'clear', lid: data.lid, pid: data.pid, uuid: data.uuid}, function (result) {
|
|
|
_.assign(data, result);
|
|
|
self.reLoadDetailData();
|
|
|
$('#edit-img').modal('hide');
|