|
|
@@ -4,50 +4,137 @@
|
|
|
//modiyied by zhong on 2017/9/21
|
|
|
|
|
|
$(document).ready(function () {
|
|
|
- //子目换算左右拖动
|
|
|
- let sideResizeEles = {};
|
|
|
- sideResizeEles.totalWidth = 0.75;
|
|
|
- sideResizeEles.id = 'stdCoe';
|
|
|
- sideResizeEles.resize = $('#sideResize');
|
|
|
- sideResizeEles.evFixedSize = `$(window).width()-$('.main-nav').width()-5`;
|
|
|
- sideResizeEles.nearElement = $('.main-content');
|
|
|
- sideResizeEles.nearSpread = $('.main-content');
|
|
|
- sideResizeEles.farElement = $('.main-side-right');
|
|
|
- sideResizeEles.farSpread = $('.main-side-right');
|
|
|
- sideResizeEles.nav = null;
|
|
|
- slideResize(sideResizeEles, {min: 250, max: $('.content').width()-260}, 'width', function(){
|
|
|
- if (sideResizeEles.id === 'stdCoe') {
|
|
|
- coeOprObj.workBook.refresh();
|
|
|
- gljAdjOprObj.workBook.refresh();
|
|
|
+ function refreshALlWorkBook() {
|
|
|
+ if (sectionTreeObj.workBook) {
|
|
|
+ sectionTreeObj.workBook.refresh();
|
|
|
+ }
|
|
|
+ if (rationOprObj.workBook) {
|
|
|
rationOprObj.workBook.refresh();
|
|
|
+ }
|
|
|
+ if (rationGLJOprObj.sheet && rationGLJOprObj.sheet.getParent()) {
|
|
|
rationGLJOprObj.sheet.getParent().refresh();
|
|
|
}
|
|
|
+ if (coeOprObj.workBook) {
|
|
|
+ coeOprObj.workBook.refresh();
|
|
|
+ }
|
|
|
+ if (gljAdjOprObj.workBook) {
|
|
|
+ gljAdjOprObj.workBook.refresh();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const moduleName = 'stdRation';
|
|
|
+ //定额章节树与定额表
|
|
|
+ let leftElesObj = {};
|
|
|
+ leftElesObj.resize = $('#slideResizeLeft');
|
|
|
+ leftElesObj.parent = $('#dataRow');
|
|
|
+ leftElesObj.left = $('#leftContent');
|
|
|
+ leftElesObj.right = $('#mainContent');
|
|
|
+ let maxEval = `$('#zmhsContent').is(':visible') ? $('#dataRow').width() - $('#zmhsContent').width() - 300 : $('#dataRow').width() - 300`;
|
|
|
+ horizontalSlide(moduleName, leftElesObj, {min: 300, max: maxEval}, function () {
|
|
|
+ refreshALlWorkBook();
|
|
|
});
|
|
|
+ loadHorizonWidth(moduleName, [$('#leftContent'), $('#mainContent')], function () {
|
|
|
+ //refreshAfterZmhs(false);
|
|
|
+ let leftContentWidth = parseFloat($('#leftContent')[0].style.width.replace('%', '')),
|
|
|
+ mainContentWidth = parseFloat($('#mainContent')[0].style.width.replace('%', ''));
|
|
|
+ let surplus = 100 - leftContentWidth - mainContentWidth;
|
|
|
+ $('#leftContent').css('width', `${leftContentWidth + surplus / 2}%`);
|
|
|
+ $('#mainContent').css('width', `${mainContentWidth + surplus / 2}%`);
|
|
|
|
|
|
+ refreshALlWorkBook();
|
|
|
+ });
|
|
|
+ //定额表与子目换算表
|
|
|
+ let rightElesObj = {};
|
|
|
+ rightElesObj.resize = $('#slideResizeRight');
|
|
|
+ rightElesObj.parent = $('#dataRow');
|
|
|
+ rightElesObj.left = $('#mainContent');
|
|
|
+ rightElesObj.right = $('#zmhsContent');
|
|
|
+ let maxEvalRight = `$('#dataRow').width() - $('#leftContent').width() - 200`;
|
|
|
+ horizontalSlide(moduleName, rightElesObj, {min: 200, max: maxEvalRight}, function () {
|
|
|
+ refreshALlWorkBook();
|
|
|
+ });
|
|
|
+
|
|
|
+ function refreshAfterZmhs(visible) {
|
|
|
+ const min = 20;
|
|
|
+ //宽度比例localstorage key
|
|
|
+ let leftContentKey = `${moduleName}${$('#leftContent').attr('id')}Width`,
|
|
|
+ mainContentKey = `${moduleName}${$('#mainContent').attr('id')}Width`,
|
|
|
+ zmhsContentKey = `${moduleName}${$('#zmhsContent').attr('id')}Width`;
|
|
|
+ let zmhsWidth = getLocalCache(zmhsContentKey) ? getLocalCache(zmhsContentKey) :$('#zmhsContent')[0].style.width,
|
|
|
+ mainContentWidth = $('#mainContent')[0].style.width,
|
|
|
+ leftContentWidth;
|
|
|
+ zmhsWidth = parseFloat(zmhsWidth.replace('%', ''));
|
|
|
+ mainContentWidth = parseFloat(mainContentWidth.replace('%', ''));
|
|
|
+ if (visible) {
|
|
|
+ mainContentWidth = mainContentWidth - zmhsWidth / 2 < min ? min : mainContentWidth - zmhsWidth / 2;
|
|
|
+ if (100 - mainContentWidth - zmhsWidth < min) {
|
|
|
+ leftContentWidth = min;
|
|
|
+ zmhsWidth = 100 - mainContentWidth - leftContentWidth;
|
|
|
+ } else {
|
|
|
+ leftContentWidth = 100 - mainContentWidth - zmhsWidth;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ mainContentWidth += zmhsWidth / 2;
|
|
|
+ leftContentWidth = 100 - mainContentWidth;
|
|
|
+ }
|
|
|
+ $('#leftContent').css('width', `${leftContentWidth}%`);
|
|
|
+ setLocalCache(leftContentKey, `${leftContentWidth}%`);
|
|
|
+ $('#mainContent').css('width', `${mainContentWidth}%`);
|
|
|
+ setLocalCache(mainContentKey, `${mainContentWidth}%`);
|
|
|
+ $('#zmhsContent').css('width', `${zmhsWidth}%`);
|
|
|
+ setLocalCache(zmhsContentKey, `${zmhsWidth}%`);
|
|
|
+ }
|
|
|
$('#zmhs').click(function () {
|
|
|
if(!$(this).hasClass('active')){
|
|
|
$(this).addClass('active');
|
|
|
- $('#mainContent').css('width', '50%');
|
|
|
+ refreshAfterZmhs(true);
|
|
|
$('#zmhsContent').show();
|
|
|
- loadSize(sideResizeEles, 'width', function(){
|
|
|
-
|
|
|
- });
|
|
|
if(!coeOprObj.workBook){
|
|
|
pageObj.initPage();
|
|
|
}
|
|
|
- coeOprObj.workBook.refresh();
|
|
|
- gljAdjOprObj.workBook.refresh();
|
|
|
- rationOprObj.workBook.refresh();
|
|
|
- rationGLJOprObj.sheet.getParent().refresh();
|
|
|
+ refreshALlWorkBook();
|
|
|
} else {
|
|
|
$(this).removeClass('active');
|
|
|
- $('#mainContent').css('width', '75%')
|
|
|
+ refreshAfterZmhs(false);
|
|
|
$('#zmhsContent').hide();
|
|
|
- rationOprObj.workBook.refresh();
|
|
|
- rationGLJOprObj.sheet.getParent().refresh();
|
|
|
+ refreshALlWorkBook();
|
|
|
}
|
|
|
});
|
|
|
+ //子目换算和调整表上下拖动
|
|
|
+ let zmhsAdjResize = getZmhsAdjResize();
|
|
|
+ slideResize(zmhsAdjResize, {min: 150, max: `$('#zmhsContent').height() - 140`}, 'height', function () {
|
|
|
+ if (coeOprObj.workBook) {
|
|
|
+ coeOprObj.workBook.refresh();
|
|
|
+ }
|
|
|
+ if (gljAdjOprObj.workBook) {
|
|
|
+ gljAdjOprObj.workBook.refresh();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ loadZmhsAdjSize(zmhsAdjResize);
|
|
|
});
|
|
|
+function getZmhsAdjResize() {
|
|
|
+ let zmhsAdjResize = {};
|
|
|
+ zmhsAdjResize.id = '#stdZmhsAdj';
|
|
|
+ zmhsAdjResize.resize = $('#zmhsAdjResize')
|
|
|
+ zmhsAdjResize.nearElement = $('#mainSpread');
|
|
|
+ zmhsAdjResize.nearSpread = $('#mainSpread');
|
|
|
+ zmhsAdjResize.farElement = $('#contentSpread')
|
|
|
+ zmhsAdjResize.farSpread = $('#contentSpread');
|
|
|
+ zmhsAdjResize.nav = null;
|
|
|
+ return zmhsAdjResize;
|
|
|
+}
|
|
|
+function loadZmhsAdjSize(resizeObj) {
|
|
|
+ if (!resizeObj) {
|
|
|
+ resizeObj = getZmhsAdjResize();
|
|
|
+ }
|
|
|
+ loadSize(resizeObj, 'height', function () {
|
|
|
+ if (coeOprObj.workBook) {
|
|
|
+ coeOprObj.workBook.refresh();
|
|
|
+ }
|
|
|
+ if (gljAdjOprObj.workBook) {
|
|
|
+ gljAdjOprObj.workBook.refresh();
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
var pageObj = {
|
|
|
libID: null,
|
|
|
gljLibID: null,
|
|
|
@@ -413,10 +500,12 @@ let gljAdjOprObj = {
|
|
|
{headerName:"名称", headerWidth:100, dataCode:"gljName", dataType: "String", hAlign: "center", vAlign: "center", readOnly: true},
|
|
|
{headerName:"操作符", headerWidth:60, dataCode:"operator", dataType: "String", hAlign: "center", vAlign: "center", readOnly: false},
|
|
|
{headerName:"数量", headerWidth:80, dataCode:"amount", dataType: "String", hAlign: "center", vAlign: "center" , readOnly: false},
|
|
|
+ {headerName:"替换为编码", headerWidth:80, dataCode:"replaceCode", dataType: "String", formatter: '@', hAlign: "center", vAlign: "center", readOnly: false},
|
|
|
+ {headerName:"替换为名称", headerWidth:100, dataCode:"replaceName", dataType: "String", hAlign: "center", vAlign: "center", readOnly: true}
|
|
|
],
|
|
|
comboItems: {
|
|
|
//调整类型下拉菜单
|
|
|
- coeType: ['定额', '人工', '材料', '机械', '主材', '设备', '单个工料机'],
|
|
|
+ coeType: ['定额', '人工', '材料', '机械', '主材', '设备', '单个工料机','替换人材机'],
|
|
|
//操作符下拉菜单
|
|
|
operator: ['+', '-', '*', '/', '=']
|
|
|
}
|
|
|
@@ -463,8 +552,16 @@ let gljAdjOprObj = {
|
|
|
},
|
|
|
onEditStart: function (sender, args) {
|
|
|
let me = gljAdjOprObj;
|
|
|
- if(!coeOprObj.currentCoe || args.row >= me.currentGljAdjList.length && args.col === 1
|
|
|
- || args.row < me.currentGljAdjList.length && args.col === 1 && me.currentGljAdjList[args.row].coeType !== '单个工料机'){
|
|
|
+ let dataCode = me.setting.header[args.col].dataCode;
|
|
|
+ if(!coeOprObj.currentCoe || args.row >= me.currentGljAdjList.length ){//超出编辑范围
|
|
|
+ if(dataCode=== 'gljCode' || dataCode=== 'replaceCode') args.cancel = true;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(dataCode=== 'gljCode' && me.currentGljAdjList[args.row].coeType !== '单个工料机'&& me.currentGljAdjList[args.row].coeType !== '替换人材机'){ //单个人才机和替换人材机,编码才能编辑
|
|
|
+ args.cancel = true;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(dataCode=== 'replaceCode' && me.currentGljAdjList[args.row].coeType !== '替换人材机'){//替换人材机类型 替换编码才能编辑
|
|
|
args.cancel = true;
|
|
|
}
|
|
|
},
|
|
|
@@ -481,14 +578,22 @@ let gljAdjOprObj = {
|
|
|
//update
|
|
|
if(args.row < me.currentGljAdjList.length && args.editingText.toString().trim() !== me.currentGljAdjList[args.row][dataCode]){
|
|
|
let updateObj = me.currentGljAdjList[args.row];
|
|
|
- if(dataCode === 'gljCode' && typeof updateObj.coeType !== 'undefined' && updateObj.coeType === '单个工料机'){
|
|
|
+ if(dataCode === 'gljCode' && typeof updateObj.coeType !== 'undefined' && (updateObj.coeType === '单个工料机'||updateObj.coeType === '替换人材机')){
|
|
|
let gljName = me.getGljName(args.editingText, me.gljList);
|
|
|
if(gljName){
|
|
|
updateObj.gljCode = args.editingText;
|
|
|
updateObj.gljName = gljName;
|
|
|
isUpdate = true;
|
|
|
+ } else {
|
|
|
+ alert("不存在编号为"+ args.editingText +"的工料机");
|
|
|
}
|
|
|
- else {
|
|
|
+ }else if(dataCode === 'replaceCode' && typeof updateObj.coeType !== 'undefined' && updateObj.coeType === '替换人材机'){
|
|
|
+ let gljName = me.getGljName(args.editingText, me.gljList);
|
|
|
+ if(gljName){
|
|
|
+ updateObj.replaceCode = args.editingText;
|
|
|
+ updateObj.replaceName = gljName;
|
|
|
+ isUpdate = true;
|
|
|
+ } else {
|
|
|
alert("不存在编号为"+ args.editingText +"的工料机");
|
|
|
}
|
|
|
}
|
|
|
@@ -497,6 +602,8 @@ let gljAdjOprObj = {
|
|
|
updateObj[dataCode] = args.editingText;
|
|
|
updateObj.gljCode = '';
|
|
|
updateObj.gljName = '';
|
|
|
+ updateObj.replaceCode = '';
|
|
|
+ updateObj.replaceName = '';
|
|
|
}
|
|
|
else if(dataCode !== 'gljCode') {
|
|
|
isUpdate = true;
|