qylist.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <view class="listbox">
  3. <!-- 列表 -->
  4. <view class="plr18">
  5. <bus-list :datalist="list" :wtdt="wtdt" :type="type" @getEdit="getEdit" @getDel="getDel"></bus-list>
  6. </view>
  7. <view class="scanbox flexcc" @click="getAddQy" v-if="checkPermi(['enterprise:enterprise:add'])">
  8. <image :src="addqy"></image>添加企业</view>
  9. </view>
  10. </template>
  11. <script>
  12. import config from '@/config'
  13. const baseUrl = config.baseUrl
  14. import busList from "@/work/components/business/list.vue"
  15. import {getEnterpriseList,getEnterpriseDel} from "@/api/mine/card.js"
  16. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  17. export default{
  18. components:{busList},
  19. data(){
  20. return{
  21. secimg:require("@/static/images/home/hsearch.png"),
  22. upimg:require('@/work/static/images/sup.png'),
  23. resetimg:require('@/work/static/images/reset.png'),
  24. addqy:require('@/work/static/images/prove/addqya.png'),
  25. list:[],
  26. pageSize: 10,
  27. pageNum: 1,
  28. reachflag: true,
  29. wtdt:'',
  30. // limit:''
  31. type:'qylist',
  32. userType:this.$store.state.user.userType,
  33. userId:this.$store.state.user.userId,
  34. }
  35. },
  36. // 上拉触底加载更多触发事件
  37. onReachBottom() {
  38. if (this.reachflag) {
  39. this.pageNum++
  40. this.getDataFn()
  41. }
  42. },
  43. onUnload() {
  44. uni.$off('qyRefresh')
  45. },
  46. onLoad() {
  47. this.getDataFn()
  48. uni.$on('qyRefresh',(e) => {
  49. this.getrefreshData()
  50. })
  51. },
  52. methods:{
  53. checkPermi, checkRole,
  54. getAddQy(){
  55. this.$tab.navigateTo("/work/pages/prove/addqy?type=add")
  56. },
  57. getTabFn(val){
  58. this.tabval=val
  59. },
  60. bindDateChangea(e){
  61. var val=e.detail.value;
  62. this.sbsj=val;
  63. this.getrefreshData()
  64. },
  65. bindDateChangeb(e){
  66. var val=e.detail.value;
  67. this.shzt=this.shlist[val].label;
  68. this.shztid=this.shlist[val].value;
  69. this.getrefreshData()
  70. },
  71. getResetFn(){
  72. // 重置
  73. this.getrefreshData()
  74. },
  75. getrefreshData(){
  76. this.pageNum=1;
  77. this.list=[];
  78. this.reachflag=true;
  79. this.getDataFn()
  80. },
  81. getEdit(e){
  82. this.$tab.navigateTo("/work/pages/prove/addqy?type=edit&id="+e)
  83. },
  84. getDel(e){
  85. var that = this;
  86. uni.showModal({
  87. title: '确认删除',
  88. content: "是否确认删除",
  89. cancelText: '取消删除',
  90. confirmText: '确认删除',
  91. success: function(res) {
  92. if (res.confirm) {
  93. getEnterpriseDel(e).then(res=>{
  94. if(res.code==200){
  95. that.$toast("删除成功")
  96. setTimeout(function(){
  97. that.getrefreshData()
  98. },1200)
  99. }
  100. })
  101. } else if (res.cancel) {
  102. }
  103. }
  104. });
  105. },
  106. getDataFn(){
  107. var params={
  108. pageSize:this.pageSize,
  109. pageNum: this.pageNum,
  110. }
  111. if(this.userType=='01'){
  112. params.userId=this.userId
  113. }
  114. console.log(this.userType)
  115. getEnterpriseList(params).then(res=>{
  116. if(res.code==200){
  117. if (res.rows.length < this.pageSize) {
  118. this.reachflag = false
  119. this.wtdt = '到底了~';
  120. } else {
  121. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  122. if (num < res.total) {
  123. this.reachflag = true
  124. this.wtdt = ''
  125. } else {
  126. this.reachflag = false
  127. this.wtdt = '到底了~';
  128. }
  129. }
  130. if (this.pageNum == 1) {
  131. this.list = res.rows;
  132. } else {
  133. this.list = this.list.concat(res.rows)
  134. }
  135. }else{
  136. this.$toast(res.msg)
  137. }
  138. })
  139. },
  140. },
  141. }
  142. </script>
  143. <style lang="scss" scoped>
  144. .fixedt{position: fixed;left: 0;right: 0;top: 0;z-index: 2;}
  145. // .fixedt /deep/ uni-picker{flex: 1;}
  146. .checkbox{padding:16rpx 32rpx;background-color: #efefef;
  147. .chekt{display: flex;align-items: center;margin-right: 12rpx;height:88rpx;
  148. view{text-align: center;
  149. font-weight: bold;font-size: 26rpx;color: #374B61;width: 136rpx;word-break: break-all;text-overflow: ellipsis;overflow: hidden;display: -webkit-box;-webkit-line-clamp: 2;-webkit-box-orient: vertical;white-space: normal;}
  150. image{width: 16rpx;height: 12rpx;flex: 0 0 auto;margin-left: 4rpx;}
  151. }
  152. }
  153. .reset{width:56rpx; height: 88rpx;display: flex;align-items: center;justify-content: center;
  154. image{width: 26rpx;height: 30rpx;}
  155. }
  156. .topc{border-radius: 34rpx;height:68rpx;box-sizing: border-box;padding:0 28rpx;position: relative;flex:1;background-color:rgba(90, 135, 186, 0.2);width: 260rpx;
  157. flex:1;margin-left: 20rpx;
  158. input{font-weight: 500;font-size: 26rpx;color: #222327;flex: 1;}
  159. image{width: 30rpx;height: 30rpx;margin-right: 16rpx;flex: 0 0 auto;}
  160. }
  161. .listbox{padding-top: 24rpx;padding-bottom: 100rpx;}
  162. .scanbox{position: fixed;left: 0;right: 0;bottom: 0;height: 100rpx;
  163. background: #00A9F0;font-weight: bold;font-size: 30rpx;color: #FFFFFF;
  164. image{width: 30rpx;height: 30rpx;margin-right: 10rpx;}
  165. }
  166. </style>