lanjianrong hace 5 años
padre
commit
8eede155af

+ 8 - 4
src/pages/Customer/Business/components/BusinessDetail/Step/index.jsx

@@ -8,6 +8,7 @@ import { CloseOne, SmilingFaceWithSquintingEyes } from '@icon-park/react'
 import { MinusCircleOutlined, DownOutlined } from '@ant-design/icons'
 
 const Step = ({ id, statusId, groupStatus = [] }) => {
+  console.log(groupStatus)
   const dispatch = useDispatch()
   const { run: tryChangeStatus } = useRequest(params => changeGroupStatus(params), {
     manual: true,
@@ -40,9 +41,12 @@ const Step = ({ id, statusId, groupStatus = [] }) => {
     }
   }
   const op = useMemo(() => {
-    const mainItems = groupStatus.filter(item => !item.endProcess).sort((a, b) => a.sort - b.sort)
-    const otherItems = groupStatus.filter(item => item.endProcess).sort((a, b) => a.sort - b.sort)
-    const selectedItemIdx = mainItems.findIndex(item => item.selected)
+    const mainItems = groupStatus.filter(item => !item.endProcess)
+    const otherItems = groupStatus.filter(item => item.endProcess)
+    const selectedItemIdx = mainItems.reduce((prev, curr, idx) => {
+      if (curr.selected) return idx
+      return prev
+    }, -1)
     const endItemIdx = otherItems.findIndex(item => item.id === statusId)
     const isSelected = mainItems.findIndex(item => item.selected) !== -1
     const isEnd = otherItems.findIndex(item => item.id === statusId) !== -1
@@ -78,7 +82,7 @@ const Step = ({ id, statusId, groupStatus = [] }) => {
     </Menu>
   )
   return (
-    <div className={['busi-state', styles.businessStep].join(' ')}>
+    <div className={['busi-state', 'mb-4', styles.businessStep].join(' ')}>
       {op.mainItems.map((item, idx) => (
         <Tooltip
           placement="bottom"

+ 5 - 4
src/pages/Customer/Business/index.jsx

@@ -3,6 +3,7 @@ import { connect } from 'umi'
 import { getBusinessList } from '@/services/customer'
 import ProTable from '@ant-design/pro-table'
 import consts from '@/consts'
+import { Select } from 'antd'
 import AddBusiness from './components/AddBusiness'
 import Detail from './components/BusinessDetail'
 import { useModal } from '@/components/Modal'
@@ -79,7 +80,7 @@ const Business = ({ dispatch, groupList, shouldUpdate }) => {
     },
     {
       dataIndex: 'businessGroupName',
-      title: '机状态组',
+      title: '机状态组',
       width: '20%'
     },
     {
@@ -119,7 +120,7 @@ const Business = ({ dispatch, groupList, shouldUpdate }) => {
         <div className="p-4 border-b-1 border-solid border-black border-opacity-10 bg-[#f7f9fa] flex justify-around items-center">
           <div className="w-1/2 text-md">商机漏斗</div>
           <div className="w-1/2">
-            {/* {groupList[0]?.value && (
+            {groupList[0]?.value && (
               <Select
                 size="small"
                 className="w-full"
@@ -131,11 +132,11 @@ const Business = ({ dispatch, groupList, shouldUpdate }) => {
                     ...state,
                     funnelData: option.items
                       .filter(item => !item.endProcess)
-                      .map(item => ({ ...item, percentage: parseInt(item.percentage) }))
+                      .map(item => ({ ...item, percentage: parseInt(item.percentage, 10) }))
                   })
                 }}
               />
-            )} */}
+            )}
           </div>
         </div>
         <div className="p-4 bg-white " style={{ height: 'calc(100% - 1rem*2 - 20px)' }}>