Переглянути джерело

feat: (dashbroad) 增加search params

gemercheung 2 роки тому
батько
коміт
8481a45e39

+ 65 - 21
src/views/dashboard/analysis/enterprise.vue

@@ -33,7 +33,10 @@
     userStaticsApi,
     bulletChatStaticsApi,
     companyChatExportApi,
-  } from '../../../api/dashboard/analysis';
+  } from '/@/api/dashboard/analysis';
+
+  import { ListApi as ListCorporationApi } from '/@/api/corporation/list';
+  import { listRoomsApi, ListApi as ListLiveApi } from '/@/api/scene/list';
   import { formatToDate } from '/@/utils/dateUtil';
   import dayjs from 'dayjs';
 
@@ -84,56 +87,97 @@
         field: 'companyId',
         label: '请选择企业',
         component: 'ApiSelect',
-        required: true,
+        required: false,
         componentProps: {
-          // api: ShippingListApi,
-          // resultField: 'list',
-          // labelField: 'name',
-          // valueField: 'id',
-          // immediate: true,
+          api: ListCorporationApi,
+          resultField: 'list',
+          labelField: 'name',
+          valueField: 'id',
+          immediate: false,
           // onChange: function (_, opt) {
           //   // Reflect.set(modalRecord, 'shippingName', opt.label);
           // },
-          // params: {
-          //   page: 1,
-          //   limit: 1000,
-          // },
+          params: {
+            page: 1,
+            limit: 1000,
+          },
         },
         colProps: {
-          xl: 5,
+          lg: 24,
+          md: 24,
+          xl: 12,
           xxl: 5,
+          // xl: 5,
+          // xxl: 5,
         },
       },
       {
-        field: 'roomId',
+        field: 'liveRoomId',
         label: '请选择房间',
         component: 'ApiSelect',
         colProps: {
-          xl: 5,
+          lg: 24,
+          md: 24,
+          xl: 12,
           xxl: 5,
         },
-        componentProps: {},
+        componentProps: {
+          api: listRoomsApi,
+          resultField: 'list',
+          labelField: 'name',
+          valueField: 'id',
+          immediate: false,
+          // onChange: function (_, opt) {
+          //   // Reflect.set(modalRecord, 'shippingName', opt.label);
+          // },
+          params: {
+            page: 1,
+            limit: 1000,
+          },
+        },
       },
       {
-        field: 'sceneId',
-        label: '请选择直播场景',
+        field: 'brandId',
+        label: '请选择直播',
         labelWidth: 130,
         component: 'ApiSelect',
         colProps: {
-          xl: 5,
+          lg: 24,
+          md: 24,
+          xl: 12,
           xxl: 5,
         },
-        componentProps: {},
+        componentProps: {
+          api: ListLiveApi,
+          resultField: 'list',
+          labelField: 'sceneName',
+          valueField: 'id',
+          immediate: false,
+          // onChange: function (_, opt) {
+          //   // Reflect.set(modalRecord, 'shippingName', opt.label);
+          // },
+          params: {
+            page: 1,
+            limit: 1000,
+          },
+        },
       },
       {
         field: 'time',
         label: '时间段',
         component: 'RangePicker',
         colProps: {
-          xl: 5,
+          lg: 24,
+          md: 24,
+          xl: 12,
           xxl: 5,
         },
-        componentProps: {},
+        componentProps: {
+          disabledDate(current) {
+            // console.log('current', current, date);
+            return current && current > dayjs().endOf('day');
+          },
+        },
       },
     ],
   };

+ 3 - 12
src/views/dashboard/analysis/index.vue

@@ -130,6 +130,9 @@
             // console.log('current', current, date);
             return current && current > dayjs().endOf('day');
           },
+          onChange: (value) => {
+            console.log('onchange', value);
+          },
         },
       },
     ],
@@ -162,18 +165,6 @@
 
   async function handleExport() {
     await bulletChatExportApi(searchInfo);
-    // const downloadBlob = new Blob([data], {
-    //   type: 'text/csv',
-    // });
-    // const url = URL.createObjectURL(downloadBlob);
-    // const a: HTMLAnchorElement = document.createElement('a');
-    // document.body.appendChild(a);
-    // a.style.display = 'none';
-    // a.href = url;
-    // const name = new Date().getTime();
-    // a.download = `${name}.csv`;
-    // a.click();
-    // window.URL.revokeObjectURL(url);
   }
 
   setTimeout(() => {