Explorar el Código

feat(组件):

修改部分bug
tangning hace 2 años
padre
commit
7c43215bbe

+ 1 - 0
src/api/customer/index.ts

@@ -67,6 +67,7 @@ export const downTemplate = (params: companyExcelParams) =>
     url: Api.downTemplate,
     params: params,
     // data: params,
+    fileName:params.type == 0?'入库模板.xls':'出库模板.xls',
     headers: {
       // @ts-ignore
       ignoreCancelToken: true,

+ 4 - 0
src/api/order/index.ts

@@ -61,6 +61,7 @@ export const CameraExport = (params: PageParams) =>
   defHttp.downloadFile<FileStream>({
     url: Api.cameraExport,
     params: params,
+    fileName:'相机订单.xls',
     // data: params,
     headers: {
       // @ts-ignore
@@ -78,6 +79,7 @@ export const IncrementExport = (params: PageParams) =>
     url: Api.incrementExport,
     params: params,
     // data: params,
+    fileName:'权益订单.xls',
     headers: {
       // @ts-ignore
       ignoreCancelToken: true,
@@ -100,6 +102,7 @@ export const DownExport = (params: PageParams) =>
   defHttp.downloadFile<FileStream>({
     url: Api.downExport,
     params: params,
+    fileName:'下载订单.xls',
     // data: params,
     headers: {
       // @ts-ignore
@@ -133,6 +136,7 @@ export const InvoiceExport = (params: PageParams) =>
     url: Api.exportInvoice,
     method:'POST',
     params,
+    fileName:'发票记录.xls',
     headers: {
       // @ts-ignore
       ignoreCancelToken: true,

+ 3 - 0
src/api/statistics/index.ts

@@ -118,6 +118,7 @@ export const buryPointList = (params: PageParams) =>
     url: Api.cameraExport,
     params: params,
     // data: params,
+    fileName:'相机订单.xls',
     headers: {
       // @ts-ignore
       ignoreCancelToken: true,
@@ -130,6 +131,7 @@ export const buryPointList = (params: PageParams) =>
     url: Api.downExport,
     params: params,
     // data: params,
+    fileName:'下载订单.xls',
     headers: {
       // @ts-ignore
       ignoreCancelToken: true,
@@ -141,6 +143,7 @@ export const buryPointList = (params: PageParams) =>
   defHttp.downloadFile<FileStream>({
     url: Api.incrementExport,
     params: params,
+    fileName:'权益订单.xls',
     // data: params,
     headers: {
       // @ts-ignore

+ 43 - 8
src/utils/http/axios/Axios.ts

@@ -1,6 +1,7 @@
 import type { AxiosRequestConfig, AxiosInstance, AxiosResponse, AxiosError } from 'axios';
 import type { RequestOptions, Result, UploadFileParams } from '/#/axios';
 import type { CreateAxiosOptions } from './axiosTransform';
+import { useMessage } from '/@/hooks/web/useMessage';
 import axios from 'axios';
 import qs from 'qs';
 import { AxiosCanceler } from './axiosCancel';
@@ -8,6 +9,8 @@ import { isFunction } from '/@/utils/is';
 import { cloneDeep } from 'lodash-es';
 import { ContentTypeEnum } from '/@/enums/httpEnum';
 import { RequestEnum } from '/@/enums/httpEnum';
+const { createMessage } = useMessage();
+import { downloadByData } from '/@/utils/file/download'
 
 export * from './axiosTransform';
 
@@ -191,14 +194,46 @@ export class VAxios {
    * @description:  File Upload
    */
    downloadFile<T = any>(config: AxiosRequestConfig) {
-    return this.request({
-      ...config,
-      headers: {
-        'Content-type': ContentTypeEnum.JSON,
-        // @ts-ignore
-        ignoreCancelToken: true,
-      },
-    });
+    let conf: CreateAxiosOptions = cloneDeep(config);
+    const { requestOptions } = this.options;
+    const transform = this.getTransform();
+    const opt: RequestOptions = Object.assign({}, requestOptions);
+    const { beforeRequestHook, requestCatchHook, transformRequestHook } = transform || {};
+    if (beforeRequestHook && isFunction(beforeRequestHook)) {
+      conf = beforeRequestHook(conf, opt);
+    }
+    conf.requestOptions = opt;
+
+    conf = this.supportFormData(conf);
+    // return new Promise((resolve, reject) => {
+      this.axiosInstance
+      .request<any, AxiosResponse<Result>>(conf)
+      .then((res: AxiosResponse<Result>) => {
+        const resData = res.data
+        const fileReader = new FileReader()
+        fileReader.onloadend = () => {
+          // 此处两种判断返回信息的方法可选其一
+          // 方法一:
+          try {
+            const jsonData = JSON.parse(fileReader.result) // 说明是普通对象数据,后台转换失败
+            // 后台信息
+            createMessage.error(jsonData.message);
+          } catch (err) { // 解析成对象失败,说明是正常的文件流
+            // 下载文件
+            console.log('err',err)
+            downloadByData(err,config.fileName)
+          }
+        }
+        fileReader.readAsText(resData)
+      }).catch((e: Error | AxiosError) => {    
+        if (requestCatchHook && isFunction(requestCatchHook)) {
+          requestCatchHook(e, opt);
+          return;
+        }    
+        console.log('Error',e)
+        // reject(e);
+      });;
+    // })
   }
   // support form-data
   supportFormData(config: AxiosRequestConfig) {

+ 2 - 0
src/views/account/details/data.ts

@@ -199,6 +199,8 @@ export const equitySearchForm: Partial<FormProps> = {
       component: 'RangePicker',
       componentProps: {
         maxLength: 100,
+        valueFormat:'YYYY-MM-DD',
+        format: 'YYYY-MM-DD',
       },
       colProps: {
         xl: 7,

+ 2 - 0
src/views/customer/device.vue

@@ -181,6 +181,8 @@
             component: 'RangePicker',
             componentProps: {
               maxLength: 100,
+              valueFormat:'YYYY-MM-DD',
+              format: 'YYYY-MM-DD',
             },
             colProps: {
               xl: 7,

+ 1 - 0
src/views/device/index.vue

@@ -216,6 +216,7 @@
             component: 'RangePicker',
             componentProps: {
               format: 'YYYY-MM-DD',
+              valueFormat:'YYYY-MM-DD',
             },
             colProps: {
               xl: 7,

+ 4 - 0
src/views/invoice/data.tsx

@@ -141,6 +141,8 @@ export const searchForm: Partial<FormProps> = {
       component: 'RangePicker',
       componentProps: {
         maxLength: 100,
+        valueFormat:'YYYY-MM-DD',
+        format: 'YYYY-MM-DD',
       },
       colProps: {
         xl: 7,
@@ -153,6 +155,8 @@ export const searchForm: Partial<FormProps> = {
       component: 'RangePicker',
       componentProps: {
         maxLength: 100,
+        valueFormat:'YYYY-MM-DD',
+        format: 'YYYY-MM-DD',
       },
       colProps: {
         xl: 7,

+ 3 - 2
src/views/operate/agent.vue

@@ -73,8 +73,9 @@
             component: 'RangePicker',
             componentProps: {
               maxLength: 100,
-              format: 'YYYY-MM-DD HH:mm',
-              showTime: true,
+              format: 'YYYY-MM-DD',
+              valueFormat:'YYYY-MM-DD',
+              // showTime: true,
             },
             colProps: {
               xl: 11,

+ 2 - 2
src/views/operate/components/recruit/addModal.vue

@@ -69,7 +69,7 @@
             required: true,
             componentProps: {
               maxLength: 5,
-              placeholder: '招聘人数',
+              placeholder: '请输入薪资待遇',
               max: 999,
               min: 0,
             },
@@ -84,7 +84,7 @@
             defaultValue:1,
             componentProps: {
               maxLength: 5,
-              placeholder: '招聘人数',
+              placeholder: '请输入招聘人数',
               max: 999,
               min: 1,
             },

+ 2 - 1
src/views/operate/messageList.vue

@@ -70,7 +70,8 @@
             component: 'RangePicker',
             componentProps: {
               maxLength: 100,
-              format: 'YYYY-MM-DD HH:mm',
+              format: 'YYYY-MM-DD',
+              valueFormat:'YYYY-MM-DD',
               showTime: true,
             },
             colProps: {

+ 2 - 1
src/views/operate/newsList.vue

@@ -184,7 +184,8 @@
             component: 'RangePicker',
             componentProps: {
               maxLength: 100,
-              format: 'YYYY-MM-DD HH:mm',
+              format: 'YYYY-MM-DD',
+              valueFormat:'YYYY-MM-DD',
               showTime: true,
             },
             colProps: {

+ 16 - 15
src/views/operate/recruitList.vue

@@ -155,22 +155,23 @@
       const searchForm: Partial<FormProps> = {
         labelWidth: 100,
         schemas: [
+          // {
+          //   field: 'sceneName',
+          //   label: t('routes.operate.releaseTime'),
+          //   component: 'RangePicker',
+          //   componentProps: {
+          //     maxLength: 100,
+          //     format: 'YYYY-MM-DD',
+          //     valueFormat:'YYYY-MM-DD',
+          //     showTime: true,
+          //   },
+          //   colProps: {
+          //     xl: 11,
+          //     xxl: 11,
+          //   },
+          // },
           {
-            field: 'sceneName',
-            label: t('routes.operate.releaseTime'),
-            component: 'RangePicker',
-            componentProps: {
-              maxLength: 100,
-              format: 'YYYY-MM-DD HH:mm',
-              showTime: true,
-            },
-            colProps: {
-              xl: 11,
-              xxl: 11,
-            },
-          },
-          {
-            field: 'type',
+            field: 'workName',
             label: t('routes.operate.newsTitle'),
             component: 'Input',
             colProps: {

+ 2 - 1
src/views/operate/sceneList.vue

@@ -72,7 +72,8 @@
             component: 'RangePicker',
             componentProps: {
               maxLength: 100,
-              format: 'YYYY-MM-DD HH:mm',
+              format: 'YYYY-MM-DD',
+              valueFormat:'YYYY-MM-DD',
               showTime: true,
             },
             colProps: {

+ 4 - 0
src/views/order/cameraList.vue

@@ -140,6 +140,10 @@
               xl: 7,
               xxl: 7,
             },
+            componentProps:{
+              format: 'YYYY-MM-DD',
+              valueFormat:'YYYY-MM-DD',
+            }
           },
           {
             field: 'type',

+ 28 - 15
src/views/order/downloadList.vue

@@ -78,15 +78,15 @@
         {
           title: '用户账号',
           dataIndex: 'userName',
-          width: 80,
+          width: 120,
         },{
           title: '相机sn码',
           dataIndex: 'snCode',
-          width: 80,
+          width: 120,
         },{
           title: '场景',
           dataIndex: 'sceneNum',
-          width: 80,
+          width: 100,
         },
         {
           title: '订单金额(元)',
@@ -113,50 +113,56 @@
       ];
       const searchForm: Partial<FormProps> = {
         labelWidth: 100,
+        autoAdvancedLine:1,
+        actionColOptions: {
+          span: 24,
+        },
         schemas: [
           {
-            field: 'sceneName',
+            field: 'ctivated',
             label: '下单时间',
             component: 'RangePicker',
             componentProps: {
               maxLength: 100,
+              format: 'YYYY-MM-DD',
+              valueFormat:'YYYY-MM-DD',
             },
             colProps: {
-              xl: 7,
-              xxl: 7,
+              xl: 8,
+              xxl: 8,
             },
           },{
-            field: 'sceneName',
+            field: 'orderSn',
             label: '订单号',
             component: 'Input',
             componentProps: {
               maxLength: 100,
             },
             colProps: {
-              xl: 6,
-              xxl: 6,
+              xl: 7,
+              xxl: 7,
             },
           },{
-            field: 'sceneName',
+            field: 'userName',
             label: '手机号',
             component: 'Input',
             componentProps: {
               maxLength: 100,
             },
             colProps: {
-              xl: 5,
-              xxl: 5,
+              xl: 7,
+              xxl: 7,
             },
           },{
-            field: 'sceneName',
+            field: 'tradeNum',
             label: '支付平台交易号',
             component: 'Input',
             componentProps: {
               maxLength: 100,
             },
             colProps: {
-              xl: 6,
-              xxl: 6,
+              xl: 7,
+              xxl: 7,
             },
           },
         ],
@@ -170,6 +176,13 @@
         formConfig: searchForm,
         showTableSetting: true,
         rowKey: 'id',
+        beforeFetch:(T)=>{
+          if(T.ctivated){
+            T.startTime = T.ctivated[0]
+            T.endTime = T.ctivated[1]
+          }
+          return T
+        },
         fetchSetting: {
           pageField: 'pageNum',
           sizeField: 'pageSize',

+ 23 - 10
src/views/order/equityList.vue

@@ -78,7 +78,7 @@
         {
           title: '用户名',
           dataIndex: 'userName',
-          width: 80,
+          width: 100,
         },
         {
           title: '数量',
@@ -110,39 +110,45 @@
       ];
       const searchForm: Partial<FormProps> = {
         labelWidth: 100,
+        autoAdvancedLine:1,
+        actionColOptions: {
+          span: 24,
+        },
         schemas: [
           {
-            field: 'sceneName',
+            field: 'ctivated',
             label: '下单时间',
             component: 'RangePicker',
             componentProps: {
               maxLength: 100,
+              format: 'YYYY-MM-DD',
+              valueFormat:'YYYY-MM-DD',
             },
             colProps: {
               xl: 7,
               xxl: 7,
             },
           },{
-            field: 'sceneName',
+            field: 'orderSn',
             label: '订单号',
             component: 'Input',
             componentProps: {
               maxLength: 100,
             },
             colProps: {
-              xl: 6,
-              xxl: 6,
+              xl: 7,
+              xxl: 7,
             },
           },{
-            field: 'sceneName',
+            field: 'userName',
             label: '手机号',
             component: 'Input',
             componentProps: {
               maxLength: 100,
             },
             colProps: {
-              xl: 5,
-              xxl: 5,
+              xl: 7,
+              xxl: 7,
             },
           },{
             field: 'sceneName',
@@ -152,8 +158,8 @@
               maxLength: 100,
             },
             colProps: {
-              xl: 6,
-              xxl: 6,
+              xl: 7,
+              xxl: 7,
             },
           },
         ],
@@ -167,6 +173,13 @@
         formConfig: searchForm,
         showTableSetting: true,
         rowKey: 'id',
+        beforeFetch:(T)=>{
+          if(T.ctivated){
+            T.startTime = T.ctivated[0]
+            T.endTime = T.ctivated[1]
+          }
+          return T
+        },
         fetchSetting: {
           pageField: 'pageNum',
           sizeField: 'pageSize',

+ 4 - 0
src/views/product/app/index.vue

@@ -98,6 +98,8 @@
             component: 'RangePicker',
             componentProps: {
               maxLength: 100,
+              valueFormat:'YYYY-MM-DD',
+              format: 'YYYY-MM-DD',
             },
             colProps: {
               xl: 7,
@@ -109,6 +111,8 @@
             label: '支付时间',
             component: 'RangePicker',
             componentProps: {
+              valueFormat:'YYYY-MM-DD',
+              format: 'YYYY-MM-DD',
               maxLength: 100,
             },
             colProps: {