|
@@ -65,9 +65,14 @@
|
|
|
{{ selectedModel }}
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
- <el-form-item style="margin-bottom: 0">
|
|
|
- <el-button type="primary" icon="el-icon-search" @click="updateChart" size="mini"
|
|
|
- >搜索</el-button>
|
|
|
+ <el-form-item style="margin-bottom: 0">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-search"
|
|
|
+ @click="updateChart"
|
|
|
+ size="mini"
|
|
|
+ >搜索</el-button
|
|
|
+ >
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
@@ -82,7 +87,7 @@ import { listBase_data_year } from "@/api/base_data_year/base_data_year";
|
|
|
require("echarts/theme/macarons");
|
|
|
import resize from "./mixins/resize";
|
|
|
import basicInfoFormVue from '../tool/gen/basicInfoForm.vue';
|
|
|
-
|
|
|
+import { Decimal } from "decimal.js";
|
|
|
export default {
|
|
|
mixins: [resize],
|
|
|
props: {
|
|
@@ -343,23 +348,24 @@ export default {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- // littlegreen - 获取预警的markArae
|
|
|
- function getErrorArray(flag, yValues, monthYValues, xValues) {
|
|
|
+ // littlegreen - 获取预警的markArea
|
|
|
+ function getErrorArray(flag, monthYValues, yValues, xValues) {
|
|
|
+ // console.log(yValues, monthYValues,flag)
|
|
|
if (flag == 0) {
|
|
|
return [];
|
|
|
}
|
|
|
const errorArray = [];
|
|
|
- yValues.forEach((yValue) => {
|
|
|
- const yVal = yValue[0];
|
|
|
- const month = yValue[1];
|
|
|
- // 在 base_data_monthYValues 中找到相应的月
|
|
|
- const baseData = monthYValues.find((base) => base[1] === month);
|
|
|
+ const error = new Decimal(that.errorVal);
|
|
|
+ monthYValues.forEach(monthYValue => {
|
|
|
+ const yVal = new Decimal(monthYValue[0]);
|
|
|
+ const month = monthYValue[1];
|
|
|
+ const baseData = yValues.find((base) => base[1] === month);
|
|
|
if (baseData) {
|
|
|
- const baseVal = baseData[0];
|
|
|
- // 计算差值
|
|
|
- const difference = Math.abs(baseVal - yVal);
|
|
|
- // 如果差值大于10,添加该月到新数组
|
|
|
- if (difference > that.errorVal) {
|
|
|
+ const baseVal = new Decimal(baseData[0]);
|
|
|
+ // console.log(yVal,baseVal)
|
|
|
+ const difference = yVal.minus(baseVal);
|
|
|
+ // console.log(difference.toNumber(),error)
|
|
|
+ if (difference.gt(error)) {
|
|
|
errorArray.push([
|
|
|
{
|
|
|
x: 10 + (80 / (xValues.length)) * (xValues.indexOf(month+"年")) + "%",
|
|
@@ -456,7 +462,7 @@ export default {
|
|
|
itemStyle: {
|
|
|
color: "rgba(255, 173, 177, 0.4)",
|
|
|
},
|
|
|
- data: getErrorArray(flag, yValues, base_data_yearYValues, xValues),
|
|
|
+ data: getErrorArray(flag, base_data_yearYValues, yValues, xValues),
|
|
|
},
|
|
|
// itemStyle: {
|
|
|
// // color: "rgba(245,0,0,0.6)",
|