list.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <view class="listbox">
  3. <view class="fixedt">
  4. <!-- 选择器 -->
  5. <view class="flexc checkbox">
  6. <picker mode="date" fields="year" @change='bindDateChangea'>
  7. <view class="chekt">
  8. <view>{{sbsj|| "申报时间"}}</view>
  9. <image :src="upimg"></image>
  10. </view>
  11. </picker>
  12. <!-- <picker range-key='label' :value="shidx" :range="shlist" @change='bindDateChangeb'>
  13. <view class="chekt">
  14. <view>{{shzt || "申贷次数"}}</view>
  15. <image :src="upimg"></image>
  16. </view>
  17. </picker> -->
  18. <view class="reset" @click="getResetFn">
  19. <image :src="resetimg"></image>
  20. </view>
  21. <view class="topc flexc">
  22. <image :src="secimg"></image>
  23. <input placeholder="请输入企业名称" confirm-type="search" v-model="usename" @confirm="getConfirm"/>
  24. </view>
  25. </view>
  26. </view>
  27. <!-- 列表 -->
  28. <view class="plr18">
  29. <bus-list :datalist="list" :wtdt="wtdt" :type="type" @getXzFn="getXzFn"></bus-list>
  30. </view>
  31. <view class="scanbox flexcc">
  32. <image :src="scanimg"></image>
  33. 扫码查看
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import config from '@/config'
  39. const baseUrl = config.baseUrl
  40. const baseName = config.baseName
  41. import busList from "@/work/components/business/list.vue"
  42. import {getListOss} from "@/api/common.js"
  43. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  44. export default{
  45. components:{busList},
  46. data(){
  47. return{
  48. secimg:require("@/static/images/home/hsearch.png"),
  49. upimg:require('@/work/static/images/sup.png'),
  50. resetimg:require('@/work/static/images/reset.png'),
  51. scanimg:require('@/work/static/images/scan.png'),
  52. list:[],
  53. pageSize: 10,
  54. pageNum: 1,
  55. reachflag: true,
  56. wtdt:'',
  57. // limit:''
  58. type:'nfiles',//file 老版, nfiles新版
  59. sbsj:'',
  60. usename:'',
  61. // type:'//file ',
  62. }
  63. },
  64. // 上拉触底加载更多触发事件
  65. onReachBottom() {
  66. if (this.reachflag) {
  67. this.pageNum++
  68. this.getDataFn()
  69. }
  70. },
  71. onLoad() {
  72. this.getDataFn()
  73. },
  74. methods:{
  75. checkPermi, checkRole,
  76. getDetail(e){
  77. this.$tab.navigateTo("/work/pages/file/wjdetails?id="+e)
  78. },
  79. getConfirm(){
  80. this.getrefreshData()
  81. },
  82. getTabFn(val){
  83. this.tabval=val
  84. },
  85. bindDateChangea(e){
  86. var val=e.detail.value;
  87. this.sbsj=val;
  88. this.getrefreshData()
  89. },
  90. bindDateChangeb(e){
  91. var val=e.detail.value;
  92. this.shzt=this.shlist[val].label;
  93. this.shztid=this.shlist[val].value;
  94. this.getrefreshData()
  95. },
  96. getResetFn(){
  97. // 重置
  98. this.sbsj='';
  99. this.usename='';
  100. this.getrefreshData()
  101. },
  102. getrefreshData(){
  103. this.pageNum=1;
  104. this.list=[];
  105. this.reachflag=true;
  106. this.getDataFn()
  107. },
  108. getXzFn(ite){
  109. // 本地路径开头使用file://,跟上手机文件本地目录storage/emulated/0,
  110. // 后缀是用于文件命名和格式修改,大家可以使用变量。
  111. var url = baseUrl + ite.url;
  112. var name=ite.name;
  113. let dtask = plus.downloader.createDownload(url, {
  114. filename: 'file://storage/emulated/0/'+baseName+'/' + name
  115. }, (d, status) => {
  116. //d为下载的文件对象
  117. if (status == 200) {
  118. uni.hideLoading();
  119. uni.showToast({
  120. icon: 'none',
  121. mask: true,
  122. title: '已保存到文件夹:/'+baseName+'/'+ name, //保存路径
  123. duration: 3000,
  124. });
  125. //下载成功,d.filename是文件在保存在本地的相对路径,使用下面的API可转为平台绝对路径
  126. let fileSaveUrl = plus.io.convertLocalFileSystemURL(d.filename);
  127. setTimeout(() => {
  128. plus.runtime.openFile(d.filename); //选择软件打开文件
  129. }, 1500)
  130. } else {
  131. //下载失败
  132. uni.hideLoading();
  133. plus.downloader.clear(); //清除下载任务
  134. uni.showToast({
  135. icon: 'none',
  136. mask: true,
  137. title: '下载失败,请稍后重试',
  138. });
  139. }
  140. })
  141. dtask.start();
  142. },
  143. getDataFn(){
  144. var params={
  145. pageSize:this.pageSize,
  146. pageNum: this.pageNum,
  147. // loanApplicationType:4,
  148. }
  149. if(this.sbsj){
  150. params['params[beginTime]']=this.sbsj
  151. }
  152. if(this.usename){
  153. params.enterpriseName=this.usename
  154. }
  155. getListOss(params).then(res=>{
  156. if(res.code==200){
  157. if (res.rows.length < this.pageSize) {
  158. this.reachflag = false
  159. this.wtdt = '到底了~';
  160. } else {
  161. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  162. if (num < res.total) {
  163. this.reachflag = true
  164. this.wtdt = ''
  165. } else {
  166. this.reachflag = false
  167. this.wtdt = '到底了~';
  168. }
  169. }
  170. if (this.pageNum == 1) {
  171. this.list = res.rows;
  172. } else {
  173. this.list = this.list.concat(res.rows)
  174. }
  175. }else{
  176. this.$toast(res.msg)
  177. }
  178. })
  179. },
  180. },
  181. }
  182. </script>
  183. <style lang="scss" scoped>
  184. .fixedt{position: fixed;left: 0;right: 0;top: 0;z-index: 2;}
  185. // .fixedt /deep/ uni-picker{flex: 1;}
  186. .checkbox{padding:16rpx 32rpx;background-color: #efefef;
  187. .chekt{display: flex;align-items: center;margin-right: 12rpx;height:88rpx;
  188. view{text-align: center;
  189. 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;}
  190. image{width: 16rpx;height: 12rpx;flex: 0 0 auto;margin-left: 4rpx;}
  191. }
  192. }
  193. .reset{width:56rpx; height: 88rpx;display: flex;align-items: center;justify-content: center;
  194. image{width: 26rpx;height: 30rpx;}
  195. }
  196. .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;
  197. margin-left: 20rpx;
  198. input{font-weight: 500;font-size: 26rpx;color: #222327;}
  199. image{width: 30rpx;height: 30rpx;margin-right: 16rpx;flex: 0 0 auto;}
  200. }
  201. .listbox{padding-top: 120rpx;padding-bottom: 100rpx;}
  202. .scanbox{position: fixed;left: 0;right: 0;bottom: 0;height: 100rpx;
  203. background: #00A9F0;font-weight: bold;font-size: 30rpx;color: #FFFFFF;
  204. image{width: 26rpx;height: 26rpx;margin-right: 24rpx;}
  205. }
  206. </style>