searchResults.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <view>
  3. <!--头部 搜索框 -->
  4. <view class="flex justify-between fixed cu-bar search bg-blue" :style="style">
  5. <view class="action">
  6. <image src="/static/user/bask.png" @click="back(1)" class="login-img"></image>
  7. </view>
  8. <view class="search-form round">
  9. <view @click="showdialog()" style="margin-left: 10px;" class="flex align-center">
  10. <text style="font-size: 28rpx;">{{typeName}}</text>
  11. <text v-if="icon" class="cuIcon-unfold"></text>
  12. <text v-else="icon" class="cuIcon-fold"></text>
  13. </view>
  14. <text class="margin-left-sm"> | </text>
  15. <image src="/static/index/search-gray.png" class="login-img margin-left margin-right" style="padding: 0;"></image>
  16. <input @click="back(2)" style="padding: 0;" v-model="searchValue" type="text" placeholder="请输入关键字搜索" confirm-type="search"></input>
  17. <image style="padding: 0;" @click="back(2)" src="/static/index/delete-gray.png" class="login-img margin-right-sm"></image>
  18. </view>
  19. </view>
  20. <scroll-view scroll-y="true" class="bg-white" style="height: 100vh;" lower-threshold="200" @scrolltolower="paging">
  21. <view :style="paddingTop"></view>
  22. <!-- 内容 -->
  23. <view class="cu-card article no-card">
  24. <view v-if="data.length>0" class="cu-item shadow solid-bottom" v-for="(item,index) in data" :key="item.id" @click="navTo(item)">
  25. <view class="content">
  26. <view class="desc">
  27. <view class="text-black text-lg padding-top " style="color:#101010 ;">
  28. {{item.name}}
  29. </view>
  30. <view class="padding-top">
  31. <view class="">
  32. <image :src="item.type == 4 ? '/static/index/fill-Information.png' : '/static/index/fill-Information-gray.png'" class="menuImageTask margin-right-sm" ></image>
  33. <image :src="item.type == 4 || item.type != 4 ? '/static/index/dataAccuracy.png':'/static/index/dataAccuracy-gray.png'" class="menuImageTask margin-right-sm" ></image>
  34. <image :src="item.type == 4 || item.type != 4 ? '/static/index/shigong.png':'/static/index/shigong-gray.png'" class="menuImageTask margin-right-sm"></image>
  35. <image :src="item.type == 4 ? '/static/index/constructionLedger.png':'/static/index/constructionLedger-gray.png'" class="menuImageTask margin-right-sm" ></image>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="bg-white text-center" v-if="showOther">
  42. <view v-if="data.length==0">
  43. <view>
  44. <image class="menuImageNoTask" src="/static/task/noTask.png"></image>
  45. </view>
  46. <view style="padding:28rpx 0 132rpx;font-size: 26rpx;color: #8A8A8A;" class="list_no">没有找到符合条件的记录~</view>
  47. </view>
  48. <view v-else class="list_no">
  49. 没有更多内容了~
  50. </view>
  51. </view>
  52. </view>
  53. </scroll-view>
  54. <!-- 弹窗 -->
  55. <view class="cu-modal bottom-modal" :class="modalShow?'show':''" >
  56. <view class="cu-dialog" style="background-color: white;border-radius: 20rpx 20rpx 0 0;">
  57. <view class="cu-bar bg-white">
  58. <view class="action text-gray"></view>
  59. <view class="action text-black text-bold" style="color: #101010;">选择分类</view>
  60. <view class="action text-gray" @tap="showdialog()">取消</view>
  61. </view>
  62. <view class="">
  63. <radio-group class="block" @change="RadioChange">
  64. <view class="cu-list menu text-left" v-for="(item,index) in list" :key="index">
  65. <view class="cu-item" v-if="index!=2">
  66. <label class="flex justify-between align-center flex-sub">
  67. <view class="flex-sub">{{item.name}}</view>
  68. <radio class="round" :class="radio==item.vlaue ?'checked':''" :checked="radio==item.vlaue ? true:false"
  69. :value="item.value"></radio>
  70. </label>
  71. </view>
  72. <view class="cu-item" v-else-if="index==2 && choose" >
  73. <label class="flex justify-between align-center flex-sub">
  74. <view class="flex-sub" style="color: #101010;">{{item.name}}</view>
  75. <radio class="round" :class="radio==item.vlaue ?'checked':''" :checked="radio==item.vlaue ? true:false"
  76. :value="item.value"></radio>
  77. </label>
  78. </view>
  79. </view>
  80. </radio-group>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. </template>
  86. <script>
  87. export default {
  88. computed: {
  89. style() {
  90. var StatusBar= this.StatusBar;
  91. var CustomBar= this.CustomBar;
  92. var bgImage = this.bgImage;
  93. var style = `height:${CustomBar}px;padding-top:${StatusBar}px;`;
  94. if (this.bgImage) {
  95. style = `${style}background-image:url(${bgImage});`;
  96. }
  97. return style
  98. }
  99. },
  100. data() {
  101. return {
  102. searchValue:"",
  103. listBoxStyle: '',
  104. list: [
  105. {value:'0',name:'全部节点'},
  106. {value:'1',name:'单位工程'},
  107. {value:'2',name:'分部工程'},
  108. {value:'3',name:'分项工程'},
  109. {value:'4',name:'工序节点'}
  110. ],
  111. data:[],
  112. showOther:false,
  113. modalShow:false,
  114. radio: 0,
  115. choose:true,
  116. icon:true,
  117. typeName:"",
  118. paddingTop:"height:"+(this.StatusBar+50)+"px",
  119. allData:[],//所有数据
  120. pagingIndex:0,//当前页数
  121. pagingNum:15,//一页几条
  122. }
  123. },
  124. onLoad(e) {
  125. this.typeName =this.list[0].name;
  126. this.searchValue=e.searchValue;
  127. this.selectTree(e.searchValue,"0");
  128. },
  129. methods: {
  130. showdialog(){
  131. this.modalShow= !this.modalShow;
  132. this.icon= !this.icon;
  133. },
  134. RadioChange(e) {
  135. this.radio = e.detail.value;
  136. this.typeName =this.list[this.radio].name;
  137. this.selectTree(this.searchValue,this.radio);
  138. this.showdialog();
  139. },
  140. navTo(data){
  141. uni.navigateTo({
  142. url:"/pages/searchDetails/searchDetails?id="+data.id+"&name="+data.name+"&nodeType="+data.type
  143. })
  144. },
  145. back(index){
  146. if(index==2){
  147. uni.$emit("clear")
  148. }
  149. uni.navigateBack({
  150. delta:1
  151. })
  152. },
  153. /* 获取单位、分部、分项、工序节点信息 */
  154. selectTree(name,type){
  155. var contractId = uni.getStorageSync("porject"+"_"+uni.getStorageSync("userInfo").id) .contractId;
  156. var that =this;
  157. that.showOther=false;
  158. that.http.request('/app/divideClient/appTPfDivideClientTree',
  159. {name:name,type:type,contractId:contractId}).then((result)=>{
  160. that.allData = result.datas;
  161. this.pagingIndex = 0;
  162. this.data = [];
  163. this.paging();
  164. that.showOther=true;
  165. })
  166. },
  167. paging(){
  168. //console.log('paging')
  169. let startNum = this.pagingIndex*this.pagingNum;
  170. if(startNum > this.allData.length){
  171. //超出不加
  172. return;
  173. }
  174. let endNum = (this.pagingIndex+1)*this.pagingNum;
  175. //console.log(startNum,endNum)
  176. let addData = this.allData.slice(startNum,endNum);
  177. //console.log(addData)
  178. //console.log('addData')
  179. this.data.push(...addData);
  180. this.pagingIndex = this.pagingIndex+1;
  181. }
  182. }
  183. }
  184. </script>
  185. <style>
  186. page{
  187. background-color: white;
  188. }
  189. .list_no{text-align: center;font-size: 26rpx;color: #AEAEAE;padding: 60rpx 0 200rpx;}
  190. .cu-card.article>.cu-item .content .text-content {
  191. font-size: 11px;
  192. color: #888;
  193. height: 100%;
  194. overflow: hidden;
  195. }
  196. .menuImageTask{
  197. height:80rpx;
  198. width: 80rpx;
  199. }
  200. .cu-modal.show {
  201. overflow-y: auto;
  202. pointer-events: auto;
  203. }
  204. .menuImageNoTask{width:162rpx;height: 105rpx;margin-top: 60rpx;}
  205. </style>