|
@@ -951,17 +951,19 @@ const pmShare = (function () {
|
|
|
alert(err);
|
|
alert(err);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ let projectQueryResult = [];
|
|
|
//拷贝分享的建设项目
|
|
//拷贝分享的建设项目
|
|
|
//@param {Object}selected
|
|
//@param {Object}selected
|
|
|
- async function copyContructionProject(selected){
|
|
|
|
|
|
|
+ async function copyContructionProject(selected, rename){
|
|
|
try {
|
|
try {
|
|
|
- let newName = getCopyName(selected);
|
|
|
|
|
|
|
+ let newName = rename ? rename : getCopyName(selected);
|
|
|
//获取单项工程的单位工程
|
|
//获取单项工程的单位工程
|
|
|
let projectQuery = {$or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], userID: userID,projType: "Project"};
|
|
let projectQuery = {$or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], userID: userID,projType: "Project"};
|
|
|
- const rstData = await ajaxPost('/pm/api/getProjectsByQuery', {user_id: userID, query: projectQuery, options: '-_id -property'}, false, 10000);
|
|
|
|
|
- for(let project of rstData){
|
|
|
|
|
|
|
+ projectQueryResult = await ajaxPost('/pm/api/getProjectsByQuery', {user_id: userID, query: projectQuery, options: '-_id -property'}, false, 10000);
|
|
|
|
|
+ for(let project of projectQueryResult){
|
|
|
if(project.name === newName){
|
|
if(project.name === newName){
|
|
|
- alert("已存在此建设项目");
|
|
|
|
|
|
|
+ $("#share-rename-dialog").modal('show');
|
|
|
|
|
+ $("#share-rename-input").val(newName);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -986,7 +988,7 @@ const pmShare = (function () {
|
|
|
node = node.parent;
|
|
node = node.parent;
|
|
|
userInfo = node.data.userInfo;
|
|
userInfo = node.data.userInfo;
|
|
|
}
|
|
}
|
|
|
- return `${orgName} (${userInfo.name}分享拷贝)`;
|
|
|
|
|
|
|
+ return `${orgName}`;
|
|
|
}
|
|
}
|
|
|
//清除了该节点后,可能还有该节点的数据在树上(树允许有重复数据),需要更新分享信息
|
|
//清除了该节点后,可能还有该节点的数据在树上(树允许有重复数据),需要更新分享信息
|
|
|
function updateAfterCancel(userID, projectID) {
|
|
function updateAfterCancel(userID, projectID) {
|
|
@@ -1112,6 +1114,26 @@ const pmShare = (function () {
|
|
|
$.bootstrapLoading.end();
|
|
$.bootstrapLoading.end();
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
|
|
+ // 拷贝重命名
|
|
|
|
|
+ $('#share-rename-dialog').on('show.bs.modal', () => {
|
|
|
|
|
+ $('#share-rename-info').hide();
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ $('#share-rename-input').focus();
|
|
|
|
|
+ }, 200)
|
|
|
|
|
+ });
|
|
|
|
|
+ $('#share-rename-confirm').click(function () {
|
|
|
|
|
+ const newName = $('#share-rename-input').val().trim();
|
|
|
|
|
+ for(let project of projectQueryResult){
|
|
|
|
|
+ if(project.name === newName){
|
|
|
|
|
+ $('#share-rename-info').text(`已存在 “${newName}”`);
|
|
|
|
|
+ $('#share-rename-info').show();
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $("#share-rename-dialog").modal('hide');
|
|
|
|
|
+ copyContructionProject(tree.selected, newName);
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
return {
|