|
@@ -73,8 +73,7 @@ let repositoryGljObj = {
|
|
|
gljList: [],
|
|
gljList: [],
|
|
|
stdGljList:[],
|
|
stdGljList:[],
|
|
|
complementaryGljList: [],
|
|
complementaryGljList: [],
|
|
|
- machineModel: {textArr: ['特', '大', '中', '小'], comboItems: [{text: '特', value: 1}, {text: '大', value: 2},{text: '中', value: 3}, {text: '小', value: 4}]},
|
|
|
|
|
- machineModelIdx: {'1': '特', '2': '大', '3': '中', '4': '小'},
|
|
|
|
|
|
|
+ feeDataCode: ['grossWeightCoe', 'purchaseStorageRate', 'offSiteTransportLossRate', 'handlingLossRate'],
|
|
|
distTypeTree: null,//add
|
|
distTypeTree: null,//add
|
|
|
setting: {
|
|
setting: {
|
|
|
header:[
|
|
header:[
|
|
@@ -84,7 +83,10 @@ let repositoryGljObj = {
|
|
|
{headerName:"单位",headerWidth:45,dataCode:"unit", dataType: "String", hAlign: "center", vAlign: "center"},
|
|
{headerName:"单位",headerWidth:45,dataCode:"unit", dataType: "String", hAlign: "center", vAlign: "center"},
|
|
|
{headerName:"定额价",headerWidth:80,dataCode:"basePrice", dataType: "Number", formatter: "0.00", hAlign: "right", vAlign: "center"},
|
|
{headerName:"定额价",headerWidth:80,dataCode:"basePrice", dataType: "Number", formatter: "0.00", hAlign: "right", vAlign: "center"},
|
|
|
{headerName:"类型",headerWidth:90,dataCode:"gljType", dataType: "String", hAlign: "center", vAlign: "center"},
|
|
{headerName:"类型",headerWidth:90,dataCode:"gljType", dataType: "String", hAlign: "center", vAlign: "center"},
|
|
|
- {headerName:"机型",headerWidth:60,dataCode:"model", dataType: "Number", hAlign: "center", vAlign: "center"},
|
|
|
|
|
|
|
+ {headerName:"毛重系数",headerWidth:90,dataCode:"grossWeightCoe", dataType: "Number", hAlign: "center", vAlign: "center"},
|
|
|
|
|
+ {headerName:"采购保管费率",headerWidth:90,dataCode:"purchaseStorageRate", dataType: "Number", hAlign: "center", vAlign: "center"},
|
|
|
|
|
+ {headerName:"场外运输损耗率",headerWidth:100,dataCode:"offSiteTransportLossRate", dataType: "Number", hAlign: "center", vAlign: "center"},
|
|
|
|
|
+ {headerName:"每增一次装卸损耗率",headerWidth:100,dataCode:"handlingLossRate", dataType: "Number", hAlign: "center", vAlign: "center"},
|
|
|
{headerName:"是否新增",headerWidth:60,dataCode:"isComplementary", hAlign: "center", vAlign: "center"}
|
|
{headerName:"是否新增",headerWidth:60,dataCode:"isComplementary", hAlign: "center", vAlign: "center"}
|
|
|
],
|
|
],
|
|
|
view:{
|
|
view:{
|
|
@@ -111,10 +113,9 @@ let repositoryGljObj = {
|
|
|
sheet.resumeEvent();
|
|
sheet.resumeEvent();
|
|
|
},
|
|
},
|
|
|
getComboData: function (gljDistType) {
|
|
getComboData: function (gljDistType) {
|
|
|
- let me = this;
|
|
|
|
|
let distType;
|
|
let distType;
|
|
|
let distTypeTree = {
|
|
let distTypeTree = {
|
|
|
- prefix: 'gljType',
|
|
|
|
|
|
|
+ prefix : 'gljType',
|
|
|
distTypes: {},
|
|
distTypes: {},
|
|
|
comboDatas: [],
|
|
comboDatas: [],
|
|
|
distTypesArr: []
|
|
distTypesArr: []
|
|
@@ -124,20 +125,20 @@ let repositoryGljObj = {
|
|
|
data: typeData,
|
|
data: typeData,
|
|
|
children: [],
|
|
children: [],
|
|
|
parent: null
|
|
parent: null
|
|
|
- }
|
|
|
|
|
|
|
+ };
|
|
|
distTypeTree.distTypes[distTypeTree.prefix + typeData.ID] = typeObj;
|
|
distTypeTree.distTypes[distTypeTree.prefix + typeData.ID] = typeObj;
|
|
|
distTypeTree.distTypesArr.push(typeObj);
|
|
distTypeTree.distTypesArr.push(typeObj);
|
|
|
});
|
|
});
|
|
|
gljDistType.forEach(function (typeData) {
|
|
gljDistType.forEach(function (typeData) {
|
|
|
distType = distTypeTree.distTypes[distTypeTree.prefix + typeData.ID];
|
|
distType = distTypeTree.distTypes[distTypeTree.prefix + typeData.ID];
|
|
|
let parent = distTypeTree.distTypes[distTypeTree.prefix + typeData.ParentID];
|
|
let parent = distTypeTree.distTypes[distTypeTree.prefix + typeData.ParentID];
|
|
|
- if (parent) {
|
|
|
|
|
|
|
+ if(parent){
|
|
|
distType.parent = parent;
|
|
distType.parent = parent;
|
|
|
parent.children.push(distType);
|
|
parent.children.push(distType);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
distTypeTree.distTypesArr.forEach(function (distTypeObj) {
|
|
distTypeTree.distTypesArr.forEach(function (distTypeObj) {
|
|
|
- if (distTypeObj.data.fullName !== '材料' && distTypeObj.data.fullName !== '机械') {
|
|
|
|
|
|
|
+ if(allowGljType.includes(distTypeObj.data.ID)){
|
|
|
distTypeTree.comboDatas.push({text: distTypeObj.data.fullName, value: distTypeObj.data.ID});
|
|
distTypeTree.comboDatas.push({text: distTypeObj.data.fullName, value: distTypeObj.data.ID});
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
@@ -170,7 +171,6 @@ let repositoryGljObj = {
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
getGljItems: function(stdGljLibId, callback) {
|
|
getGljItems: function(stdGljLibId, callback) {
|
|
|
- console.log('enterGG');
|
|
|
|
|
let me = this;
|
|
let me = this;
|
|
|
CommonAjax.post('complementartGlj/api/getGljItems', {stdGljLibId: stdGljLibId}, function (rstData) {
|
|
CommonAjax.post('complementartGlj/api/getGljItems', {stdGljLibId: stdGljLibId}, function (rstData) {
|
|
|
me.stdGljList = rstData.stdGljs;
|
|
me.stdGljList = rstData.stdGljs;
|
|
@@ -217,11 +217,8 @@ let repositoryGljObj = {
|
|
|
sheet.setCellType(row, isComplementaryCol, baseCell);
|
|
sheet.setCellType(row, isComplementaryCol, baseCell);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
- sheetOpr.showData(sheet, me.setting, cacheSection, me.distTypeTree, me.machineModelIdx);
|
|
|
|
|
|
|
+ sheetOpr.showData(sheet, me.setting, cacheSection, me.distTypeTree);
|
|
|
sheetCommonObj.setDynamicCombo(sheet, 0, 5, sheet.getRowCount(), me.distTypeTree.comboDatas, false, 'text');
|
|
sheetCommonObj.setDynamicCombo(sheet, 0, 5, sheet.getRowCount(), me.distTypeTree.comboDatas, false, 'text');
|
|
|
- sheetCommonObj.setDynamicCombo(sheet, 0, 6, sheet.getRowCount(), me.machineModel.comboItems, false, 'text');
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
cacheSection = null;
|
|
cacheSection = null;
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -277,21 +274,6 @@ let repositoryGljObj = {
|
|
|
return v !== undefined && v !== null;
|
|
return v !== undefined && v !== null;
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- //成为了组成物,暂时只需要判断主材的
|
|
|
|
|
- isComponent: function (gljId, gljList) {
|
|
|
|
|
- for(let i = 0, len = gljList.length; i < len; i++){
|
|
|
|
|
- let gljComponent = gljList[i].component;
|
|
|
|
|
- if(gljList[i].gljType === 4 && this.isDef(gljComponent) && gljComponent.length > 0){
|
|
|
|
|
- for(let j = 0, jLen = gljComponent.length; j < jLen; j++){
|
|
|
|
|
- if(gljComponent[j].ID === gljId){
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return false;
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
getCurrentComponent: function (gljComponent) {
|
|
getCurrentComponent: function (gljComponent) {
|
|
|
let me = repositoryGljObj, rst = [];
|
|
let me = repositoryGljObj, rst = [];
|
|
|
for(let i = 0; i < gljComponent.length; i++){
|
|
for(let i = 0; i < gljComponent.length; i++){
|
|
@@ -405,11 +387,9 @@ let repositoryGljObj = {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- else{
|
|
|
|
|
|
|
+ } else{
|
|
|
me.currentGlj = null;
|
|
me.currentGlj = null;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
//组成物表能编辑则显示,否则隐藏该工作表
|
|
//组成物表能编辑则显示,否则隐藏该工作表
|
|
|
let rightWidth = getLocalCache('compleGLjrightContentWidth') || '25%';
|
|
let rightWidth = getLocalCache('compleGLjrightContentWidth') || '25%';
|
|
|
rightWidth = rightWidth.replace('%', '');
|
|
rightWidth = rightWidth.replace('%', '');
|
|
@@ -503,7 +483,7 @@ let repositoryGljObj = {
|
|
|
},
|
|
},
|
|
|
onButtonClicked: function (sender, args) {
|
|
onButtonClicked: function (sender, args) {
|
|
|
let me = repositoryGljObj;
|
|
let me = repositoryGljObj;
|
|
|
- if(args.col === 6 && args.row < me.currentCache.length){
|
|
|
|
|
|
|
+ if(me.setting.header[args.col].dataCode === 'isComplementary' && args.row < me.currentCache.length){
|
|
|
args.sheet.setValue(args.row, args.col, true);
|
|
args.sheet.setValue(args.row, args.col, true);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -512,18 +492,19 @@ let repositoryGljObj = {
|
|
|
let rObj = sheetOpr.combineRowData(me.workBook.getSheet(0), me.setting, args.row);
|
|
let rObj = sheetOpr.combineRowData(me.workBook.getSheet(0), me.setting, args.row);
|
|
|
me.currentEditingGlj = rObj;
|
|
me.currentEditingGlj = rObj;
|
|
|
me.orgCode = me.workBook.getSheet(0).getValue(args.row, 0);
|
|
me.orgCode = me.workBook.getSheet(0).getValue(args.row, 0);
|
|
|
|
|
+ let dataCode = me.setting.header[args.col].dataCode;
|
|
|
if(args.row < me.currentCache.length){
|
|
if(args.row < me.currentCache.length){
|
|
|
me.currentGlj = me.currentCache[args.row];
|
|
me.currentGlj = me.currentCache[args.row];
|
|
|
- if(args.col === 0 || (args.col === 4 && allowComponent.includes(me.currentGlj.gljType) && me.currentGlj.component.length > 0)
|
|
|
|
|
- || (args.col === 6 && me.currentGlj.gljType !== 301) || args.col === 7){
|
|
|
|
|
|
|
+ //费率数据列只有普通材料能用,可添加组成物的人材机,基价只读
|
|
|
|
|
+ if (dataCode === 'code'|| (me.feeDataCode.includes(dataCode) && me.currentGlj.gljType !== 201) ||
|
|
|
|
|
+ (dataCode === 'basePrice' && allowComponent.includes(me.currentGlj.gljType)) ||
|
|
|
|
|
+ dataCode === 'isComplementary'){
|
|
|
args.cancel = true;
|
|
args.cancel = true;
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
rObj.ID = me.currentGlj.ID;
|
|
rObj.ID = me.currentGlj.ID;
|
|
|
rObj.gljClass = me.currentGlj.gljClass;
|
|
rObj.gljClass = me.currentGlj.gljClass;
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
me.currentGlj = null;
|
|
me.currentGlj = null;
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -531,29 +512,29 @@ let repositoryGljObj = {
|
|
|
let me = repositoryGljObj, that = gljComponentOprObj,
|
|
let me = repositoryGljObj, that = gljComponentOprObj,
|
|
|
rObj = sheetOpr.combineRowData(me.workBook.getSheet(0), me.setting, args.row, me),
|
|
rObj = sheetOpr.combineRowData(me.workBook.getSheet(0), me.setting, args.row, me),
|
|
|
updateArr = [], addArr = [], updateBasePrcArr = [];
|
|
updateArr = [], addArr = [], updateBasePrcArr = [];
|
|
|
|
|
+ let dataCode = me.setting.header[args.col].dataCode;
|
|
|
me.editingRowIdx = args.row;
|
|
me.editingRowIdx = args.row;
|
|
|
rObj.basePrice = rObj.basePrice ? rObj.basePrice : 0;
|
|
rObj.basePrice = rObj.basePrice ? rObj.basePrice : 0;
|
|
|
//更新
|
|
//更新
|
|
|
if (me.currentEditingGlj["ID"]) {
|
|
if (me.currentEditingGlj["ID"]) {
|
|
|
rObj["ID"] = me.currentEditingGlj["ID"];
|
|
rObj["ID"] = me.currentEditingGlj["ID"];
|
|
|
rObj.gljClass = me.currentEditingGlj.gljClass;
|
|
rObj.gljClass = me.currentEditingGlj.gljClass;
|
|
|
- //for(let col =0; col< me.setting.header.length; col++){
|
|
|
|
|
- if(me.currentEditingGlj[me.setting.header[args.col].dataCode] !== rObj[me.setting.header[args.col].dataCode]){
|
|
|
|
|
- //me.addGljObj = rObj;
|
|
|
|
|
|
|
+ if(me.currentEditingGlj[dataCode] !== rObj[dataCode]){
|
|
|
//编码、名称、单位、类型不可为空
|
|
//编码、名称、单位、类型不可为空
|
|
|
- if(rObj[me.setting.header[0].dataCode] && rObj[me.setting.header[1].dataCode] && rObj[me.setting.header[3].dataCode] && rObj[me.setting.header[5].dataCode]
|
|
|
|
|
- &&rObj[me.setting.header[0].dataCode].toString().trim().length !== 0 && rObj[me.setting.header[1].dataCode].toString().trim().length !== 0 && rObj[me.setting.header[3].dataCode].toString().trim().length !== 0&&
|
|
|
|
|
- rObj[me.setting.header[5].dataCode].toString().trim().length !== 0){
|
|
|
|
|
|
|
+ if(rObj.code && rObj.name && rObj.unit && rObj.gljType
|
|
|
|
|
+ &&rObj.code.toString().trim().length !== 0 && rObj.name.toString().trim().length !== 0 && rObj.unit.toString().trim().length !== 0&&
|
|
|
|
|
+ rObj.gljType.toString().trim().length !== 0){
|
|
|
if(rObj.gljType !== me.currentEditingGlj.gljType){//修改了工料机类型
|
|
if(rObj.gljType !== me.currentEditingGlj.gljType){//修改了工料机类型
|
|
|
- if(me.currentGlj){
|
|
|
|
|
- me.currentGlj.component = [];
|
|
|
|
|
|
|
+ if(me.currentGlj){
|
|
|
|
|
+ me.currentGlj.component = [];
|
|
|
|
|
+ }
|
|
|
|
|
+ //工料机类型不为普通材料时,情况费率数据
|
|
|
|
|
+ if (me.currentEditingGlj.gljType === 201 && rObj.gljType !== 201) {
|
|
|
|
|
+ for (let feeCode of me.feeDataCode) {
|
|
|
|
|
+ if (me.currentEditingGlj[feeCode]) {
|
|
|
|
|
+ rObj[feeCode] = null;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- /* if(me.allowComponent.indexOf(rObj.gljType) !== -1){
|
|
|
|
|
- rObj.basePrice = 0;
|
|
|
|
|
- }*/
|
|
|
|
|
- //工料机类型不为机械台班时,清空机型
|
|
|
|
|
- if(me.currentEditingGlj.gljType === 301 && rObj.gljType !== 301 && me.currentEditingGlj.model){
|
|
|
|
|
- rObj.model = null;
|
|
|
|
|
}
|
|
}
|
|
|
if(componentType.includes(me.currentEditingGlj.gljType) &&
|
|
if(componentType.includes(me.currentEditingGlj.gljType) &&
|
|
|
!(machineComponent.includes(me.currentEditingGlj.gljType) && machineComponent.includes(rObj.gljType))
|
|
!(machineComponent.includes(me.currentEditingGlj.gljType) && machineComponent.includes(rObj.gljType))
|
|
@@ -570,8 +551,13 @@ let repositoryGljObj = {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
sheetOpr.cleanData(that.workBook.getSheet(0), that.setting, 5);
|
|
sheetOpr.cleanData(that.workBook.getSheet(0), that.setting, 5);
|
|
|
- }
|
|
|
|
|
- else if(rObj.basePrice !== me.currentEditingGlj.basePrice){//修改了单价,可修改单价的必为可成为组成物的
|
|
|
|
|
|
|
+ } else if (me.feeDataCode.includes(dataCode) && rObj[dataCode] !== me.currentEditingGlj[dataCode]) {
|
|
|
|
|
+ if(isNaN(rObj[dataCode])){
|
|
|
|
|
+ args.sheet.setValue(args.row, args.col, me.currentEditingGlj[dataCode] ? me.currentEditingGlj[dataCode] : '');
|
|
|
|
|
+ alert(`${me.setting.header[args.col].headerName}只能输入数值!`);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if(rObj.basePrice !== me.currentEditingGlj.basePrice){//修改了单价,可修改单价的必为可成为组成物的
|
|
|
//寻找所有引用了此组成物的工料机,并从组成物中删去此工料机,并重算单价
|
|
//寻找所有引用了此组成物的工料机,并从组成物中删去此工料机,并重算单价
|
|
|
if(isNaN(parseFloat(rObj.basePrice))){
|
|
if(isNaN(parseFloat(rObj.basePrice))){
|
|
|
alert('单价只能为数值!');
|
|
alert('单价只能为数值!');
|
|
@@ -588,22 +574,20 @@ let repositoryGljObj = {
|
|
|
updateArr.push(updateGljs.updateBasePrcArr[i]);
|
|
updateArr.push(updateGljs.updateBasePrcArr[i]);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- //rObj.basePrice = !isNaN(parseFloat(rObj.basePrice)) && (rObj.basePrice && typeof rObj.basePrice !== 'undefined') ? that.round(parseFloat(rObj.basePrice), 2) : 0;
|
|
|
|
|
}
|
|
}
|
|
|
rObj.component = me.currentGlj.component;
|
|
rObj.component = me.currentGlj.component;
|
|
|
updateArr.push(rObj);
|
|
updateArr.push(rObj);
|
|
|
}
|
|
}
|
|
|
else{
|
|
else{
|
|
|
- if(me.setting.header[args.col].dataCode === 'gljType'){
|
|
|
|
|
- let distTypeVal = me.distTypeTree.distTypes[me.distTypeTree.prefix + me.currentEditingGlj[me.setting.header[args.col].dataCode]].data.fullName;
|
|
|
|
|
|
|
+ if(dataCode === 'gljType'){
|
|
|
|
|
+ let distTypeVal = me.distTypeTree.distTypes[me.distTypeTree.prefix + me.currentEditingGlj[dataCode]].data.fullName;
|
|
|
args.sheet.setValue(args.row, args.col, distTypeVal);
|
|
args.sheet.setValue(args.row, args.col, distTypeVal);
|
|
|
}
|
|
}
|
|
|
else{
|
|
else{
|
|
|
- args.sheet.setValue(args.row, args.col, me.currentEditingGlj[me.setting.header[args.col].dataCode]);
|
|
|
|
|
|
|
+ args.sheet.setValue(args.row, args.col, me.currentEditingGlj[dataCode]);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- // }
|
|
|
|
|
//--------------------------------------
|
|
//--------------------------------------
|
|
|
if(me.currentEditingGlj.basePrice !== rObj.basePrice){
|
|
if(me.currentEditingGlj.basePrice !== rObj.basePrice){
|
|
|
//update basePrice of ration when editting basePrice of glj
|
|
//update basePrice of ration when editting basePrice of glj
|
|
@@ -634,16 +618,12 @@ let repositoryGljObj = {
|
|
|
if(typeof rObj.code !== 'undefined'){
|
|
if(typeof rObj.code !== 'undefined'){
|
|
|
me.addGljObj = rObj;
|
|
me.addGljObj = rObj;
|
|
|
let isCanSav = true;
|
|
let isCanSav = true;
|
|
|
- if(!rObj[me.setting.header[0].dataCode] || !rObj[me.setting.header[1].dataCode] || !rObj[me.setting.header[3].dataCode] || !rObj[me.setting.header[5].dataCode]){
|
|
|
|
|
|
|
+ if(!rObj.code || !rObj.name || !rObj.unit || !rObj.gljType){
|
|
|
isCanSav = false;
|
|
isCanSav = false;
|
|
|
}
|
|
}
|
|
|
if(isCanSav){
|
|
if(isCanSav){
|
|
|
me.addGljObj = null;
|
|
me.addGljObj = null;
|
|
|
rObj.component = [];
|
|
rObj.component = [];
|
|
|
- //如果类型为混凝土、砂浆、配合比、机械台班时,添加时填写的单价清空
|
|
|
|
|
- /* if(me.allowComponent.indexOf(rObj.gljType) !== -1){
|
|
|
|
|
- rObj.basePrice = 0;
|
|
|
|
|
- }*/
|
|
|
|
|
rObj.basePrice = !isNaN(parseFloat(rObj.basePrice)) && (rObj.basePrice && typeof rObj.basePrice !== 'undefined') ? parseFloat(rObj.basePrice) : 0;
|
|
rObj.basePrice = !isNaN(parseFloat(rObj.basePrice)) && (rObj.basePrice && typeof rObj.basePrice !== 'undefined') ? parseFloat(rObj.basePrice) : 0;
|
|
|
addArr.push(rObj);
|
|
addArr.push(rObj);
|
|
|
}
|
|
}
|
|
@@ -659,10 +639,7 @@ let repositoryGljObj = {
|
|
|
},
|
|
},
|
|
|
delGljs: function (sels) {
|
|
delGljs: function (sels) {
|
|
|
let me = repositoryGljObj;
|
|
let me = repositoryGljObj;
|
|
|
- let sheet = me.workBook.getSheet(0),
|
|
|
|
|
- updateArr = [], removeArr = [],
|
|
|
|
|
- tempRemoveArr= [],
|
|
|
|
|
- refGljCodes = [], //已被引用的工料机
|
|
|
|
|
|
|
+ let updateArr = [], removeArr = [],
|
|
|
updateBasePrcArr = [],//删除基价单位后重新计算
|
|
updateBasePrcArr = [],//删除基价单位后重新计算
|
|
|
canUpdate = false,
|
|
canUpdate = false,
|
|
|
cacheSection = me.currentCache;
|
|
cacheSection = me.currentCache;
|
|
@@ -682,7 +659,6 @@ let repositoryGljObj = {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
removeArr.push(cacheSection[sels[i].row + j].ID);
|
|
removeArr.push(cacheSection[sels[i].row + j].ID);
|
|
|
- //tempRemoveArr.push({ID: cacheSection[sels[i].row + j].ID, code: cacheSection[sels[i].row + j].code});
|
|
|
|
|
//删除后重新计算引用了此工料机的定额单价
|
|
//删除后重新计算引用了此工料机的定额单价
|
|
|
updateBasePrcArr.push({gljId: cacheSection[sels[i].row + j].ID, gljType: cacheSection[sels[i].row + j].gljType, basePrice: 0, delete: 1});
|
|
updateBasePrcArr.push({gljId: cacheSection[sels[i].row + j].ID, gljType: cacheSection[sels[i].row + j].gljType, basePrice: 0, delete: 1});
|
|
|
}
|
|
}
|
|
@@ -807,7 +783,6 @@ let repositoryGljObj = {
|
|
|
validUpdateObj: function (pasteObj, rowIdx) {
|
|
validUpdateObj: function (pasteObj, rowIdx) {
|
|
|
let rst = {updateGlj: [], updateBasePrcArr: []}, backUpObj = {},
|
|
let rst = {updateGlj: [], updateBasePrcArr: []}, backUpObj = {},
|
|
|
me = repositoryGljObj,
|
|
me = repositoryGljObj,
|
|
|
- that = gljComponentOprObj,
|
|
|
|
|
tempObj = me.currentCache[rowIdx],
|
|
tempObj = me.currentCache[rowIdx],
|
|
|
reCalBasePrc = false,
|
|
reCalBasePrc = false,
|
|
|
isValid = true;
|
|
isValid = true;
|
|
@@ -856,8 +831,10 @@ let repositoryGljObj = {
|
|
|
pasteObj.gljType = me.distTypeTree.comboDatas[i].value;
|
|
pasteObj.gljType = me.distTypeTree.comboDatas[i].value;
|
|
|
isExsit = true;
|
|
isExsit = true;
|
|
|
reCalBasePrc = true;
|
|
reCalBasePrc = true;
|
|
|
- if(pasteObj.gljType !== 301 && tempObj.gljType === 301){
|
|
|
|
|
- tempObj.model = null;
|
|
|
|
|
|
|
+ if (pasteObj.gljType !== 201 && tempObj.gljType === 201) {
|
|
|
|
|
+ for (let feeCode of me.feeDataCode) {
|
|
|
|
|
+ tempObj[feeCode] = null;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
if(componentType.includes(tempObj.gljType)&&
|
|
if(componentType.includes(tempObj.gljType)&&
|
|
|
!(machineComponent.includes(tempObj.gljType) && machineComponent.includes(pasteObj.gljType)) &&
|
|
!(machineComponent.includes(tempObj.gljType) && machineComponent.includes(pasteObj.gljType)) &&
|
|
@@ -874,9 +851,6 @@ let repositoryGljObj = {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
tempObj.component = tempObj.gljType === me.distTypeTree.comboDatas[i].value ? tempObj.component : [];
|
|
tempObj.component = tempObj.gljType === me.distTypeTree.comboDatas[i].value ? tempObj.component : [];
|
|
|
- /*if(me.allowComponent.indexOf(tempObj.gljType) !== -1){
|
|
|
|
|
- tempObj.basePrice = tempObj.gljType === me.distTypeTree.comboDatas[i].value ? tempObj.basePrice : 0;
|
|
|
|
|
- }*/
|
|
|
|
|
tempObj.gljType = me.distTypeTree.comboDatas[i].value;
|
|
tempObj.gljType = me.distTypeTree.comboDatas[i].value;
|
|
|
tempObj.shortName = me.distTypeTree.distTypes[me.distTypeTree.prefix + tempObj.gljType].data.shortName;
|
|
tempObj.shortName = me.distTypeTree.distTypes[me.distTypeTree.prefix + tempObj.gljType].data.shortName;
|
|
|
break;
|
|
break;
|
|
@@ -884,6 +858,16 @@ let repositoryGljObj = {
|
|
|
}
|
|
}
|
|
|
if(!isExsit) isValid = false;
|
|
if(!isExsit) isValid = false;
|
|
|
}
|
|
}
|
|
|
|
|
+ for (let feeCode of me.feeDataCode) {
|
|
|
|
|
+ if (typeof pasteObj[feeCode] !== 'undefined' && !isNaN(pasteObj[feeCode])) {
|
|
|
|
|
+ if ((typeof pasteObj.gljType !== 'undefined' && pasteObj.gljType === 201) ||
|
|
|
|
|
+ (tempObj.gljType && tempObj.gljType === 201)) {
|
|
|
|
|
+ tempObj[feeCode] = pasteObj[feeCode];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ isValid = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
//
|
|
//
|
|
|
pasteObj.basePrice = !isNaN(parseFloat(pasteObj.basePrice)) && (pasteObj.basePrice && typeof pasteObj.basePrice !== 'undefined') ? scMathUtil.roundTo(parseFloat(pasteObj.basePrice), 2) :
|
|
pasteObj.basePrice = !isNaN(parseFloat(pasteObj.basePrice)) && (pasteObj.basePrice && typeof pasteObj.basePrice !== 'undefined') ? scMathUtil.roundTo(parseFloat(pasteObj.basePrice), 2) :
|
|
|
me.currentCache[rowIdx].basePrice;
|
|
me.currentCache[rowIdx].basePrice;
|
|
@@ -900,34 +884,10 @@ let repositoryGljObj = {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if(typeof pasteObj.model !== 'undefined'){
|
|
|
|
|
- if(!me.machineModel.textArr.includes(pasteObj.model)){
|
|
|
|
|
- isValid = false;
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- let existsModel = false;
|
|
|
|
|
- if((typeof pasteObj.gljType !== 'undefined' && pasteObj.gljType === 301) ||
|
|
|
|
|
- (tempObj.gljType && tempObj.gljType === 301)){
|
|
|
|
|
- me.machineModel.comboItems.forEach(function (item) {
|
|
|
|
|
- if(item.text === pasteObj.model){
|
|
|
|
|
- tempObj.model = item.value;
|
|
|
|
|
- existsModel = true;
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- if(!existsModel){
|
|
|
|
|
- isValid = false;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- isValid = false;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
if(isValid){
|
|
if(isValid){
|
|
|
rst.updateGlj.push(tempObj);
|
|
rst.updateGlj.push(tempObj);
|
|
|
if(reCalBasePrc){
|
|
if(reCalBasePrc){
|
|
|
//重新计算定额基价对象
|
|
//重新计算定额基价对象
|
|
|
- //rst.updateBasePrc = {gljId: tempObj.ID, gljType: tempObj.gljType, basePrice: tempObj.basePrice};
|
|
|
|
|
let newReObj = {gljId: tempObj.ID, gljType: tempObj.gljType, basePrice: tempObj.basePrice};
|
|
let newReObj = {gljId: tempObj.ID, gljType: tempObj.gljType, basePrice: tempObj.basePrice};
|
|
|
rst.updateBasePrcArr.push(newReObj);
|
|
rst.updateBasePrcArr.push(newReObj);
|
|
|
}
|
|
}
|
|
@@ -973,15 +933,10 @@ let repositoryGljObj = {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
- if(typeof pasteObj.model !== 'undefined' && pasteObj.model){
|
|
|
|
|
- if(!me.machineModel.textArr.includes(pasteObj.model) || pasteObj.gljType !== 301){
|
|
|
|
|
|
|
+ for (let feeCode of me.feeDataCode) {
|
|
|
|
|
+ if (typeof pasteObj[feeCode] !== 'undefined' && (isNaN(pasteObj[feeCode]) || pasteObj.gljType !== 201)) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
- me.machineModel.comboItems.forEach(function (item) {
|
|
|
|
|
- if(item.text === pasteObj.model){
|
|
|
|
|
- pasteObj.model = item.value;
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
}
|
|
}
|
|
|
pasteObj.basePrice = !isNaN(parseFloat(pasteObj.basePrice)) && (pasteObj.basePrice && typeof pasteObj.basePrice !== 'undefined') ? parseFloat(pasteObj.basePrice) : 0;
|
|
pasteObj.basePrice = !isNaN(parseFloat(pasteObj.basePrice)) && (pasteObj.basePrice && typeof pasteObj.basePrice !== 'undefined') ? parseFloat(pasteObj.basePrice) : 0;
|
|
|
if(!me.parentNodeIds["_pNodeId_" + me.gljCurTypeId]){
|
|
if(!me.parentNodeIds["_pNodeId_" + me.gljCurTypeId]){
|
|
@@ -1002,6 +957,7 @@ let repositoryGljObj = {
|
|
|
if(info.cellRange.col === 0){
|
|
if(info.cellRange.col === 0){
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
+ //可添加组成物的人材机基价由组成物基价计算得来,基价列只读
|
|
|
else if(info.cellRange.col <= 4 && info.cellRange.col + info.cellRange.colCount - 1 >= 4){
|
|
else if(info.cellRange.col <= 4 && info.cellRange.col + info.cellRange.colCount - 1 >= 4){
|
|
|
for(let i = 0, len = info.cellRange.rowCount; i < len; i++){
|
|
for(let i = 0, len = info.cellRange.rowCount; i < len; i++){
|
|
|
let row = i + info.cellRange.row;
|
|
let row = i + info.cellRange.row;
|
|
@@ -1020,13 +976,11 @@ let repositoryGljObj = {
|
|
|
},
|
|
},
|
|
|
onClipboardPasting: function(sender, args) {
|
|
onClipboardPasting: function(sender, args) {
|
|
|
let me = repositoryGljObj;
|
|
let me = repositoryGljObj;
|
|
|
- let maxCol = args.cellRange.col + args.cellRange.colCount - 1;
|
|
|
|
|
if (!me.canPasted(args)) {
|
|
if (!me.canPasted(args)) {
|
|
|
args.cancel = true;
|
|
args.cancel = true;
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
onClipboardPasted: function(e, info) {
|
|
onClipboardPasted: function(e, info) {
|
|
|
- // if(info.pasteData.text.trim().length > 0){
|
|
|
|
|
let me = repositoryGljObj;
|
|
let me = repositoryGljObj;
|
|
|
let updateArr = [], addArr = [];
|
|
let updateArr = [], addArr = [];
|
|
|
let items = sheetOpr.analyzePasteData(me.setting, info);
|
|
let items = sheetOpr.analyzePasteData(me.setting, info);
|
|
@@ -1034,20 +988,17 @@ let repositoryGljObj = {
|
|
|
maxRow = me.currentCache.length - 1,//当前数据最大行数
|
|
maxRow = me.currentCache.length - 1,//当前数据最大行数
|
|
|
updateBasePrcArr = [] ,
|
|
updateBasePrcArr = [] ,
|
|
|
updateCount, resumeArr = [];
|
|
updateCount, resumeArr = [];
|
|
|
- if(endRow <= maxRow){
|
|
|
|
|
- //updateItems = items;
|
|
|
|
|
|
|
+ if(endRow <= maxRow){//只有更新
|
|
|
for(let i = 0; i < items.length; i++){
|
|
for(let i = 0; i < items.length; i++){
|
|
|
let updateObj = me.validUpdateObj(items[i], info.cellRange.row + i);
|
|
let updateObj = me.validUpdateObj(items[i], info.cellRange.row + i);
|
|
|
if(updateObj && typeof updateObj.updateGlj !== 'undefined' && updateObj.updateGlj.length > 0){
|
|
if(updateObj && typeof updateObj.updateGlj !== 'undefined' && updateObj.updateGlj.length > 0){
|
|
|
- //updateArr = updateObj.updateGlj;
|
|
|
|
|
updateArr = updateArr.concat(updateObj.updateGlj);
|
|
updateArr = updateArr.concat(updateObj.updateGlj);
|
|
|
if(typeof updateObj.updateBasePrcArr !== 'undefined'){
|
|
if(typeof updateObj.updateBasePrcArr !== 'undefined'){
|
|
|
updateBasePrcArr = updateBasePrcArr.concat(updateObj.updateBasePrcArr);
|
|
updateBasePrcArr = updateBasePrcArr.concat(updateObj.updateBasePrcArr);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- else if(beginRow <= maxRow && endRow > maxRow){
|
|
|
|
|
|
|
+ } else if(beginRow <= maxRow && endRow > maxRow){//更新+新增
|
|
|
updateCount = maxRow - beginRow + 1;
|
|
updateCount = maxRow - beginRow + 1;
|
|
|
for(let i = 0; i < updateCount; i++){
|
|
for(let i = 0; i < updateCount; i++){
|
|
|
let updateObj = me.validUpdateObj(items[i], info.cellRange.row + i);
|
|
let updateObj = me.validUpdateObj(items[i], info.cellRange.row + i);
|
|
@@ -1059,29 +1010,17 @@ let repositoryGljObj = {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if(info.cellRange.colCount === me.setting.header.length -1){
|
|
|
|
|
- for(let i = updateCount ; i < items.length; i++){
|
|
|
|
|
- if(me.isValidObj(items[i])){
|
|
|
|
|
- items[i].component = [];
|
|
|
|
|
- //类型为混凝土、砂浆、配合比、机械时,基价只能组成物计算
|
|
|
|
|
- /* if(me.allowComponent.indexOf(items[i].gljType) !== -1){
|
|
|
|
|
- items[i].basePrice = 0;
|
|
|
|
|
- }*/
|
|
|
|
|
- addArr.push(items[i]);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ for(let i = updateCount ; i < items.length; i++){
|
|
|
|
|
+ if(me.isValidObj(items[i])){
|
|
|
|
|
+ items[i].component = [];
|
|
|
|
|
+ addArr.push(items[i]);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- else{
|
|
|
|
|
- if(info.cellRange.colCount === me.setting.header.length -1){
|
|
|
|
|
- for(let i = 0; i < items.length; i++){
|
|
|
|
|
- if(me.isValidObj(items[i])){
|
|
|
|
|
- items[i].component = [];
|
|
|
|
|
- /*if(me.allowComponent.indexOf(items[i].gljType) !== -1){
|
|
|
|
|
- items[i].basePrice = 0;
|
|
|
|
|
- }*/
|
|
|
|
|
- addArr.push(items[i]);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ } else{//新增
|
|
|
|
|
+ for(let i = 0; i < items.length; i++){
|
|
|
|
|
+ if(me.isValidObj(items[i])){
|
|
|
|
|
+ items[i].component = [];
|
|
|
|
|
+ addArr.push(items[i]);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1095,15 +1034,13 @@ let repositoryGljObj = {
|
|
|
for(let i = 0; i < resumeArr.length ; i++){
|
|
for(let i = 0; i < resumeArr.length ; i++){
|
|
|
if(resumeArr[i] < me.currentCache.length){
|
|
if(resumeArr[i] < me.currentCache.length){
|
|
|
for(let col = 0; col < me.setting.header.length -1; col++){
|
|
for(let col = 0; col < me.setting.header.length -1; col++){
|
|
|
- if(me.setting.header[col].dataCode === 'gljType'){
|
|
|
|
|
- let gljType = me.currentCache[resumeArr[i]][me.setting.header[col].dataCode];
|
|
|
|
|
|
|
+ let dCode = me.setting.header[col].dataCode;
|
|
|
|
|
+ if(dCode === 'gljType'){
|
|
|
|
|
+ let gljType = me.currentCache[resumeArr[i]][dCode];
|
|
|
sheet.setValue(resumeArr[i], col, me.distTypeTree.distTypes["gljType" + gljType].data.fullName);
|
|
sheet.setValue(resumeArr[i], col, me.distTypeTree.distTypes["gljType" + gljType].data.fullName);
|
|
|
}
|
|
}
|
|
|
- else if(me.setting.header[col].dataCode === 'model'){
|
|
|
|
|
- sheet.setValue(resumeArr[i], col, me.currentCache[resumeArr[i]][me.setting.header[col].dataCode] ? me.machineModelIdx[me.currentCache[resumeArr[i]][me.setting.header[col].dataCode]]: '');
|
|
|
|
|
- }
|
|
|
|
|
else{
|
|
else{
|
|
|
- sheet.setValue(resumeArr[i], col, me.currentCache[resumeArr[i]][me.setting.header[col].dataCode]);
|
|
|
|
|
|
|
+ sheet.setValue(resumeArr[i], col, me.currentCache[resumeArr[i]][dCode]);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1121,7 +1058,6 @@ let repositoryGljObj = {
|
|
|
if(updateBasePrcArr.length > 0 && me.rationLibs.length > 0){
|
|
if(updateBasePrcArr.length > 0 && me.rationLibs.length > 0){
|
|
|
me.updateRationBasePrcRq(updateBasePrcArr);
|
|
me.updateRationBasePrcRq(updateBasePrcArr);
|
|
|
}
|
|
}
|
|
|
- // }
|
|
|
|
|
},
|
|
},
|
|
|
updateRationBasePrcRq: function (basePrcArr) {
|
|
updateRationBasePrcRq: function (basePrcArr) {
|
|
|
CommonAjax.post('/complementartGlj/api/updateRationBasePrc', {basePrcArr: basePrcArr}, function (rstData) {
|
|
CommonAjax.post('/complementartGlj/api/updateRationBasePrc', {basePrcArr: basePrcArr}, function (rstData) {
|
|
@@ -1163,10 +1099,11 @@ let repositoryGljObj = {
|
|
|
me.showGljItems(me.complementaryGljList, me.gljCurTypeId);
|
|
me.showGljItems(me.complementaryGljList, me.gljCurTypeId);
|
|
|
//getCurrentGlj
|
|
//getCurrentGlj
|
|
|
let row = me.workBook.getSheet(0).getSelections()[0].row;
|
|
let row = me.workBook.getSheet(0).getSelections()[0].row;
|
|
|
- me.currentGlj = row < me.currentCache.length ? me.currentCache[row] : null;
|
|
|
|
|
|
|
+ /* me.currentGlj = row < me.currentCache.length ? me.currentCache[row] : null;
|
|
|
me.currentComponent = me.currentGlj ? me.getCurrentComponent(me.currentGlj.component) : [];
|
|
me.currentComponent = me.currentGlj ? me.getCurrentComponent(me.currentGlj.component) : [];
|
|
|
sheetOpr.cleanData(gljComponentOprObj.workBook.getSheet(0), gljComponentOprObj.setting, -1);
|
|
sheetOpr.cleanData(gljComponentOprObj.workBook.getSheet(0), gljComponentOprObj.setting, -1);
|
|
|
- sheetOpr.showData(gljComponentOprObj.workBook.getSheet(0), gljComponentOprObj.setting, me.currentComponent);
|
|
|
|
|
|
|
+ sheetOpr.showData(gljComponentOprObj.workBook.getSheet(0), gljComponentOprObj.setting, me.currentComponent);*/
|
|
|
|
|
+ me.initSel(row);
|
|
|
}
|
|
}
|
|
|
let errCaller = function (err) {
|
|
let errCaller = function (err) {
|
|
|
alert('保存失败');
|
|
alert('保存失败');
|