Pārlūkot izejas kodu

Merge branch 'master' of http://git.ycjcjy.com/state_grid/invoice_fill_admin

张涛 1 gadu atpakaļ
vecāks
revīzija
038fcb512c
3 mainītis faili ar 134 papildinājumiem un 115 dzēšanām
  1. 2
    2
      config/proxy.js
  2. 17
    0
      src/pages/invoiceDetail/index.jsx
  3. 115
    113
      src/utils/request.js

+ 2
- 2
config/proxy.js Parādīt failu

@@ -14,8 +14,8 @@ export default {
14 14
       target: 'http://192.168.89.25:7081',
15 15
       changeOrigin: true,
16 16
       headers: {
17
-        origin: 'http://192.168.89.147:7081',
18
-        referer: 'http://192.168.89.147:7081',
17
+        origin: 'http://192.168.89.25:7081',
18
+        referer: 'http://192.168.89.25:7081',
19 19
       },
20 20
     },
21 21
   },

+ 17
- 0
src/pages/invoiceDetail/index.jsx Parādīt failu

@@ -106,6 +106,23 @@ export default (props) => {
106 106
       key: 'mailAddress',
107 107
       search: false,
108 108
     },
109
+    {
110
+      title: '房号',
111
+      dataIndex: 'roomCode',
112
+      key: 'roomCode',
113
+      search: false,
114
+    },
115
+    {
116
+      title: '是否需要住宿清单',
117
+      dataIndex: 'isNeedLodging',
118
+      key: 'isNeedLodging',
119
+      valueType: 'select',
120
+      valueEnum: {
121
+        0: '不需要',
122
+        1: '需要'
123
+      },
124
+      search: false,
125
+    },
109 126
     {
110 127
       title: '提交时间',
111 128
       dataIndex: 'createDate',

+ 115
- 113
src/utils/request.js Parādīt failu

@@ -1,113 +1,115 @@
1
-import { request } from 'umi';
2
-import { downloadBlob } from './download';
3
-
4
-/**
5
- *
6
- * 自定义修改 umi-request 行为
7
- *
8
- * 默认错误处理行为是通过 message 组件报错
9
- * 也可以设置 option.showType 来修改默认行为
10
- *
11
- * export enum ErrorShowType {
12
- *   SILENT = 0, // 不提示错误
13
- *   WARN_MESSAGE = 1, // 警告信息提示
14
- *   ERROR_MESSAGE = 2, // 错误信息提示
15
- *   NOTIFICATION = 4, // 通知提示
16
- *   REDIRECT = 9, // 页面跳转,会跳转到 /exception 页面
17
- * }
18
- *
19
- */
20
-
21
-function requestInterceptor(url, options) {
22
-  const headers = options.headers || {};
23
-  const token = localStorage.getItem('token')
24
-    ? { Authorization: localStorage.getItem('token') }
25
-    : {};
26
-
27
-    console.log('------------->', API_BASE)
28
-
29
-  const prefix = `${API_BASE}/api/admin`;
30
-  let requestType='json'
31
-  if (options.data instanceof FormData) {
32
-    requestType='form'
33
-  }
34
-  return {
35
-    url: `${prefix}${url}`,
36
-    options: {
37
-      ...options,
38
-      requestType,
39
-      headers: {
40
-        ...headers,
41
-        ...token,
42
-      },
43
-    },
44
-  };
45
-}
46
-
47
-async function responseInterceptor(response, ctx) {
48
-  const contextType = response.headers.get('content-type');
49
-  if (contextType.indexOf('json') > -1) {
50
-    const result = await response.clone().json();
51
-    if (result?.token || result?.data?.token) {
52
-      localStorage.setItem('token', result?.token || result?.data?.token);
53
-    }
54
-  }
55
-
56
-  if (contextType.indexOf('application/vnd.ms-excel') > -1) {
57
-    const data = await response.clone().blob();
58
-    console.info(response)
59
-    const content = response.headers.get('content-disposition');
60
-    const fileName = content.replace('attachment;filename=', '');
61
-    downloadBlob(data, decodeURIComponent(fileName));
62
-  }
63
-
64
-  return response;
65
-}
66
-
67
-// https://umijs.org/plugins/plugin-request
68
-export const requestConfig = {
69
-  errorConfig: {
70
-    adaptor: (resData, ctx) => {
71
-      if (typeof resData === 'string') {
72
-        // 可能是 excel 导出
73
-        return {
74
-          success: true,
75
-        };
76
-      }
77
-
78
-      const showError = ctx.req.options?.showType;
79
-
80
-      return {
81
-        ...resData,
82
-        success: resData.code === 1000,
83
-        errorMessage: resData.message,
84
-        showType: isNaN(showError) ? 1 : showError, // 默认通过 message 组件报错
85
-      };
86
-    },
87
-  },
88
-  requestInterceptors: [requestInterceptor],
89
-  responseInterceptors: [responseInterceptor],
90
-};
91
-
92
-export default (...args) => request(...args).then((r) => r.data);
93
-
94
-export function queryTable(apiRequest) {
95
-  return function (params) {
96
-    return apiRequest({
97
-      ...params,
98
-      pageNum: params.current,
99
-    })
100
-      .then((res) => {
101
-        return {
102
-          data: res.records,
103
-          success: true,
104
-          total: res.total,
105
-        };
106
-      })
107
-      .catch((err) => {
108
-        return {
109
-          success: false,
110
-        };
111
-      });
112
-  };
113
-}
1
+import { request } from 'umi';
2
+import { downloadBlob } from './download';
3
+
4
+/**
5
+ *
6
+ * 自定义修改 umi-request 行为
7
+ *
8
+ * 默认错误处理行为是通过 message 组件报错
9
+ * 也可以设置 option.showType 来修改默认行为
10
+ *
11
+ * export enum ErrorShowType {
12
+ *   SILENT = 0, // 不提示错误
13
+ *   WARN_MESSAGE = 1, // 警告信息提示
14
+ *   ERROR_MESSAGE = 2, // 错误信息提示
15
+ *   NOTIFICATION = 4, // 通知提示
16
+ *   REDIRECT = 9, // 页面跳转,会跳转到 /exception 页面
17
+ * }
18
+ *
19
+ */
20
+
21
+function requestInterceptor (url, options) {
22
+  const headers = options.headers || {};
23
+  const token = localStorage.getItem('token')
24
+    ? { Authorization: localStorage.getItem('token') }
25
+    : {};
26
+
27
+  console.log('------------->', API_BASE)
28
+
29
+  const prefix = `${API_BASE}/api/admin`;
30
+  let requestType = 'json'
31
+  if (options.data instanceof FormData) {
32
+    requestType = 'form'
33
+  }
34
+  return {
35
+    url: `${prefix}${url}`,
36
+    options: {
37
+      ...options,
38
+      requestType,
39
+      headers: {
40
+        ...headers,
41
+        ...token,
42
+      },
43
+    },
44
+  };
45
+}
46
+
47
+async function responseInterceptor (response, ctx) {
48
+  const contextType = response.headers.get('content-type');
49
+  if (contextType.indexOf('json') > -1) {
50
+    const result = await response.clone().json();
51
+    if (result?.token || result?.data?.token) {
52
+      localStorage.setItem('token', result?.token || result?.data?.token);
53
+    }
54
+  }
55
+
56
+  if (contextType.indexOf('application/vnd.ms-excel') > -1) {
57
+    const data = await response.clone().blob();
58
+    console.info(response)
59
+    const content = response.headers.get('content-disposition');
60
+    const fileName = content.replace('attachment;filename=', '');
61
+    downloadBlob(data, decodeURIComponent(fileName));
62
+  }
63
+
64
+  return response;
65
+}
66
+
67
+// https://umijs.org/plugins/plugin-request
68
+export const requestConfig = {
69
+  errorConfig: {
70
+    adaptor: (resData, ctx) => {
71
+      if (typeof resData === 'string') {
72
+        // 可能是 excel 导出
73
+        return {
74
+          success: true,
75
+        };
76
+      }
77
+
78
+      const showError = ctx.req.options?.showType;
79
+
80
+      return {
81
+        ...resData,
82
+        success: resData.code === 1000,
83
+        errorMessage: resData.message,
84
+        showType: isNaN(showError) ? 1 : showError, // 默认通过 message 组件报错
85
+      };
86
+    },
87
+  },
88
+  requestInterceptors: [requestInterceptor],
89
+  responseInterceptors: [responseInterceptor],
90
+};
91
+
92
+export default (...args) => request(...args).then((r) => r.data);
93
+
94
+export function queryTable (apiRequest) {
95
+  return function (params) {
96
+    const { current, pageSize, ...leftParams } = params;
97
+    return apiRequest({
98
+      ...params,
99
+      pageNum: params.current,
100
+      ...(leftParams || {}),
101
+    })
102
+      .then((res) => {
103
+        return {
104
+          data: res.records,
105
+          success: true,
106
+          total: res.total,
107
+        };
108
+      })
109
+      .catch((err) => {
110
+        return {
111
+          success: false,
112
+        };
113
+      });
114
+  };
115
+}