listProject.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <view>
  3. <image src="/static/icon/background.png" mode="" class="background"></image>
  4. <view class="" style="padding-top: 0rpx;">
  5. <!-- <back></back> -->
  6. </view>
  7. <view >
  8. <u-grid :col="4">
  9. <u-grid-item @click="getProjectList(index1)" v-for="(item, index1) in viewList" :bg-color="index1==index ? '#6aabff':''" :index="index1">
  10. <image :src="item.src" mode="" style="height: 100rpx;width: 100rpx;"></image>
  11. <view class="grid-text">{{item.name}}</view>
  12. </u-grid-item>
  13. </u-grid>
  14. <view>
  15. <u-search placeholder="请输入搜索内容" v-model="value1" shape="square" :show-action="false" :action-style="{'font-size':'40rpx'}" @search="gethosList()"></u-search>
  16. </view>
  17. <view v-for="(item,index) in list" :key="index" >
  18. <view class="project-content" @click="gotoindex(item)">
  19. <view>
  20. <view class="font-forty-eight blue">
  21. 项目名称:{{item.name}}
  22. </view>
  23. <view class="font-forty-eight blue">
  24. 项目时间:{{item.time}}
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import service from '@/api/index.js'
  34. export default {
  35. data() {
  36. return {
  37. list:[],
  38. value:'',
  39. value1:'',
  40. nameValue:'',
  41. civilPower:'',
  42. userId:'',
  43. index:-1,
  44. ReachBottom:true,
  45. page:1,
  46. viewList:[{name:'抢险维修',src:'../../static/icon/qxwx.png'},{name:'调压箱管理',src:'../../static/icon/xxdy.png'},{name:'庭院网管',src:'../../static/icon/tywg.png'},{name:'警示桩管理',src:'../../static/icon/jsz.png'}]
  47. }
  48. },
  49. onLoad(e) {
  50. console.log(e)
  51. this.nameValue = e.nameValue
  52. //this.getProjectList();
  53. this.getUserName();
  54. uni.setNavigationBarTitle({
  55. title: '历史记录',
  56. });
  57. uni.setNavigationBarColor({
  58. frontColor: '#ffffff',
  59. backgroundColor: '#2d95f4',
  60. })
  61. },
  62. onReachBottom(){
  63. console.log('触底')
  64. this.getReachBottom()
  65. },
  66. onPullDownRefresh()
  67. {
  68. console.log('下拉刷新')
  69. this.getvalueproject()
  70. },
  71. methods: {
  72. getReachBottom()
  73. {
  74. if (this.ReachBottom) {
  75. this.page+=1
  76. this.getvalueproject()
  77. }else
  78. {
  79. this.page=1
  80. this.ReachBottom=false
  81. }
  82. },
  83. gotoindex(item){
  84. console.log(item)
  85. if(this.index==1)
  86. {//调压箱
  87. console.log(item)
  88. uni.navigateTo({
  89. url: `/pages/noLogin/PressureRegulatingBox/PressureRegulatingBox?type=1&id=${item.id}`
  90. })
  91. }else if(this.index==2)
  92. {//庭院管理
  93. uni.navigateTo({
  94. url: `/pages/noLogin/CourtyardNetworkManagement/CourtyardNetworkManagement?type=1&id=${item.id}`
  95. })
  96. }else if(this.index==0)
  97. {//抢险维修
  98. uni.navigateTo({
  99. url: `/pages/noLogin/emergencyRepairOrder/emergencyRepairOrder?type=1&id=${item.id}`
  100. })
  101. }else if(this.index==3)
  102. {//警示桩
  103. console.log(item)
  104. let url1= `/pages/noLogin/WarningPileForm/WarningPileForm?type=1&id=${item.id}`
  105. uni.navigateTo({
  106. url: url1
  107. })
  108. }
  109. // uni.switchTab({
  110. // url:'/pages/index/index'
  111. // })
  112. },
  113. topage(url){
  114. uni.navigateTo({
  115. url
  116. })
  117. },
  118. getvalueproject()
  119. {
  120. service.getSearch({type:this.index,userId:this.userId,page:this.page,size:10,value:this.value1}).then(res=>{
  121. console.log('getProjectType', res)
  122. if(null==res){
  123. //this.$UTILS.showPrompt('暂无历史记录!')
  124. return
  125. }
  126. let list1=[]
  127. list1=res
  128. this.list.push(...list1)
  129. // list1.forEach(item=>{
  130. // this.list.push(item)
  131. // })
  132. //this.list = res;
  133. })
  134. },
  135. gethosList()
  136. {
  137. service.getSearch({type:this.index,userId:this.userId,page:this.page,size:10,value:this.value1}).then(res=>{
  138. console.log('getProjectType', res)
  139. if(res.length == 0){
  140. this.list=[]
  141. this.$UTILS.showPrompt('暂无历史记录!')
  142. return
  143. }
  144. let list1=[]
  145. list1=res
  146. list1.forEach(item=>{
  147. this.list.push(item)
  148. })
  149. this.list = res;
  150. })
  151. },
  152. getProjectList(val) {
  153. this.page=1
  154. this.value1=''
  155. this.ReachBottom=true
  156. console.log(val,'11111111')
  157. if(val==this.index)
  158. {
  159. this.index=-1
  160. return
  161. }
  162. this.index=val
  163. this.list=[]
  164. service.getSearch({type:val,userId:this.userId,page:this.page,size:10,value:this.value1}).then(res=>{
  165. console.log('getProjectType', res)
  166. if(res.length == 0){
  167. this.$UTILS.showPrompt('暂无历史记录!')
  168. return
  169. }
  170. let list1=[]
  171. list1=res
  172. list1.forEach(item=>{
  173. if(item.type==1)
  174. {
  175. item.typeValue='调压箱'
  176. }else if(item.type==2)
  177. {
  178. item.typeValue='庭院管网'
  179. }
  180. else if(item.type==3)
  181. {
  182. item.typeValue='抢险维修'
  183. }else if(item.type==4)
  184. {
  185. item.typeValue='警示桩'
  186. }
  187. this.list.push(item)
  188. })
  189. //this.list = res;
  190. })
  191. },
  192. getUserName(){
  193. service.getUserName().then(res=>{
  194. this.userId=res.id
  195. this.civilPower = res.civilPower;
  196. })
  197. },
  198. },
  199. }
  200. </script>
  201. <style lang="scss" scoped>
  202. .background {
  203. z-index: -1;
  204. position: fixed;
  205. width: 100%;
  206. height: 100%;
  207. background-size: 100% 100%;
  208. }
  209. .project {
  210. border-radius: 72rpx;
  211. padding: 25rpx 0;
  212. text-align: center;
  213. margin: 170rpx 55rpx 0;
  214. }
  215. .project-content {
  216. border: 4rpx solid #3857F3;
  217. margin: 40rpx 55rpx 0;
  218. padding: 30rpx 20rpx;
  219. border-radius: 48rpx;
  220. }
  221. .position{
  222. position: absolute;
  223. bottom: 100rpx;
  224. right: 50rpx;
  225. .arrow{
  226. width: 152rpx;
  227. height: 152rpx;
  228. border-radius: 50%;
  229. padding: 25rpx;
  230. margin-left: 20rpx;
  231. }
  232. }
  233. </style>