qylist.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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. }
  33. },
  34. // 上拉触底加载更多触发事件
  35. onReachBottom() {
  36. if (this.reachflag) {
  37. this.pageNum++
  38. this.getDataFn()
  39. }
  40. },
  41. onUnload() {
  42. uni.$off('qyRefresh')
  43. },
  44. onLoad() {
  45. this.getDataFn()
  46. uni.$on('qyRefresh',(e) => {
  47. this.getrefreshData()
  48. })
  49. },
  50. methods:{
  51. checkPermi, checkRole,
  52. getAddQy(){
  53. this.$tab.navigateTo("/work/pages/prove/addqy?type=add")
  54. },
  55. getTabFn(val){
  56. this.tabval=val
  57. },
  58. bindDateChangea(e){
  59. var val=e.detail.value;
  60. this.sbsj=val;
  61. this.getrefreshData()
  62. },
  63. bindDateChangeb(e){
  64. var val=e.detail.value;
  65. this.shzt=this.shlist[val].label;
  66. this.shztid=this.shlist[val].value;
  67. this.getrefreshData()
  68. },
  69. getResetFn(){
  70. // 重置
  71. this.getrefreshData()
  72. },
  73. getrefreshData(){
  74. this.pageNum=1;
  75. this.list=[];
  76. this.reachflag=true;
  77. this.getDataFn()
  78. },
  79. getEdit(e){
  80. this.$tab.navigateTo("/work/pages/prove/addqy?type=edit&id="+e)
  81. },
  82. getDel(e){
  83. var that = this;
  84. uni.showModal({
  85. title: '确认删除',
  86. content: "是否确认删除",
  87. cancelText: '取消删除',
  88. confirmText: '确认删除',
  89. success: function(res) {
  90. if (res.confirm) {
  91. getEnterpriseDel(e).then(res=>{
  92. if(res.code==200){
  93. that.$toast("删除成功")
  94. setTimeout(function(){
  95. that.getrefreshData()
  96. },1200)
  97. }
  98. })
  99. } else if (res.cancel) {
  100. }
  101. }
  102. });
  103. },
  104. getDataFn(){
  105. var params={
  106. pageSize:this.pageSize,
  107. pageNum: this.pageNum,
  108. }
  109. getEnterpriseList(params).then(res=>{
  110. if(res.code==200){
  111. if (res.rows.length < this.pageSize) {
  112. this.reachflag = false
  113. this.wtdt = '到底了~';
  114. } else {
  115. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  116. if (num < res.total) {
  117. this.reachflag = true
  118. this.wtdt = ''
  119. } else {
  120. this.reachflag = false
  121. this.wtdt = '到底了~';
  122. }
  123. }
  124. if (this.pageNum == 1) {
  125. this.list = res.rows;
  126. } else {
  127. this.list = this.list.concat(res.rows)
  128. }
  129. }else{
  130. this.$toast(res.msg)
  131. }
  132. })
  133. },
  134. },
  135. }
  136. </script>
  137. <style lang="scss" scoped>
  138. .fixedt{position: fixed;left: 0;right: 0;top: 0;z-index: 2;}
  139. // .fixedt /deep/ uni-picker{flex: 1;}
  140. .checkbox{padding:16rpx 32rpx;background-color: #efefef;
  141. .chekt{display: flex;align-items: center;margin-right: 12rpx;height:88rpx;
  142. view{text-align: center;
  143. 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;}
  144. image{width: 16rpx;height: 12rpx;flex: 0 0 auto;margin-left: 4rpx;}
  145. }
  146. }
  147. .reset{width:56rpx; height: 88rpx;display: flex;align-items: center;justify-content: center;
  148. image{width: 26rpx;height: 30rpx;}
  149. }
  150. .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;
  151. flex:1;margin-left: 20rpx;
  152. input{font-weight: 500;font-size: 26rpx;color: #222327;}
  153. image{width: 30rpx;height: 30rpx;margin-right: 16rpx;flex: 0 0 auto;}
  154. }
  155. .listbox{padding-top: 24rpx;padding-bottom: 100rpx;}
  156. .scanbox{position: fixed;left: 0;right: 0;bottom: 0;height: 100rpx;
  157. background: #00A9F0;font-weight: bold;font-size: 30rpx;color: #FFFFFF;
  158. image{width: 30rpx;height: 30rpx;margin-right: 10rpx;}
  159. }
  160. </style>