|
@@ -1,5 +1,6 @@
|
|
const copyBlockTag = 'zh.calc.copyBlock';
|
|
const copyBlockTag = 'zh.calc.copyBlock';
|
|
$(document).ready(function() {
|
|
$(document).ready(function() {
|
|
|
|
+ let stdXmj;
|
|
const ckBillsSpread = '/contract/' + window.location.pathname.split('/')[2] + '/' + contractConst.typeMap[contract_type] + '/detail/contract-billsSelect';
|
|
const ckBillsSpread = '/contract/' + window.location.pathname.split('/')[2] + '/' + contractConst.typeMap[contract_type] + '/detail/contract-billsSelect';
|
|
autoFlashHeight();
|
|
autoFlashHeight();
|
|
const contractSpreadSetting = {
|
|
const contractSpreadSetting = {
|
|
@@ -2052,6 +2053,91 @@ $(document).ready(function() {
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ const stdLibCellDoubleClick = function (updateData, stdNode, stdTree) {
|
|
|
|
+ if (!permission_edit) return;
|
|
|
|
+ const mainSheet = contractSheet;
|
|
|
|
+ if (!stdTree || !mainSheet.zh_tree) { return; }
|
|
|
|
+
|
|
|
|
+ const mainTree = mainSheet.zh_tree;
|
|
|
|
+ const sel = mainSheet.getSelections()[0];
|
|
|
|
+ const mainNode = mainTree.nodes[sel.row];
|
|
|
|
+ if (!stdNode) return;
|
|
|
|
+
|
|
|
|
+ // if (updateData.postData.stdType === 'gcl') {
|
|
|
|
+ // if (mainNode.code && mainNode.code !== '' && !mainTree.isLeafXmj(mainNode)) {
|
|
|
|
+ // toastr.warning('非最底层项目下,不应添加节点');
|
|
|
|
+ // return;
|
|
|
|
+ // }
|
|
|
|
+ // } else {
|
|
|
|
+ // const stdNodes = stdTree.getAllParents(stdNode);
|
|
|
|
+ // for (const node of stdNodes) {
|
|
|
|
+ // const parent = mainTree.datas.find(x => { return x.code === node.code && x.name === node.name; });
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ console.log(mainTree.getNodeKey(mainNode), stdTree.getNodeKey(stdNode), stdNode.list_id, updateData.postData.stdType);
|
|
|
|
+
|
|
|
|
+ postData(window.location.pathname + '/update', {
|
|
|
|
+ postType: 'add-std',
|
|
|
|
+ postData: {
|
|
|
|
+ id: mainTree.getNodeKey(mainNode),
|
|
|
|
+ tender_id: mainNode.tender_id,
|
|
|
|
+ stdType: updateData.postData.stdType,
|
|
|
|
+ stdLibId: stdNode.list_id,
|
|
|
|
+ stdNode: stdTree.getNodeKey(stdNode)
|
|
|
|
+ }
|
|
|
|
+ }, function (result) {
|
|
|
|
+ const refreshNode = mainTree.loadPostData(result);
|
|
|
|
+ contractTreeSpreadObj.refreshTree(mainSheet, refreshNode);
|
|
|
|
+ if (sel) {
|
|
|
|
+ if (refreshNode.create && refreshNode.create.length > 0) {
|
|
|
|
+ mainSheet.setSelection(refreshNode.create[refreshNode.create.length - 1].index, sel.col, sel.rowCount, sel.colCount);
|
|
|
|
+ SpreadJsObj.reloadRowsBackColor(mainSheet, [sel.row, refreshNode.create[refreshNode.create.length - 1].index]);
|
|
|
|
+ } else {
|
|
|
|
+ const node = _.find(mainTree.nodes, {code: stdNode.code, name: stdNode.name});
|
|
|
|
+ if (node) {
|
|
|
|
+ mainSheet.setSelection(mainTree.nodes.indexOf(node), sel.col, sel.rowCount, sel.colCount);
|
|
|
|
+ SpreadJsObj.reloadRowsBackColor(mainSheet, [sel.row, mainTree.nodes.indexOf(node)]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ contractTreeSpreadObj.refreshOperationValid(mainSheet);
|
|
|
|
+ contractSpread.focus();
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+ const stdXmjSetting = {
|
|
|
|
+ selector: '#std-xmj',
|
|
|
|
+ stdType: 'xmj',
|
|
|
|
+ libs: stdChapters,
|
|
|
|
+ treeSetting: {
|
|
|
|
+ id: 'chapter_id',
|
|
|
|
+ pid: 'pid',
|
|
|
|
+ order: 'order',
|
|
|
|
+ level: 'level',
|
|
|
|
+ rootId: -1,
|
|
|
|
+ keys: ['id', 'list_id', 'chapter_id'],
|
|
|
|
+ },
|
|
|
|
+ spreadSetting: {
|
|
|
|
+ cols: [
|
|
|
|
+ {title: '项目节编号', field: 'code', hAlign: 0, width: 120, formatter: '@', readOnly: true, cellType: 'tree'},
|
|
|
|
+ {title: '名称', field: 'name', hAlign: 0, width: 150, formatter: '@', readOnly: true},
|
|
|
|
+ ],
|
|
|
|
+ treeCol: 0,
|
|
|
|
+ emptyRows: 0,
|
|
|
|
+ headRows: 1,
|
|
|
|
+ headRowHeight: [32],
|
|
|
|
+ defaultRowHeight: 21,
|
|
|
|
+ headerFont: '12px 微软雅黑',
|
|
|
|
+ font: '12px 微软雅黑',
|
|
|
|
+ headColWidth: [30],
|
|
|
|
+ selectedBackColor: '#fffacd',
|
|
|
|
+ },
|
|
|
|
+ spreadClassCss: 'sjs-contract',
|
|
|
|
+ cellDoubleClick: stdLibCellDoubleClick,
|
|
|
|
+ page: 'contract',
|
|
|
|
+ tid: window.location.pathname.split('/')[2],
|
|
|
|
+ };
|
|
|
|
+
|
|
// 显示层次
|
|
// 显示层次
|
|
(function (select, sheet) {
|
|
(function (select, sheet) {
|
|
$(select).click(function () {
|
|
$(select).click(function () {
|
|
@@ -2082,15 +2168,55 @@ $(document).ready(function() {
|
|
}, 100);
|
|
}, 100);
|
|
});
|
|
});
|
|
})('a[name=showLevel]', contractSheet);
|
|
})('a[name=showLevel]', contractSheet);
|
|
|
|
+
|
|
$.divResizer({
|
|
$.divResizer({
|
|
- select: '#contract-resize',
|
|
|
|
|
|
+ select: '#right-spr',
|
|
callback: function () {
|
|
callback: function () {
|
|
contractSpread.refresh();
|
|
contractSpread.refresh();
|
|
|
|
+ if (stdXmj) stdXmj.spread.refresh();
|
|
|
|
+ const width = (($('#right-view').width()/$('#right-view').parent('div').width())*100).toFixed();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ $.divResizer({
|
|
|
|
+ select: '#contract-resize',
|
|
|
|
+ callback: function () {
|
|
let bcontent = $(".bcontent-wrap") ? $(".bcontent-wrap").height() : 0;
|
|
let bcontent = $(".bcontent-wrap") ? $(".bcontent-wrap").height() : 0;
|
|
$(".sp-wrap").height(bcontent-30);
|
|
$(".sp-wrap").height(bcontent-30);
|
|
|
|
+ updateSjsHeight();
|
|
|
|
+ contractSpread.refresh();
|
|
|
|
+ if (stdXmj) stdXmj.spread.refresh();
|
|
// posSpread.refresh();
|
|
// posSpread.refresh();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+ // 展开收起月信息价并浏览器记住本期展开收起
|
|
|
|
+ $('a', '.right-nav').bind('click', function () {
|
|
|
|
+ const tab = $(this), tabPanel = $(tab.attr('content'));
|
|
|
|
+ if (!tab.hasClass('active')) {
|
|
|
|
+ $('a', '.side-menu').removeClass('active');
|
|
|
|
+ $('#right-view .tab-content .tab-pane').removeClass('active');
|
|
|
|
+ tab.addClass('active');
|
|
|
|
+ tabPanel.addClass('active');
|
|
|
|
+ showSideTools(tab.hasClass('active'));
|
|
|
|
+ if (tab.attr('content') === '#std-xmj') {
|
|
|
|
+ if (!stdXmj) {
|
|
|
|
+ stdXmj = $.stdLib(stdXmjSetting);
|
|
|
|
+ }
|
|
|
|
+ updateSjsHeight();
|
|
|
|
+ stdXmj.spread.refresh();
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ tab.removeClass('active');
|
|
|
|
+ tabPanel.removeClass('active');
|
|
|
|
+ showSideTools(tab.hasClass('active'));
|
|
|
|
+ }
|
|
|
|
+ contractSpread.refresh();
|
|
|
|
+ });
|
|
|
|
+ function updateSjsHeight() {
|
|
|
|
+ $('.sjs-contract').height($('.sjs-height-1').height() - getObjHeight($('.sjs-bar')));
|
|
|
|
+ }
|
|
|
|
+ function getObjHeight(select) {
|
|
|
|
+ return select.length > 0 ? select.outerHeight() : 0;
|
|
|
|
+ }
|
|
$.subMenu({
|
|
$.subMenu({
|
|
menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
|
|
menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
|
|
toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
|
|
toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
|
|
@@ -2106,6 +2232,7 @@ $(document).ready(function() {
|
|
}
|
|
}
|
|
autoFlashHeight();
|
|
autoFlashHeight();
|
|
contractSpread.refresh();
|
|
contractSpread.refresh();
|
|
|
|
+ if (stdXmj) stdXmj.spread.refresh();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
});
|