|
|
@@ -12,16 +12,70 @@ function getPasteHint (str, row = '') {
|
|
|
}
|
|
|
return returnObj;
|
|
|
}
|
|
|
+let show_node = false;
|
|
|
function resetExTpTable() {
|
|
|
- const rate = $('#rateInput').val();
|
|
|
- const bqhs = ZhCalc.round(ZhCalc.mul(ex_tp, 1+rate/100), materialDecimal.tp);
|
|
|
- const jzbqhs = ZhCalc.add(ex_pre_tp_hs, bqhs);
|
|
|
- $('#tp_set').find('td').eq(3).text(ZhCalc.round(ex_tp, materialDecimal.tp));
|
|
|
- $('#tp_set').find('td').eq(4).text(ZhCalc.add(ex_pre_tp, ZhCalc.round(ex_tp, materialDecimal.tp)));
|
|
|
- $('#rate_set').find('td').eq(3).text(bqhs !== 0 ? bqhs : '');
|
|
|
- $('#rate_set').find('td').eq(4).text(jzbqhs !== 0 ? jzbqhs : '');
|
|
|
- // $('#ex_expr').html(ex_expr);
|
|
|
- $('#ex_expr').attr('data-original-title', '本期价差:' + (ex_expr ? ex_expr : ''));
|
|
|
+ $('#tj_ledger').children('td').eq(1).text(ex_tp ? ZhCalc.round(ex_tp, materialExponentDecimal.tp) : '');
|
|
|
+ $('#tj_ledger').children('td').eq(2).text(ex_tax_tp ? ZhCalc.round(ex_tax_tp, materialExponentDecimal.tp) : '');
|
|
|
+ $('#tj_ledger').children('td').eq(3).text(ZhCalc.add(ex_pre_tp, ZhCalc.round(ex_tp, materialExponentDecimal.tp)));
|
|
|
+ $('#tj_ledger').children('td').eq(4).text(ZhCalc.add(ex_pre_tp_hs, ZhCalc.round(ex_tax_tp, materialExponentDecimal.tp)));
|
|
|
+ $('#total_set').children('td').eq(1).text(ex_tp ? ZhCalc.round(ex_tp, materialExponentDecimal.tp) : '');
|
|
|
+ $('#total_set').children('td').eq(2).text(ex_tax_tp ? ZhCalc.round(ex_tax_tp, materialExponentDecimal.tp) : '');
|
|
|
+ $('#total_set').children('td').eq(3).text(ZhCalc.add(ex_pre_tp, ZhCalc.round(ex_tp, materialExponentDecimal.tp)));
|
|
|
+ $('#total_set').children('td').eq(4).text(ZhCalc.add(ex_pre_tp_hs, ZhCalc.round(ex_tax_tp, materialExponentDecimal.tp)));
|
|
|
+ if (exponent_nodes) {
|
|
|
+ const materialExponentNodeSort = exponent_nodes ? ['-1'].concat(exponent_nodes.split(',')) : [];
|
|
|
+ const map = Object.fromEntries(materialExponentNodeSort.map((v, i) => [v, i]));
|
|
|
+ materialExponentNodeData = materialExponentNodeData.sort((a, b) => map[a.node] - map[b.node]);
|
|
|
+ let html = '';
|
|
|
+ for (const node of materialExponentNodeSort) {
|
|
|
+ const mnList = _.filter(materialExponentNodeData, { node });
|
|
|
+ const one_mn = mnList[0];
|
|
|
+ let total_tp = 0;
|
|
|
+ let total_tax_tp = 0;
|
|
|
+ let total_pre_tp = one_mn.ex_pre_tp || 0;
|
|
|
+ let total_pre_tp_hs = one_mn.ex_tax_pre_tp || 0;
|
|
|
+ // 汇总
|
|
|
+ for (const mn of mnList) {
|
|
|
+ total_tp = ZhCalc.add(total_tp, mn.ex_tp ? mn.ex_tp : 0);
|
|
|
+ total_tax_tp = ZhCalc.add(total_tax_tp, mn.ex_tax_tp ? mn.ex_tax_tp : 0);
|
|
|
+ total_pre_tp = ZhCalc.add(total_pre_tp, mn.ex_tp ? mn.ex_tp : 0);
|
|
|
+ total_pre_tp_hs = ZhCalc.add(total_pre_tp_hs, mn.ex_tax_tp ? mn.ex_tax_tp : 0);
|
|
|
+ }
|
|
|
+ const exprHtml = isStageSelf ? '' : `<a href="javascript:void(0);" data-toggle="tooltip" data-placement="bottom" title="${one_mn.name}(${one_mn.code})价差:${one_mn.ex_expr ? one_mn.ex_expr : ''}"><i class="fa fa-question-circle-o"></i></a>`;
|
|
|
+ html += `<tr id="tj_node_${node}">
|
|
|
+ <td class="text-center">${one_mn.name}(${one_mn.code}) ${exprHtml}</td>
|
|
|
+ <td class="text-center">${total_tp}</td>
|
|
|
+ <td class="text-center">${total_tax_tp}</td>
|
|
|
+ <td class="text-center">${total_pre_tp}</td>
|
|
|
+ <td class="text-center">${total_pre_tp_hs}</td>
|
|
|
+ </tr>`;
|
|
|
+ // if (!show_node) {
|
|
|
+ // show_node = true;
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ $('#tj_node').html(html);
|
|
|
+ $('[data-toggle="tooltip"]').tooltip();
|
|
|
+ }
|
|
|
+ if (showStageExponent) {
|
|
|
+ $('#total_stage').children('td').eq(1).text(ex_tp ? ZhCalc.round(ex_tp, materialExponentDecimal.tp) : '');
|
|
|
+ $('#total_stage').children('td').eq(2).text(ex_tax_tp ? ZhCalc.round(ex_tax_tp, materialExponentDecimal.tp) : '');
|
|
|
+ for (const ms of materialStageData) {
|
|
|
+ if (!exponent_nodes) {
|
|
|
+ $('.ex_expr_' + ms.order).attr('data-original-title', '第' + ms.order + '期价差:' + (ms.ex_expr ? ms.ex_expr : ''));
|
|
|
+ }
|
|
|
+ $('#tj_stage_' + ms.order).children('td').eq(1).text(ms.ex_tp ? ZhCalc.round(ms.ex_tp, materialExponentDecimal.tp) : '');
|
|
|
+ $('#tj_stage_' + ms.order).children('td').eq(2).text(ms.ex_tax_tp ? ZhCalc.round(ms.ex_tax_tp, materialExponentDecimal.tp) : '');
|
|
|
+ }
|
|
|
+ if (exponent_nodes) {
|
|
|
+ for (const mn of materialExponentNodeData) {
|
|
|
+ $('.ex_expr_node_' + mn.id).attr('data-original-title', mn.name + '价差:' + (mn.ex_expr ? mn.ex_expr : ''));
|
|
|
+ $('#tj_node_' + mn.id).children('td').eq(1).text(mn.ex_tp ? ZhCalc.round(mn.ex_tp, materialExponentDecimal.tp) : '');
|
|
|
+ $('#tj_node_' + mn.id).children('td').eq(2).text(mn.ex_tax_tp ? ZhCalc.round(mn.ex_tax_tp, materialExponentDecimal.tp) : '');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $('#ex_expr').attr('data-original-title', '本期价差:' + (ex_expr ? ex_expr : ''));
|
|
|
+ }
|
|
|
}
|
|
|
$(document).ready(() => {
|
|
|
autoFlashHeight();
|
|
|
@@ -32,11 +86,11 @@ $(document).ready(() => {
|
|
|
{title: '符号', colSpan: '1', rowSpan: '2', field: 'symbol', hAlign: 1, width: 60, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
{title: '符号说明', colSpan: '1', rowSpan: '2', field: 'symbol_desc', hAlign: 0, width: 180, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
{title: '编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 1, width: 60, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
- {title: '加权系数', colSpan: '1', rowSpan: '2', field: 'weight_num', hAlign: 2, width: 120, formatter: '@', readOnly: 'readOnly.isConstant'},
|
|
|
- {title: '基本价格指数', colSpan: '1', rowSpan: '2', field: 'basic_price', hAlign: 2, width: 120, readOnly: 'readOnly.isEdit'},
|
|
|
+ {title: '基本价格指数(F0)', colSpan: '1', rowSpan: '2', field: 'basic_price', hAlign: 2, width: 120, readOnly: 'readOnly.isEdit'},
|
|
|
{title: '基准时间', colSpan: '1', rowSpan: '2', field: 'basic_times', hAlign: 0, width: 80, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
- {title: '现行价格指数', colSpan: '1', rowSpan: '2', field: 'm_price', hAlign: 2, width: 120, type: 'Number', readOnly: 'readOnly.remark'},
|
|
|
- {title: '计算值', colSpan: '1', rowSpan: '2', field: 'calc_num', hAlign: 2, width: 80, formatter: '@', readOnly: true},
|
|
|
+ {title: '现行价格指数(Ft)', colSpan: '1', rowSpan: '2', field: 'm_price', hAlign: 2, width: 120, type: 'Number', readOnly: 'readOnly.remark'},
|
|
|
+ {title: '加权系数(B)', colSpan: '1', rowSpan: '2', field: 'weight_num', hAlign: 2, width: 120, formatter: '@', readOnly: 'readOnly.isConstant'},
|
|
|
+ {title: '计算值(Ft/F0*B)', colSpan: '1', rowSpan: '2', field: 'calc_num', hAlign: 2, width: 100, formatter: '@', readOnly: true, getValue: 'getValue.calc_num'},
|
|
|
{title: '备注', colSpan: '1', rowSpan: '2', field: 'remark', hAlign: 0, width: 60, formatter: '@', readOnly: 'readOnly.remark'},
|
|
|
{title: '是否汇总', colSpan: '1', rowSpan: '2', field: 'is_summary', hAlign: 1, width: 60, cellType: 'checkbox', readOnly: 'readOnly.isEdit'},
|
|
|
],
|
|
|
@@ -66,8 +120,9 @@ $(document).ready(() => {
|
|
|
const materialExponentCol = {
|
|
|
getValue: {
|
|
|
calc_num : function (data) {
|
|
|
+ if (data.type === 1) return null;
|
|
|
const calc_num = data.basic_price > 0 ? ZhCalc.mul(data.weight_num, ZhCalc.div(data.m_price, data.basic_price)) : 0;
|
|
|
- return calc_num > 0 ? ZhCalc.round(calc_num, 3) : 0;
|
|
|
+ return calc_num > 0 ? ZhCalc.round(calc_num, materialExponentDecimal.qty) : 0;
|
|
|
},
|
|
|
},
|
|
|
readOnly: {
|
|
|
@@ -86,11 +141,135 @@ $(document).ready(() => {
|
|
|
}
|
|
|
},
|
|
|
};
|
|
|
- SpreadJsObj.initSpreadSettingEvents(materialExponentSpreadSetting, materialExponentCol);
|
|
|
- SpreadJsObj.initSheet(materialExponentSpread.getActiveSheet(), materialExponentSpreadSetting);
|
|
|
- SpreadJsObj.loadSheetData(materialExponentSpread.getActiveSheet(), SpreadJsObj.DataType.Data, materialExponentData);
|
|
|
+
|
|
|
+ const needUpdateArray = ['m_price', 'remark'];
|
|
|
|
|
|
const materialExponentSpreadObj = {
|
|
|
+ getMaterialExponentData: function (msid = null, mnid = null) {
|
|
|
+ const ms_id = msid || $('#myTab').find('.active').attr('data-msid') || null;
|
|
|
+ const mn_id = mnid || $('#myTab2').find('.active').attr('data-mnid') || null;
|
|
|
+ if (ms_id || mn_id) {
|
|
|
+ const condition = {};
|
|
|
+ if (ms_id) condition.ms_id = parseInt(ms_id);
|
|
|
+ if (mn_id) condition.mn_id = parseInt(mn_id);
|
|
|
+ const mseList = _.filter(materialExponentShardData, condition);
|
|
|
+ console.log(mseList);
|
|
|
+ for (const me of materialExponentData) {
|
|
|
+ me.ms_id = ms_id ? parseInt(ms_id) : null;
|
|
|
+ me.mn_id = mn_id ? parseInt(mn_id) : null;
|
|
|
+ const mseInfo = _.find(mseList, { me_id: me.me_id ? me.me_id : me.id });
|
|
|
+ console.log(mseInfo);
|
|
|
+ if (mseInfo) {
|
|
|
+ for (const nu of needUpdateArray) {
|
|
|
+ me[nu] = mseInfo[nu];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(materialExponentData, materialExponentShardData);
|
|
|
+ return materialExponentData;
|
|
|
+ },
|
|
|
+ updateMaterialNodeTab: function () {
|
|
|
+ const nodeList = $('#myTab2').find('li');
|
|
|
+ const nowli = $('#myTab2').find('.active');
|
|
|
+ const materialExponentNodeSort = exponent_nodes ? ['-1'].concat(exponent_nodes.split(',')) : [];
|
|
|
+ const map = Object.fromEntries(materialExponentNodeSort.map((v, i) => [v, i]));
|
|
|
+ materialExponentNodeData = materialExponentNodeData.sort((a, b) => map[a.node] - map[b.node]);
|
|
|
+ const newNodeList = _.filter(materialExponentNodeData, { ms_id: parseInt($('#myTab').find('.active').attr('data-msid')) });
|
|
|
+ for (const n of nodeList) {
|
|
|
+ const node = $(n).children('a').attr('data-node');
|
|
|
+ const nl = _.find(newNodeList, { node });
|
|
|
+ $(n).children('a').attr('data-mnid', nl.id);
|
|
|
+ }
|
|
|
+ const newMnid = parseInt(nowli.attr('data-mnid'));
|
|
|
+ materialExponentSpreadObj.getMaterialExponentData($('#myTab').find('.active').attr('data-msid'), newMnid);
|
|
|
+ materialExponentSpreadObj.materialSheetReset(true);
|
|
|
+ setExCalc($('#myTab').find('.active').attr('data-msid'), newMnid);
|
|
|
+ },
|
|
|
+ updateOneMaterialExponent: function (data) {
|
|
|
+ const ms_id = $('#myTab').find('.active').attr('data-msid') || null;
|
|
|
+ const mn_id = $('#myTab2').find('.active').attr('data-mnid') || null;
|
|
|
+ const condition = { me_id: data.id };
|
|
|
+ if (ms_id) condition.ms_id = parseInt(ms_id);
|
|
|
+ if (mn_id) condition.mn_id = parseInt(mn_id);
|
|
|
+ const mseInfo = _.find(materialExponentShardData, condition);
|
|
|
+ console.log(mseInfo);
|
|
|
+ data.ms_id = ms_id ? parseInt(ms_id) : null;
|
|
|
+ data.mn_id = mn_id ? parseInt(mn_id) : null;
|
|
|
+ for (const nu of needUpdateArray) {
|
|
|
+ data[nu] = mseInfo[nu];
|
|
|
+ }
|
|
|
+ return data;
|
|
|
+ },
|
|
|
+ updateMaterialData: function (datas) {
|
|
|
+ if (datas.stageData && datas.stageData.length > 0) {
|
|
|
+ if (datas.stageData.length === materialStageData.length) {
|
|
|
+ // 全体替换
|
|
|
+ materialStageData = datas.stageData;
|
|
|
+ } else {
|
|
|
+ // 替换对应的stage数据
|
|
|
+ for (const s of datas.stageData) {
|
|
|
+ const index = _.findIndex(materialStageData, { id: s.id });
|
|
|
+ materialStageData.splice(index, 1, s);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (datas.nodeData && datas.nodeData.length > 0) {
|
|
|
+ if (datas.nodeData.length === materialExponentNodeData.length) {
|
|
|
+ // 全体替换
|
|
|
+ materialExponentNodeData = datas.nodeData;
|
|
|
+ } else {
|
|
|
+ // 替换对应的stage数据
|
|
|
+ for (const s of datas.nodeData) {
|
|
|
+ const index = _.findIndex(materialExponentNodeData, { id: s.id });
|
|
|
+ materialExponentNodeData.splice(index, 1, s);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (datas.pushExponentShardData && datas.pushExponentShardData.length > 0) {
|
|
|
+ materialExponentShardData = _.concat(materialExponentShardData, datas.pushExponentShardData);
|
|
|
+ }
|
|
|
+ if (datas.removeExponentShardData && datas.removeExponentShardData.length > 0) {
|
|
|
+ materialExponentShardData = _.remove(materialExponentShardData, function (item) {
|
|
|
+ return _.findIndex(datas.removeExponentShardData, { id: item.me_id }) === -1
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (datas.exponentShardData && datas.exponentShardData.length > 0) {
|
|
|
+ if (datas.exponentShardData.length === materialExponentShardData.length) {
|
|
|
+ // 全体替换
|
|
|
+ materialExponentShardData = datas.exponentShardData;
|
|
|
+ } else {
|
|
|
+ // 替换对应的stage数据
|
|
|
+ for (const s of datas.exponentShardData) {
|
|
|
+ const index = _.findIndex(materialExponentShardData, { id: s.id });
|
|
|
+ materialExponentShardData.splice(index, 1, s);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (datas.exponentData && datas.exponentData.length > 0) {
|
|
|
+ if (datas.exponentData.length === materialExponentData.length) {
|
|
|
+ // 全体替换
|
|
|
+ materialExponentData = datas.exponentData;
|
|
|
+ materialExponentSpreadObj.getMaterialExponentData();
|
|
|
+ } else {
|
|
|
+ for (const b of datas.exponentData) {
|
|
|
+ const index = _.findIndex(materialExponentData, {id: b.id});
|
|
|
+ materialExponentData.splice(index, 1, b);
|
|
|
+ materialExponentSpreadObj.updateOneMaterialExponent(materialExponentData[index]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ materialSheetReset: function (redo = false) {
|
|
|
+ let newMaterialExponentData = _.cloneDeep(materialExponentData);
|
|
|
+ if (redo) {
|
|
|
+ materialExponentSpread.getActiveSheet().reset();
|
|
|
+ SpreadJsObj.initSpreadSettingEvents(materialExponentSpreadSetting, materialExponentCol);
|
|
|
+ SpreadJsObj.initSheet(materialExponentSpread.getActiveSheet(), materialExponentSpreadSetting);
|
|
|
+ }
|
|
|
+ SpreadJsObj.loadSheetData(materialExponentSpread.getActiveSheet(), SpreadJsObj.DataType.Data, newMaterialExponentData);
|
|
|
+ materialExponentSpreadObj.refreshActn();
|
|
|
+ },
|
|
|
refreshActn: function (rowCount = 1) {
|
|
|
const setObjEnable = function (obj, enable) {
|
|
|
if (enable) {
|
|
|
@@ -108,9 +287,12 @@ $(document).ready(() => {
|
|
|
const sheet = materialExponentSpread.getActiveSheet();
|
|
|
postData(window.location.pathname + '/save', {type: 'add'}, function (result) {
|
|
|
if (result) {
|
|
|
- materialExponentData.push(result);
|
|
|
- sheet.addRows(materialExponentData.length - 1, 1);
|
|
|
- SpreadJsObj.reLoadRowData(sheet, materialExponentData.length - 1);
|
|
|
+ materialExponentData.push(result.info);
|
|
|
+ if (showStageExponent || exponent_nodes) {
|
|
|
+ materialExponentSpreadObj.updateMaterialData(result);
|
|
|
+ materialExponentSpreadObj.getMaterialExponentData();
|
|
|
+ }
|
|
|
+ SpreadJsObj.loadSheetData(materialExponentSpread.getActiveSheet(), SpreadJsObj.DataType.Data, materialExponentData);
|
|
|
sheet.setSelection(materialExponentData.length - 1, 0, 1, 1);
|
|
|
materialExponentSpreadObj.refreshActn();
|
|
|
}
|
|
|
@@ -119,14 +301,20 @@ $(document).ready(() => {
|
|
|
del: function () {
|
|
|
const sheet = materialExponentSpread.getActiveSheet();
|
|
|
const select = SpreadJsObj.getSelectObject(sheet);
|
|
|
+ const sel = sheet.getSelections();
|
|
|
postData(window.location.pathname + '/save', {type: 'del', id: select.id}, function (result) {
|
|
|
ex_tp = result.ex_tp;
|
|
|
- ex_expr = result.ex_expr;
|
|
|
- resetExTpTable();
|
|
|
- const index = materialExponentData.indexOf(select);
|
|
|
+ ex_tax_tp = result.ex_tax_tp;
|
|
|
+ ex_expr = result.ex_expr || null;
|
|
|
+ const index = _.findIndex(materialExponentData, { id: select.id });
|
|
|
materialExponentData.splice(index, 1);
|
|
|
- sheet.deleteRows(index, 1);
|
|
|
- const sel = sheet.getSelections();
|
|
|
+ if (showStageExponent || exponent_nodes) {
|
|
|
+ result.removeExponentShardData = [{ id: select.id }];
|
|
|
+ materialExponentSpreadObj.updateMaterialData(result);
|
|
|
+ materialExponentSpreadObj.getMaterialExponentData();
|
|
|
+ }
|
|
|
+ materialExponentSpreadObj.materialSheetReset(true);
|
|
|
+ resetExTpTable();
|
|
|
sheet.setSelection(index > 0 ? index - 1 : 0, sel.length > 0 ? sel[0].col : 0, 1, 1);
|
|
|
materialExponentSpreadObj.refreshActn();
|
|
|
});
|
|
|
@@ -204,12 +392,16 @@ $(document).ready(() => {
|
|
|
// console.log(select);
|
|
|
|
|
|
// 更新至服务器
|
|
|
- postData(window.location.pathname + '/save', { type:'update', updateData: select }, function (result) {
|
|
|
+ postData(window.location.pathname + '/save', { type:'update', updateData: select, ms_id: $('#myTab').find('.active').attr('data-msid') || null, mn_id: $('#myTab2').find('.active').attr('data-mnid') || null }, function (result) {
|
|
|
ex_tp = result.ex_tp;
|
|
|
- ex_expr = result.ex_expr;
|
|
|
+ ex_tax_tp = result.ex_tax_tp;
|
|
|
+ ex_expr = result.ex_expr || null;
|
|
|
+ if (showStageExponent || exponent_nodes) {
|
|
|
+ materialExponentSpreadObj.updateMaterialData(result);
|
|
|
+ }
|
|
|
resetExTpTable();
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
- materialExponentData.splice(info.row, 1, select);
|
|
|
+ // materialExponentData.splice(info.row, 1, select);
|
|
|
}, function () {
|
|
|
select[col.field] = orgValue;
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
@@ -236,9 +428,13 @@ $(document).ready(() => {
|
|
|
select.is_summary = info.sheet.getValue(info.row, info.col) ? 1 : 0;
|
|
|
delete select.waitingLoading;
|
|
|
// 更新至服务器
|
|
|
- postData(window.location.pathname + '/save', { type:'update', updateData: select }, function (result) {
|
|
|
+ postData(window.location.pathname + '/save', { type:'update', updateData: select, ms_id: $('#myTab').find('.active').attr('data-msid') || null, mn_id: $('#myTab2').find('.active').attr('data-mnid') || null }, function (result) {
|
|
|
ex_tp = result.ex_tp;
|
|
|
- ex_expr = result.ex_expr;
|
|
|
+ ex_tax_tp = result.ex_tax_tp;
|
|
|
+ ex_expr = result.ex_expr || null;
|
|
|
+ if (showStageExponent || exponent_nodes) {
|
|
|
+ materialExponentSpreadObj.updateMaterialData(result);
|
|
|
+ }
|
|
|
resetExTpTable();
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
}, function () {
|
|
|
@@ -292,11 +488,15 @@ $(document).ready(() => {
|
|
|
return;
|
|
|
}
|
|
|
// 更新至服务器
|
|
|
- postData(window.location.pathname + '/save', { type:'paste', updateData: data }, function (result) {
|
|
|
- materialExponentData = result.info;
|
|
|
- SpreadJsObj.loadSheetData(materialExponentSpread.getActiveSheet(), SpreadJsObj.DataType.Data, materialExponentData);
|
|
|
+ postData(window.location.pathname + '/save', { type:'paste', updateData: data, ms_id: $('#myTab').find('.active').attr('data-msid') || null, mn_id: $('#myTab2').find('.active').attr('data-mnid') || null }, function (result) {
|
|
|
ex_tp = result.ex_tp;
|
|
|
- ex_expr = result.ex_expr;
|
|
|
+ ex_tax_tp = result.ex_tax_tp;
|
|
|
+ ex_expr = result.ex_expr || null;
|
|
|
+ materialExponentSpreadObj.updateMaterialData(result);
|
|
|
+ if (showStageExponent || exponent_nodes) {
|
|
|
+ materialExponentSpreadObj.getMaterialExponentData();
|
|
|
+ }
|
|
|
+ SpreadJsObj.loadSheetData(materialExponentSpread.getActiveSheet(), SpreadJsObj.DataType.Data, materialExponentData);
|
|
|
resetExTpTable();
|
|
|
}, function () {
|
|
|
SpreadJsObj.reLoadSheetData(sheet);
|
|
|
@@ -415,11 +615,15 @@ $(document).ready(() => {
|
|
|
}
|
|
|
// console.log(data);
|
|
|
// 更新至服务器
|
|
|
- postData(window.location.pathname + '/save', { type:'paste', updateData: data }, function (result) {
|
|
|
- materialExponentData = result.info;
|
|
|
- SpreadJsObj.loadSheetData(materialExponentSpread.getActiveSheet(), SpreadJsObj.DataType.Data, materialExponentData);
|
|
|
+ postData(window.location.pathname + '/save', { type:'paste', updateData: data, ms_id: $('#myTab').find('.active').attr('data-msid') || null, mn_id: $('#myTab2').find('.active').attr('data-mnid') || null }, function (result) {
|
|
|
ex_tp = result.ex_tp;
|
|
|
- ex_expr = result.ex_expr;
|
|
|
+ ex_tax_tp = result.ex_tax_tp;
|
|
|
+ ex_expr = result.ex_expr || null;
|
|
|
+ materialExponentSpreadObj.updateMaterialData(result);
|
|
|
+ if (showStageExponent || exponent_nodes) {
|
|
|
+ materialExponentSpreadObj.getMaterialExponentData();
|
|
|
+ }
|
|
|
+ SpreadJsObj.loadSheetData(materialExponentSpread.getActiveSheet(), SpreadJsObj.DataType.Data, materialExponentData);
|
|
|
resetExTpTable();
|
|
|
}, function () {
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
|
|
|
@@ -428,10 +632,185 @@ $(document).ready(() => {
|
|
|
},
|
|
|
setReadOnly: function(readOnly) {
|
|
|
// SpreadJsObj.resetFieldReadOnly(materialSpread.getActiveSheet(), 'msg_spread', 'm_spread', 'm_tp', 'pre_tp', readOnly);
|
|
|
- }
|
|
|
+ },
|
|
|
+ _checkExprValid(expr) {
|
|
|
+ if (!expr) return [true, null];
|
|
|
+ const param = [];
|
|
|
+ let num = '', base = '';
|
|
|
+ for (let i = 0, iLen = expr.length; i < iLen; i++) {
|
|
|
+ if (/^[\d\.%]+/.test(expr[i])) {
|
|
|
+ if (base !== '') {
|
|
|
+ param.push({type: 'base', value: base});
|
|
|
+ base = '';
|
|
|
+ }
|
|
|
+ num = num + expr[i];
|
|
|
+ } else if (expr[i] === '(') {
|
|
|
+ if (num !== '') {
|
|
|
+ param.push({type: 'num', value: num});
|
|
|
+ num = '';
|
|
|
+ }
|
|
|
+ if (base !== '') {
|
|
|
+ param.push({type: 'base', value: base});
|
|
|
+ base = '';
|
|
|
+ }
|
|
|
+ param.push({type: 'left', value: '('});
|
|
|
+ } else if (expr[i] === ')') {
|
|
|
+ if (num !== '') {
|
|
|
+ param.push({type: 'num', value: num});
|
|
|
+ num = '';
|
|
|
+ }
|
|
|
+ if (base !== '') {
|
|
|
+ param.push({type: 'base', value: base});
|
|
|
+ base = '';
|
|
|
+ }
|
|
|
+ param.push({type: 'right', value: ')'});
|
|
|
+ } else if (/^[\+\-*\/]/.test(expr[i])) {
|
|
|
+ if (num !== '') {
|
|
|
+ param.push({type: 'num', value: num});
|
|
|
+ num = '';
|
|
|
+ }
|
|
|
+ if (base !== '') {
|
|
|
+ param.push({type: 'base', value: base});
|
|
|
+ base = '';
|
|
|
+ }
|
|
|
+ param.push({type: 'calc', value: expr[i]});
|
|
|
+ } else {
|
|
|
+ return [false, '输入的表达式含有非法字符: ' + expr[i]];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (num !== '') {
|
|
|
+ param.push({type: 'num', value: num});
|
|
|
+ num = '';
|
|
|
+ }
|
|
|
+ if (base !== '') {
|
|
|
+ param.push({type: 'base', value: base});
|
|
|
+ base = '';
|
|
|
+ }
|
|
|
+ if (param.length === 0) return true;
|
|
|
+ if (param.length > 1) {
|
|
|
+ if (param[0].value === '-' && param[1].type === 'num') {
|
|
|
+ param[1].value = '-' + param[1].value;
|
|
|
+ param.shift();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const iLen = param.length;
|
|
|
+ let iLeftCount = 0, iRightCount = 0;
|
|
|
+ for (const [i, p] of param.entries()) {
|
|
|
+ if (p.type === 'calc') {
|
|
|
+ if (i === 0 || i === iLen - 1)
|
|
|
+ return [false, '输入的表达式非法:计算符号' + p.value + '前后应有数字'];
|
|
|
+ }
|
|
|
+ if (p.type === 'num') {
|
|
|
+ num = p.value.replace('%', '');
|
|
|
+ if (p.value.length - num.length > 1)
|
|
|
+ return [false, '输入的表达式非法:' + p.value + '不是一个有效的数字'];
|
|
|
+ num = _.toNumber(num);
|
|
|
+ if (num === undefined || num === null || _.isNaN(num))
|
|
|
+ return [false, '输入的表达式非法:' + p.value + '不是一个有效的数字'];
|
|
|
+ if (i > 0) {
|
|
|
+ if (param[i - 1].type !== 'calc' && param[i - 1].type !== 'left') {
|
|
|
+ return [false, '输入的表达式非法:' + p.value + '前应有运算符'];
|
|
|
+ } else if (param[i - 1].value === '/' && num === 0) {
|
|
|
+ return [false, '输入的表达式非法:请勿除0'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (p.type === 'base') {
|
|
|
+ if (i > 0 && (param[i - 1].type === 'num' || param[i - 1].type === 'right'))
|
|
|
+ return [false, '输入的表达式非法:' + p.value + '前应有运算符'];
|
|
|
+ }
|
|
|
+ if (p.type === 'left') {
|
|
|
+ iLeftCount += 1;
|
|
|
+ if (i !== 0 && param[i-1].type !== 'calc')
|
|
|
+ return [false, '输入的表达式非法:(前应有运算符'];
|
|
|
+ }
|
|
|
+ if (p.type === 'right') {
|
|
|
+ iRightCount += 1;
|
|
|
+ if (i !== iLen - 1 && param[i+1].type !== 'calc')
|
|
|
+ return [false, '输入的表达式非法:)后应有运算符'];
|
|
|
+ if (iRightCount > iLeftCount)
|
|
|
+ return [false, '输入的表达式非法:")"前无对应的"("'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (iLeftCount > iRightCount)
|
|
|
+ return [false, '输入的表达式非法:"("后无对应的")"'];
|
|
|
+ return [true, ''];
|
|
|
+ },
|
|
|
+ _checkExpr: function (text, data) {
|
|
|
+ if (text) {
|
|
|
+ const num = _.toNumber(text);
|
|
|
+ if (num) {
|
|
|
+ data.quantity = num;
|
|
|
+ data.expr = '';
|
|
|
+ } else {
|
|
|
+ const expr = $.trim(text).replace('\t', '').replace('=', '').toLowerCase();
|
|
|
+ const [valid, msg] = this._checkExprValid(expr);
|
|
|
+ if (!valid) return [valid, msg];
|
|
|
+ data.expr = expr;
|
|
|
+ data.quantity = ZhCalc.calcExpr.calcExprStrRpn(expr.replace(new RegExp('%', 'gm'), '/100'));
|
|
|
+ // const ce = new CalcEvalMin();
|
|
|
+ // data.quantity = ce.eval(expr);
|
|
|
+ // console.log(data.quantity);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ data.quantity = 0;
|
|
|
+ data.expr = '';
|
|
|
+ }
|
|
|
+ return [true, ''];
|
|
|
+ },
|
|
|
};
|
|
|
+
|
|
|
+ SpreadJsObj.initSpreadSettingEvents(materialExponentSpreadSetting, materialExponentCol);
|
|
|
+ SpreadJsObj.initSheet(materialExponentSpread.getActiveSheet(), materialExponentSpreadSetting);
|
|
|
+ materialExponentSpreadObj.getMaterialExponentData();
|
|
|
+ SpreadJsObj.loadSheetData(materialExponentSpread.getActiveSheet(), SpreadJsObj.DataType.Data, materialExponentData);
|
|
|
+ if (showStageExponent || exponent_nodes) setExCalc();
|
|
|
+ if (exponent_nodes) resetExTpTable();
|
|
|
materialExponentSpreadObj.refreshActn();
|
|
|
|
|
|
+ // 期切换
|
|
|
+ $('#myTab a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
|
|
+ e.preventDefault();
|
|
|
+ showWaitingView();
|
|
|
+ setTimeout(function () {
|
|
|
+ if (exponent_nodes) {
|
|
|
+ materialExponentSpreadObj.updateMaterialNodeTab();
|
|
|
+ } else {
|
|
|
+ materialExponentSpreadObj.getMaterialExponentData();
|
|
|
+ materialExponentSpreadObj.materialSheetReset(true);
|
|
|
+ setExCalc();
|
|
|
+ }
|
|
|
+ closeWaitingView();
|
|
|
+ }, 1000);
|
|
|
+ });
|
|
|
+ // 分项切换
|
|
|
+ $('#myTab2 a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
|
|
+ e.preventDefault();
|
|
|
+ showWaitingView();
|
|
|
+ setTimeout(function () {
|
|
|
+ materialExponentSpreadObj.getMaterialExponentData();
|
|
|
+ materialExponentSpreadObj.materialSheetReset(true);
|
|
|
+ setExCalc();
|
|
|
+ closeWaitingView();
|
|
|
+ }, 1000);
|
|
|
+ });
|
|
|
+
|
|
|
+ function setExCalc(msid = null, mnid = null) {
|
|
|
+ let html = '';
|
|
|
+ const mn_id = mnid || $('#myTab2').find('.active').attr('data-mnid') || null;
|
|
|
+ const ms_id = msid || $('#myTab').find('.active').attr('data-msid') || null;
|
|
|
+ const condition = {};
|
|
|
+ if (mn_id) condition.mn_id = parseInt(mn_id);
|
|
|
+ if (ms_id) condition.ms_id = parseInt(ms_id);
|
|
|
+ ex_calc = _.find(ex_calcList, condition).ex_calc;
|
|
|
+ for (const bq of ex_calc) {
|
|
|
+ html += `<tr>
|
|
|
+ <td><input type="checkbox" value="${bq.code}" ${readOnly ? 'disabled' : ''} class="calc_select" ${bq.select ? 'checked' : ''}></td>
|
|
|
+ <td>${materialType.ex_basic_text[bq.code]}</td><td>${bq.code === 'zdy' && !readOnly ? `<input type="text" id="calc_zdy" class="form-control form-control-sm" value="${bq.result ? bq.result : bq.value}">` : bq.result ? bq.result : bq.value }</td>
|
|
|
+ </tr>`;
|
|
|
+ }
|
|
|
+ $('#calc_basic_select').html(html);
|
|
|
+ }
|
|
|
|
|
|
if (!readOnly) {
|
|
|
$('#add').click(materialExponentSpreadObj.add);
|
|
|
@@ -480,7 +859,7 @@ $(document).ready(() => {
|
|
|
}
|
|
|
|
|
|
// 调差基数选中
|
|
|
- $('.calc_select').on('click', function () {
|
|
|
+ $('body').on('click', '.calc_select', function () {
|
|
|
// 如果是选中则清除其余的选中
|
|
|
const code = $(this).val();
|
|
|
for (const calc of ex_calc) {
|
|
|
@@ -489,37 +868,71 @@ $(document).ready(() => {
|
|
|
$('.calc_select[value="'+ calc.code +'"]').prop('checked', false);
|
|
|
}
|
|
|
}
|
|
|
- postData(window.location.pathname + '/save', { type:'ex_calc', updateData: ex_calc }, function (result) {
|
|
|
+ postData(window.location.pathname + '/save', { type:'ex_calc', updateData: ex_calc, ms_id: $('#myTab').find('.active').attr('data-msid') || null, mn_id: $('#myTab2').find('.active').attr('data-mnid') || null }, function (result) {
|
|
|
ex_tp = result.ex_tp;
|
|
|
- ex_expr = result.ex_expr;
|
|
|
+ ex_tax_tp = result.ex_tax_tp;
|
|
|
+ ex_expr = result.ex_expr || null;
|
|
|
+ if (showStageExponent || exponent_nodes) {
|
|
|
+ materialExponentSpreadObj.updateMaterialData(result);
|
|
|
+ }
|
|
|
resetExTpTable();
|
|
|
});
|
|
|
});
|
|
|
// 回车提交
|
|
|
- $('#calc_zdy').on('keypress', function () {
|
|
|
+ $('body').on('keypress', '#calc_zdy', function () {
|
|
|
if(window.event.keyCode === 13) {
|
|
|
$(this).blur();
|
|
|
}
|
|
|
});
|
|
|
+ $('body').on('click', '#calc_zdy', function (e) {
|
|
|
+ e.stopPropagation();
|
|
|
+ const zdy = _.find(ex_calc, { code: 'zdy' });
|
|
|
+ $(this).val(zdy.value);
|
|
|
+ });
|
|
|
// 自定义金额变更并提交
|
|
|
- $('#calc_zdy').on('blur', function () {
|
|
|
- let newValue = parseFloat($(this).val());
|
|
|
- // 判断输入位数,并自动四舍五入
|
|
|
- newValue = ZhCalc.round(newValue, materialDecimal.tp);
|
|
|
- $('#calc_zdy').val(newValue);
|
|
|
- if (isNaN(newValue)) {
|
|
|
- toastr.error('请输入正确的金额');
|
|
|
- return false;
|
|
|
- }
|
|
|
+ $('body').on('blur', '#calc_zdy', function () {
|
|
|
+ let validText = $(this).val();
|
|
|
+ let newValue = is_numeric(validText) ? parseFloat(validText) : (validText ? trimInvalidChar(validText) : '');
|
|
|
const zdy = _.find(ex_calc, { code: 'zdy' });
|
|
|
if (zdy.value === newValue) {
|
|
|
+ $('#calc_zdy').val(zdy.result ? zdy.result : zdy.value);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const exprQuantity = {
|
|
|
+ expr: '',
|
|
|
+ quantity: 0,
|
|
|
+ };
|
|
|
+ const [valid, msg] = materialExponentSpreadObj._checkExpr(newValue, exprQuantity);
|
|
|
+ console.log(exprQuantity, validText, valid, msg);
|
|
|
+ if (!valid) {
|
|
|
+ toastr.error(msg);
|
|
|
+ $('#calc_zdy').val(zdy.result ? zdy.result : zdy.value);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (isNaN(exprQuantity.quantity)) {
|
|
|
+ toastr.error('不能输入其它非数字类型字符');
|
|
|
+ $('#calc_zdy').val(zdy.result ? zdy.result : zdy.value);
|
|
|
return;
|
|
|
+ }
|
|
|
+ validText = parseFloat(exprQuantity.quantity);
|
|
|
+ newValue = ZhCalc.round(validText, 6);
|
|
|
+ const gather = _.find(ex_calc, { code: 'bqwc' });
|
|
|
+ if (gather.value === newValue) {
|
|
|
+ zdy.value = gather.value;
|
|
|
+ zdy.result = '';
|
|
|
} else {
|
|
|
- zdy.value = newValue;
|
|
|
+ zdy.value = exprQuantity.expr ? exprQuantity.expr : newValue;
|
|
|
+ zdy.result = newValue;
|
|
|
}
|
|
|
- postData(window.location.pathname + '/save', { type:'ex_calc', updateData: ex_calc }, function (result) {
|
|
|
+ console.log(zdy, ex_calcList, ex_calc);
|
|
|
+ $('#calc_zdy').val(zdy.result ? zdy.result : zdy.value);
|
|
|
+ postData(window.location.pathname + '/save', { type:'ex_calc', updateData: ex_calc, ms_id: $('#myTab').find('.active').attr('data-msid') || null, mn_id: $('#myTab2').find('.active').attr('data-mnid') || null }, function (result) {
|
|
|
ex_tp = result.ex_tp;
|
|
|
- ex_expr = result.ex_expr;
|
|
|
+ ex_tax_tp = result.ex_tax_tp;
|
|
|
+ ex_expr = result.ex_expr || null;
|
|
|
+ if (showStageExponent || exponent_nodes) {
|
|
|
+ materialExponentSpreadObj.updateMaterialData(result);
|
|
|
+ }
|
|
|
resetExTpTable();
|
|
|
});
|
|
|
});
|
|
|
@@ -556,39 +969,23 @@ $(document).ready(() => {
|
|
|
console.log(rate, materialRate);
|
|
|
if (rate !== materialRate) {
|
|
|
postData(window.location.pathname + '/save', { type:'rate', rate: rate }, function (result) {
|
|
|
- const exbqhs = ZhCalc.round(ZhCalc.mul(ex_tp, 1+rate/100), materialDecimal.tp);
|
|
|
- const exjzbqhs = ZhCalc.round(ZhCalc.add(ex_pre_tp_hs, exbqhs), materialDecimal.tp);
|
|
|
- // if (!materialTax) {
|
|
|
- // const bqhs = ZhCalc.round(ZhCalc.mul(m_tp, 1+rate/100), materialDecimal.tp);
|
|
|
- // const jzbqhs = ZhCalc.round(ZhCalc.add(pre_tp_hs, bqhs), materialDecimal.tp);
|
|
|
- // $('#rate_set').find('td').eq(1).text(bqhs !== 0 ? bqhs : '');
|
|
|
- // $('#rate_set').find('td').eq(2).text(jzbqhs !== 0 ? jzbqhs : '');
|
|
|
- // }
|
|
|
- $('#rate_set').find('td').eq(3).text(exbqhs !== 0 ? exbqhs : '');
|
|
|
- $('#rate_set').find('td').eq(4).text(exjzbqhs !== 0 ? exjzbqhs : '');
|
|
|
+ // const exbqhs = ZhCalc.round(ZhCalc.mul(ex_tp, 1+rate/100), materialDecimal.tp);
|
|
|
+ // const exjzbqhs = ZhCalc.round(ZhCalc.add(ex_pre_tp_hs, exbqhs), materialDecimal.tp);
|
|
|
+ // $('#rate_set').find('td').eq(3).text(exbqhs !== 0 ? exbqhs : '');
|
|
|
+ // $('#rate_set').find('td').eq(4).text(exjzbqhs !== 0 ? exjzbqhs : '');
|
|
|
materialRate = rate;
|
|
|
+ ex_tax_tp = result.ex_tax_tp;
|
|
|
$('#rateInput').val(rate);
|
|
|
+ if (showStageExponent || exponent_nodes) {
|
|
|
+ materialExponentSpreadObj.updateMaterialData(result);
|
|
|
+ }
|
|
|
+ resetExTpTable();
|
|
|
});
|
|
|
} else {
|
|
|
$('#rateInput').val(rate);
|
|
|
}
|
|
|
}, 500);
|
|
|
});
|
|
|
- // $('#changeRate').change(function () {
|
|
|
- // const rate = parseInt($(this).val());
|
|
|
- // postData(window.location.pathname + '/save', { type:'rate', rate: rate }, function (result) {
|
|
|
- // const exbqhs = ZhCalc.round(ZhCalc.mul(ex_tp, 1+rate/100), materialDecimal.tp);
|
|
|
- // const exjzbqhs = ZhCalc.round(ZhCalc.add(ex_pre_tp_hs, exbqhs), materialDecimal.tp);
|
|
|
- // if (!materialTax) {
|
|
|
- // const bqhs = ZhCalc.round(ZhCalc.mul(m_tp, 1+rate/100), materialDecimal.tp);
|
|
|
- // const jzbqhs = ZhCalc.round(ZhCalc.add(pre_tp_hs, bqhs), materialDecimal.tp);
|
|
|
- // $('#rate_set').find('td').eq(1).text(bqhs !== 0 ? bqhs : '');
|
|
|
- // $('#rate_set').find('td').eq(2).text(jzbqhs !== 0 ? jzbqhs : '');
|
|
|
- // }
|
|
|
- // $('#rate_set').find('td').eq(3).text(exbqhs !== 0 ? exbqhs : '');
|
|
|
- // $('#rate_set').find('td').eq(4).text(exjzbqhs !== 0 ? exjzbqhs : '');
|
|
|
- // });
|
|
|
- // });
|
|
|
}
|
|
|
|
|
|
$.divResizer({
|
|
|
@@ -603,8 +1000,14 @@ $(document).ready(() => {
|
|
|
$.divResizer({
|
|
|
select: '#main-resize',
|
|
|
callback: function () {
|
|
|
+ let bcontent = $(".bcontent-wrap") ? $(".bcontent-wrap").height() : 0;
|
|
|
+ $(".sp-wrap").height(bcontent-30);
|
|
|
+ const height = $('.bcontent-wrap').height();
|
|
|
+ const cutHeight = isStageSelf ? getObjHeight($('#myTab')) : 0;
|
|
|
+ const cutHeight2 = exponent_nodes ? getObjHeight($('#myTab2')) : 0;
|
|
|
+ $('.sjs-height-material').height($('.sjs-height-1').height() - cutHeight - cutHeight2);
|
|
|
materialExponentSpread.refresh();
|
|
|
- const height = $('#material-exponent-spread').height();
|
|
|
+ // const height = $('#material-exponent-spread').height();
|
|
|
setLocalCache('material_exponent2_' + materialID, height);
|
|
|
}
|
|
|
});
|
|
|
@@ -632,6 +1035,8 @@ $(document).ready(() => {
|
|
|
materialExponentSpread.refresh();
|
|
|
});
|
|
|
// 根据浏览器记录展开收起
|
|
|
+ const cutHeight = isStageSelf ? getObjHeight($('#myTab')) : 0;
|
|
|
+ const cutHeight2 = exponent_nodes ? getObjHeight($('#myTab2')) : 0;
|
|
|
if (getLocalCache('material_exponent_' + materialID)) {
|
|
|
const tab = $('.right-nav a[content="#base-tab"]'), tabPanel = $(tab.attr('content'));
|
|
|
$('a', '.side-menu').removeClass('active');
|
|
|
@@ -643,14 +1048,22 @@ $(document).ready(() => {
|
|
|
materialExponentSpread.refresh();
|
|
|
}
|
|
|
if (getLocalCache('material_exponent2_' + materialID)) {
|
|
|
- $('#material-exponent-spread').height(getLocalCache('material_exponent2_' + materialID));
|
|
|
+ // $('#material-exponent-spread').height(getLocalCache('material_exponent2_' + materialID));
|
|
|
+ $('.bcontent-wrap').height(getLocalCache('material_exponent2_' + materialID));
|
|
|
var cHeader = getObjHeight($(".c-header"));
|
|
|
- var sjs1 = getObjHeight($('.sjs-height-1'));
|
|
|
- $(".bcontent-wrap").height($(window).height()-cHeader-sjs1-90+53);
|
|
|
+ const bcontent = $(".bcontent-wrap") ? $(".bcontent-wrap").height() : 0;
|
|
|
+ $(".sp-wrap").height(bcontent-30);
|
|
|
+ $('.sjs-height-1').height($(window).height()-cHeader-bcontent-90+53);
|
|
|
+ $('.sjs-height-material').height($('.sjs-height-1').height() - cutHeight - cutHeight2);
|
|
|
+ // var sjs1 = getObjHeight($('.sjs-height-1'));
|
|
|
+ // $(".bcontent-wrap").height($(window).height()-cHeader-sjs1-90+53);
|
|
|
+ materialExponentSpread.refresh();
|
|
|
+ } else {
|
|
|
+ $('.sjs-height-material').height($('.sjs-height-1').height() - cutHeight - cutHeight2);
|
|
|
materialExponentSpread.refresh();
|
|
|
}
|
|
|
function getObjHeight(select) {
|
|
|
- return select.length > 0 ? select.height() : 0;
|
|
|
+ return select.length > 0 ? select.outerHeight(true) : 0;
|
|
|
}
|
|
|
|
|
|
$.subMenu({
|