//dictypeData = eval("(" + dictypeData + ")");
//console.log(dictypeData)

function dicData(code, arr, type) {
    var dicArr = [];
    if (type) {
        dicArr.push({ name: "全部", id: "" });
    }
    let dictypeData = JSON.parse(window.localStorage.getItem("dictypeData"));
    for (var i = 0; i < dictypeData.length; i++) {
        if (dictypeData[i].code == code) {
            var data = dictypeData[i].children;
            if (arr.length == 0) {
                for (var j = 0; j < data.length; j++) {
                    let p = {
                        name: data[j].name,
                        id: data[j].id,
                        code: data[j].code,
                        label: data[j].name,
                        gvalue: data[j].value,
                        value: data[j].id,
                        sort: data[j].sort,
                        algoDescribe: data[j].algoDescribe,
                    };
                    dicArr.push(p);
                }
            } else if (arr.length > 0) {
                for (var j = 0; j < data.length; j++) {
                    if (arr.indexOf(data[j].code) == -1) {
                        let p = {
                            name: data[j].name,
                            id: data[j].id,
                            code: data[j].code,
                            value: data[j].id,
                            gvalue: data[j].value,
                            label: data[j].name,
                            sort: data[j].sort,
                            algoDescribe: data[j].algoDescribe,
                        };
                        dicArr.push(p);
                    }
                }
            }
        }
    }
    return dicArr.sort((a, b) => {
        return a.sort - b.sort;
    });
}
export { dicData };