|
@@ -130,8 +130,8 @@ var GetPreNodeUpdateData = function (pre, nid) {
|
|
|
var data = {};
|
|
|
data['updateType'] = 'update';
|
|
|
data['updateData'] = {};
|
|
|
- data.updateData[setting.tree.id] = pre.id();
|
|
|
- data.updateData[setting.tree.nid] = nid;
|
|
|
+ data.updateData[Tree.setting.tree.id] = pre.id();
|
|
|
+ data.updateData[Tree.setting.tree.id] = nid;
|
|
|
return data;
|
|
|
}
|
|
|
// 获取新建项目数据
|
|
@@ -218,7 +218,7 @@ var GetDeleteUpdateData = function (node) {
|
|
|
data['updateData'] = {};
|
|
|
data['updateData'][Tree.setting.tree.id] = node.id();
|
|
|
if (node.data.projType === 'Tender') {
|
|
|
- data['updateData']['FullFolder'] = GetfullFolder(node.parent);
|
|
|
+ data['updateData']['FullFolder'] = GetFullFolder(node.parent);
|
|
|
}
|
|
|
return data;
|
|
|
},
|
|
@@ -257,12 +257,13 @@ var GetMoveUpdateData = function (node, parent, next) {
|
|
|
return datas;
|
|
|
};
|
|
|
|
|
|
-var GetCopyUpdateData = function (node, parent, next){
|
|
|
+var GetCopyUpdateData = function (node, parent, next, newId){
|
|
|
var datas = [], updateData, pre;
|
|
|
updateData = {};
|
|
|
- updateData['updateType'] = 'new';
|
|
|
+ updateData['updateType'] = 'copy';
|
|
|
+ updateData['srcProjectId'] = node.id();
|
|
|
updateData['updateData'] = {};
|
|
|
- updateData['updateData'][Tree.setting.tree.id] = node.tree.maxNodeId() + 1;
|
|
|
+ updateData['updateData'][Tree.setting.tree.id] = newId + 1;
|
|
|
updateData['updateData'][Tree.setting.tree.pid] = parent ? parent.id() : -1;
|
|
|
updateData['updateData'][Tree.setting.tree.nid] = next ? next.id() : -1;
|
|
|
updateData['updateData']['name'] = node.data.name;
|
|
@@ -581,7 +582,7 @@ $('#copyto').on('show.bs.modal', function () {
|
|
|
copytoZTree = ConvertTreeToZtree(Tree, $('#treeDemo2'));
|
|
|
});
|
|
|
$('#copytoOk').click(function() {
|
|
|
- var updateData, form = $('#copyto'),
|
|
|
+ var form = $('#copyto'),
|
|
|
target = GetTargetTreeNode($.fn.zTree.getZTreeObj('treeDemo2')),
|
|
|
parent, next, cur = Tree.selected();
|
|
|
if (target && (target.data.projType === 'Tender' || target.children.length === 0 || target.firstChild().data.projType === 'Tender')) {
|
|
@@ -594,13 +595,18 @@ $('#copytoOk').click(function() {
|
|
|
}
|
|
|
|
|
|
if (parent !== cur.parent || (next !== cur && next !== cur.nextSibling)){
|
|
|
- updateData = GetCopyUpdateData(Tree.selected(), parent, next);
|
|
|
- UpdateProjectData(updateData, function (data) {
|
|
|
- form.modal('hide');
|
|
|
- data.forEach(function (nodeData) {
|
|
|
- if (nodeData.updateType === 'new') {
|
|
|
- Tree.addNodeData(nodeData.updateData, parent, next);
|
|
|
- }
|
|
|
+ CommonAjax.post('/getNewProjectID', {count: 1}, function (IDs) {
|
|
|
+ var updateData = GetCopyUpdateData(cur, parent, next, IDs.lowID);
|
|
|
+ Tree.maxNodeId(IDs.lowID - 1);
|
|
|
+ CommonAjax.post('/copyProjects', {user_id: userID, updateData: updateData}, function (data) {
|
|
|
+ form.modal('hide');
|
|
|
+ data.forEach(function (nodeData) {
|
|
|
+ if (nodeData.updateType === 'copy') {
|
|
|
+ Tree.addNodeData(nodeData.updateData, parent, next);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }, function () {
|
|
|
+ form.modal('hide');
|
|
|
});
|
|
|
});
|
|
|
} else {
|