大屏页面初始化
This commit is contained in:
@@ -127,31 +127,25 @@ const loadComponent = async (vueName) => {
|
||||
}
|
||||
};
|
||||
|
||||
const fetchChartData = async () => {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
const apiData = [
|
||||
{ sort: 1, vueName: 'ChartV01' },
|
||||
{ sort: 2, vueName: 'ChartV02' },
|
||||
{ sort: 3, vueName: 'ChartV03' },
|
||||
{ sort: 4, vueName: 'ChartV04' },
|
||||
{ sort: 5, vueName: 'ChartV05' },
|
||||
{ sort: 6, vueName: 'ChartV06' },
|
||||
{ sort: 7, vueName: 'ChartV07' },
|
||||
{ sort: 8, vueName: 'ChartV08' },
|
||||
{ sort: 9, vueName: 'ChartV09' },
|
||||
];
|
||||
resolve(apiData);
|
||||
}, 300);
|
||||
});
|
||||
};
|
||||
async function getChartList(){
|
||||
try {
|
||||
const reqParams = {
|
||||
chartCode: 'erp'
|
||||
}
|
||||
const res = await getChartListAll(reqParams)
|
||||
chartData.value = res || []
|
||||
} catch (error) {
|
||||
console.error('获取数据失败:', error)
|
||||
chartData.value = []
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const data = await fetchChartData();
|
||||
chartData.value = data.sort((a, b) => a.sort - b.sort);
|
||||
await getChartList();
|
||||
chartData.value = chartData.value.sort((a, b) => a.sort - b.sort);
|
||||
const newComponentMap = {};
|
||||
const uniqueComponents = [...new Set(data.map(item => item.vueName))];
|
||||
const uniqueComponents = [...new Set(chartData.value.map(item => item.vueName))];
|
||||
for (const vueName of uniqueComponents) {
|
||||
const component = await loadComponent(vueName);
|
||||
if (component) {
|
||||
|
||||
@@ -65,6 +65,8 @@ import { ref, watch, onMounted } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import ChartTop from './components/ChartTop.vue';
|
||||
|
||||
import { getChartListAll } from '@/api/bizChart'
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
const FormValues = ref({
|
||||
@@ -103,30 +105,25 @@ const loadComponent = async (vueName) => {
|
||||
}
|
||||
};
|
||||
|
||||
const fetchChartData = async () => {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
const apiData = [
|
||||
{ sort: 1, vueName: 'ChartV01' },
|
||||
{ sort: 2, vueName: 'ChartV02' },
|
||||
{ sort: 3, vueName: 'ChartV03' },
|
||||
{ sort: 4, vueName: 'ChartV04' },
|
||||
{ sort: 5, vueName: 'ChartV05' },
|
||||
{ sort: 6, vueName: 'ChartV06' },
|
||||
{ sort: 7, vueName: 'ChartV07' },
|
||||
{ sort: 8, vueName: 'ChartV08' },
|
||||
];
|
||||
resolve(apiData);
|
||||
}, 300);
|
||||
});
|
||||
};
|
||||
async function getChartList(){
|
||||
try {
|
||||
const reqParams = {
|
||||
chartCode: 'work'
|
||||
}
|
||||
const res = await getChartListAll(reqParams)
|
||||
chartData.value = res || []
|
||||
} catch (error) {
|
||||
console.error('获取数据失败:', error)
|
||||
chartData.value = []
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const data = await fetchChartData();
|
||||
chartData.value = data.sort((a, b) => a.sort - b.sort);
|
||||
await getChartList();
|
||||
chartData.value = chartData.value.sort((a, b) => a.sort - b.sort);
|
||||
const newComponentMap = {};
|
||||
const uniqueComponents = [...new Set(data.map(item => item.vueName))];
|
||||
const uniqueComponents = [...new Set(chartData.value.map(item => item.vueName))];
|
||||
for (const vueName of uniqueComponents) {
|
||||
const component = await loadComponent(vueName);
|
||||
if (component) {
|
||||
|
||||
Reference in New Issue
Block a user