|
@@ -10,18 +10,17 @@ $("#fuzhu").click(function(){
|
|
$(this).attr('href', "/rationRepository/coeList" + "?repository=" + getQueryString("repository"))
|
|
$(this).attr('href', "/rationRepository/coeList" + "?repository=" + getQueryString("repository"))
|
|
});
|
|
});
|
|
|
|
|
|
-var rationOprObj = {
|
|
|
|
|
|
+let rationOprObj = {
|
|
workBook: null,
|
|
workBook: null,
|
|
currentRations: {},
|
|
currentRations: {},
|
|
currentEditingRation: null,
|
|
currentEditingRation: null,
|
|
currentSectionId: -1,
|
|
currentSectionId: -1,
|
|
- activeCell: null,
|
|
|
|
rationsCodes: [],
|
|
rationsCodes: [],
|
|
setting: {
|
|
setting: {
|
|
header:[
|
|
header:[
|
|
{headerName:"编码",headerWidth:120,dataCode:"code", dataType: "String", formatter: "@"},
|
|
{headerName:"编码",headerWidth:120,dataCode:"code", dataType: "String", formatter: "@"},
|
|
{headerName:"名称",headerWidth:280,dataCode:"name", dataType: "String"},
|
|
{headerName:"名称",headerWidth:280,dataCode:"name", dataType: "String"},
|
|
- {headerName:"单位",headerWidth:120,dataCode:"unit", dataType: "String", hAlign: "center"},
|
|
|
|
|
|
+ {headerName:"计量单位",headerWidth:120,dataCode:"unit", dataType: "String", hAlign: "center"},
|
|
{headerName:"人工费",headerWidth:120,dataCode:"labourPrice", dataType: "Number", formatter: "0.00", hAlign: "right"},
|
|
{headerName:"人工费",headerWidth:120,dataCode:"labourPrice", dataType: "Number", formatter: "0.00", hAlign: "right"},
|
|
{headerName:"材料费",headerWidth:120,dataCode:"materialPrice", dataType: "Number", formatter: "0.00", hAlign: "right"},
|
|
{headerName:"材料费",headerWidth:120,dataCode:"materialPrice", dataType: "Number", formatter: "0.00", hAlign: "right"},
|
|
{headerName:"机械费",headerWidth:120,dataCode:"machinePrice", dataType: "Number", formatter: "0.00", hAlign: "right"},
|
|
{headerName:"机械费",headerWidth:120,dataCode:"machinePrice", dataType: "Number", formatter: "0.00", hAlign: "right"},
|
|
@@ -43,7 +42,7 @@ var rationOprObj = {
|
|
},
|
|
},
|
|
buildSheet: function(container) {
|
|
buildSheet: function(container) {
|
|
let rationRepId = getQueryString("repository");
|
|
let rationRepId = getQueryString("repository");
|
|
- var me = rationOprObj;
|
|
|
|
|
|
+ let me = rationOprObj;
|
|
let gljLibID = storageUtil.getSessionCache("gljLib", "repositoryID_" + rationRepId);
|
|
let gljLibID = storageUtil.getSessionCache("gljLib", "repositoryID_" + rationRepId);
|
|
if(!gljLibID || typeof gljLibID === 'undefined' || gljLibID == -1){
|
|
if(!gljLibID || typeof gljLibID === 'undefined' || gljLibID == -1){
|
|
alert("没有引用工料机库!");
|
|
alert("没有引用工料机库!");
|
|
@@ -57,16 +56,45 @@ var rationOprObj = {
|
|
me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.EnterCell, me.onEnterCell);
|
|
me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.EnterCell, me.onEnterCell);
|
|
me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.EditStarting, me.onCellEditStart);
|
|
me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.EditStarting, me.onCellEditStart);
|
|
me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.EditEnded, me.onCellEditEnd);
|
|
me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.EditEnded, me.onCellEditEnd);
|
|
- //me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.RangeChanged, me.onRangeChanged);
|
|
|
|
- me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.CellClick, me.onCellClick);
|
|
|
|
|
|
+ //me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.CellClick, me.onCellClick);
|
|
|
|
+ me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.SelectionChanged, me.onSelectionChanged);
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ onSelectionChanged: function (sender, info) {
|
|
|
|
+ if(info.oldSelections.length === 0 && info.newSelections.length > 0 || info.oldSelections[0].row !== info.newSelections[0].row){
|
|
|
|
+ let row = info.newSelections[0].row;
|
|
|
|
+ let me = rationOprObj,
|
|
|
|
+ sheetGLJ = rationGLJOprObj.sheet, settingGLJ = rationGLJOprObj.setting,
|
|
|
|
+ sheetCoe = rationCoeOprObj.sheet, settingCoe = rationCoeOprObj.setting,
|
|
|
|
+ sheetAss = rationAssistOprObj.sheet, settingAss = rationAssistOprObj.setting;
|
|
|
|
+ sheetCommonObj.cleanSheet(sheetGLJ, settingGLJ, -1);
|
|
|
|
+ sheetCommonObj.shieldAllCells(sheetGLJ);
|
|
|
|
+ sheetCommonObj.cleanSheet(sheetCoe, settingCoe, -1);
|
|
|
|
+ sheetCommonObj.shieldAllCells(sheetCoe);
|
|
|
|
+ sheetCommonObj.cleanSheet(sheetAss, settingAss, -1);
|
|
|
|
+ sheetCommonObj.shieldAllCells(sheetAss);
|
|
|
|
+ let cacheSection = me.getCache();
|
|
|
|
+ if (cacheSection && row < cacheSection.length) {
|
|
|
|
+ rationGLJOprObj.getGljItems(cacheSection[row], function () {
|
|
|
|
+ me.workBook.focus(true);
|
|
|
|
+ });
|
|
|
|
+ rationCoeOprObj.getCoeItems(cacheSection[row], function () {
|
|
|
|
+ me.workBook.focus(true);
|
|
|
|
+ });
|
|
|
|
+ rationAssistOprObj.getAssItems(cacheSection[row]);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ rationGLJOprObj.currentRationItem = null;
|
|
|
|
+ }
|
|
|
|
+ me.workBook.focus(true);
|
|
|
|
+ }
|
|
},
|
|
},
|
|
|
|
|
|
onCellClick: function(sender, args) {
|
|
onCellClick: function(sender, args) {
|
|
- var me = rationOprObj,
|
|
|
|
|
|
+ let me = rationOprObj,
|
|
sheetGLJ = rationGLJOprObj.sheet, settingGLJ = rationGLJOprObj.setting,
|
|
sheetGLJ = rationGLJOprObj.sheet, settingGLJ = rationGLJOprObj.setting,
|
|
sheetCoe = rationCoeOprObj.sheet, settingCoe = rationCoeOprObj.setting,
|
|
sheetCoe = rationCoeOprObj.sheet, settingCoe = rationCoeOprObj.setting,
|
|
sheetAss = rationAssistOprObj.sheet, settingAss = rationAssistOprObj.setting;
|
|
sheetAss = rationAssistOprObj.sheet, settingAss = rationAssistOprObj.setting;
|
|
- me.activeCell = {row: args.row, col: args.col};
|
|
|
|
sheetCommonObj.cleanSheet(sheetGLJ, settingGLJ, -1);
|
|
sheetCommonObj.cleanSheet(sheetGLJ, settingGLJ, -1);
|
|
sheetCommonObj.shieldAllCells(sheetGLJ);
|
|
sheetCommonObj.shieldAllCells(sheetGLJ);
|
|
sheetCommonObj.cleanSheet(sheetCoe, settingCoe, -1);
|
|
sheetCommonObj.cleanSheet(sheetCoe, settingCoe, -1);
|
|
@@ -74,7 +102,7 @@ var rationOprObj = {
|
|
sheetCommonObj.cleanSheet(sheetAss, settingAss, -1);
|
|
sheetCommonObj.cleanSheet(sheetAss, settingAss, -1);
|
|
sheetCommonObj.shieldAllCells(sheetAss);
|
|
sheetCommonObj.shieldAllCells(sheetAss);
|
|
if(!(args.sheetArea === GC.Spread.Sheets.SheetArea.colHeader || args.sheetArea === GC.Spread.Sheets.SheetArea.corner)){
|
|
if(!(args.sheetArea === GC.Spread.Sheets.SheetArea.colHeader || args.sheetArea === GC.Spread.Sheets.SheetArea.corner)){
|
|
- var cacheSection = me.getCache();
|
|
|
|
|
|
+ let cacheSection = me.getCache();
|
|
if (cacheSection && args.row < cacheSection.length) {
|
|
if (cacheSection && args.row < cacheSection.length) {
|
|
rationGLJOprObj.getGljItems(cacheSection[args.row], function () {
|
|
rationGLJOprObj.getGljItems(cacheSection[args.row], function () {
|
|
me.workBook.focus(true);
|
|
me.workBook.focus(true);
|
|
@@ -90,9 +118,11 @@ var rationOprObj = {
|
|
};
|
|
};
|
|
me.workBook.focus(true);
|
|
me.workBook.focus(true);
|
|
},
|
|
},
|
|
-
|
|
|
|
|
|
+ isInt: function (num) {
|
|
|
|
+ return !isNaN(num) && num % 1 === 0;
|
|
|
|
+ },
|
|
getCache: function() {
|
|
getCache: function() {
|
|
- var me = this, rst = me.currentRations["_SEC_ID_" + me.currentSectionId];
|
|
|
|
|
|
+ let me = this, rst = me.currentRations["_SEC_ID_" + me.currentSectionId];
|
|
if (!(rst)) {
|
|
if (!(rst)) {
|
|
me.currentRations["_SEC_ID_" + me.currentSectionId] = [];
|
|
me.currentRations["_SEC_ID_" + me.currentSectionId] = [];
|
|
rst = me.currentRations["_SEC_ID_" + me.currentSectionId];
|
|
rst = me.currentRations["_SEC_ID_" + me.currentSectionId];
|
|
@@ -100,21 +130,21 @@ var rationOprObj = {
|
|
return rst;
|
|
return rst;
|
|
},
|
|
},
|
|
updateCache: function(addArr, updateArr, removeIds, result) {
|
|
updateCache: function(addArr, updateArr, removeIds, result) {
|
|
- var me = this, cacheSection = me.getCache();
|
|
|
|
|
|
+ let me = this, cacheSection = me.getCache();
|
|
if (addArr.length > 0) {
|
|
if (addArr.length > 0) {
|
|
me.currentRations["_SEC_ID_" + me.currentSectionId] = cacheSection.concat(addArr);
|
|
me.currentRations["_SEC_ID_" + me.currentSectionId] = cacheSection.concat(addArr);
|
|
cacheSection = me.currentRations["_SEC_ID_" + me.currentSectionId];
|
|
cacheSection = me.currentRations["_SEC_ID_" + me.currentSectionId];
|
|
}
|
|
}
|
|
- for (var i = removeIds.length - 1; i >= 0; i--) {
|
|
|
|
- for (var j = cacheSection.length - 1; j >= 0 ; j--) {
|
|
|
|
|
|
+ for (let i = removeIds.length - 1; i >= 0; i--) {
|
|
|
|
+ for (let j = cacheSection.length - 1; j >= 0 ; j--) {
|
|
if (cacheSection[j]["ID"] == removeIds[i]) {
|
|
if (cacheSection[j]["ID"] == removeIds[i]) {
|
|
cacheSection.splice(j,1);
|
|
cacheSection.splice(j,1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (result && result.data.ops && result.data.ops.length > 0) {
|
|
if (result && result.data.ops && result.data.ops.length > 0) {
|
|
- for (var i = 0; i < result.data.ops.length; i++) {
|
|
|
|
- for (var j = 0; j < cacheSection.length; j++) {
|
|
|
|
|
|
+ for (let i = 0; i < result.data.ops.length; i++) {
|
|
|
|
+ for (let j = 0; j < cacheSection.length; j++) {
|
|
if (cacheSection[j][me.setting.header[0].dataCode] == result.data.ops[i][me.setting.header[0].dataCode]) {
|
|
if (cacheSection[j][me.setting.header[0].dataCode] == result.data.ops[i][me.setting.header[0].dataCode]) {
|
|
cacheSection[j]["ID"] = result.data.ops[i]["ID"];
|
|
cacheSection[j]["ID"] = result.data.ops[i]["ID"];
|
|
cacheSection[j]["rationGljList"] = result.data.ops[i]["rationGljList"];
|
|
cacheSection[j]["rationGljList"] = result.data.ops[i]["rationGljList"];
|
|
@@ -122,8 +152,8 @@ var rationOprObj = {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- for (var i = 0; i < updateArr.length; i++) {
|
|
|
|
- for (var j = 0; j < cacheSection.length; j++) {
|
|
|
|
|
|
+ for (let i = 0; i < updateArr.length; i++) {
|
|
|
|
+ for (let j = 0; j < cacheSection.length; j++) {
|
|
if (updateArr[i]["ID"] && cacheSection[j]["ID"]) {
|
|
if (updateArr[i]["ID"] && cacheSection[j]["ID"]) {
|
|
if (cacheSection[j]["ID"] == updateArr[i]["ID"]) {
|
|
if (cacheSection[j]["ID"] == updateArr[i]["ID"]) {
|
|
cacheSection[j] = updateArr[i];
|
|
cacheSection[j] = updateArr[i];
|
|
@@ -195,48 +225,6 @@ var rationOprObj = {
|
|
me.workBook.commandManager().setShortcutKey(null, GC.Spread.Commands.Key.del, false, false, false, false);
|
|
me.workBook.commandManager().setShortcutKey(null, GC.Spread.Commands.Key.del, false, false, false, false);
|
|
me.workBook.commandManager().setShortcutKey('rationDelete', GC.Spread.Commands.Key.del, false, false, false, false);
|
|
me.workBook.commandManager().setShortcutKey('rationDelete', GC.Spread.Commands.Key.del, false, false, false, false);
|
|
},
|
|
},
|
|
- onRangeChanged: function(sender, args) {
|
|
|
|
- if (args.action == GC.Spread.Sheets.RangeChangedAction.clear) {
|
|
|
|
- var me = rationOprObj, updateArr = [], removeArr = [];
|
|
|
|
- var cacheSection = me.getCache();
|
|
|
|
- if (cacheSection) {
|
|
|
|
- for (var i = 0; i < args.rowCount; i++) {
|
|
|
|
- //var hasUpdate = false, rObj = sheetCommonObj.combineRowData(me.workBook.getSheet(0), me.setting, args.row + i),
|
|
|
|
- var hasUpdate = false, rObj = sheetCommonObj.combineRationRowData(me.workBook.getSheet(0), me.setting, args.row + i),
|
|
|
|
- isEmpty = sheetCommonObj.chkIfEmpty(rObj, me.setting);
|
|
|
|
- for (var j = 0; j < cacheSection.length; j++) {
|
|
|
|
- if (cacheSection[j][me.setting.header[0].dataCode] == rObj[me.setting.header[0].dataCode]) {
|
|
|
|
- rObj["ID"] = cacheSection[j]["ID"];
|
|
|
|
- hasUpdate = true;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if(isEmpty){
|
|
|
|
- if(args.row + i < cacheSection.length){
|
|
|
|
- rObj.ID = cacheSection[args.row + i].ID;
|
|
|
|
- removeArr.push(rObj.ID);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- else{
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (hasUpdate) {
|
|
|
|
- if (isEmpty) {
|
|
|
|
- removeArr.push(rObj);
|
|
|
|
- } else updateArr.push(rObj);
|
|
|
|
- } else if (isEmpty) {
|
|
|
|
- if (args.row + i < cacheSection.length) {
|
|
|
|
- rObj["ID"] = cacheSection[args.row + i]["ID"];
|
|
|
|
- removeArr.push(rObj["ID"]);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- // me.mixUpdateRequest(updateArr, [], removeArr);
|
|
|
|
- //removeRationItems
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
onEnterCell: function (sender, args) {
|
|
onEnterCell: function (sender, args) {
|
|
let me = rationOprObj;
|
|
let me = rationOprObj;
|
|
me.cellRowIdx = args.row;
|
|
me.cellRowIdx = args.row;
|
|
@@ -252,17 +240,14 @@ var rationOprObj = {
|
|
if(isHasData){
|
|
if(isHasData){
|
|
if(me.editingRowIdx !== me.cellRowIdx) {
|
|
if(me.editingRowIdx !== me.cellRowIdx) {
|
|
let focusToCol = !me.addRationItem.code ? 0 : -1;
|
|
let focusToCol = !me.addRationItem.code ? 0 : -1;
|
|
- // else {
|
|
|
|
if(focusToCol !== -1){
|
|
if(focusToCol !== -1){
|
|
$('#rationAlertBtn').click();
|
|
$('#rationAlertBtn').click();
|
|
me.workBook.getSheet(0).options.isProtected = true;
|
|
me.workBook.getSheet(0).options.isProtected = true;
|
|
$('#rationAlertCac').click(function () {
|
|
$('#rationAlertCac').click(function () {
|
|
me.workBook.getSheet(0).options.isProtected = false;
|
|
me.workBook.getSheet(0).options.isProtected = false;
|
|
- //me.workBook.getSheet(0).setActiveCell(me.editingRowIdx, focusToCol);
|
|
|
|
});
|
|
});
|
|
$('#rationAlertCls').click(function () {
|
|
$('#rationAlertCls').click(function () {
|
|
me.workBook.getSheet(0).options.isProtected = false;
|
|
me.workBook.getSheet(0).options.isProtected = false;
|
|
- // me.workBook.getSheet(0).setActiveCell(me.editingRowIdx, focusToCol);
|
|
|
|
});
|
|
});
|
|
$('#rationAlertCof').click(function () {
|
|
$('#rationAlertCof').click(function () {
|
|
me.workBook.getSheet(0).options.isProtected = false;
|
|
me.workBook.getSheet(0).options.isProtected = false;
|
|
@@ -270,21 +255,18 @@ var rationOprObj = {
|
|
for(let col=0; col<me.setting.header.length; col++){
|
|
for(let col=0; col<me.setting.header.length; col++){
|
|
me.workBook.getSheet(0).getCell(me.editingRowIdx, col).value(me.currentEditingRation[me.setting.header[col].dataCode]);
|
|
me.workBook.getSheet(0).getCell(me.editingRowIdx, col).value(me.currentEditingRation[me.setting.header[col].dataCode]);
|
|
}
|
|
}
|
|
- //me.workBook.getSheet(0).setActiveCell(me.editingRowIdx, 0);
|
|
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- // }
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
onCellEditStart: function(sender, args) {
|
|
onCellEditStart: function(sender, args) {
|
|
- var me = rationOprObj;
|
|
|
|
- //var rObj = sheetCommonObj.combineRowData(me.workBook.getSheet(0), me.setting, args.row);
|
|
|
|
- var rObj = sheetCommonObj.combineRationRowData(me.workBook.getSheet(0), me.setting, args.row);
|
|
|
|
|
|
+ let me = rationOprObj;
|
|
|
|
+ let rObj = sheetsOprObj.combineRationRowData(me.workBook.getSheet(0), me.setting, args.row);
|
|
me.currentEditingRation = rObj;
|
|
me.currentEditingRation = rObj;
|
|
- var cacheSection = me.getCache();
|
|
|
|
|
|
+ let cacheSection = me.getCache();
|
|
if (cacheSection) {
|
|
if (cacheSection) {
|
|
- for (var j = 0; j < cacheSection.length; j++) {
|
|
|
|
|
|
+ for (let j = 0; j < cacheSection.length; j++) {
|
|
if (cacheSection[j][me.setting.header[0].dataCode] == rObj[me.setting.header[0].dataCode]) {
|
|
if (cacheSection[j][me.setting.header[0].dataCode] == rObj[me.setting.header[0].dataCode]) {
|
|
rObj["ID"] = cacheSection[j]["ID"];
|
|
rObj["ID"] = cacheSection[j]["ID"];
|
|
break;
|
|
break;
|
|
@@ -293,13 +275,16 @@ var rationOprObj = {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
onCellEditEnd: function(sender, args) {
|
|
onCellEditEnd: function(sender, args) {
|
|
- //var me = rationOprObj, rObj = sheetCommonObj.combineRowData(me.workBook.getSheet(0), me.setting, args.row),
|
|
|
|
- var me = rationOprObj, rObj = sheetCommonObj.combineRationRowData(me.workBook.getSheet(0), me.setting, args.row),
|
|
|
|
|
|
+ let me = rationOprObj, rObj = sheetsOprObj.combineRationRowData(me.workBook.getSheet(0), me.setting, args.row),
|
|
updateArr = [], addArr = [];
|
|
updateArr = [], addArr = [];
|
|
let dataCode = me.setting.header[args.col].dataCode;
|
|
let dataCode = me.setting.header[args.col].dataCode;
|
|
me.editingRowIdx = args.row;
|
|
me.editingRowIdx = args.row;
|
|
if (me.currentEditingRation["ID"]) {
|
|
if (me.currentEditingRation["ID"]) {
|
|
- rObj["ID"] = me.currentEditingRation["ID"];
|
|
|
|
|
|
+ if((!args.editingText || args.editingText.toString().trim().length === 0) && args.col === 0){
|
|
|
|
+ args.sheet.setValue(args.row, args.col, me.currentEditingRation[dataCode] + '');
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ rObj["ID"] = me.currentEditingRation["ID"];
|
|
if(me.currentEditingRation[dataCode] !== rObj[dataCode]){
|
|
if(me.currentEditingRation[dataCode] !== rObj[dataCode]){
|
|
me.addRationItem = rObj;
|
|
me.addRationItem = rObj;
|
|
if(dataCode === 'code'){
|
|
if(dataCode === 'code'){
|
|
@@ -314,10 +299,20 @@ var rationOprObj = {
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ else if(dataCode === 'feeType'){//取费专业控制为整数
|
|
|
|
+ if(me.isInt(rObj[dataCode])){
|
|
|
|
+ updateArr.push(rObj);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ rObj[dataCode] = '';
|
|
|
|
+ args.sheet.setValue(args.row, args.col, typeof me.currentEditingRation[dataCode] !== 'undefined' && me.currentEditingRation[dataCode] ? me.currentEditingRation[dataCode] : '');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
else{
|
|
else{
|
|
updateArr.push(rObj);
|
|
updateArr.push(rObj);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else if(!me.currentEditingRation["ID"]) {
|
|
else if(!me.currentEditingRation["ID"]) {
|
|
if (!sheetCommonObj.chkIfEmpty(rObj, me.setting)) {
|
|
if (!sheetCommonObj.chkIfEmpty(rObj, me.setting)) {
|
|
@@ -329,6 +324,9 @@ var rationOprObj = {
|
|
if(jobContentOprObj && jobContentOprObj.currentSituation === jobContentOprObj.situations.ALL){
|
|
if(jobContentOprObj && jobContentOprObj.currentSituation === jobContentOprObj.situations.ALL){
|
|
rObj.jobContent = jobContentOprObj.currentJobContent ? jobContentOprObj.currentJobContent : '';
|
|
rObj.jobContent = jobContentOprObj.currentJobContent ? jobContentOprObj.currentJobContent : '';
|
|
}
|
|
}
|
|
|
|
+ if(annotationOprObj && annotationOprObj.currentSituation === annotationOprObj.situations.ALL){
|
|
|
|
+ rObj.annotation = annotationOprObj.currentAnnotation ? annotationOprObj.currentAnnotation : '';
|
|
|
|
+ }
|
|
me.setInitPrc(rObj);
|
|
me.setInitPrc(rObj);
|
|
addArr.push(rObj);
|
|
addArr.push(rObj);
|
|
me.rationsCodes.push(rObj.code);
|
|
me.rationsCodes.push(rObj.code);
|
|
@@ -367,35 +365,34 @@ var rationOprObj = {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
onClipboardPasting: function(sender, args) {
|
|
onClipboardPasting: function(sender, args) {
|
|
- var me = rationOprObj;
|
|
|
|
- /* if (args.cellRange.colCount != me.setting.header.length) {
|
|
|
|
- args.cancel = true;
|
|
|
|
- }*/
|
|
|
|
|
|
+ let me = rationOprObj;
|
|
},
|
|
},
|
|
onClipboardPasted: function(e, info) {
|
|
onClipboardPasted: function(e, info) {
|
|
- var me = rationOprObj;
|
|
|
|
- var cacheSection = me.getCache();
|
|
|
|
- var updateArr = [], addArr = [];
|
|
|
|
- var items = sheetCommonObj.analyzePasteData(me.setting, info);
|
|
|
|
- let failPasteArr = [];
|
|
|
|
- for (var i = 0, rowIdx =info.cellRange.row; i < items.length; i++, rowIdx++) {
|
|
|
|
|
|
+ let me = rationOprObj;
|
|
|
|
+ let cacheSection = me.getCache();
|
|
|
|
+ let updateArr = [], addArr = [];
|
|
|
|
+ let items = sheetCommonObj.analyzePasteData(me.setting, info);
|
|
|
|
+ //let failPasteArr = [];
|
|
|
|
+ for (let i = 0, rowIdx =info.cellRange.row; i < items.length; i++, rowIdx++) {
|
|
if (cacheSection) {
|
|
if (cacheSection) {
|
|
if(!me.isValidUnit(items[i], rationUnits)){//无效单位
|
|
if(!me.isValidUnit(items[i], rationUnits)){//无效单位
|
|
items[i].unit = typeof cacheSection[rowIdx].unit !== 'undefined' && !cacheSection[rowIdx] ? cacheSection[rowIdx].unit : '';
|
|
items[i].unit = typeof cacheSection[rowIdx].unit !== 'undefined' && !cacheSection[rowIdx] ? cacheSection[rowIdx].unit : '';
|
|
}
|
|
}
|
|
- //var hasCacheItem = false;
|
|
|
|
if(!cacheSection[rowIdx] && info.cellRange.col === 0 ){
|
|
if(!cacheSection[rowIdx] && info.cellRange.col === 0 ){
|
|
if(me.rationsCodes.indexOf(items[i].code) === -1){
|
|
if(me.rationsCodes.indexOf(items[i].code) === -1){
|
|
//jobConten
|
|
//jobConten
|
|
if(jobContentOprObj && jobContentOprObj.currentSituation === jobContentOprObj.situations.ALL){
|
|
if(jobContentOprObj && jobContentOprObj.currentSituation === jobContentOprObj.situations.ALL){
|
|
items[i].jobContent = jobContentOprObj.currentJobContent ? jobContentOprObj.currentJobContent : '';
|
|
items[i].jobContent = jobContentOprObj.currentJobContent ? jobContentOprObj.currentJobContent : '';
|
|
}
|
|
}
|
|
|
|
+ if(annotationOprObj && annotationOprObj.currentSituation === annotationOprObj.situations.ALL){
|
|
|
|
+ items[i].annotation = annotationOprObj.currentAnnotation ? annotationOprObj.currentAnnotation : '';
|
|
|
|
+ }
|
|
me.setInitPrc(items[i]);
|
|
me.setInitPrc(items[i]);
|
|
addArr.push(items[i]);
|
|
addArr.push(items[i]);
|
|
me.rationsCodes.push(items[i].code);
|
|
me.rationsCodes.push(items[i].code);
|
|
}
|
|
}
|
|
else{
|
|
else{
|
|
- failPasteArr.push(items[i].code);
|
|
|
|
|
|
+ //failPasteArr.push(items[i].code);
|
|
me.workBook.getSheet(0).setValue(rowIdx, 0, '');
|
|
me.workBook.getSheet(0).setValue(rowIdx, 0, '');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -405,6 +402,10 @@ var rationOprObj = {
|
|
items[i][me.setting.header[col].dataCode] = cacheSection[rowIdx][me.setting.header[col].dataCode];
|
|
items[i][me.setting.header[col].dataCode] = cacheSection[rowIdx][me.setting.header[col].dataCode];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if(items[i].feeType && !me.isInt(items[i].feeType)){
|
|
|
|
+ items[i].feeType = '';
|
|
|
|
+ me.workBook.getSheet(0).setValue(rowIdx, 8, '');
|
|
|
|
+ }
|
|
if(info.cellRange.col === 0){
|
|
if(info.cellRange.col === 0){
|
|
if(me.rationsCodes.indexOf(items[i].code) === -1){
|
|
if(me.rationsCodes.indexOf(items[i].code) === -1){
|
|
items[i].ID = cacheSection[rowIdx].ID;
|
|
items[i].ID = cacheSection[rowIdx].ID;
|
|
@@ -432,12 +433,15 @@ var rationOprObj = {
|
|
if(jobContentOprObj && jobContentOprObj.currentSituation === jobContentOprObj.situations.ALL){
|
|
if(jobContentOprObj && jobContentOprObj.currentSituation === jobContentOprObj.situations.ALL){
|
|
items[i].jobContent = jobContentOprObj.currentJobContent ? jobContentOprObj.currentJobContent : '';
|
|
items[i].jobContent = jobContentOprObj.currentJobContent ? jobContentOprObj.currentJobContent : '';
|
|
}
|
|
}
|
|
|
|
+ if(annotationOprObj && annotationOprObj.currentSituation === annotationOprObj.situations.ALL){
|
|
|
|
+ items[i].annotation = annotationOprObj.currentAnnotation ? annotationOprObj.currentAnnotation : '';
|
|
|
|
+ }
|
|
me.setInitPrc(items[i]);
|
|
me.setInitPrc(items[i]);
|
|
addArr.push(items[i]);
|
|
addArr.push(items[i]);
|
|
}
|
|
}
|
|
- else{
|
|
|
|
|
|
+ /*else{
|
|
failPasteArr.push(items[i]);
|
|
failPasteArr.push(items[i]);
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -477,7 +481,7 @@ var rationOprObj = {
|
|
})
|
|
})
|
|
},
|
|
},
|
|
mixUpdateRequest: function(updateArr, addArr, removeIds) {
|
|
mixUpdateRequest: function(updateArr, addArr, removeIds) {
|
|
- var me = rationOprObj;
|
|
|
|
|
|
+ let me = rationOprObj;
|
|
sheetCommonObj.setLockCol(me.workBook.getSheet(0), 0, true);
|
|
sheetCommonObj.setLockCol(me.workBook.getSheet(0), 0, true);
|
|
$.ajax({
|
|
$.ajax({
|
|
type:"POST",
|
|
type:"POST",
|
|
@@ -491,21 +495,37 @@ var rationOprObj = {
|
|
alert(`error`);
|
|
alert(`error`);
|
|
me.getRationItems(me.currentSectionId);
|
|
me.getRationItems(me.currentSectionId);
|
|
} else {
|
|
} else {
|
|
- var cacheSection = me.updateCache(addArr, updateArr, removeIds, result);
|
|
|
|
|
|
+ let cacheSection = me.updateCache(addArr, updateArr, removeIds, result);
|
|
cacheSection.sort(function(a, b){
|
|
cacheSection.sort(function(a, b){
|
|
- var rst = 0;
|
|
|
|
|
|
+ let rst = 0;
|
|
if (a.code > b.code) rst = 1
|
|
if (a.code > b.code) rst = 1
|
|
else if (a.code < b.code) rst = -1;
|
|
else if (a.code < b.code) rst = -1;
|
|
return rst;
|
|
return rst;
|
|
});
|
|
});
|
|
//jobContent
|
|
//jobContent
|
|
- if(jobContentOprObj && jobContentOprObj.currentSituation === jobContentOprObj.situations.PARTIAL){
|
|
|
|
|
|
+ if(jobContentOprObj ){
|
|
jobContentOprObj.currentRationItems = cacheSection;
|
|
jobContentOprObj.currentRationItems = cacheSection;
|
|
- jobContentOprObj.buildTablePartial(jobContentOprObj.tablePartial, jobContentOprObj.getGroup(cacheSection));
|
|
|
|
|
|
+ jobContentOprObj.setRadiosDisabled(cacheSection.length > 0 ? false : true, jobContentOprObj.radios);
|
|
|
|
+ if(cacheSection.length === 0){
|
|
|
|
+ jobContentOprObj.updateSituation(pageOprObj.rationLibId, me.currentSectionId, 'NONE');
|
|
|
|
+ }
|
|
|
|
+ jobContentOprObj.setRadiosChecked(jobContentOprObj.currentSituation, jobContentOprObj.radios);
|
|
|
|
+ if(jobContentOprObj.currentSituation === jobContentOprObj.situations.PARTIAL){
|
|
|
|
+ jobContentOprObj.buildTablePartial(jobContentOprObj.tablePartial, jobContentOprObj.getGroup(cacheSection));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(annotationOprObj ){
|
|
|
|
+ annotationOprObj.setRadiosDisabled(cacheSection.length > 0 ? false : true, annotationOprObj.radios);
|
|
|
|
+ if(cacheSection.length === 0){
|
|
|
|
+ annotationOprObj.updateAnnoSituation(pageOprObj.rationLibId, me.currentSectionId, 'NONE');
|
|
|
|
+ }
|
|
|
|
+ annotationOprObj.setRadiosChecked(annotationOprObj.currentSituation, annotationOprObj.radios);
|
|
|
|
+ if(annotationOprObj.currentSituation === annotationOprObj.situations.PARTIAL){
|
|
|
|
+ annotationOprObj.buildTablePartial(annotationOprObj.fzTablePartial, annotationOprObj.getGroup(cacheSection));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
me.showRationItems(me.currentSectionId);
|
|
me.showRationItems(me.currentSectionId);
|
|
me.mixUpdate = 0;
|
|
me.mixUpdate = 0;
|
|
- // me.workBook.getSheet(0).setActiveCell(me.activeCell.row, me.activeCell.col);
|
|
|
|
}
|
|
}
|
|
sheetCommonObj.setLockCol(me.workBook.getSheet(0), 0, false);
|
|
sheetCommonObj.setLockCol(me.workBook.getSheet(0), 0, false);
|
|
},
|
|
},
|
|
@@ -515,14 +535,15 @@ var rationOprObj = {
|
|
},
|
|
},
|
|
getRationItems: function(sectionID){
|
|
getRationItems: function(sectionID){
|
|
if (sectionID != -1) {
|
|
if (sectionID != -1) {
|
|
- var me = rationOprObj;
|
|
|
|
|
|
+ let me = rationOprObj;
|
|
me.mixUpdate = 0;
|
|
me.mixUpdate = 0;
|
|
me.currentSectionId = sectionID;
|
|
me.currentSectionId = sectionID;
|
|
if (me.currentRations["_SEC_ID_" + sectionID]) {
|
|
if (me.currentRations["_SEC_ID_" + sectionID]) {
|
|
//jobContent--
|
|
//jobContent--
|
|
jobContentOprObj.currentRationItems = me.currentRations["_SEC_ID_" + sectionID];
|
|
jobContentOprObj.currentRationItems = me.currentRations["_SEC_ID_" + sectionID];
|
|
jobContentOprObj.rationJobContentOpr(me.currentRations["_SEC_ID_" + sectionID]);
|
|
jobContentOprObj.rationJobContentOpr(me.currentRations["_SEC_ID_" + sectionID]);
|
|
- //jobContent--
|
|
|
|
|
|
+ //annotation
|
|
|
|
+ annotationOprObj.rationAnnotationOpr(me.currentRations["_SEC_ID_" + sectionID]);
|
|
me.showRationItems(sectionID);
|
|
me.showRationItems(sectionID);
|
|
///sheetCommonObj.unShieldAllCells(me.workBook.getSheet(0));
|
|
///sheetCommonObj.unShieldAllCells(me.workBook.getSheet(0));
|
|
sheetCommonObj.lockCells(rationGLJOprObj.sheet, rationGLJOprObj.setting);
|
|
sheetCommonObj.lockCells(rationGLJOprObj.sheet, rationGLJOprObj.setting);
|
|
@@ -544,7 +565,8 @@ var rationOprObj = {
|
|
//job--
|
|
//job--
|
|
jobContentOprObj.currentRationItems = me.currentRations["_SEC_ID_" + sectionID];
|
|
jobContentOprObj.currentRationItems = me.currentRations["_SEC_ID_" + sectionID];
|
|
jobContentOprObj.rationJobContentOpr(me.currentRations["_SEC_ID_" + sectionID]);
|
|
jobContentOprObj.rationJobContentOpr(me.currentRations["_SEC_ID_" + sectionID]);
|
|
- //job--
|
|
|
|
|
|
+ //annotation
|
|
|
|
+ annotationOprObj.rationAnnotationOpr(me.currentRations["_SEC_ID_" + sectionID]);
|
|
me.showRationItems(sectionID);
|
|
me.showRationItems(sectionID);
|
|
//sheetCommonObj.unShieldAllCells(me.workBook.getSheet(0));
|
|
//sheetCommonObj.unShieldAllCells(me.workBook.getSheet(0));
|
|
sheetCommonObj.lockCells(me.workBook.getSheet(0), rationOprObj.setting);
|
|
sheetCommonObj.lockCells(me.workBook.getSheet(0), rationOprObj.setting);
|
|
@@ -576,13 +598,13 @@ var rationOprObj = {
|
|
sheet.resumePaint();
|
|
sheet.resumePaint();
|
|
},
|
|
},
|
|
showRationItems: function(sectionID){
|
|
showRationItems: function(sectionID){
|
|
- var me = rationOprObj;
|
|
|
|
|
|
+ let me = rationOprObj;
|
|
if (me.workBook) {
|
|
if (me.workBook) {
|
|
if (me.currentRations && me.currentRations["_SEC_ID_" + sectionID] && me.currentRations["_SEC_ID_" + sectionID].length > 0) {
|
|
if (me.currentRations && me.currentRations["_SEC_ID_" + sectionID] && me.currentRations["_SEC_ID_" + sectionID].length > 0) {
|
|
- var cacheSection = me.currentRations["_SEC_ID_" + sectionID];
|
|
|
|
|
|
+ let cacheSection = me.currentRations["_SEC_ID_" + sectionID];
|
|
//sheetCommonObj.cleanSheet(me.workBook.getSheet(0), me.setting, -1);
|
|
//sheetCommonObj.cleanSheet(me.workBook.getSheet(0), me.setting, -1);
|
|
sheetCommonObj.cleanData(me.workBook.getSheet(0), me.setting, -1);
|
|
sheetCommonObj.cleanData(me.workBook.getSheet(0), me.setting, -1);
|
|
- sheetCommonObj.showData(me.workBook.getSheet(0), me.setting, cacheSection);
|
|
|
|
|
|
+ sheetsOprObj.showData(me.workBook.getSheet(0), me.setting, cacheSection);
|
|
sheetCommonObj.setLockCol(me.workBook.getSheet(0), 4, true);
|
|
sheetCommonObj.setLockCol(me.workBook.getSheet(0), 4, true);
|
|
//combo
|
|
//combo
|
|
me.setCombo(me.workBook.getActiveSheet(), rationUnits);
|
|
me.setCombo(me.workBook.getActiveSheet(), rationUnits);
|