|
@@ -52,7 +52,6 @@ let regions = [];
|
|
|
function isDef(v) {
|
|
|
return typeof v !== 'undefined' && v !== null;
|
|
|
}
|
|
|
-
|
|
|
let keyupTime = 0,
|
|
|
delayTime = 500;
|
|
|
function delayKeyup(callback) {
|
|
@@ -1698,7 +1697,90 @@ function setupRequiredWarn(compilation) {
|
|
|
map[compilation.name] ? $warn.html(map[compilation.name]) : $warn.html('');
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+// 显示最近分享信息
|
|
|
+function showRecentShareInfo() {
|
|
|
+ function getBookListHtml(users) {
|
|
|
+ return users.reduce((acc, user) => {
|
|
|
+ const mobile = user.mobile || '';
|
|
|
+ const realName = user.real_name || '';
|
|
|
+ const company = user.company || '';
|
|
|
+ // 手机最后一位
|
|
|
+ const lastMobileNumer = mobile.substring(mobile.length - 1);
|
|
|
+ // 显示名称为真实名称后两位
|
|
|
+ const nickName = realName.substring(realName.length - 2);
|
|
|
+ return acc +
|
|
|
+ `<li>
|
|
|
+ <span class="avatar bg-${lastMobileNumer}">${nickName}</span>
|
|
|
+ <div class="book-body">
|
|
|
+ <h5 class="mt-0" title="${company}">${realName}</h5>
|
|
|
+ <span class="mobile-info">${mobile}</span>
|
|
|
+ </div>
|
|
|
+ </li>`;
|
|
|
+ }, '');
|
|
|
+
|
|
|
+ }
|
|
|
+ $.bootstrapLoading.start();
|
|
|
+ CommonAjax.post('/pm/api/getRecentShareInfo', {user_id: userID, count: 5}, (data) => {
|
|
|
+ const recentHtml = getBookListHtml(data.recentUsers);
|
|
|
+ // 联系人按拼英首字母降序排序
|
|
|
+ data.contacts.sort((a, b) => {
|
|
|
+ const realNameA = a.real_name || '';
|
|
|
+ const realNameB = b.real_name || '';
|
|
|
+ return realNameA.localeCompare(realNameB, 'zh-Hans-CN', {sensitivity: 'accent'})
|
|
|
+ });
|
|
|
+ const contactsHtml = getBookListHtml(data.contacts);
|
|
|
+ $('#recentList').html(recentHtml);
|
|
|
+ $('#contactsList').html(contactsHtml);
|
|
|
+ $('#myTabContent ul li').click(function () {
|
|
|
+ const mobile = $(this).find('.mobile-info')[0].textContent;
|
|
|
+ $('#sharePhone').val(mobile);
|
|
|
+ shareTender();
|
|
|
+ const $subMenu = $('#shareSubMenu');
|
|
|
+ const subMenu = $subMenu[0];
|
|
|
+ $(subMenu.parentElement).removeClass('show');
|
|
|
+ $subMenu.removeClass('show');
|
|
|
+ });
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ }, () => {
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
$(document).ready(function() {
|
|
|
+ // 最近分享、联系人列表相关
|
|
|
+ $('body').click(function (e) {
|
|
|
+ const body = $(this)[0];
|
|
|
+ const $subMenu = $('#shareSubMenu');
|
|
|
+ const subMenu = $subMenu[0];
|
|
|
+ const menuBook = $('#dropdownMenuBook')[0]
|
|
|
+ if (!$subMenu.is(':visible')) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let target = e.target;
|
|
|
+ while (target !== body) {
|
|
|
+ if ([subMenu, menuBook].includes(target)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ target = target.parentElement;
|
|
|
+ }
|
|
|
+ $(subMenu.parentElement).removeClass('show');
|
|
|
+ $subMenu.removeClass('show');
|
|
|
+ });
|
|
|
+ // 最近分享、联系人列表相关
|
|
|
+ $('#dropdownMenuBook').click(function () {
|
|
|
+ const $subMenu = $('#shareSubMenu');
|
|
|
+ const visible = $subMenu.is(':visible');
|
|
|
+ if (visible) {
|
|
|
+ $(this).parent().removeClass('show');
|
|
|
+ $subMenu.removeClass('show');
|
|
|
+ } else {
|
|
|
+ $(this).parent().addClass('show');
|
|
|
+ $subMenu.addClass('show');
|
|
|
+ showRecentShareInfo();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
// 单位工程超限提示后,弹出客服列表
|
|
|
$('#hintBox_form').on('hide.bs.modal', function () {
|
|
|
const text = $('#hintBox_caption').text();
|
|
@@ -3101,7 +3183,7 @@ function AddTenderItems(selected, projName, engName, tenderName, property, callb
|
|
|
projID, {updateType: 'new', projectType: projectType.project});
|
|
|
let updateEng = {updateType: 'new', updateData: {ID: engID, ParentID: projID, NextSiblingID: -1, name: engName, projType: projectType.engineering}};
|
|
|
property.rootProjectID = projID;
|
|
|
- let updateTender = {updateType: 'new', updateData: {ID: tenderID, ParentID: engID, NextSiblingID: -1, shareInfo: [], name: tenderName, projType: projectType.tender, property: property}};
|
|
|
+ let updateTender = {updateType: 'new', updateData: {ID: tenderID, ParentID: engID, NextSiblingID: -1, name: tenderName, projType: projectType.tender, property: property}};
|
|
|
updateDatas = updateDatas.concat(updateProjs);
|
|
|
updateDatas.push(updateEng);
|
|
|
updateDatas.push(updateTender);
|
|
@@ -3109,6 +3191,7 @@ function AddTenderItems(selected, projName, engName, tenderName, property, callb
|
|
|
let projData, engData, tenderData;
|
|
|
datas.forEach(function (data) {
|
|
|
if (data.updateType === 'new') {
|
|
|
+ data.updateData.shareInfo = [];
|
|
|
setInitSummaryData(data.updateData);
|
|
|
if(data.updateData.projType === projectType.project){
|
|
|
projData = data.updateData;
|
|
@@ -3136,7 +3219,7 @@ function AddTenderItems(selected, projName, engName, tenderName, property, callb
|
|
|
let next = null;
|
|
|
let updateEng = {updateType: 'new', updateData: {ID: engID, ParentID: tempProj.data.ID, NextSiblingID: -1, name: engName, projType: projectType.engineering}};
|
|
|
property.rootProjectID = tempProj.data.ID;
|
|
|
- let updateTender = {updateType: 'new', updateData: {ID: tenderID, ParentID: engID, NextSiblingID: -1, shareInfo: [], name: tenderName, projType: projectType.tender, property: property}};
|
|
|
+ let updateTender = {updateType: 'new', updateData: {ID: tenderID, ParentID: engID, NextSiblingID: -1, name: tenderName, projType: projectType.tender, property: property}};
|
|
|
if(selected && selected.data.projType === projectType.engineering && selected.parent === tempProj){
|
|
|
pre = selected;
|
|
|
next = selected.nextSibling;
|
|
@@ -3151,6 +3234,7 @@ function AddTenderItems(selected, projName, engName, tenderName, property, callb
|
|
|
let engData, tenderData;
|
|
|
datas.forEach(function (data) {
|
|
|
if (data.updateType === 'new') {
|
|
|
+ data.updateData.shareInfo = [];
|
|
|
setInitSummaryData(data.updateData);
|
|
|
if(data.updateData.projType === projectType.engineering){
|
|
|
engData = data.updateData;
|
|
@@ -3172,7 +3256,7 @@ function AddTenderItems(selected, projName, engName, tenderName, property, callb
|
|
|
let tenderID = IDs.lowID;
|
|
|
let pre = tempEng.lastChild();
|
|
|
property.rootProjectID = tempProj.data.ID;
|
|
|
- let updateTender = {updateType: 'new', updateData: {ID: tenderID, ParentID: tempEng.id(), NextSiblingID: -1, shareInfo: [], name: tenderName, projType: projectType.tender, property: property}};
|
|
|
+ let updateTender = {updateType: 'new', updateData: {ID: tenderID, ParentID: tempEng.id(), NextSiblingID: -1, name: tenderName, projType: projectType.tender, property: property}};
|
|
|
updateDatas.push(updateTender);
|
|
|
if(pre){
|
|
|
updateDatas.push({updateType: 'update', updateData: {ID: pre.id(), NextSiblingID: tenderID}});
|
|
@@ -3180,6 +3264,7 @@ function AddTenderItems(selected, projName, engName, tenderName, property, callb
|
|
|
UpdateProjectData(updateDatas, function (datas) {
|
|
|
datas.forEach(function (data) {
|
|
|
if(data.updateType === 'new') {
|
|
|
+ data.updateData.shareInfo = [];
|
|
|
setInitSummaryData(data.updateData);
|
|
|
data.updateData.feeStandardName = data.updateData.property.feeStandardName || '';
|
|
|
projTreeObj.insert(data.updateData, tempEng, null);
|
|
@@ -3220,6 +3305,7 @@ function AddChildrenItem(selected, name, property, type, existCallback, sucCallb
|
|
|
UpdateProjectData(updateData, function(datas){
|
|
|
datas.forEach(function (data) {
|
|
|
if (data.updateType === 'new') {
|
|
|
+ data.updateData.shareInfo = [];
|
|
|
setInitSummaryData(data.updateData);
|
|
|
projTreeObj.insert(data.updateData, parent, null);
|
|
|
}
|
|
@@ -3258,6 +3344,7 @@ function AddSiblingsItem(selected, name, property, type, existCallback, sucCallb
|
|
|
UpdateProjectData(updateData, function(datas){
|
|
|
datas.forEach(function (data) {
|
|
|
if (data.updateType === 'new') {
|
|
|
+ data.updateData.shareInfo = [];
|
|
|
setInitSummaryData(data.updateData);
|
|
|
projTreeObj.insert(data.updateData, parent, next);
|
|
|
}
|
|
@@ -4606,8 +4693,8 @@ function shareTender(){
|
|
|
coopInput.prop('checked', false);
|
|
|
userInfo.show();
|
|
|
//判断项目是否已经分享
|
|
|
- CommonAjax.post('/pm/api/getProjectShareInfo', {user_id: userID, projectID: shareSeleted.data.ID}, function (rstData) {
|
|
|
- for(let shareData of rstData.shareInfo){
|
|
|
+ CommonAjax.post('/pm/api/getProjectShareInfo', {user_id: userID, projectID: shareSeleted.data.ID}, function (shareInfo) {
|
|
|
+ for(let shareData of shareInfo){
|
|
|
if(shareData.userID === userData._id){
|
|
|
setDangerInfo(hintInfo, '已与该用户分享。', true);
|
|
|
return;
|
|
@@ -4649,7 +4736,7 @@ $('#share-confirm').click(function(){
|
|
|
<td style="width: 90px;"><input value="allowCopy" ${allowCopy ? 'checked' : ''} type="checkbox"></td>
|
|
|
<td style="width: 90px;"><input value="allowCooperate" ${allowCoop ? 'checked' : ''} type="checkbox"></td>
|
|
|
<td style="width: 90px;"><input value="cancelShare" type="checkbox"></td>
|
|
|
- </tr>`);
|
|
|
+ </tr>`);
|
|
|
let tbodyTotalHeight = $('#shareToInfo').height() + perHeight > 200 ? 200 : $('#shareToInfo').height() + perHeight;
|
|
|
$('#shareToInfo').height(tbodyTotalHeight);
|
|
|
$('#shareToInfo').append($tr);
|
|
@@ -4807,28 +4894,28 @@ function setShareToModal(selected){
|
|
|
let infoArr = [];
|
|
|
//居中style="width: 90px;text-align: center"
|
|
|
let theadHtml = `<tr>
|
|
|
- <th style="width: 112px;">姓名</th>
|
|
|
- <th style="width: 165px;">公司</th>
|
|
|
- <th style="width: 136px;">手机</th>
|
|
|
- <th style="width: 136px;">邮箱</th>
|
|
|
- <th style="width: 90px;">允许拷贝</th>
|
|
|
- <th style="width: 90px;">允许编辑</th>
|
|
|
- <th style="width: 90px;">取消分享</th>
|
|
|
- </tr>`;
|
|
|
+ <th style="width: 112px;">姓名</th>
|
|
|
+ <th style="width: 165px;">公司</th>
|
|
|
+ <th style="width: 136px;">手机</th>
|
|
|
+ <th style="width: 136px;">邮箱</th>
|
|
|
+ <th style="width: 90px;">允许拷贝</th>
|
|
|
+ <th style="width: 90px;">允许编辑</th>
|
|
|
+ <th style="width: 90px;">取消分享</th>
|
|
|
+ </tr>`;
|
|
|
infoArr.push(theadHtml);
|
|
|
for(let user of selected.data.shareInfo){
|
|
|
if (!user.exist) {
|
|
|
continue;
|
|
|
}
|
|
|
let infoHtml = `<tr>
|
|
|
- <td style="width: 112px;">${user.name}</td>
|
|
|
- <td style="width: 165px;">${user.company}</td>
|
|
|
- <td style="width: 136px;">${user.mobile}</td>
|
|
|
- <td style="width: 160px;">${user.email}</td>
|
|
|
- <td style="width: 90px;"><input value="allowCopy" ${user.allowCopy ? 'checked' : ''} type="checkbox"></td>
|
|
|
- <td style="width: 90px;"><input value="allowCooperate" ${user.allowCooperate ? 'checked' : ''} type="checkbox"></td>
|
|
|
- <td style="width: 90px;"><input value="cancelShare" type="checkbox"></td>
|
|
|
- </tr>`;
|
|
|
+ <td style="width: 112px;">${user.name}</td>
|
|
|
+ <td style="width: 165px;">${user.company}</td>
|
|
|
+ <td style="width: 136px;">${user.mobile}</td>
|
|
|
+ <td style="width: 160px;">${user.email}</td>
|
|
|
+ <td style="width: 90px;"><input value="allowCopy" ${user.allowCopy ? 'checked' : ''} type="checkbox"></td>
|
|
|
+ <td style="width: 90px;"><input value="allowCooperate" ${user.allowCooperate ? 'checked' : ''} type="checkbox"></td>
|
|
|
+ <td style="width: 90px;"><input value="cancelShare" type="checkbox"></td>
|
|
|
+ </tr>`;
|
|
|
infoArr.push(infoHtml);
|
|
|
}
|
|
|
let tbodyTotalHeight = infoArr.length * perHeight + 5 > 200 ? 200 : infoArr.length * perHeight + 5;
|
|
@@ -4871,6 +4958,7 @@ function updateShareInfo(selected){
|
|
|
}
|
|
|
let newShareInfo = [],
|
|
|
orgShareInfo = [];
|
|
|
+ const postData = [];
|
|
|
//数据不同才提交
|
|
|
for (let shareData of selected.data.shareInfo) {
|
|
|
orgShareInfo.push({userID: shareData.userID, allowCopy: shareData.allowCopy, allowCooperate: shareData.allowCooperate})
|
|
@@ -4882,15 +4970,19 @@ function updateShareInfo(selected){
|
|
|
let cancelShare = $(userTr).find('input:eq(2)').prop('checked');
|
|
|
selected.data.shareInfo[i].allowCopy = allowCopy;
|
|
|
selected.data.shareInfo[i].allowCooperate = allowCoop;
|
|
|
- if(!cancelShare){
|
|
|
- //newShareInfo.push(selected.data.shareInfo[i]);
|
|
|
- newShareInfo.push({userID: selected.data.shareInfo[i].userID, allowCopy: allowCopy, allowCooperate: allowCoop});
|
|
|
+ let shareItem;
|
|
|
+ if(cancelShare){
|
|
|
+ shareItem = {userID: selected.data.shareInfo[i].userID, isCancel: true};
|
|
|
+ } else {
|
|
|
+ shareItem = {userID: selected.data.shareInfo[i].userID, allowCopy: allowCopy, allowCooperate: allowCoop};
|
|
|
+ newShareInfo.push(shareItem);
|
|
|
}
|
|
|
+ postData.push(shareItem);
|
|
|
}
|
|
|
if (_.isEqual(newShareInfo, orgShareInfo)) {
|
|
|
return;
|
|
|
}
|
|
|
- CommonAjax.post('/pm/api/share', {user_id: userID, type: 'update', projectID: selected.data.ID, shareData: newShareInfo}, function (shareData) {
|
|
|
+ CommonAjax.post('/pm/api/share', {user_id: userID, type: 'update', projectID: selected.data.ID, shareData: postData}, function (shareData) {
|
|
|
selected.data.shareInfo = shareData;
|
|
|
let sheet = projTreeObj.workBook.getSheet(0);
|
|
|
projTreeObj.renderSheetFuc(sheet, function () {
|
|
@@ -4898,15 +4990,6 @@ function updateShareInfo(selected){
|
|
|
sheet.repaint();
|
|
|
});
|
|
|
});
|
|
|
- /*CommonAjax.post('/pm/api/updateProjects', {user_id: userID, updateData: [{updateType: 'update', updateData: {ID: selected.data.ID, shareInfo: newShareInfo}}]}, function () {
|
|
|
- //todo 更新
|
|
|
- selected.data.shareInfo = newShareInfo;
|
|
|
- let sheet = projTreeObj.workBook.getSheet(0);
|
|
|
- projTreeObj.renderSheetFuc(sheet, function () {
|
|
|
- sheet.invalidateLayout();
|
|
|
- sheet.repaint();
|
|
|
- });
|
|
|
- });*/
|
|
|
}
|
|
|
|
|
|
//刷新建设项目汇总金额信息
|