12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- /**
- * 工料机汇总相关
- *
- * @author CaiAoLin
- * @date 2017/6/15
- * @version
- */
- let projectGLJSpread = null;
- let projectGLJSheet = null;
- let currentTag = '';
- let isChanging = false;
- $(document).ready(function () {
- projectInfoObj.showProjectInfo();
- projectGLJSpread = new ProjectGLJSpread();
- projectGLJSpread.successCallback = successTrigger;
- projectGLJSheet = projectGLJSpread.init();
- // 绑定单击事件
- let lastRow = 0;
- projectGLJSheet.bind(GC.Spread.Sheets.Events.CellClick, function (element, info) {
- let currentRow = info.row;
- if (currentRow === undefined || currentRow === lastRow) {
- return;
- }
- if (currentTag !== 'mix-ratio' && currentTag !== 'machine') {
- return;
- }
- let spread = currentTag === 'mix-ratio' ? mixRatioSpread : machineSpread;
- if (spread === null) {
- return;
- }
- let projectGLJId = projectGLJSheet.getActiveDataByField('id');
- spread.getRatioData(projectGLJId);
- lastRow = currentRow;
- });
- // 切换tab触发refresh
- $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
- currentTag = $(e.target).data('name');
- if (currentTag === 'ration') {
- projectGLJSheet.filterData('unit_price.type', []);
- }
- });
- // 是否主动更改数据
- // $("#message").on('click', '#load-data', function() {
- // $("#notify").slideUp('fast');
- // if (changeInfo.length > 0) {
- // for (let index in changeInfo) {
- // let cell = gljSheet.getCell(changeInfo[index].row, changeInfo[index].col, GC.Spread.Sheets.SheetArea.viewport);
- // cell.value(changeInfo[index].newValue);
- // }
- // }
- // changeInfo = [];
- // });
- });
- /**
- * 成功事件
- *
- * @param {string} field
- * @param {object} info
- * @return {void}
- */
- function successTrigger(field, info) {
- switch (field) {
- case 'unit_price.market_price':
- // 计算价格
- projectGLJSpread.priceCalculate(info);
- // 触发websocket通知
- socket.emit('dataNotify', JSON.stringify(info));
- break;
- }
- }
|