list.vue 6.8 KB

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