|
@@ -89,13 +89,6 @@ function initTreeColSettingEvents(setting) {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-function needCheckDetail() {
|
|
|
- stage.check_detail = true;
|
|
|
- $('#check_point').show();
|
|
|
- $('#sub-sp-btn').attr('data-target', '#sub-sp3');
|
|
|
- $('#sp-done-btn').attr('data-target', '#sub-sp3');
|
|
|
- $('#sp-list2-btn').attr('data-target', '#sub-sp3');
|
|
|
-}
|
|
|
|
|
|
// 生成所有附件列表
|
|
|
function getAllList(currPageNum = 1) {
|
|
@@ -128,6 +121,7 @@ function getNodeList(node) {
|
|
|
}
|
|
|
|
|
|
$(document).ready(() => {
|
|
|
+ let detail, searchLedger;
|
|
|
// 界面布局
|
|
|
autoFlashHeight();
|
|
|
// 初始化 台账树结构 数据结构
|
|
@@ -262,7 +256,7 @@ $(document).ready(() => {
|
|
|
const sel = sheet.getSelections()[0];
|
|
|
const sortData = SpreadJsObj.getSortData(sheet);
|
|
|
// 仅本期计量可删除
|
|
|
- if (sel.col === 5 || sel.colCount === 1) {
|
|
|
+ if (sel.col === 5 && sel.colCount === 1) {
|
|
|
const col = sheet.zh_setting.cols[sel.col];
|
|
|
for (let iRow = sel.row; iRow < sel.row + sel.rowCount; iRow++) {
|
|
|
const data = sortData[iRow];
|
|
@@ -318,7 +312,11 @@ $(document).ready(() => {
|
|
|
const nodes = stageTree.loadPostStageData(result.bills);
|
|
|
stageTreeSpreadObj.refreshTreeNodes(slSpread.getActiveSheet(), nodes);
|
|
|
stagePosSpreadObj.loadCurPosData();
|
|
|
- needCheckDetail();
|
|
|
+ if (detail) {
|
|
|
+ detail.loadStageChangeUpdateData(result);
|
|
|
+ } else {
|
|
|
+ stageIm.loadUpdateChangeData(result)
|
|
|
+ }
|
|
|
self.obj.modal('hide');
|
|
|
});
|
|
|
})
|
|
@@ -458,15 +456,8 @@ $(document).ready(() => {
|
|
|
return data && data.end_contract_qty > data.quantity ? '#f8d7da' : defaultColor;
|
|
|
};
|
|
|
SpreadJsObj.initSheet(slSpread.getActiveSheet(), ledgerSpreadSetting);
|
|
|
-
|
|
|
- stageTree.loadDatas(ledgerData);
|
|
|
- // stageTree.loadCurStageData(curStageData);
|
|
|
- // stageTree.loadPreStageData(preStageData);
|
|
|
- // 根据设置 计算 台账树结构
|
|
|
- treeCalc.calculateAll(stageTree);
|
|
|
- // 绘制界面
|
|
|
- SpreadJsObj.loadSheetData(slSpread.getActiveSheet(), 'tree', stageTree);
|
|
|
- SpreadJsObj.loadTopAndSelect(slSpread.getActiveSheet(), ckBillsSpread);
|
|
|
+ slSpread.getActiveSheet().frozenColumnCount(5);
|
|
|
+ slSpread.getActiveSheet().options.frozenlineColor = '#93b5e4';
|
|
|
|
|
|
//初始化所有附件列表
|
|
|
getAllList();
|
|
@@ -585,9 +576,16 @@ $(document).ready(() => {
|
|
|
}
|
|
|
|
|
|
postData(window.location.href + '/update', {bills: updateData}, function (data) {
|
|
|
+ // tag update
|
|
|
const nodes = stageTree.loadPostStageData(data);
|
|
|
stageTreeSpreadObj.refreshTreeNodes(slSpread.getActiveSheet(), nodes);
|
|
|
- needCheckDetail();
|
|
|
+ if (detail) {
|
|
|
+ detail.loadStageLedgerUpdateData(data);
|
|
|
+ } else {
|
|
|
+ stageIm.loadUpdateLedgerData(data);
|
|
|
+ }
|
|
|
+ }, function () {
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
});
|
|
|
}
|
|
|
},
|
|
@@ -595,7 +593,10 @@ $(document).ready(() => {
|
|
|
if (!info.oldSelections[0] || info.newSelections[0].row !== info.oldSelections[0].row) {
|
|
|
stagePosSpreadObj.loadCurPosData();
|
|
|
SpreadJsObj.resetTopAndSelect(spSpread.getActiveSheet());
|
|
|
- posSearch.search();
|
|
|
+ if (posSearch) {
|
|
|
+
|
|
|
+ posSearch.search();
|
|
|
+ }
|
|
|
}
|
|
|
SpreadJsObj.saveTopAndSelect(info.sheet, ckBillsSpread);
|
|
|
stageTreeSpreadObj.loadExprToInput(info.sheet);
|
|
@@ -608,7 +609,8 @@ $(document).ready(() => {
|
|
|
const sel = sheet.getSelections()[0];
|
|
|
const validCols = [];
|
|
|
for (let iCol = sel.col; iCol < sel.col + sel.colCount; iCol++) {
|
|
|
- if (!sheet.zh_setting.cols[iCol].readOnly) {
|
|
|
+ const colSetting = sheet.zh_setting.cols[iCol];
|
|
|
+ if (!colSetting.readOnly && colSetting.field !== 'qc_qty') {
|
|
|
validCols.push(iCol);
|
|
|
}
|
|
|
}
|
|
@@ -657,7 +659,11 @@ $(document).ready(() => {
|
|
|
postData(window.location.href + '/update', {bills: bills}, function (result) {
|
|
|
const nodes = stageTree.loadPostStageData(result);
|
|
|
stageTreeSpreadObj.refreshTreeNodes(slSpread.getActiveSheet(), nodes);
|
|
|
- needCheckDetail();
|
|
|
+ if (detail) {
|
|
|
+ detail.loadStageLedgerUpdateData(result);
|
|
|
+ } else {
|
|
|
+ stageIm.loadUpdateLedgerData(result);
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -760,7 +766,14 @@ $(document).ready(() => {
|
|
|
postData(window.location.href + '/update', {bills: updateData}, function (data) {
|
|
|
const nodes = stageTree.loadPostStageData(data);
|
|
|
stageTreeSpreadObj.refreshTreeNodes(slSpread.getActiveSheet(), nodes.concat(filterNodes));
|
|
|
- needCheckDetail();
|
|
|
+ if (detail) {
|
|
|
+ detail.loadStageLedgerUpdateData(data);
|
|
|
+ } else {
|
|
|
+ stageIm.loadUpdateLedgerData(data);
|
|
|
+ }
|
|
|
+ }, function () {
|
|
|
+ // todo
|
|
|
+ //stageTreeSpreadObj.refreshTreeNodes(slSpread.getActiveSheet(), filterNodes);
|
|
|
});
|
|
|
} else {
|
|
|
stageTreeSpreadObj.refreshTreeNodes(slSpread.getActiveSheet(), filterNodes);
|
|
@@ -804,7 +817,11 @@ $(document).ready(() => {
|
|
|
const nodes = stageTree.loadPostStageData(result.ledger);
|
|
|
stageTreeSpreadObj.refreshTreeNodes(slSpread.getActiveSheet(), nodes);
|
|
|
stagePosSpreadObj.loadCurPosData();
|
|
|
- needCheckDetail();
|
|
|
+ if (detail) {
|
|
|
+ detail.loadStagePosUpdateData(result);
|
|
|
+ } else {
|
|
|
+ stageIm.loadUpdatePosData(result);
|
|
|
+ }
|
|
|
toastr.success('已计量' + data.updateData.length + '条');
|
|
|
}, function () {
|
|
|
stagePosSpreadObj.loadCurPosData();
|
|
@@ -1092,7 +1109,11 @@ $(document).ready(() => {
|
|
|
const refreshData = stageTree.loadPostStageData(result.ledger);
|
|
|
stageTreeSpreadObj.refreshTreeNodes(slSpread.getActiveSheet(), refreshData);
|
|
|
stagePosSpreadObj.loadCurPosData();
|
|
|
- needCheckDetail();
|
|
|
+ if (detail) {
|
|
|
+ detail.loadStagePosUpdateData(result);
|
|
|
+ } else {
|
|
|
+ stageIm.loadUpdatePosData(result);
|
|
|
+ }
|
|
|
}, function () {
|
|
|
stagePosSpreadObj.loadCurPosData();
|
|
|
});
|
|
@@ -1207,7 +1228,11 @@ $(document).ready(() => {
|
|
|
const nodes = stageTree.loadPostStageData(result.ledger);
|
|
|
stageTreeSpreadObj.refreshTreeNodes(slSpread.getActiveSheet(), nodes);
|
|
|
stagePosSpreadObj.loadCurPosData();
|
|
|
- needCheckDetail();
|
|
|
+ if (detail) {
|
|
|
+ detail.loadStagePosUpdateData(result);
|
|
|
+ } else {
|
|
|
+ stageIm.loadUpdatePosData(result);
|
|
|
+ }
|
|
|
}, function () {
|
|
|
stagePosSpreadObj.loadCurPosData();
|
|
|
});
|
|
@@ -1221,7 +1246,8 @@ $(document).ready(() => {
|
|
|
const sel = sheet.getSelections()[0];
|
|
|
const validCols = [];
|
|
|
for (let iCol = sel.col; iCol < sel.col + sel.colCount; iCol++) {
|
|
|
- if (!sheet.zh_setting.cols[iCol].readOnly) {
|
|
|
+ const colSetting = sheet.zh_setting.cols[iCol];
|
|
|
+ if (!colSetting.readOnly && colSetting.field !== 'qc_qty') {
|
|
|
validCols.push(iCol);
|
|
|
}
|
|
|
}
|
|
@@ -1252,7 +1278,11 @@ $(document).ready(() => {
|
|
|
}
|
|
|
const nodes = stageTree.loadPostStageData(result.ledger);
|
|
|
stageTreeSpreadObj.refreshTreeNodes(slSpread.getActiveSheet(), nodes);
|
|
|
- needCheckDetail();
|
|
|
+ if (detail) {
|
|
|
+ detail.loadStagePosUpdateData(result);
|
|
|
+ } else {
|
|
|
+ stageIm.loadUpdatePosData(result);
|
|
|
+ }
|
|
|
// todo 只加载改变项
|
|
|
stagePosSpreadObj.loadCurPosData();
|
|
|
});
|
|
@@ -1276,7 +1306,11 @@ $(document).ready(() => {
|
|
|
const refreshData = stageTree.loadPostStageData(result.ledger);
|
|
|
stageTreeSpreadObj.refreshTreeNodes(slSpread.getActiveSheet(), refreshData);
|
|
|
stagePosSpreadObj.loadCurPosData();
|
|
|
- needCheckDetail();
|
|
|
+ if (detail) {
|
|
|
+ detail.loadStagePosUpdateData(result);
|
|
|
+ } else {
|
|
|
+ stageIm.loadUpdatePosData(result);
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -1298,13 +1332,23 @@ $(document).ready(() => {
|
|
|
|
|
|
// 加载计量单元数据 - 暂时统一加载,如有需要,切换成动态加载并缓存
|
|
|
console.time('loadPosFromServer');
|
|
|
- postData(window.location.pathname + '/pos', null, function (result) {
|
|
|
+ postData(window.location.pathname + '/load', null, function (result) {
|
|
|
console.timeEnd('loadPosFromServer');
|
|
|
- console.log('pos: ' + result.length);
|
|
|
- stagePos.loadDatas(result);
|
|
|
+ // 加载树结构
|
|
|
+ stageTree.loadDatas(result.ledgerData);
|
|
|
+ // stageTree.loadCurStageData(curStageData);
|
|
|
+ // stageTree.loadPreStageData(preStageData);
|
|
|
+ treeCalc.calculateAll(stageTree);
|
|
|
+ SpreadJsObj.loadSheetData(slSpread.getActiveSheet(), 'tree', stageTree);
|
|
|
+ SpreadJsObj.loadTopAndSelect(slSpread.getActiveSheet(), ckBillsSpread);
|
|
|
+ // 加载部位明细
|
|
|
+ stagePos.loadDatas(result.posData);
|
|
|
stagePos.calculateAll();
|
|
|
stagePosSpreadObj.loadCurPosData();
|
|
|
SpreadJsObj.resetTopAndSelect(spSpread.getActiveSheet());
|
|
|
+ // 加载中间计量
|
|
|
+ stageIm.init(stage, imType);
|
|
|
+ stageIm.loadData(result.ledgerData, result.posData, result.detailData, result.changeData);
|
|
|
}, null, true);
|
|
|
spSpread.bind(spreadNS.Events.EditEnded, stagePosSpreadObj.editEnded);
|
|
|
spSpread.bind(spreadNS.Events.ClipboardPasting, stagePosSpreadObj.clipboardPasting);
|
|
@@ -1411,7 +1455,8 @@ $(document).ready(() => {
|
|
|
$.subMenu({
|
|
|
menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
|
|
|
toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
|
|
|
- //key: 'stage.memu.1.0.0',
|
|
|
+ key: 'menu.1.0.0',
|
|
|
+ miniHint: '#sub-mini-hint', hintKey: 'menu.hint.1.0.1',
|
|
|
callback: function (info) {
|
|
|
if (info.mini) {
|
|
|
$('.panel-title').addClass('fluid');
|
|
@@ -1423,6 +1468,12 @@ $(document).ready(() => {
|
|
|
autoFlashHeight();
|
|
|
slSpread.refresh();
|
|
|
spSpread.refresh();
|
|
|
+ if (searchLedger) {
|
|
|
+ searchLedger.spread.refresh();
|
|
|
+ }
|
|
|
+ if (detail) {
|
|
|
+ detail.spread.refresh();
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -1590,7 +1641,6 @@ $(document).ready(() => {
|
|
|
SpreadJsObj.loadSheetData(this.spread.getActiveSheet(), 'data', this.searchResult);
|
|
|
}
|
|
|
}
|
|
|
- let searchLedger;
|
|
|
|
|
|
const posSearch = (function () {
|
|
|
let resultArr = [];
|
|
@@ -1734,8 +1784,717 @@ $(document).ready(() => {
|
|
|
if (searchLedger) {
|
|
|
searchLedger.spread.refresh();
|
|
|
}
|
|
|
+ if (detail) {
|
|
|
+ detail.spread.refresh();
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ class Detail {
|
|
|
+ constructor (obj) {
|
|
|
+ const self = this;
|
|
|
+ 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: stage.im_type === imType.tz.value ? '本期计量金额' : '本期计量数量',
|
|
|
+ colSpan: '1', rowSpan: '1', field: 'jl', hAlign: 2, width: 220, formatter: '@', readOnly: true
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ headRows: 1,
|
|
|
+ emptyRows: 0,
|
|
|
+ headRowHeight: [32],
|
|
|
+ defaultRowHeight: 21,
|
|
|
+ headerFont: '12px 微软雅黑',
|
|
|
+ font: '12px 微软雅黑',
|
|
|
+ readOnly: readOnly,
|
|
|
+ };
|
|
|
+ this.spread = SpreadJsObj.createNewSpread(obj[0]);
|
|
|
+ this.sheet = this.spread.getActiveSheet();
|
|
|
+ this.spread.options.allowUserDragFill = true;
|
|
|
+ this.spread.options.defaultDragFillType = spreadNS.Fill.AutoFillType.fillSeries;
|
|
|
+ SpreadJsObj.initSheet(this.spread.getActiveSheet(), this.spreadSetting);
|
|
|
+
|
|
|
+ this.detailObj = {
|
|
|
+ selectionChanged: function (e, info) {
|
|
|
+ self.reLoadDetailData();
|
|
|
+ },
|
|
|
+ editEnded: function(e, info) {
|
|
|
+ if (info.sheet.zh_setting) {
|
|
|
+ const col = info.sheet.zh_setting.cols[info.col];
|
|
|
+ if (col.field !== 'doc_code') {
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const data = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
+ if (data) {
|
|
|
+ const updateData = {lid: data.lid};
|
|
|
+ if (data.uuid) {
|
|
|
+ updateData.uuid = data.uuid;
|
|
|
+ } else {
|
|
|
+ updateData.code = data.code;
|
|
|
+ updateData.name = data.name;
|
|
|
+ updateData.unit = data.unit;
|
|
|
+ updateData.unit_price = data.unit_price;
|
|
|
+ }
|
|
|
+ updateData.doc_code = info.editingText;
|
|
|
+ postData(window.location.pathname + '/detail/save', updateData, function (result) {
|
|
|
+ stageIm.loadUpdateDetailData(result);
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ }, function () {
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ clipboardPasted: function (e, info) {
|
|
|
+ if (info.sheet.zh_setting && info.sheet.zh_data) {
|
|
|
+ const col = info.sheet.zh_setting.cols[info.cellRange.col];
|
|
|
+ if (info.cellRange.colCount > 1) {
|
|
|
+ toastr.warning('请勿同时复制粘贴多列数据');
|
|
|
+ SpreadJsObj.reLoadSheetData(paySpread.getActiveSheet());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (col.field !== 'doc_code') {
|
|
|
+ SpreadJsObj.reLoadSheetData(paySpread.getActiveSheet());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const datas = [];
|
|
|
+ for (let iRow = 0; iRow < info.cellRange.rowCount; iRow++) {
|
|
|
+ const curRow = info.cellRange.row + iRow;
|
|
|
+ const data = info.sheet.zh_data[curRow];
|
|
|
+ if (data) {
|
|
|
+ const updateData = {lid: data.lid};
|
|
|
+ if (data.uuid) {
|
|
|
+ updateData.uuid = data.uuid;
|
|
|
+ } else {
|
|
|
+ updateData.code = data.code;
|
|
|
+ updateData.name = data.name;
|
|
|
+ updateData.unit = data.unit;
|
|
|
+ updateData.unit_price = data.unit_price;
|
|
|
+ }
|
|
|
+ updateData.doc_code = info.sheet.getText(curRow, info.cellRange.col).replace('\n', '');
|
|
|
+ datas.push(updateData);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (datas.length > 0) {
|
|
|
+ postData(window.location.pathname + '/detail/save', datas, function (result) {
|
|
|
+ stageIm.loadUpdateDetailData(result);
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
|
|
|
+ }, function () {
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deletePress: function (sheet) {
|
|
|
+ if (sheet.zh_setting) {
|
|
|
+ const datas = [];
|
|
|
+ const sel = sheet.getSelections()[0];
|
|
|
+ for (let iCol = sel.col; iCol < sel.col + sel.colCount; iCol++) {
|
|
|
+ const col = sheet.zh_setting.cols[iCol];
|
|
|
+ for (let iRow = sel.row; iRow < sel.row + sel.rowCount; iRow++) {
|
|
|
+ const data = sheet.zh_data[iRow];
|
|
|
+ if (col.field === 'doc_code') {
|
|
|
+ const updateData = {lid: data.lid};
|
|
|
+ if (data.uuid) {
|
|
|
+ updateData.uuid = data.uuid;
|
|
|
+ updateData.doc_code = null;
|
|
|
+ datas.push(updateData);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (datas.length > 0) {
|
|
|
+ postData(window.location.pathname + '/detail/save', datas, function (result) {
|
|
|
+ stageIm.loadUpdateDetailData(result);
|
|
|
+ SpreadJsObj.reLoadRowData(sheet, sel.row, sel.rowCount);
|
|
|
+ }, function () {
|
|
|
+ SpreadJsObj.reLoadRowData(sheet, sel.row, sel.rowCount);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ dragFillBlock: function (e, info) {
|
|
|
+ info.cancel = true;
|
|
|
+ if (!info.sheet.zh_setting || !info.sheet.zh_data) return;
|
|
|
+ const sel = info.sheet.getSelections()[0];
|
|
|
+ const col = info.sheet.zh_setting.cols[info.fillRange.col];
|
|
|
+ if (info.fillRange.colCount > 1 || !sel || col.field !== 'doc_code') return;
|
|
|
+ const text = info.sheet.getText(sel.row + sel.rowCount - 1, sel.col);
|
|
|
+ if (text === '') return;
|
|
|
+
|
|
|
+ const regRst = /(\d+)$/g.exec(text), datas = [];
|
|
|
+ for (let iRow = 0; iRow < info.fillRange.rowCount; iRow++) {
|
|
|
+ const curRow = info.fillRange.row + iRow;
|
|
|
+ const data = info.sheet.zh_data[curRow];
|
|
|
+ if (data) {
|
|
|
+ const updateData = {lid: data.lid};
|
|
|
+ if (data.uuid) {
|
|
|
+ updateData.uuid = data.uuid;
|
|
|
+ } else {
|
|
|
+ updateData.code = data.code;
|
|
|
+ updateData.name = data.name;
|
|
|
+ updateData.unit = data.unit;
|
|
|
+ updateData.unit_price = data.unit_price;
|
|
|
+ }
|
|
|
+ if (regRst) {
|
|
|
+ updateData.doc_code = text.substr(0, regRst.index) + (parseInt(regRst[0]) + iRow + 1);
|
|
|
+ } else {
|
|
|
+ updateData.doc_code = text.replace('\n', '');
|
|
|
+ }
|
|
|
+ datas.push(updateData);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (datas.length > 0) {
|
|
|
+ postData(window.location.pathname + '/detail/save', datas, function (result) {
|
|
|
+ stageIm.loadUpdateDetailData(result);
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.fillRange.row, info.fillRange.rowCount);
|
|
|
+ }, function () {
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.fillRange.row, info.fillRange.rowCount);
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ };
|
|
|
+
|
|
|
+ this.spread.bind(spreadNS.Events.SelectionChanged, this.detailObj.selectionChanged);
|
|
|
+ if (!readOnly) {
|
|
|
+ this.spread.bind(spreadNS.Events.EditEnded, this.detailObj.editEnded);
|
|
|
+ this.spread.bind(spreadNS.Events.ClipboardPasted, this.detailObj.clipboardPasted);
|
|
|
+ this.spread.bind(spreadNS.Events.DragFillBlock, this.detailObj.dragFillBlock);
|
|
|
+ SpreadJsObj.addDeleteBind(this.spread, this.detailObj.deletePress);
|
|
|
+ }
|
|
|
+
|
|
|
+ this._initImTypeSetRela();
|
|
|
+ this._initModifyDetail();
|
|
|
+ // 草图相关
|
|
|
+ this._initImageRela();
|
|
|
+ this.reBuildImData();
|
|
|
+ }
|
|
|
+ _initImTypeSetRela() {
|
|
|
+ const self = this;
|
|
|
+ const gatherConfirmPopover = {
|
|
|
+ reBind: function (obj, eventName, fun) {
|
|
|
+ obj.unbind(eventName);
|
|
|
+ obj.bind(eventName, fun);
|
|
|
+ },
|
|
|
+ check: function (pos, hint, okCallback) {
|
|
|
+ const confirmObj = $('#gather-confirm'), hintObj = $('#gather-confirm-hint');
|
|
|
+ const okObj = $('#gather-confirm-ok'), cancelObj = $('#gather-confirm-cancel');
|
|
|
+ this.reBind(cancelObj, 'click', function () {
|
|
|
+ confirmObj.hide();
|
|
|
+ });
|
|
|
+ this.reBind(okObj, 'click', function () {
|
|
|
+ okCallback();
|
|
|
+ confirmObj.hide();
|
|
|
+ });
|
|
|
+ hintObj.text(hint);
|
|
|
+ confirmObj.css("top", pos.y).css("left", pos.x).show();
|
|
|
+ }
|
|
|
+ };
|
|
|
+ this.gsTree = stageIm.getGsTree();
|
|
|
+
|
|
|
+ if (stage.im_type === imType.tz.value) {
|
|
|
+ $('#type-title-contract').text('本期合同计量金额');
|
|
|
+ $('#type-title-qc').text('本期变更计量金额');
|
|
|
+ } else {
|
|
|
+ $('#type-title-contract').text('本期合同计量数量');
|
|
|
+ $('#type-title-qc').text('本期变更计量数量');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 选择中间计量模式
|
|
|
+ $('div[name="im-type"]').click(function () {
|
|
|
+ function chooseType(obj) {
|
|
|
+ obj.style.cursor = 'default';
|
|
|
+ $(obj).children().addClass('text-primary');
|
|
|
+ $('h5', obj).prepend('<i class="fa fa-check pull-right"></i>');
|
|
|
+ }
|
|
|
+ function validType(obj) {
|
|
|
+ obj.style.cursor = 'pointer';
|
|
|
+ $(obj).children().removeClass('text-primary');
|
|
|
+ $('i', obj).remove();
|
|
|
+ }
|
|
|
+ if (this.style.cursor === 'pointer') {
|
|
|
+ const typeArr = $('div[name="im-type"]');
|
|
|
+ for (const t of typeArr) {
|
|
|
+ if ($(t).attr('im-type') === $(this).attr('im-type')) {
|
|
|
+ chooseType(t);
|
|
|
+ } else {
|
|
|
+ validType(t)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $('#choose').on('show.bs.modal', function () {
|
|
|
+ function chooseType(obj) {
|
|
|
+ obj.style.cursor = 'default';
|
|
|
+ $(obj).children().addClass('text-primary');
|
|
|
+ $('i', obj).remove();
|
|
|
+ $('h5', obj).prepend('<i class="fa fa-check pull-right"></i>');
|
|
|
+ }
|
|
|
+ function validType(obj) {
|
|
|
+ obj.style.cursor = 'pointer';
|
|
|
+ $(obj).children().removeClass('text-primary');
|
|
|
+ $('i', obj).remove();
|
|
|
+ }
|
|
|
+ $('#im-pre').val(stage.im_pre ? stage.im_pre : '');
|
|
|
+ const typeArr = $('div[name="im-type"]');
|
|
|
+ for (const t of typeArr) {
|
|
|
+ if (parseInt($(t).attr('im-type')) === stage.im_type) {
|
|
|
+ chooseType(t);
|
|
|
+ } else {
|
|
|
+ validType(t)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 提交 中间计量模式
|
|
|
+ $('#choose-ok').click(() => {
|
|
|
+ const chooseType = _.find($('div[name="im-type"]', '#im-type'), function (it) {
|
|
|
+ return it.style.cursor !== 'pointer';
|
|
|
+ });
|
|
|
+ const data = {
|
|
|
+ im_type: parseInt($(chooseType).attr('im-type')),
|
|
|
+ im_pre: $('#im-pre').val(),
|
|
|
+ };
|
|
|
+ postData(window.location.pathname + '/detail/build', data, function (result) {
|
|
|
+ stage.im_type = data.im_type;
|
|
|
+ stage.im_pre = data.im_pre;
|
|
|
+ if (stage.im_type === imType.tz.value) {
|
|
|
+ const jlCol = self.spreadSetting.cols.find(function (x) {return x.field === 'jl'});
|
|
|
+ jlCol.title = '本期计量金额';
|
|
|
+ SpreadJsObj.reLoadSheetHeader(self.sheet);
|
|
|
+ $('#type-title-contract').text('本期合同计量金额');
|
|
|
+ $('#type-title-qc').text('本期变更计量金额');
|
|
|
+ } else {
|
|
|
+ const jlCol = self.spreadSetting.cols.find(function (x) {return x.field === 'jl'});
|
|
|
+ jlCol.title = '本期计量金额';
|
|
|
+ SpreadJsObj.reLoadSheetHeader(self.sheet);
|
|
|
+ $('#type-title-contract').text('本期合同计量数量');
|
|
|
+ $('#type-title-qc').text('本期变更计量数量');
|
|
|
+ }
|
|
|
+ // 加载生成数据
|
|
|
+ self.reBuildImData();
|
|
|
+ $('#choose').modal('hide');
|
|
|
+ });
|
|
|
+ });
|
|
|
+ // 显示树结构信息
|
|
|
+ $('#choose2').on('shown.bs.modal', function () {
|
|
|
+ if (!self.gsSpread) {
|
|
|
+ self.gsSpread = SpreadJsObj.createNewSpread($('#im-gather-spread')[0]);
|
|
|
+ SpreadJsObj.initSheet(self.gsSpread.getActiveSheet(), {
|
|
|
+ cols: [
|
|
|
+ {title: '计量\n汇总', colSpan: '1', rowSpan: '1', field: 'check', hAlign: 1, width: 50, formatter: '@', readOnly: true, cellType: 'checkbox'},
|
|
|
+ {title: '项目节编号', colSpan: '1', rowSpan: '1', field: 'code', hAlign: 0, width: 150, formatter: '@', readOnly: true, cellType: 'tree'},
|
|
|
+ {title: '清单编号', colSpan: '1', rowSpan: '1', field: 'b_code', hAlign: 0, width: 80, formatter: '@', readOnly: true},
|
|
|
+ {title: '名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 230, formatter: '@', readOnly: true},
|
|
|
+ {title: '单位', colSpan: '1', rowSpan: '1', field: 'unit', hAlign: 1, width: 60, formatter: '@', readOnly: true},
|
|
|
+ ],
|
|
|
+ headRows: 1,
|
|
|
+ emptyRows: 0,
|
|
|
+ headRowHeight: [32],
|
|
|
+ defaultRowHeight: 21,
|
|
|
+ headerFont: '12px 微软雅黑',
|
|
|
+ font: '12px 微软雅黑',
|
|
|
+ });
|
|
|
+ self.gsSpread.bind(spreadNS.Events.ButtonClicked, function (e, info) {
|
|
|
+ function checkParent(node) {
|
|
|
+ const parent = self.gsTree.getParent(node);
|
|
|
+ if (parent) {
|
|
|
+ return parent.check ? parent.check : checkParent(parent);
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function checkChildren(node) {
|
|
|
+ for (const child of node.children) {
|
|
|
+ if (child.check) {
|
|
|
+ return true;
|
|
|
+ } else if (checkChildren(child)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!$('#im-gather-check')[0].checked) { return; }
|
|
|
+
|
|
|
+ const sheet = info.sheet, cellType = sheet.getCellType(info.row, info.col);
|
|
|
+ if (cellType instanceof spreadNS.CellTypes.CheckBox) {
|
|
|
+ if (sheet.isEditing()) {
|
|
|
+ sheet.endEdit(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (info.sheet.zh_setting) {
|
|
|
+ const col = info.sheet.zh_setting.cols[info.col];
|
|
|
+ if (col.field !== 'check') {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const sortData = info.sheet.zh_dataType === 'tree' ? info.sheet.zh_tree.nodes : info.sheet.zh_data;
|
|
|
+ const node = sortData[info.row];
|
|
|
+ if (!node.check) {
|
|
|
+ if (checkParent(node)) {
|
|
|
+ const rect = info.sheet.getCellRect(info.row, info.col);
|
|
|
+ gatherConfirmPopover.check({
|
|
|
+ x: rect.x + rect.width / 2 + 25,
|
|
|
+ y: rect.y + rect.height / 2 + 3,
|
|
|
+ }, '父项已勾选,继续将取消父项勾选。', function () {
|
|
|
+ node.check = true;
|
|
|
+ const parents = self.gsTree.getFullPathNodes(self.gsTree.getParent(node).full_path);
|
|
|
+ const rows = [self.gsTree.nodes.indexOf(node)];
|
|
|
+ for (const p of parents) {
|
|
|
+ if (p.check) {
|
|
|
+ p.check = false;
|
|
|
+ rows.push(self.gsTree.nodes.indexOf(p));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SpreadJsObj.reLoadRowsData(info.sheet, rows);
|
|
|
+ });
|
|
|
+ } else if (checkChildren(node)) {
|
|
|
+ const rect = info.sheet.getCellRect(info.row, info.col);
|
|
|
+ gatherConfirmPopover.check({
|
|
|
+ x: rect.x + rect.width / 2 + 25,
|
|
|
+ y: rect.y + rect.height / 2 + 3,
|
|
|
+ }, '子项已勾选,继续将取消子项勾选。', function () {
|
|
|
+ node.check = true;
|
|
|
+ const posterity = self.gsTree.getPosterity(node);
|
|
|
+ const rows = [self.gsTree.nodes.indexOf(node)];
|
|
|
+ for (const p of posterity) {
|
|
|
+ if (p.check) {
|
|
|
+ rows.push(self.gsTree.nodes.indexOf(p));
|
|
|
+ p.check = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SpreadJsObj.reLoadRowsData(info.sheet, rows);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ node.check = true;
|
|
|
+ SpreadJsObj.reLoadRowsData(info.sheet, [self.gsTree.nodes.indexOf(node)]);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ node.check = false;
|
|
|
+ SpreadJsObj.reLoadRowsData(info.sheet, [self.gsTree.nodes.indexOf(node)]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ const gatherNodes = stage.im_gather_node ? _.map(stage.im_gather_node.split(',')) : [];
|
|
|
+ for (const node of self.gsTree.datas) {
|
|
|
+ node.check = gatherNodes.indexOf(node.id + '') !== -1;
|
|
|
+ }
|
|
|
+ SpreadJsObj.loadSheetData(self.gsSpread.getActiveSheet(), SpreadJsObj.DataType.Tree, self.gsTree);
|
|
|
+ self.gsTree.expandByLevel(4);
|
|
|
+ SpreadJsObj.refreshTreeRowVisible(self.gsSpread.getActiveSheet());
|
|
|
+ SpreadJsObj.resetFieldReadOnly(self.gsSpread.getActiveSheet, 'check', !$('#im-gather-check')[0].checked);
|
|
|
+ } else {
|
|
|
+ const gatherNodes = stage.im_gather_node ? _.map(stage.im_gather_node.split(',')) : [];
|
|
|
+ for (const node of self.gsTree.datas) {
|
|
|
+ node.check = gatherNodes.indexOf(node.id + '') !== -1;
|
|
|
+ }
|
|
|
+ SpreadJsObj.reLoadColsData(self.gsSpread.getActiveSheet(), [0]);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 提交 高级设置
|
|
|
+ $('#choose2-ok').click(() => {
|
|
|
+ if (!self.gsTree) { return; }
|
|
|
+ const nodes = [];
|
|
|
+ for (const node of self.gsTree.datas) {
|
|
|
+ if (node.check) {
|
|
|
+ nodes.push(node.id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const data = {
|
|
|
+ im_gather: $('#im-gather-check')[0].checked,
|
|
|
+ im_gather_node: nodes.join(','),
|
|
|
+ };
|
|
|
+ postData(window.location.pathname + '/detail/adv', data, function (result) {
|
|
|
+ stage.im_gather = data.im_gather;
|
|
|
+ stage.im_gather_node = data.im_gather_node;
|
|
|
+ $('#choose2').modal('hide');
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ _initModifyDetail() {
|
|
|
+ const self = this;
|
|
|
+ // 编辑
|
|
|
+ $('#edit-detail').click(function () {
|
|
|
+ $(this).hide();
|
|
|
+ $('#save-detail').show();
|
|
|
+ $('#cancel-detail').show();
|
|
|
+ $('#detail-show').hide();
|
|
|
+ $('#detail-edit').show();
|
|
|
+ });
|
|
|
+ // 保存
|
|
|
+ $('#save-detail').click(() => {
|
|
|
+ function check(field, obj, org, update) {
|
|
|
+ const newValue = obj.val();
|
|
|
+ if (!org[field]) {
|
|
|
+ if (newValue !== '') {
|
|
|
+ update[field] = newValue;
|
|
|
+ }
|
|
|
+ } else if (newValue !== org[field]){
|
|
|
+ update[field] = newValue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const data = SpreadJsObj.getSelectObject(self.spread.getActiveSheet());
|
|
|
+ const updateData = {lid: data.lid, pid: data.pid};
|
|
|
+ if (data.uuid) {
|
|
|
+ updateData.uuid = data.uuid;
|
|
|
+ } else {
|
|
|
+ updateData.code = data.code;
|
|
|
+ updateData.name = data.name;
|
|
|
+ updateData.unit = data.unit;
|
|
|
+ updateData.unit_price = data.unit_price;
|
|
|
+ }
|
|
|
+ updateData.bw = $('#bw-name').val();
|
|
|
+ updateData.peg = $('#peg').val();
|
|
|
+ updateData.xm = $('#xm-name').val();
|
|
|
+ updateData.drawing_code = $('#drawing-code').val();
|
|
|
+ updateData.calc_memo = $('#calc-memo').val();
|
|
|
+ postData(window.location.pathname + '/detail/save', updateData, function (result) {
|
|
|
+ _.assign(data, result);
|
|
|
+ self.reLoadDetailData();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ // 取消
|
|
|
+ $('#cancel-detail').click(() => {
|
|
|
+ self.reLoadDetailData();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ _initImageRela() {
|
|
|
+ const self = this;
|
|
|
+ function setdraggrable(){
|
|
|
+ $( ".img-item" ).draggable({ containment: "parent" },{stop: function( event, ui ) {
|
|
|
+ }}).resizable({ containment: "parent" },{ handles: 'n, e, s, w, ne, se, sw, nw' },{ maxWidth: parseFloat($('#imgwidth').val())},{maxHeight: parseFloat($('#imgheight').val())},{
|
|
|
+ stop: function( event, ui ) {
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 移动图片
|
|
|
+ const moveImageItem = function (ev) {
|
|
|
+ const item = this;
|
|
|
+ const view = $('.img-view')[0];
|
|
|
+ let oEvent = ev;
|
|
|
+ // 浏览器有一些图片的默认事件,这里要阻止
|
|
|
+ oEvent.preventDefault();
|
|
|
+ let disX = oEvent.clientX - item.offsetLeft;
|
|
|
+ let disY = oEvent.clientY - item.offsetTop;
|
|
|
+ view.onmousemove = function (ev) {
|
|
|
+ oEvent = ev;
|
|
|
+ oEvent.preventDefault();
|
|
|
+ let x = oEvent.clientX -disX;
|
|
|
+ let y = oEvent.clientY -disY;
|
|
|
+
|
|
|
+ // 图形移动的边界判断
|
|
|
+ x = x <= 0 ? 0 : x;
|
|
|
+ x = x >= view.offsetWidth - item.offsetWidth ? view.offsetWidth - item.offsetWidth : x;
|
|
|
+ y = y <= 0 ? 0 : y;
|
|
|
+ y = y >= view.offsetHeight - item.offsetHeight ? view.offsetHeight - item.offsetHeight : y;
|
|
|
+ item.style.left = x + 'px';
|
|
|
+ item.style.top = y + 'px';
|
|
|
+ };
|
|
|
+ // 图形移出父盒子取消移动事件,防止移动过快触发鼠标移出事件,导致鼠标弹起事件失效
|
|
|
+ view.onmouseleave = function () {
|
|
|
+ view.onmousemove = null;
|
|
|
+ view.onmouseup = null;
|
|
|
+ };
|
|
|
+ // 鼠标弹起后停止移动
|
|
|
+ view.onmouseup=function() {
|
|
|
+ view.onmousemove = null;
|
|
|
+ view.onmouseup = null;
|
|
|
+ };
|
|
|
+ };
|
|
|
+ const removeImageItem = function () {
|
|
|
+ $(this).parent().remove();
|
|
|
+ };
|
|
|
+ // 加载草图组成
|
|
|
+ $('#edit-img').on('show.bs.modal', function () {
|
|
|
+ const data = SpreadJsObj.getSelectObject(self.spread.getActiveSheet());
|
|
|
+ const items = data.calc_img_org ? JSON.parse(data.calc_img_org) : [];
|
|
|
+ const html = [];
|
|
|
+ for (const item of items) {
|
|
|
+ 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('</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>');
|
|
|
+ }
|
|
|
+ $('.img-view').html(html.join(''));
|
|
|
+ $('.img-bar').click(removeImageItem);
|
|
|
+ setdraggrable();
|
|
|
+ });
|
|
|
+ // 上传图片
|
|
|
+ $('#upload-img').click(function () {
|
|
|
+ $('#upload-img-file').trigger('click');
|
|
|
+ });
|
|
|
+ $('#upload-img-file').change(function () {
|
|
|
+ const file = this.files[0];
|
|
|
+ const ext = file.name.toLowerCase().split('.').splice(-1)[0];
|
|
|
+ const imgStr = /(jpg|jpeg|png|bmp|BMP|JPG|PNG|JPEG)$/;
|
|
|
+ if (!imgStr.test(ext)) {
|
|
|
+ toastr.error('请上传正确的图片格式文件');
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if ($(this).val()) {
|
|
|
+ const formData = new FormData();
|
|
|
+ formData.append('file', this.files[0]);
|
|
|
+ postDataWithFile(window.location.pathname + '/detail/add-img', formData, function (result) {
|
|
|
+ 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('</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();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 保存草图修改结果
|
|
|
+ $('#edit-img-ok').click(function () {
|
|
|
+ // 记录上传的图片的信息
|
|
|
+ const items = $('.img-item');
|
|
|
+ const data = SpreadJsObj.getSelectObject(self.spread.getActiveSheet());
|
|
|
+ if (items.length > 0) {
|
|
|
+ const itemInfo = [];
|
|
|
+ for (const item of items) {
|
|
|
+ const itemData = {
|
|
|
+ src: $('img', item).attr('src'),
|
|
|
+ left: item.style.left,
|
|
|
+ top: item.style.top,
|
|
|
+ width: item.style.width,
|
|
|
+ height: item.style.height,
|
|
|
+ };
|
|
|
+ itemInfo.push(itemData);
|
|
|
+ }
|
|
|
+ // 获取合并好的图片数据
|
|
|
+ const canvas = document.createElement('canvas');
|
|
|
+ const view = $('.img-view')[0];
|
|
|
+ canvas.height = view.clientHeight;
|
|
|
+ canvas.width = view.clientWidth;
|
|
|
+ const ctx = canvas.getContext('2d');
|
|
|
+ ctx.fillStyle = '#ffffff';
|
|
|
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
|
+ for (const b of $('.img-item')) {
|
|
|
+ const pos = $(b).position();
|
|
|
+ const img = $('img', b)[0];
|
|
|
+ ctx.drawImage(img, pos.left, pos.top, img.width, img.height);
|
|
|
+ }
|
|
|
+ // 生成上传数据
|
|
|
+ const updateData = {updateType: 'update', lid: data.lid};
|
|
|
+ if (data.uuid) {
|
|
|
+ updateData.uuid = data.uuid;
|
|
|
+ } else {
|
|
|
+ updateData.code = data.code;
|
|
|
+ updateData.name = data.name;
|
|
|
+ updateData.unit = data.unit;
|
|
|
+ updateData.unit_price = data.unit_price;
|
|
|
+ }
|
|
|
+ updateData.img = canvas.toDataURL('image/jpeg');
|
|
|
+ updateData.imgInfo = itemInfo;
|
|
|
+ postData(window.location.pathname + '/detail/merge-img', updateData, function (result) {
|
|
|
+ _.assign(data, result);
|
|
|
+ self.reLoadDetailData();
|
|
|
+ $('#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) {
|
|
|
+ _.assign(data, result);
|
|
|
+ self.reLoadDetailData();
|
|
|
+ $('#edit-img').modal('hide');
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ reBuildImData() {
|
|
|
+ const imData = stageIm.buildImData();
|
|
|
+ SpreadJsObj.loadSheetData(this.sheet, SpreadJsObj.DataType.Data, imData);
|
|
|
+ this.reLoadDetailData();
|
|
|
+ }
|
|
|
+ loadStageLedgerUpdateData(data) {
|
|
|
+ const imData = stageIm.loadUpdateLedgerData(data);
|
|
|
+ SpreadJsObj.loadSheetData(this.sheet, SpreadJsObj.DataType.Data, imData);
|
|
|
+ this.reLoadDetailData();
|
|
|
+ }
|
|
|
+ loadStagePosUpdateData(data) {
|
|
|
+ const imData = stageIm.loadUpdatePosData(data);
|
|
|
+ SpreadJsObj.loadSheetData(this.sheet, SpreadJsObj.DataType.Data, imData);
|
|
|
+ this.reLoadDetailData();
|
|
|
+ }
|
|
|
+ loadStageChangeUpdateData(data) {
|
|
|
+ const imData = stageIm.loadUpdateChangeData(data);
|
|
|
+ SpreadJsObj.loadSheetData(this.sheet, SpreadJsObj.DataType.Data, imData);
|
|
|
+ this.reLoadDetailData();
|
|
|
+ }
|
|
|
+ reLoadDetailData() {
|
|
|
+ const data = SpreadJsObj.getSelectObject(this.spread.getActiveSheet());
|
|
|
+
|
|
|
+ if (data) {
|
|
|
+ $('#edit-detail').show();
|
|
|
+ $('#modify-img').show();
|
|
|
+ } else {
|
|
|
+ $('#edit-detail').hide();
|
|
|
+ $('#modify-img').hide();
|
|
|
+ }
|
|
|
+ $('#save-detail').hide();
|
|
|
+ $('#cancel-detail').hide();
|
|
|
+
|
|
|
+ $('#detail-show').show();
|
|
|
+ $('#detail-edit').hide();
|
|
|
+
|
|
|
+ const contractJl = data && data.contract_jl ? data.contract_jl : '';
|
|
|
+ $('#show-contract-jl').text(contractJl);
|
|
|
+ $('#contract-jl').val(contractJl);
|
|
|
+
|
|
|
+ const qcJl = data && data.qc_jl ? data.qc_jl : '';
|
|
|
+ $('#show-qc-jl').text(qcJl);
|
|
|
+ $('#qc-jl').val(qcJl);
|
|
|
+
|
|
|
+ const bglCode = data && data.bgl_code ? data.bgl_code : '';
|
|
|
+ $('#show-bgl-code').text(bglCode);
|
|
|
+ $('#bgl-code').val(bglCode);
|
|
|
+
|
|
|
+ const bglDrawingCode = data && data.bgl_drawing_code ? data.bgl_drawing_code : '';
|
|
|
+ $('#show-bgl-drawing-code').text(bglDrawingCode);
|
|
|
+ $('#bgl-drawing-code').val(bglDrawingCode);
|
|
|
+
|
|
|
+ const bwName = data && data.bw ? data.bw : '';
|
|
|
+ $('#show-bw-name').text(bwName);
|
|
|
+ $('#bw-name').val(bwName);
|
|
|
+
|
|
|
+ const peg = data && data.peg ? data.peg : '';
|
|
|
+ $('#show-peg').text(peg);
|
|
|
+ $('#peg').val(peg);
|
|
|
+
|
|
|
+ const xmName = data && data.xm ? data.xm: '';
|
|
|
+ $('#show-xm-name').text(xmName);
|
|
|
+ $('#xm-name').val(xmName);
|
|
|
+
|
|
|
+ const drawingCode = data && data.drawing_code ? data.drawing_code: '';
|
|
|
+ $('#show-drawing-code').text(drawingCode);
|
|
|
+ $('#drawing-code').val(drawingCode);
|
|
|
+
|
|
|
+ const calcMemo = data && data.calc_memo ? data.calc_memo: '';
|
|
|
+ $('#show-calc-memo').html(calcMemo.replace(/\n/g, '<br/>'));
|
|
|
+ $('#calc-memo').val(calcMemo);
|
|
|
+
|
|
|
+ const calcImgSrc = data && data.calc_img ? '/' + data.calc_img : '';
|
|
|
+ $('#show-calc-img').attr('src', calcImgSrc);
|
|
|
+ $('#calc-img').attr('src', calcImgSrc);
|
|
|
+ $('#view-calc-img').attr('src', calcImgSrc);
|
|
|
+ }
|
|
|
+ }
|
|
|
// 展开收起附件
|
|
|
$('a', '.right-nav').bind('click', function () {
|
|
|
//const main = $('#main-view'), tool = $('#tools-view');
|
|
@@ -1777,6 +2536,12 @@ $(document).ready(() => {
|
|
|
const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
getNodeList(node.id);
|
|
|
}
|
|
|
+ if (tab.attr('content') === '#zhongjian') {
|
|
|
+ if (!detail) {
|
|
|
+ detail = new Detail($('#detail-spread'));
|
|
|
+ detail.spread.refresh();
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
tab.removeClass('active');
|
|
|
tabPanel.removeClass('active');
|