|
@@ -2,36 +2,87 @@
|
|
|
<div>
|
|
<div>
|
|
|
<el-form
|
|
<el-form
|
|
|
label-position="top"
|
|
label-position="top"
|
|
|
- label-width="80px"
|
|
|
|
|
:model="formLabelAlign"
|
|
:model="formLabelAlign"
|
|
|
size="mini"
|
|
size="mini"
|
|
|
ref="form"
|
|
ref="form"
|
|
|
>
|
|
>
|
|
|
- <el-form-item label="Y轴数据">
|
|
|
|
|
- <el-select
|
|
|
|
|
|
|
+ <el-form-item label="纬度标签">
|
|
|
|
|
+ <div
|
|
|
|
|
+ slot="label"
|
|
|
|
|
+ style="
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ justify-content: space-between;
|
|
|
|
|
+ "
|
|
|
|
|
+ >
|
|
|
|
|
+ <span>纬度标签</span>
|
|
|
|
|
+ <el-tooltip content="添加纬度" placement="bottom-start">
|
|
|
|
|
+ <i
|
|
|
|
|
+ @click="
|
|
|
|
|
+ formLabelAlign.Xdata.push({ lable: '', data: [], id: '' })
|
|
|
|
|
+ "
|
|
|
|
|
+ class="el-icon-circle-plus-outline"
|
|
|
|
|
+ style="font-size: 20px"
|
|
|
|
|
+ ></i>
|
|
|
|
|
+ </el-tooltip>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <template v-for="(item, ind) in formLabelAlign.Xdata">
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ style="margin: 5px 0"
|
|
|
|
|
+ :key="ind + 'select'"
|
|
|
|
|
+ v-model="formLabelAlign.Xdata[ind].id"
|
|
|
|
|
+ placeholder="请先进行数据配置"
|
|
|
|
|
+ :disabled="disabled"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in selectData"
|
|
|
|
|
+ :label="item.label"
|
|
|
|
|
+ :value="item.id"
|
|
|
|
|
+ :key="item.id"
|
|
|
|
|
+ ></el-option>
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <!-- <el-select
|
|
|
|
|
+ style="margin: 5px 0"
|
|
|
v-model="formLabelAlign.Ydata"
|
|
v-model="formLabelAlign.Ydata"
|
|
|
placeholder="请先进行数据配置"
|
|
placeholder="请先进行数据配置"
|
|
|
- :disabled="true"
|
|
|
|
|
|
|
+ :disabled="disabled"
|
|
|
>
|
|
>
|
|
|
- <el-option label="区域一" value="shanghai"></el-option>
|
|
|
|
|
- </el-select>
|
|
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in selectData"
|
|
|
|
|
+ :label="item.label"
|
|
|
|
|
+ :value="item.id"
|
|
|
|
|
+ :key="item.id"
|
|
|
|
|
+ ></el-option>
|
|
|
|
|
+ </el-select> -->
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item label="X轴数据">
|
|
|
|
|
|
|
+ <el-form-item label="指标值">
|
|
|
<el-select
|
|
<el-select
|
|
|
- v-model="formLabelAlign.Xdata"
|
|
|
|
|
|
|
+ v-model="formLabelAlign.Ydata"
|
|
|
placeholder="请先进行数据配置"
|
|
placeholder="请先进行数据配置"
|
|
|
- :disabled="true"
|
|
|
|
|
|
|
+ :disabled="disabled"
|
|
|
>
|
|
>
|
|
|
- <el-option label="区域一" value="shanghai"></el-option>
|
|
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in selectData"
|
|
|
|
|
+ :label="item.label"
|
|
|
|
|
+ :value="item.id"
|
|
|
|
|
+ :key="item.id"
|
|
|
|
|
+ ></el-option>
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="标题名称">
|
|
<el-form-item label="标题名称">
|
|
|
<el-input v-model="formLabelAlign.text"></el-input>
|
|
<el-input v-model="formLabelAlign.text"></el-input>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item label="X轴名称">
|
|
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ label="X轴名称"
|
|
|
|
|
+ v-if="curEdit.type !== 'pie' && curEdit.type !== 'radar'"
|
|
|
|
|
+ >
|
|
|
<el-input v-model="formLabelAlign.Xlable"></el-input>
|
|
<el-input v-model="formLabelAlign.Xlable"></el-input>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item label="Y轴名称">
|
|
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ label="Y轴名称"
|
|
|
|
|
+ v-if="curEdit.type !== 'pie' && curEdit.type !== 'radar'"
|
|
|
|
|
+ >
|
|
|
<el-input v-model="formLabelAlign.Ylable"></el-input>
|
|
<el-input v-model="formLabelAlign.Ylable"></el-input>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-form>
|
|
</el-form>
|
|
@@ -57,29 +108,55 @@ export default {
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
formLabelAlign: {
|
|
formLabelAlign: {
|
|
|
- Xdata: "",
|
|
|
|
|
|
|
+ Xdata: [
|
|
|
|
|
+ {
|
|
|
|
|
+ label: "",
|
|
|
|
|
+ data: [],
|
|
|
|
|
+ id: "",
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
Ydata: "",
|
|
Ydata: "",
|
|
|
|
|
+ // Ydata: [
|
|
|
|
|
+ // {
|
|
|
|
|
+ // label: "",
|
|
|
|
|
+ // data: [],
|
|
|
|
|
+ // },
|
|
|
|
|
+ // ],
|
|
|
text: "",
|
|
text: "",
|
|
|
Xlable: "",
|
|
Xlable: "",
|
|
|
Ylable: "",
|
|
Ylable: "",
|
|
|
},
|
|
},
|
|
|
|
|
+ disabled: true,
|
|
|
|
|
+ selectData: [], //可选择的数据
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
|
...mapState("dragChart", {
|
|
...mapState("dragChart", {
|
|
|
currentChartList: "currentChartList",
|
|
currentChartList: "currentChartList",
|
|
|
|
|
+ dataBaseCheckList: "dataBaseCheckList",
|
|
|
}),
|
|
}),
|
|
|
},
|
|
},
|
|
|
watch: {
|
|
watch: {
|
|
|
- curEdit(newVal) {
|
|
|
|
|
|
|
+ curEdit() {
|
|
|
|
|
+ console.log(this.curEdit, "curEdit");
|
|
|
this.changeData();
|
|
this.changeData();
|
|
|
},
|
|
},
|
|
|
formLabelAlign: {
|
|
formLabelAlign: {
|
|
|
- handler() {
|
|
|
|
|
|
|
+ handler(nval) {
|
|
|
|
|
+ console.log(nval, "nval");
|
|
|
this.changeChart();
|
|
this.changeChart();
|
|
|
},
|
|
},
|
|
|
deep: true,
|
|
deep: true,
|
|
|
},
|
|
},
|
|
|
|
|
+ dataBaseCheckList: {
|
|
|
|
|
+ handler(newVal) {
|
|
|
|
|
+ this.disabled = !newVal.children?.length;
|
|
|
|
|
+
|
|
|
|
|
+ this.selectData = newVal.children;
|
|
|
|
|
+ },
|
|
|
|
|
+ immediate: true, // 组件加载时立即检查
|
|
|
|
|
+ deep: true, // 深度监听
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
|
this.changeData();
|
|
this.changeData();
|
|
@@ -88,9 +165,7 @@ export default {
|
|
|
...mapMutations("dragChart", ["updateChart"]),
|
|
...mapMutations("dragChart", ["updateChart"]),
|
|
|
changeData() {
|
|
changeData() {
|
|
|
this.$refs.form.resetFields();
|
|
this.$refs.form.resetFields();
|
|
|
-
|
|
|
|
|
if (this.curEdit && this.curEdit.option) {
|
|
if (this.curEdit && this.curEdit.option) {
|
|
|
- console.log("curEdit.option 存在", this.curEdit.option);
|
|
|
|
|
this.formLabelAlign = {
|
|
this.formLabelAlign = {
|
|
|
...this.formLabelAlign,
|
|
...this.formLabelAlign,
|
|
|
text: this.curEdit.option.title?.text || "",
|
|
text: this.curEdit.option.title?.text || "",
|
|
@@ -105,14 +180,14 @@ export default {
|
|
|
if (!this.curEdit || !this.curEdit.option) return; // 确保 curEdit 和 option 存在
|
|
if (!this.curEdit || !this.curEdit.option) return; // 确保 curEdit 和 option 存在
|
|
|
const item = JSON.parse(JSON.stringify(this.curEdit));
|
|
const item = JSON.parse(JSON.stringify(this.curEdit));
|
|
|
|
|
|
|
|
|
|
+ // 确保 title, xAxis, yAxis 存在
|
|
|
item.option.title = item.option.title || {};
|
|
item.option.title = item.option.title || {};
|
|
|
item.option.xAxis = item.option.xAxis || {};
|
|
item.option.xAxis = item.option.xAxis || {};
|
|
|
item.option.yAxis = item.option.yAxis || {};
|
|
item.option.yAxis = item.option.yAxis || {};
|
|
|
-
|
|
|
|
|
|
|
+ // 更新标题和坐标轴名称
|
|
|
Object.assign(item.option.title, { text: this.formLabelAlign.text });
|
|
Object.assign(item.option.title, { text: this.formLabelAlign.text });
|
|
|
Object.assign(item.option.xAxis, { name: this.formLabelAlign.Xlable });
|
|
Object.assign(item.option.xAxis, { name: this.formLabelAlign.Xlable });
|
|
|
Object.assign(item.option.yAxis, { name: this.formLabelAlign.Ylable });
|
|
Object.assign(item.option.yAxis, { name: this.formLabelAlign.Ylable });
|
|
|
-
|
|
|
|
|
this.updateChart(item); // 更新图表
|
|
this.updateChart(item); // 更新图表
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
@@ -120,7 +195,11 @@ export default {
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|
|
|
-.el-form-item {
|
|
|
|
|
|
|
+::v-deep .el-form-item {
|
|
|
|
|
+ width: 100% !important;
|
|
|
margin-bottom: 5px;
|
|
margin-bottom: 5px;
|
|
|
|
|
+ .el-form-item__label {
|
|
|
|
|
+ width: 100% !important;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
</style>
|
|
</style>
|