Commit 281f12a3 by 孙香冬

no message

parent 04ae7899
No preview for this file type
...@@ -10,13 +10,14 @@ export async function getData(req, res) { ...@@ -10,13 +10,14 @@ export async function getData(req, res) {
let result = []; let result = [];
let titleConfig = { let titleConfig = {
"节点名称":"nodeName", "节点名称":"nodeName",
"重要等级":"weightedGrade",
"标题内容":"title", "标题内容":"title",
"图片名称":"titleImgUrl", "图片名称":"titleImgUrl",
"是否有弹框":"havePop", "是否有弹框":"havePop",
"弹框视频/图片内容":"popInfo", "弹框视频/图片内容":"popInfo",
"弹框内容":"popDes", "弹框内容":"popDes",
}; };
let index = 1;
list.valueList.forEach(info => { list.valueList.forEach(info => {
let onceNode = {}; let onceNode = {};
info.forEach((item, index) => { info.forEach((item, index) => {
...@@ -30,6 +31,7 @@ export async function getData(req, res) { ...@@ -30,6 +31,7 @@ export async function getData(req, res) {
} }
onceNode[title] = item; onceNode[title] = item;
}); });
onceNode["id"] = index;
onceNode["title"] = splitStr(onceNode["title"]); onceNode["title"] = splitStr(onceNode["title"]);
onceNode["titleImgUrl"] = splitStr(onceNode["titleImgUrl"]); onceNode["titleImgUrl"] = splitStr(onceNode["titleImgUrl"]);
for (let i = 0; i < onceNode["titleImgUrl"].length; i++) { for (let i = 0; i < onceNode["titleImgUrl"].length; i++) {
...@@ -37,6 +39,7 @@ export async function getData(req, res) { ...@@ -37,6 +39,7 @@ export async function getData(req, res) {
} }
onceNode["popDes"] = splitDesStr(onceNode["popDes"]); onceNode["popDes"] = splitDesStr(onceNode["popDes"]);
result.push(onceNode); result.push(onceNode);
index++;
}); });
res.send({"dsjList":result}); res.send({"dsjList":result});
} }
...@@ -48,13 +51,13 @@ export function dsjNodeList(req, res) { ...@@ -48,13 +51,13 @@ export function dsjNodeList(req, res) {
let data = []; let data = [];
tableData.valueList.forEach(info => { tableData.valueList.forEach(info => {
let txt = info[0]; let txt = info[0];
if (info[3] != "是") return if (info[4] != "是") return``
if (!ditinctMap[txt]) ditinctMap[txt] = 1; if (!ditinctMap[txt]) ditinctMap[txt] = 1;
else ditinctMap[txt] += 1; else ditinctMap[txt] += 1;
}); });
tableData.valueList.forEach(info => { tableData.valueList.forEach(info => {
let txt = info[0]; let txt = info[0];
if (info[3] != "是") return if (info[4] != "是") return
if (ditinctMap[txt]>1) { if (ditinctMap[txt]>1) {
if (!indexMap[txt]) indexMap[txt] = 0; if (!indexMap[txt]) indexMap[txt] = 0;
let str = `${txt}_${indexMap[txt]+1}` let str = `${txt}_${indexMap[txt]+1}`
......
...@@ -61,7 +61,8 @@ export async function getCSFX(req, res) { ...@@ -61,7 +61,8 @@ export async function getCSFX(req, res) {
let ret:any = {}; let ret:any = {};
let 企业测试自动驾驶比率Info = await getQytlzdjs(); let 企业测试自动驾驶比率Info = await getQytlzdjs();
ret["api5"] = getListOutData("企业脱离自动驾驶比率", 企业测试自动驾驶比率Info); // ret["api5"] = getListOutData("企业脱离自动驾驶比率", 企业测试自动驾驶比率Info);
ret["api5"] = {title:"企业脱离自动驾驶比率", dataList:企业测试自动驾驶比率Info}
let {月度测试时长数据, 月度测试时长功能数据, 月度测试里程数据, 月度测试里程功能数据} = await getYdcs(); let {月度测试时长数据, 月度测试时长功能数据, 月度测试里程数据, 月度测试里程功能数据} = await getYdcs();
......
...@@ -76,40 +76,32 @@ export async function getQytlzdjs() { ...@@ -76,40 +76,32 @@ export async function getQytlzdjs() {
enterpriseExitList.sort( (a, b) => { enterpriseExitList.sort( (a, b) => {
if ( !a.ratio ) { if ( !a.ratio ) {
a.ratio = Math.ceil((a.exitCount/a.autoMileage)*100/100); a.ratio = Math.floor((a.exitCount/a.autoMileage)*100);
if (a.exitCount == 0 || a.autoMileage == 0) { if (a.exitCount == 0 || a.autoMileage == 0) {
a.ratio = 0; a.ratio = 0;
} }
} }
if ( !b.ratio ) { if ( !b.ratio ) {
b.ratio = Math.ceil((b.exitCount/b.autoMileage)*100/100); b.ratio = Math.floor((b.exitCount/b.autoMileage)*100);
if (b.exitCount == 0 || b.autoMileage == 0) { if (b.exitCount == 0 || b.autoMileage == 0) {
b.ratio = 0; b.ratio = 0;
} }
} }
let aRatio = a.ratio; let aRatio = a.ratio;
let bRatio = b.ratio; let bRatio = b.ratio;
return bRatio - aRatio; return aRatio - bRatio;
}); });
let 企业名称data = []; let 企业测试自动驾驶比率 = [];
let 次数data = [];
let 比率data = [];
let enterpriseExitListTop10 = enterpriseExitList.slice(0, 10); let enterpriseExitListTop10 = enterpriseExitList.slice(0, 10);
let index = 1;
enterpriseExitListTop10.forEach( info => { enterpriseExitListTop10.forEach( info => {
let {autoMileage, enterpriseName, exitCount, ratio} = info; let {autoMileage, enterpriseName, exitCount, ratio} = info;
企业名称data.push(enterpriseName); 企业测试自动驾驶比率.push({key:"企业" + index, value:ratio, unit:"次/百公里"});
次数data.push(ratio + "次/公里"); index++;
比率data.push(ratio + "%")
}); });
let 企业测试自动驾驶比率 = [
{key:"企业名称", values: 企业名称data},
{key:"次/公里", values: 次数data},
{key:"比率", values: 比率data},
];
return 企业测试自动驾驶比率; return 企业测试自动驾驶比率;
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment