|
|
@@ -142,16 +142,14 @@ $(document).ready(function () {
|
|
|
});
|
|
|
|
|
|
// 是否主动更改数据
|
|
|
- // $("#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 = [];
|
|
|
- // });
|
|
|
+ $("#message").on('click', '#load-data', function() {
|
|
|
+ $("#message").html('正在加载...');
|
|
|
+ // 重新加载数据到缓存
|
|
|
+ projectObj.project.projectGLJ.loadData(function() {
|
|
|
+ projectObj.project.projectGLJ.loadCacheData();
|
|
|
+ $("#notify").slideUp('fast');
|
|
|
+ });
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
/**
|
|
|
@@ -180,6 +178,9 @@ function init() {
|
|
|
usedUnitPriceInfo = data.constData.usedUnitPriceInfo !== undefined ?
|
|
|
data.constData.usedUnitPriceInfo : {};
|
|
|
|
|
|
+ // 连接socket服务器
|
|
|
+ socketInit();
|
|
|
+
|
|
|
unitPriceFileInit(usedUnitPriceInfo.name, usedTenderList);
|
|
|
|
|
|
setTimeout(spreadInit, 1);
|
|
|
@@ -261,6 +262,7 @@ function successTrigger(field, info) {
|
|
|
|
|
|
// 触发websocket通知
|
|
|
socket.emit('dataNotify', JSON.stringify(info));
|
|
|
+ console.log(info);
|
|
|
break;
|
|
|
}
|
|
|
// 重新加载数据到缓存
|
|
|
@@ -268,4 +270,29 @@ function successTrigger(field, info) {
|
|
|
|
|
|
// 更新定额工料机
|
|
|
gljOprObj.refreshView();
|
|
|
-}
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * socket.io相关初始化
|
|
|
+ *
|
|
|
+ * @return {void}
|
|
|
+ */
|
|
|
+function socketInit() {
|
|
|
+ if (socket === null) {
|
|
|
+ socket = io('http://'+ host +':3300');
|
|
|
+ socket.on('connect', function () {
|
|
|
+ socket.emit('join', roomId);
|
|
|
+ console.log('单价文件同步连接成功');
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 接收到改变
|
|
|
+ socket.on('dataChange', function(data) {
|
|
|
+ data = JSON.parse(data);
|
|
|
+ if (data.newValue === undefined) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ $("#message").html('市场单位已被修改,<a href="javascript:void(0);" id="load-data">点击加载</a>');
|
|
|
+ $("#notify").slideDown('fast');
|
|
|
+ });
|
|
|
+}
|