| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 | const _Http = getApp().globalData.http;Page({    data: {        ownertable: null,        ownerid: null,        copyTeams: [], //用来本地搜索        keyword: "", //搜索关键字        activeNames: ["1"],        userid: wx.getStorageSync('userMsg').userid    },    onLoad(options) {        if (options.item) {            this.setData({                ...JSON.parse(options.item)            });            this.getList()        };    },    onInput(e) {        let {            value        } = e.detail;        let index = this.data.teams.findIndex(v => v.ismyteam == 1);        let copyTeams = JSON.parse(JSON.stringify(this.data.copyTeams[0]));        this.setData({            keyword: value,            [`teams[${index}].team`]: value ? copyTeams.filter(v => v.name.includes(value) || v.position.includes(value)) : copyTeams        });    },    cancelTheSearch() {        let index = this.data.teams.findIndex(v => v.ismyteam == 1);        let copyTeams = JSON.parse(JSON.stringify(this.data.copyTeams[0]));        this.setData({            keyword: "",            [`teams[${index}].team`]: copyTeams        });    },    onChange(event) {        this.setData({            activeNames: event.detail,        });    },    toAdd() {        wx.navigateTo({            url: `/packageA/group/select?data=${              JSON.stringify({                ownertable:this.data.ownertable,                ownerid:this.data.ownerid              })          }`,        })    },    /* 处理添加 */    handelSubmit(userids) {        const that = this;        wx.showModal({            title: '提示',            content: '是否确认添加成员',            success: ({                confirm            }) => {                if (confirm) _Http.basic({                    "id": 20220930103601,                    "content": {                        "ownertable": that.data.ownertable,                        "ownerid": that.data.ownerid,                        userids                    }                }).then(res => {                    console.log("添加团队成员", res)                    if (res.msg != '成功') return wx.showToast({                        title: res.data,                        icon: "none"                    });                    that.getList();                    wx.showToast({                        title: '添加成功',                        icon: "none"                    })                    getCurrentPages().forEach(v => {                        switch (v.__route__) {                            case "packageA/setclient/detail":                                v.getGroup();                                break;                        }                    })                    setTimeout(wx.navigateBack, 300);                })            }        })    },    //获取列表    getList() {        _Http.basic({            "id": 20220930103501,            "content": {                "nocache": true,                "ownertable": this.data.ownertable,                "ownerid": this.data.ownerid            }        }).then(res => {            console.log("团队成员列表", res)            if (res.msg != '成功') return wx.showToast({                title: res.data,                icon: "none"            })            this.setData({                teams: res.data,                copyTeams: res.data.map(v => v.team)            })        })    },    onReachBottom() {        this.getList();    }})
 |