|
@@ -3,32 +3,6 @@
|
|
|
*/
|
|
|
$(document).ready(function () {
|
|
|
var tempType = 3;
|
|
|
- var PostData = function (url, data, successCallback, errorCallback) {
|
|
|
- $.ajax({
|
|
|
- type:"POST",
|
|
|
- url: url,
|
|
|
- data: {'data': JSON.stringify(data)},
|
|
|
- dataType: 'json',
|
|
|
- cache: false,
|
|
|
- timeout: 50000,
|
|
|
- success: function(result){
|
|
|
- if (result.error === 0) {
|
|
|
- successCallback(result.data);
|
|
|
- } else {
|
|
|
- alert('error: ' + result.message);
|
|
|
- if (errorCallback) {
|
|
|
- errorCallback();
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- error: function(jqXHR, textStatus, errorThrown){
|
|
|
- alert('error ' + textStatus + " " + errorThrown);
|
|
|
- if (errorCallback) {
|
|
|
- errorCallback();
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- };
|
|
|
var FormatUpdateData = function (data) {
|
|
|
var updateData = {};
|
|
|
updateData['user_id'] = userID;
|
|
@@ -69,26 +43,32 @@ $(document).ready(function () {
|
|
|
|
|
|
billsSpread.options.tabStripVisible = false;
|
|
|
billsSpread.options.scrollbarMaxAlign = true;
|
|
|
+ billsSpread.options.cutCopyIndicatorVisible = false;
|
|
|
+ billsSpread.options.allowCopyPasteExcelStyle = false;
|
|
|
controller.bind('refreshBaseActn', RefreshBaseActn);
|
|
|
|
|
|
billsSpread.bind(GC.Spread.Sheets.Events.EditEnded, function (sender, info) {
|
|
|
- var node = controller.tree.findNode(info.sheet.getTag(info.row, info.col));
|
|
|
+ var node = controller.tree.items[info.row];
|
|
|
var fieldName = controller.setting.cols[info.col].data.field;
|
|
|
var data = {type: 'update', data: {ID: node.getID()}};
|
|
|
data.data[fieldName] = info.editingText;
|
|
|
var updateData = FormatUpdateData([data]);
|
|
|
- PostData('/template/bills/updateBillsTemplate', updateData, function (data) {
|
|
|
+ CommonAjax.post('/template/bills/updateBillsTemplate', updateData, function (data) {
|
|
|
node.data[fieldName] = info.editingText;
|
|
|
controller.refreshTreeNode([node], false);
|
|
|
}, function () {
|
|
|
controller.refreshTreeNode([node], false);
|
|
|
});
|
|
|
});
|
|
|
+ billsSpread.bind(GC.Spread.Sheets.Events.ClipboardPasting, function (sender, args) {
|
|
|
+ console.log("ClipboardPasting");
|
|
|
+ });
|
|
|
billsSpread.bind(GC.Spread.Sheets.Events.ClipboardPasted, function (e, info) {
|
|
|
+ console.log("ClipboardPasted");
|
|
|
var node, iRow, iCol, curRow, curCol, datas = [], data, fieldName, updateData;
|
|
|
for (iRow = 0; iRow < info.cellRange.rowCount; iRow ++) {
|
|
|
curRow = info.cellRange.row + iRow;
|
|
|
- node = controller.tree.findNode(info.sheet.getTag(curRow, 0));
|
|
|
+ node = controller.tree.items[curRow];
|
|
|
if (node) {
|
|
|
data = {type: 'update', data: {ID: node.getID()}};
|
|
|
for (iCol = 0; iCol < info.cellRange.colCount; iCol++) {
|
|
@@ -99,15 +79,15 @@ $(document).ready(function () {
|
|
|
datas.push(data);
|
|
|
}
|
|
|
};
|
|
|
- PostData('/template/bills/updateBillsTemplate', FormatUpdateData(datas), function (data) {
|
|
|
+ CommonAjax.post('/template/bills/updateBillsTemplate', FormatUpdateData(datas), function (data) {
|
|
|
RefreshBillsData(data);
|
|
|
controller.showTreeData();
|
|
|
}, function () {
|
|
|
controller.showTreeData();
|
|
|
- })
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
- PostData('/template/bills/getBillsTemplate', {tempType: tempType}, function (data) {
|
|
|
+ CommonAjax.post('/template/bills/getBillsTemplate', {tempType: tempType}, function (data) {
|
|
|
bills = data;
|
|
|
tree.loadDatas(bills);
|
|
|
controller.showTreeData();
|
|
@@ -118,7 +98,7 @@ $(document).ready(function () {
|
|
|
});
|
|
|
|
|
|
$('#insert').click(function () {
|
|
|
- PostData('/template/bills/getNewBillsTemplateID', {count: 1}, function (data) {
|
|
|
+ CommonAjax.post('/template/bills/getNewBillsTemplateID', {count: 1}, function (data) {
|
|
|
var selected = controller.tree.selected, updateData;
|
|
|
controller.tree.maxNodeID(data.lowID - 1);
|
|
|
controller.tree.rangeNodeID(data.highID);
|
|
@@ -142,7 +122,7 @@ $(document).ready(function () {
|
|
|
var selected = controller.tree.selected, updateData;
|
|
|
if (selected) {
|
|
|
updateData = FormatUpdateData(controller.tree.getDeleteData(selected));
|
|
|
- PostData('/template/bills/updateBillsTemplate', updateData, function (data) {
|
|
|
+ CommonAjax.post('/template/bills/updateBillsTemplate', updateData, function (data) {
|
|
|
controller.delete();
|
|
|
RefreshBillsData(data);
|
|
|
controller.showTreeData();
|
|
@@ -153,7 +133,7 @@ $(document).ready(function () {
|
|
|
var selected = controller.tree.selected, updateData;
|
|
|
if (selected) {
|
|
|
updateData = FormatUpdateData(selected.getUpLevelData());
|
|
|
- PostData('/template/bills/updateBillsTemplate', updateData, function (data) {
|
|
|
+ CommonAjax.post('/template/bills/updateBillsTemplate', updateData, function (data) {
|
|
|
controller.upLevel();
|
|
|
RefreshBillsData(data);
|
|
|
controller.showTreeData();
|
|
@@ -164,7 +144,7 @@ $(document).ready(function () {
|
|
|
var selected = controller.tree.selected, updateData;
|
|
|
if (selected) {
|
|
|
updateData = FormatUpdateData(selected.getDownLevelData());
|
|
|
- PostData('/template/bills/updateBillsTemplate', updateData, function (data) {
|
|
|
+ CommonAjax.post('/template/bills/updateBillsTemplate', updateData, function (data) {
|
|
|
controller.downLevel();
|
|
|
RefreshBillsData(data);
|
|
|
controller.showTreeData();
|
|
@@ -175,7 +155,7 @@ $(document).ready(function () {
|
|
|
var selected = controller.tree.selected, updateData;
|
|
|
if (selected) {
|
|
|
updateData = FormatUpdateData(selected.getUpMoveData());
|
|
|
- PostData('/template/bills/updateBillsTemplate', updateData, function (data) {
|
|
|
+ CommonAjax.post('/template/bills/updateBillsTemplate', updateData, function (data) {
|
|
|
controller.upMove();
|
|
|
RefreshBillsData(data);
|
|
|
controller.showTreeData();
|
|
@@ -186,7 +166,7 @@ $(document).ready(function () {
|
|
|
var selected = controller.tree.selected, updateData;
|
|
|
if (selected) {
|
|
|
updateData = FormatUpdateData(selected.getDownMoveData());
|
|
|
- PostData('/template/bills/updateBillsTemplate', updateData, function (data) {
|
|
|
+ CommonAjax.post('/template/bills/updateBillsTemplate', updateData, function (data) {
|
|
|
controller.downMove();
|
|
|
RefreshBillsData(data);
|
|
|
controller.showTreeData();
|