|
@@ -19,7 +19,7 @@ let GLJTypeConst = [];
|
|
// spreadjs载入数据所需
|
|
// spreadjs载入数据所需
|
|
let jsonData = [];
|
|
let jsonData = [];
|
|
let mixRatioConnectData = [];
|
|
let mixRatioConnectData = [];
|
|
-let mixRatioMap={};
|
|
|
|
|
|
+let mixRatioMap = {};
|
|
// 单价文件相关
|
|
// 单价文件相关
|
|
let usedUnitPriceInfo = {};
|
|
let usedUnitPriceInfo = {};
|
|
let usedTenderList = [];
|
|
let usedTenderList = [];
|
|
@@ -32,7 +32,7 @@ $(document).ready(function () {
|
|
init();
|
|
init();
|
|
});
|
|
});
|
|
|
|
|
|
- slideResize($("#glj-main"), function() {
|
|
|
|
|
|
+ slideResize($("#glj-main"), function () {
|
|
projectGLJSpread.sheetObj.spread.refresh();
|
|
projectGLJSpread.sheetObj.spread.refresh();
|
|
});
|
|
});
|
|
|
|
|
|
@@ -40,7 +40,7 @@ $(document).ready(function () {
|
|
$('#change-dj').on('shown.bs.modal', function () {
|
|
$('#change-dj').on('shown.bs.modal', function () {
|
|
// 获取当前建设项数据
|
|
// 获取当前建设项数据
|
|
let projectName = projectInfoObj.projectInfo.fullFolder !== undefined &&
|
|
let projectName = projectInfoObj.projectInfo.fullFolder !== undefined &&
|
|
- projectInfoObj.projectInfo.fullFolder.length > 0 ? projectInfoObj.projectInfo.fullFolder[0] : '';
|
|
|
|
|
|
+ projectInfoObj.projectInfo.fullFolder.length > 0 ? projectInfoObj.projectInfo.fullFolder[0] : '';
|
|
$("#current-project-name").text(projectName);
|
|
$("#current-project-name").text(projectName);
|
|
|
|
|
|
// 获取切换单价文件相关数据
|
|
// 获取切换单价文件相关数据
|
|
@@ -49,7 +49,7 @@ $(document).ready(function () {
|
|
type: 'post',
|
|
type: 'post',
|
|
data: {project_id: scUrlUtil.GetQueryString('project')},
|
|
data: {project_id: scUrlUtil.GetQueryString('project')},
|
|
dataType: 'json',
|
|
dataType: 'json',
|
|
- success: function(response) {
|
|
|
|
|
|
+ success: function (response) {
|
|
if (response.err === 1) {
|
|
if (response.err === 1) {
|
|
alert('数据传输错误!');
|
|
alert('数据传输错误!');
|
|
return false;
|
|
return false;
|
|
@@ -58,9 +58,9 @@ $(document).ready(function () {
|
|
// 本项目中的单价文件
|
|
// 本项目中的单价文件
|
|
if (data.self.length > 0) {
|
|
if (data.self.length > 0) {
|
|
let selfFileHtml = '';
|
|
let selfFileHtml = '';
|
|
- for(let tmp of data.self) {
|
|
|
|
|
|
+ for (let tmp of data.self) {
|
|
let select = usedUnitPriceInfo === tmp.id ? ' selected="selected"' : '';
|
|
let select = usedUnitPriceInfo === tmp.id ? ' selected="selected"' : '';
|
|
- selfFileHtml += '<option'+ select +' value="'+ tmp.id +'">'+ tmp.name +'</option>';
|
|
|
|
|
|
+ selfFileHtml += '<option' + select + ' value="' + tmp.id + '">' + tmp.name + '</option>';
|
|
}
|
|
}
|
|
$("#self-file").html(selfFileHtml);
|
|
$("#self-file").html(selfFileHtml);
|
|
}
|
|
}
|
|
@@ -69,14 +69,14 @@ $(document).ready(function () {
|
|
if (data.other.length > 0) {
|
|
if (data.other.length > 0) {
|
|
let otherProjectHtml = '';
|
|
let otherProjectHtml = '';
|
|
let otherFileHtml = '';
|
|
let otherFileHtml = '';
|
|
- for(let tmp of data.other) {
|
|
|
|
- otherProjectHtml += '<option value="'+ tmp.ID +'">'+ tmp.name +'</option>';
|
|
|
|
|
|
+ for (let tmp of data.other) {
|
|
|
|
+ otherProjectHtml += '<option value="' + tmp.ID + '">' + tmp.name + '</option>';
|
|
otherFileData[tmp.ID] = tmp.unitPriceList;
|
|
otherFileData[tmp.ID] = tmp.unitPriceList;
|
|
if (otherFileHtml !== '') {
|
|
if (otherFileHtml !== '') {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- for(let unitPrice of tmp.unitPriceList) {
|
|
|
|
- otherFileHtml += '<option value="'+ unitPrice.id +'">'+ unitPrice.name +'</option>';
|
|
|
|
|
|
+ for (let unitPrice of tmp.unitPriceList) {
|
|
|
|
+ otherFileHtml += '<option value="' + unitPrice.id + '">' + unitPrice.name + '</option>';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$("#other-project").html(otherProjectHtml);
|
|
$("#other-project").html(otherProjectHtml);
|
|
@@ -87,13 +87,13 @@ $(document).ready(function () {
|
|
});
|
|
});
|
|
|
|
|
|
// 单价文件另存为弹框
|
|
// 单价文件另存为弹框
|
|
- $("#file-save-as-dialog").on('shown.bs.modal', function() {
|
|
|
|
|
|
+ $("#file-save-as-dialog").on('shown.bs.modal', function () {
|
|
// 获取当前建设项数据
|
|
// 获取当前建设项数据
|
|
$("#save-as-name").val(usedUnitPriceInfo.name + '(复件)');
|
|
$("#save-as-name").val(usedUnitPriceInfo.name + '(复件)');
|
|
});
|
|
});
|
|
|
|
|
|
// 单价文件另存为操作
|
|
// 单价文件另存为操作
|
|
- $("#save-as-confirm").click(function() {
|
|
|
|
|
|
+ $("#save-as-confirm").click(function () {
|
|
let name = $("#save-as-name").val();
|
|
let name = $("#save-as-name").val();
|
|
if (name === '') {
|
|
if (name === '') {
|
|
$("#save-as-tips").text('请填写单价文件名称').show();
|
|
$("#save-as-tips").text('请填写单价文件名称').show();
|
|
@@ -108,13 +108,13 @@ $(document).ready(function () {
|
|
type: 'post',
|
|
type: 'post',
|
|
data: {name: name, project_id: scUrlUtil.GetQueryString('project')},
|
|
data: {name: name, project_id: scUrlUtil.GetQueryString('project')},
|
|
dataType: 'json',
|
|
dataType: 'json',
|
|
- error: function() {
|
|
|
|
|
|
+ error: function () {
|
|
isChanging = false;
|
|
isChanging = false;
|
|
},
|
|
},
|
|
- beforeSend: function() {
|
|
|
|
|
|
+ beforeSend: function () {
|
|
isChanging = true;
|
|
isChanging = true;
|
|
},
|
|
},
|
|
- success: function(response) {
|
|
|
|
|
|
+ success: function (response) {
|
|
isChanging = false;
|
|
isChanging = false;
|
|
if (response.err === 1) {
|
|
if (response.err === 1) {
|
|
let msg = response.msg !== undefined && response.msg !== '' ? response.msg : '另存为失败!';
|
|
let msg = response.msg !== undefined && response.msg !== '' ? response.msg : '另存为失败!';
|
|
@@ -128,20 +128,20 @@ $(document).ready(function () {
|
|
});
|
|
});
|
|
|
|
|
|
// 从其他建设项目中复制 选择建设项目
|
|
// 从其他建设项目中复制 选择建设项目
|
|
- $("#other-project").change(function() {
|
|
|
|
|
|
+ $("#other-project").change(function () {
|
|
let projectId = $(this).val();
|
|
let projectId = $(this).val();
|
|
if (otherFileData[projectId] === undefined) {
|
|
if (otherFileData[projectId] === undefined) {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
let otherFileHtml = '';
|
|
let otherFileHtml = '';
|
|
- for(let unitPrice of otherFileData[projectId]) {
|
|
|
|
- otherFileHtml += '<option value="'+ unitPrice.id +'">'+ unitPrice.name +'</option>';
|
|
|
|
|
|
+ for (let unitPrice of otherFileData[projectId]) {
|
|
|
|
+ otherFileHtml += '<option value="' + unitPrice.id + '">' + unitPrice.name + '</option>';
|
|
}
|
|
}
|
|
$("#other-file").html(otherFileHtml);
|
|
$("#other-file").html(otherFileHtml);
|
|
});
|
|
});
|
|
|
|
|
|
// 单价文件选项切换
|
|
// 单价文件选项切换
|
|
- $("input[name='change-type']").change(function() {
|
|
|
|
|
|
+ $("input[name='change-type']").change(function () {
|
|
let type = $(this).val();
|
|
let type = $(this).val();
|
|
type = parseInt(type);
|
|
type = parseInt(type);
|
|
$("#change-dj .option").hide();
|
|
$("#change-dj .option").hide();
|
|
@@ -153,7 +153,7 @@ $(document).ready(function () {
|
|
});
|
|
});
|
|
|
|
|
|
// 单价文件切换确认
|
|
// 单价文件切换确认
|
|
- $("#change-file-confirm").click(function() {
|
|
|
|
|
|
+ $("#change-file-confirm").click(function () {
|
|
if (isChanging) {
|
|
if (isChanging) {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
@@ -173,14 +173,14 @@ $(document).ready(function () {
|
|
url: '/glj/change-file',
|
|
url: '/glj/change-file',
|
|
type: 'post',
|
|
type: 'post',
|
|
data: {project_id: scUrlUtil.GetQueryString('project'), change_id: changeUnitPriceId, type: type},
|
|
data: {project_id: scUrlUtil.GetQueryString('project'), change_id: changeUnitPriceId, type: type},
|
|
- error: function() {
|
|
|
|
|
|
+ error: function () {
|
|
isChanging = false;
|
|
isChanging = false;
|
|
$.bootstrapLoading.end();
|
|
$.bootstrapLoading.end();
|
|
},
|
|
},
|
|
- beforeSend: function() {
|
|
|
|
|
|
+ beforeSend: function () {
|
|
isChanging = true;
|
|
isChanging = true;
|
|
},
|
|
},
|
|
- success: function(response) {
|
|
|
|
|
|
+ success: function (response) {
|
|
isChanging = false;
|
|
isChanging = false;
|
|
if (response.err === 1) {
|
|
if (response.err === 1) {
|
|
let msg = response.msg !== undefined ? response.msg : '未知错误';
|
|
let msg = response.msg !== undefined ? response.msg : '未知错误';
|
|
@@ -200,19 +200,19 @@ $(document).ready(function () {
|
|
});
|
|
});
|
|
|
|
|
|
// 是否主动更改数据
|
|
// 是否主动更改数据
|
|
- $("#message").on('click', '#load-data', function() {
|
|
|
|
|
|
+ $("#message").on('click', '#load-data', function () {
|
|
$("#message").html('正在加载...');
|
|
$("#message").html('正在加载...');
|
|
// 重新加载数据到缓存
|
|
// 重新加载数据到缓存
|
|
- projectObj.project.projectGLJ.loadData(function() {
|
|
|
|
|
|
+ projectObj.project.projectGLJ.loadData(function () {
|
|
projectObj.project.projectGLJ.loadCacheData();
|
|
projectObj.project.projectGLJ.loadCacheData();
|
|
$("#notify").slideUp('fast');
|
|
$("#notify").slideUp('fast');
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
|
|
$('#pop-dj').popover({
|
|
$('#pop-dj').popover({
|
|
- placement:"bottom",
|
|
|
|
- html:true,
|
|
|
|
- trigger:"hover | focus",
|
|
|
|
|
|
+ placement: "bottom",
|
|
|
|
+ html: true,
|
|
|
|
+ trigger: "hover | focus",
|
|
content: getUsedTenderInfo
|
|
content: getUsedTenderInfo
|
|
}
|
|
}
|
|
);
|
|
);
|
|
@@ -224,11 +224,11 @@ $(document).ready(function () {
|
|
* @return {void|boolean}
|
|
* @return {void|boolean}
|
|
*/
|
|
*/
|
|
function init() {
|
|
function init() {
|
|
- projectObj.project.projectGLJ.loadData(function(data) {
|
|
|
|
|
|
+ projectObj.project.projectGLJ.loadData(function (data) {
|
|
if (jsonData.length <= 0) {
|
|
if (jsonData.length <= 0) {
|
|
// 赋值
|
|
// 赋值
|
|
jsonData = data.gljList !== undefined && data.gljList.length > 0 ? data.gljList : [];
|
|
jsonData = data.gljList !== undefined && data.gljList.length > 0 ? data.gljList : [];
|
|
- jsonData= filterProjectGLJ(jsonData);
|
|
|
|
|
|
+ jsonData = filterProjectGLJ(jsonData);
|
|
jsonData = sortProjectGLJ(jsonData);
|
|
jsonData = sortProjectGLJ(jsonData);
|
|
mixRatioConnectData = data.mixRatioConnectData !== undefined ? data.mixRatioConnectData : mixRatioConnectData;
|
|
mixRatioConnectData = data.mixRatioConnectData !== undefined ? data.mixRatioConnectData : mixRatioConnectData;
|
|
mixRatioMap = data.mixRatioMap !== undefined ? data.mixRatioMap : mixRatioMap;
|
|
mixRatioMap = data.mixRatioMap !== undefined ? data.mixRatioMap : mixRatioMap;
|
|
@@ -291,7 +291,7 @@ function spreadInit() {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
- loadSize("glj-main", function() {
|
|
|
|
|
|
+ loadSize("glj-main", function () {
|
|
projectGLJSpread.sheetObj.spread.refresh();
|
|
projectGLJSpread.sheetObj.spread.refresh();
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -306,7 +306,7 @@ function spreadInit() {
|
|
function unitPriceFileInit() {
|
|
function unitPriceFileInit() {
|
|
let projectGLJ = projectObj.project.projectGLJ;
|
|
let projectGLJ = projectObj.project.projectGLJ;
|
|
let data = projectGLJ.datas;
|
|
let data = projectGLJ.datas;
|
|
- usedTenderList = data.usedTenderList !== undefined ? data.usedTenderList : [];
|
|
|
|
|
|
+ usedTenderList = data.usedTenderList !== undefined ? data.usedTenderList : [];
|
|
usedUnitPriceInfo = data.constData.usedUnitPriceInfo !== undefined ?
|
|
usedUnitPriceInfo = data.constData.usedUnitPriceInfo !== undefined ?
|
|
data.constData.usedUnitPriceInfo : {};
|
|
data.constData.usedUnitPriceInfo : {};
|
|
$("#used-name").text(usedUnitPriceInfo.name);
|
|
$("#used-name").text(usedUnitPriceInfo.name);
|
|
@@ -315,7 +315,7 @@ function unitPriceFileInit() {
|
|
}
|
|
}
|
|
|
|
|
|
function getUsedTenderInfo() {
|
|
function getUsedTenderInfo() {
|
|
- return usedTenderList.join("<br>");
|
|
|
|
|
|
+ return usedTenderList.join("<br>");
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -357,7 +357,7 @@ function successTrigger(field, info) {
|
|
*/
|
|
*/
|
|
function socketInit() {
|
|
function socketInit() {
|
|
if (socket === null) {
|
|
if (socket === null) {
|
|
- socket = io('http://'+ host +':3300');
|
|
|
|
|
|
+ socket = io('http://' + host + ':3300');
|
|
socket.on('connect', function () {
|
|
socket.on('connect', function () {
|
|
socket.emit('join', roomId);
|
|
socket.emit('join', roomId);
|
|
console.log('单价文件同步连接成功');
|
|
console.log('单价文件同步连接成功');
|
|
@@ -365,7 +365,7 @@ function socketInit() {
|
|
}
|
|
}
|
|
|
|
|
|
// 接收到改变
|
|
// 接收到改变
|
|
- socket.on('dataChange', function(data) {
|
|
|
|
|
|
+ socket.on('dataChange', function (data) {
|
|
data = JSON.parse(data);
|
|
data = JSON.parse(data);
|
|
if (data.newValue === undefined) {
|
|
if (data.newValue === undefined) {
|
|
return false;
|
|
return false;
|
|
@@ -380,8 +380,8 @@ function filterProjectGLJ(jsonData) {
|
|
if (jsonData.length > 0) {
|
|
if (jsonData.length > 0) {
|
|
// 不显示消耗量为0的数据
|
|
// 不显示消耗量为0的数据
|
|
let tmpData = [];
|
|
let tmpData = [];
|
|
- for(let data of jsonData) {
|
|
|
|
- if (data.quantity !== 0&&data.quantity !=='0') {
|
|
|
|
|
|
+ for (let data of jsonData) {
|
|
|
|
+ if (data.quantity !== 0 && data.quantity !== '0') {
|
|
tmpData.push(data);
|
|
tmpData.push(data);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -391,10 +391,10 @@ function filterProjectGLJ(jsonData) {
|
|
}
|
|
}
|
|
|
|
|
|
function sortProjectGLJ(jsonData) {
|
|
function sortProjectGLJ(jsonData) {
|
|
- if (jsonData.length > 0){
|
|
|
|
- jsonData = _.sortByAll(jsonData,[function (item) {
|
|
|
|
- return item.unit_price.type+"";
|
|
|
|
- },'code']);
|
|
|
|
|
|
+ if (jsonData.length > 0) {
|
|
|
|
+ jsonData = _.sortByAll(jsonData, [function (item) {
|
|
|
|
+ return item.unit_price.type + "";
|
|
|
|
+ }, 'code']);
|
|
}
|
|
}
|
|
return jsonData
|
|
return jsonData
|
|
}
|
|
}
|