|
@@ -41,6 +41,7 @@ let repositoryGljObj = {
|
|
|
gljList: [],
|
|
|
allowComponent: [202, 203, 204, 301, 4],//可带组成物类型:混凝土、砂浆、配合比、机械台班
|
|
|
componentGljType: [201, 302, 303, 4],//可成为组成物的工料机类型: 普通材料、 机械组成物、 机上人工
|
|
|
+ materialType: ['钢材', '木材', '水泥', '钢筋', '标准砖'],//三材类别
|
|
|
distTypeTree: null,//add
|
|
|
setting: {
|
|
|
owner: "glj",
|
|
@@ -52,6 +53,8 @@ let repositoryGljObj = {
|
|
|
{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:"adjCoe", dataType: "Number", hAlign: "center", vAlign: "center"},
|
|
|
+ {headerName:"三材类别",headerWidth:90,dataCode:"materialType", dataType: "String", hAlign: "center", vAlign: "center"},
|
|
|
+ {headerName:"三材系数",headerWidth:60,dataCode:"materialCoe", dataType: "Number", hAlign: "center", vAlign: "center"},
|
|
|
],
|
|
|
view:{
|
|
|
comboBox:[
|
|
@@ -189,6 +192,7 @@ let repositoryGljObj = {
|
|
|
sheetCommonObj.cleanData(me.workBook.getSheet(0), me.setting, -1);
|
|
|
sheetsOprObj.showData(me.workBook.getSheet(0), me.setting, cacheSection, me.distTypeTree);
|
|
|
sheetCommonObj.setDynamicCombo(me.workBook.getActiveSheet(), 0, 5, me.workBook.getActiveSheet().getRowCount(), me.distTypeTree.comboDatas, false, 'text');
|
|
|
+ sheetCommonObj.setDynamicCombo(me.workBook.getActiveSheet(), 0, 7, me.workBook.getActiveSheet().getRowCount(), me.materialType, false, 'text');
|
|
|
cacheSection = null;
|
|
|
}
|
|
|
},
|
|
@@ -330,7 +334,10 @@ let repositoryGljObj = {
|
|
|
},
|
|
|
onEnterCell: function (sender, args) {
|
|
|
let me = repositoryGljObj;
|
|
|
- if(me.setting.header[args.col].dataCode === 'gljType' || me.setting.header[me.lastCol].dataCode === 'gljType'){
|
|
|
+ let thisDataCode = me.setting.header[args.col].dataCode,
|
|
|
+ lastDataCode = me.setting.header[me.lastCol].dataCode;
|
|
|
+ if(thisDataCode === 'gljType' || lastDataCode === 'gljType'
|
|
|
+ || thisDataCode === 'materialType' || lastDataCode === 'materialType'){
|
|
|
args.sheet.repaint();
|
|
|
}
|
|
|
me.cellRowIdx = args.row;
|
|
@@ -400,10 +407,12 @@ let repositoryGljObj = {
|
|
|
me.currentEditingGlj = rObj;
|
|
|
me.orgCode = me.workBook.getSheet(0).getValue(args.row, 0);
|
|
|
if(args.row < me.currentCache.length){
|
|
|
+ let dataCode = me.setting.header[args.col].dataCode;
|
|
|
me.currentGlj = me.currentCache[args.row];
|
|
|
- if(args.col === 0 || (args.col === 4 && me.allowComponent.indexOf(me.currentGlj.gljType) !== -1
|
|
|
+ if(dataCode === 'code' || (dataCode === 'basePrice' && me.allowComponent.indexOf(me.currentGlj.gljType) !== -1
|
|
|
&& me.currentGlj.component.length > 0)
|
|
|
- || (args.col === 6 && me.currentGlj.gljType !== 1 && me.currentGlj.gljType !== 303)){
|
|
|
+ || (dataCode === 'adjCoe' && me.currentGlj.gljType !== 1 && me.currentGlj.gljType !== 303)
|
|
|
+ || (dataCode === 'materialCoe' && !me.currentGlj.materialType)){
|
|
|
args.cancel = true;
|
|
|
}
|
|
|
else {
|
|
@@ -432,9 +441,9 @@ let repositoryGljObj = {
|
|
|
if(me.currentGlj){
|
|
|
me.currentGlj.component = [];
|
|
|
}
|
|
|
- if(me.allowComponent.indexOf(rObj.gljType) !== -1){
|
|
|
+ /*if(me.allowComponent.indexOf(rObj.gljType) !== -1){//更改成可添加组成物的类型,则将定额价设成零
|
|
|
rObj.basePrice = 0;
|
|
|
- }
|
|
|
+ }*/
|
|
|
//调整系数,工料机类型为人工和机上人工时,可输入整数
|
|
|
if((me.currentEditingGlj.gljType === 1 || me.currentEditingGlj.gljType === 303) && !(rObj.gljType === 1 || rObj.gljType === 303)){
|
|
|
rObj.adjCoe = null;
|
|
@@ -462,6 +471,14 @@ let repositoryGljObj = {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ else if(rObj.materialCoe !== me.currentEditingGlj.materialCoe){
|
|
|
+ if(isNaN(rObj.materialCoe)){
|
|
|
+ args.sheet.setValue(args.row, args.col, me.currentEditingGlj.materialCoe ? me.currentEditingGlj.materialCoe : '');
|
|
|
+ alert('三材系数只能输入数值!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ rObj.materialCoe = scMathUtil.roundTo(parseFloat(rObj.materialCoe), -5);
|
|
|
+ }
|
|
|
else if(rObj.basePrice !== me.currentEditingGlj.basePrice){//修改了单价,可修改单价的必为可成为组成物的
|
|
|
//寻找所有引用了此组成物的工料机,并从组成物中删去此工料机,并重算单价
|
|
|
if(isNaN(parseFloat(rObj.basePrice))){
|
|
@@ -535,9 +552,9 @@ let repositoryGljObj = {
|
|
|
me.addGljObj = null;
|
|
|
rObj.component = [];
|
|
|
//如果类型为混凝土、砂浆、配合比、机械台班时,添加时填写的单价清空
|
|
|
- if(me.allowComponent.indexOf(rObj.gljType) !== -1){
|
|
|
+ /*if(me.allowComponent.indexOf(rObj.gljType) !== -1){
|
|
|
rObj.basePrice = 0;
|
|
|
- }
|
|
|
+ }*/
|
|
|
rObj.basePrice = !isNaN(parseFloat(rObj.basePrice)) && (rObj.basePrice && typeof rObj.basePrice !== 'undefined') ? scMathUtil.roundTo(parseFloat(rObj.basePrice), -2) : 0;
|
|
|
addArr.push(rObj);
|
|
|
}
|
|
@@ -586,52 +603,47 @@ let repositoryGljObj = {
|
|
|
}
|
|
|
else{
|
|
|
let maxCol = sels[i].col + sels[i].colCount - 1;
|
|
|
- if(sels[i].col >= 2 && maxCol <= 4){
|
|
|
- for(let j = 0; j < sels[i].rowCount; j++){
|
|
|
- if(sels[i].row + j < cacheSection.length){
|
|
|
- let updateObj = cacheSection[sels[i].row + j];
|
|
|
- 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){
|
|
|
+ let cantNullDataCode = ['code', 'name', 'gljType'];
|
|
|
+ for(let j = 0; j < sels[i].rowCount; j++){
|
|
|
+ if(sels[i].row + j < cacheSection.length){
|
|
|
+ let updateObj = cacheSection[sels[i].row + j];
|
|
|
+ for(let col = sels[i].col; col <= maxCol; col++){
|
|
|
+ let dataCode = me.setting.header[col].dataCode;
|
|
|
+ if(cantNullDataCode.includes(dataCode)){
|
|
|
+ $('#alertText').text(me.setting.header[col].headerName + "不可为空!");
|
|
|
+ $('#codeAlert').modal('show');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if(dataCode === 'basePrice'){
|
|
|
+ //如果类型不为混凝土、砂浆、配合比、机械、主材且无组成物,才可删除单价 basePrice = 0
|
|
|
+ if(me.allowComponent.indexOf(updateObj.gljType) === -1 ||
|
|
|
+ (me.allowComponent.indexOf(updateObj.gljType) !== -1 && updateObj.component.length === 0)){
|
|
|
canUpdate = true;
|
|
|
- updateObj[me.setting.header[col].dataCode] = 0;
|
|
|
+ updateObj[dataCode] = 0;
|
|
|
updateBasePrcArr.push({gljId: updateObj.ID, gljType: updateObj.gljType, basePrice: 0});
|
|
|
}
|
|
|
}
|
|
|
else{
|
|
|
+ if(dataCode === 'materialType'){
|
|
|
+ updateObj['materialCoe'] = null;
|
|
|
+ }
|
|
|
canUpdate = true;
|
|
|
- updateObj[me.setting.header[col].dataCode] = '';
|
|
|
+ updateObj[dataCode] = '';
|
|
|
}
|
|
|
}
|
|
|
- if(canUpdate){
|
|
|
- updateArr.push(updateObj);
|
|
|
- }
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
- //编号、名称、类型不可为空
|
|
|
- else{
|
|
|
- if(sels[i].row < cacheSection.length){
|
|
|
- let text = '', cantNullStr =['编码', '名称', '类型'];
|
|
|
- for(let col = sels[i].col; col <= sels[i].col + sels[i].colCount -1; col++){
|
|
|
- if(cantNullStr.indexOf(me.setting.header[col].headerName) !== -1){
|
|
|
- text += me.setting.header[col].headerName + " ";
|
|
|
- }
|
|
|
+ if(canUpdate){
|
|
|
+ updateArr.push(updateObj);
|
|
|
}
|
|
|
- $('#alertText').text(text + "不可为空!");
|
|
|
- $('#codeAlertBtn').click();
|
|
|
- $('#codAleConfBtn').click(function () {
|
|
|
- });
|
|
|
- $('#codAleClose').click(function () {
|
|
|
- });
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if(removeArr.length > 0 || updateArr.length > 0){
|
|
|
//删除警告
|
|
|
- $('#alertGljTxt').text('可能已有定额引用了当前工料机,导致定额查找不到此工料机。确定要删除吗?');
|
|
|
+ let upAlertText = removeArr.length > 0 ? '可能已有定额引用了当前工料机,导致定额查找不到此工料机。确定要删除吗?' : '确认删除选中字段?';
|
|
|
+ $('#alertGljTxt').text(upAlertText);
|
|
|
$('#gljAlertBtn').click();
|
|
|
//确认
|
|
|
$('#aleConfBtn').click(function () {
|
|
@@ -712,9 +724,9 @@ let repositoryGljObj = {
|
|
|
}
|
|
|
}
|
|
|
tempObj.component = tempObj.gljType === me.distTypeTree.comboDatas[i].value ? tempObj.component : [];
|
|
|
- if(me.allowComponent.indexOf(tempObj.gljType) !== -1){
|
|
|
+ /*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.shortName = me.distTypeTree.distTypes[me.distTypeTree.prefix + tempObj.gljType].data.shortName;
|
|
|
break;
|
|
@@ -749,6 +761,22 @@ let repositoryGljObj = {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if(typeof pasteObj.materialType !== 'undefined'){
|
|
|
+ if(!me.materialType.includes(pasteObj.materialType)){
|
|
|
+ isValid = false;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ tempObj.materialType = pasteObj.materialType;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(typeof pasteObj.materialCoe !== 'undefined'){
|
|
|
+ if(isNaN(pasteObj.materialCoe) || (!tempObj.materialType && !pasteObj.materialType)){
|
|
|
+ isValid = false;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ tempObj.materialCoe = pasteObj.materialCoe !== '' ? scMathUtil.roundTo(parseFloat(pasteObj.materialCoe), -5) : null;
|
|
|
+ }
|
|
|
+ }
|
|
|
if(isValid){
|
|
|
rst.updateGlj.push(tempObj);
|
|
|
if(reCalBasePrc){
|
|
@@ -798,6 +826,16 @@ let repositoryGljObj = {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
+ if(pasteObj.materialType){
|
|
|
+ if(!me.materialType.includes(pasteObj.materialType)){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(pasteObj.materialCoe){
|
|
|
+ if(isNaN(pasteObj.materialCoe) || !pasteObj.materialType){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
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;
|
|
@@ -836,6 +874,10 @@ let repositoryGljObj = {
|
|
|
onClipboardPasting: function(sender, args) {
|
|
|
let me = repositoryGljObj;
|
|
|
//复制的列数超过正确的列数,不可复制
|
|
|
+ if(me.prevent){
|
|
|
+ args.cancel = true;
|
|
|
+ return;
|
|
|
+ }
|
|
|
if(!me.canPasted(args)){
|
|
|
args.cancel = true;
|
|
|
}
|
|
@@ -880,14 +922,14 @@ let repositoryGljObj = {
|
|
|
}
|
|
|
}
|
|
|
//if(info.cellRange.colCount === me.setting.header.length){
|
|
|
- if(info.cellRange.colCount >= me.setting.header.length - 1 && info.cellRange.colCount <= me.setting.header.length){
|
|
|
+ if(info.cellRange.colCount >= me.setting.header.length - 3 && info.cellRange.colCount <= me.setting.header.length){
|
|
|
for(let i = updateCount ; i < items.length; i++){
|
|
|
if(me.isValidObj(items[i])){
|
|
|
items[i].component = [];
|
|
|
//类型为混凝土、砂浆、配合比、机械时,基价只能组成物计算
|
|
|
- if(me.allowComponent.indexOf(items[i].gljType) !== -1){
|
|
|
+ /* if(me.allowComponent.indexOf(items[i].gljType) !== -1){
|
|
|
items[i].basePrice = 0;
|
|
|
- }
|
|
|
+ }*/
|
|
|
addArr.push(items[i]);
|
|
|
}
|
|
|
else{
|
|
@@ -903,13 +945,13 @@ let repositoryGljObj = {
|
|
|
}
|
|
|
else{
|
|
|
//if(info.cellRange.colCount === me.setting.header.length && info.cellRange.col + info.cellRange.colCount - 1 >= 5){
|
|
|
- if(info.cellRange.colCount >= me.setting.header.length - 1 && info.cellRange.colCount <= me.setting.header.length && info.cellRange.col + info.cellRange.colCount - 1 >= 5){
|
|
|
+ if(info.cellRange.colCount >= me.setting.header.length - 3 && info.cellRange.colCount <= me.setting.header.length && info.cellRange.col + info.cellRange.colCount - 1 >= 5){
|
|
|
for(let i = 0; i < items.length; i++){
|
|
|
if(me.isValidObj(items[i])){
|
|
|
items[i].component = [];
|
|
|
- if(me.allowComponent.indexOf(items[i].gljType) !== -1){
|
|
|
+ /* if(me.allowComponent.indexOf(items[i].gljType) !== -1){
|
|
|
items[i].basePrice = 0;
|
|
|
- }
|
|
|
+ }*/
|
|
|
addArr.push(items[i]);
|
|
|
}
|
|
|
else{
|
|
@@ -957,6 +999,7 @@ let repositoryGljObj = {
|
|
|
let me = this;
|
|
|
me.prevent = true;
|
|
|
$.bootstrapLoading.start();
|
|
|
+ //me.workBook.focus(false);
|
|
|
$.ajax({
|
|
|
type: 'post',
|
|
|
url: 'api/updateRationBasePrc',
|
|
@@ -968,6 +1011,7 @@ let repositoryGljObj = {
|
|
|
}
|
|
|
$.bootstrapLoading.end();
|
|
|
me.prevent = false;
|
|
|
+ //me.workBook.focus(true);
|
|
|
}
|
|
|
});
|
|
|
},
|