Form.jsx 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. import { Row, Col } from 'antd'
  2. import React from 'react'
  3. import EditableForm from '@/components/EditableForm'
  4. import ChangeCompanyInput, {
  5. ChangeCompMap
  6. } from '@/pages/customer/Contact/components/ChangeCompany'
  7. import ChangeStaff from '../ChangeStaff/index'
  8. import Step from './Step/index'
  9. const Form = props => {
  10. const { business } = props
  11. const changeCopInputData = {
  12. customerName: business.customerName,
  13. customerId: business.customerId,
  14. targetName: business.name,
  15. dataId: business.id,
  16. actionPayload: ChangeCompMap.BUSINESS.key,
  17. title: ChangeCompMap.BUSINESS.title
  18. }
  19. const changeStaffOpt = {
  20. responsibleId: business.responsibleId,
  21. dataId: business.id,
  22. actionPayload: ChangeCompMap.BUSINESS.key,
  23. text: business.responsible
  24. }
  25. const columns = [
  26. {
  27. dataIndex: 'name',
  28. label: '商机名称',
  29. span: 24
  30. },
  31. {
  32. dataIndex: 'customerId',
  33. label: '客户名称',
  34. editCellType: 'custom',
  35. customCell: <ChangeCompanyInput dataSource={changeCopInputData} />,
  36. span: 24
  37. },
  38. {
  39. dataIndex: 'price',
  40. label: '商机金额(元)',
  41. span: 12
  42. },
  43. {
  44. dataIndex: 'finalTime',
  45. label: '预计成交',
  46. editCellType: 'datePicker',
  47. span: 12
  48. },
  49. {
  50. dataIndex: 'responsibleId',
  51. label: '负责人',
  52. editCellType: 'custom',
  53. customCell: <ChangeStaff dataSource={changeStaffOpt} />,
  54. span: 24
  55. },
  56. {
  57. dataIndex: 'remark',
  58. label: '备注',
  59. span: 24,
  60. editCellType: 'textarea'
  61. }
  62. ]
  63. return (
  64. <div>
  65. <Row>
  66. <Col span={8}>
  67. <h2 className="text-gray-500">商机</h2>
  68. </Col>
  69. <Col span={16} className="text-right text-gray-500">
  70. {business.staffName} 创建于{business.createTime}
  71. </Col>
  72. <Col span={22}>
  73. <h2 className="text-2xl pb-4">{business.name}</h2>
  74. </Col>
  75. <Col span={2} />
  76. <Step />
  77. </Row>
  78. <EditableForm
  79. dataSource={business}
  80. columns={columns}
  81. tartgetUrl="/business/update"
  82. type="business"
  83. />
  84. </div>
  85. )
  86. }
  87. export default Form