|
@@ -40,6 +40,7 @@ projectGljObject={
|
|
|
header:[
|
|
|
{headerName: "编码", headerWidth: 120, dataCode: "code", dataType: "String"},
|
|
|
{headerName: "名称", headerWidth: 120, dataCode: "name", dataType: "String"},
|
|
|
+ {headerName: "规格型号", headerWidth: 120, dataCode: "specs", dataType: "String"},
|
|
|
{headerName: "单位", headerWidth: 120, dataCode: "unit", hAlign: "center", dataType: "String"},
|
|
|
{headerName: "类型", headerWidth: 120, dataCode: "short_name", hAlign: "center", dataType: "String"},
|
|
|
{headerName: "定额价", headerWidth: 120, dataCode: "basePrice", hAlign: "right", dataType: "Number",decimalField:'glj.unitPrice',validator:"number"},
|
|
@@ -48,7 +49,7 @@ projectGljObject={
|
|
|
{headerName: "消耗量", headerWidth: 120, dataCode: "consumption", hAlign: "right", dataType: "Number",decimalField:"glj.quantity",validator:"number"}
|
|
|
],
|
|
|
view: {
|
|
|
- lockColumns: [0,1,2,3,4,5,6]
|
|
|
+ lockColumns: [0,1,2,3,4,5,6,7]
|
|
|
}
|
|
|
},
|
|
|
materialTreeSetting:{
|
|
@@ -293,6 +294,7 @@ projectGljObject={
|
|
|
showProjectGljData:function () {
|
|
|
this.projectGljSpread.setActiveSheetIndex(0);
|
|
|
let sel = this.projectGljSheet.getSelections()[0];
|
|
|
+ let oldData = sel.row<this.projectGljSheetData.length?this.projectGljSheetData[sel.row]:'';
|
|
|
let projectGljSheetData = [];
|
|
|
let gljList = projectObj.project.projectGLJ.datas.gljList;
|
|
|
gljList = this.filterProjectGLJ(gljList);
|
|
@@ -304,15 +306,19 @@ projectGljObject={
|
|
|
this.projectGljSheet.setRowCount(0);
|
|
|
sheetCommonObj.showData(this.projectGljSheet, this.projectGljSetting,this.projectGljSheetData);
|
|
|
this.projectGljSheet.setRowCount(this.projectGljSheetData.length);
|
|
|
+ sel.row = _.findIndex(this.projectGljSheetData,{'id':oldData.id});
|
|
|
this.projectGljSheet.setSelection(sel.row==-1?0:sel.row,sel.col,sel.rowCount,sel.colCount);
|
|
|
},
|
|
|
showMaterialTreeData:function () {
|
|
|
this.projectGljSpread.setActiveSheetIndex(1);
|
|
|
let sel = this.materialTreeSheet.getSelections()[0];
|
|
|
+ let oldNodeID = this.materialTree.selected.data.id;
|
|
|
let gljList = projectObj.project.projectGLJ.datas.gljList;
|
|
|
gljList = _.sortByAll(gljList, [ 'code']);
|
|
|
this.createMaterialTree(gljList);
|
|
|
this.materialTreeController.showTreeData();
|
|
|
+ let newNode = this.materialTree.getNodeByID(oldNodeID);
|
|
|
+ sel.row = newNode.serialNo();
|
|
|
this.materialTreeSheet.setSelection(sel.row==-1?0:sel.row,sel.col,sel.rowCount,sel.colCount);
|
|
|
this.materialTreeController.setTreeSelected(this.materialTree.items[sel.row==-1?0:sel.row]);
|
|
|
},
|
|
@@ -571,11 +577,14 @@ projectGljObject={
|
|
|
let parantData = null;
|
|
|
if(sheet.name() == 'projectGljSheet'){
|
|
|
me.showProjectGljData();// me.refreshProjectGljRow(row) 这里原来是分开刷新的,现在整个统一刷新,先留着
|
|
|
- parantData = me.projectGljSheetData[row];
|
|
|
+ //parantData = _.find(); //me.projectGljSheetData[row];
|
|
|
}else {
|
|
|
me.showMaterialTreeData();
|
|
|
- parantData = me.materialTree.items[row].data;
|
|
|
+ //parantData = me.materialTree.items[row].data;
|
|
|
}
|
|
|
+ let pglj = _.find(projectObj.project.projectGLJ.datas.gljList,{'id':pid});
|
|
|
+ parantData = pglj?me.getSheetDataByGLJ(pglj):null;
|
|
|
+ //projectObj.project.projectGLJ.datas.gljList
|
|
|
|
|
|
// 更新组成物缓存
|
|
|
projectObj.project.composition.loadData();
|
|
@@ -593,7 +602,7 @@ projectGljObject={
|
|
|
for(let r of rations){
|
|
|
let r_node = projectObj.project.mainTree.getNodeByID(r.ID);
|
|
|
if(r_node){
|
|
|
- r_node.data.marketUnitFee = parantData.marketPrice;//parentMarketPrice;//这里用显示的价格
|
|
|
+ r_node.data.marketUnitFee = parantData?parantData.marketPrice:'';//parentMarketPrice;//这里用显示的价格
|
|
|
updateNodes.push(r_node);
|
|
|
}
|
|
|
}
|
|
@@ -767,6 +776,17 @@ projectGljObject={
|
|
|
me.deleteMixRatio(row);
|
|
|
}
|
|
|
},
|
|
|
+ "addMixRatio":{
|
|
|
+ name: '添加',
|
|
|
+ icon: 'fa-sign-in',
|
|
|
+ disabled: function () {
|
|
|
+ return me.rightClickTarget.row === undefined;
|
|
|
+ },
|
|
|
+ callback: function (key, opt) {
|
|
|
+ let row = me.rightClickTarget.row;
|
|
|
+ console.log(row);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -795,6 +815,21 @@ projectGljObject={
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
+ },
|
|
|
+ checkUnitFileName:function (name,callback) {
|
|
|
+ let projectGLJ = projectObj.project.projectGLJ;
|
|
|
+ projectGLJ.checkUnitFileName(name,function (data) {
|
|
|
+ if(data){
|
|
|
+ $("#save-as-tips").text('已存在同名单价文件').show();
|
|
|
+ $('#save-as-confirm').attr("disabled","disabled");
|
|
|
+ }else {
|
|
|
+ $("#save-as-tips").hide();
|
|
|
+ $('#save-as-confirm').removeAttr("disabled");
|
|
|
+ if(callback){
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -879,6 +914,7 @@ $(function () {
|
|
|
return false;
|
|
|
}
|
|
|
let data = response.data;
|
|
|
+ projectGljObject.changeInfo = data;
|
|
|
$("#current-project-name").text(data.currentProjectName);
|
|
|
// 本项目中的单价文件
|
|
|
if (data.self.length > 0) {
|
|
@@ -915,14 +951,24 @@ $(function () {
|
|
|
let type = $("input[name='change-type']:checked").val();
|
|
|
type = parseInt(type);
|
|
|
let changeUnitPriceId = 0;
|
|
|
+ $('#change-unitFile').modal("hide");
|
|
|
if (type === 0) {
|
|
|
// 从本项目中选择
|
|
|
changeUnitPriceId = $("#self-file").val();
|
|
|
} else {
|
|
|
// 从其他项目中复制
|
|
|
changeUnitPriceId = $("#other-file").val();
|
|
|
+ let newName = $("#other-file").children("option:selected").text();
|
|
|
+ let currentOption = _.find(projectGljObject.changeInfo.self,{name:newName});
|
|
|
+ if(currentOption){ //存在则说明有重名的文件
|
|
|
+ //rename-unitFile
|
|
|
+ $("#rename-unitFile").modal({show:true});
|
|
|
+ $("#newUnitFileID").val(changeUnitPriceId);
|
|
|
+ $("#newUnitFileName").val(newName);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
- $('#change-unitFile').modal("hide");
|
|
|
let data = {project_id: scUrlUtil.GetQueryString('project'), change_id: changeUnitPriceId, type: type};
|
|
|
projectObj.project.projectGLJ.changeFile(data,function () {
|
|
|
projectGljObject.changeFileCallback();
|
|
@@ -942,6 +988,7 @@ $(function () {
|
|
|
$("#unitFile-save-as").on('shown.bs.modal', function () {
|
|
|
// 获取当前建设项数据
|
|
|
$("#save-as-name").val(projectGljObject.usedUnitPriceInfo.name + '副本');
|
|
|
+ projectGljObject.checkUnitFileName(projectGljObject.usedUnitPriceInfo.name + '副本');
|
|
|
});
|
|
|
|
|
|
// 从其他建设项目中复制 选择建设项目
|
|
@@ -957,17 +1004,56 @@ $(function () {
|
|
|
$("#other-file").html(otherFileHtml);
|
|
|
});
|
|
|
|
|
|
+ $('#save-as-name').change(function () {
|
|
|
+ projectGljObject.checkUnitFileName(this.value);
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#newUnitFileName').change(function () {
|
|
|
+ let projectGLJ = projectObj.project.projectGLJ;
|
|
|
+ projectGLJ.checkUnitFileName(this.value,function (data) {
|
|
|
+ if(data){
|
|
|
+ $("#renameError_unitFile").text('已存在同名单价文件').show();
|
|
|
+ $('#renameUnitFileConfirm').attr("disabled","disabled");
|
|
|
+ }else {
|
|
|
+ $("#renameError_unitFile").hide();
|
|
|
+ $('#renameUnitFileConfirm').removeAttr("disabled");
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ });
|
|
|
+ $("#renameUnitFileConfirm").click(function () {
|
|
|
+ let projectGLJ = projectObj.project.projectGLJ;
|
|
|
+ let newName = $('#newUnitFileName').val();
|
|
|
+ let changeUnitPriceId = $('#newUnitFileID').val();
|
|
|
+ projectGLJ.checkUnitFileName(newName,function (data) {
|
|
|
+ if(data){
|
|
|
+ $("#renameError_unitFile").text('已存在同名单价文件').show();
|
|
|
+ $('#renameUnitFileConfirm').attr("disabled","disabled");
|
|
|
+ }else {
|
|
|
+ $("#renameError_unitFile").hide();
|
|
|
+ $('#renameUnitFileConfirm').removeAttr("disabled");
|
|
|
+ let data = {project_id: scUrlUtil.GetQueryString('project'), change_id: changeUnitPriceId, type: 1,newName:newName};
|
|
|
+ projectObj.project.projectGLJ.changeFile(data,function () {
|
|
|
+ projectGljObject.changeFileCallback();
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
// 单价文件另存为操作
|
|
|
$("#save-as-confirm").click(function () {
|
|
|
+ let projectGLJ = projectObj.project.projectGLJ;
|
|
|
let name = $("#save-as-name").val();
|
|
|
if (name === '') {
|
|
|
$("#save-as-tips").text('请填写单价文件名称').show();
|
|
|
return false;
|
|
|
}
|
|
|
let saveData = {name: name, project_id: scUrlUtil.GetQueryString('project')};
|
|
|
- projectObj.project.projectGLJ.saveAs(saveData,function () {
|
|
|
- projectGljObject.changeFileCallback();
|
|
|
- $("#unitFile-save-as").modal("hide");
|
|
|
+ projectGljObject.checkUnitFileName(name,function () {
|
|
|
+ projectGLJ.saveAs(saveData,function () {
|
|
|
+ projectGljObject.changeFileCallback();
|
|
|
+ $("#unitFile-save-as").modal("hide");
|
|
|
+ });
|
|
|
});
|
|
|
});
|
|
|
|