|
@@ -2,6 +2,9 @@
|
|
|
* Created by zhang on 2018/3/13.
|
|
|
*/
|
|
|
projectGljObject={
|
|
|
+ showTag:'ration',//mixRatio/machine
|
|
|
+ mixRatioType: [gljType.CONCRETE, gljType.MORTAR, gljType.MIX_RATIO,gljType.MAIN_MATERIAL],
|
|
|
+ machineType: [gljType.GENERAL_MACHINE],
|
|
|
projectGljSetting:{
|
|
|
header: [
|
|
|
{headerName: "编码", headerWidth: 80, dataCode: "code", dataType: "String"},
|
|
@@ -10,7 +13,7 @@ projectGljObject={
|
|
|
{headerName: "单位", headerWidth: 45, dataCode: "unit", hAlign: "center", dataType: "String"},
|
|
|
{headerName: "类型", headerWidth: 45, dataCode: "short_name", hAlign: "center", dataType: "String"},
|
|
|
{headerName: "总消耗量", headerWidth: 100, dataCode: "quantity", hAlign: "right", dataType: "Number",decimalField:'glj.quantity'},
|
|
|
- {headerName: "定额价", headerWidth: 70, dataCode: "basePrice", hAlign: "right", dataType: "Number",decimalField:'glj.quantity',validator:"number"},
|
|
|
+ {headerName: "定额价", headerWidth: 70, dataCode: "basePrice", hAlign: "right", dataType: "Number",decimalField:'glj.unitPrice',validator:"number"},
|
|
|
{headerName: "调整价", headerWidth: 70, dataCode: "adjustPrice", hAlign: "right", dataType: "Number",decimalField:"glj.unitPrice"},
|
|
|
{headerName: "市场价", headerWidth: 70, dataCode: "marketPrice", hAlign: "right", dataType: "Number",decimalField:"glj.unitPrice",validator:"number"},
|
|
|
{headerName: "是否暂估", headerWidth: 60, dataCode: "is_evaluate", hAlign: "center", dataType: "String",cellType:'checkBox'},
|
|
@@ -29,21 +32,24 @@ projectGljObject={
|
|
|
projectGljSheetData:[],
|
|
|
mixRatioSetting:{
|
|
|
header:[
|
|
|
- {headerName: "编码", headerWidth: 80, dataCode: "code", dataType: "String"},
|
|
|
- {headerName: "名称", headerWidth: 160, dataCode: "name", dataType: "String"},
|
|
|
- {headerName: "单位", headerWidth: 45, dataCode: "unit", hAlign: "center", dataType: "String"},
|
|
|
- {headerName: "类型", headerWidth: 45, dataCode: "short_name", hAlign: "center", dataType: "String"},
|
|
|
- {headerName: "定额价", headerWidth: 70, dataCode: "basePrice", hAlign: "right", dataType: "Number",decimalField:'glj.quantity',validator:"number"},
|
|
|
- {headerName: "调整价", headerWidth: 70, dataCode: "adjustPrice", hAlign: "right", dataType: "Number",decimalField:"glj.unitPrice"},
|
|
|
- {headerName: "市场价", headerWidth: 70, dataCode: "marketPrice", hAlign: "right", dataType: "Number",decimalField:"glj.unitPrice",validator:"number"}
|
|
|
+ {headerName: "编码", headerWidth: 120, dataCode: "code", dataType: "String"},
|
|
|
+ {headerName: "名称", headerWidth: 120, dataCode: "name", 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"},
|
|
|
+ {headerName: "调整价", headerWidth: 120, dataCode: "adjustPrice", hAlign: "right", dataType: "Number",decimalField:"glj.unitPrice"},
|
|
|
+ {headerName: "市场价", headerWidth: 120, dataCode: "marketPrice", hAlign: "right", dataType: "Number",decimalField:"glj.unitPrice",validator:"number"},
|
|
|
+ {headerName: "用量", headerWidth: 120, dataCode: "consumption", hAlign: "right", dataType: "Number",decimalField:"glj.quantity",validator:"number"}
|
|
|
],
|
|
|
view: {
|
|
|
- lockColumns: [0,1]
|
|
|
+ lockColumns: [0,1,2,3,4,5,6]
|
|
|
}
|
|
|
},
|
|
|
mixRatioSpread:null,
|
|
|
mixRatioSheet:null,
|
|
|
mixRatioData:[],
|
|
|
+ usedTenderList:[],
|
|
|
+ usedUnitPriceInfo:null,
|
|
|
initProjectGljSpread:function () {
|
|
|
this.projectGljSpread = SheetDataHelper.createNewSpread($("#project_glj_sheet")[0]);
|
|
|
this.projectGljSheet = this.projectGljSpread .getSheet(0);
|
|
@@ -52,6 +58,77 @@ projectGljObject={
|
|
|
this.projectGljSheet.bind(GC.Spread.Sheets.Events.EditStarting,this.onProjectGljEditStarting);
|
|
|
this.projectGljSheet.name('projectGljSheet');
|
|
|
},
|
|
|
+ initMixRatio:function () {
|
|
|
+ let me = projectGljObject;
|
|
|
+ if(me.mixRatioSpread==null){
|
|
|
+ me.initMixRatioSpread();
|
|
|
+ me.initRightClick();
|
|
|
+ }
|
|
|
+ me.showMixRatioData();
|
|
|
+ },
|
|
|
+ initMixRatioSpread:function () {
|
|
|
+ this.mixRatioSpread = SheetDataHelper.createNewSpread($("#mix_ratio_sheet")[0]);
|
|
|
+ this.mixRatioSheet = this.mixRatioSpread .getSheet(0);
|
|
|
+ this.initSheet(this.mixRatioSheet,this.mixRatioSetting);
|
|
|
+ this.mixRatioSheet.name('mixRatioSheet');
|
|
|
+ },
|
|
|
+ unitPriceFileInit:function() {
|
|
|
+ let me = this;
|
|
|
+ let projectGLJ = projectObj.project.projectGLJ;
|
|
|
+ let data = projectGLJ.datas;
|
|
|
+ me.usedTenderList = data.usedTenderList !== undefined ? data.usedTenderList : [];
|
|
|
+ me.usedUnitPriceInfo = data.constData.usedUnitPriceInfo !== undefined ?
|
|
|
+ data.constData.usedUnitPriceInfo : {};
|
|
|
+ $("#current-name").text(me.usedUnitPriceInfo.name);
|
|
|
+ let usedCount = me.usedTenderList.length <= 0 ? 1 : me.usedTenderList.length;
|
|
|
+ $("#used-project-count").text(usedCount);
|
|
|
+ },
|
|
|
+ getUsedTenderInfo:function() {
|
|
|
+ return projectGljObject.usedTenderList.join("<br>");
|
|
|
+ },
|
|
|
+ showMixRatioData:function () {
|
|
|
+ let me = this,gljId = null;
|
|
|
+ let consumptionCol = _.findIndex(me.mixRatioSetting.header, { 'dataCode': 'consumption'});
|
|
|
+ if(me.showTag == 'ration'){
|
|
|
+ return;
|
|
|
+ }else if(me.showTag == 'mixRatio'){
|
|
|
+ me.mixRatioSheet.setValue(0, consumptionCol, '用量', GC.Spread.Sheets.SheetArea.colHeader);
|
|
|
+ }else if(me.showTag == 'machine'){
|
|
|
+ me.mixRatioSheet.setValue(0, consumptionCol, '消耗量', GC.Spread.Sheets.SheetArea.colHeader);
|
|
|
+ }
|
|
|
+ let sel = me.projectGljSheet.getSelections()[0];
|
|
|
+ if(me.projectGljSheetData.length>sel.row){
|
|
|
+ gljId = me.projectGljSheetData[sel.row].id;
|
|
|
+ }
|
|
|
+ projectObj.project.projectGLJ.getRatioData(gljId,function (data) {
|
|
|
+ let rationList =[];
|
|
|
+ console.log(data);
|
|
|
+ for(let glj of data){
|
|
|
+ rationList.push(me.getMixRatioSheetData(glj)) ;
|
|
|
+ }
|
|
|
+ me.mixRatioData = rationList;
|
|
|
+ me.mixRatioSheet.setRowCount(0);
|
|
|
+ sheetCommonObj.showData(me.mixRatioSheet, me.mixRatioSetting,me.mixRatioData);
|
|
|
+ me.mixRatioSheet.setRowCount(me.mixRatioData.length);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getMixRatioSheetData:function (glj) {
|
|
|
+ let data ={
|
|
|
+ id:glj.id,
|
|
|
+ mix_ratio_id:glj.ratio_data.id,
|
|
|
+ code:glj.code,
|
|
|
+ name:glj.name,
|
|
|
+ specs:glj.specs,
|
|
|
+ unit:glj.unit,
|
|
|
+ type:glj.type,
|
|
|
+ short_name:projectObj.project.projectGLJ.getShortNameByID(glj.type),
|
|
|
+ consumption:glj.ratio_data.consumption,
|
|
|
+ unit_price:glj.unit_price
|
|
|
+ };
|
|
|
+ gljOprObj.setGLJPrice(data,glj);
|
|
|
+ return data;
|
|
|
+ },
|
|
|
+
|
|
|
onProjectGljEditStarting:function (sender, args) {
|
|
|
let me = projectGljObject;
|
|
|
let row = args.row;
|
|
@@ -84,14 +161,13 @@ projectGljObject={
|
|
|
me.projectGljSheet.getCell(row, col, GC.Spread.Sheets.SheetArea.viewport).locked(true);
|
|
|
}
|
|
|
}
|
|
|
+ me.showMixRatioData();
|
|
|
me.projectGljSheet.repaint();
|
|
|
},
|
|
|
-
|
|
|
-
|
|
|
showProjectGljData:function () {
|
|
|
let projectGljSheetData = [];
|
|
|
let gljList = projectObj.project.projectGLJ.datas.gljList;
|
|
|
- gljList = filterProjectGLJ(gljList);
|
|
|
+ gljList = this.filterProjectGLJ(gljList);
|
|
|
gljList = sortProjectGLJ(gljList);
|
|
|
for(let glj of gljList){
|
|
|
projectGljSheetData.push(this.getSheetDataByGLJ(glj));
|
|
@@ -101,6 +177,25 @@ projectGljObject={
|
|
|
sheetCommonObj.showData(this.projectGljSheet, this.projectGljSetting,this.projectGljSheetData);
|
|
|
this.projectGljSheet.setRowCount(this.projectGljSheetData.length);
|
|
|
},
|
|
|
+ filterProjectGLJ:function (gljList) {
|
|
|
+ let me = projectGljObject;
|
|
|
+ if(gljList.length>0){
|
|
|
+ gljList = _.filter(gljList,function (item) {
|
|
|
+ if(item.quantity !== 0 && item.quantity !== '0'){//过滤掉消耗量为0的工料机
|
|
|
+ //showTag:'ration',//mixRatio/machine
|
|
|
+ if(me.showTag == 'ration'){
|
|
|
+ return true;
|
|
|
+ }else if(me.showTag == 'mixRatio'){
|
|
|
+ return _.includes(me.mixRatioType,item.type)
|
|
|
+ }else if(me.showTag == 'machine'){
|
|
|
+ return _.includes(me.machineType,item.type)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return gljList;
|
|
|
+ },
|
|
|
getSheetDataByGLJ:function (glj) {
|
|
|
let projectGLJ = projectObj.project.projectGLJ;
|
|
|
let materialIdList = projectGLJ.datas.constData.materialIdList;
|
|
@@ -162,7 +257,90 @@ projectGljObject={
|
|
|
let me = projectGljObject;
|
|
|
if(info.sheetName=='projectGljSheet'){
|
|
|
me.onProjectGLJValueChange(e,info);
|
|
|
+ }if(info.sheetName == 'mixRatioSheet'){
|
|
|
+ me.onMixRatioValueChange(e,info);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onMixRatioValueChange:function (e,info){
|
|
|
+ let composition = projectObj.project.composition;
|
|
|
+ let me = projectGljObject,row = info.row, col = info.col;
|
|
|
+ let dataCode = me.mixRatioSetting.header[col].dataCode;
|
|
|
+ let recode = me.mixRatioData[row];
|
|
|
+ let value = info.newValue;
|
|
|
+ if (!me.checkData(col,me.mixRatioSetting,value)) {
|
|
|
+ alert('输入的数据类型不对,请重新输入!');
|
|
|
+ me.mixRatioSheet.setValue(row, col, info.oldValue);
|
|
|
+ return false;
|
|
|
}
|
|
|
+ value = scMathUtil.roundToString(value,getDecimal("glj.quantity"));
|
|
|
+ let [parentMarketPrice, parentBasePrice] = me.getCompositionSumPrice('modify', row, value);
|
|
|
+ let updateData ={id: recode.mix_ratio_id, field: 'mix_ratio.' + dataCode, value: value, market_price: parentMarketPrice, base_price: parentBasePrice};
|
|
|
+ let prow= projectGljObject.projectGljSheet.getActiveRowIndex();//取父机械或组成物的下标
|
|
|
+ let prowData = projectGljObject.projectGljSheetData[prow];
|
|
|
+ composition.updateConsumption(updateData,recode,prowData.id,function () {
|
|
|
+ me.refreshParentData(prow,prowData.id);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ refreshParentData:function (row,pid) {
|
|
|
+ let me = this;
|
|
|
+ me.refreshProjectGljRow(row);
|
|
|
+ // 更新组成物缓存
|
|
|
+ projectObj.project.composition.loadData();
|
|
|
+ //选查找使用了父项目工料机的定额工料机
|
|
|
+ let updateNodes=[];
|
|
|
+ let ration_gljs = _.filter(projectObj.project.ration_glj.datas,{'projectGLJID':pid});
|
|
|
+ for(let rg of ration_gljs){
|
|
|
+ let node = projectObj.project.mainTree.getNodeByID(rg.rationID);
|
|
|
+ if(node){
|
|
|
+ updateNodes.push(node);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //或者是使用了父项目工料机的工料机类型的定额
|
|
|
+ let rations = _.filter(projectObj.project.Ration.datas,{'type':3,'projectGLJID':pid});
|
|
|
+ for(let r of rations){
|
|
|
+ let r_node = projectObj.project.mainTree.getNodeByID(r.ID);
|
|
|
+ if(r_node){
|
|
|
+ r_node.data.marketUnitFee = projectGljObject.projectGljSheetData[row].marketPrice;//parentMarketPrice;//这里用显示的价格
|
|
|
+ updateNodes.push(r_node);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(updateNodes.length>0){
|
|
|
+ projectObj.project.calcProgram.calcRationsAndSave(updateNodes);
|
|
|
+ }
|
|
|
+ gljOprObj.refreshView();
|
|
|
+ },
|
|
|
+
|
|
|
+ deleteMixRatio:function (row) {
|
|
|
+ let me = this, deleteRecode = me.mixRatioData[row];
|
|
|
+ let consumption = deleteRecode.consumption;
|
|
|
+ let [parentMarketPrice, parentBasePrice] = me.getCompositionSumPrice('delete', row);
|
|
|
+ let prow= projectGljObject.projectGljSheet.getActiveRowIndex();//取父机械或组成物的下标
|
|
|
+ let prowData = projectGljObject.projectGljSheetData[prow];
|
|
|
+ let updateData = {id: deleteRecode.mix_ratio_id, field: 'mix_ratio.consumption' , value: 0, market_price: parentMarketPrice, base_price: parentBasePrice};
|
|
|
+ projectObj.project.composition.deleteComposition(updateData,deleteRecode,prowData.id,function () {
|
|
|
+ me.refreshParentData(prow,prowData.id);
|
|
|
+ me.mixRatioSheet.deleteRows(row,1);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getCompositionSumPrice : function(scene, affectRow, newValue = 0) {
|
|
|
+ let me = this;
|
|
|
+ let parentMarketPrice = 0;
|
|
|
+ let parentBasePrice = 0;
|
|
|
+ for(let i = 0;i < me.mixRatioData.length;i++){
|
|
|
+ let ratio = me.mixRatioData[i];
|
|
|
+ let marketPrice = ratio.unit_price.marketPrice;
|
|
|
+ let basePrice = ratio.unit_price.base_price;
|
|
|
+ // 如果是删除则忽略即将被删除的行数据
|
|
|
+ if (scene === 'delete' && affectRow === i) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ let consumption = i === affectRow ? newValue : ratio.consumption;
|
|
|
+ parentMarketPrice += operationWithRound(consumption,marketPrice,"glj.unitPrice","*");
|
|
|
+ parentBasePrice += operationWithRound(consumption,basePrice,"glj.unitPrice","*");
|
|
|
+ }
|
|
|
+ parentMarketPrice = parentMarketPrice.toDecimal(getDecimal("glj.unitPrice"));
|
|
|
+ parentBasePrice = parentBasePrice.toDecimal(getDecimal("glj.unitPrice"));
|
|
|
+ return [parentMarketPrice, parentBasePrice];
|
|
|
},
|
|
|
onProjectGLJValueChange:function (e,info) {
|
|
|
let projectGLJ = projectObj.project.projectGLJ;
|
|
@@ -236,27 +414,202 @@ projectGljObject={
|
|
|
break;
|
|
|
}
|
|
|
return result;
|
|
|
+ },
|
|
|
+ initRightClick : function() {
|
|
|
+ let activeSheet = this.mixRatioSheet;
|
|
|
+ let me = this;
|
|
|
+ $.contextMenu({
|
|
|
+ selector: '#mix_ratio_sheet',
|
|
|
+ build: function ($trigger, e) {
|
|
|
+ me.rightClickTarget = SheetDataHelper.safeRightClickSelection($trigger, e, me.mixRatioSpread);
|
|
|
+ return me.rightClickTarget.hitTestType === GC.Spread.Sheets.SheetArea.viewport ||
|
|
|
+ me.rightClickTarget.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
|
|
|
+ },
|
|
|
+ items: {
|
|
|
+ "deleteMixRatio": {
|
|
|
+ name: "删除",
|
|
|
+ icon: 'fa-trash-o',
|
|
|
+ disabled: function () {
|
|
|
+ return me.rightClickTarget.row === undefined;
|
|
|
+ },
|
|
|
+ callback: function (key, opt) {
|
|
|
+ let row = me.rightClickTarget.row;
|
|
|
+ me.deleteMixRatio(row);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ changeFileCallback:function(){
|
|
|
+ projectGljObject.unitPriceFileInit();
|
|
|
+ projectGljObject.showProjectGljData();
|
|
|
+ gljOprObj.refreshView();
|
|
|
+ projectObj.project.calcProgram.calcAllNodesAndSave();
|
|
|
+ if(socketObject.roomInfo){
|
|
|
+ let data ={
|
|
|
+ projectID:projectObj.project.ID(),
|
|
|
+ oldRoom:socketObject.roomInfo.unitFile,
|
|
|
+ newRoom:socketObject.getUnitFileRoomID(),
|
|
|
+ name:'unitFile'
|
|
|
+ };
|
|
|
+ socket.emit('changeNewRoom',data);
|
|
|
+ socketObject.roomInfo.unitFile = socketObject.getUnitFileRoomID();
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
|
|
|
|
|
|
$(function () {
|
|
|
- $('#tab_project_glj').on('show.bs.tab', function (e) {
|
|
|
+ $('#tab_project_glj').on('shown.bs.tab', function (e) {
|
|
|
let me = projectGljObject;
|
|
|
$(e.relatedTarget.hash).removeClass('active');
|
|
|
- setTimeout(function () {
|
|
|
- if(me.projectGljSpread==null){
|
|
|
- me.initProjectGljSpread();
|
|
|
- }
|
|
|
- me.showProjectGljData();
|
|
|
- loadSize("project-glj-main", function () {
|
|
|
- me.projectGljSpread.refresh();
|
|
|
- });
|
|
|
- },1)
|
|
|
+ if(me.projectGljSpread==null){
|
|
|
+ me.initProjectGljSpread();
|
|
|
+ }
|
|
|
+ me.unitPriceFileInit();
|
|
|
+ me.showProjectGljData();
|
|
|
+ loadSize("project-glj-main", function () {
|
|
|
+ me.projectGljSpread.refresh();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ $('#ration_link').on('shown.bs.tab', function (e) {
|
|
|
+ let me = projectGljObject;
|
|
|
+ me.showTag='ration';
|
|
|
+ me.showProjectGljData();
|
|
|
+ });
|
|
|
+ $('#mix_ratio_link').on('shown.bs.tab', function (e) {
|
|
|
+ let me = projectGljObject;
|
|
|
+ me.showTag='mixRatio';
|
|
|
+ me.showProjectGljData();
|
|
|
+ me.initMixRatio();
|
|
|
+ });
|
|
|
+ $('#machine_ratio_link').on('shown.bs.tab', function (e) {
|
|
|
+ let me = projectGljObject;
|
|
|
+ me.showTag='machine';
|
|
|
+ me.showProjectGljData();
|
|
|
+ me.initMixRatio();
|
|
|
});
|
|
|
slideResize($("#project-glj-main"), function () {
|
|
|
projectGljObject.projectGljSpread.refresh();
|
|
|
});
|
|
|
+ $('#pop-used-list').popover({
|
|
|
+ placement: "bottom",
|
|
|
+ html: true,
|
|
|
+ trigger: "hover | focus",
|
|
|
+ content: projectGljObject.getUsedTenderInfo
|
|
|
+ }
|
|
|
+ );
|
|
|
+ // 单价文件切换弹框
|
|
|
+ $('#change-unitFile').on('shown.bs.modal', function () {
|
|
|
+ // 获取当前建设项数据
|
|
|
+ let projectName = projectInfoObj.projectInfo.fullFolder !== undefined &&
|
|
|
+ projectInfoObj.projectInfo.fullFolder.length > 0 ? projectInfoObj.projectInfo.fullFolder[0] : '';
|
|
|
+ $("#current-project-name").text(projectName);
|
|
|
+ let rootProjectID = projectInfoObj.projectInfo.property.rootProjectID;
|
|
|
+ // 获取切换单价文件相关数据
|
|
|
+ $.ajax({
|
|
|
+ url: '/glj/get-project-info',
|
|
|
+ type: 'post',
|
|
|
+ data: {project_id: scUrlUtil.GetQueryString('project'),rootProjectID:rootProjectID},
|
|
|
+ dataType: 'json',
|
|
|
+ success: function (response) {
|
|
|
+ if (response.err === 1) {
|
|
|
+ alert('数据传输错误!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ let data = response.data;
|
|
|
+ // 本项目中的单价文件
|
|
|
+ if (data.self.length > 0) {
|
|
|
+ let selfFileHtml = '';
|
|
|
+ for (let tmp of data.self) {
|
|
|
+ let select = usedUnitPriceInfo === tmp.id ? ' selected="selected"' : '';
|
|
|
+ selfFileHtml += '<option' + select + ' value="' + tmp.id + '">' + tmp.name + '</option>';
|
|
|
+ }
|
|
|
+ $("#self-file").html(selfFileHtml);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 其他建设项目数据
|
|
|
+ if (data.other.length > 0) {
|
|
|
+ let otherProjectHtml = '';
|
|
|
+ let otherFileHtml = '';
|
|
|
+ for (let tmp of data.other) {
|
|
|
+ otherProjectHtml += '<option value="' + tmp.ID + '">' + tmp.name + '</option>';
|
|
|
+ otherFileData[tmp.ID] = tmp.unitPriceList;
|
|
|
+ if (otherFileHtml !== '') {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ for (let unitPrice of tmp.unitPriceList) {
|
|
|
+ otherFileHtml += '<option value="' + unitPrice.id + '">' + unitPrice.name + '</option>';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $("#other-project").html(otherProjectHtml);
|
|
|
+ $("#other-file").html(otherFileHtml);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ // 单价文件切换确认
|
|
|
+ $("#change-file-confirm").click(function () {
|
|
|
+ let type = $("input[name='change-type']:checked").val();
|
|
|
+ type = parseInt(type);
|
|
|
+ let changeUnitPriceId = 0;
|
|
|
+ if (type === 0) {
|
|
|
+ // 从本项目中选择
|
|
|
+ changeUnitPriceId = $("#self-file").val();
|
|
|
+ } else {
|
|
|
+ // 从其他项目中复制
|
|
|
+ changeUnitPriceId = $("#other-file").val();
|
|
|
+ }
|
|
|
+ $('#change-unitFile').modal("hide");
|
|
|
+ let data = {project_id: scUrlUtil.GetQueryString('project'), change_id: changeUnitPriceId, type: type};
|
|
|
+ projectObj.project.projectGLJ.changeFile(data,function () {
|
|
|
+ projectGljObject.changeFileCallback();
|
|
|
+ })
|
|
|
+ });
|
|
|
+ // 单价文件选项切换
|
|
|
+ $("input[name='change-type']").change(function () {
|
|
|
+ let type = $(this).val();
|
|
|
+ type = parseInt(type);
|
|
|
+ $("#change-unitFile .option").hide();
|
|
|
+ if (type === 0) {
|
|
|
+ $(".option.select").show();
|
|
|
+ } else {
|
|
|
+ $(".option.copy").show();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ $("#unitFile-save-as").on('shown.bs.modal', function () {
|
|
|
+ // 获取当前建设项数据
|
|
|
+ $("#save-as-name").val(projectGljObject.usedUnitPriceInfo.name + '(复件)');
|
|
|
+ });
|
|
|
+
|
|
|
+ // 从其他建设项目中复制 选择建设项目
|
|
|
+ $("#other-project").change(function () {
|
|
|
+ let projectId = $(this).val();
|
|
|
+ if (otherFileData[projectId] === undefined) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ let otherFileHtml = '';
|
|
|
+ for (let unitPrice of otherFileData[projectId]) {
|
|
|
+ otherFileHtml += '<option value="' + unitPrice.id + '">' + unitPrice.name + '</option>';
|
|
|
+ }
|
|
|
+ $("#other-file").html(otherFileHtml);
|
|
|
+ });
|
|
|
+
|
|
|
+ // 单价文件另存为操作
|
|
|
+ $("#save-as-confirm").click(function () {
|
|
|
+ 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");
|
|
|
+ });
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
|