Browse Source

Merge branch 'master' of lizhiqi/yongxu-web into master

lizhiqi 11 months ago
parent
commit
28fe3a7f75

+ 8 - 12
src/pages/ReportHomeManagement/edit.tsx

@@ -190,24 +190,20 @@ const Edit: React.FC<userEditPros> = (props) => {
                 placeholder="请选择空调类型"
                 options={[
                   {
-                    value: '6s水机',
-                    label: '6s水机',
+                    value: '五恒一体机',
+                    label: '五恒一体机',
                   },
                   {
-                    value: '8s水机',
-                    label: '8s水机',
+                    value: '家用分风系统',
+                    label: '家用分风系统',
                   },
                   {
-                    value: '7.2kw氟机',
-                    label: '7.2kw氟机',
+                    value: '商用分风系统',
+                    label: '商用分风系统',
                   },
                   {
-                    value: '12kw氟机',
-                    label: '12kw氟机',
-                  },
-                  {
-                    value: '12kw水机',
-                    label: '12kw水机',
+                    value: '分体式五恒',
+                    label: '分体式五恒',
                   },
                 ]}
               />

+ 36 - 1
src/pages/ReportHomeManagement/index.tsx

@@ -1,10 +1,16 @@
 import React, { useEffect, useState } from 'react';
 import { Button, Card, Form, Input, message, Modal, Space, Table } from 'antd';
-import { PlusCircleOutlined, ReloadOutlined, SearchOutlined } from '@ant-design/icons';
+import {
+  PlusCircleOutlined,
+  CloudDownloadOutlined,
+  ReloadOutlined,
+  SearchOutlined,
+} from '@ant-design/icons';
 import { PageContainer } from '@ant-design/pro-components';
 import type { ColumnsType } from 'antd/es/table';
 import Edit from './edit';
 import {
+  queryExport,
   queryReportHome,
   queryReportHomeDetail,
   reportHomeAbandon,
@@ -108,6 +114,25 @@ const CommunityManagement: React.FC = () => {
     setCheckVisible(false);
   };
 
+  // 导出
+  const onDownLoad = () => {
+    form.validateFields().then((data) => {
+      queryExport(data)
+        .then((res: any) => {
+          const link = document.createElement('a');
+          link.style.display = 'none';
+          link.href = window.URL.createObjectURL(new Blob([res]));
+          link.setAttribute('download', '零售报备列表.xlsx');
+          document.body.appendChild(link);
+          link.click();
+          document.body.removeChild(link);
+        })
+        .catch(() => {
+          message.error('导出失败');
+        });
+    });
+  };
+
   // 成交
   const toDeal = (record: any) => {
     Modal.confirm({
@@ -178,6 +203,12 @@ const CommunityManagement: React.FC = () => {
       title: '门牌号',
       dataIndex: 'doorplate',
       key: 'doorplate',
+      render: (_, res: any) =>
+        res && (
+          <span>
+            {res?.building}-{res?.unit}-{res?.doorplate}
+          </span>
+        ),
     },
     {
       title: '详细地址',
@@ -280,6 +311,10 @@ const CommunityManagement: React.FC = () => {
             <PlusCircleOutlined />
             新增报备
           </Button>
+          <Button htmlType="button" style={{ margin: '20px 10px' }} onClick={onDownLoad}>
+            <CloudDownloadOutlined />
+            导出
+          </Button>
           <Table
             columns={columns}
             dataSource={dataList}

+ 8 - 12
src/pages/ReportingManagement/edit.tsx

@@ -365,24 +365,20 @@ const Edit: React.FC<userEditPros> = (props) => {
                 placeholder="请选择空调类型"
                 options={[
                   {
-                    value: '6s水机',
-                    label: '6s水机',
+                    value: '五恒一体机',
+                    label: '五恒一体机',
                   },
                   {
-                    value: '8s水机',
-                    label: '8s水机',
+                    value: '家用分风系统',
+                    label: '家用分风系统',
                   },
                   {
-                    value: '7.2kw氟机',
-                    label: '7.2kw氟机',
+                    value: '商用分风系统',
+                    label: '商用分风系统',
                   },
                   {
-                    value: '12kw氟机',
-                    label: '12kw氟机',
-                  },
-                  {
-                    value: '12kw水机',
-                    label: '12kw水机',
+                    value: '分体式五恒',
+                    label: '分体式五恒',
                   },
                 ]}
               />

+ 12 - 0
src/services/reportHome.ts

@@ -58,3 +58,15 @@ export async function editReportHome(params: any) {
 export async function queryReportHomeDetail(id: string) {
   return request(`/web/v1/report_homes/${id}`);
 }
+
+/**
+ * 导出
+ * @param params
+ */
+export async function queryExport(params: any) {
+  console.log('params', params);
+  return request(`/web/v1/reports/export?${stringify(params)}`, {
+    method: 'GET',
+    responseType: 'blob',
+  });
+}