Jelajahi Sumber

Merge branch 'dev' of http://192.168.1.41:3000/outaozhen/cldV2react into dev

outaozhen 4 tahun lalu
induk
melakukan
fd81fc7bca

+ 7 - 3
src/components/EditableForm/src/editableForm.jsx

@@ -3,7 +3,8 @@ import { Row } from 'antd'
 import EditableFormItem from './editableFormItem'
 import { isNullOrUnDef } from '@/utils/is'
 
-const EditableForm = ({ dataSource, columns, type, tartgetUrl }) => {
+const EditableForm = ({ dataSource, columns, type, tartgetUrl, editable }) => {
+  console.log('editable', editable)
   // console.log(store)
   const newColumns = columns.map(item => {
     const newItem = { ...item }
@@ -13,8 +14,11 @@ const EditableForm = ({ dataSource, columns, type, tartgetUrl }) => {
       newItem.span = 24
     }
 
-    // 默认编辑
-    if (isNullOrUnDef(item.editable)) {
+    // 默认取用全局-editable
+    if (!isNullOrUnDef(editable)) {
+      newItem.editable = editable
+    } else if (isNullOrUnDef(item.editable)) {
+      // 采用布局-editable 默认为true
       newItem.editable = true
     }
 

+ 7 - 2
src/pages/Customer/Business/components/BusinessDetail/Form.jsx

@@ -1,5 +1,5 @@
 import { Row, Col } from 'antd'
-import React from 'react'
+import React, { useMemo } from 'react'
 import EditableForm from '@/components/EditableForm'
 import ChangeCompanyInput, {
   ChangeCompMap
@@ -10,6 +10,10 @@ import Step from './Step/index'
 const Form = props => {
   const { business, groupStatus, updateKey } = props
 
+  const isEnd = useMemo(() => {
+    return groupStatus.findIndex(item => item.endProcess && item.selected) !== -1
+  }, [groupStatus, business.businessStatusId])
+
   const changeCopInputData = {
     customerName: business.customerName,
     customerId: business.customerId,
@@ -35,7 +39,7 @@ const Form = props => {
       dataIndex: 'customerId',
       label: '单位名称',
       editCellType: 'custom',
-      customCell: <ChangeCompanyInput dataSource={changeCopInputData} />,
+      customCell: <ChangeCompanyInput dataSource={changeCopInputData} editable={!isEnd} />,
       span: 24
     },
     {
@@ -84,6 +88,7 @@ const Form = props => {
         columns={columns}
         tartgetUrl="/business/update"
         type={updateKey}
+        editable={!isEnd}
       />
     </div>
   )

+ 11 - 0
src/pages/Customer/Business/components/BusinessDetail/Step/index.jsx

@@ -102,6 +102,17 @@ const Step = ({ id, statusId, groupStatus = [] }) => {
                   return
                 }
                 if (idx > op.selectedItemIdx + 1) {
+                  // notification.info({
+                  //   message: '温馨提示:',
+                  //   description: `当前处于${
+                  //     op.mainItems.find((_, i) => {
+                  //       if (op.selectedItemIdx === -1) {
+                  //         return i === 0
+                  //       }
+                  //       return i === op.selectedItemIdx
+                  //     })?.name
+                  //   }阶段`
+                  // })
                   return
                 }
                 Modal.confirm({

+ 8 - 9
src/pages/Customer/Business/index.jsx

@@ -40,11 +40,6 @@ const Business = ({ dispatch, groupList, shouldUpdate, loading }) => {
     if (groupList) {
       const group = groupList[0]
       if (group) {
-        console.log(
-          group.items
-            ?.filter(item => !item.endProcess)
-            ?.map(item => ({ ...item, percentage: parseInt(item.percentage, 10) }))
-        )
         setState({
           ...state,
           params: { ...state.params, businessGroupId: group.value },
@@ -142,10 +137,14 @@ const Business = ({ dispatch, groupList, shouldUpdate, loading }) => {
     xField: 'name',
     yField: 'count',
     shape: 'pyramid',
-    conversionTag: false
+    conversionTag: false,
+    dynamicHeight: true
   }
-  const handleOnPermChange = ({ staffIds, dataPermission }) =>
+  const handleOnPermChange = ({ staffIds, dataPermission }) => {
     setState({ ...state, groupParams: { ...state.groupParams, staffIds, dataPermission } })
+    initGroupList({ staffIds, dataPermission })
+  }
+
   return (
     <div className="h-full w-full flex flex-row justify-between">
       <div className="h-full w-3/20 rounded-4px shadow-card">
@@ -159,7 +158,7 @@ const Business = ({ dispatch, groupList, shouldUpdate, loading }) => {
                 bordered={false}
                 options={groupList}
                 defaultValue={groupList[0]?.value}
-                onChange={(id, option) => {
+                onChange={async (id, option) => {
                   setState({
                     ...state,
                     params: { ...state.params, businessGroupId: id },
@@ -174,7 +173,7 @@ const Business = ({ dispatch, groupList, shouldUpdate, loading }) => {
         </div>
         <div className="p-4 bg-white " style={{ height: 'calc(100% - 1rem*2 - 20px)' }}>
           <div className="max-h-1/3">
-            <Funnel data={state.funnelData} {...conifg} />
+            {state.funnelData?.length && <Funnel data={state.funnelData} {...conifg} />}
           </div>
         </div>
       </div>

+ 16 - 13
src/pages/Customer/Company/components/ChangeCompany/index.jsx

@@ -30,7 +30,8 @@ const ChangeCompanyInput = props => {
       targetName,
       actionPayload = ChangeCompMap.CLIENT.key,
       title = '客户'
-    }
+    },
+    editable = true
   } = props
   const refreshClient = () => {
     dispatch({
@@ -94,18 +95,20 @@ const ChangeCompanyInput = props => {
         <div className={styles.nameContent} onClick={handleCompanyClick}>
           {customerName}
         </div>
-        <div className={styles.iconContent}>
-          <Tooltip placement="right" title="移除单位">
-            <span className={styles.unlinkIcon} onClick={removeCustomer}>
-              <LinkInterrupt />
-            </span>
-          </Tooltip>
-          <Tooltip placement="right" title="更换单位" onClick={handleConnectCustomer}>
-            <span className={styles.switchIcon}>
-              <Switch />
-            </span>
-          </Tooltip>
-        </div>
+        {editable && (
+          <div className={styles.iconContent}>
+            <Tooltip placement="right" title="移除单位">
+              <span className={styles.unlinkIcon} onClick={removeCustomer}>
+                <LinkInterrupt />
+              </span>
+            </Tooltip>
+            <Tooltip placement="right" title="更换单位" onClick={handleConnectCustomer}>
+              <span className={styles.switchIcon}>
+                <Switch />
+              </span>
+            </Tooltip>
+          </div>
+        )}
       </div>
     </Card>
   )

+ 2 - 2
src/services/customer.js

@@ -185,8 +185,8 @@ export async function apiAddCustomerService(payload) {
 
 /** 获取商机组列表 */
 export async function getBusinessGroupList(params) {
-  return request.get('/business/group/list', {
-    params
+  return request.post('/business/group/list', {
+    data: params
   })
 }