소스 검색

新需求

傅行帆 5 년 전
부모
커밋
1d1ae50b43
5개의 변경된 파일272개의 추가작업 그리고 46개의 파일을 삭제
  1. 12
    0
      config/routes.js
  2. 97
    0
      src/pages/eContract/company/add.jsx
  3. 106
    0
      src/pages/eContract/company/edit.jsx
  4. 32
    39
      src/pages/eContract/company/index.jsx
  5. 25
    7
      src/services/apis.js

+ 12
- 0
config/routes.js 파일 보기

@@ -126,6 +126,18 @@ export default [
126 126
                 name: '企业认证管理',
127 127
                 component: './eContract/company/index',
128 128
               },
129
+              {
130
+                path: '/eContract/company/add',
131
+                name: '新增企业认证',
132
+                hideInMenu: true,
133
+                component: './eContract/company/add',
134
+              },
135
+              {
136
+                path: '/eContract/company/edit',
137
+                name: '编辑企业认证',
138
+                hideInMenu: true,
139
+                component: './eContract/company/edit',
140
+              },
129 141
               {
130 142
                 path: '/eContract/relatedOrganization',
131 143
                 name: '关联组织',

+ 97
- 0
src/pages/eContract/company/add.jsx 파일 보기

@@ -0,0 +1,97 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select, Form, Alert } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import XForm, { FieldTypes } from '../../../components/XForm';
5
+import router from 'umi/router';
6
+import apis from '../../../services/apis';
7
+import request from '../../../utils/request';
8
+import Wangedit from '../../../components/Wangedit/Wangedit'
9
+import moment from 'moment';
10
+
11
+
12
+const header = props => {
13
+    const companyId = props.location.query.id
14
+  
15
+    const [ data, setData ] = useState({})
16
+    if(companyId){
17
+      useEffect(() => {
18
+        getCompanyData(companyId);
19
+      },[])
20
+    
21
+      // 查询列表
22
+      const getCompanyData = (companyId) => {
23
+        request({
24
+            ...apis.company.get,
25
+            urlData: { id: companyId }
26
+        }).then((data) => {
27
+          setData(data)
28
+        }).catch((err) => {
29
+          message.error(err.msg || err.message)
30
+        })
31
+      }
32
+    }else{
33
+      //第一次进入就创建新的企业
34
+      useEffect(() => {
35
+        addCompanyData();
36
+      },[])
37
+
38
+      // 查询列表
39
+      const addCompanyData = () => {
40
+        request({
41
+            ...apis.company.add,
42
+        }).then((data) => {
43
+          setData(data)
44
+        }).catch((err) => {
45
+          message.error(err.msg || err.message)
46
+        })
47
+      }
48
+    }
49
+  
50
+    const fields = [
51
+      {
52
+        label: '已自动生成企业编号',
53
+        name: 'companyCode',
54
+        value: data.companyCode,
55
+        render: <span>{data.companyCode}</span>
56
+      },    
57
+      {
58
+        label: '已生成法大大客户编号',
59
+        name: 'fadadaCode',
60
+        value: data.fadadaCode,
61
+        render: <span>{data.fadadaCode}</span>
62
+      },
63
+      {
64
+        label: '请选择企业管理员身份',
65
+        name: 'companyManagerType',
66
+        value: data.companyManagerType,
67
+        render: <Select style={{ width: '180px' }} placeholder="请选择企业管理员身份">
68
+                  <Select.Option value="legal">法人</Select.Option>
69
+                  <Select.Option value="agent">代理人</Select.Option>
70
+                </Select>,
71
+      },
72
+    ]
73
+  
74
+     
75
+    const handleSubmit = (values) => {
76
+      if(companyId){
77
+          request({ ...apis.sample.update, urlData: { id: companyId }, data: { ...values }}).then((data) => {
78
+            cancelPage();
79
+          }).catch((err) => {
80
+            message.error(err.msg || err.message)
81
+          })
82
+        }
83
+    }
84
+  
85
+    const cancelPage = () => {
86
+      router.push({
87
+        pathname: '/sample/demand/list',
88
+      });
89
+    }
90
+  
91
+    return (
92
+      <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
93
+    )
94
+  }
95
+  
96
+  const WrappedNormalLoginForm = Form.create({ name: 'header' })(header);
97
+  export default WrappedNormalLoginForm

