/**
* Created by Mai on 2017/6/21.
*/
var projectInfoObj = {
// 头部同时编辑的用户头像
handleAvatarList: function (users) {
const opener = projectObj.project.projectInfo.opener;
if (opener) {
users = users.filter(user => user._id !== opener._id);
}
const avatarListHtml = users.reduce((acc, user) => {
const avatarSpan = SHARE_TO.getAvatarHTML(user.mobile, user.real_name);
const li =
`
${avatarSpan}
`
return acc += li;
}, '');
$('#avatar-list').html(avatarListHtml);
$('#avatar-list [data-toggle="tooltip"]').tooltip();
},
getReceiveInfo: function (projectReadOnly, projectCooperate, owner) {
if (!projectReadOnly && !projectCooperate) {
return '';
}
const action = projectCooperate ? '可编辑' : '只能查看';
const ownerName = owner && owner.real_name || '';
const dropdownMenu = allowCopy?`
`:"";
return `
${action}
${dropdownMenu}
`;
},
getShareButton: function (projectReadOnly, projectCooperate, shareTip) {
if (projectReadOnly || projectCooperate) {
return '';
}
return `
分享
`;
},
getFullPathHtml: function (proj) {
let fullPath = [], i, pm = '项目管理', angleRight = '';
if (proj) {
let pathArr = proj.fullPath;
let engName = pathArr[pathArr.length - 2] || '',
projectName = pathArr[pathArr.length - 3] || '',
folderName = pathArr[pathArr.length - 4] || '';
const receiveInfo = this.getReceiveInfo(projectReadOnly, projectCooperate, proj.owner);
const shareButton = this.getShareButton(projectReadOnly, projectCooperate, proj.shareTip);
let newHtml = ` ...
\
...
\
...
\
${proj.name}
${receiveInfo}${shareButton}
`;
fullPath.push(newHtml);
fullPath.push(``);
}
return fullPath.join('');
},
showProjectInfo: function (data) {
if (data) {
$('#tzCharacterText').prop('readonly', projectObj.project.projectInfo.property.lockBills);
// 清单子界面的模块:清单指引、清单精灵
for (let billsGuidanceLib of data.engineeringInfo.billsGuidance_lib) {
BillsSub.switchModule(billsGuidanceLib.type);
}
//init decimal
setDecimal(decimalObj, data.property.decimal);
billsQuanDecimal.datas = data.property.billsQuantityDecimal || [billsDecimalView.angleDecimal];
basicInfoView.orgDatas = data.property.basicInformation ? basicInfoView.toViewDatas(data.property.basicInformation) : [];
projFeatureView.orgDatas = data.property.projectFeature ? projFeatureView.toViewDatas(data.property.projectFeature) : [];
$('#fullpath').html(this.getFullPathHtml(data));
// 分享给
$('#init-share').click(() => {
SHARE_TO.initModal(SHARE_TO.Mode.PROJECT, projectObj.project.ID());
$('#share-tip').tooltip('hide');
});
SHARE_TO.handleEventListener();
$("[data-toggle='tooltip']").tooltip();
}
}
};