|
@@ -88,6 +88,7 @@
|
|
|
></i>
|
|
|
</el-tooltip>
|
|
|
</div>
|
|
|
+ {{ formLabelAlign.Ydata[0].label }}
|
|
|
<template v-for="(item, ind) in formLabelAlign.Ydata">
|
|
|
<div class="attributeItemData">
|
|
|
<el-select
|
|
@@ -166,14 +167,13 @@
|
|
|
multiple
|
|
|
collapse-tags
|
|
|
>
|
|
|
- <!-- <el-option label="全部" value="all"></el-option> -->
|
|
|
<el-option
|
|
|
- v-for="(item, index) in itemFilter.data"
|
|
|
+ v-for="(item, index) in itemFilter?.data"
|
|
|
:label="
|
|
|
- item[itemFilter.label] ? `${item[itemFilter.label]} ` : `0`
|
|
|
+ item[itemFilter?.label] ? `${item[itemFilter?.label]} ` : `0`
|
|
|
"
|
|
|
- :value="item[itemFilter.label]"
|
|
|
- :key="item[itemFilter.label] + '' + index"
|
|
|
+ :value="item[itemFilter?.label]"
|
|
|
+ :key="item[itemFilter?.label] + '' + index"
|
|
|
>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
@@ -230,12 +230,13 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import { mapState, mapMutations } from "vuex";
|
|
|
-// import { getFormattedLabels, getFormattedSeries } from "./configFn";
|
|
|
-// import { filterData } from "./chartLogic/dargChartFIlter";
|
|
|
import {
|
|
|
handleBarChartLogic,
|
|
|
handleScatterChartLogic,
|
|
|
+ handleRadarChartLogic,
|
|
|
+ handleCpChartLogic,
|
|
|
} from "./chartLogic/index";
|
|
|
+import Vue from "vue";
|
|
|
export default {
|
|
|
name: "title",
|
|
|
props: {
|
|
@@ -327,7 +328,6 @@ export default {
|
|
|
dataBaseCheckList: {
|
|
|
handler(newVal) {
|
|
|
this.disabled = !newVal.children?.length;
|
|
|
-
|
|
|
this.selectData = newVal.children;
|
|
|
},
|
|
|
immediate: true, // 组件加载时立即检查
|
|
@@ -367,27 +367,30 @@ export default {
|
|
|
);
|
|
|
},
|
|
|
updateAxisData(axisData) {
|
|
|
- return axisData.map((item) => {
|
|
|
+ console.log(axisData, "axisData");
|
|
|
+ axisData.forEach((item, index) => {
|
|
|
const selected = this.selectData.find(
|
|
|
(val) => (val && val.id) === (item && item.id)
|
|
|
);
|
|
|
if (selected) {
|
|
|
- return {
|
|
|
+ Vue.set(axisData, index, {
|
|
|
...item,
|
|
|
label: selected.label || "",
|
|
|
data: selected.fileData || [],
|
|
|
- };
|
|
|
+ });
|
|
|
}
|
|
|
- return item;
|
|
|
});
|
|
|
+ return axisData;
|
|
|
},
|
|
|
+
|
|
|
changeData() {
|
|
|
if (this.$refs.form) {
|
|
|
this.$refs.form.resetFields();
|
|
|
}
|
|
|
- //图表内容回显图表配置赋值
|
|
|
+ // 图表内容回显图表配置赋值
|
|
|
if (this.curEdit && this.curEdit.option) {
|
|
|
- this.formLabelAlign = {
|
|
|
+ // 使用 this.$set 替代直接赋值
|
|
|
+ this.$set(this, "formLabelAlign", {
|
|
|
text: this.curEdit.option.title?.text || "",
|
|
|
Xlable: this.curEdit.option.xAxis?.name || "",
|
|
|
Ylable: this.curEdit.option.yAxis?.name || "",
|
|
@@ -411,15 +414,19 @@ export default {
|
|
|
id: "",
|
|
|
},
|
|
|
],
|
|
|
- };
|
|
|
- //查找是否存在数据
|
|
|
+ });
|
|
|
+ // 查找是否存在数据
|
|
|
const index = this.formFilterAlignData.findIndex(
|
|
|
(item) => item.id === this.curEdit.id
|
|
|
);
|
|
|
if (index !== -1) {
|
|
|
- this.formFilterAlign = this.formFilterAlignData[index]?.data;
|
|
|
+ this.$set(
|
|
|
+ this,
|
|
|
+ "formFilterAlign",
|
|
|
+ this.formFilterAlignData[index]?.data
|
|
|
+ );
|
|
|
} else {
|
|
|
- this.formFilterAlign = [
|
|
|
+ this.$set(this, "formFilterAlign", [
|
|
|
{
|
|
|
filters: [],
|
|
|
filterType1: "",
|
|
@@ -428,7 +435,7 @@ export default {
|
|
|
number2: null,
|
|
|
radio: null,
|
|
|
},
|
|
|
- ];
|
|
|
+ ]);
|
|
|
}
|
|
|
} else {
|
|
|
this.$message.warning("请选择一个图表进行编辑");
|
|
@@ -437,8 +444,11 @@ export default {
|
|
|
//全部数据渲染
|
|
|
changeChart(isFilter) {
|
|
|
if (!this.curEdit?.option) return; // 确保 curEdit 和 option 存在
|
|
|
+ console.log(this.curEdit, this.formLabelAlign.Ydata, "this.curEdit");
|
|
|
const item = JSON.parse(JSON.stringify(this.curEdit));
|
|
|
- if (this.curEdit.type === "scatter") {
|
|
|
+
|
|
|
+ if (this.curEdit.type === "scatter" || this.curEdit.type === "radar") {
|
|
|
+ //判断散点选择的是否为number 或可转为number
|
|
|
const isAllNumbers = (data) =>
|
|
|
data.every((val) =>
|
|
|
val.data.every((vals) => {
|
|
@@ -448,13 +458,19 @@ export default {
|
|
|
);
|
|
|
})
|
|
|
);
|
|
|
- // console.log(isAllNumbers(this.formLabelAlign.Xdata), "isAllNumbers");
|
|
|
const isAllNumbersXdata = isAllNumbers(this.formLabelAlign.Xdata);
|
|
|
const isAllNumbersYdata = isAllNumbers(this.formLabelAlign.Ydata);
|
|
|
- if (!isAllNumbersXdata || !isAllNumbersYdata) {
|
|
|
+ if (
|
|
|
+ this.curEdit.type === "scatter" &&
|
|
|
+ (!isAllNumbersXdata || !isAllNumbersYdata)
|
|
|
+ ) {
|
|
|
this.$message.warning("请选择数值项进行散点图绘制");
|
|
|
return;
|
|
|
}
|
|
|
+ if (this.curEdit.type === "radar" && !isAllNumbersYdata) {
|
|
|
+ this.$message.warning("指标值请选择数值项进行散点图绘制");
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
// 确保标题和坐标轴对象存在
|
|
|
item.option.title = item.option.title || {};
|
|
@@ -475,8 +491,23 @@ export default {
|
|
|
isFilter,
|
|
|
this.curEdit.type
|
|
|
);
|
|
|
+ } else if (this.curEdit.type === "radar") {
|
|
|
+ handleRadarChartLogic(
|
|
|
+ item,
|
|
|
+ this.formLabelAlign,
|
|
|
+ this.formFilterAlign,
|
|
|
+ isFilter,
|
|
|
+ this.curEdit.type
|
|
|
+ );
|
|
|
+ } else if (this.curEdit.type === "Cp") {
|
|
|
+ handleCpChartLogic(
|
|
|
+ item,
|
|
|
+ this.formLabelAlign,
|
|
|
+ this.formFilterAlign,
|
|
|
+ isFilter,
|
|
|
+ this.curEdit.type
|
|
|
+ );
|
|
|
}
|
|
|
-
|
|
|
//设置仓库
|
|
|
this.setFormFilterAlignData({
|
|
|
id: this.curEdit.id,
|