Component({
    properties: {
        item: {
            type: Object
        }
    },
    data: {
        active: {}
    },
    lifetimes: {
        attached: function () {
            getApp().globalData.Language.getLanguagePackage(this)
        }
    },
    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;
            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.subarea.length ? {
                        index: null,
                        label: item.itemclassname ? item.itemclassname + getApp().globalData.Language.getMapText('的下级分类') : item.areaname + getApp().globalData.Language.getMapText('的下级区域'),
                        list: item.subarea,
                        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
                });
            };
        }
    }
})