qylist.vue 4.5 KB

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