|
@@ -35,11 +35,10 @@ let repositoryGljObj = {
|
|
|
gljList: [],
|
|
|
stdGljList:[],
|
|
|
complementaryGljList: [],
|
|
|
- allowComponent: [202, 203, 204, 301, 4],//可带组成物类型:混凝土、砂浆、配合比、机械台班、主材
|
|
|
- componentGljType: [201, 302, 303, 4],//可成为组成物的工料机类型: 普通材料、 机械组成物、 机上人工、主材
|
|
|
+ machineModel: {textArr: ['特', '大', '中', '小'], comboItems: [{text: '特', value: 1}, {text: '大', value: 2},{text: '中', value: 3}, {text: '小', value: 4}]},
|
|
|
+ machineModelIdx: {'1': '特', '2': '大', '3': '中', '4': '小'},
|
|
|
distTypeTree: null,//add
|
|
|
setting: {
|
|
|
-
|
|
|
header:[
|
|
|
{headerName:"编码",headerWidth:80,dataCode:"code", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"},
|
|
|
{headerName:"名称",headerWidth:160,dataCode:"name", dataType: "String", hAlign: "left", vAlign: "center"},
|
|
@@ -47,6 +46,7 @@ let repositoryGljObj = {
|
|
|
{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:90,dataCode:"gljType", dataType: "String", hAlign: "center", vAlign: "center"},
|
|
|
+ {headerName:"机型",headerWidth:60,dataCode:"model", dataType: "Number", hAlign: "center", vAlign: "center"},
|
|
|
{headerName:"是否新增",headerWidth:60,dataCode:"isComplementary", hAlign: "center", vAlign: "center"}
|
|
|
],
|
|
|
view:{
|
|
@@ -86,16 +86,20 @@ let repositoryGljObj = {
|
|
|
data: typeData,
|
|
|
children: [],
|
|
|
parent: null
|
|
|
+ };
|
|
|
+ if(allowGljType.includes(typeData.ID)){
|
|
|
+ distTypeTree.distTypes[distTypeTree.prefix + typeData.ID] = typeObj;
|
|
|
+ distTypeTree.distTypesArr.push(typeObj);
|
|
|
}
|
|
|
- distTypeTree.distTypes[distTypeTree.prefix + typeData.ID] = typeObj;
|
|
|
- distTypeTree.distTypesArr.push(typeObj);
|
|
|
});
|
|
|
gljDistType.forEach(function (typeData) {
|
|
|
- distType = distTypeTree.distTypes[distTypeTree.prefix + typeData.ID];
|
|
|
- let parent = distTypeTree.distTypes[distTypeTree.prefix + typeData.ParentID];
|
|
|
- if(parent){
|
|
|
- distType.parent = parent;
|
|
|
- parent.children.push(distType);
|
|
|
+ if(allowGljType.includes(typeData.ID)){
|
|
|
+ distType = distTypeTree.distTypes[distTypeTree.prefix + typeData.ID];
|
|
|
+ let parent = distTypeTree.distTypes[distTypeTree.prefix + typeData.ParentID];
|
|
|
+ if(parent){
|
|
|
+ distType.parent = parent;
|
|
|
+ parent.children.push(distType);
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
distTypeTree.distTypesArr.forEach(function (distTypeObj) {
|
|
@@ -164,8 +168,10 @@ let repositoryGljObj = {
|
|
|
}
|
|
|
}
|
|
|
sheetOpr.cleanData(me.workBook.getSheet(0), me.setting, -1);
|
|
|
- sheetOpr.showData(me.workBook.getSheet(0), me.setting, cacheSection, me.distTypeTree);
|
|
|
+ sheetOpr.showData(me.workBook.getSheet(0), me.setting, cacheSection, me.distTypeTree, me.machineModelIdx);
|
|
|
sheetCommonObj.setDynamicCombo(me.workBook.getActiveSheet(), 0, 5, me.workBook.getActiveSheet().getRowCount(), me.distTypeTree.comboDatas, false, 'text');
|
|
|
+ sheetCommonObj.setDynamicCombo(me.workBook.getActiveSheet(), 0, 6, me.workBook.getActiveSheet().getRowCount(), me.machineModel.comboItems, false, 'text');
|
|
|
+
|
|
|
|
|
|
cacheSection = null;
|
|
|
}
|
|
@@ -334,7 +340,7 @@ let repositoryGljObj = {
|
|
|
if(row < me.currentCache.length){
|
|
|
//标记当前工料机
|
|
|
me.currentGlj = me.currentCache[row];
|
|
|
- if(me.allowComponent.indexOf(me.currentCache[row].gljType) !== -1){
|
|
|
+ if(allowComponent.includes(me.currentCache[row].gljType)){
|
|
|
//展示数据
|
|
|
if(me.currentGlj.component.length > 0){
|
|
|
me.currentComponent = me.getCurrentComponent(me.currentGlj.component);
|
|
@@ -430,8 +436,8 @@ let repositoryGljObj = {
|
|
|
me.orgCode = me.workBook.getSheet(0).getValue(args.row, 0);
|
|
|
if(args.row < me.currentCache.length){
|
|
|
me.currentGlj = me.currentCache[args.row];
|
|
|
- if(args.col === 0 || (args.col === 4 && me.allowComponent.indexOf(me.currentGlj.gljType) !== -1 && me.currentGlj.component.length > 0)
|
|
|
- || args.col === 6){
|
|
|
+ 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){
|
|
|
args.cancel = true;
|
|
|
}
|
|
|
else {
|
|
@@ -467,19 +473,24 @@ let repositoryGljObj = {
|
|
|
/* if(me.allowComponent.indexOf(rObj.gljType) !== -1){
|
|
|
rObj.basePrice = 0;
|
|
|
}*/
|
|
|
- if(me.componentGljType.indexOf(me.currentEditingGlj.gljType) !== -1 &&
|
|
|
- !(me.currentEditingGlj.gljType === 302 && rObj.gljType === 303) && !(me.currentEditingGlj.gljType === 303 && rObj.gljType === 302)){//修改了原本是组成物的工料机
|
|
|
- //寻找所有引用了此组成物的工料机,并从组成物中删去此工料机,并重算单价
|
|
|
- let updateGljs = me.getUpdateGljs(rObj, true);
|
|
|
- if(updateGljs.updateArr.length > 0 || updateGljs.updateBasePrcArr.length > 0){
|
|
|
- for(let i = 0; i < updateGljs.updateArr.length; i++){
|
|
|
- updateArr.push(updateGljs.updateArr[i]);
|
|
|
- }
|
|
|
- for(let i = 0; i < updateGljs.updateBasePrcArr.length; i++){
|
|
|
- updateArr.push(updateGljs.updateBasePrcArr[i]);
|
|
|
- }
|
|
|
+ //工料机类型不为机械台班时,清空机型
|
|
|
+ if(me.currentEditingGlj.gljType === 301 && rObj.gljType !== 301 && me.currentEditingGlj.model){
|
|
|
+ rObj.model = null;
|
|
|
+ }
|
|
|
+ if(componentType.includes(me.currentEditingGlj.gljType) &&
|
|
|
+ !(machineComponent.includes(me.currentEditingGlj.gljType) && machineComponent.includes(rObj.gljType))
|
|
|
+ && !(materialComponent.includes(me.currentEditingGlj.gljType) && materialComponent.includes(rObj.gljType))){//修改了原本是组成物的工料机
|
|
|
+ //寻找所有引用了此组成物的工料机,并从组成物中删去此工料机,并重算单价
|
|
|
+ let updateGljs = me.getUpdateGljs(rObj, true);
|
|
|
+ if(updateGljs.updateArr.length > 0 || updateGljs.updateBasePrcArr.length > 0){
|
|
|
+ for(let i = 0; i < updateGljs.updateArr.length; i++){
|
|
|
+ updateArr.push(updateGljs.updateArr[i]);
|
|
|
+ }
|
|
|
+ for(let i = 0; i < updateGljs.updateBasePrcArr.length; i++){
|
|
|
+ updateArr.push(updateGljs.updateBasePrcArr[i]);
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
sheetOpr.cleanData(that.workBook.getSheet(0), that.setting, 5);
|
|
|
}
|
|
|
else if(rObj.basePrice !== me.currentEditingGlj.basePrice){//修改了单价,可修改单价的必为可成为组成物的
|
|
@@ -610,7 +621,7 @@ let repositoryGljObj = {
|
|
|
for(let col = sels[i].col; col <= maxCol; col++){
|
|
|
if(me.setting.header[col].dataCode === 'basePrice'){
|
|
|
//如果类型不为混凝土、砂浆、配合比、机械,才可删除单价 basePrice = 0
|
|
|
- if(me.allowComponent.indexOf(updateObj.gljType) === -1){
|
|
|
+ if(!allowComponent.includes(updateObj.gljType)){
|
|
|
canUpdate = true;
|
|
|
updateObj[me.setting.header[col].dataCode] = 0;
|
|
|
updateBasePrcArr.push({gljId: updateObj.ID, gljType: updateObj.gljType, basePrice: 0});
|
|
@@ -717,9 +728,12 @@ let repositoryGljObj = {
|
|
|
pasteObj.gljType = me.distTypeTree.comboDatas[i].value;
|
|
|
isExsit = true;
|
|
|
reCalBasePrc = true;
|
|
|
- //
|
|
|
- if(me.componentGljType.indexOf(tempObj.gljType) !== -1 &&
|
|
|
- !(tempObj.gljType === 302 && pasteObj.gljType === 303) && !(tempObj.gljType === 303 && pasteObj.gljType === 302)){//修改了原本是组成物的工料机
|
|
|
+ if(pasteObj.gljType !== 301 && tempObj.gljType === 301){
|
|
|
+ tempObj.model = null;
|
|
|
+ }
|
|
|
+ if(componentType.includes(tempObj.gljType)&&
|
|
|
+ !(machineComponent.includes(tempObj.gljType) && machineComponent.includes(pasteObj.gljType)) &&
|
|
|
+ !(materialComponent.includes(tempObj.gljType) && materialComponent.includes(pasteObj.gljType))){//修改了原本是组成物的工料机
|
|
|
//寻找所有引用了此组成物的工料机,并从组成物中删去此工料机,并重算单价
|
|
|
let updateGljs = me.getUpdateGljs(tempObj, true);
|
|
|
if(updateGljs.updateArr.length > 0 || updateGljs.updateBasePrcArr.length > 0){
|
|
@@ -758,6 +772,29 @@ 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){
|
|
|
rst.updateGlj.push(tempObj);
|
|
|
if(reCalBasePrc){
|
|
@@ -808,6 +845,16 @@ let repositoryGljObj = {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ if(typeof pasteObj.model !== 'undefined' && pasteObj.model){
|
|
|
+ if(!me.machineModel.textArr.includes(pasteObj.model) || pasteObj.gljType !== 301){
|
|
|
+ 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;
|
|
|
if(!me.parentNodeIds["_pNodeId_" + me.gljCurTypeId]){
|
|
|
pasteObj.gljClass = me.gljCurTypeId;
|
|
@@ -831,7 +878,7 @@ let repositoryGljObj = {
|
|
|
for(let i = 0, len = info.cellRange.rowCount; i < len; i++){
|
|
|
let row = i + info.cellRange.row;
|
|
|
if(row < me.currentCache.length){
|
|
|
- if(me.allowComponent.indexOf(me.currentCache[row].gljType) !== -1){
|
|
|
+ if(allowComponent.includes(me.currentCache[row].gljType)){
|
|
|
rst = false;
|
|
|
}
|
|
|
}
|
|
@@ -924,6 +971,9 @@ let repositoryGljObj = {
|
|
|
let gljType = me.currentCache[resumeArr[i]][me.setting.header[col].dataCode];
|
|
|
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{
|
|
|
sheet.setValue(resumeArr[i], col, me.currentCache[resumeArr[i]][me.setting.header[col].dataCode]);
|
|
|
}
|