diff --git a/screen-vue/src/views/screen/Setting/components/Erp.vue b/screen-vue/src/views/screen/Setting/components/Erp.vue index e72f1eb..9afbcd7 100644 --- a/screen-vue/src/views/screen/Setting/components/Erp.vue +++ b/screen-vue/src/views/screen/Setting/components/Erp.vue @@ -5,9 +5,9 @@
-

财务可视化大屏指标配置

+

系统可视化大屏指标配置

- 保存 重置
@@ -276,22 +276,26 @@ const handleDrop = (e, gridNum) => { if (!dragItem.value) return; const targetArr = getMetricArrByGridNum(gridNum); if (!targetArr) return; - const currentChartId = dragItem.value.chartId; + const currentChartId = dragItem.value.chartId; + getAllMetricArrays().forEach((arr, index) => { const pos = index + 1; if (pos !== gridNum && arr.value.some(item => item.chartId === currentChartId)) { arr.value = []; } }); + + const originalSort = dragItem.value.sort || 0; const currentFixedOldId = targetArr.value[0]?.fixedOldChartId || currentChartId; + const newItem = { ...dragItem.value, sort: gridNum, - oldSort: targetArr.value[0]?.sort || gridNum, + oldSort: originalSort, fixedOldChartId: currentFixedOldId, oldChartId: currentFixedOldId }; - + targetArr.value = [newItem]; dragItem.value = null; }; @@ -312,7 +316,6 @@ const handleReset = () => { const handleSave = async () => { saveLoading.value = true; - const saveData = getAllMetricArrays().map((arr, index) => { const gridNum = index + 1; const currentItem = arr.value[0]; @@ -322,18 +325,19 @@ const handleSave = async () => { oldChartId: currentItem?.fixedOldChartId || null, chartName: currentItem?.chartName || '', chartCode: 'erp', - oldSort: currentItem?.oldSort || gridNum, + oldSort: currentItem?.oldSort || 0, color: currentItem?.color || '' }; }).filter(item => item.chartId); try { const res = await getChartSetting(saveData); - ElMessage.success(res?.msg || '保存成功'); + ElMessage.success(res?.msg); return saveData; } catch (error) { console.error('保存失败:', error); } finally { + getChartList(); saveLoading.value = false; } }; @@ -343,12 +347,10 @@ const getRandomColor = () => { return colors[Math.floor(Math.random() * colors.length)]; }; -async function getChartList(){ +async function getChartList() { try { - const reqParams = { - chartCode: 'erp' - } - const res = await getChartListAll(reqParams) + const reqParams = { chartCode: 'erp' }; + const res = await getChartListAll(reqParams); rawChartData.value = res || []; rawChartData.value.forEach(item => { diff --git a/src/main/java/com/mini/mybigscreen/biz/controller/ChartInfoController.java b/src/main/java/com/mini/mybigscreen/biz/controller/ChartInfoController.java index 71c4384..d8508e5 100644 --- a/src/main/java/com/mini/mybigscreen/biz/controller/ChartInfoController.java +++ b/src/main/java/com/mini/mybigscreen/biz/controller/ChartInfoController.java @@ -38,18 +38,20 @@ public class ChartInfoController { @PostMapping("setting") public Result save(@RequestBody List configs) { for (ChartConfig config : configs) { - LambdaQueryWrapper newQuery = new LambdaQueryWrapper() - .eq(ChartInfo::getChartId, config.getChartId()) - .eq(ChartInfo::getChartCode, config.getChartCode()); - ChartInfo newChartInfo = chartInfoService.getOne(newQuery); - newChartInfo.setSort(config.getSort()); - chartInfoService.updateById(newChartInfo); - LambdaQueryWrapper oldQuery = new LambdaQueryWrapper() - .eq(ChartInfo::getChartId, config.getOldChartId()) - .eq(ChartInfo::getChartCode, config.getChartCode()); - ChartInfo oldChartInfo = chartInfoService.getOne(oldQuery); - oldChartInfo.setSort(config.getOldSort()); - chartInfoService.updateById(oldChartInfo); + + System.out.println(config); +// LambdaQueryWrapper newQuery = new LambdaQueryWrapper() +// .eq(ChartInfo::getChartId, config.getChartId()) +// .eq(ChartInfo::getChartCode, config.getChartCode()); +// ChartInfo newChartInfo = chartInfoService.getOne(newQuery); +// newChartInfo.setSort(config.getSort()); +// chartInfoService.updateById(newChartInfo); +// LambdaQueryWrapper oldQuery = new LambdaQueryWrapper() +// .eq(ChartInfo::getChartId, config.getOldChartId()) +// .eq(ChartInfo::getChartCode, config.getChartCode()); +// ChartInfo oldChartInfo = chartInfoService.getOne(oldQuery); +// oldChartInfo.setSort(config.getOldSort()); +// chartInfoService.updateById(oldChartInfo); } return Result.success(new Message("配置保存成功", 200)); }