people.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. <template>
  2. <view class="talbbox">
  3. <!-- 搜索 -->
  4. <view class="tabtop">
  5. <view class="plr12">
  6. <view class="search flex0" style="margin-bottom: 0;">
  7. <image :src="searchimg"></image>
  8. <input placeholder="输入关键字进行查询" v-model="title" @confirm="getConfirm"/>
  9. </view>
  10. </view>
  11. <view class="lbtab flexc">
  12. <image :src="lbicoimg" class="limg"></image>
  13. <view class="lbtabs flexc">
  14. <view class="lbtabp">
  15. <picker range-key='label' :value="jbidx" :range="jblist" @change='bindDateChangea'>
  16. <view >{{jbtxt || "选择届别"}}</view>
  17. </picker>
  18. <image :src="upimg" class="upimg"></image>
  19. </view>
  20. <view class="lbtabp" >
  21. <picker range-key='label' :value="sfwyidx" :range="sfList" @change='bindDateChangeb'>
  22. <view >{{sfwy || "是否常委"}}</view>
  23. </picker>
  24. <image :src="upimg" class="upimg"></image>
  25. </view>
  26. </view>
  27. <view class="czbtns" style="color:#fff;" @click='getResetFn'>重置</view>
  28. </view>
  29. </view>
  30. <view class="mflexbox" v-if="cateList.length">
  31. <!-- 左侧 -->
  32. <view>
  33. <scroll-view :scroll-top="scrollTop" class="cate-left" scroll-y="true" show-scrollbar="false">
  34. <view class="cate-item" :class="{act:current==index}" v-for="(item,index) in cateList"
  35. @click="menuTab(index)" :key="item.userId">
  36. {{item.name}}
  37. </view>
  38. </scroll-view>
  39. </view>
  40. <!-- 右侧 -->
  41. <view class="cate-right">
  42. <scroll-view :scroll-top="riscrollTop" :scroll-into-view="'cate'+tempCurrent" class="cate-right-scroll" scroll-y="true"
  43. show-scrollbar="false" @scroll="getCurrentHeight">
  44. <view :id="'cate'+index" v-for="(item,index) in cateList" :key="item.userId" class="cate-right-item">
  45. <view class="flexcj">
  46. <view class="cate-title">{{item.userName||item.name}}</view>
  47. <view class="allbtns" @click="getAll(item)">全选</view>
  48. </view>
  49. <view class="cate-right-txt">
  50. <!-- :class="checkList.findIndex((it) => it.userId === el.userId)!=-1?'act':''" -->
  51. <text v-for="(el,idx) in item.children" @click="getTabFn(el,item)" :class="checkList.findIndex((it) => it.userId === el.userId)!=-1?'act':''" :key="el.userId">{{el.userName||el.name}}</text>
  52. </view>
  53. </view>
  54. <view style="height: 30rpx;"></view>
  55. </scroll-view>
  56. </view>
  57. </view>
  58. <block v-else>
  59. <no-data></no-data>
  60. </block>
  61. <!-- 弹窗 -->
  62. <view class="lmtac" :class="upflag?'upbox':''">
  63. <view class="flex1 table">
  64. <view class="upimg" @click="upflag=!upflag">
  65. <image :src="upsimg"></image>
  66. </view>
  67. <view class="flex1" style="overflow-y: auto;">
  68. <view class="lmtit mb14">已添加人员</view>
  69. <view class="lmtxt" >
  70. <view class="lmame">
  71. <block v-for="(ite,idx) in checkList" ::key="ite.userId">
  72. <view class="tit">{{ite.userName||ite.name}}
  73. <view class="delimg" @click="getDel(idx)"><image :src="delimg"></image></view>
  74. </view>
  75. </block>
  76. </view>
  77. </view>
  78. <!-- <block v-for="(item,index) in cateList" :key="item.userId">
  79. <block v-if="checkList.findIndex((it) => it.grade.indexOf(item.userId)!=-1)!=-1">
  80. <view class="lmtxt mb14" >
  81. <view class="laber">{{item.name}}:</view>
  82. <view class="lmame">
  83. <block v-for="(ite,idx) in checkList" ::key="ite.userId">
  84. <view class="tit" v-if="ite.grade.indexOf(item.userId)!=-1">{{ite.name}}
  85. <view class="delimg" @click="getDel(idx)"><image :src="delimg"></image></view>
  86. </view>
  87. </block>
  88. </view>
  89. </view>
  90. </block>
  91. </block> -->
  92. </view>
  93. </view>
  94. <view class="btns" @click="getSure">确定</view>
  95. </view>
  96. <!-- <view class="fwbtns" @click="getSure">确定</view> -->
  97. </view>
  98. </template>
  99. <script>
  100. import noData from "@/components/nodata/nodata.vue"
  101. import {getDictionaryFn} from "@/api/mine/register.js"
  102. import {getInfotreeSelectFn} from "@/api/mine/meeting.js"
  103. export default {
  104. components:{noData},
  105. data() {
  106. return {
  107. searchimg: require("@/work/static/images/search.png"),
  108. upsimg:require("@/work/static/images/meeting/up.png"),
  109. delimg:require("@/work/static/images/meeting/del.png"),
  110. lbicoimg:require("@/work/static/images/lwico.png"),
  111. upimg:require("@/work/static/images/lwup.png"),
  112. cateList: [],
  113. sfList:[{label: '是',value: 'Y'},{label: '否',value: 'N'}],
  114. sfwy:'',
  115. sfwyidx:'',
  116. isMember:'',
  117. current: 0, //当前点击项
  118. rectInfoList: [],
  119. tempCurrent: 0,
  120. ricurrent:'',
  121. scrollTop: 0, //左侧导航栏距离顶部的位置
  122. riscrollTop:0,//右侧导航栏距离顶部的位置
  123. checkList:[],//选择的人员,
  124. jblist:[],
  125. jbtxt:'',
  126. jbidx:'',
  127. title:'',
  128. upflag:false,
  129. }
  130. },
  131. onLoad(e) {
  132. if(e.data){
  133. var newobj=JSON.parse(decodeURIComponent(e.data));
  134. this.checkList=newobj.list;
  135. }
  136. this.init()
  137. this.getCasetalbFn()
  138. },
  139. mounted() {
  140. setTimeout(() => {
  141. this.getRectInfo();
  142. }, 200)
  143. },
  144. methods: {
  145. init(){
  146. // 界别circles
  147. getDictionaryFn('circles').then(res=>{
  148. if(res.code==200&&res.data.length){
  149. this.jblist = res.data.map(v => {
  150. return {
  151. label: v.dictLabel,
  152. value: v.dictValue
  153. }
  154. })
  155. }
  156. })
  157. },
  158. bindDateChangea(e){
  159. var val=e.detail.value;
  160. this.jbtxt=this.jblist[val].label;
  161. this.jbid=this.jblist[val].value;
  162. this.getConfirm()
  163. },
  164. bindDateChangeb(e){
  165. var val=e.detail.value;
  166. this.sfwy=this.sfList[val].label;
  167. this.isMember=this.sfList[val].value;
  168. this.getConfirm()
  169. },
  170. getConfirm(){
  171. this.cateList=[];
  172. this.getCasetalbFn()
  173. },
  174. getResetFn(){
  175. this.jbtxt='';
  176. this.sfwy='';
  177. this.jbid='';
  178. this.isMember='';
  179. this.title='';
  180. this.getConfirm()
  181. },
  182. getCasetalbFn(){
  183. var params={
  184. name:this.title,
  185. boundary:this.jbid,
  186. isMember:this.isMember
  187. }
  188. getInfotreeSelectFn(params).then(res=>{
  189. if(res.code==200){
  190. this.cateList=res.data;
  191. }
  192. })
  193. },
  194. menuTab(index){
  195. var top=this.rectInfoList[index].top;
  196. this.current = index;
  197. this.riscrollTop = top;
  198. },
  199. getTabFn(ite,item){
  200. // var obj={
  201. // userId:ite.userId,
  202. // userName:ite.name,
  203. // postName:ite.unit,
  204. // userLevel:item.name,
  205. // grade:ite.grade,
  206. // }
  207. var indexNum = (this.checkList || []).findIndex((item) => item.userId === ite.userId);
  208. if(indexNum!=-1){
  209. this.checkList.splice(indexNum,1)
  210. }else{
  211. var obj={
  212. userId:ite.userId,
  213. userName:ite.name,
  214. postName:ite.unit,
  215. userLevel:item.name,
  216. grade:ite.grade,
  217. phonenumber:ite.phonenumber,
  218. parentGrade:item.userId
  219. }
  220. this.checkList.push(obj)
  221. }
  222. },
  223. getDel(idx){
  224. this.checkList.splice(idx,1)
  225. },
  226. getAll(item){
  227. var newArr=this.checkList;
  228. if(item.children&&item.children.length){
  229. item.children.forEach(ite=>{
  230. const matchingData = newArr.find(d => d.userId == ite.userId);
  231. if(matchingData){
  232. }else{
  233. var obj={
  234. userId:ite.userId,
  235. userName:ite.name,
  236. postName:ite.unit,
  237. userLevel:item.name,
  238. grade:ite.grade,
  239. phonenumber:ite.phonenumber,
  240. parentGrade:item.userId
  241. }
  242. this.checkList.push(obj)
  243. }
  244. })
  245. }
  246. },
  247. getSure(){
  248. // 带数据返回
  249. var obj={
  250. zxConferenceUserList:this.checkList,
  251. }
  252. uni.$emit("refreshtalb",obj)
  253. uni.navigateBack({
  254. delta: 1 //返回层数,2则上上页
  255. });
  256. },
  257. // 获取与顶部之间的距离
  258. getRectInfo() {
  259. var top = 0;
  260. var bottom = 0;
  261. var temp = 0;
  262. for (var i = 0; i < this.cateList.length; i++) {
  263. let view = uni.createSelectorQuery().in(this).select("#cate" + i);
  264. view.fields({
  265. size: true,
  266. rect: true
  267. }, data => {
  268. top = temp;
  269. bottom = top + data.height;
  270. temp = bottom;
  271. this.rectInfoList[i] = {
  272. 'top': top,
  273. 'bottom': bottom
  274. }
  275. // console.log(top, bottom);
  276. }).exec();
  277. }
  278. },
  279. getCurrentHeight(e) {
  280. var currentHeight = e.detail.scrollTop;
  281. this.rectInfoList.forEach((item, index) => {
  282. if (currentHeight >= item.top && currentHeight <= item.bottom) {
  283. // 当前获取的盒子高度大于top小于bottom,判定将索引传至左侧菜单导航
  284. this.current = index;
  285. this.scrollTop = index * uni.upx2px(100);
  286. }
  287. })
  288. }
  289. }
  290. }
  291. </script>
  292. <style scoped lang="scss">
  293. /deep/::-webkit-scrollbar {
  294. display: none;
  295. width: 0;
  296. height: 0;
  297. }
  298. .talbbox{
  299. display: flex;height: 100vh;padding-bottom: 412rpx;flex-direction: column;
  300. .cate-left{width: 252rpx;flex: 0 0 auto;height: 100%;background-color: #f5f5f5;
  301. .cate-item{height: 110rpx;line-height: 110rpx;text-align: center;font-weight: 500;
  302. font-size: 28rpx;color: #666666;
  303. &.act{background-color: #ffffff;font-weight: bold;color: #1D64E2;}
  304. }
  305. }
  306. .cate-right{flex: 1;height: 100%;background: #ffffff;
  307. .cate-right-scroll{height: 100%;padding-left:34rpx;
  308. .cate-right-item{
  309. .cate-title{font-weight: bold;font-size: 30rpx;color: #222327;height: 110rpx;line-height: 110rpx;}
  310. .cate-right-txt{display: flex;flex-wrap: wrap;
  311. text{font-weight: 500;font-size: 26rpx;color: #666666;min-width: 130rpx;margin-right:24rpx ;margin-bottom: 16rpx;padding: 8rpx 0;
  312. &.act{color: #1D64E2;}
  313. }
  314. }
  315. }
  316. }
  317. }
  318. .allbtns{font-weight: bold;font-size: 26rpx;color: #28C529;padding: 0 26rpx;}
  319. }
  320. .tabtop{flex: 0 0 auto;padding-top: 20rpx;background: #1D64E2;
  321. .lbtab{height: 96rpx;padding:0 24rpx 0 40rpx;
  322. .limg{width: 40rpx;height: 34rpx;margin-right: 10rpx;flex:0 0 auto;}
  323. .lbtabs{overflow: auto;flex-wrap: nowrap;flex: 1;
  324. .lbtabp{display: flex;align-items: center;flex: 0 0 auto;margin-right: 40rpx;
  325. view{color: #ffffff;font-size: 26rpx;}
  326. }
  327. .upimg{width: 18rpx;height: 10rpx;}
  328. }
  329. }
  330. }
  331. .mflexbox{flex: 1;display: flex;overflow: auto;}
  332. .lbtabs /deep/ picker{padding: 0 22rpx;}
  333. // 弹窗
  334. .lmtac{padding: 0 22rpx 40rpx;box-sizing: border-box;display: flex;flex-direction: column;
  335. position: fixed;left: 0;right: 0;bottom: 0;background: #FFFFFF;height:412rpx;
  336. box-shadow: 0px 12rpx 6rpx 0px #EDEDED;transition: all 0.3s;
  337. &.upbox{
  338. height: 100vh;
  339. .upimg{
  340. image{transform: rotate(180deg);}
  341. }
  342. }
  343. .table{display: flex;flex-direction: column;overflow: hidden;}
  344. .upimg{padding: 20rpx;margin: 0 auto 6rpx;width: 64rpx;flex: 0 0 auto;
  345. image{width: 24rpx;height: 26rpx;}
  346. }
  347. .lmtit{font-weight: bold;font-size: 30rpx;color: #222327;}
  348. .lmtxt{
  349. display: flex;align-items: flex-start;font-weight: bold;font-size: 30rpx;
  350. .laber{color: #222327;flex: 0 0 auto;}
  351. .lmame{display: flex;flex-wrap: wrap;flex: 1;
  352. .tit{color: #1D64E2;display: flex;align-items: center;margin-right: 32rpx;margin-bottom: 12rpx;}
  353. .delimg{
  354. width: 40rpx;height: 40rpx;display: flex;align-items: center;justify-content: center;
  355. image{width: 26rpx;height: 26rpx;margin-left: 12rpx;}
  356. }
  357. }
  358. }
  359. .btns{width: 100%;height: 80rpx;margin-top: 30rpx;
  360. background: #1D64E2;font-weight: bold;font-size: 30rpx;
  361. color: #FFFFFF;display: flex;align-items: center;justify-content: center;
  362. border-radius: 40rpx;}
  363. }
  364. </style>