//报告品种
import http from "@/api/http.js"

//英文报告品种权限
export const reportVarietyENInterence={
    // 品种列表
    varietyList:params=>{
        return http.get('/en_permission/list',params)
    },
    //获取过滤后的品种列表数据
    filterVarietyOpts:params=>{
        return new Promise((resolve,reject)=>{
            http.get('/en_permission/list',params).then(res=>{
                if(res.Ret===200){
                    const arr=res.Data||[]
                    arr.forEach(e => {
                        e.Child&&e.Child.forEach(_e=>{
                            delete _e.Child
                        })
                    });
                    const resArr=arr.filter(e=>e.Child&&e.Child.length>0)
                    resolve(resArr)
                }
            })
        })
    },
    //父级品种
    parentVarietyList:params=>{
        return http.get('/en_permission/parent/list',params)
    },
    //新增品种
    addVariety:params=>{
        return http.post('/en_permission/add',params)
    },
    //编辑品种
    editVariety:params=>{
        return http.post('/en_permission/edit',params)
    },
    //删除品种
    delVariety:params=>{
        return http.post('/en_permission/remove',params)
    }

}