|
@@ -35,9 +35,6 @@ let taxTypeMap = {
|
|
|
* */
|
|
|
let regions = [];
|
|
|
|
|
|
-//分享用户列表
|
|
|
-let shareUsers = [];
|
|
|
-
|
|
|
function isDef(v) {
|
|
|
return typeof v !== 'undefined' && v !== null;
|
|
|
}
|
|
@@ -308,9 +305,11 @@ const projTreeObj = {
|
|
|
//return !(selectedItem && selectedItem.data.projType === projectType.tender);
|
|
|
},
|
|
|
callback: function (key, opt) {
|
|
|
+ let selected = projTreeObj.tree.selected;
|
|
|
$('#sharePhone').val('');
|
|
|
$('#share-info').hide();
|
|
|
- $('#share').find('.card').hide();
|
|
|
+ $('#shareFindDiv').hide();
|
|
|
+ setShareToModal(selected);
|
|
|
$('#share').modal('show');
|
|
|
//默认允许拷贝
|
|
|
$('#allowCopy').prop('checked', true);
|
|
@@ -3321,9 +3320,11 @@ function shareTender(){
|
|
|
canShare = false;
|
|
|
let phone = $('#sharePhone').val();
|
|
|
const hintInfo = $('#share-info');
|
|
|
- const userInfo = $('#share').find('.card');
|
|
|
+ const userInfo = $('#shareFindDiv');
|
|
|
const addUser = $('#addShareUser');
|
|
|
const copyInput = $('#allowCopy');
|
|
|
+ const shareConfirm = $('#share-confirm');
|
|
|
+ shareConfirm.addClass('disabled');
|
|
|
//可分享才可添加用户
|
|
|
addUser.addClass('disabled');
|
|
|
if (hintInfo.is(':visible')) {
|
|
@@ -3354,10 +3355,8 @@ function shareTender(){
|
|
|
setDangerInfo(hintInfo, '', false);
|
|
|
$('#user_name').text(userData.real_name ? userData.real_name : '');
|
|
|
$('#user_company').text(userData.company ? userData.company : '');
|
|
|
- let mobileHtml = `<i class="fa fa-tablet"> ${userData.mobile ? userData.mobile : ''}</i>`;
|
|
|
- $('#user_mobile').html(mobileHtml);
|
|
|
- let emailHtml = `<i class="fa fa-envelope-o"> ${userData.email ? userData.email : ''}</i>`;
|
|
|
- $('#user_email').html(emailHtml);
|
|
|
+ $('#user_mobile').text(userData.mobile ? userData.mobile : '');
|
|
|
+ $('#user_email').text(userData.email ? userData.email : '');
|
|
|
//默认可拷贝
|
|
|
copyInput.prop('checked', true);
|
|
|
userInfo.show();
|
|
@@ -3370,6 +3369,7 @@ function shareTender(){
|
|
|
}
|
|
|
}
|
|
|
addUser.removeClass('disabled');
|
|
|
+ shareConfirm.removeClass('disabled');
|
|
|
canShare = true;
|
|
|
});
|
|
|
}
|
|
@@ -3381,127 +3381,43 @@ $('#sharePhone').on('keyup',function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
-//设置确认分享用户列表
|
|
|
-//@param {String}name {String}phone @return {void}
|
|
|
-function setUsersShareDiv(projName, users) {
|
|
|
- //每行的数据
|
|
|
- const perLineCount = 2;
|
|
|
- let $users = $('#shareUsers');
|
|
|
- //三行后限制死高度
|
|
|
- if (Math.ceil(users.length / perLineCount) > 2) {
|
|
|
- $users.height(180);
|
|
|
- } else {
|
|
|
- $users.height('');
|
|
|
- }
|
|
|
- $users.empty();
|
|
|
- let $projInfo = $(`<p>确认分享 <b>${projName}</b> 给</p>`);
|
|
|
- $users.append($projInfo);
|
|
|
- let $preP = null,
|
|
|
- $preH4 = null;
|
|
|
- for (let i = 0; i < users.length; i++) {
|
|
|
- let user = users[i];
|
|
|
- let $span = $(`<span class="badge badge-light mr-3" style="padding: 0">${user.name}(${user.phone})</span>`),
|
|
|
- $a = $(`<a href="javascript:void(0);" userID="${user.userID}" class="text-danger" title="移除分享"></a>`),
|
|
|
- $i = $('<i class="fa fa-remove"></i>');
|
|
|
- bindRemoveShare($a);
|
|
|
- $a.append($i);
|
|
|
- $span.append($a);
|
|
|
- //另起一行
|
|
|
- if (i % 2 === 0) {
|
|
|
- $preP = $('<p>');
|
|
|
- $preH4 = $('<h4>');
|
|
|
- $preH4.append($span);
|
|
|
- $preP.append($preH4);
|
|
|
- $users.append($preP);
|
|
|
- } else {//行内新增元素
|
|
|
- $preH4.append($span);
|
|
|
- $preP.append($preH4);
|
|
|
- }
|
|
|
- }
|
|
|
- if (users.length > 0) {
|
|
|
- $users.show();
|
|
|
- }
|
|
|
- //移除分享列表
|
|
|
- function bindRemoveShare(a){
|
|
|
- a.click(function () {
|
|
|
- let theUserID = a.attr('userID');
|
|
|
- //清除shareUsers数组相关数据
|
|
|
- _.remove(shareUsers, {userID: theUserID});
|
|
|
- a.parent().remove();
|
|
|
- //如果行内只剩一个数据,则删除数据及行
|
|
|
- if (a.parent().parent().children().length === 0) {
|
|
|
- a.parent().parent().remove();
|
|
|
- }
|
|
|
- //如果所用用户数据只剩这一条,删除用户数据则隐藏分享用户列表容器
|
|
|
- if (shareUsers.length === 0) {
|
|
|
- $('#shareUsers').hide();
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
-//添加分享用户
|
|
|
-$('#addShareUser').click(function () {
|
|
|
- //输入有效手机号的用户
|
|
|
- if (shareUserID) {
|
|
|
- const hintInfo = $('#share-info');
|
|
|
- if (_.find(shareUsers, {userID: shareUserID})) {
|
|
|
- setDangerInfo(hintInfo, '已添加此用户');
|
|
|
- return;
|
|
|
- }
|
|
|
- let allowCopy = $('#allowCopy').prop('checked'),
|
|
|
- name = $('#user_name').text(),
|
|
|
- phone = $('#user_mobile').text();
|
|
|
- shareUsers.push({userID: shareUserID, name: name, phone: phone, allowCopy: allowCopy});
|
|
|
- let selected = projTreeObj.tree.selected;
|
|
|
- setUsersShareDiv(selected.data.name, shareUsers);
|
|
|
- if (hintInfo.is(':visible')) {
|
|
|
- hintInfo.hide();
|
|
|
- }
|
|
|
- //搜索的用户信息
|
|
|
- $('#share').find('.card').hide();
|
|
|
- $('#sharePhone').val('');
|
|
|
- $('#sharePhone').focus();
|
|
|
- shareUserID = null;
|
|
|
- }
|
|
|
-});
|
|
|
-$('#share').on('hidden.bs.modal', function () {
|
|
|
- $('#shareUsers').hide();
|
|
|
- shareUsers = []
|
|
|
-});
|
|
|
//确认分享
|
|
|
$('#share-confirm').click(function(){
|
|
|
const hintInfo = $('#share-info');
|
|
|
- if (shareUsers.length === 0) {
|
|
|
- setDangerInfo(hintInfo, '请添加分享');
|
|
|
- return;
|
|
|
- }
|
|
|
- $('#shareUsers').hide();
|
|
|
- $('#share-confirm').addClass('disabled');
|
|
|
$.bootstrapLoading.start();
|
|
|
- let allowCopy = $('#allowCopy').prop('checked');
|
|
|
- let shareData = [];
|
|
|
- for (let userData of shareUsers) {
|
|
|
- shareData.push({userID: userData.userID, allowCopy: userData.allowCopy});
|
|
|
- }
|
|
|
+ let allowCopy = $('#allowCopy').prop('checked'),
|
|
|
+ userName = $('#user_name').text() || '',
|
|
|
+ userCompany = $('#user_company').text() || '',
|
|
|
+ userMobile = $('#user_mobile').text() || '',
|
|
|
+ userEmail = $('#user_email').text() || '';
|
|
|
+ let shareData = [{userID: shareUserID, allowCopy: allowCopy}];
|
|
|
//分享
|
|
|
CommonAjax.post('/pm/api/share', {user_id: userID, type: shareType.create, projectID: shareSeleted.data.ID, shareData: shareData}, function (rstData) {
|
|
|
+ //更新已分享table
|
|
|
+ let $tr = $(`<tr>
|
|
|
+ <td style="width: 112px">${userName}</td>
|
|
|
+ <td style="width: 165px">${userCompany}</td>
|
|
|
+ <td style="width: 136px">${userMobile}</td>
|
|
|
+ <td style="width: 136px">${userEmail}</td>
|
|
|
+ <td style="width: 90px;"><input value="allowCopy" ${allowCopy ? 'checked' : ''} type="checkbox"></td>
|
|
|
+ <td style="width: 90px;"><input value="cancelShare" type="checkbox"></td>
|
|
|
+ </tr>`);
|
|
|
+ $('#shareToInfo').append($tr);
|
|
|
//更新缓存
|
|
|
- if (shareSeleted.data.shareInfo.length === 0) {
|
|
|
+ // if (shareSeleted.data.shareInfo.length === 0) {
|
|
|
shareSeleted.data.shareInfo = shareSeleted.data.shareInfo.concat(shareData);
|
|
|
let sheet = projTreeObj.workBook.getSheet(0);
|
|
|
projTreeObj.renderSheetFuc(sheet, function () {
|
|
|
sheet.invalidateLayout();
|
|
|
sheet.repaint();
|
|
|
});
|
|
|
- }
|
|
|
+ // }
|
|
|
$.bootstrapLoading.end();
|
|
|
- $('#share-confirm').removeClass('disabled');
|
|
|
- $('#share').modal('hide');
|
|
|
+ $('#shareFindDiv').hide();
|
|
|
+ $('#share-confirm').addClass('disabled');
|
|
|
}, function () {
|
|
|
$.bootstrapLoading.end();
|
|
|
$('#share-confirm').removeClass('disabled');
|
|
|
- $('#share').modal('hide');
|
|
|
});
|
|
|
});
|
|
|
//允许拷贝
|
|
@@ -3547,14 +3463,24 @@ 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>
|
|
|
+ </tr>`;
|
|
|
+ infoArr.push(theadHtml);
|
|
|
for(let user of selected.data.shareInfo){
|
|
|
let infoHtml = `<tr>
|
|
|
- <td style="width: 106px;">${user.name}</td>
|
|
|
- <td style="width: 146px;">${user.company}</td>
|
|
|
- <td style="width: 146px;">${user.mobile}</td>
|
|
|
- <td style="width: 156px;">${user.email}</td>
|
|
|
- <td style="width: 70px;text-align: center"><input value="allowCopy" ${user.allowCopy ? 'checked' : ''} type="checkbox"></td>
|
|
|
- <td style="width: 70px;text-align: center"><input value="cancelShare" type="checkbox"></td>
|
|
|
+ <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="cancelShare" type="checkbox"></td>
|
|
|
</tr>`;
|
|
|
infoArr.push(infoHtml);
|
|
|
}
|
|
@@ -3569,6 +3495,9 @@ function updateShareInfo(selected){
|
|
|
return;
|
|
|
}
|
|
|
let usersTr = $('#shareToInfo').find('tr');
|
|
|
+ if (usersTr && usersTr.length > 0) {
|
|
|
+ usersTr = usersTr.slice(1);
|
|
|
+ }
|
|
|
let newShareInfo = [];
|
|
|
for(let i = 0; i < usersTr.length; i++){
|
|
|
let userTr = usersTr[i];
|