const _Http = getApp().globalData.http;
Page({
    data: {
        content: {
            nocache: true,
            "sa_projectid": 1,
            "pageNumber": 1,
            "pageTotal": 1,
            "pageSize": 20,
            total: null,
            "where": {
                "condition": ""
            }
        },
    },
    onLoad(options) {
        this.setData({
            "content.sa_projectid": options.sa_projectid
        })
        this.getList();
        getApp().globalData.Language.getLanguagePackage(this, '搜索联系人');
    },
    getList(init = false) {
        _Http.init(this.data.content, init).then(content => {
            _Http.basic({
                "id": 20221111131004,
                content
            }).then(res => {
                console.log("项目联系人搜索", res)
                this.selectComponent('#ListBox').RefreshToComplete();
                if (res.code != '1') return wx.showToast({
                    title: res.msg,
                    icon: "none"
                })
                this.setData({
                    loading: false,
                    content: _Http.paging(content, res),
                    list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
                })
            })
        })
    },
    /* 开始搜索 */
    onSearch({
        detail
    }) {
        if (this.data.content.where.condition == detail) return;
        this.setData({
            'content.where.condition': detail
        });
        this.getList(true)
    },
    onClear() {
        this.setData({
            'content.where.condition': ""
        });
        this.getList(true)
    },
})