index.jsx 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. import { Button, Drawer, Form, Input, Row, Col, Tabs, Cascader, Select, Tag } from 'antd'
  2. import React, { useState, useEffect } from 'react'
  3. import styles from './index.less'
  4. const Popcontactform = props => {
  5. // 浏览器实际宽度
  6. const [ clientWidth, setClientWidth ] = useState(document.body.clientWidth * 0.75)
  7. useEffect(() => {
  8. window.addEventListener('resize', () => {
  9. setClientWidth(document.body.clientWidth * 0.7)
  10. })
  11. return () => {
  12. window.removeEventListener('resize')
  13. }
  14. }, [])
  15. const { visible, onClose, onCreate } = props
  16. const [ form ] = Form.useForm()
  17. const { TabPane } = Tabs
  18. function callback(key) {
  19. console.log(key)
  20. }
  21. const residences = [
  22. {
  23. value: '广东省',
  24. label: '广东省',
  25. children: [
  26. {
  27. value: '珠海市',
  28. label: '珠海市',
  29. children: [
  30. {
  31. value: '香洲区',
  32. label: '香洲区'
  33. }
  34. ]
  35. }
  36. ]
  37. },
  38. {
  39. value: '安徽省',
  40. label: '安徽省',
  41. children: [
  42. {
  43. value: '合肥市',
  44. label: '合肥市',
  45. children: [
  46. {
  47. value: '庐阳区',
  48. label: '庐阳区'
  49. }
  50. ]
  51. }
  52. ]
  53. }
  54. ]
  55. return (
  56. <div>
  57. <div className="sheet-box">
  58. <Drawer
  59. title="联系人"
  60. placement="right"
  61. width={clientWidth}
  62. closable
  63. onClose={onClose}
  64. visible={visible}
  65. // mask={false}
  66. >
  67. <Row>
  68. <Col span={12} className="sheet-box-left">
  69. <div className="sheet-left-panel pr-4">
  70. <Row>
  71. <Col span={12}>
  72. <h2>刘泽富</h2>
  73. </Col>
  74. <Col span={12} className={[ 'text-right', styles.textMuted ]}>
  75. 陈特 创建于 2019年5月6日 14:55
  76. </Col>
  77. </Row>
  78. <Form layout="vertical" form={form}>
  79. <Row gutter={16}>
  80. <Col span={24}>
  81. <Form.Item
  82. label="姓名"
  83. name="clientname"
  84. rules={[ { required: false, message: '姓名' } ]}>
  85. <Input value="刘泽富" />
  86. </Form.Item>
  87. </Col>
  88. </Row>
  89. <Row gutter={16}>
  90. <Col span={24}>
  91. <Form.Item
  92. label="联系人地区"
  93. name="local"
  94. rules={[ { required: false, message: '地区' } ]}>
  95. <Cascader options={residences} />
  96. </Form.Item>
  97. </Col>
  98. </Row>
  99. <Row gutter={16}>
  100. <Col span={24}>
  101. <Form.Item
  102. label="客户名称"
  103. name="companyname"
  104. rules={[ { required: false, message: '客户名称' } ]}>
  105. <Input value="刘泽富" />
  106. </Form.Item>
  107. </Col>
  108. </Row>
  109. <Row gutter={16}>
  110. <Col span={12}>
  111. <Form.Item
  112. label="性别"
  113. name=""
  114. rules={[ { required: false, message: '性别' } ]}>
  115. <Select>
  116. <Select.Option value="男">男</Select.Option>
  117. <Select.Option value="女">女</Select.Option>
  118. </Select>
  119. </Form.Item>
  120. </Col>
  121. <Col span={12}>
  122. <Form.Item
  123. label="昵称"
  124. name=""
  125. rules={[ { required: false, message: '昵称' } ]}>
  126. <Input value="" />
  127. </Form.Item>
  128. </Col>
  129. </Row>
  130. <Row gutter={16}>
  131. <Col span={12}>
  132. <Form.Item
  133. label="手机"
  134. name=""
  135. rules={[ { required: false, message: '手机' } ]}>
  136. <Input value="" />
  137. </Form.Item>
  138. </Col>
  139. <Col span={12}>
  140. <Form.Item label="QQ" name="" rules={[ { required: false, message: 'QQ' } ]}>
  141. <Input value="" />
  142. </Form.Item>
  143. </Col>
  144. </Row>
  145. <Row gutter={16}>
  146. <Col span={12}>
  147. <Form.Item
  148. label="电话"
  149. name=""
  150. rules={[ { required: false, message: '电话' } ]}>
  151. <Input value="" />
  152. </Form.Item>
  153. </Col>
  154. <Col span={12}>
  155. <Form.Item
  156. label="邮箱"
  157. name=""
  158. rules={[ { required: false, message: '邮箱' } ]}>
  159. <Input value="" />
  160. </Form.Item>
  161. </Col>
  162. </Row>
  163. <Row gutter={16}>
  164. <Col span={12}>
  165. <Form.Item
  166. label="传真"
  167. name=""
  168. rules={[ { required: false, message: '传真' } ]}>
  169. <Input value="" />
  170. </Form.Item>
  171. </Col>
  172. <Col span={12}></Col>
  173. </Row>
  174. <Row gutter={16}>
  175. <Col span={12}>
  176. <Form.Item
  177. label="部门"
  178. name=""
  179. rules={[ { required: false, message: '部门' } ]}>
  180. <Input value="" />
  181. </Form.Item>
  182. </Col>
  183. <Col span={12}>
  184. <Form.Item
  185. label="职务"
  186. name=""
  187. rules={[ { required: false, message: '职务' } ]}>
  188. <Input value="" />
  189. </Form.Item>
  190. </Col>
  191. </Row>
  192. <Row gutter={16}>
  193. <Col span={24}>
  194. <Form.Item
  195. label="办公室"
  196. name=""
  197. rules={[ { required: false, message: '办公室' } ]}>
  198. <Input value="" />
  199. </Form.Item>
  200. </Col>
  201. </Row>
  202. <Row gutter={16}>
  203. <Col span={24}>
  204. <Form.Item
  205. label="联系人地址"
  206. name=""
  207. rules={[ { required: false, message: '联系人地址' } ]}>
  208. <Input value="" />
  209. </Form.Item>
  210. </Col>
  211. </Row>
  212. <Row gutter={16}>
  213. <Col span={24}>
  214. <Form.Item
  215. label="联系人乘车"
  216. name=""
  217. rules={[ { required: false, message: '联系人乘车' } ]}>
  218. <Input value="" />
  219. </Form.Item>
  220. </Col>
  221. </Row>
  222. <Row gutter={16}>
  223. <Col span={24}>
  224. <Form.Item
  225. label="联系人地标"
  226. name=""
  227. rules={[ { required: false, message: '联系人地标' } ]}>
  228. <Input value="" />
  229. </Form.Item>
  230. </Col>
  231. </Row>
  232. <Row gutter={16}>
  233. <Col span={24}>
  234. <Form.Item
  235. label="联系人住宿"
  236. name=""
  237. rules={[ { required: false, message: '联系人住宿' } ]}>
  238. <Input value="" />
  239. </Form.Item>
  240. </Col>
  241. </Row>
  242. <Row gutter={16}>
  243. <Col span={24}>
  244. <Form.Item
  245. label="备注"
  246. name=""
  247. rules={[ { required: false, message: '备注' } ]}>
  248. <Input value="" />
  249. </Form.Item>
  250. </Col>
  251. </Row>
  252. <Row gutter={16}>
  253. <Col span={24}>
  254. <Form.Item label="个人标签">
  255. <span className="ant-form-text">
  256. <Tag color="#16A085">标签</Tag>
  257. <Tag color="#2980B9">特别关注</Tag>
  258. </span>
  259. </Form.Item>
  260. </Col>
  261. </Row>
  262. <Row gutter={16}>
  263. <Col span={24}>
  264. <Form.Item label="协作标签">
  265. <span className="ant-form-text">
  266. <Tag color="#F8AC59">协作标签1</Tag>
  267. <Tag color="#FF69B4">协作标签2</Tag>
  268. </span>
  269. </Form.Item>
  270. </Col>
  271. </Row>
  272. </Form>
  273. <Button
  274. type="primary"
  275. className="ant-btn ant-btn-primary"
  276. onClick={() => {
  277. form
  278. .validateFields()
  279. .then(values => {
  280. onCreate(values)
  281. })
  282. .catch(err => {
  283. console.log(err)
  284. })
  285. }}>
  286. 确定
  287. </Button>
  288. </div>
  289. </Col>
  290. <Col span={12}>
  291. <div className="sheet-right-panel pl-4">
  292. <Tabs onChange={callback} type="card">
  293. <TabPane tab="Tab 1" key="1">
  294. Content of Tab Pane 1
  295. </TabPane>
  296. <TabPane tab="Tab 2" key="2">
  297. Content of Tab Pane 2
  298. </TabPane>
  299. <TabPane tab="Tab 3" key="3">
  300. Content of Tab Pane 3
  301. </TabPane>
  302. </Tabs>
  303. </div>
  304. </Col>
  305. </Row>
  306. </Drawer>
  307. </div>
  308. </div>
  309. )
  310. }
  311. export default Popcontactform