zhaoxiaohai 3 rokov pred
rodič
commit
c8d407a3bf

+ 117 - 0
packageA/project/select.js

@@ -0,0 +1,117 @@
+const _Http = getApp().globalData.http,
+    getHeight = require("../../utils/getRheRemainingHeight");
+Page({
+    data: {
+        content: {
+            nocache: true,
+            "type": 0,
+            "pageNumber": 1,
+            "pageSize": 20,
+            "isExport": 0,
+            "where": {
+                "condition": "",
+            }
+        },
+        result: [],
+        radio: true,
+    },
+    onLoad(options) {
+        this.getList()
+    },
+    submit() {
+        let pages = getCurrentPages();
+        let list = this.data.result.map(v => this.data.list.find(value => value.sa_projectid == v));
+        console.log(this.data.result)
+        console.log(list)
+    },
+    getList(init = false) {
+        //init 用于初始化分页
+        if (init.detail != undefined) init = init.detail;
+        if (init) this.setData({
+            ['content.pageNumber']: 1
+        })
+        if (this.data.content.pageNumber > this.data.content.pageTotal) return;
+        _Http.basic({
+            "id": 20221020143502,
+            content: this.data.content
+        }).then(res => {
+            console.log("选择项目列表", res)
+            this.selectComponent('#ListBox').RefreshToComplete();
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            })
+            this.setData({
+                'content.pageNumber': res.pageNumber + 1,
+                'content.pageTotal': res.pageTotal,
+                'content.total': res.total,
+                list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
+            })
+            this.getTags();
+        })
+    },
+    /* 获取列表标签 */
+    getTags() {
+        let list = this.data.list,
+            ownerids = list.map(v => v.sa_projectid);
+        _Http.basic({
+            "id": 20221018102001,
+            "content": {
+                nocache: true,
+                "ownertable": "sa_project",
+                ownerids
+            }
+        }).then(res => {
+            console.log("标签", res)
+            for (let key in res.data) {
+                let index = list.findIndex(v => v.sa_projectid == key);
+                list[index].tags = res.data[key]
+            };
+            console.log(list)
+            this.setData({
+                list
+            })
+        })
+    },
+    /* 选中 */
+    changeResult(e) {
+        const {
+            id
+        } = e.currentTarget.dataset;
+        let result = this.data.result;
+        if (this.data.radio) {
+            result = [id];
+        } else {
+            if (result.some(v => v == id)) {
+                result = result.filter(v => v != id);
+            } else {
+                result.push(id)
+            };
+        }
+        this.setData({
+            result
+        })
+    },
+    /* 开始搜索 */
+    startSearch({
+        detail
+    }) {
+        if (detail == this.data.content.where.condition) return;
+        this.setData({
+            'content.where.condition': detail
+        });
+        this.getList(true);
+    },
+    /* 取消搜索 */
+    onClear() {
+        this.setData({
+            'content.where.condition': ""
+        });
+        this.getList(true);
+    },
+    onReady() {
+        getHeight.getHeight('.total', this).then(res => this.setData({
+            listHeight: res
+        }));
+    }
+})

+ 4 - 0
packageA/project/select.json

@@ -0,0 +1,4 @@
+{
+    "usingComponents": {},
+    "navigationBarTitleText": "选择项目"
+}

+ 108 - 0
packageA/project/select.scss

@@ -0,0 +1,108 @@
+page {
+    height: 100vh;
+    overflow: hidden;
+}
+
+.total {
+    height: 60rpx;
+    line-height: 60rpx;
+    font-size: 24rpx;
+    font-family: PingFang SC-Regular, PingFang SC;
+    color: #666666;
+    padding-left: 30rpx;
+}
+
+.setclient-list-item {
+    width: 100vw;
+    background-color: #fff;
+    box-sizing: border-box;
+    padding-left: 30rpx;
+
+    .con {
+        display: flex;
+        align-items: center;
+        width: 100%;
+        border-bottom: 1px solid #EFEFEF;
+        box-sizing: border-box;
+        padding: 10rpx 0;
+
+        .mian {
+            flex: 1;
+            min-height: 60rpx;
+            width: 0;
+            font-family: PingFang SC-Regular, PingFang SC;
+
+            .title {
+                font-size: 28rpx;
+                color: #333333;
+                font-weight: 600;
+            }
+
+            .tag-box {
+                display: flex;
+                align-items: center;
+                width: 90%;
+                overflow: hidden;
+                margin-bottom: 4rpx;
+
+                .datatag,
+                .systemtag {
+                    flex-shrink: 0;
+                    margin-top: 6rpx;
+                    background: #FAAB16;
+                    color: #ffffff;
+                    margin-right: 10rpx;
+                    display: flex;
+                    align-items: center;
+                    height: 30rpx;
+                    font-size: 18rpx;
+                    padding: 0 10rpx;
+                    border-radius: 20rpx;
+                    font-family: PingFang SC-Regular, PingFang SC;
+                }
+                .systemtag {
+                    background: #FA8C16;
+                }
+            }
+            .exp {
+                font-size: 24rpx;
+                color: #666666;
+            }
+        }
+
+        .checkbox {
+            flex-shrink: 0 !important;
+        }
+    }
+}
+
+.footer {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    padding: 0 30rpx;
+    position: fixed;
+    width: 100vw;
+    height: 130rpx;
+    background: #FFFFFF;
+    box-shadow: 0px -4rpx 16rpx 2rpx rgba(150, 157, 165, 0.16);
+    bottom: 0;
+    box-sizing: border-box;
+
+    .count {
+        font-size: 28rpx;
+        font-family: PingFang SC-Regular, PingFang SC;
+        color: #333333;
+    }
+
+    .but {
+        width: 156rpx;
+        height: 90rpx;
+        background: #3874F6;
+        border-radius: 8rpx;
+        font-size: 28rpx;
+        font-family: PingFang SC-Bold, PingFang SC;
+        font-weight: bold;
+        color: #FFFFFF;
+    }
+}

