李志伟 2 lat temu
rodzic
commit
567aa9e444

+ 6
- 7
config/routes.js Wyświetl plik

@@ -18,12 +18,6 @@ export default [
18 18
       },
19 19
     ],
20 20
   },
21
-  {
22
-    path: '/dashboard',
23
-    name: '工作台',
24
-    icon: 'DashboardOutlined',
25
-    component: './dashboard',
26
-  },  
27 21
   {
28 22
     path: '/',
29 23
     name: '工作台',//暂定
@@ -43,7 +37,12 @@ export default [
43 37
     component: '@/pages/invoiceFill/edit.jsx',
44 38
     hideInMenu:true
45 39
   },
46
-
40
+  {
41
+    path: '/invoiceDetail',
42
+    name: '报销明细列表',
43
+    icon: 'ProfileOutlined',
44
+    component: '@/pages/invoiceDetail',    
45
+  },
47 46
   {
48 47
     path: '/',
49 48
     redirect: '/welcome',

+ 62
- 0
src/components/BanjiSearch/index.jsx Wyświetl plik

@@ -0,0 +1,62 @@
1
+import { useEffect, useState } from 'react';
2
+import { Select } from 'antd'
3
+import { getInvoiceFillDetail,getInvoiceFillList } from '@/services/invoiceFill'
4
+
5
+const Option = Select.Option;
6
+export default (props) => {
7
+  const { value, onChange, ...otherProps } = props;
8
+
9
+  const showType = 0; // 不显示报错
10
+
11
+  const [list, setList] = useState([])
12
+
13
+  const searchData = (val) => { 
14
+    getInvoiceFillList({ pageSize: 999,name:val }, showType).then(res => {
15
+      setList(res.records || [])
16
+    })    
17
+  }
18
+
19
+  const handleSearch = (text) => {
20
+    if (text) {
21
+      searchData(text)
22
+    }else{
23
+      getInvoiceFillList({ pageSize: 999 }, showType).then(res => {
24
+        setList(res.records || [])
25
+      })
26
+    }
27
+  }
28
+
29
+  useEffect(() => {
30
+    if (value) {
31
+      getInvoiceFillDetail(value).then((res) => {
32
+        setList([res])
33
+      })
34
+    }else{
35
+      getInvoiceFillList({ pageSize: 999 }, showType).then(res => {
36
+        setList(res.records || [])
37
+      })
38
+    }
39
+  }, [value])
40
+
41
+  return (
42
+    <Select
43
+      showSearch
44
+      value={value}
45
+      defaultActiveFirstOption={false}
46
+      showArrow={false}
47
+      filterOption={false}
48
+      onSearch={handleSearch}
49
+      onChange={onChange}
50
+      notFoundContent={null}
51
+      {...otherProps}
52
+    >
53
+      {
54
+        list.map((item) => {
55
+          return (
56
+            <Option key={item.invoiceId} value={item.invoiceId}>{item.name}</Option>
57
+          )
58
+        })
59
+      }
60
+    </Select>
61
+  )
62
+}

+ 1
- 1
src/components/PageTable/index.jsx Wyświetl plik

@@ -15,7 +15,7 @@ export default (props) => {
15 15
   // 导出函数需要使用的 params
16 16
   const exportParams = useRef()
17 17
   const handleBeforSearch = (params) => {
18
-    params.invoiceId=invoiceId||''
18
+    params.invoiceId=invoiceId||params.invoiceId||''
19 19
     if (typeof beforeSearchSubmit === 'function') {
20 20
       exportParams.current = beforeSearchSubmit(params);
21 21
     } else {

+ 0
- 111
src/pages/dashboard/components/AdminDashboard/components/BannerStatis.jsx Wyświetl plik

@@ -1,111 +0,0 @@
1
-import { useEffect, useState } from 'react';
2
-import { history } from 'umi';
3
-import { Card, Row, Col } from 'antd'
4
-import { AppstoreOutlined, MacCommandOutlined, TeamOutlined, UsergroupDeleteOutlined, UsergroupAddOutlined } from '@ant-design/icons'
5
-import { getcomm } from '@/services/statis';
6
-import StatisCard from './StatisCard';
7
-import StatisGroup from './StatisGroup';
8
-
9
-const colorList = [
10
-  { backColor: '#126BAE', frontColor: '#fff' },
11
-  { backColor: '#66A9C9', frontColor: '#fff' },
12
-  { backColor: '#08507b', frontColor: '#fff' },
13
-]
14
-
15
-export default (props) => {
16
-  const [cardData, setCardData] = useState({})
17
-  
18
-  const toAbnormal = () => {
19
-    history.push('../resume-work/abnormal');
20
-  }
21
-
22
-  useEffect(() => {
23
-    getcomm().then((res) => {
24
-      setCardData(res || {});
25
-    })
26
-  }, [])
27
-
28
-  const abnormalNum = (cardData.todayReportNum || 0) - (cardData.todayNormalNum || 0)
29
-
30
-  return (
31
-    <Row justify='space-around' gutter={24} >
32
-      <Col span={8}>
33
-        <StatisGroup
34
-          title="企业"
35
-          data1={{ title: '企业总数', value: cardData.orgTotalNum || 0 }}
36
-          data2={{ title: '无数据企业', value: cardData.noDataOrgNum || 0 }}
37
-          {...colorList[0]}
38
-          icon={<AppstoreOutlined />}
39
-        />
40
-      </Col>
41
-      <Col span={8}>
42
-        <StatisGroup
43
-          title="上报人次"
44
-          data1={{ title: '今日提交', value: cardData.todayReportNum || 0 }}
45
-          data2={{ title: '昨日提交', value: cardData.yestodayReportNum || 0 }}
46
-          {...colorList[1]}
47
-          icon={<TeamOutlined />}
48
-        />
49
-      </Col>
50
-      <Col span={8}>
51
-        <StatisGroup
52
-          title="今日概况"
53
-          data1={{ title: '正常人次', value: cardData.todayNormalNum || 0 }}
54
-          data2={{ title: '异常人次', value: abnormalNum }}
55
-          {...colorList[2]}
56
-          icon={<UsergroupDeleteOutlined />}
57
-          onClick2={toAbnormal}
58
-        />
59
-      </Col>
60
-      {/* <Col span={4}>
61
-        <StatisCard
62
-          title="企业总数"
63
-          value={cardData?.orgTotalNum || 0}
64
-          icon={<AppstoreOutlined />}
65
-          {...colorList[0]}
66
-        />
67
-      </Col>
68
-      <Col span={4}>
69
-        <StatisCard
70
-          title="无数据企业"
71
-          value={`${cardData?.noDataOrgNum || 0} / ${cardData?.orgTotalNum || 0}`}
72
-          icon={<MacCommandOutlined />}
73
-          {...colorList[1]}
74
-        />
75
-      </Col>
76
-      <Col span={4}>
77
-        <StatisCard
78
-          title="今日提交总人数"
79
-          value={cardData?.todayReportNum || 0}
80
-          icon={<TeamOutlined />}
81
-          {...colorList[2]}
82
-        />
83
-      </Col>
84
-      <Col span={4}>
85
-        <StatisCard
86
-          title="昨日提交总人数"
87
-          value={cardData?.yestodayReportNum || 0}
88
-          icon={<TeamOutlined />}
89
-          {...colorList[3]}
90
-        />
91
-      </Col>
92
-      <Col span={4}>
93
-        <StatisCard
94
-          title="今日正常人数"
95
-          value={cardData?.todayNormalNum || 0}
96
-          icon={<UsergroupDeleteOutlined />}
97
-          {...colorList[4]}
98
-        />
99
-      </Col>
100
-      <Col span={4}>
101
-        <StatisCard
102
-          title="今日异常人数"
103
-          value={(cardData?.todayReportNum || 0) - (cardData?.todayNormalNum || 0)}
104
-          icon={<UsergroupAddOutlined />}
105
-          {...colorList[5]}
106
-          onClick={toAbnormal}
107
-        />
108
-      </Col> */}
109
-    </Row>
110
-  )
111
-}

+ 0
- 103
src/pages/dashboard/components/AdminDashboard/components/OrgSummary.jsx Wyświetl plik

@@ -1,103 +0,0 @@
1
-import { useEffect, useState, useCallback } from 'react';
2
-import Echart from '@/components/echart/echart'
3
-import { Card } from 'antd'
4
-import { getAllOrgPersonNum } from '@/services/statis'
5
-
6
-const barOption = {
7
-  color: ['#08507b'],
8
-  tooltip: {
9
-    trigger: 'axis',
10
-    axisPointer: {
11
-      type: 'shadow'
12
-    },
13
-    formatter: (params) => `人次: ${params[0].data.totalReportNum || 0}`
14
-  },
15
-  grid: {
16
-    containLabel: true,
17
-    left: 0,
18
-    top: 0,
19
-    right: 60,
20
-    bottom: 0,
21
-  }, 
22
-  yAxis: {
23
-    type: 'category',
24
-    axisLabel: {
25
-      // rotate: 45,
26
-      formatter: (value) => value.length > 10 ? value.substring(0, 10) + '...' : value,
27
-      color: (value, index) => 'black'
28
-    },
29
-  },
30
-  xAxis: {
31
-    type: 'value',
32
-  },
33
-  dataZoom: [
34
-    {
35
-      type: 'slider',
36
-      yAxisIndex: [0],
37
-      start: 100,
38
-      end: 80,
39
-      // width: 10,
40
-      // fillerColor: '#08507b',
41
-      selectedDataBackground: {
42
-        areaStyle: { color: '#08507b', },
43
-        lineStyle: { color: '#08507b', width: 1 },
44
-      }
45
-    },
46
-    {
47
-      type: 'inside',
48
-      yAxisIndex: [0],
49
-      start: 100,
50
-      end: 80
51
-    }
52
-  ],
53
-  dataset: {
54
-    dimensions: ['orgName', 'totalReportNum'],
55
-    source: [],
56
-  },
57
-  series: [
58
-    {
59
-      type: 'bar',
60
-    },
61
-  ]
62
-}
63
-
64
-export default (props) => {
65
-  const [loading, setLoading] = useState(false)
66
-  const [list, setList] = useState([])
67
-
68
-  const option = {
69
-    ...barOption,
70
-    dataset: {
71
-      ...barOption.dataset,
72
-      source: list
73
-    },
74
-    yAxis: {
75
-      ...barOption.yAxis,
76
-      axisLabel: {
77
-        ...barOption.yAxis.axisLabel,
78
-        color: value => list.filter(x => x.orgName === value)[0].totalReportNum ? 'black' : 'red'
79
-      }
80
-    }
81
-  }
82
-  
83
-  const queryList = useCallback(() => {
84
-    setLoading(true)
85
-
86
-    getAllOrgPersonNum().then((res) => {
87
-      setLoading(false)
88
-      setList((res || []).reverse())
89
-    }).catch(err => {
90
-      setLoading(false)
91
-    })
92
-  }, [])
93
-  
94
-  useEffect(() => {
95
-    queryList()
96
-  }, [])
97
-
98
-  return (
99
-    <Card title='企业数据总览' loading={loading} bodyStyle={{height: 600}}>
100
-      <Echart option={option} />
101
-    </Card>
102
-  )
103
-}

+ 0
- 120
src/pages/dashboard/components/AdminDashboard/components/ReportList.jsx Wyświetl plik

@@ -1,120 +0,0 @@
1
-import moment from 'moment'
2
-import { Card, List, Badge, Space, Carousel } from 'antd'
3
-import { useCallback, useEffect, useMemo, useState } from 'react'
4
-import { getList } from '@/services/work'
5
-import { random } from '@/utils/number'
6
-
7
-const colorList = [
8
-  '#a8071a',
9
-  '#ad2102',
10
-  '#ad4e00',
11
-  '#ad6800',
12
-  '#ad8b00',
13
-  '#5b8c00',
14
-  '#237804',
15
-  '#006d75',
16
-  '#0050b3',
17
-  '#10239e',
18
-  '#391085',
19
-  '#9e1068',
20
-]
21
-
22
-const Avatar = (props) => {
23
-  const style = useMemo(() => {
24
-    let r = random(0, colorList.length)
25
-    if (r >= 12) r = 0;
26
-    const color = colorList[r];
27
-
28
-    return {
29
-      background: color,
30
-      color: '#fff',
31
-      width: '48px',
32
-      height: '48px',
33
-      fontSize: '1.8em',
34
-      lineHeight: '48px',
35
-      textAlign: 'center',
36
-    }
37
-  }, [])
38
-
39
-  return <div style={style}>{props.children}</div>
40
-}
41
-
42
-
43
-const Content = (props) => {
44
-  const { item } = props;
45
-
46
-  const abnormal = item.antigenIsNormal === 0 || item.nucleicIsNormal === 0
47
-  const status = abnormal ? 'error' : 'success'
48
-
49
-  return (
50
-    <Space size="large">
51
-      <span><Badge status={status} /> { abnormal ? '异常' : '正常' }</span>
52
-      <span>{moment(item.createDate).format('HH:mm')}</span>
53
-    </Space>
54
-  )
55
-}
56
-
57
-const showNum = 8;
58
-
59
-export default (props) => {
60
-  const [loading, setLoading] = useState(false)
61
-  const [list, setList] = useState([])
62
-  const [disabled, setDisabled] = useState(false)
63
-
64
-  const queryList = useCallback(() => {
65
-    setLoading(true)
66
-    getList(
67
-      {
68
-        pageSize: 50, // 过多会很卡
69
-        start: moment().format('YYYY-MM-DD'),
70
-        end: moment().format('YYYY-MM-DD'),
71
-        isAll: true
72
-      }).then(res => {
73
-        setLoading(false)
74
-        setList((res.records || []).reverse())
75
-      }).catch(er => {
76
-        setLoading(false)
77
-      })
78
-  }, [])
79
-
80
-  useEffect(() => {
81
-    queryList()
82
-  }, [])
83
-
84
-  useEffect(() => {
85
-    setDisabled(!list || list.length <= showNum)
86
-  }, [list])
87
-
88
-  return (
89
-    <Card title="今日提交记录" loading={loading} bodyStyle={{ height: '600px' }}>
90
-      <List style={{ height: '100%', overflow: 'hidden' }} itemLayout="horizontal">
91
-        <Carousel
92
-          autoplay={!disabled}
93
-          infinite={!disabled}
94
-          rtl
95
-          slidesToShow={showNum}
96
-          slidesToScroll={1}
97
-          dot={false}
98
-          dotPosition="right"
99
-          style={{ height: '100%' }}
100
-        >
101
-          {
102
-            list.map(item => (
103
-              <div key={item.formId} style={{ display: 'flex' }}>
104
-                <List.Item>
105
-                  <List.Item.Meta
106
-                    avatar={<Avatar>{item.orgName.substring(0,1)}</Avatar>}
107
-                    title={item.userName}
108
-                    con
109
-                    description={item.orgName}
110
-                  />
111
-                  <Content item={item} />
112
-                </List.Item>
113
-              </div>
114
-            ))
115
-          }
116
-        </Carousel>
117
-      </List>
118
-    </Card>
119
-  )
120
-}

+ 0
- 41
src/pages/dashboard/components/AdminDashboard/components/StatisCard.jsx Wyświetl plik

@@ -1,41 +0,0 @@
1
-import React from 'react'
2
-import { Statistic, Card } from 'antd';
3
-
4
-const iconDivStyle = {
5
-  position: 'absolute',
6
-  top: 20,
7
-  right: 20,
8
-}
9
-
10
-const iconStyle = {
11
-  fontSize: '5em',
12
-  color: '#fff',
13
-  opacity: 0.3,
14
-}
15
-
16
-export default (props) => {
17
-  const { title, value, icon, backColor = '#fff', frontColor='#000', onClick } = props
18
-
19
-  const bodyStyle = {
20
-    background: backColor,
21
-    overflow: 'hidden',
22
-    position: 'relative',
23
-  }
24
-
25
-  return (
26
-    <Card bodyStyle={bodyStyle} onClick={onClick}>
27
-      <Statistic
28
-        title={title}
29
-        value={value}
30
-        valueStyle={{ color: frontColor }}
31
-      />
32
-      {
33
-        icon && (
34
-          <div style={iconDivStyle}>
35
-            {React.cloneElement(icon, { style: iconStyle })}
36
-          </div>
37
-        )
38
-      }
39
-    </Card>
40
-  )
41
-}

+ 0
- 74
src/pages/dashboard/components/AdminDashboard/components/StatisGroup.jsx Wyświetl plik

@@ -1,74 +0,0 @@
1
-import React, { useState } from 'react';
2
-import { StatisticCard } from '@ant-design/pro-card';
3
-
4
-const { Divider } = StatisticCard;
5
-const iconDivStyle = {
6
-  position: 'absolute',
7
-  top: '4px',
8
-  right: '-30px',
9
-}
10
-
11
-const iconStyle = {
12
-  fontSize: '10em',
13
-  color: '#fff',
14
-  opacity: 0.45,
15
-}
16
-
17
-export default (props) => {
18
-  const { title, data1, data2, icon, onClick1, onClick2, backColor = '#fff', frontColor='#000' } = props
19
-
20
-  const headStyle = {
21
-    background: backColor,
22
-    color: frontColor,
23
-  }
24
-
25
-  const bodyStyle = {
26
-    background: backColor,
27
-    color: frontColor,
28
-    position: 'relative',
29
-    overflow: 'hidden',
30
-  }
31
-
32
-  const groupBodyStyle = {
33
-    ...bodyStyle,
34
-    padding: 0,
35
-  }
36
-
37
-  const valueStyle = {
38
-    color: frontColor
39
-  }
40
-
41
-  const headTitleStyle = {
42
-    color: frontColor,
43
-    fontSize: '19px',
44
-    fontWeight: 700,
45
-    letterSpacing: '2px',
46
-  }
47
-
48
-  const titleStyle = {
49
-    color: frontColor,
50
-  }
51
-
52
-  return (
53
-    <StatisticCard.Group title={<div style={headTitleStyle}>{title}</div>} headStyle={headStyle} bodyStyle={groupBodyStyle}>
54
-      <StatisticCard
55
-        bodyStyle={bodyStyle}
56
-        statistic={{ ...data1, title: (<div style={titleStyle}>{data1.title}</div>), valueStyle }}
57
-        onClick={onClick1}
58
-      />
59
-      <Divider type="vertical" />
60
-      <StatisticCard
61
-        bodyStyle={bodyStyle}
62
-        statistic={{ ...data2, title: (<div style={titleStyle}>{data2.title}</div>), valueStyle }}
63
-        onClick={onClick2}
64
-      />
65
-      {
66
-        icon && (
67
-          <div style={iconDivStyle}>
68
-            {React.cloneElement(icon, { style: iconStyle })}
69
-          </div>
70
-        )
71
-      }
72
-    </StatisticCard.Group>
73
-  )
74
-}

+ 0
- 20
src/pages/dashboard/components/AdminDashboard/index.jsx Wyświetl plik

@@ -1,20 +0,0 @@
1
-import React from 'react';
2
-import { Space, Row, Col } from 'antd'
3
-import ReportList from './components/ReportList';
4
-import OrgSummary from './components/OrgSummary';
5
-import BannerStatis from './components/BannerStatis';
6
-
7
-export default (props) => {  
8
-  return (
9
-    <Space direction="vertical" size="large" style={{ width: '100%' }}>
10
-      <BannerStatis />
11
-
12
-      <Row gutter={24}>
13
-        <Col span={12}><OrgSummary /></Col>
14
-        <Col span={12}>
15
-          <ReportList />
16
-        </Col>
17
-      </Row>
18
-    </Space>
19
-  )
20
-}

+ 0
- 6
src/pages/dashboard/index.jsx Wyświetl plik

@@ -1,6 +0,0 @@
1
-import AdminDashboard from "./components/adminDashboard";
2
-export default (props) => {
3
-  return (
4
-    <AdminDashboard />
5
-  )
6
-}

+ 163
- 0
src/pages/invoiceDetail/index.jsx Wyświetl plik

@@ -0,0 +1,163 @@
1
+
2
+import moment from 'moment';
3
+import React, { useRef, useEffect, useState } from 'react'
4
+
5
+import { Button, Modal, Popconfirm, message } from 'antd';
6
+import { PlusOutlined } from '@ant-design/icons';
7
+import { PageHeaderWrapper } from '@ant-design/pro-layout';
8
+import { getInvoiceDetailList } from '@/services/invoiceDetail'
9
+import { getExport } from '@/services/invoiceFill'
10
+
11
+import PageTable from '@/components/PageTable'
12
+import { history } from 'umi';
13
+import BanjiSearch from '@/components/BanjiSearch';
14
+
15
+const formatterTime = (val) => {
16
+  return val ? moment(val).format('YYYY-MM-DD HH:mm') : '';
17
+};
18
+
19
+export default (props) => {
20
+  const actionRef = useRef();
21
+
22
+  const handleClick = () => {
23
+    history.push('/invoiceFill/edit.jsx');
24
+  }
25
+  const handleDelete = (id) => {
26
+    deleteInvoiceFill(id).then((res) => {
27
+      message.success('删除成功')
28
+      actionRef.current.reload();
29
+    }).catch((err) => {
30
+      console.log(err.message)
31
+    });
32
+  }
33
+
34
+  const handleBeforSearch = (params) => {
35
+    const { ...others } = params;    
36
+    return { ...others };
37
+  }
38
+
39
+  const columns = [
40
+    {
41
+      title: '班级名称',
42
+      dataIndex: 'invoiceId',
43
+      key: 'invoiceId',
44
+      search: true,
45
+      hideInTable: true,
46
+      renderFormItem: () => (
47
+        <BanjiSearch placeholder='请输入班级名称' />
48
+      ),
49
+      formItemProps: {
50
+        rules: [          
51
+          {
52
+            required: true,
53
+            message: '请输入班级名称',
54
+          }
55
+        ],
56
+      }
57
+    },
58
+    {
59
+      title: '姓名',
60
+      dataIndex: 'personName',
61
+      key: 'personName',
62
+      search: true,
63
+    },
64
+    {
65
+      title: '开票单位',
66
+      dataIndex: 'orgName',
67
+      key: 'orgName',
68
+      search: true,
69
+    },
70
+    {
71
+      title: '纳税识别号',
72
+      dataIndex: 'taxNo',
73
+      key: 'taxNo',
74
+      search: false,
75
+    },
76
+    {
77
+      title: '地址',
78
+      dataIndex: 'address',
79
+      key: 'address',
80
+      search: false,
81
+    },
82
+    {
83
+      title: '电话',
84
+      dataIndex: 'phone',
85
+      key: 'phone',
86
+      search: false,
87
+    },
88
+    {
89
+      title: '开户银行',
90
+      dataIndex: 'bankName',
91
+      key: 'bankName',
92
+      search: false,
93
+    },
94
+    {
95
+      title: '开户行账号',
96
+      dataIndex: 'cardNo',
97
+      key: 'cardNo',
98
+      search: false,
99
+    },
100
+    {
101
+      title: '报销项目',
102
+      dataIndex: 'itemName',
103
+      key: 'itemName',
104
+      search: false,
105
+    },
106
+    {
107
+      title: '开票金额',
108
+      dataIndex: 'charge',
109
+      key: 'charge',
110
+      search: false,
111
+    },
112
+    {
113
+      title: '是否合开',
114
+      dataIndex: 'mergeRemark',
115
+      key: 'mergeRemark',
116
+      search: false,
117
+    },
118
+    {
119
+      title: '操作',
120
+      valueType: 'option',
121
+      key: 'option',
122
+      ellipsis: true,
123
+      render: (_, record) => [
124
+        <Button type="link" key={1} onClick={() => history.push(`/invoiceFill/edit.jsx?id=${record.detailId}`)} style={{ padding: 0 }}>
125
+          编辑
126
+        </Button>,
127
+        <Popconfirm
128
+          key={2}
129
+          title="您是否确认删除 ?"
130
+          onConfirm={() => handleDelete(record.detailId)}
131
+          okText="确定"
132
+          cancelText="取消"
133
+        >
134
+          <Button style={{ padding: 0 }} type="link">
135
+            删除
136
+          </Button>
137
+        </Popconfirm>
138
+      ],
139
+    },
140
+  ]
141
+
142
+
143
+  return (
144
+    <PageHeaderWrapper>
145
+      <PageTable
146
+        columns={columns}
147
+        request={getInvoiceDetailList}
148
+        expfunc={getExport}
149
+        options={false}        
150
+        actionRef={actionRef}
151
+        search={{
152
+          defaultCollapsed:false
153
+        }}
154
+        form={{ ignoreRules: false }}
155
+        manualRequest={true}
156
+        revalidateOnFocus={false}
157
+        beforeSearchSubmit={handleBeforSearch}
158
+        rowKey="detailId"
159
+        scroll={{x:2000}}
160
+      />
161
+    </PageHeaderWrapper>
162
+  )
163
+}

+ 22
- 1
src/pages/invoiceFill/components/BasicInfo.jsx Wyświetl plik

@@ -1,4 +1,4 @@
1
-import React, { useState, useRef, useEffect } from 'react';
1
+import React, { useState, useRef, useEffect, useMemo } from 'react';
2 2
 import { Form, Input, Popconfirm, Select, Button, Modal, InputNumber, message, Col, Row, DatePicker } from 'antd';
3 3
 import { PlusOutlined } from '@ant-design/icons';
4 4
 import moment from 'moment';
@@ -7,6 +7,8 @@ import { saveInvoiceItemTpl, getInvoiceItemTplList, deleteInvoiceItemTpl } from
7 7
 import { history } from 'umi';
8 8
 import PageTable from '@/components/PageTable';
9 9
 import locale from 'antd/es/date-picker/locale/zh_CN';
10
+import QRCode from './QRCode'
11
+
10 12
 
11 13
 const FormItem = Form.Item;
12 14
 const { Option } = Select;
@@ -20,10 +22,22 @@ export default (props) => {
20 22
   const dateFormat = "YYYY-MM-DD HH:mm:ss";
21 23
   const [loading, setLoading] = useState(false);
22 24
   const [formModel] = Form.useForm();
25
+  const [formData, setFormData] = useState()
23 26
   const [editModal, setEditModal] = useState(false);
24 27
   const [modelLoading, setModelLoading] = useState(false);
25 28
   const actionRef = useRef();
26 29
 
30
+
31
+  const qrcodeText = useMemo(() => 
32
+  // initialState.report_url + '#resume-work-form?org=' + 
33
+  'https://www.baidu.com/#resume-work-form?org='+
34
+  invoiceId, 
35
+  [invoiceId
36
+    // , initialState.report_url
37
+  ]
38
+  )
39
+
40
+
27 41
   //保存班级
28 42
   const onSubmit = (data) => {
29 43
     var newData = { ...data, endDate: moment(data.endDate) };
@@ -94,6 +108,7 @@ export default (props) => {
94 108
     if (invoiceId) {
95 109
       getInvoiceFillDetail(invoiceId).then((res) => {
96 110
         form.setFieldsValue({ ...res, endDate: moment(res.endDate) })
111
+        setFormData({ ...res, endDate: moment(res.endDate) })
97 112
       }).catch((err) => {
98 113
         message.error(err.message || err);
99 114
       });
@@ -146,6 +161,12 @@ export default (props) => {
146 161
                 <Option value={2}>已截止</Option>
147 162
               </Select>
148 163
             </FormItem>
164
+            {
165
+              invoiceId &&
166
+              <FormItem label='申报二维码' >
167
+                <QRCode text={qrcodeText} title={formData?.name} />
168
+              </FormItem>
169
+            }
149 170
             <FormItem label=" " colon={false}>
150 171
               <Button type="default" onClick={goBack}>
151 172
                 返回

+ 3
- 5
src/pages/invoiceFill/components/InvoiceDetail.jsx Wyświetl plik

@@ -1,7 +1,6 @@
1 1
 import React, { useState, useRef, useImperativeHandle, forwardRef } from 'react';
2 2
 import { Form, Input, Button, Modal, message, Popconfirm, Radio } from 'antd';
3
-import { getInvoiceDetailList, updateInvoiceDetail, deleteInvoiceDetail } from '@/services/invoiceDetail'
4
-import { getExport } from '@/services/invoiceFill'
3
+import { getInvoiceTplList, updateInvoiceDetail, deleteInvoiceTpl } from '@/services/invoiceDetail'
5 4
 import PageTable from '@/components/PageTable';
6 5
 
7 6
 const FormItem = Form.Item;
@@ -46,7 +45,7 @@ export default forwardRef((props, ref) => {
46 45
     refrash
47 46
   }))
48 47
   const handleDelete = (val) => {
49
-    deleteInvoiceDetail(val.invoiceId,val.invoiceItemId).then(res => {
48
+    deleteInvoiceTpl(val.invoiceId,val.invoiceItemId).then(res => {
50 49
       message.success('删除成功')
51 50
       refrash()
52 51
     }).catch((err) => {
@@ -99,11 +98,10 @@ export default forwardRef((props, ref) => {
99 98
   return (
100 99
     <>
101 100
       <PageTable
102
-        request={getInvoiceDetailList}
101
+        request={getInvoiceTplList}
103 102
         actionRef={actionRef}
104 103
         columns={columns}
105 104
         rowKey={(record, index) => (record, index)}
106
-        expfunc={getExport}
107 105
         invoiceId={invoiceId}
108 106
         options={false}
109 107
         search={false}

+ 43
- 0
src/pages/invoiceFill/components/QRCode.jsx Wyświetl plik

@@ -0,0 +1,43 @@
1
+import React, { useRef } from 'react'
2
+import { Popover, Button } from 'antd';
3
+import { QrcodeOutlined } from '@ant-design/icons';
4
+import QRCode from '@/components/QRCode'
5
+
6
+const style = {
7
+  display: 'flex',
8
+  alignItem: 'center',
9
+  justifyContent: 'center',
10
+  flexDirection: 'column',
11
+}
12
+
13
+export default (props) => {
14
+  const { text, title } = props
15
+
16
+  const qrcodeRef = useRef()
17
+  const download = () => {
18
+    if (qrcodeRef.current) {
19
+      qrcodeRef.current.getCanvas().then((canvas) => {
20
+        const imageData = canvas.toDataURL('image/png', .8);
21
+        const link = document.createElement('a');
22
+        link.download = `${title}.png`
23
+        link.href = imageData
24
+        link.click()
25
+      });
26
+    }
27
+  }
28
+
29
+  const content = (
30
+    <div style={style}>
31
+      <QRCode ref={qrcodeRef} border content={text} title={title} />
32
+      <div style={{ textAlign: 'center' }}>
33
+        <Button  onClick={download} type='primary'>下载</Button>
34
+      </div>
35
+    </div>
36
+  )
37
+
38
+  return (
39
+    <Popover content={content} placement="right">
40
+      <QrcodeOutlined style={{ fontSize: '32px' }} />
41
+    </Popover>
42
+  )
43
+}

+ 8
- 2
src/pages/invoiceFill/components/ReimbursementPerson.jsx Wyświetl plik

@@ -7,6 +7,7 @@ import { UploadExcel } from '@/components/Upload';
7 7
 
8 8
 const FormItem = Form.Item;
9 9
 const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 14 } };
10
+const modelUrl='https://h5.njyunzhi.com/assets/%E6%8A%A5%E9%94%80%E4%BA%BA%E5%91%98%E6%A8%A1%E6%9D%BF.xlsx'
10 11
 
11 12
 export default (props) => {
12 13
   const { invoiceId } = props
@@ -14,7 +15,6 @@ export default (props) => {
14 15
   const [editModal, setEditModal] = useState(false);
15 16
   const [modelLoading, setModelLoading] = useState(false);
16 17
   const actionRef = useRef();
17
-
18 18
   //弹窗保存
19 19
   const Submit = (val) => {
20 20
     setModelLoading(true);
@@ -50,8 +50,13 @@ export default (props) => {
50 50
       message.error(err.message || err);
51 51
     });
52 52
   }
53
+  const downloadExcel=()=>{
54
+    const link=document.createElement('a')
55
+    link.href=modelUrl
56
+    link.click()
57
+  }
53 58
   const actions = () => [
54
-    <Button key="dowload" icon={<DownloadOutlined />} >
59
+    <Button key="dowload" icon={<DownloadOutlined />} onClick={downloadExcel} >
55 60
       下载模板
56 61
     </Button>,
57 62
     <UploadExcel key='upload' id={invoiceId} refrash={refrash}/>,
@@ -98,6 +103,7 @@ export default (props) => {
98 103
         rowKey="invoicePersonId"
99 104
         options={false}
100 105
         search={false}
106
+        pagination={{pageSize:500}}
101 107
         params={{ invoiceId }}
102 108
       />
103 109
       <Modal

+ 10
- 6
src/services/invoiceDetail.js Wyświetl plik

@@ -1,21 +1,25 @@
1 1
 import request from '@/utils/request';
2 2
 
3
-// 获取列表
4
-export const getInvoiceDetailList = (params) =>
3
+// 获取模板列表
4
+export const getInvoiceTplList = (params) =>
5 5
   request(`/invoice/${params.invoiceId}/detail-tpl`, { params });
6 6
 
7
-// 生成明细
7
+// 生成模板
8 8
 export const saveInvoiceDetail = (invoiceId) =>
9 9
   request(`/invoice/${invoiceId}/detail-tpl`, { method: 'post' });
10 10
 
11
-// 更新信息
11
+// 更新模板报销费用信息
12 12
 export const updateInvoiceDetail = (invoiceId, data) =>
13 13
   request(`/invoice/${invoiceId}/detail-tpl/item`, { data, method: 'post' });
14 14
 
15 15
 /**
16
- * 删除报销明细
16
+ * 删除报销模板
17 17
  * @param {*} data
18 18
  * @returns
19 19
  */
20
-export const deleteInvoiceDetail = (invoiceId, itemId ) =>
20
+export const deleteInvoiceTpl = (invoiceId, itemId ) =>
21 21
   request(`/invoice/${invoiceId}/detail-tpl/item/${itemId}`, { method: 'delete' });
22
+
23
+// 获取模板列表
24
+export const getInvoiceDetailList = (params) =>
25
+request(`/invoice/${params.invoiceId}/detail`, { params });