|
@@ -812,10 +812,10 @@ const pmShare = (function () {
|
|
|
return !(selected && selected.data.allowCopy && selected.data.projType === projectType.project);
|
|
|
},
|
|
|
callback: function (key, opt) {
|
|
|
- if($(".p-title").text().includes('免费')){
|
|
|
+ /* if($(".p-title").text().includes('免费')){
|
|
|
hintBox.versionBox('此功能仅在专业版中提供,免费版可选择单位工程进行拷贝');
|
|
|
return;
|
|
|
- }
|
|
|
+ } */
|
|
|
copyContructionProject(tree.selected);
|
|
|
}
|
|
|
},
|
|
@@ -965,18 +965,19 @@ const pmShare = (function () {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+ let projectQueryResult = [];
|
|
|
//拷贝分享的建设项目
|
|
|
//@param {Object}selected
|
|
|
- async function copyContructionProject(selected){
|
|
|
+ async function copyContructionProject(selected, rename){
|
|
|
try {
|
|
|
- let newName = getCopyName(selected);
|
|
|
+ let newName = rename ? rename : getCopyName(selected);
|
|
|
//获取单项工程的单位工程
|
|
|
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){
|
|
|
- alert("已存在此建设项目");
|
|
|
+ $("#share-rename-dialog").modal('show');
|
|
|
+ $("#share-rename-input").val(newName);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
@@ -1007,7 +1008,7 @@ const pmShare = (function () {
|
|
|
node = node.parent;
|
|
|
userInfo = node.data.userInfo;
|
|
|
}
|
|
|
- return `${orgName} (${userInfo.name}分享拷贝)`;
|
|
|
+ return `${orgName}`;
|
|
|
}
|
|
|
//清除了该节点后,可能还有该节点的数据在树上(树允许有重复数据),需要更新分享信息
|
|
|
function updateAfterCancel(userID, projectID) {
|
|
@@ -1184,6 +1185,25 @@ const pmShare = (function () {
|
|
|
$.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 {
|