+ 44 - 0
packageA/project/select.wxml

@@ -0,0 +1,44 @@
+<van-search class="search" value="{{ content.where.condition }}" shape="round" placeholder="请输入搜索关键词" bind:search='startSearch' bind:clear='onClear' />
+<My_listBox id='ListBox' height="{{listHeight}}" bind:getlist='getList'>
+    <view class="total">共{{content.total}}个</view>
+    <navigator class="setclient-list-item" url="#" wx:for="{{list}}" wx:key="item.sa_projectid" data-id="{{item.sa_projectid}}" bindtap="changeResult">
+        <view class="con">
+            <view class="mian">
+                <view class="title line-1">
+                    {{item.projectname}}
+                </view>
+                <view class="tag-box">
+                    <view class="systemtag" wx:for="{{item.tags.systemtag}}" wx:key="item">{{item}}</view>
+                    <view class="datatag" wx:for="{{item.tags.datatag}}" wx:key="item">{{item}}</view>
+                </view>
+                <view class="exp line-1">
+                    项目编号:{{item.projectnum}}
+                </view>
+                <view class="exp line-1" wx:if="{{item.province}}">
+                    项目地址:{{item.province+item.city+item.county+item.address}}
+                </view>
+            </view>
+            <view class="checkbox">
+                <van-checkbox value='{{handle.isCheck(item.sa_projectid,result)}}' />
+            </view>
+        </view>
+    </navigator>
+    <view style="height: 230rpx;" />
+    <My_empty wx:if="{{!list.length}}" />
+</My_listBox>
+<view style="height: 130rpx;" />
+<view class="footer">
+    <view class="count">
+        已选:{{result.length}}
+    </view>
+    <van-button custom-class='but' disabled='{{result.length==0}}' bind:click="submit">确定</van-button>
+</view>
+<wxs module="handle">
+    module.exports = {
+        isCheck: function (id, list) {
+            return list.some(function (v) {
+                return v == id
+            });
+        },
+    }
+</wxs>

+ 0 - 63
packageA/setclient/search.js

@@ -1,63 +0,0 @@
-const _Http = getApp().globalData.http;
-Page({
-    data: {
-        content: {
-            nocache: true,
-            "type": 0,
-            "pageNumber": 1,
-            "pageSize": 20,
-            "isExport": 0,
-            "where": {
-                "condition": "",
-                "status": "", //状态
-                "startdate": "",
-                "enddate": ""
-            },
-        },
-        list: []
-    },
-    onLoad(options) {
-        this.getList();
-    },
-    /* 开始搜索 */
-    startSearch({
-        detail
-    }) {
-        this.setData({
-            "content.where.condition": detail
-        });
-        this.getList(true);
-    },
-    onClear() {
-        this.setData({
-            "content.where.condition": ""
-        });
-        this.getList(true);
-    },
-    getList(init = false) {
-        //init 用于初始化分页
-        let content = this.data.content;
-        if (init) content.pageNumber = 1;
-        if (content.pageNumber > content.pageTotal) return;
-        _Http.basic({
-            "id": 20221012164402,
-            content
-        }).then(res => {
-            console.log("搜索客户列表", res)
-            if (res.msg != '成功') return wx.showToast({
-                title: res.data,
-                icon: "none"
-            })
-            // this.getTags(res.data.map(v => v.sys_enterpriseid));
-            this.setData({
-                'content.pageNumber': res.pageNumber + 1,
-                'content.pageTotal': res.pageTotal,
-                'content.total': res.total,
-                list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
-            })
-        })
-    },
-    onReachBottom() {
-        this.getList();
-    },
-})

+ 0 - 10
packageA/setclient/search.json

@@ -1,10 +0,0 @@
-{
-    "usingComponents": {
-        "TraceList": "./modules/trace/list/index",
-        "AddressList": "./modules/address/list/index",
-        "ContactsList": "./modules/contacts/list/index",
-        "FinancingList": "./modules/financing/list/index",
-        "list": "./modules/list/index"
-    },
-    "navigationBarTitleText": "客户管理搜索"
-}

+ 0 - 0
packageA/setclient/search.scss


+ 0 - 3
packageA/setclient/search.wxml

@@ -1,3 +0,0 @@
-<van-search value="{{ content.where.condition }}" shape="round" placeholder="请输入搜索关键词" bind:search='startSearch' bind:clear='onClear' />
-<view style="height: 20rpx;" />
-<list list='{{list}}' />