limit.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template>
  2. <view>
  3. <view class="navbox">
  4. <uni-nav-bar color="#ffffff" left-icon="left" title="人员权限" :background-color="backgroundColor"
  5. :border="false" statusBar='true' fixed="true" @clickLeft='getBack'>
  6. </uni-nav-bar>
  7. <view class="plr16" :style="'background:'+backgroundColor">
  8. <!-- 搜索 -->
  9. <view class="lbtab flexc">
  10. <image :src="licoimg" class="limg" @click='getResetFn'></image>
  11. <view class="search flexc mb4">
  12. <image :src="serimg"></image>
  13. <input placeholder="请输入人员姓名进行搜索" confirm-type="search" placeholder-style="color:#B9DCF7" v-model="title" @confirm="getConfirm"/>
  14. </view>
  15. <!-- <view class="lbtabs flexc">
  16. <picker class="pickbox" range-key='dictLabel' :range="jclxlist" @change="bindTimeChangea">
  17. <view class="pickboxa">
  18. <view class="tit overtwo" >{{jclx||'就餐类型'}}</view>
  19. <image :src="wupimg" class="hupimg"></image>
  20. </view>
  21. </picker>
  22. </view>
  23. <view @click="getDetailDay" class="daybtn flexc">
  24. <image :src="dayimg"></image>
  25. 预约记录</view> -->
  26. </view>
  27. </view>
  28. </view>
  29. <image :src="navbg" class="navbg"></image>
  30. <view class="zxmain" :style="'margin-top:-'+marTop+'rpx;'">
  31. <!-- 列表 -->
  32. <y-list type='limit' :datalist="list" :wtdt="wtdt" @getDetail='getDetail' :mjlist="mjlist" @getDelFn="getDelFn"></y-list>
  33. <view class="yyfbtn flexcc" v-if="checkPermi(['system:management:add'])" @click="getAddFn">添加人员</view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import {checkPermi,checkRole} from "@/utils/permission"; // 权限判断函数
  39. import yList from "@/work/components/yuyue/list.vue"
  40. import {getManagementList,getManagementDel} from "@/api/mine/work.js"
  41. import {getDictionaryFn} from "@/api/mine/register.js"
  42. export default {
  43. components: {yList},
  44. data() {
  45. return {
  46. wupimg:require("@/work/static/record/wup.png"),
  47. serimg:require("@/work/static/record/search.png"),
  48. licoimg:require("@/work/static/record/lico.png"),
  49. navbg:require("@/static/images/navbg.png"),
  50. dayimg:require("@/work/static/yuy/day.png"),
  51. backgroundColor: "transparent",
  52. datainfo:{},
  53. nvaHeight: 44,
  54. marTop: 0, //距离顶部的距离
  55. stubarHeight: 0, //
  56. title:'',
  57. mjlist:[],
  58. list:[],
  59. pageSize: 10,
  60. pageNum: 1,
  61. reachflag: false,
  62. wtdt:'',
  63. jclx:'',
  64. orderFoodType:'',//就餐类型
  65. userId:this.$store.state.user.userId,
  66. }
  67. },
  68. onPageScroll(e) {
  69. var scrollTop = Number(e.scrollTop);
  70. if (scrollTop > 0) {
  71. this.backgroundColor = '#0491FD'
  72. } else {
  73. this.backgroundColor = 'transparent'
  74. }
  75. },
  76. onUnload() {
  77. uni.$off('refreshlimitlist')
  78. },
  79. onLoad: function() {
  80. uni.$on('refreshlimitlist',(e) => {
  81. this.getConfirm()
  82. })
  83. this.init()
  84. this.getDataFn()
  85. uni.getSystemInfo({
  86. success: (e) => {
  87. this.stubarHeight = Number(e.statusBarHeight);
  88. this.nvaHeight = Number(e.statusBarHeight) + 44;
  89. this.tabscheight = Number(this.nvaHeight) * 2 + 100;
  90. }
  91. })
  92. },
  93. onShow() {},
  94. mounted() {
  95. this.getHeightFn()
  96. },
  97. // 上拉触底加载更多触发事件
  98. onReachBottom() {
  99. if (this.reachflag) {
  100. this.pageNum++
  101. this.getDataFn()
  102. }
  103. },
  104. methods: {
  105. checkPermi,
  106. checkRole,
  107. getConfirm(){
  108. this.pageNum=1;
  109. this.list=[];
  110. this.reachflag=true;
  111. this.getDataFn()
  112. },
  113. getResetFn(){
  114. // 重置
  115. this.jclx='';
  116. this.orderFoodType='';
  117. this.title="";
  118. this.getConfirm()
  119. },
  120. getBack() {
  121. uni.navigateBack({
  122. delta: 1
  123. })
  124. },
  125. getDetail(id){
  126. var obj={
  127. id:id,
  128. type:'edit'
  129. }
  130. this.$tab.navigateTo('/work/pages/yyorder/limitdetail?data='+encodeURIComponent(JSON.stringify(obj)))
  131. },
  132. getDetailDay(){
  133. this.$tab.navigateTo('/work/pages/yyorder/eatlistday')
  134. },
  135. getAddFn(){
  136. this.$tab.navigateTo('/work/pages/yyorder/limitdetail')
  137. },
  138. bindTimeChangea(e){
  139. var val=e.detail.value;
  140. this.jclx=this.jclxlist[val].dictLabel;
  141. this.orderFoodType=this.jclxlist[val].dictValue;
  142. this.getConfirm()
  143. },
  144. getHeightFn() {
  145. let query = uni.createSelectorQuery().in(this);
  146. //需要给黄色区域设置一个id标识,在这里是demo
  147. query.select('.navbox').boundingClientRect(data => {
  148. var top = data.top < 0 ? -data.top : data.top;
  149. var stubarHeight = Number(this.stubarHeight);
  150. this.marTop = stubarHeight > 0 ? 692 - Number(data.height) * 2 : 692 - Number(data.height) *
  151. 2 + 40 //赋值,待会要用
  152. if (top <= this.nvaHeight) {
  153. const opacity = top / 100 // 计算透明度值
  154. const color = `rgba(4, 145, 253, ${opacity})`
  155. this.backgroundColor = color // 更新盒子背景颜色
  156. } else {
  157. this.backgroundColor = '#00A9F0'
  158. }
  159. }).exec();
  160. },
  161. init() {
  162. // 门禁
  163. getDictionaryFn('menj').then(res=>{
  164. if(res.code==200){
  165. this.mjlist = res.data.map(v => {
  166. return {
  167. dictLabel: v.dictLabel,
  168. dictValue: v.dictValue
  169. }
  170. })
  171. }
  172. })
  173. },
  174. getDelFn(id){
  175. var that=this;
  176. getManagementDel(id).then(res=>{
  177. if(res.code==200){
  178. this.$toast('删除成功')
  179. setTimeout(function(){
  180. that.getConfirm()
  181. },1200)
  182. }
  183. })
  184. },
  185. getDataFn() {
  186. var params = {
  187. pageSize: this.pageSize,
  188. pageNum: this.pageNum,
  189. }
  190. if(this.title){
  191. params.personneName=this.title
  192. }
  193. getManagementList(params).then(res => {
  194. if (res.code == 200) {
  195. if (res.rows.length < this.pageSize) {
  196. this.reachflag = false
  197. this.wtdt = '到底了~';
  198. } else {
  199. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum -
  200. 1)
  201. if (num < res.total) {
  202. this.reachflag = true
  203. this.wtdt = '上拉加载更多'
  204. } else {
  205. this.reachflag = false
  206. this.wtdt = '到底了~';
  207. }
  208. }
  209. if (this.pageNum == 1) {
  210. this.list = res.rows;
  211. } else {
  212. this.list = this.list.concat(res.rows)
  213. }
  214. } else {
  215. this.$toast(res.msg)
  216. }
  217. })
  218. },
  219. },
  220. }
  221. </script>
  222. <style>
  223. /* page {
  224. background: #ffffff;
  225. } */
  226. </style>
  227. <style lang="scss" scoped>
  228. .navbox{position: fixed;left: 0;right: 0;top: 0;z-index: 4; }
  229. .navbg{width: 100%;height: 692rpx;}
  230. .zxmain{position: relative;padding: 8rpx 32rpx 100rpx;box-sizing: border-box;}
  231. .search{padding: 0 52rpx;box-sizing: border-box;
  232. width: 100%;height: 76rpx;background: rgba(40, 139, 214, 0.5);border-radius: 38rpx;
  233. image{width: 24rpx;height: 24rpx;margin-right: 22rpx;flex: 0 0 auto;}
  234. input{flex: 1;font-weight: 500;font-size: 22rpx;color: #FFFFFF;}
  235. }
  236. .daybtn{font-weight: 500;font-size: 26rpx;color: #FFFFFF;flex: 0 0 auto;
  237. image{width: 30rpx;height: 30rpx;margin-right: 8rpx;}
  238. }
  239. .lbtab{padding-left:18rpx;
  240. .limg{width: 24rpx;height: 24rpx;margin-right: 16rpx;flex:0 0 auto;}
  241. .lbtabs{overflow: auto;flex-wrap: nowrap;flex:1;
  242. .pickbox{text-align: right;font-weight: 500;font-size: 28rpx;color: #161616;min-height:88rpx;margin: 0 10rpx;
  243. .pickboxa{justify-content: center;
  244. min-height: 88rpx;display: flex;align-items: center;
  245. }
  246. .tit{font-weight: 500;font-size: 26rpx;color: #FFFFFF;}
  247. .hupimg{width: 16rpx;height: 10rpx;margin-left: 26rpx;flex: 0 0 auto;}
  248. }
  249. }
  250. }
  251. </style>