list.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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. getDownloader(path,name){
  109. console.log(path,name)
  110. // #ifdef APP-PLUS
  111. plus.android.requestPermissions([
  112. 'android.permission.WRITE_EXTERNAL_STORAGE',
  113. 'android.permission.READ_EXTERNAL_STORAGE',
  114. 'android.permission.INTERNET',
  115. 'android.permission.ACCESS_WIFI_STATE'
  116. ], error => {
  117. var url = baseUrl + path;
  118. let dtask = plus.downloader.createDownload(url, {
  119. filename: 'file://storage/emulated/0/'+baseName+'/' + name
  120. }, (d, status) => {
  121. //d为下载的文件对象
  122. if (status == 200) {
  123. uni.hideLoading();
  124. uni.showToast({
  125. icon: 'none',
  126. mask: true,
  127. title: '已保存到文件夹:/'+baseName+'/'+ name, //保存路径
  128. duration: 3000,
  129. });
  130. //下载成功,d.filename是文件在保存在本地的相对路径,使用下面的API可转为平台绝对路径
  131. let fileSaveUrl = plus.io.convertLocalFileSystemURL(d.filename);
  132. setTimeout(() => {
  133. plus.runtime.openFile(d.filename); //选择软件打开文件
  134. }, 1500)
  135. } else {
  136. //下载失败
  137. uni.hideLoading();
  138. plus.downloader.clear(); //清除下载任务
  139. uni.showToast({
  140. icon: 'none',
  141. mask: true,
  142. title: '下载失败,请稍后重试',
  143. });
  144. }
  145. })
  146. dtask.start();
  147. }, success=> {
  148. uni.showToast({
  149. title: '无法获取权限,文件下载将出错!',
  150. icon: 'none',
  151. })
  152. })
  153. // #endif
  154. },
  155. getXzFn(ite){
  156. // 本地路径开头使用file://,跟上手机文件本地目录storage/emulated/0,
  157. // 后缀是用于文件命名和格式修改,大家可以使用变量。
  158. var url =ite.url;
  159. var name=ite.name;
  160. this.getDownloader(url,name)
  161. },
  162. getDataFn(){
  163. var params={
  164. pageSize:this.pageSize,
  165. pageNum: this.pageNum,
  166. // loanApplicationType:4,
  167. }
  168. if(this.sbsj){
  169. params['params[beginTime]']=this.sbsj
  170. }
  171. if(this.usename){
  172. params.enterpriseName=this.usename
  173. }
  174. getListOss(params).then(res=>{
  175. if(res.code==200){
  176. if (res.rows.length < this.pageSize) {
  177. this.reachflag = false
  178. this.wtdt = '到底了~';
  179. } else {
  180. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  181. if (num < res.total) {
  182. this.reachflag = true
  183. this.wtdt = ''
  184. } else {
  185. this.reachflag = false
  186. this.wtdt = '到底了~';
  187. }
  188. }
  189. if (this.pageNum == 1) {
  190. this.list = res.rows;
  191. } else {
  192. this.list = this.list.concat(res.rows)
  193. }
  194. }else{
  195. this.$toast(res.msg)
  196. }
  197. })
  198. },
  199. },
  200. }
  201. </script>
  202. <style lang="scss" scoped>
  203. .fixedt{position: fixed;left: 0;right: 0;top: 0;z-index: 2;}
  204. // .fixedt /deep/ uni-picker{flex: 1;}
  205. .checkbox{padding:16rpx 32rpx;background-color: #efefef;
  206. .chekt{display: flex;align-items: center;margin-right: 12rpx;height:88rpx;
  207. view{text-align: center;
  208. 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;}
  209. image{width: 16rpx;height: 12rpx;flex: 0 0 auto;margin-left: 4rpx;}
  210. }
  211. }
  212. .reset{width:56rpx; height: 88rpx;display: flex;align-items: center;justify-content: center;
  213. image{width: 26rpx;height: 30rpx;}
  214. }
  215. .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;
  216. margin-left: 20rpx;
  217. input{font-weight: 500;font-size: 26rpx;color: #222327;}
  218. image{width: 30rpx;height: 30rpx;margin-right: 16rpx;flex: 0 0 auto;}
  219. }
  220. .listbox{padding-top: 120rpx;padding-bottom: 100rpx;}
  221. .scanbox{position: fixed;left: 0;right: 0;bottom: 0;height: 100rpx;
  222. background: #00A9F0;font-weight: bold;font-size: 30rpx;color: #FFFFFF;
  223. image{width: 26rpx;height: 26rpx;margin-right: 24rpx;}
  224. }
  225. </style>