Pārlūkot izejas kodu

添加筛选项

xiaohaizhao 2 gadi atpakaļ
vecāks
revīzija
93c39421fc

+ 68 - 0
packageA/select/project/select2.js

@@ -12,6 +12,17 @@ Page({
         radio: false, //是否为单选
         idname: "sa_projectid", //idkey
         showName: "projectname", //表单用 显示名称
+        filtratelist: [],
+    },
+    openFiltrate() {
+        this.setData({
+            showFiltrate: true
+        })
+    },
+    handleFilter(e) {
+        e.detail.condition = this.data.params.content.where.condition;
+        this.data.params.content.where = e.detail;
+        this.getList(true);
     },
     onLoad(options) {
         if (options.params) {
@@ -33,6 +44,63 @@ Page({
             showName: options.showName || this.data.showName,
         });
         this.getList()
+
+        _Http.basic({
+            "classname": "sysmanage.develop.optiontype.optiontype",
+            "method": "optiontypeselect",
+            "content": {
+                "nochace": true,
+                "pageNumber": 1,
+                "pageSize": 1000,
+                "typename": "projecttype",
+                "parameter": {
+                    "siteid": wx.getStorageSync('userMsg').siteid
+                }
+            }
+        }).then(res => {
+            console.log("项目类型", res)
+            if (res.msg == '成功') {
+                this.data.filtratelist.unshift({
+                    label: "项目类型",
+                    index: null,
+                    showName: "value", //显示字段
+                    valueKey: "projecttype", //返回Key
+                    selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
+                    value: "", //选中值
+                    list: res.data
+                })
+                this.setData({
+                    filtratelist: this.data.filtratelist
+                })
+            }
+        })
+
+        _Http.basic({
+            "id": 20221223141802,
+            "content": {
+                "pageNumber": 1,
+                "pageSize": 9999,
+                "where": {
+                    "condition": ""
+                }
+            }
+        }, false).then(res => {
+            console.log("获取领域", res)
+            if (res.msg == '成功') {
+                this.data.filtratelist.push({
+                    label: "领域",
+                    index: null,
+                    showName: "tradefield", //显示字段
+                    valueKey: "tradefield", //返回Key
+                    selectKey: "tradefield", //传参 代表选着字段 不传参返回整个选择对象
+                    value: "", //选中值
+                    list: res.data
+                })
+                this.setData({
+                    filtratelist: this.data.filtratelist
+                })
+            }
+        })
     },
     getList(init = false) {
         //init 用于初始化分页

+ 9 - 0
packageA/select/project/select2.scss

@@ -2,6 +2,15 @@ page {
     height: 100vh;
     overflow: hidden;
 }
+.action {
+    width: 120rpx;
+    color: #666;
+    text-align: center;
+
+    text {
+        margin-right: 10rpx;
+    }
+}
 
 .total {
     height: 60rpx;

+ 7 - 3
packageA/select/project/select2.wxml

@@ -1,4 +1,8 @@
-<van-search class="search" value="{{ params.content.where.condition }}" shape="round" placeholder="请输入搜索关键词" bind:search='startSearch' bind:clear='onClear' />
+<van-search class="search" value="{{ params.content.where.condition }}" shape="round" placeholder="请输入搜索关键词" bind:search='startSearch' use-action-slot bind:clear='onClear'>
+    <view slot='action' class="action" catchtap="openFiltrate">
+        <text class="iconfont icon-shaixuan" />筛选
+    </view>
+</van-search>
 <view class="div" style="height: 20rpx;" />
 <Yl_ListBox id='ListBox' bind:getlist='getList'>
     <navigator class="setclient-list-item" url="#" wx:for="{{list}}" wx:key="{{idname}}" data-id="{{item[idname]}}" bindtap="changeResult">
@@ -34,7 +38,6 @@
     <view style="height: 150rpx;" />
     <My_empty wx:if="{{!list.length}}" />
 </Yl_ListBox>
-
 <view style="height: 130rpx;" />
 <block wx:if="{{!radio}}">
     <view class="footer">
@@ -52,4 +55,5 @@
             },
         }
     </wxs>
-</block>
+</block>
+<Yl_Filtrate1 show='{{showFiltrate}}' list='{{filtratelist}}' bindhandle="handleFilter" />