const _Http = getApp().globalData.http;
Component({
    properties: {
        ownertable: String,
        ownerid: String,
        disabled: Boolean
    },
    data: {
        content: {
            nocache: true,
            pageNumber: 1,
            pageSize: 20,
            pageTotal: 1,
            total: null,
        },
        list: []
    },
    methods: {
        getList(id, init = false) {
            let content = {
                ...this.data.content,
                "ownertable": this.data.ownertable,
                "ownerid": this.data.ownerid,
            };
            if (init) content.pageNumber = 1
            _Http.basic({
                id: "20220902085001",
                content
            }).then(res => {
                console.log("任务列表", res)
                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)
                })
            })
        },
        toAdd(){
            wx.navigateTo({
              url: `/packageA/work/add?ownertable=${this.data.ownertable}&ownerid=${this.data.ownerid}`,
            })
        }
    }
})