This commit is contained in:
Qiuxia Fan 2022-07-27 15:32:26 +08:00
parent 118c678667
commit c39ab481f3

View File

@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { ElMessage } from "element-plus";
import { useDashboardStore } from "@/store/modules/dashboard"; import { useDashboardStore } from "@/store/modules/dashboard";
import { LayoutConfig } from "@/types/dashboard"; import { LayoutConfig } from "@/types/dashboard";
@ -47,7 +48,7 @@ export default function getDashboard(param?: {
function associationWidget(sourceId: string, filters: unknown, type: string) { function associationWidget(sourceId: string, filters: unknown, type: string) {
const widget = widgets.filter((d: { type: string }) => d.type === type)[0]; const widget = widgets.filter((d: { type: string }) => d.type === type)[0];
if (!widget) { if (!widget) {
return; return ElMessage.info(`There has no a ${type} widget in the dashboard`);
} }
const item = { const item = {
...widget, ...widget,
@ -67,7 +68,7 @@ export default function getDashboard(param?: {
dashboardStore.setActiveTabIndex(Number(targetTabIndex[1])); dashboardStore.setActiveTabIndex(Number(targetTabIndex[1]));
} }
if (container && widget) { if (container && widget) {
container.scrollTop = widget.y * 10; container.scrollTop = widget.y * 10 + 10;
} }
} }
return { dashboard, widgets, associationWidget }; return { dashboard, widgets, associationWidget };