Bläddra i källkod

fix: 专题画像雷达图不更新问题

ystl_myq 6 månader sedan
förälder
incheckning
cfcbe155b8

+ 4 - 3
src/components/echarts/bar.vue

@@ -27,7 +27,6 @@ onMounted(() => {
         props.itemDim
       );
     } else {
-      console.log("没有数据", props?.barDimEchartsList);
       init(props?.barDimEchartsList?.data, props?.barDimEchartsList?.type);
     }
   }
@@ -70,8 +69,10 @@ const init = async (item?: any, type?: any, itemDim?: any) => {
     if (data.length > 0) {
       data.map((it, id) => {
         if (id < 10) {
-          dataList.title.push(it.assessmentObjectName);
-          dataList.data.push(it.totalScore);
+          if (dataList.data.length < 10) {
+            dataList.title.push(it.assessmentObjectName);
+            dataList.data.push(it.totalScore);
+          }
         }
       });
     }

+ 0 - 3
src/components/echarts/barDim.vue

@@ -26,7 +26,6 @@ onMounted(() => {
   nextTick(() => {
     if (props) {
       propItem.value = props;
-      console.log("props", props);
       init(
         props.barDimEchartsList.data,
         props.barDimEchartsList.type,
@@ -38,7 +37,6 @@ onMounted(() => {
 watch(
   propItem,
   newVal => {
-    console.log("newVal", newVal);
     if (props.bigFull == 2) {
       let dimList = {
         name: newVal.barDimEchartsList.name,
@@ -88,7 +86,6 @@ const init = async (item?: any, type?: number, dimList?: any) => {
   // } else {
   //   console.log("没有这条数据", item);
   // }
-  console.log("item", item);
   const { data, code } = await getPersonDimensionChartsRanking({
     ...item,
     dimensionName: dimList?.name,

+ 1 - 0
src/components/echarts/big/fullBig.vue

@@ -17,6 +17,7 @@ onMounted(() => {
   nextTick(() => {
     title.value = route.query.name;
     Object.assign(params.value, route.query);
+    console.log("route.query", route.query);
     // barDimEchartsRef.value.init(params.value);
     setTimeout(() => {
       init();

+ 17 - 9
src/components/echarts/radar.vue

@@ -1,16 +1,24 @@
 <script setup lang="ts">
-import { ref, computed, nextTick, onMounted } from "vue";
+import { ref, computed, nextTick, onMounted, watch } from "vue";
 import { useDark, useECharts } from "@pureadmin/utils";
+import { getPersonDimensionChartsList } from "@/api/draw";
 const $props = defineProps({
   radarRefList: {
     type: Array
   }
 });
 onMounted(() => {
-  if ($props.radarRefList) {
+  if ($props) {
     initChart($props.radarRefList);
   }
 });
+watch(
+  $props,
+  newVal => {
+    initChart(newVal.radarRefList);
+  },
+  { deep: true }
+);
 // 兼容dark主题
 const { isDark } = useDark();
 let theme = computed(() => {
@@ -23,11 +31,12 @@ const { setOptions } = useECharts(chartRef, { theme });
 const rankName = ref([]);
 const rankValue = ref([]);
 // 根据配置项渲染ECharts
-const initChart = (item?: any) => {
+const initChart = async (item?: any) => {
   rankName.value = [];
   rankValue.value = [];
-  if (item && item.length != 0) {
-    item.map(itx => {
+  const { data, code } = await getPersonDimensionChartsList({ ...item });
+  if (data && data.length != 0) {
+    data.map(itx => {
       itx.dimensionList.map(it => {
         rankName.value.push({
           name: it.dimName
@@ -78,10 +87,9 @@ const initChart = (item?: any) => {
     });
   }
 };
-nextTick(() => {
-  initChart();
-});
-// initChart();
+// nextTick(() => {
+//   initChart();
+// });
 defineExpose({ initChart });
 </script>
 

+ 11 - 2
src/components/personList/index.vue

@@ -44,22 +44,31 @@
 </template>
 
 <script lang="ts" setup>
-import { ref, nextTick } from "vue";
+import { ref, nextTick, watch } from "vue";
 const tableData = ref([]);
 const showList = ref();
+const watchData = ref();
 const init = (data?: any) => {
   if (data) {
     tableData.value = [];
+    watchData.value = data;
     setTimeout(() => {
       nextTick(() => {
         showList.value = data[0]?.dimensionList[0];
-        console.log("维度", showList.value);
         tableData.value = data[0]?.dimensionList[0].quotaList;
         // tableData.value = data;
       });
     }, 0);
   }
 };
+watch(
+  watchData.value,
+  newVal => {
+    showList.value = newVal[0]?.dimensionList[0];
+    tableData.value = newVal[0]?.dimensionList[0].quotaList;
+  },
+  { deep: true }
+);
 // nextTick(() => {
 //   init();
 // });

+ 16 - 12
src/views/draw/children/department/departmentDrank.vue

@@ -30,14 +30,16 @@ const getChartsListApi = async () => {
     type: 1
   });
   if (code == 200) {
-    showLength.value = data.length;
-    setTimeout(() => {
-      nextTick(() => {
-        if (rankTableRef.value) {
-          rankTableRef.value.init(data, "科室", "姓名");
-        }
-      });
-    }, 500);
+    if (data && data.length > 0) {
+      showLength.value = data?.length;
+      setTimeout(() => {
+        nextTick(() => {
+          if (rankTableRef.value) {
+            rankTableRef.value.init(data, "科室", "姓名");
+          }
+        });
+      }, 500);
+    }
   }
 };
 // 柱状图
@@ -55,7 +57,7 @@ const getPersonDimensionChartsListApiDimList = async () => {
   });
   if (code == 200) {
     dataList.dimName = [];
-    if (data.length > 0) {
+    if (data && data.length > 0) {
       data.map(it => {
         it.dimensionList.map((item, index) => {
           dataList.dimName.push({
@@ -81,7 +83,7 @@ const getPersonDimensionChartsListApi = async (
   });
   let tabIndex = Number(index);
   if (code == 200) {
-    if (data.length > 0) {
+    if (data && data.length > 0) {
       if (dimensionName && dimId) {
         setTimeout(() => {
           nextTick(() => {
@@ -93,7 +95,7 @@ const getPersonDimensionChartsListApi = async (
       } else {
         setTimeout(() => {
           nextTick(() => {
-            radarRefList.value = data;
+            // radarRefList.value = data;
             // radarRef.value.initChart(data);
           });
         }, 500);
@@ -114,7 +116,7 @@ const getPersonDimensionChartsRankingApi = async (
     type: 1
   });
   if (code == 200) {
-    if (data.length > 0) {
+    if (data && data.length > 0) {
       // barEchartsRef.value.init(data);
     }
   }
@@ -129,6 +131,7 @@ const init = (item, type) => {
   barDimEchartsList.type = null;
   if (Number(type)) {
     nextTick(() => {
+      radarRefList.value = { ...seachParams.value, type: 1 };
       barDimEchartsList.data = item;
       barDimEchartsList.type = 1;
     });
@@ -136,6 +139,7 @@ const init = (item, type) => {
     getPersonDimensionChartsListApiDimList();
     getPersonDimensionChartsRankingApi();
     getChartsListApi();
+    activeName.value = "1";
   }
   // setTimeout(() => {
   //   nextTick(() => {

+ 26 - 12
src/views/draw/children/head/headDrank.vue

@@ -37,7 +37,7 @@ const getChartsListApi = async () => {
     setTimeout(() => {
       nextTick(() => {
         if (data) {
-          showLength.value = data.length;
+          showLength.value = data?.length;
           rankTableRefList.data = data;
           rankTableRefList.dept = "科室";
           rankTableRefList.name = "姓名";
@@ -62,7 +62,7 @@ const getPersonDimensionChartsListApiDimList = async () => {
   });
   if (code == 200) {
     dataList.dimName = [];
-    if (data.length > 0) {
+    if (data && data.length > 0) {
       data.map(it => {
         it.dimensionList.map(item => {
           dataList.dimName.push({
@@ -89,7 +89,7 @@ const getPersonDimensionChartsListApi = async (
   let tabIndex = Number(index);
 
   if (code == 200) {
-    if (data.length > 0) {
+    if (data && data.length > 0) {
       if (dimensionName && dimId) {
         setTimeout(() => {
           nextTick(() => {
@@ -99,7 +99,7 @@ const getPersonDimensionChartsListApi = async (
       } else {
         setTimeout(() => {
           nextTick(() => {
-            radarRefList.value = data;
+            // radarRefList.value = data;
             // radarRef.value.initChart(data);
             // rankTableRef.value.init(data, "科室");
           });
@@ -112,7 +112,8 @@ const getPersonDimensionChartsListApi = async (
 };
 const getPersonDimensionChartsRankingApi = async (
   dimensionName?: string,
-  dimId?: number | string
+  dimId?: number | string,
+  index?: any
 ) => {
   const { code, data } = await getPersonDimensionChartsRanking({
     ...seachParams.value,
@@ -121,9 +122,18 @@ const getPersonDimensionChartsRankingApi = async (
     type: 3
   });
   if (code == 200) {
-    if (data.length > 0) {
-      barEchartsRef.value.init(data);
-    }
+    // if (data && data.length > 0) {
+    //   nextTick(() => {
+    //     if (Array.isArray(barEchartsRef?.value)) {
+    //       barEchartsRef?.value[Number(index - 1)]?.init(seachParams.value, 3, {
+    //         id: dimId,
+    //         name: dimensionName
+    //       });
+    //     } else {
+    //       barEchartsRef?.value?.init(data);
+    //     }
+    //   });
+    // }
   }
 };
 const barDimEchartsList = reactive({
@@ -134,6 +144,7 @@ const init = (item, type) => {
   seachParams.value = item;
   if (Number(type)) {
     nextTick(() => {
+      radarRefList.value = { ...seachParams.value, type: 3 };
       barDimEchartsList.data = item;
       barDimEchartsList.type = 3;
     });
@@ -141,6 +152,7 @@ const init = (item, type) => {
     getPersonDimensionChartsRankingApi();
     getPersonDimensionChartsListApiDimList();
     getChartsListApi();
+    activeName.value = "1";
   }
   setTimeout(() => {
     nextTick(() => {
@@ -159,14 +171,17 @@ const init = (item, type) => {
 // 维度表格
 const personListRef = ref();
 const handleClick = (tab: TabsPaneContext, event: Event) => {
-  console.log(tab, event);
   if (tab.props.label == "总览") {
     getPersonDimensionChartsListApi();
     getPersonDimensionChartsRankingApi();
     getChartsListApi();
   } else {
     getPersonDimensionChartsListApi(tab.props.label, tab.props.name, tab.index);
-    getPersonDimensionChartsRankingApi(tab.props.label, tab.props.name);
+    getPersonDimensionChartsRankingApi(
+      tab.props.label,
+      tab.props.name,
+      tab.index
+    );
   }
   // barEchartsRef.value.init(tab.props);
 };
@@ -174,8 +189,7 @@ const fullBig = (item: any) => {
   router.push({
     path: "/fullBig",
     query: {
-      dimensionName: item.name,
-      dimId: item.id,
+      ...item,
       ...seachParams.value,
       type: 3
     }

+ 14 - 12
src/views/draw/children/health/healthDrank.vue

@@ -42,7 +42,7 @@ const getChartsListApi = async () => {
     // showLength.value = data.length;
     setTimeout(() => {
       nextTick(() => {
-        if (data) {
+        if (data && data.length > 0) {
           showLength.value = data.length;
           rankTableRefList.data = data;
           rankTableRefList.dept = "医疗组";
@@ -100,7 +100,7 @@ const getPersonDimensionChartsListApi = async (
       } else {
         setTimeout(() => {
           nextTick(() => {
-            radarRefList.value = data;
+            // radarRefList.value = data;
             // radarRef.value.initChart(data);
           });
         }, 500);
@@ -116,16 +116,16 @@ const getPersonDimensionChartsRankingApi = async (
   dimensionName?: string,
   dimId?: number | string
 ) => {
-  const { code, data } = await getPersonDimensionChartsRanking({
-    ...seachParams.value,
-    dimId,
-    dimensionName,
-    type: 2
-  });
-  if (code == 200) {
-    if (data.length > 0) {
-    }
-  }
+  // const { code, data } = await getPersonDimensionChartsRanking({
+  //   ...seachParams.value,
+  //   dimId,
+  //   dimensionName,
+  //   type: 2
+  // });
+  // if (code == 200) {
+  //   if (data.length > 0) {
+  //   }
+  // }
 };
 const barDimEchartsList = reactive({
   data: null,
@@ -135,6 +135,7 @@ const init = (item, type) => {
   seachParams.value = item;
   if (Number(type)) {
     nextTick(() => {
+      radarRefList.value = { ...seachParams.value, type: 0 };
       barDimEchartsList.data = item;
       barDimEchartsList.type = 2;
     });
@@ -142,6 +143,7 @@ const init = (item, type) => {
     getPersonDimensionChartsRankingApi();
     getPersonDimensionChartsListApiDimList();
     getChartsListApi();
+    activeName.value = "1";
   }
   setTimeout(() => {
     nextTick(() => {

+ 15 - 14
src/views/draw/children/worker/workerDrak.vue

@@ -40,7 +40,7 @@ const getChartsListApi = async () => {
   if (code == 200) {
     setTimeout(() => {
       nextTick(() => {
-        if (data) {
+        if (data && data.length > 0) {
           showLength.value = data.length;
           rankTableRefList.data = data;
           rankTableRefList.dept = "科室";
@@ -77,7 +77,7 @@ const getPersonDimensionChartsListApiDimList = async () => {
     }
   }
 };
-const radarRefList = ref([]);
+const radarRefList = ref();
 const getPersonDimensionChartsListApi = async (
   dimensionName?: string,
   dimId?: number | string,
@@ -90,7 +90,15 @@ const getPersonDimensionChartsListApi = async (
     type: 0
   });
   let tabIndex = Number(index);
-
+  setTimeout(() => {
+    nextTick(() => {
+      // radarRefList.value = data;
+      // 组件加载过慢使用prop加载
+      // if (radarRef.value) {
+      //   radarRef.value.initChart(data);
+      // }
+    });
+  }, 0);
   if (code == 200) {
     if (dimensionName && dimId) {
       setTimeout(() => {
@@ -101,15 +109,6 @@ const getPersonDimensionChartsListApi = async (
         });
       }, 0);
     } else {
-      setTimeout(() => {
-        nextTick(() => {
-          radarRefList.value = data;
-          // 组件加载过慢使用prop加载
-          // if (radarRef.value) {
-          //   radarRef.value.initChart(data);
-          // }
-        });
-      }, 0);
     }
   }
 };
@@ -128,8 +127,8 @@ const getPersonDimensionChartsRankingApi = async (
     type: 0
   });
   if (code == 200) {
-    if (data.length > 0) {
-      barEchartsRef.value.init(data);
+    if (data && data.length > 0) {
+      // barEchartsRef?.value?.init(data);
     }
   }
 };
@@ -143,6 +142,7 @@ const init = (item, type) => {
   barDimEchartsList.type = null;
   if (Number(type)) {
     nextTick(() => {
+      radarRefList.value = { ...seachParams.value, type: 0 };
       barDimEchartsList.data = item;
       barDimEchartsList.type = 0;
     });
@@ -150,6 +150,7 @@ const init = (item, type) => {
     getPersonDimensionChartsRankingApi();
     getPersonDimensionChartsListApiDimList();
     getChartsListApi();
+    activeName.value = "1";
   }
   setTimeout(() => {
     nextTick(() => {

+ 21 - 3
src/views/evaluate/children/change/mould/manageObject.vue

@@ -470,7 +470,18 @@ const editOpenEvent = data => {
   console.log("editOpenEvent", data);
 };
 const hangdleOpenClick = row => {
-  console.log("hangdleOpenClick", row);
+  Object.assign(editVxe, {
+    relationId: null,
+    startValue: null,
+    finalValue: null,
+    dataSource: null,
+    score: null,
+    assessmentObjectId: null,
+    assessmentModelId: null,
+    id: null,
+    dimId: null,
+    assessmentId: null
+  });
   editVxe.finalValue = row?.finalValue;
   editVxe.score = row?.score;
 };
@@ -484,22 +495,29 @@ const editClosedEvent = row => {
     editVxe.id = row.row?.id;
     editVxe.dimId = row.row?.dimId;
     editVxe.assessmentId = messageData.value.id;
+    // 判断表头
     if (row.column.title == "得分") {
+      // 判断是否为空
       if (row.row?.score) {
+        // 判断是否id相同
         if (editVxe.score != row.row?.score) {
+          // if (row.row?.id != editVxe.id) {
           editVxe.score = row.row?.score;
-          editVxe.score = null;
+          editVxe.finalValue = null;
           updateAssessmentQuotaDetailsApi(editVxe);
+          // }
         }
       }
     }
     if (row.column.title == "完成值") {
       if (row.row?.finalValue) {
+        // if (row.row?.id != editVxe.id) {
         if (editVxe.finalValue != row.row?.finalValue) {
           editVxe.finalValue = row.row?.finalValue;
-          editVxe.finalValue = null;
+          editVxe.score = null;
           updateAssessmentQuotaDetailsApi(editVxe);
         }
+        // }
       }
     }
   }