Commit 77755b8c by zhangleyuan

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

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