Component({
    properties: {
        item: Object,
        jumboSize: Boolean
    },
    data: {
        active: {}
    },
    methods: {
        clearChild() {
            this.setData({
                "item.index": null,
                childClass: null
            });
            let MultilevelClass = this.selectComponent("#MultilevelClass");
            if (MultilevelClass) MultilevelClass.clearChild()
            getApp().globalData.temporaryId = null;
        },
        onSelect(e) {
            const {
                i,
                item
            } = e.currentTarget.dataset;
            let MultilevelClass = this.selectComponent("#MultilevelClass");
            if (MultilevelClass) MultilevelClass.clearChild()
            if (this.data.item.index == i) {
                getApp().globalData.temporaryId = this.data.item.id || "";
                this.setData({
                    "item.index": null,
                    childClass: null
                });
            } else {
                getApp().globalData.temporaryId = this.data.item.selectKey ? item[this.data.item.selectKey] : JSON.parse(JSON.stringify(item));
                this.setData({
                    "item.index": i,
                    childClass: item.subdep.length ? {
                        index: null,
                        label: item.itemclassname + '的下级分类',
                        list: item.subdep,
                        selectKey: this.data.item.selectKey,
                        showName: this.data.item.showName,
                        type: this.data.item.type,
                        value: "",
                        valueKey: this.data.item.valueKey,
                        id: getApp().globalData.temporaryId
                    } : null
                });
            };
            //商城
            getApp().globalData.setTemporaryId && getApp().globalData.setTemporaryId({
                detail: {
                    temporaryId: getApp().globalData.temporaryId
                }
            })
        }
    }
})