people.vue 11 KB

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