|
@@ -8,9 +8,9 @@ var rationCoeOprObj = {
|
|
cache: {},
|
|
cache: {},
|
|
setting: {
|
|
setting: {
|
|
header:[
|
|
header:[
|
|
- {headerName:"编号",headerWidth:160,dataCode:"ID", dataType: "Number"},
|
|
|
|
|
|
+ {headerName:"编号",headerWidth:120,dataCode:"ID", dataType: "Number"},
|
|
{headerName:"名称",headerWidth:400,dataCode:"name", dataType: "String"},
|
|
{headerName:"名称",headerWidth:400,dataCode:"name", dataType: "String"},
|
|
- {headerName:"内容",headerWidth:500,dataCode:"content", dataType: "String"}
|
|
|
|
|
|
+ {headerName:"内容",headerWidth:300,dataCode:"content", dataType: "String"}
|
|
],
|
|
],
|
|
view:{
|
|
view:{
|
|
comboBox:[],
|
|
comboBox:[],
|
|
@@ -45,7 +45,7 @@ var rationCoeOprObj = {
|
|
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- onClipboardPasting: function(sender, args) {
|
|
|
|
|
|
+/* onClipboardPasting: function(sender, args) {
|
|
var me = rationCoeOprObj;
|
|
var me = rationCoeOprObj;
|
|
if (args.cellRange.colCount != 1 || args.cellRange.col != 0 || !(me.currentRationItem)) {
|
|
if (args.cellRange.colCount != 1 || args.cellRange.col != 0 || !(me.currentRationItem)) {
|
|
args.cancel = true;
|
|
args.cancel = true;
|
|
@@ -58,22 +58,20 @@ var rationCoeOprObj = {
|
|
var tmpCoeIDs = sheetCommonObj.analyzePasteData({header:[{dataCode: "ID"}] }, info);
|
|
var tmpCoeIDs = sheetCommonObj.analyzePasteData({header:[{dataCode: "ID"}] }, info);
|
|
var IDs = [];
|
|
var IDs = [];
|
|
for (var i = 0; i < tmpCoeIDs.length; i++) {
|
|
for (var i = 0; i < tmpCoeIDs.length; i++) {
|
|
- IDs.push(tmpCoeIDs[i].ID);
|
|
|
|
|
|
+ IDs.push(tmpCoeIDs[i]);
|
|
}
|
|
}
|
|
- me.addCoeItems(IDs, me.libID);
|
|
|
|
|
|
+ me.addCoeItems(IDs);
|
|
} else {
|
|
} else {
|
|
//修改用量
|
|
//修改用量
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- },
|
|
|
|
|
|
+ },*/
|
|
onCellEditEnd: function(sender, args){
|
|
onCellEditEnd: function(sender, args){
|
|
var me = rationCoeOprObj;
|
|
var me = rationCoeOprObj;
|
|
- if (args.col = 0) {
|
|
|
|
- //重新录入附注条件的ID
|
|
|
|
- if (args.editingText == null || args.editingText.trim() == "") {
|
|
|
|
- //delete
|
|
|
|
- if (me.cache["_Coe_" + me.currentRationItem.ID]) {
|
|
|
|
- var cacheArr = me.cache["_Coe_" + me.currentRationItem.ID];
|
|
|
|
|
|
+ if (args.col == 0) { // 编号列
|
|
|
|
+ if (args.editingText == null || args.editingText.trim() == "") { //delete
|
|
|
|
+ var cacheArr = me.cache["_Coe_" + me.currentRationItem.ID];
|
|
|
|
+ if (cacheArr) {
|
|
if (args.row < cacheArr.length) {
|
|
if (args.row < cacheArr.length) {
|
|
cacheArr.splice(args.row, 1);
|
|
cacheArr.splice(args.row, 1);
|
|
me.updateRationItem();
|
|
me.updateRationItem();
|
|
@@ -91,12 +89,12 @@ var rationCoeOprObj = {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|
|
- addCoeItems: function(coeIDs, repId) {
|
|
|
|
|
|
+ addCoeItems: function(coeIDs) {
|
|
var me = this;
|
|
var me = this;
|
|
$.ajax({
|
|
$.ajax({
|
|
type:"POST",
|
|
type:"POST",
|
|
url:"api/getCoeItemsByIDs",
|
|
url:"api/getCoeItemsByIDs",
|
|
- data:{"coeIDs": JSON.stringify(coeIDs), repId: repId},
|
|
|
|
|
|
+ data: {"data": JSON.stringify({"libID": me.libID, "coeIDs": coeIDs})},
|
|
dataType:"json",
|
|
dataType:"json",
|
|
cache:false,
|
|
cache:false,
|
|
timeout:5000,
|
|
timeout:5000,
|
|
@@ -112,7 +110,7 @@ var rationCoeOprObj = {
|
|
for (var i = 0; i < rstArr.length; i++) {
|
|
for (var i = 0; i < rstArr.length; i++) {
|
|
var hasDup = false;
|
|
var hasDup = false;
|
|
for (var j = 0; j < cacheArr.length; j++) {
|
|
for (var j = 0; j < cacheArr.length; j++) {
|
|
- if (cacheArr[j].ID == rstArr[i].ID) {
|
|
|
|
|
|
+ if (cacheArr[j] == rstArr[i]) {
|
|
hasDup = true;
|
|
hasDup = true;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -123,8 +121,8 @@ var rationCoeOprObj = {
|
|
}
|
|
}
|
|
cacheArr.sort(function(a, b) {
|
|
cacheArr.sort(function(a, b) {
|
|
var rst = 0;
|
|
var rst = 0;
|
|
- if (a.ID > b.ID) rst = 1
|
|
|
|
- else if (a.ID < b.ID) rst = -1;
|
|
|
|
|
|
+ if (a > b) rst = 1
|
|
|
|
+ else if (a < b) rst = -1;
|
|
return rst;
|
|
return rst;
|
|
});
|
|
});
|
|
me.cache["_Coe_" + me.currentRationItem.ID] = cacheArr.concat(newAddArr);
|
|
me.cache["_Coe_" + me.currentRationItem.ID] = cacheArr.concat(newAddArr);
|
|
@@ -145,18 +143,18 @@ var rationCoeOprObj = {
|
|
updateRationItem: function() {
|
|
updateRationItem: function() {
|
|
var me = this, updateArr = [];
|
|
var me = this, updateArr = [];
|
|
if (me.currentRationItem) {
|
|
if (me.currentRationItem) {
|
|
- me.currentRationItem.rationCoeList = me.buildRationItemCoe();
|
|
|
|
|
|
+ me.currentRationItem.rationCoeList = me.getCoeIDsArr();
|
|
updateArr.push(me.currentRationItem);
|
|
updateArr.push(me.currentRationItem);
|
|
rationOprObj.mixUpdateRequest(updateArr, [], []);
|
|
rationOprObj.mixUpdateRequest(updateArr, [], []);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|
|
- buildRationItemCoe: function(){
|
|
|
|
|
|
+ getCoeIDsArr: function(){
|
|
var me = this, rst = [];
|
|
var me = this, rst = [];
|
|
if (me.currentRationItem && me.cache["_Coe_" + me.currentRationItem.ID]) {
|
|
if (me.currentRationItem && me.cache["_Coe_" + me.currentRationItem.ID]) {
|
|
var cacheArr = me.cache["_Coe_" + me.currentRationItem.ID];
|
|
var cacheArr = me.cache["_Coe_" + me.currentRationItem.ID];
|
|
for (var i = 0; i < cacheArr.length; i++) {
|
|
for (var i = 0; i < cacheArr.length; i++) {
|
|
- rst.push({ID: cacheArr[i].ID});
|
|
|
|
|
|
+ rst.push(cacheArr[i].ID);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return rst;
|
|
return rst;
|
|
@@ -180,10 +178,8 @@ var rationCoeOprObj = {
|
|
timeout:5000,
|
|
timeout:5000,
|
|
success:function(result){
|
|
success:function(result){
|
|
sheetCommonObj.cleanSheet(me.workBook.getSheet(0), me.setting, -1);
|
|
sheetCommonObj.cleanSheet(me.workBook.getSheet(0), me.setting, -1);
|
|
- if (result) {
|
|
|
|
- alert(JSON.stringify(result.data));
|
|
|
|
- alert(JSON.stringify(rationCoeList));
|
|
|
|
|
|
|
|
|
|
+ if (result.data) {
|
|
var cacheArr = [];
|
|
var cacheArr = [];
|
|
for (var i = 0; i < result.data.length; i++) {
|
|
for (var i = 0; i < result.data.length; i++) {
|
|
for (var j = 0; j < rationCoeList.length; j++) {
|
|
for (var j = 0; j < rationCoeList.length; j++) {
|
|
@@ -193,7 +189,6 @@ var rationCoeOprObj = {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
- alert(JSON.stringify(cacheArr));
|
|
|
|
me.cache["_Coe_" + rationID] = cacheArr;
|
|
me.cache["_Coe_" + rationID] = cacheArr;
|
|
me.showCoeItems(rationID);
|
|
me.showCoeItems(rationID);
|
|
}
|
|
}
|