|
|
@@ -867,7 +867,7 @@ const pmShare = (function () {
|
|
|
}
|
|
|
for (let node of items) {
|
|
|
if (node.children.length === 0) {//project
|
|
|
- rst.push({ ID: node.data.ID, fileHierarchyName: getFileHierarchyName(node) })
|
|
|
+ rst.push({ ID: node.data.ID, fileHierarchyName: getFileHierarchyName(node), valuationType: node.data.property.valuationType || '' })
|
|
|
}
|
|
|
}
|
|
|
return rst;
|
|
|
@@ -877,26 +877,26 @@ const pmShare = (function () {
|
|
|
function setCopyModal() {
|
|
|
//获取建设项目
|
|
|
let projQuery = { $or: [{ deleteInfo: null }, { 'deleteInfo.deleted': false }], projType: { $in: [projectType.project, projectType.folder] }, userID: userID };
|
|
|
- CommonAjax.post('/pm/api/getProjectsByQuery', { user_id: userID, query: projQuery, options: '-_id -property' }, function (rstData) {
|
|
|
+ CommonAjax.post('/pm/api/getProjectsByQuery', { user_id: userID, query: projQuery, options: '-_id' }, function (rstData) {
|
|
|
let fileHierarchyData = getFileHierarchyInfo(rstData);
|
|
|
- $('#copyShare_selectProj').empty();
|
|
|
- for (let proj of fileHierarchyData) {
|
|
|
- let opt = $('<option>').val(proj.ID).text(proj.fileHierarchyName);
|
|
|
- $('#copyShare_selectProj').append(opt);
|
|
|
- }
|
|
|
- //初始选择
|
|
|
- /*if(fileHierarchyData.length > 0){
|
|
|
- setEng(fileHierarchyData[0].ID);
|
|
|
- }*/
|
|
|
+ const html = fileHierarchyData.reduce((acc, proj) =>
|
|
|
+ acc += `<option value="${proj.ID}" data-valuation="${proj.valuationType}">${proj.fileHierarchyName}</option>`
|
|
|
+ , '');
|
|
|
+ $('#copyShare_selectProj').html(html);
|
|
|
});
|
|
|
}
|
|
|
//拷贝分享的工程
|
|
|
//@param {Object}selected {Number}parentID @return {void}
|
|
|
- async function copyShareProject(selected, projID) {
|
|
|
+ async function copyShareProject(selected, projID, projValuationType) {
|
|
|
try {
|
|
|
if (!projID || !selected) {
|
|
|
return;
|
|
|
}
|
|
|
+ // 复制到的目标建设项目项目类型与当前文件项目类型相同才可复制(目标建设项目为空也能复制到,兼容旧项目)
|
|
|
+ const tenderValuationType = selected.data._valuationType || null;
|
|
|
+ if (projValuationType && projValuationType !== tenderValuationType) {
|
|
|
+ return alert('当前分段与目标建设项目的项目类型不同,请选择其他建设项目进行复制。');
|
|
|
+ }
|
|
|
let copyMap = { copy: null, update: null };
|
|
|
let newName = getCopyName(selected);
|
|
|
//获取建设项目的分段
|
|
|
@@ -1095,7 +1095,8 @@ const pmShare = (function () {
|
|
|
$('#copyShareProj-info').show();
|
|
|
return;
|
|
|
}
|
|
|
- copyShareProject(tree.selected, parseInt(selProj));
|
|
|
+ const valuationType = $('#copyShare_selectProj').find('option:selected').data('valuation') || null;
|
|
|
+ copyShareProject(tree.selected, parseInt(selProj), valuationType);
|
|
|
});
|
|
|
//清除分享
|
|
|
$('#cancelShareConfirm').click(function () {
|