const _Http = getApp().globalData.http;
Component({
    properties: {
        siteid: {
            type: String
        },
    },
    lifetimes: {
        attached: function () {
            getApp().globalData.Language.getLanguagePackage(this)
        }
    },
    methods: {
        queryList(condition) {
            return _Http.basic({
                "id": 20230727134902,
                "content": {
                    "pageNumber": 1,
                    "pageSize": 9999,
                    "where": {
                        condition
                    }
                }
            }).then(res => {
                console.log("项目名称", res)
                if (res.code == 0) {
                    wx.showToast({
                        title: res.msg,
                        icon: "none"
                    })
                    return res.msg
                }
                this.setData({
                    repetitionList: res.data.map(v => {
                        v.chars = v.chars.reduce((acc, item) => ({
                            ...acc,
                            ...item
                        }), {});
                        v.projectname = v.projectname.split('').map(text => {
                            let projectname = v.chars.projectname.join("") || ''
                            return projectname.includes(text) ? {
                                text,
                                color: "red"
                            } : {
                                text,
                                color: "#666666"
                            }
                        })
                        return v
                    }),
                    show: this.data.siteid == 'HY' ? false : res.data.length != 0
                })
                return res.data.length != 0
            })
        },
        repClose() {
            this.setData({
                show: false
            })
        }
    }
})