|
@@ -1,5 +1,5 @@
|
|
|
/**
|
|
|
- * 聊天室相关
|
|
|
+ * 工料机汇总相关
|
|
|
*
|
|
|
* @author CaiAoLin
|
|
|
* @date 2017/6/15
|
|
@@ -105,28 +105,8 @@ $(document).ready(function () {
|
|
|
rowCounter++;
|
|
|
}
|
|
|
|
|
|
-/*
|
|
|
- let socket = io('http://notify.smartcost.com.cn:3300');
|
|
|
- socket.on('connect', function () {
|
|
|
- socket.emit('join', project);
|
|
|
- console.log('连接成功');
|
|
|
- });
|
|
|
-
|
|
|
- // 接受到改变
|
|
|
- let changeInfo = [];
|
|
|
- socket.on('dataChange', function(data) {
|
|
|
- data = JSON.parse(data);
|
|
|
- if (data.newValue === undefined) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- changeInfo.push(data);
|
|
|
- $("#message").html('基价单位已被修改,<a href="javascript:void(0);" id="load-data">点击加载</a>');
|
|
|
- $("#notify").slideDown('fast');
|
|
|
- initiativeChange = false;
|
|
|
- });
|
|
|
|
|
|
// 是否主动更改数据
|
|
|
- let initiativeChange = false;
|
|
|
$("#message").on('click', '#load-data', function() {
|
|
|
$("#notify").slideUp('fast');
|
|
|
if (changeInfo.length > 0) {
|
|
@@ -138,11 +118,6 @@ $(document).ready(function () {
|
|
|
changeInfo = [];
|
|
|
});
|
|
|
|
|
|
- // 进入单元格后设置为主动设置数据
|
|
|
- sheet.bind(GC.Spread.Sheets.Events.EditEnding, function (element, info) {
|
|
|
- initiativeChange = true;
|
|
|
- });
|
|
|
- */
|
|
|
// 绑定事件
|
|
|
let isChanging = false;
|
|
|
sheet.bind(GC.Spread.Sheets.Events.ValueChanged, function (element, info) {
|
|
@@ -205,32 +180,6 @@ $(document).ready(function () {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
- /*
|
|
|
- // 如果修改了数据且为主动修改,先存库再广播给其他页面
|
|
|
- if (info.newValue !== undefined && info.oldValue !== undefined && initiativeChange) {
|
|
|
- let id = sheet.getCell(info.row, 0).value();
|
|
|
- $.ajax({
|
|
|
- url: '/save',
|
|
|
- type: 'post',
|
|
|
- data: {priceValue: info.newValue, id: id},
|
|
|
- error: function() {
|
|
|
- // @todo 替换为更好地错误提示
|
|
|
- alert('error');
|
|
|
- },
|
|
|
- beforeSend: function() {
|
|
|
-
|
|
|
- },
|
|
|
- success: function(response) {
|
|
|
- if (response.err === 0) {
|
|
|
- socket.emit('dataNotify', JSON.stringify(info));
|
|
|
- } else {
|
|
|
- // @todo 替换为更好地错误提示
|
|
|
- alert(response.msg);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- */
|
|
|
});
|
|
|
|
|
|
// 绑定双击事件
|
|
@@ -332,6 +281,8 @@ function successTrigger(field, info) {
|
|
|
// 市场单价的计算
|
|
|
marketPriceCalculate(type, info);
|
|
|
|
|
|
+ // 触发websocket通知
|
|
|
+ socket.emit('dataNotify', JSON.stringify(info));
|
|
|
break;
|
|
|
}
|
|
|
}
|