Commit 77755b8c by zhangleyuan

Merge branch 'feature/zhangleyuan/20210812/opzi-organize' into rc

parents e3535b19 a1e2dd52
......@@ -12,69 +12,34 @@ import Platform from '@/common/js/platform';
import User from '@/common/js/user';
import Service from '@/common/js/service';
console.log(wx.agentConfig,' console.log(wx.agentConfig) ')
export default class WechatApi {
static async initConfig(params = { isAgentConfig: false, url: '' }) {
static initConfig(params = { isAgentConfig: false, url: '' }) {
if (Platform.isWorkWx()) {
return new Promise(async (resolve, reject) => {
Service.Hades('anon/hades/getWxCorpJSAPISignature', {
storeId: User.getStoreId(),
url: params.url,
url: window.location.href.split('#')[0],
}).then((result) => {
const res = result.result;
this.config({
wx.config({
beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: res.appId, // 必填,企业微信的corpID
timestamp: res.timestamp, // 必填,生成签名的时间戳
nonceStr: res.nonceStr, // 必填,生成签名的随机串
signature: res.signature, // 必填,签名,见 附录-JS-SDK使用权限签名算法
jsApiList: ['chooseImage', 'shareToExternalContact', 'selectExternalContact', 'selectEnterpriseContact'],
}).then(() => {
Service.Hades('anon/hades/getWxWorkJSAPISignature', {
storeId: User.getStoreId(),
url: params.url,
}).then((result2) => {
const res2 = result2.result;
setTimeout(() => {
this.agentConfig({
corpid: res2.corpid, // 必填,企业微信的corpid,必须与当前登录的企业一致
agentid: res2.agentid, // 必填,企业微信的应用id (e.g. 1000247)
timestamp: res2.timestamp, // 必填,生成签名的时间戳
nonceStr: res2.nonceStr, // 必填,生成签名的随机串
signature: res2.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
jsApiList: ['selectExternalContact', 'getCurExternalContact', 'getContext', 'shareToExternalContact', 'sendChatMessage', 'shareToExternalChat', 'startLiving', 'replayLiving'],
success: (res) => {
console.log(res, 'res-agentconfig');
console.info('window.WWOpenData', window.WWOpenData);
resolve(res);
},
fail: (err) => {
console.log(1213545344545)
console.log(err, 'err-agentconfig');
reject(err);
},
});
}, 500)
});
})
});
})
} else {
if (params.isAgentConfig) {
console.log(32132132, 'cesgu')
return new Promise(async (resolve, reject) => {
jsApiList: ['scanQRCode'],
});
})
wx.ready(() => {
Service.Hades('anon/hades/getWxWorkJSAPISignature', {
storeId: User.getStoreId(),
url: params.url,
url: window.location.href.split('#')[0],
}).then((result2) => {
const res2 = result2.result;
this.agentConfig({
wx.agentConfig({
corpid: res2.corpid, // 必填,企业微信的corpid,必须与当前登录的企业一致
agentid: res2.agentid, // 必填,企业微信的应用id (e.g. 1000247)
timestamp: res2.timestamp, // 必填,生成签名的时间戳
......@@ -82,58 +47,55 @@ export default class WechatApi {
signature: res2.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
jsApiList: ['selectExternalContact', 'getCurExternalContact', 'getContext', 'shareToExternalContact', 'sendChatMessage', 'shareToExternalChat', 'startLiving', 'replayLiving'],
success: (res) => {
console.log(res, 'res-agentconfig');
console.info('window.WWOpenData', window.WWOpenData);
console.log(res, 'agentConfig 成功', 'res-agentconfig');
resolve(res);
},
fail: (err) => {
console.log(1213545344545)
console.log(err, 'err-agentconfig');
reject(err);
},
});
});
});
}
}
wx.error((err) => {
console.log('getWxCorpJSAPISignature', err)
});
}
})
static async config(config) {
return new Promise((resolve, reject) => {
console.info('wx.config', config);
wx.config(config);
wx.ready(resolve);
wx.error(reject);
}).then(
() => {
console.info('wx.ready');
},
(error) => {
console.error('wx.error', error);
throw error;
}
);
}
static async agentConfig(config) {
wx.agentConfig({ ...config });
}
} else {
static getCurExternalContact() {
return new Promise((resolve, reject) => {
wx.ready(() => {
wx.invoke('getCurExternalContact', {}, function (res) {
if (res.err_msg == 'getCurExternalContact:ok') {
resolve(res.userId); //返回当前外部联系人userId
} else {
reject(res.err_msg); //错误处理
}
return new Promise(async (resolve, reject) => {
Service.Hades('anon/hades/getWxWorkJSAPISignature', {
storeId: User.getStoreId(),
url: window.location.href.split('#')[0],
}).then((result2) => {
const res2 = result2.result;
wx.agentConfig({
corpid: res2.corpid, // 必填,企业微信的corpid,必须与当前登录的企业一致
agentid: res2.agentid, // 必填,企业微信的应用id (e.g. 1000247)
timestamp: res2.timestamp, // 必填,生成签名的时间戳
nonceStr: res2.nonceStr, // 必填,生成签名的随机串
signature: res2.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
jsApiList: ['selectExternalContact', 'getCurExternalContact', 'getContext', 'shareToExternalContact', 'sendChatMessage', 'shareToExternalChat', 'startLiving', 'replayLiving'],
success: (res) => {
console.log(res, 'agentConfig 成功', 'res-agentconfig');
resolve(res);
},
fail: (err) => {
console.log(1213545344545)
console.log(err, 'err-agentconfig');
},
});
});
});
});
}
}
static getContext() {
return new Promise((resolve, reject) => {
wx.ready(() => {
......
......@@ -41,16 +41,25 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script>
<script type="text/javascript" src="https://image.xiaomaiketang.com/xm/iscroll-zoom-min.js"></script>
<script type="text/javascript" src="https://image.xiaomaiketang.com/xm/hammer.min.js"></script>
<script type="text/javascript" src="https://image.xiaomaiketang.com/xm/lrz.all.bundle.js"></script>
<script type="text/javascript" src="https://image.xiaomaiketang.com/xm/PhotoClip.js"></script>
<script type="text/javascript" charset="utf-8" src="//g.alicdn.com/sd/ncpc/nc.js?t=2015052012"></script>
<script type="text/javascript" src="https://xiaomai-js.oss-cn-hangzhou.aliyuncs.com/loghub-xm-0.0.1-beta.js"></script>
<script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script type="text/javascript" src="//open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script>
</head>
<body>
<script>
setTimeout(()=>{
if(!wx.agentConfig){
window.location.reload()
}
},100)
</script>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
......
......@@ -503,7 +503,9 @@ function LeftStructureTree(props) {
function selectUserList(record, e) {
const _selectKeys = [];
_selectKeys.push(e.selectedNodes[0].id)
if(e.selectedNodes){
_selectKeys.push(e.selectedNodes[0].id)
}
setSelectedKeys(_selectKeys);
props.onChangeSelectDep(e.selectedNodes[0]);
props.searchUserList(e.selectedNodes[0], treeType, 1);
......@@ -523,7 +525,7 @@ function LeftStructureTree(props) {
<div className="organization">
<div className="search-con">
{/* <Complete/> */}
{/* <AutoComplete
<AutoComplete
dropdownClassName="certain-category-search-dropdown"
dropdownMatchSelectWidth={250}
allowClear
......@@ -545,7 +547,7 @@ function LeftStructureTree(props) {
style={{ width: 250 }}
enterButton={<span className='icon iconfont'>&#xe832;</span>}
/>
</AutoComplete> */}
</AutoComplete>
</div>
{(props.treeType === 'postGrouptab' || props.treeType === 'customGroupTab') && (
<div className="operate">
......
......@@ -40,7 +40,7 @@ function MemberTree(props) {
const _dataArray = dataArray.map((item,index)=>{
item.title = "";
item.key=item.id;
item.children = []
item.children = [];
if(item.departmentUserVOList){
item.children = item.departmentUserVOList;
}
......@@ -60,11 +60,10 @@ function MemberTree(props) {
const _checkedNodes = e.checkedNodes;
const _selectNodes = [];
_checkedNodes.map((item,index)=>{
if(item.userId){
// if(item.userId){
_selectNodes.push(item);
}
// }
})
console.log('_selectNodes',_selectNodes);
props.onSelect(_selectNodes);
}
return (
......@@ -75,7 +74,7 @@ function MemberTree(props) {
checkable
showIcon={false}
treeData={treeData}
checkedKeys={_.pluck(props.selectUserList, 'id')}
checkedKeys={_.pluck(props.selectList, 'id')}
onCheck={(selectedKeys,e)=>treeSelected(selectedKeys,e)}
titleRender={(nodeData) => {
return (
......
......@@ -9,6 +9,9 @@
}
}
.ant-tree.ant-tree-directory .ant-tree-treenode-selected:hover::before, .ant-tree.ant-tree-directory .ant-tree-treenode-selected::before{
background: none;
background:transparent;
}
.ant-tree.ant-tree-directory .ant-tree-treenode-selected .ant-tree-switcher{
color:#000;
}
}
\ No newline at end of file
......@@ -22,13 +22,13 @@ function SearchUser(props) {
}
function selectuser(e,item){
if(e.target.checked){
let _record = props.selectUserList
let _record = props.selectList
_record.push(item)
props.onSelect(_record,'user')
}else{
let _record = props.selectUserList
let _record = props.selectList
_record.map((_item,index)=>{
if(item.userId === item.userId){
if(_item.userId === item.userId){
_record.splice(index,1)
}
})
......@@ -58,14 +58,13 @@ function SearchUser(props) {
};
return (
<div className="search-user" style={{width:'300px'}} id="search-user">
{/* <Search
<Search
placeholder='搜索成员'
enterButton={<span className="icon iconfont">&#xe832;</span>}
onFocus={(e)=>{onFocus(e)}}
onChange={(e)=>{onChange(e)}}
className="search-input-item"
// onBlur={()=>{onBlur()}}
/> */}
/>
{dropDownVisible &&
<div className="drop-down">
<div className="drop-down__list">
......@@ -78,7 +77,7 @@ function SearchUser(props) {
<div>
{props.data.departmentUserVOList.map((item,index)=>{
return <div>
<Checkbox onChange={(e)=>{selectuser(e,item)}} checked={_.pluck(props.selectUserList, 'userId').indexOf(item.userId)=== -1?false:true}>
<Checkbox onChange={(e)=>{selectuser(e,item)}} checked={_.pluck(props.selectList, 'userId').indexOf(item.userId)=== -1?false:true}>
<div className="drop-down__item__con__item">
<div className="drop-down__item__con__item__left">
<span className="icon iconfont title-icon">&#xe603;</span>
......
......@@ -10,10 +10,11 @@
box-shadow: 0px 2px 15px 6px rgba(0, 0, 0, 0.05);
border-radius:2px;
width:270px;
max-height:280px;
overflow-y: scroll;
// .drop-down__item-user{
// margin-bottom:30px;
// }
.drop-down__item__title{
font-size:14px;
color:#666;
......
......@@ -26,7 +26,8 @@ class NewChooseMembersModal extends React.Component {
constructor(props) {
super(props);
this.state = {
selectUserList:[],
selectList:[], //所有的选中项
selectUserList:[], // 所有的选中的用户
selectObject: {},
openSetModal: false,
visible:this.props.visible,
......@@ -84,26 +85,41 @@ class NewChooseMembersModal extends React.Component {
}
treeSelect = (record)=>{
// console.log('record',record)
this.setState({
selectUserList:record
selectList:record,
selectUserList:this.handleSelectUserList(record)
})
}
clearOneUser = (record) =>{
console.log("record",record);
const {selectUserList} = this.state;
const _selectUserList = selectUserList.filter((item,index)=>{
return item.userId !== record.userId
// 将所有的选中项里的人员挑出来
handleSelectUserList =(list)=>{
const _list = [];
list.map((item,index)=>{
if(item.userId){
_list.push(item);
}
})
console.log('selectUserList',selectUserList);
return _list
}
clearOneUser = (record) =>{
const {selectUserList,selectList} = this.state;
const _selectList = [];
selectList.map((item,index)=>{
if(item.userId !== record.userId && item.id !==record.departmentId){
_selectList.push(item);
}
});
console.log('_selectList',_selectList);
this.setState({
selectUserList:_selectUserList
selectList:_selectList,
selectUserList:this.handleSelectUserList(_selectList)
})
}
// 清空所有成员
clearAllUser = () => {
this.setState({
selectList:[],
selectUserList : [],
})
}
......@@ -254,25 +270,22 @@ class NewChooseMembersModal extends React.Component {
}
confirmSearchSelect=(record,type)=>{
const { selectUserList } = this.state;
const { selectUserList,selectList} = this.state;
if(type==='user'){
this.setState({selectUserList:[...record]});
this.setState({selectList:[...record],selectUserList:this.handleSelectUserList(record)});
}else{
let _list = [];
if(record.departmentUserVOList){
_list = record.departmentUserVOList;
}
console.log('_list',_list);
this.setState({selectUserList:[...selectUserList,..._list]},()=>{
console.log('selectUserList',this.state.selectUserList);
});
this.setState({selectList:[...selectList,..._list],selectUserList:[...selectUserList,..._list]});
}
}
render() {
const {type,treeDepType,selectDep={},addDepType=''} = this.props;
const { id=''} = selectDep;
const {selectUserList,selectObject,visible,openSetModal,searchUserResultList} = this.state;
const {selectUserList,selectObject,visible,openSetModal,searchUserResultList,selectList} = this.state;
const title = type === 'USER' ? '添加员工' : '添加学员';
return (
<div>
......@@ -301,15 +314,9 @@ class NewChooseMembersModal extends React.Component {
<div className='member-container'>
<div className='container-left'>
<div className='container-left-body'>
{/* <Search
placeholder='搜索成员'
className='search search-input'
enterButton={<span className="icon iconfont">&#xe832;</span>}
/> */}
{/* {this.Complete()} */}
<SearchUser onChange={(value)=>{this.getCompleteOptionData(value)}} data={searchUserResultList} onSelect={(record,type)=>{this.confirmSearchSelect(record,type)}} selectUserList={selectUserList}/>
<SearchUser onChange={(value)=>{this.getCompleteOptionData(value)}} data={searchUserResultList} onSelect={(record,type)=>{this.confirmSearchSelect(record,type)}} selectUserList={selectUserList} selectList={selectList}/>
<div className='container-left-body-table'>
<MemberTree departmentId={id} treeDepType={treeDepType} nowTreeDepType={addDepType} onSelect={(record)=>{this.treeSelect(record)}} selectUserList={selectUserList} type={type}/>
<MemberTree departmentId={id} treeDepType={treeDepType} nowTreeDepType={addDepType} onSelect={(record)=>{this.treeSelect(record)}} selectUserList={selectUserList} type={type} selectList={selectList}/>
</div>
</div>
</div>
......
......@@ -23,7 +23,7 @@
}
.container-left-body-table{
width: 300px;
height: 330px;
max-height: 380px;
overflow: scroll;
.ant-table {
border: none;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment