Explorar o código

feat: 客户添加服务记录日志

outaozhen %!s(int64=5) %!d(string=hai) anos
pai
achega
3418bae7c3

+ 2 - 3
src/pages/Customer/Company/components/AddCompany/index.jsx

@@ -6,8 +6,7 @@ import { connect } from 'dva'
 import { Plus } from '@icon-park/react'
 
 const AddCompany = props => {
-  const { natures, onConfirm, dispatch, buttonProps } = props
-  console.log(buttonProps)
+  const { natures, onConfirm, dispatch } = props
   const layout = {
     layout: 'horizontal',
     labelCol: { flex: '100px' }
@@ -25,7 +24,7 @@ const AddCompany = props => {
       title="添加客户"
       {...layout}
       trigger={
-        <Button key="button">
+        <Button key="button" type="primary">
           <Plus theme="filled" className="mr-1" />
           <span>客户</span>
         </Button>

+ 35 - 13
src/pages/Customer/Company/components/CompanyDetail/CompanyLowerList.jsx

@@ -1,27 +1,49 @@
-import { Tabs, List } from 'antd'
+import { Tabs, List, Row, Col } from 'antd'
 import { dayjsFormat } from '@/utils/utils'
-// import { useModal } from '@/components/Modal'
-// import ContactDetail from '@/pages/customer/Contact/components/ContactDetail'
 
 const CompanyLowerList = props => {
   // const { toggleModal, setModalProps } = useModal()
   const {
-    log: { log: logs = [], total = 0 }
+    log: { log: logs = [], total = 0 },
+    servicelist
   } = props
+  const servicelogEnum = {
+    1: '上门服务',
+    2: '电话拜访',
+    3: '其他事项',
+    4: '在线服务'
+  }
   const { TabPane } = Tabs
-  // const needSubtractHeight = 48 + 48 + 48 + 64 + 24 // 需要被裁掉的高度
-  // const [x, y] = useAutoTable(needSubtractHeight)
-
-  // const handleOnClick = id => {
-  //   setModalProps({
-  //     onClose: () => toggleDrawer(),
-  //     children: <ContactDetail dataId={id} />
-  //   })
-  // }
   return (
     <div>
       <div className="zh-pd-left-15">
         <Tabs>
+          <TabPane tab="服务记录" key="服务记录">
+            <div className="sheet-panel-record">
+              <Row>
+                <Col span="8">类型/时间</Col>
+                <Col span="16">服务内容</Col>
+              </Row>
+              <List
+                dataSource={servicelist}
+                split={false}
+                renderItem={item => (
+                  <List.Item>
+                    <Row className="zh-width-100P">
+                      <Col span="8">
+                        <a className="zh-mg-right-3">@{item.staffName}</a>
+                        {servicelogEnum[item.status]}
+                        <List.Item.Meta description={dayjsFormat(item.date, 'MM-DD HH:mm:ss')} />
+                      </Col>
+                      <Col span="16" className="whitespace-pre-line">
+                        {item.mark}
+                      </Col>
+                    </Row>
+                  </List.Item>
+                )}
+              />
+            </div>
+          </TabPane>
           <TabPane tab="日志" key="日志">
             <div className="sheet-panel-record">
               <List

+ 2 - 2
src/pages/Customer/Company/components/CompanyDetail/CompanyTabList.jsx

@@ -107,7 +107,7 @@ const CompanyTabList = ({ initData, customerId, client, software }) => {
     // 刷新数据
     dispatch({
       type: 'refresh/commitAction',
-      payload: 'client'
+      payload: 'company'
     })
     // await initData()
   }
@@ -165,7 +165,7 @@ const CompanyTabList = ({ initData, customerId, client, software }) => {
         <AddContact
           onConfirm={handleAddClient}
           key="addContactBtn"
-          buttonProps={({ size: 'middle' }, { type: 'primary' })}
+          buttonProps={{ size: 'small', ghost: 'true' }}
         />
         <AddRecord
           onConfirm={handleAddCustomerService}

+ 4 - 8
src/pages/Customer/Company/components/CompanyDetail/index.jsx

@@ -23,13 +23,14 @@ const CompanyDetail = props => {
     loading: false,
     customer: {},
     log: [],
+    serviceLog: [],
     software: {},
     client: {}
   })
   const initData = async (id = dataId) => {
     setState({ ...state, loading: true })
     const {
-      data: { customer = {}, log = [], software = {}, client = {} },
+      data: { customer = {}, log = [], serviceLog = [], software = {}, client = {} },
       code = -1
     } = await apiCompanyDetail(id)
     if (code === consts.RET_CODE.SUCCESS) {
@@ -39,7 +40,7 @@ const CompanyDetail = props => {
           payload: 'company'
         })
       }
-      setState({ ...state, customer, log, software, loading: false, client })
+      setState({ ...state, customer, log, serviceLog, software, loading: false, client })
     }
   }
   const { flipFn, flipConsts } = useFlipOver(initData, dataId, orderIds)
@@ -48,11 +49,6 @@ const CompanyDetail = props => {
   }, [shouldUpdate])
   useEffect(() => {
     visible && initData(dataId)
-    // if (!departments.length) {
-    //   dispatch({
-    //     type: 'staff/fetchDepartments'
-    //   })
-    // }
   }, [visible])
   return (
     <Spin spinning={state.loading}>
@@ -97,7 +93,7 @@ const CompanyDetail = props => {
               client={state.client}
               // departmentsMap={departmentsMap}
             />
-            <CompanyLowerList log={state.log} />
+            <CompanyLowerList log={state.log} servicelist={state.serviceLog} />
           </Col>
         </Row>
       </div>

+ 2 - 2
src/pages/Customer/Contact/components/AddContact/index.jsx

@@ -6,7 +6,7 @@ import { Plus } from '@icon-park/react'
 import ModalDrag from '@/components/DragmModal'
 
 const Addcontact = props => {
-  const { onConfirm } = props
+  const { onConfirm, buttonProps } = props
   const layout = {
     layout: 'horizontal',
     labelCol: { flex: '100px' }
@@ -17,7 +17,7 @@ const Addcontact = props => {
       {...layout}
       title={<ModalDrag title={'添加联系人'} />}
       trigger={
-        <Button type="primary" className="items-center">
+        <Button type="primary" {...buttonProps} className="items-center">
           <Plus className="mr-1" />
           联系人
         </Button>