fix widget index

This commit is contained in:
Qiuxia Fan 2022-03-27 22:42:09 +08:00
parent d733594804
commit 713c1d1459
2 changed files with 4 additions and 5 deletions

View File

@ -76,9 +76,10 @@ export const dashboardStore = defineStore({
this.currentDashboard = item;
},
addControl(type: string) {
const arr = this.layout.map((d: any) => Number(d.i));
const newItem: LayoutConfig = {
...NewControl,
i: String(this.layout.length),
i: String(Math.max(...arr) + 1),
type,
metricTypes: [""],
metrics: [""],
@ -146,9 +147,10 @@ export const dashboardStore = defineStore({
}
const tabIndex = this.layout[idx].activedTabIndex || 0;
const { children } = this.layout[idx].children[tabIndex];
const arr = children.map((d: any) => Number(d.i));
const newItem: LayoutConfig = {
...NewControl,
i: String(children.length),
i: String(Math.max(...arr) + 1),
type,
metricTypes: [""],
metrics: [""],

View File

@ -19,9 +19,6 @@ limitations under the License. -->
<span>
{{ data.widget?.title || "" }}
</span>
<span class="unit" v-show="data.standard?.unit">
({{ data.standard?.unit }})
</span>
</div>
<div>
<el-tooltip :content="data.widget?.tips">