|
@@ -35,6 +35,9 @@ let taxTypeMap = {
|
|
* */
|
|
* */
|
|
let regions = [];
|
|
let regions = [];
|
|
|
|
|
|
|
|
+//分享用户列表
|
|
|
|
+let shareUsers = [];
|
|
|
|
+
|
|
function isDef(v) {
|
|
function isDef(v) {
|
|
return typeof v !== 'undefined' && v !== null;
|
|
return typeof v !== 'undefined' && v !== null;
|
|
}
|
|
}
|
|
@@ -317,6 +320,19 @@ const projTreeObj = {
|
|
}, 200);
|
|
}, 200);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ 'cancelShare': {
|
|
|
|
+ name: '取消分享',
|
|
|
|
+ icon: 'fa-ban',
|
|
|
|
+ disabled: function () {
|
|
|
|
+ let selected = projTreeObj.tree.selected;
|
|
|
|
+ return !(selected && selected.data.shareInfo && selected.data.shareInfo.length > 0);
|
|
|
|
+ },
|
|
|
|
+ callback: function () {
|
|
|
|
+ let selected = projTreeObj.tree.selected;
|
|
|
|
+ setShareToModal(selected);
|
|
|
|
+ $('#shareTo').modal('show');
|
|
|
|
+ }
|
|
|
|
+ },
|
|
"spr3": '--------',
|
|
"spr3": '--------',
|
|
"manageFiles": {
|
|
"manageFiles": {
|
|
name: "管理相关文件",
|
|
name: "管理相关文件",
|
|
@@ -655,6 +671,9 @@ const projTreeObj = {
|
|
let halfExpandLength = 3;
|
|
let halfExpandLength = 3;
|
|
let imgWidth = 18;
|
|
let imgWidth = 18;
|
|
let imgHeight = 14;
|
|
let imgHeight = 14;
|
|
|
|
+ let shareImg = document.getElementById('share_pic'),
|
|
|
|
+ shareImgWidth = 18,
|
|
|
|
+ shareImgHeight = 18;
|
|
let TreeNodeCellType = function () {
|
|
let TreeNodeCellType = function () {
|
|
};
|
|
};
|
|
TreeNodeCellType.prototype = new GC.Spread.Sheets.CellTypes.Text();
|
|
TreeNodeCellType.prototype = new GC.Spread.Sheets.CellTypes.Text();
|
|
@@ -745,7 +764,6 @@ const projTreeObj = {
|
|
img = node.data.changeMark && node.data.changeMark!=""? document.getElementById('refresh_pic'):document.getElementById('tender_pic');
|
|
img = node.data.changeMark && node.data.changeMark!=""? document.getElementById('refresh_pic'):document.getElementById('tender_pic');
|
|
imgWidth = 14;
|
|
imgWidth = 14;
|
|
}
|
|
}
|
|
-
|
|
|
|
ctx.drawImage(img, centerX+indent/2+3, centerY - 7, imgWidth,imgHeight);
|
|
ctx.drawImage(img, centerX+indent/2+3, centerY - 7, imgWidth,imgHeight);
|
|
}
|
|
}
|
|
// Draw Vertical Line
|
|
// Draw Vertical Line
|
|
@@ -780,6 +798,11 @@ const projTreeObj = {
|
|
x = x + (node.depth() + 1) * indent + node.depth() * levelIndent + imgWidth + 3;
|
|
x = x + (node.depth() + 1) * indent + node.depth() * levelIndent + imgWidth + 3;
|
|
w = w - (node.depth() + 1) * indent - node.depth() * levelIndent - imgWidth - 3;
|
|
w = w - (node.depth() + 1) * indent - node.depth() * levelIndent - imgWidth - 3;
|
|
GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
|
|
GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
|
|
|
|
+ if (node.data.shareInfo.length > 0) {
|
|
|
|
+ let nowX = Math.floor(x) + w - 20;
|
|
|
|
+ let nowY = Math.floor((y + (y + h)) / 2);
|
|
|
|
+ ctx.drawImage(shareImg, nowX + 3, nowY - 7, shareImgWidth,shareImgHeight);
|
|
|
|
+ }
|
|
};
|
|
};
|
|
TreeNodeCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
|
|
TreeNodeCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
|
|
let info = {x: x, y: y, row: context.row, col: context.col, cellStyle: cellStyle, cellRect: cellRect, sheetArea: context.sheetArea};
|
|
let info = {x: x, y: y, row: context.row, col: context.col, cellStyle: cellStyle, cellRect: cellRect, sheetArea: context.sheetArea};
|
|
@@ -811,30 +834,6 @@ const projTreeObj = {
|
|
return hitinfo.x > centerX + halfBoxLength && hitinfo.x < centerX + halfBoxLength + imgWidth + indent/2+3 + textLength;
|
|
return hitinfo.x > centerX + halfBoxLength && hitinfo.x < centerX + halfBoxLength + imgWidth + indent/2+3 + textLength;
|
|
}
|
|
}
|
|
if(hitinfo.sheet.name() != "copyToSheet"){//如果是复制到sheet,不用执行
|
|
if(hitinfo.sheet.name() != "copyToSheet"){//如果是复制到sheet,不用执行
|
|
- //建设项目,侧滑汇总
|
|
|
|
- /*if(node.data.projType === projectType.project && withingClickArea() && !$('.slide-sidebar').hasClass('open')){
|
|
|
|
- setDataToSideBar();
|
|
|
|
- $(".slide-sidebar").animate({width:"440"}).addClass("open");
|
|
|
|
- setTimeout(function () {
|
|
|
|
- $("body").bind('click', function (event) {
|
|
|
|
- var e = event || window.event; //浏览器兼容性
|
|
|
|
- if (!$(event.target).is('a')) {
|
|
|
|
- var elem = event.target || e.srcElement;
|
|
|
|
- while (elem) { //循环判断至跟节点,防止点击的是div子元素
|
|
|
|
- if (elem.className == "open-sidebar" || elem.className == 'slide-sidebar open') {
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- if($(elem).attr('id') && $(elem).attr('id') === 'del-wj'){
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- elem = elem.parentNode;
|
|
|
|
- }
|
|
|
|
- $(".slide-sidebar").animate({width: "0"}).removeClass("open")// 关闭处理
|
|
|
|
- $('body').unbind('click');
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }, 500);
|
|
|
|
- }*/
|
|
|
|
//单项文件,进入造价书界面
|
|
//单项文件,进入造价书界面
|
|
if(node.data.projType === projectType.tender && withingClickArea()){
|
|
if(node.data.projType === projectType.tender && withingClickArea()){
|
|
let timeoutTime = 200;
|
|
let timeoutTime = 200;
|
|
@@ -3318,6 +3317,13 @@ function shareTender(){
|
|
let phone = $('#sharePhone').val();
|
|
let phone = $('#sharePhone').val();
|
|
const hintInfo = $('#share-info');
|
|
const hintInfo = $('#share-info');
|
|
const userInfo = $('#share').find('.card');
|
|
const userInfo = $('#share').find('.card');
|
|
|
|
+ const addUser = $('#addShareUser');
|
|
|
|
+ const copyInput = $('#allowCopy');
|
|
|
|
+ //可分享才可添加用户
|
|
|
|
+ addUser.addClass('disabled');
|
|
|
|
+ if (hintInfo.is(':visible')) {
|
|
|
|
+ hintInfo.hide();
|
|
|
|
+ }
|
|
if(!phone || phone.trim() === ''){
|
|
if(!phone || phone.trim() === ''){
|
|
setDangerInfo(hintInfo, '请输入手机号码。', true);
|
|
setDangerInfo(hintInfo, '请输入手机号码。', true);
|
|
if(userInfo.is(':visible')){
|
|
if(userInfo.is(':visible')){
|
|
@@ -3347,6 +3353,8 @@ function shareTender(){
|
|
$('#user_mobile').html(mobileHtml);
|
|
$('#user_mobile').html(mobileHtml);
|
|
let emailHtml = `<i class="fa fa-envelope-o"> ${userData.email ? userData.email : ''}</i>`;
|
|
let emailHtml = `<i class="fa fa-envelope-o"> ${userData.email ? userData.email : ''}</i>`;
|
|
$('#user_email').html(emailHtml);
|
|
$('#user_email').html(emailHtml);
|
|
|
|
+ //默认可拷贝
|
|
|
|
+ copyInput.prop('checked', true);
|
|
userInfo.show();
|
|
userInfo.show();
|
|
//判断项目是否已经分享
|
|
//判断项目是否已经分享
|
|
CommonAjax.post('/pm/api/getProjectShareInfo', {user_id: userID, projectID: shareSeleted.data.ID}, function (rstData) {
|
|
CommonAjax.post('/pm/api/getProjectShareInfo', {user_id: userID, projectID: shareSeleted.data.ID}, function (rstData) {
|
|
@@ -3356,6 +3364,7 @@ function shareTender(){
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ addUser.removeClass('disabled');
|
|
canShare = true;
|
|
canShare = true;
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -3366,26 +3375,109 @@ $('#sharePhone').on('keyup',function () {
|
|
shareTender();
|
|
shareTender();
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+//设置确认分享用户列表
|
|
|
|
+//@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(164);
|
|
|
|
+ } 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">${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();
|
|
|
|
+ }
|
|
|
|
+ console.log(shareUsers);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+//添加分享用户
|
|
|
|
+$('#addShareUser').click(function () {
|
|
|
|
+ //输入有效手机号的用户
|
|
|
|
+ if (shareUserID) {
|
|
|
|
+ const hintInfo = $('#share-info');
|
|
|
|
+ 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;
|
|
|
|
+ }
|
|
|
|
+ console.log(`shareUsers`);
|
|
|
|
+ console.log(shareUsers);
|
|
|
|
+});
|
|
//确认分享
|
|
//确认分享
|
|
$('#share-confirm').click(function(){
|
|
$('#share-confirm').click(function(){
|
|
- let phone = $('#sharePhone').val();
|
|
|
|
const hintInfo = $('#share-info');
|
|
const hintInfo = $('#share-info');
|
|
- const userInfo = $('#share').find('.card');
|
|
|
|
- if(!phone || phone.trim() === ''){
|
|
|
|
- setDangerInfo(hintInfo, '请输入手机号码。', true);
|
|
|
|
- if(userInfo.is(':visible')){
|
|
|
|
- userInfo.hide();
|
|
|
|
- }
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- if(!canShare){
|
|
|
|
|
|
+ if (shareUsers.length === 0) {
|
|
|
|
+ setDangerInfo(hintInfo, '请添加分享');
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ $('#shareUsers').hide();
|
|
$('#share-confirm').addClass('disabled');
|
|
$('#share-confirm').addClass('disabled');
|
|
$.bootstrapLoading.start();
|
|
$.bootstrapLoading.start();
|
|
let allowCopy = $('#allowCopy').prop('checked');
|
|
let allowCopy = $('#allowCopy').prop('checked');
|
|
|
|
+ let shareData = [];
|
|
|
|
+ for (let userData of shareUsers) {
|
|
|
|
+ shareData.push({userID: userData.userID, allowCopy: userData.allowCopy});
|
|
|
|
+ }
|
|
//分享
|
|
//分享
|
|
- CommonAjax.post('/pm/api/share', {user_id: userID, type: shareType.create, projectID: shareSeleted.data.ID, userID: shareUserID, allowCopy: allowCopy}, function (rstData) {
|
|
|
|
|
|
+ CommonAjax.post('/pm/api/share', {user_id: userID, type: shareType.create, projectID: shareSeleted.data.ID, shareData: shareData}, function (rstData) {
|
|
|
|
+ //更新缓存
|
|
|
|
+ shareSeleted.data.shareInfo = shareSeleted.data.shareInfo.concat(shareData);
|
|
$.bootstrapLoading.end();
|
|
$.bootstrapLoading.end();
|
|
$('#share-confirm').removeClass('disabled');
|
|
$('#share-confirm').removeClass('disabled');
|
|
$('#share').modal('hide');
|
|
$('#share').modal('hide');
|
|
@@ -3406,6 +3498,80 @@ $('#allowCopy').change(function () {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+//分享给...界面确认
|
|
|
|
+$('#shareToConfirm').click(function () {
|
|
|
|
+ let selected = projTreeObj.tree.selected;
|
|
|
|
+ if (!selected) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ updateShareInfo(selected);
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+//设置分享给界面数据
|
|
|
|
+//@param {Object}selected @return {void}
|
|
|
|
+function setShareToModal(selected){
|
|
|
|
+ $('#shareToInfo').empty();
|
|
|
|
+ if(!selected){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ let userIDs = [];
|
|
|
|
+ for(let user of selected.data.shareInfo){
|
|
|
|
+ userIDs.push(user.userID);
|
|
|
|
+ }
|
|
|
|
+ CommonAjax.post('/user/getUsers', {userIDs: userIDs}, function (rstData) {
|
|
|
|
+ for(let userInfo of rstData){
|
|
|
|
+ for(let user of selected.data.shareInfo){
|
|
|
|
+ if(user.userID === userInfo._id){
|
|
|
|
+ user.name = userInfo.real_name;
|
|
|
|
+ user.company = userInfo.company;
|
|
|
|
+ user.mobile = userInfo.mobile;
|
|
|
|
+ user.email = userInfo.email;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ let infoArr = [];
|
|
|
|
+ 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>
|
|
|
|
+ </tr>`;
|
|
|
|
+ infoArr.push(infoHtml);
|
|
|
|
+ }
|
|
|
|
+ let infoHtml = infoArr.join('');
|
|
|
|
+ $('#shareToInfo').html(infoHtml);
|
|
|
|
+ });
|
|
|
|
+}
|
|
|
|
+//更新项目分享信息
|
|
|
|
+//@param {Object}selected
|
|
|
|
+function updateShareInfo(selected){
|
|
|
|
+ if(!selected){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ let usersTr = $('#shareToInfo').find('tr');
|
|
|
|
+ let newShareInfo = [];
|
|
|
|
+ for(let i = 0; i < usersTr.length; i++){
|
|
|
|
+ let userTr = usersTr[i];
|
|
|
|
+ let allowCopy = $(userTr).find('input:first').prop('checked');
|
|
|
|
+ let cancelShare = $(userTr).find('input:last').prop('checked');
|
|
|
|
+ selected.data.shareInfo[i].allowCopy = allowCopy;
|
|
|
|
+ if(!cancelShare){
|
|
|
|
+ newShareInfo.push(selected.data.shareInfo[i]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ CommonAjax.post('/pm/api/updateProjects', {user_id: userID, updateData: [{updateType: 'update', updateData: {ID: selected.data.ID, shareInfo: newShareInfo}}]}, function () {
|
|
|
|
+ selected.data.shareInfo = newShareInfo;
|
|
|
|
+ let sheet = projTreeObj.workBook.getSheet(0);
|
|
|
|
+ projTreeObj.renderSheetFuc(sheet, function () {
|
|
|
|
+ sheet.invalidateLayout();
|
|
|
|
+ sheet.repaint();
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+}
|
|
|
|
+
|
|
//刷新建设项目汇总金额信息
|
|
//刷新建设项目汇总金额信息
|
|
function refreshProjSummary(project, summaryInfo) {
|
|
function refreshProjSummary(project, summaryInfo) {
|
|
let refreshNodes = [];
|
|
let refreshNodes = [];
|