|
@@ -40,13 +40,6 @@ var projectObj = {
|
|
// for test interface. CSLAAAAA
|
|
// for test interface. CSLAAAAA
|
|
// projectObj.testDisplay('前四项累计值排除当前选中项' + projectObj.project.calcProgram.getBeforeTaxTotalFee([node]));
|
|
// projectObj.testDisplay('前四项累计值排除当前选中项' + projectObj.project.calcProgram.getBeforeTaxTotalFee([node]));
|
|
|
|
|
|
- // 公式结果
|
|
|
|
- /* let t = projectObj.project.calcProgram.compiledTemplates[node.data.programID];
|
|
|
|
- let c = t.calcItems[7];
|
|
|
|
- c.dispExpr = '[定额基价人工费] + [定额基价材料费] + F6 + [主材费]';
|
|
|
|
- let rst = analyzer.analyzeUserExpr(t, c);
|
|
|
|
- projectObj.testDisplay('结果', rst);*/
|
|
|
|
-
|
|
|
|
// 基数
|
|
// 基数
|
|
// node.data.isSubcontract = true;
|
|
// node.data.isSubcontract = true;
|
|
// node.data.gljList = project.ration_glj.getGljArrByRation(node.data.ID);
|
|
// node.data.gljList = project.ration_glj.getGljArrByRation(node.data.ID);
|
|
@@ -516,6 +509,8 @@ var projectObj = {
|
|
let startTime = +new Date();
|
|
let startTime = +new Date();
|
|
console.log("开始加载-----"+startTime);
|
|
console.log("开始加载-----"+startTime);
|
|
this.project.loadDatas(function (err) {
|
|
this.project.loadDatas(function (err) {
|
|
|
|
+ let mTime = +new Date();
|
|
|
|
+ console.log(`get data时间——${mTime - startTime}`);
|
|
if (!err) {
|
|
if (!err) {
|
|
that.project.projectGLJ.calcQuantity();//计算分部分项和技术措施项目消耗量;
|
|
that.project.projectGLJ.calcQuantity();//计算分部分项和技术措施项目消耗量;
|
|
that.project.property = projectInfoObj.projectInfo.property;
|
|
that.project.property = projectInfoObj.projectInfo.property;
|
|
@@ -527,8 +522,6 @@ var projectObj = {
|
|
that.project.projSetting.mainGridSetting = JSON.parse(str);
|
|
that.project.projSetting.mainGridSetting = JSON.parse(str);
|
|
that.project.projSetting.mainGridSetting.frozenCols = 4;
|
|
that.project.projSetting.mainGridSetting.frozenCols = 4;
|
|
TREE_SHEET_HELPER.initSetting($('#billsSpread')[0], that.project.projSetting.mainGridSetting);
|
|
TREE_SHEET_HELPER.initSetting($('#billsSpread')[0], that.project.projSetting.mainGridSetting);
|
|
- const autoHeight = that.project.property.displaySetting !== undefined ?
|
|
|
|
- that.project.property.displaySetting.autoHeight : false;
|
|
|
|
that.project.projSetting.mainGridSetting.cols.forEach(function (col) {
|
|
that.project.projSetting.mainGridSetting.cols.forEach(function (col) {
|
|
col.data.splitFields = col.data.field.split('.');
|
|
col.data.splitFields = col.data.field.split('.');
|
|
if (col.data.getText && Object.prototype.toString.apply(col.data.getText) === "[object String]") {
|
|
if (col.data.getText && Object.prototype.toString.apply(col.data.getText) === "[object String]") {
|
|
@@ -548,17 +541,12 @@ var projectObj = {
|
|
if (col.data.field === 'code') {
|
|
if (col.data.field === 'code') {
|
|
col.data.formatter = '@';
|
|
col.data.formatter = '@';
|
|
}
|
|
}
|
|
-
|
|
|
|
- // 根据配置设置自动行高
|
|
|
|
|
|
+ col.setAutoHeight = MainTreeCol.getEvent("setAutoHeight");
|
|
|
|
+ // 根据配置设置自动行高,在这里先做个标记,然后对每个单元格单独配置
|
|
if (col.data.field === 'name' || col.data.field === 'itemCharacterText' ||
|
|
if (col.data.field === 'name' || col.data.field === 'itemCharacterText' ||
|
|
col.data.field === 'jobContentText' || col.data.field === 'adjustState') {
|
|
col.data.field === 'jobContentText' || col.data.field === 'adjustState') {
|
|
- if (!autoHeight) {
|
|
|
|
- col.showHint = true;
|
|
|
|
- col.data.wordWrap = false;
|
|
|
|
- } else {
|
|
|
|
- col.showHint = false;
|
|
|
|
- col.data.wordWrap = true;
|
|
|
|
- }
|
|
|
|
|
|
+ col.data.autoHeight = true;
|
|
|
|
+ col.showHint = true;
|
|
}
|
|
}
|
|
if(col.data.field ==='quantity'){
|
|
if(col.data.field ==='quantity'){
|
|
col.showHint = true;
|
|
col.showHint = true;
|
|
@@ -573,9 +561,11 @@ var projectObj = {
|
|
// }
|
|
// }
|
|
|
|
|
|
});
|
|
});
|
|
-
|
|
|
|
|
|
+ let startShowTime = +new Date();
|
|
that.mainController = TREE_SHEET_CONTROLLER.createNew(that.project.mainTree, that.mainSpread.getActiveSheet(), that.project.projSetting.mainGridSetting);
|
|
that.mainController = TREE_SHEET_CONTROLLER.createNew(that.project.mainTree, that.mainSpread.getActiveSheet(), that.project.projSetting.mainGridSetting);
|
|
that.mainController.showTreeData();
|
|
that.mainController.showTreeData();
|
|
|
|
+ let endShowTime = +new Date();
|
|
|
|
+ console.log(`show data时间——${endShowTime - startShowTime}`);
|
|
that.mainController.bind('refreshBaseActn', that.refreshBaseActn);
|
|
that.mainController.bind('refreshBaseActn', that.refreshBaseActn);
|
|
that.mainController.bind(TREE_SHEET_CONTROLLER.eventName.beforeTreeSelectedChange, that.beforeMainTreeSelectedChange);
|
|
that.mainController.bind(TREE_SHEET_CONTROLLER.eventName.beforeTreeSelectedChange, that.beforeMainTreeSelectedChange);
|
|
that.mainController.bind(TREE_SHEET_CONTROLLER.eventName.treeSelectedChanged, that.treeSelectedChanged);
|
|
that.mainController.bind(TREE_SHEET_CONTROLLER.eventName.treeSelectedChanged, that.treeSelectedChanged);
|
|
@@ -591,9 +581,11 @@ var projectObj = {
|
|
that.mainSpread.bind(GC.Spread.Sheets.Events.ClipboardChanged, that.msClipboardChanged);
|
|
that.mainSpread.bind(GC.Spread.Sheets.Events.ClipboardChanged, that.msClipboardChanged);
|
|
that.mainSpread.bind(GC.Spread.Sheets.Events.ButtonClicked, that.onButtonClick);
|
|
that.mainSpread.bind(GC.Spread.Sheets.Events.ButtonClicked, that.onButtonClick);
|
|
that.mainSpread.bind(GC.Spread.Sheets.Events.CellDoubleClick, that.onCellDoubleClick);
|
|
that.mainSpread.bind(GC.Spread.Sheets.Events.CellDoubleClick, that.onCellDoubleClick);
|
|
|
|
+ let loadOtherStartTime = +new Date();
|
|
that.loadMainSpreadContextMenu();
|
|
that.loadMainSpreadContextMenu();
|
|
that.loadFocusLocation();
|
|
that.loadFocusLocation();
|
|
let endTime = +new Date();
|
|
let endTime = +new Date();
|
|
|
|
+ console.log(`其它时间——${endTime - loadOtherStartTime}`);
|
|
socketObject.connect();//连接socket服务器
|
|
socketObject.connect();//连接socket服务器
|
|
console.log("加载完成-----"+endTime);
|
|
console.log("加载完成-----"+endTime);
|
|
console.log(`时间——${endTime - startTime}`);
|
|
console.log(`时间——${endTime - startTime}`);
|
|
@@ -1070,10 +1062,10 @@ var projectObj = {
|
|
},
|
|
},
|
|
//大项费用则字体加粗,String 15px, Number 13px
|
|
//大项费用则字体加粗,String 15px, Number 13px
|
|
getBoldFontStyle: function (node, colSetting) {
|
|
getBoldFontStyle: function (node, colSetting) {
|
|
|
|
+ let style = new GC.Spread.Sheets.Style();
|
|
if(node.sourceType !== this.project.Bills.getSourceType() || node.data.type !== billType.DXFY){
|
|
if(node.sourceType !== this.project.Bills.getSourceType() || node.data.type !== billType.DXFY){
|
|
- return null;
|
|
|
|
|
|
+ return null
|
|
}
|
|
}
|
|
- let style = new GC.Spread.Sheets.Style();
|
|
|
|
//备注暂无字段
|
|
//备注暂无字段
|
|
let stringFields = [
|
|
let stringFields = [
|
|
'code',
|
|
'code',
|
|
@@ -1087,6 +1079,7 @@ var projectObj = {
|
|
'programID',
|
|
'programID',
|
|
'ruleText'
|
|
'ruleText'
|
|
];
|
|
];
|
|
|
|
+
|
|
if(stringFields.indexOf(colSetting.data.field) > 0){
|
|
if(stringFields.indexOf(colSetting.data.field) > 0){
|
|
style.font = 'bold 15px Arial';
|
|
style.font = 'bold 15px Arial';
|
|
}
|
|
}
|
|
@@ -1523,4 +1516,140 @@ function ifCanDelete() {
|
|
}
|
|
}
|
|
return true
|
|
return true
|
|
};
|
|
};
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//选择要导入的excel文件
|
|
|
|
+$('#customFile').change(function () {
|
|
|
|
+ let file = $(this)[0];
|
|
|
|
+ if(file.files.length > 0){
|
|
|
|
+ $('#uploadAlert').text(`${file.files[0].name} 准备导入上传`);
|
|
|
|
+ $('#uploadAlert').show();
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ $('#uploadAlert').hide();
|
|
|
|
+ }
|
|
|
|
+});
|
|
|
|
+//从excel导入清单
|
|
|
|
+$('#uploadConfirm').click(function () {
|
|
|
|
+ let me = this;
|
|
|
|
+ $(me).addClass('disabled');
|
|
|
|
+ try{
|
|
|
|
+ let formData = new FormData();
|
|
|
|
+ let file = $('#customFile')[0];
|
|
|
|
+ if(file.files.length <= 0){
|
|
|
|
+ throw '未选择文件';
|
|
|
|
+ }
|
|
|
|
+ formData.append('file', file.files[0]);
|
|
|
|
+ let projectID = scUrlUtil.GetQueryString('project');
|
|
|
|
+ if(!projectID || projectID <= 0){
|
|
|
|
+ throw '项目数据出错';
|
|
|
|
+ }
|
|
|
|
+ formData.append('projectID', projectID);
|
|
|
|
+ $.ajax({
|
|
|
|
+ url: '/bills/upload',
|
|
|
|
+ type: 'POST',
|
|
|
|
+ data: formData,
|
|
|
|
+ cache: false,
|
|
|
|
+ contentType: false,
|
|
|
|
+ processData: false,
|
|
|
|
+ beforeSend: function() {
|
|
|
|
+ $.bootstrapLoading.start();
|
|
|
|
+ },
|
|
|
|
+ success: function(response){
|
|
|
|
+ if (response.err === 0) {
|
|
|
|
+ const message = response.msg !== undefined ? response.msg : '';
|
|
|
|
+ if (message !== '') {
|
|
|
|
+ alert(message);
|
|
|
|
+ }
|
|
|
|
+ // 成功则关闭窗体
|
|
|
|
+ $('#import').modal("hide");
|
|
|
|
+ //更新前端
|
|
|
|
+ doAfterImport(response.data);
|
|
|
|
+ } else {
|
|
|
|
+ const message = response.msg !== undefined ? response.msg : '上传失败!';
|
|
|
|
+ $.bootstrapLoading.end();
|
|
|
|
+ alert(message);
|
|
|
|
+ }
|
|
|
|
+ $(me).removeClass('disabled');
|
|
|
|
+ },
|
|
|
|
+ error: function(){
|
|
|
|
+ alert("与服务器通信发生错误");
|
|
|
|
+ $.bootstrapLoading.end();
|
|
|
|
+ $(me).removeClass('disabled');
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ catch (err){
|
|
|
|
+ alert(err);
|
|
|
|
+ }
|
|
|
|
+});
|
|
|
|
+//导入后更新操作
|
|
|
|
+function doAfterImport(resData){
|
|
|
|
+ if(resData){
|
|
|
|
+ let nodes = projectObj.project.mainTree.nodes;
|
|
|
|
+ let bills_datas = projectObj.project.Bills.datas;
|
|
|
|
+ let ration_datas = projectObj.project.Ration.datas;
|
|
|
|
+ let quantity_detail_datas = projectObj.project.quantity_detail.datas;
|
|
|
|
+ let ration_glj_datas = projectObj.project.ration_glj.datas;
|
|
|
|
+ let ration_coe_datas = projectObj.project.ration_coe.datas;
|
|
|
|
+ let ration_install_datas = projectObj.project.ration_installation.datas;
|
|
|
|
+ let delNodes = [];
|
|
|
|
+ for(let billID of resData.remove.bill){
|
|
|
|
+ if(nodes['id_' + billID]){
|
|
|
|
+ delNodes.push(nodes['id_' + billID]);
|
|
|
|
+ }
|
|
|
|
+ //清除清单数据
|
|
|
|
+ _.remove(bills_datas, {ID: billID});
|
|
|
|
+ //清除清单工程量明细数据
|
|
|
|
+ _.remove(quantity_detail_datas, {billID: billID});
|
|
|
|
+ }
|
|
|
|
+ for(let rationID of resData.remove.ration){
|
|
|
|
+ //清除定额数据
|
|
|
|
+ _.remove(ration_datas, {ID: rationID});
|
|
|
|
+ //清除定额下的相关数据
|
|
|
|
+ _.remove(ration_glj_datas, {rationID: rationID});
|
|
|
|
+ _.remove(ration_coe_datas, {rationID: rationID});
|
|
|
|
+ _.remove(ration_install_datas, {rationID: rationID});
|
|
|
|
+ _.remove(quantity_detail_datas, {rationID: rationID});
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ //删除节点
|
|
|
|
+ if(delNodes.length > 0){
|
|
|
|
+ //通过固定清单获得删除节点的起始行索引
|
|
|
|
+ let beginRow = null;
|
|
|
|
+ if(resData.fixedBill){
|
|
|
|
+ let fixedNode = nodes['id_' + resData.fixedBill.ID];
|
|
|
|
+ if(fixedNode){
|
|
|
|
+ beginRow = projectObj.project.mainTree.items.indexOf(fixedNode) + 1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //删除主树节点
|
|
|
|
+ projectObj.mainController.m_delete(delNodes, beginRow);
|
|
|
|
+ //删除清单树节点
|
|
|
|
+ let delIdNodes = [];
|
|
|
|
+ for(let delNode of delNodes){
|
|
|
|
+ delIdNodes.push(delNode.source);
|
|
|
|
+ }
|
|
|
|
+ projectObj.project.Bills.tree.m_delete(delIdNodes);
|
|
|
|
+ }
|
|
|
|
+ if(resData.insert.bill.length > 0){
|
|
|
|
+ //插入清单节点
|
|
|
|
+ projectObj.project.Bills.tree.insertByDatas(resData.insert.bill);
|
|
|
|
+ //插入主树节点
|
|
|
|
+ let newNodes = projectObj.project.mainTree.insertByDatas(resData.insert.bill);
|
|
|
|
+ for(let node of newNodes){
|
|
|
|
+ node.source = projectObj.project.Bills.tree.nodes['id_' + node.getID()];
|
|
|
|
+ node.data = node.source.data;
|
|
|
|
+ node.sourceType = projectObj.project.Bills.getSourceType();
|
|
|
|
+ }
|
|
|
|
+ ProjectController.syncDisplayNewNodes(projectObj.mainController, newNodes);
|
|
|
|
+ }
|
|
|
|
+ $.bootstrapLoading.end();
|
|
|
|
+ //重算
|
|
|
|
+ projectObj.project.calcProgram.calcAllNodesAndSave(calcAllType.catAll, function () {
|
|
|
|
+ projectObj.project.projectGLJ.loadData(function () {
|
|
|
|
+ $.bootstrapLoading.end();
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|