+ 106
- 0
src/pages/eContract/company/edit.jsx 파일 보기

@@ -0,0 +1,106 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select, Form, Alert } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import XForm, { FieldTypes } from '../../../components/XForm';
5
+import router from 'umi/router';
6
+import apis from '../../../services/apis';
7
+import request from '../../../utils/request';
8
+import Wangedit from '../../../components/Wangedit/Wangedit'
9
+import moment from 'moment';
10
+
11
+
12
+const header = props => {
13
+    const companyId = props.location.query.id
14
+  
15
+    const [ data, setData ] = useState({})
16
+    if(companyId){
17
+      useEffect(() => {
18
+        getCompanyData(companyId);
19
+      },[])
20
+    
21
+      // 查询列表
22
+      const getCompanyData = (companyId) => {
23
+        request({
24
+            ...apis.company.get,
25
+            urlData: { id: companyId }
26
+        }).then((data) => {
27
+          if(data.certifiedStatus === 'registered'){
28
+            router.push({
29
+              pathname: '/eContract/company/add',
30
+              query: {
31
+                id: companyId
32
+              },
33
+            });
34
+            return
35
+          }
36
+          setData(data)
37
+        }).catch((err) => {
38
+          message.error(err.msg || err.message)
39
+        })
40
+      }
41
+    }else{
42
+      //第一次进入就创建新的企业
43
+      useEffect(() => {
44
+        addCompanyData();
45
+      },[])
46
+
47
+      // 查询列表
48
+      const addCompanyData = () => {
49
+        request({
50
+            ...apis.company.add,
51
+        }).then((data) => {
52
+          setData(data)
53
+        }).catch((err) => {
54
+          message.error(err.msg || err.message)
55
+        })
56
+      }
57
+    }
58
+  
59
+    const fields = [
60
+      {
61
+        label: '已自动生成企业编号',
62
+        name: 'companyCode',
63
+        value: data.companyCode,
64
+        render: <span>{data.companyCode}</span>
65
+      },    
66
+      {
67
+        label: '已生成法大大客户编号',
68
+        name: 'fadadaCode',
69
+        value: data.fadadaCode,
70
+        render: <span>{data.fadadaCode}</span>
71
+      },
72
+      {
73
+        label: '请选择企业管理员身份',
74
+        name: 'companyManagerType',
75
+        value: data.companyManagerType,
76
+        render: <Select style={{ width: '180px' }} placeholder="请选择企业管理员身份">
77
+                  <Select.Option value="legal">法人</Select.Option>
78
+                  <Select.Option value="agent">代理人</Select.Option>
79
+                </Select>,
80
+      },
81
+    ]
82
+  
83
+     
84
+    const handleSubmit = (values) => {
85
+      if(companyId){
86
+          request({ ...apis.sample.update, urlData: { id: companyId }, data: { ...values }}).then((data) => {
87
+            cancelPage();
88
+          }).catch((err) => {
89
+            message.error(err.msg || err.message)
90
+          })
91
+        }
92
+    }
93
+  
94
+    const cancelPage = () => {
95
+      router.push({
96
+        pathname: '/sample/demand/list',
97
+      });
98
+    }
99
+  
100
+    return (
101
+      <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
102
+    )
103
+  }
104
+  
105
+  const WrappedNormalLoginForm = Form.create({ name: 'header' })(header);
106
+  export default WrappedNormalLoginForm

+ 32
- 39
src/pages/eContract/company/index.jsx 파일 보기

