Explorar el Código

feat: 表格远程排序

wyf hace 1 año
padre
commit
075b0cec3d

+ 3 - 3
src/views/datamanager/platformdata/charts/BarChart.vue

@@ -42,9 +42,6 @@
       () => {
         drawBarChart(bar);
       },
-      // {
-      //   deep: true,
-      // }
     );
   });
 
@@ -76,6 +73,9 @@
           axisTick: {
             alignWithLabel: true,
           },
+          axisLabel: {
+            rotate: 45,
+          },
         },
       ],
       yAxis: [

+ 11 - 0
src/views/datamanager/platformdata/charts/LineChart.vue

@@ -67,6 +67,9 @@
         {
           type: 'category',
           data: props.chartLable,
+          axisLabel: {
+            rotate: 45,
+          },
         },
       ],
       yAxis: [
@@ -81,7 +84,15 @@
           type: 'line',
           data: props.chartData,
         },
+        // TODO 根据返回数据维度添加
       ],
+      // res.map(item => {
+      //   return {
+      //     name: item.name,
+      //     type: 'line',
+      //     data: item.data,
+      //   };
+      // }),
     };
     line.setOption(lineOption);
   };

+ 2 - 0
src/views/datamanager/platformdata/compoents/common/DialogNavBar.vue

@@ -65,6 +65,8 @@
     }
     serchParams.value.startTime = formatDate(dateRange.value[0]);
     serchParams.value.endTime = formatDate(dateRange.value[1]);
+    // console.log(props.workshopList);
+    // serchParams.value.workshopList = props.workshopList?.map((item) => item.id);
     if (props.workshopList !== undefined) {
       if (!selectedWorkshop.value || !selectedWorkshop.value.length) {
         ElMessage.error('请至少选择一个车间');

+ 19 - 4
src/views/datamanager/platformdata/compoents/common/PlatformTable.vue

@@ -29,6 +29,7 @@
       stripe
       :data="tableData.list"
       highlight-current-row
+      @sort-change="handleSortChange"
     >
       <el-table-column label="姓名" prop="nickname" align="center"></el-table-column>
       <el-table-column label="工号" prop="username" align="center"></el-table-column>
@@ -36,19 +37,19 @@
       <el-table-column
         :label="'当日' + props.tableLabel"
         prop="statisticDay"
-        sortable
+        sortable="custom"
         align="right"
       ></el-table-column>
       <el-table-column
         :label="'本月' + tableLabel"
         prop="statisticMonth"
-        sortable
+        sortable="custom"
         align="right"
       ></el-table-column>
       <el-table-column
         :label="'累计' + tableLabel"
         prop="statisticAll"
-        sortable
+        sortable="custom"
         align="right"
       ></el-table-column>
       <el-table-column v-if="tableLabel === '访问次数'" label="访问次数统计图" align="center">
@@ -147,7 +148,20 @@
     emits('tableParamsChanged', tableQueryParams.value);
   };
 
-  // TODO 表格排序事件
+  // 表格排序事件
+  const handleSortChange = (data: any) => {
+    if (data.order !== null) {
+      tableQueryParams.value.sortKey = data.prop;
+      tableQueryParams.value.sortType = data.order.includes('a') ? 'asc' : 'desc';
+    } else {
+      delete tableQueryParams.value.sortKey;
+      delete tableQueryParams.value.sortType;
+    }
+    tableQueryParams.value.pageNumber = 1;
+    console.log(tableQueryParams.value);
+    // TODO 替换
+    // emits('tableParamsChanged', tableQueryParams.value);
+  };
 
   // 复用输入框类型和变化事件
   const tableQueryType = ref<string>('姓名');
@@ -157,6 +171,7 @@
     } else {
       delete tableQueryParams.value.nickname;
     }
+    tableQueryTypeContent.value = '';
   };
   // 复用输入框绑定内容、提交事件、重置事件
   const tableQueryTypeContent = ref<string>();

+ 2 - 2
src/views/datamanager/platformdata/compoents/query/Query.vue

@@ -24,9 +24,9 @@
       <DialogNavBar
         :workshop-list="dialogTitle === '相机统计数据' ? flattenedWorkshops : undefined"
         @chart-params-changed="
-          (v) => {
+          async (v) => {
             console.log(v);
-            getChartData(v);
+            await getChartData(v);
           }
         "
       />