wyf преди 1 година
родител
ревизия
95b7913421

+ 16 - 16
src/api/datamanagement/dataplatform.ts

@@ -47,11 +47,11 @@ export interface UserAccessRecordList {
 /**
  * @description: 获取用户访问记录
  */
-export const getUserAccessRecords = (data: UserAccessRecordQueryParams) => {
+export const getUserAccessRecords = (params: UserAccessRecordQueryParams) => {
   return http.request<UserAccessRecordList>({
-    url: '/skyeye-admin-platform-api/getList',
+    url: '/userRecord/getList',
     method: 'get',
-    data,
+    params,
   });
 };
 
@@ -81,11 +81,11 @@ export interface WorkshopVisitedTimes {
 /**
  * @description: 获取车间被访问次数数据
  */
-export const getWorkshopVisitedTimes = (data: ChartQuery) => {
+export const getWorkshopVisitedTimes = (params: ChartQuery) => {
   return http.request<WorkshopVisitedTimes[]>({
-    url: '/skyeye-admin-platform-api/statisticByWorkshop ',
-    method: 'post',
-    params: data,
+    url: '/userRecord/statisticByWorkshop ',
+    method: 'POST',
+    params,
   });
 };
 
@@ -101,22 +101,22 @@ export interface CameraVisitedTimes {
 /**
  * @description: 获取相机被访问次数数据
  */
-export const getCameraVisitedTimes = (data: ChartQuery) => {
+export const getCameraVisitedTimes = (params: ChartQuery) => {
   return http.request<CameraVisitedTimes[]>({
-    url: '/skyeye-admin-platform-api/statisticByCamera',
+    url: '/userRecord/statisticByCamera',
     method: 'post',
-    params: data,
+    params,
   });
 };
 
 /**
  * @description: 获取员工访问车间次数数据
  */
-export const getUserVisitTimes = (data: ChartQuery) => {
+export const getUserVisitTimes = (params: ChartQuery) => {
   return http.request<WorkshopVisitedTimes[]>({
-    url: '/skyeye-admin-platform-api/statisticByWorkshopPerUser ',
+    url: '/userRecord/statisticByWorkshopPerUser ',
     method: 'post',
-    params: data,
+    params,
   });
 };
 
@@ -131,10 +131,10 @@ export interface UserDailyVisitTimes {
 /**
  * @description: 获取员工日访问车间次数数据
  */
-export const getUserDailyVisitTimes = (data: ChartQuery) => {
+export const getUserDailyVisitTimes = (params: ChartQuery) => {
   return http.request<UserDailyVisitTimes[]>({
-    url: '/skyeye-admin-platform-api/statisticByWorkshopPerDay',
+    url: '/userRecord/statisticByWorkshopPerDay',
     method: 'post',
-    params: data,
+    params,
   });
 };

+ 6 - 6
src/api/system/role.ts

@@ -52,7 +52,7 @@ export function updateRole(params: RoleType<PermissionType>) {
 export function roleAdminInfo(params) {
   return http.request({
     url: '/role/infoAdmin',
-    method: 'GET',
+
     params,
   });
 }
@@ -63,7 +63,7 @@ export function roleAdminInfo(params) {
 export function roleUserInfo(params) {
   return http.request({
     url: '/role/info',
-    method: 'GET',
+
     params,
   });
 }
@@ -107,7 +107,7 @@ export function delUserRole(params) {
 export function roleList(params?) {
   return http.request({
     url: '/role/pageList',
-    method: 'GET',
+
     params,
   });
 }
@@ -118,7 +118,7 @@ export function roleList(params?) {
 export function roleAllList(params?) {
   return http.request({
     url: '/role/getAllRoles',
-    method: 'GET',
+
     params,
   });
 }
@@ -129,7 +129,7 @@ export function roleAllList(params?) {
 export function permissionList() {
   return http.request({
     url: '/role/listAllPermission',
-    method: 'GET',
+
   });
 }
 
@@ -137,6 +137,6 @@ export function permissionList() {
 export function getFeaturePermissions() {
   return http.request({
     url: '/role/listFunctionPermission',
-    method: 'get',
+
   });
 }

+ 9 - 2
src/views/datamanager/platformdata/charts/BarChart.vue

@@ -9,14 +9,16 @@
     TooltipComponentOption,
     GridComponent,
     GridComponentOption,
+    DataZoomComponent,
+    DataZoomComponentOption,
   } from 'echarts/components';
   import { BarChart, BarSeriesOption } from 'echarts/charts';
   import { CanvasRenderer } from 'echarts/renderers';
   import { onMounted, watch } from 'vue';
 
-  echarts.use([TooltipComponent, GridComponent, BarChart, CanvasRenderer]);
+  echarts.use([TooltipComponent, GridComponent, BarChart, CanvasRenderer, DataZoomComponent]);
   type EChartsOption = echarts.ComposeOption<
-    TooltipComponentOption | GridComponentOption | BarSeriesOption
+    TooltipComponentOption | GridComponentOption | BarSeriesOption | DataZoomComponentOption
   >;
 
   const props = withDefaults(
@@ -57,6 +59,11 @@
         bottom: '3%',
         containLabel: true,
       },
+      dataZoom: [
+        {
+          type: 'inside',
+        },
+      ],
       xAxis: [
         {
           type: 'category',

+ 15 - 3
src/views/datamanager/platformdata/charts/LineChart.vue

@@ -4,14 +4,21 @@
 
 <script setup lang="ts">
   import * as echarts from 'echarts/core';
-  import { GridComponent, GridComponentOption } from 'echarts/components';
+  import {
+    GridComponent,
+    GridComponentOption,
+    DataZoomComponent,
+    DataZoomComponentOption,
+  } from 'echarts/components';
   import { LineChart, LineSeriesOption } from 'echarts/charts';
   import { UniversalTransition } from 'echarts/features';
   import { CanvasRenderer } from 'echarts/renderers';
   import { onMounted, watch } from 'vue';
 
-  echarts.use([GridComponent, LineChart, CanvasRenderer, UniversalTransition]);
-  type EChartsOption = echarts.ComposeOption<GridComponentOption | LineSeriesOption>;
+  echarts.use([GridComponent, LineChart, CanvasRenderer, UniversalTransition, DataZoomComponent]);
+  type EChartsOption = echarts.ComposeOption<
+    GridComponentOption | LineSeriesOption | DataZoomComponentOption
+  >;
   const props = withDefaults(
     defineProps<{
       chartData: number[];
@@ -49,6 +56,11 @@
         bottom: '3%',
         containLabel: true,
       },
+      dataZoom: [
+        {
+          type: 'inside',
+        },
+      ],
       xAxis: [
         {
           type: 'category',

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

@@ -37,41 +37,42 @@
 <script setup lang="ts">
   import { onMounted, ref, watch } from 'vue';
   import { ElMessage } from 'element-plus';
+  import { ChartQuery } from '@/api/datamanagement/dataplatform';
 
   const checkAll = ref();
-  const dateRange = ref<Date[]>();
   const selectedWorkshop = ref<string[]>();
+  const dateRange = ref<Date[]>();
 
   const props = defineProps<{
     workshopList?: any[] | undefined;
   }>();
 
   const emits = defineEmits<{
-    (e: 'chartParamsChanged', parmas: DialogParams);
+    (e: 'chartParamsChanged', parmas: ChartQuery);
   }>();
 
-  export interface DialogParams {
-    date: Date[] | undefined;
-    workshops?: string[] | undefined;
-  }
-  const serchParams = ref<DialogParams>({
-    date: undefined,
+  // export interface DialogParams {
+  //   date: Date[];
+  //   workshops?: string[] | undefined;
+  // }
+  const serchParams = ref<ChartQuery>({
+    startTime: new Date(),
+    endTime: new Date(0),
   });
 
   const onSearch = () => {
-    if (!dateRange.value) {
-      ElMessage.error('请选择时间范围');
-      return;
-    }
-    serchParams.value.date = dateRange.value;
-    if (props.workshopList !== undefined) {
-      if (!selectedWorkshop.value || !selectedWorkshop.value.length) {
-        ElMessage.error('请至少选择一个车间');
-        return;
-      }
-      serchParams.value.workshops = selectedWorkshop.value;
-    }
-    emits('chartParamsChanged', serchParams.value);
+    // if (!serchParams.value.date) {
+    //   ElMessage.error('请选择时间范围');
+    //   return;
+    // }
+    // if (props.workshopList !== undefined) {
+    //   if (!selectedWorkshop.value || !selectedWorkshop.value.length) {
+    //     ElMessage.error('请至少选择一个车间');
+    //     return;
+    //   }
+    //   serchParams.value.workshops = selectedWorkshop.value;
+    // }
+    // emits('chartParamsChanged');
   };
 
   const shortcuts = [
@@ -122,7 +123,6 @@
     if (props.workshopList !== undefined) {
       selectedWorkshop.value = props.workshopList!.map((item) => item.id);
     }
-    dateRange.value = [new Date(0), new Date()];
   });
 </script>
 

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

@@ -23,7 +23,11 @@
     >
       <DialogNavBar
         :workshop-list="dialogTitle === '相机统计数据' ? flattenedWorkshops : undefined"
-        @chart-params-changed="(v) => console.log(v)"
+        @chart-params-changed="
+          (v) => {
+            console.log(v);
+          }
+        "
       />
       <BarChart :chart-data="chartData.val" :chart-lable="chartData.label" />
     </el-dialog>
@@ -40,6 +44,9 @@
     UserAccessRecordQueryParams,
     UserAccessRecordList,
     getUserAccessRecords,
+    ChartQuery,
+    getCameraVisitedTimes,
+    getWorkshopVisitedTimes,
   } from '@/api/datamanagement/dataplatform';
 
   const sceneInfos = useSceneInfos();
@@ -49,44 +56,92 @@
   });
 
   const dialogVisible = ref(false);
-  const chartData = ref();
   const dialogTitle = ref('');
 
   const showWorkshopData = () => {
     dialogVisible.value = true;
-    chartData.value = workshopData.value;
     dialogTitle.value = '车间统计数据';
   };
 
   const showCameraData = () => {
     dialogVisible.value = true;
-    chartData.value = cameraData.value;
     dialogTitle.value = '相机统计数据';
   };
 
   const tableQueryParams = ref<UserAccessRecordQueryParams>({
     pageNumber: 1,
     pageSize: 10,
+    nickname: '',
+    username: '',
+    sortKey: '',
+    sortType: '',
   });
+
   const tableData = ref<UserAccessRecordList>();
 
   watch(
     () => tableQueryParams.value,
-    (val) => {
-      getUserAccessRecords(val).then();
+    async () => {
+      const data = await getUserAccessRecords(tableQueryParams.value);
+      tableData.value = data;
+      // tableData.value = {
+      //   pageNumber: 1,
+      //   pageSize: 10,
+      //   total: 1,
+      //   list: [
+      //     {
+      //       userId: 1,
+      //       username: 'string',
+      //       nickname: 'string',
+      //       deptId: 1,
+      //       deptName: 'string',
+      //       statisticDay: 1,
+      //       statisticMonth: 1,
+      //       statisticAll: 1,
+      //     },
+      //   ],
+      // };
+    },
+    {
+      immediate: true,
+      deep: true,
     },
-    { immediate: true },
   );
 
-  const workshopData = ref({
+  const ChartQueryParams = ref<ChartQuery>();
+  const chartData = ref({
     label: ['车间1', '车间2', '车间3', '车间4', '车间5', '车间6'],
     val: [9, 66, 77, 82, 35, 100],
   });
 
-  const cameraData = ref({
-    label: ['相机1', '相机2', '相机3', '相机4', '相机5', '相机6'],
-    val: [99, 66, 77, 82, 35, 1],
-  });
+  watch(
+    () => ChartQueryParams.value,
+    async (v) => {
+      if (dialogTitle.value === '相机统计数据') {
+        const data = await getCameraVisitedTimes(v!);
+        console.log(data);
+        // chartData.value.val = data;
+      } else {
+        const data = await getWorkshopVisitedTimes(v!);
+        console.log(data);
+        // chartData.value.label = data;
+      }
+    },
+    {
+      immediate: true,
+      deep: true,
+    },
+  );
+
+  // const workshopData = ref({
+  //   label: ['车间1', '车间2', '车间3', '车间4', '车间5', '车间6'],
+  //   val: [9, 66, 77, 82, 35, 100],
+  // });
+
+  // const cameraData = ref({
+  //   label: ['相机1', '相机2', '相机3', '相机4', '相机5', '相机6'],
+  //   val: [99, 66, 77, 82, 35, 1],
+  // });
 </script>
 
 <style scoped lang="scss">