@@ -23,7 +23,7 @@ function header(props) {
23 23
 
24 24
   // 查询列表
25 25
   const getList = (params) => {
26
-    request({ ...apis.sample.list, params: { ...params } }).then((data) => {
26
+    request({ ...apis.company.list, params: { ...params } }).then((data) => {
27 27
         console.log(data)
28 28
         setData(data)
29 29
     })
@@ -35,31 +35,14 @@ function header(props) {
35 35
     e.preventDefault();
36 36
     props.form.validateFields((err, values) => {
37 37
       if (!err) {
38
-        let {createDate, ...submitValue} = values
39
-        if(null != createDate && createDate.length > 0){
40
-          const [startCreateDate, endCreateDate] = createDate
41
-          submitValue.startCreateDate = moment(startCreateDate).format('YYYY-MM-DD');
42
-          submitValue.endCreateDate = moment(endCreateDate).format('YYYY-MM-DD');
43
-        }else{
44
-          submitValue.startCreateDate = null
45
-          submitValue.endCreateDate = null
46
-        }
47
-        getList({ pageNum: 1, pageSize: 10, ...submitValue })
38
+        getList({ pageNum: 1, pageSize: 10, ...values })
48 39
       }
49 40
     });
50 41
   }
51 42
 
52 43
   const changePageNum = (pageNumber) => {
53
-    let {createDate, ...submitValue}  = props.form.getFieldsValue()
54
-    if(null != createDate && createDate.length > 0){
55
-      const [startCreateDate, endCreateDate] = createDate
56
-      submitValue.startCreateDate = moment(startCreateDate).format('YYYY-MM-DD');
57
-      submitValue.endCreateDate = moment(endCreateDate).format('YYYY-MM-DD');
58
-    }else{
59
-      submitValue.startCreateDate = null
60
-      submitValue.endCreateDate = null
61
-    }
62
-    getList({ pageNum: pageNumber, pageSize: 10, ...submitValue })
44
+    let values  = props.form.getFieldsValue()
45
+    getList({ pageNum: pageNumber, pageSize: 10, ...values })
63 46
   }
64 47
 
65 48
   const rowSelection = {
@@ -71,9 +54,9 @@ function header(props) {
71 54
 
72 55
 
73 56
   // 跳转到编辑资讯
74
-  const toEditDemand = (id) => () => {
57
+  const toEditCompany = (id) => () => {
75 58
     router.push({
76
-      pathname: '/sample/demand/edit',
59
+      pathname: '/eContract/company/edit',
77 60
       query: {
78 61
         id
79 62
       },
@@ -81,6 +64,14 @@ function header(props) {
81 64
   }
82 65
 
83 66
   
67
+  // 跳转到编辑资讯
68
+  const toAddCompany = () => {
69
+    router.push({
70
+      pathname: '/eContract/company/add',
71
+    });
72
+  }
73
+
74
+  
84 75
   const changeStatus = () => {
85 76
     if(demandIdList.length < 1){
86 77
       message.error('请先选择要删除的数据!')
@@ -112,35 +103,34 @@ function header(props) {
112 103
   const columns = [
113 104
     {
114 105
       title: '企业名称',
115
-      dataIndex: 'sampleName',
116
-      key: 'sampleName',
106
+      dataIndex: 'companyName',
107
+      key: 'companyName',
117 108
       align: 'center',
118 109
     },
119 110
     {
120 111
       title: '企业编号',
121
-      dataIndex: 'orgName',
122
-      key: 'orgName',
112
+      dataIndex: 'companyCode',
113
+      key: 'companyCode',
123 114
       align: 'center',
124 115
     },
125 116
     {
126 117
       title: '法大大客户编号',
127
-      dataIndex: 'orderer',
128
-      key: 'orderer',
118
+      dataIndex: 'fadadaCode',
119
+      key: 'fadadaCode',
129 120
       align: 'center',
130 121
 
131 122
     },
132 123
     {
133 124
       title: '实名认证状态',
134
-      dataIndex: 'phone',
135
-      key: 'phone',
125
+      dataIndex: 'certifiedStatus',
126
+      key: 'certifiedStatus',
136 127
       align: 'center',
137 128
     },
138 129
     {
139 130
       title: '企业管理员身份',
140
-      dataIndex: 'createDate',
141
-      key: 'createDate',
131
+      dataIndex: 'companyManagerType',
132
+      key: 'companyManagerType',
142 133
       align: 'center',
143
-      render: (x, row) => <><span>{`${moment(row.createDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
144 134
     },
145 135
     {
146 136
       title: '操作',
@@ -148,7 +138,7 @@ function header(props) {
148 138
       key: 'handle',
149 139
       align: 'center',
150 140
       render: (x, row) => (
151
-        <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={toEditDemand(row.demandId)}>
141
+        <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={toEditCompany(row.companyId)}>
152 142
           查看详情<Icon type="form" className={styles.edit} />
153 143
         </span>
154 144
       ),
@@ -165,7 +155,7 @@ function header(props) {
165 155
     <>
166 156
     <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
167 157
         <Form.Item>
168
-          {getFieldDecorator('sampleName')(
158
+          {getFieldDecorator('companyName')(
169 159
             <Input
170 160
               prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
171 161
               placeholder="企业名称"
@@ -173,7 +163,7 @@ function header(props) {
173 163
           )}
174 164
         </Form.Item>
175 165
         <Form.Item>
176
-          {getFieldDecorator('orgName')(
166
+          {getFieldDecorator('companyCode')(
177 167
             <Input
178 168
               prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
179 169
               placeholder="企业编号"
@@ -181,7 +171,7 @@ function header(props) {
181 171
           )}
182 172
         </Form.Item>
183 173
         <Form.Item>
184
-          {getFieldDecorator('demandStatus')(
174
+          {getFieldDecorator('certifiedStatus')(
185 175
             <Select style={{ width: '180px' }} placeholder="实名认证状态">
186 176
               <Select.Option value="1">未认证</Select.Option>
187 177
               <Select.Option value="2">管理员资料已提交</Select.Option>
@@ -203,7 +193,10 @@ function header(props) {
203 193
         </Form.Item>
204 194
       </Form>
205 195
       <AuthButton name="admin.taNewsType.post" noRight={null}>
206
-        <Button type="danger" className={styles.addBtn} onClick={changeStatus}>删除</Button>
196
+        <Button type="danger" className={styles.addBtn} onClick={toAddCompany}>新增</Button>
197
+      </AuthButton>
198
+      <AuthButton name="admin.taNewsType.post" noRight={null}>
199
+        <Button type="danger" style={{ marginLeft: 15 }} onClick={changeStatus}>删除</Button>
207 200
       </AuthButton>
208 201
       <Table rowSelection={rowSelection} rowKey="newsType" dataSource={data.records} columns={columns} pagination={false} />
209 202
       <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>

+ 25
- 7
src/services/apis.js 파일 보기

@@ -115,12 +115,12 @@ const apis = {
115 115
     uploadForAnt: {
116 116
       url: `${prefix}/antd/image`,
117 117
       method: 'POST',
118
-      action: 'center',
118
+      action: 'channel',
119 119
     },
120 120
     upload: {
121 121
       url: `${prefix}/image`,
122 122
       method: 'POST',
123
-      action: 'center',
123
+      action: 'channel',
124 124
     },
125 125
   },
126 126
   openScreen: {
@@ -164,33 +164,51 @@ const apis = {
164 164
     listContactByCondition: {
165 165
       url: `${prefix}/listContactByCondition`,
166 166
       method: 'GET',
167
-      action: 'center',
167
+      action: 'channel',
168 168
     },
169 169
     taContactAdd: {
170 170
       url: `${prefix}/taContact`,
171 171
       method: 'POST',
172
-      action: 'center',
172
+      action: 'channel',
173 173
     },
174 174
     batchDeleteContact: {
175 175
       url: `${prefix}/taContact/batchDelete`,
176 176
       method: 'PUT',
177
-      action: 'center',
177
+      action: 'channel',
178 178
     },
179 179
     taContactGet: {
180 180
       url: `${prefix}/taContact/:id`,
181 181
       method: 'GET',
182
-      action: 'center',
182
+      action: 'channel',
183 183
     },
184 184
     taContactUpdate: {
185 185
       url: `${prefix}/taContact/:id`,
186 186
       method: 'PUT',
187
-      action: 'center',
187
+      action: 'channel',
188 188
     },
189 189
     list: {
190 190
       url: `${prefix}/taContact`,
191 191
       method: 'GET',
192 192
       action: 'channel',
193 193
     },
194
+  },
195
+
196
+  company: {
197
+    list: {
198
+      url: `${prefix}/company/list`,
199
+      method: 'GET',
200
+      action: 'channel',
201
+    },
202
+    add: {
203
+      url: `${prefix}/company/add`,
204
+      method: 'POST',
205
+      action: 'channel',
206
+    },
207
+    get: {
208
+      url: `${prefix}/company/:id`,
209
+      method: 'GET',
210
+      action: 'channel',
211
+    },
194 212
   }
195 213
   
196 214
 }