vue 片区公司关联

// 片区公司关联
    const associationChange = async (areaId,companyId, type)    => {
        let list = await GetCompanyList({
            areaId:areaId,
            companyId:companyId,
            status: 1,
            pageIndex:1,
            pageSize:500,
        });
        if(list && list.data.length > 0){
            if(type == 1){
                companyOptions.value = [];
                for (let i=0;i<list.data.length;i++) {
                    let company = {
                        value:list.data[i].id,
                        label:list.data[i].name,
                    }
                    companyOptions.value.push(company);
                }
                 switch (parseInt(cateId.value)) {
                    case 1 :
                        qFormState.companyID = '';
                        break;
                    case 2 :
                        iFormState.companyID = '';
                        break;
                    case 5 :
                        hFormState.companyID = '';
                        break;
                    case 6 :
                        sFormState.companyID = '';
                        break;  
                }
            }else{
                console.log(list.data);
                switch (parseInt(cateId.value)) {
                    case 1 :
                        qFormState.areaID = list.data[0].areaId;
                        break;
                    case 2 :
                        iFormState.areaID = list.data[0].areaId;
                        break;
                    case 5 :
                        hFormState.areaID = list.data[0].areaId;
                        break;
                    case 6 :
                        sFormState.areaID = list.data[0].areaId;
                        break;  
                }
                
            }
        }else{
           companyOptions.value = [];
            switch (parseInt(cateId.value)) {
                    case 1 :
                        qFormState.companyID = '';
                        break;
                    case 2 :
                        iFormState.companyID = '';
                        break;
                    case 5 :
                        hFormState.companyID = '';
                        break;
                    case 6 :
                        sFormState.companyID = '';
                        break;  
                }
        }
    }

  

posted @ 2022-08-18 11:13  韩梦芫  阅读(19)  评论(0)    收藏  举报