people.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  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">
  62. <view class="flex1 table">
  63. <view class="upimg">
  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. }
  128. },
  129. onLoad(e) {
  130. if(e.data){
  131. var newobj=JSON.parse(decodeURIComponent(e.data));
  132. this.checkList=newobj.list;
  133. }
  134. this.init()
  135. this.getCasetalbFn()
  136. },
  137. mounted() {
  138. setTimeout(() => {
  139. this.getRectInfo();
  140. }, 200)
  141. },
  142. methods: {
  143. init(){
  144. // 界别circles
  145. getDictionaryFn('circles').then(res=>{
  146. if(res.code==200&&res.data.length){
  147. this.jblist = res.data.map(v => {
  148. return {
  149. label: v.dictLabel,
  150. value: v.dictValue
  151. }
  152. })
  153. }
  154. })
  155. },
  156. bindDateChangea(e){
  157. var val=e.detail.value;
  158. this.jbtxt=this.jblist[val].label;
  159. this.jbid=this.jblist[val].value;
  160. this.getConfirm()
  161. },
  162. bindDateChangeb(e){
  163. var val=e.detail.value;
  164. this.sfwy=this.sfList[val].label;
  165. this.isMember=this.sfList[val].value;
  166. this.getConfirm()
  167. },
  168. getConfirm(){
  169. this.cateList=[];
  170. this.getCasetalbFn()
  171. },
  172. getCasetalbFn(){
  173. var params={
  174. name:this.title,
  175. boundary:this.jbid,
  176. isMember:this.isMember
  177. }
  178. getInfotreeSelectFn(params).then(res=>{
  179. if(res.code==200){
  180. this.cateList=res.data;
  181. }
  182. })
  183. },
  184. menuTab(index){
  185. var top=this.rectInfoList[index].top;
  186. this.current = index;
  187. this.riscrollTop = top;
  188. },
  189. getTabFn(ite,item){
  190. // var obj={
  191. // userId:ite.userId,
  192. // userName:ite.name,
  193. // postName:ite.unit,
  194. // userLevel:item.name,
  195. // grade:ite.grade,
  196. // }
  197. var indexNum = (this.checkList || []).findIndex((item) => item.userId === ite.userId);
  198. if(indexNum!=-1){
  199. this.checkList.splice(indexNum,1)
  200. }else{
  201. var obj={
  202. userId:ite.userId,
  203. userName:ite.name,
  204. postName:ite.unit,
  205. userLevel:item.name,
  206. grade:ite.grade,
  207. phonenumber:ite.phonenumber,
  208. parentGrade:item.userId
  209. }
  210. this.checkList.push(obj)
  211. }
  212. },
  213. getDel(idx){
  214. this.checkList.splice(idx,1)
  215. },
  216. getAll(item){
  217. var newArr=this.checkList;
  218. if(item.children&&item.children.length){
  219. item.children.forEach(ite=>{
  220. const matchingData = newArr.find(d => d.userId == ite.userId);
  221. if(matchingData){
  222. }else{
  223. var obj={
  224. userId:ite.userId,
  225. userName:ite.name,
  226. postName:ite.unit,
  227. userLevel:item.name,
  228. grade:ite.grade,
  229. phonenumber:ite.phonenumber,
  230. parentGrade:item.userId
  231. }
  232. this.checkList.push(obj)
  233. }
  234. })
  235. }
  236. },
  237. getSure(){
  238. // 带数据返回
  239. var obj={
  240. zxConferenceUserList:this.checkList,
  241. }
  242. uni.$emit("refreshtalb",obj)
  243. uni.navigateBack({
  244. delta: 1 //返回层数,2则上上页
  245. });
  246. },
  247. // 获取与顶部之间的距离
  248. getRectInfo() {
  249. var top = 0;
  250. var bottom = 0;
  251. var temp = 0;
  252. for (var i = 0; i < this.cateList.length; i++) {
  253. let view = uni.createSelectorQuery().in(this).select("#cate" + i);
  254. view.fields({
  255. size: true,
  256. rect: true
  257. }, data => {
  258. top = temp;
  259. bottom = top + data.height;
  260. temp = bottom;
  261. this.rectInfoList[i] = {
  262. 'top': top,
  263. 'bottom': bottom
  264. }
  265. // console.log(top, bottom);
  266. }).exec();
  267. }
  268. },
  269. getCurrentHeight(e) {
  270. var currentHeight = e.detail.scrollTop;
  271. this.rectInfoList.forEach((item, index) => {
  272. if (currentHeight >= item.top && currentHeight <= item.bottom) {
  273. // 当前获取的盒子高度大于top小于bottom,判定将索引传至左侧菜单导航
  274. this.current = index;
  275. this.scrollTop = index * uni.upx2px(100);
  276. }
  277. })
  278. }
  279. }
  280. }
  281. </script>
  282. <style scoped lang="scss">
  283. /deep/::-webkit-scrollbar {
  284. display: none;
  285. width: 0;
  286. height: 0;
  287. }
  288. .talbbox{
  289. display: flex;height: 100vh;padding-bottom: 412rpx;flex-direction: column;
  290. .cate-left{width: 252rpx;flex: 0 0 auto;height: 100%;background-color: #f5f5f5;
  291. .cate-item{height: 110rpx;line-height: 110rpx;text-align: center;font-weight: 500;
  292. font-size: 28rpx;color: #666666;
  293. &.act{background-color: #ffffff;font-weight: bold;color: #1D64E2;}
  294. }
  295. }
  296. .cate-right{flex: 1;height: 100%;background: #ffffff;
  297. .cate-right-scroll{height: 100%;padding-left:34rpx;
  298. .cate-right-item{
  299. .cate-title{font-weight: bold;font-size: 30rpx;color: #222327;height: 110rpx;line-height: 110rpx;}
  300. .cate-right-txt{display: flex;flex-wrap: wrap;
  301. text{font-weight: 500;font-size: 26rpx;color: #666666;min-width: 130rpx;margin-right:24rpx ;margin-bottom: 16rpx;padding: 8rpx 0;
  302. &.act{color: #1D64E2;}
  303. }
  304. }
  305. }
  306. }
  307. }
  308. .allbtns{font-weight: bold;font-size: 26rpx;color: #28C529;padding: 0 26rpx;}
  309. }
  310. .tabtop{flex: 0 0 auto;padding-top: 20rpx;background: #1D64E2;
  311. .lbtab{height: 96rpx;padding:0 24rpx 0 40rpx;
  312. .limg{width: 40rpx;height: 34rpx;margin-right: 10rpx;flex:0 0 auto;}
  313. .lbtabs{overflow: auto;flex-wrap: nowrap;flex: 1;
  314. .lbtabp{display: flex;align-items: center;flex: 0 0 auto;margin-right: 40rpx;
  315. view{color: #ffffff;font-size: 26rpx;}
  316. }
  317. .upimg{width: 18rpx;height: 10rpx;}
  318. }
  319. }
  320. }
  321. .mflexbox{flex: 1;display: flex;overflow: auto;}
  322. .lbtabs /deep/ picker{padding: 0 22rpx;}
  323. // 弹窗
  324. .lmtac{padding: 0 22rpx 40rpx;box-sizing: border-box;display: flex;flex-direction: column;
  325. position: fixed;left: 0;right: 0;bottom: 0;background: #FFFFFF;height:412rpx;
  326. box-shadow: 0px 12rpx 6rpx 0px #EDEDED;
  327. .table{display: flex;flex-direction: column;overflow: hidden;}
  328. .upimg{padding: 20rpx;margin: 0 auto 6rpx;width: 64rpx;flex: 0 0 auto;
  329. image{width: 24rpx;height: 26rpx;}
  330. }
  331. .lmtit{font-weight: bold;font-size: 30rpx;color: #222327;}
  332. .lmtxt{
  333. display: flex;align-items: flex-start;font-weight: bold;font-size: 30rpx;
  334. .laber{color: #222327;flex: 0 0 auto;}
  335. .lmame{display: flex;flex-wrap: wrap;flex: 1;
  336. .tit{color: #1D64E2;display: flex;align-items: center;margin-right: 20rpx;}
  337. .delimg{
  338. width: 40rpx;height: 40rpx;display: flex;align-items: center;justify-content: center;
  339. image{width: 26rpx;height: 26rpx;margin-left: 12rpx;}
  340. }
  341. }
  342. }
  343. .btns{width: 100%;height: 80rpx;margin-top: 30rpx;
  344. background: #1D64E2;font-weight: bold;font-size: 30rpx;
  345. color: #FFFFFF;display: flex;align-items: center;justify-content: center;
  346. border-radius: 40rpx;}
  347. }
  348. </style>