ContanctForm.jsx 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. import { Row, Col, Tooltip } from 'antd'
  2. import React from 'react'
  3. import EditableForm from '@/components/EditableForm'
  4. import ChangeCompanyInput from '@/pages/customer/Contact/components/ChangeCompany'
  5. import { connect } from 'umi'
  6. import PersonLabel from '@/pages/customer/Company/components/PersonLabel'
  7. import { Add } from '@icon-park/react'
  8. import {
  9. TagTypeEnum,
  10. TagDataTypeEnum,
  11. LabelModeType
  12. } from '@/pages/customer/Company/components/PersonLabel/const'
  13. const ContanctForm = props => {
  14. const { client, personTagColorMap, personTags, teamTagColorMap, teamTags, dispatch } = props
  15. const changeCopInputData = {
  16. customerName: client.companyName,
  17. customerId: client.companyId,
  18. targetName: client.clientName,
  19. dataId: client.id
  20. }
  21. const refreshClient = () => {
  22. dispatch({
  23. type: 'refresh/commitAction',
  24. payload: 'client'
  25. })
  26. }
  27. const columns = [
  28. {
  29. dataIndex: 'clientName',
  30. label: '姓名',
  31. span: 24
  32. },
  33. {
  34. dataIndex: 'districtIds',
  35. label: '联系人地区',
  36. editCellType: 'cascader',
  37. span: 24
  38. },
  39. {
  40. dataIndex: 'companyName',
  41. label: '客户名称',
  42. editCellType: 'custom',
  43. customCell: <ChangeCompanyInput dataSource={changeCopInputData} />,
  44. span: 24
  45. },
  46. {
  47. dataIndex: 'gender',
  48. label: '性别',
  49. editCellType: 'select',
  50. span: 12
  51. },
  52. {
  53. dataIndex: 'niceName',
  54. label: '昵称',
  55. span: 12
  56. },
  57. {
  58. dataIndex: 'telephone',
  59. label: '手机',
  60. span: 12
  61. },
  62. {
  63. dataIndex: 'qq',
  64. label: 'QQ',
  65. span: 12
  66. },
  67. {
  68. dataIndex: 'phone',
  69. label: '电话',
  70. span: 12
  71. },
  72. {
  73. dataIndex: 'email',
  74. label: '邮箱',
  75. span: 12
  76. },
  77. {
  78. dataIndex: 'fax',
  79. label: '传真',
  80. span: 12
  81. },
  82. {
  83. dataIndex: 'department',
  84. label: '部门',
  85. span: 12
  86. },
  87. {
  88. dataIndex: 'position',
  89. label: '职务',
  90. span: 12
  91. },
  92. {
  93. dataIndex: 'office',
  94. label: '办公室',
  95. span: 24,
  96. editCellType: 'textarea'
  97. },
  98. {
  99. dataIndex: 'address',
  100. label: '联系人地址',
  101. span: 24,
  102. editCellType: 'textarea'
  103. },
  104. {
  105. dataIndex: 'ride',
  106. label: '联系人乘车',
  107. span: 24,
  108. editCellType: 'textarea'
  109. },
  110. {
  111. dataIndex: 'landmarks',
  112. label: '联系人地标',
  113. span: 24,
  114. editCellType: 'textarea'
  115. },
  116. {
  117. dataIndex: 'stay',
  118. label: '联系人住宿',
  119. span: 24,
  120. editCellType: 'textarea'
  121. },
  122. {
  123. dataIndex: 'mark',
  124. label: '备注',
  125. span: 24,
  126. editCellType: 'textarea'
  127. },
  128. {
  129. dataIndex: 'tagIds',
  130. label: '个人标签',
  131. editCellType: 'custom',
  132. customCell: (
  133. <div className="editable-cell-value-wrap text-center flex flex-wrap items-center">
  134. {client.tagIds?.map(item => (
  135. <Tooltip title={personTags.find(i => i.id === item)?.name} key={client.id + item}>
  136. <span
  137. className="zh-circle-icon mr-3px"
  138. style={{ backgroundColor: personTagColorMap[item] }}
  139. />
  140. </Tooltip>
  141. ))}
  142. <PersonLabel
  143. dataId={client.id}
  144. tagIds={client.tagIds}
  145. tagType={TagTypeEnum.PERSONTAG}
  146. tagColumn={TagDataTypeEnum.CONTACT}
  147. checkCallBack={refreshClient}
  148. modeType={LabelModeType.column}>
  149. <Add theme="filled" size="20" fill="#868e96" className="cursor-pointer" />
  150. </PersonLabel>
  151. </div>
  152. ),
  153. span: 24
  154. },
  155. {
  156. dataIndex: 'tagCooperationIds',
  157. label: '协作标签',
  158. editCellType: 'custom',
  159. customCell: (
  160. <div className="editable-cell-value-wrap text-center flex flex-wrap items-center">
  161. {client.tagCooperationIds?.map(item => (
  162. <Tooltip title={teamTags.find(i => i.id === item)?.name} key={client.id + item}>
  163. <span
  164. className="zh-square-icon mr-3px"
  165. style={{ backgroundColor: teamTagColorMap[item] }}
  166. />
  167. </Tooltip>
  168. ))}
  169. <PersonLabel
  170. dataId={client.id}
  171. tagIds={client.tagCooperationIds}
  172. tagType={TagTypeEnum.TEAMTAG}
  173. tagColumn={TagDataTypeEnum.CONTACT}
  174. checkCallBack={refreshClient}
  175. modeType={LabelModeType.column}>
  176. <Add theme="filled" size="20" fill="#868e96" className="cursor-pointer" />
  177. </PersonLabel>
  178. </div>
  179. ),
  180. span: 24
  181. }
  182. ]
  183. return (
  184. <div>
  185. <Row>
  186. <Col span={8}>
  187. <h2 className="text-gray-500">联系人</h2>
  188. </Col>
  189. {/* className={[ 'text-right', styles.textMuted ]} */}
  190. <Col span={16} className="zh-text-right zh-gray">
  191. {client.staffName} 创建于{client.createTime}
  192. </Col>
  193. <Col span={22}>
  194. <h2 className="text-2xl pb-4">{client.clientName}</h2>
  195. </Col>
  196. <Col span={2} />
  197. </Row>
  198. <EditableForm
  199. dataSource={client}
  200. columns={columns}
  201. tartgetUrl="/client/update"
  202. type="contact"
  203. />
  204. </div>
  205. )
  206. }
  207. export default connect(({ client }) => ({
  208. personTagColorMap: client.personTagColorMap,
  209. personTags: client.personTags,
  210. teamTagColorMap: client.teamTagColorMap,
  211. teamTags: client.teamTags
  212. }))(ContanctForm)