| | |
| | | :width="'100%'" |
| | | :height="'260px'" |
| | | :layerData="layerData" |
| | | :chartsId="0" |
| | | ></Bar-graph> |
| | | <div class="select"> |
| | | <el-select |
| | |
| | | if (dt.code !== 200) { |
| | | return ElMessage.error("查询错误"); |
| | | } |
| | | console.log(dt); |
| | | |
| | | dt.result.forEach((e) => { |
| | | if (e.code != 200) { |
| | | e.avg = "-"; |
| | |
| | | resultList.value.push(e); |
| | | }); |
| | | }; |
| | | //保留三位小数 |
| | | const keepThreeNum = (value) => { |
| | | let resValue = 0; |
| | | //小数点的位置 |
| | | let index = value && value.toString().indexOf(".") + 1; |
| | | //小数的位数 |
| | | let num = value && Math.abs(Number(value)).toString().length - index; |
| | | if (index && num > 3) { |
| | | resValue = value && Number(value).toFixed(3); |
| | | } else { |
| | | resValue = value; |
| | | } |
| | | return resValue; |
| | | }; |
| | | |
| | | //线查询接口 |
| | | const selectPolyline = async (res) => { |
| | | layerArr.value = []; |
| | | const dt = await selectByPolyline(res); |
| | | console.log(dt); |
| | | |
| | | dt.result.forEach((e) => { |
| | | e.points.forEach((element) => { |
| | | element.vals.forEach((v) => { |
| | | v = keepThreeNum(v); |
| | | }); |
| | | }); |
| | | }); |
| | | |
| | | layeroptions.value = dt.result; |
| | | layerArr.value.push(dt.result[0]); |
| | | chartIsshow.value = true; |