Explorar el Código

fix: 单位下添加服务逻辑接入ModalStore

lanjianrong hace 4 años
padre
commit
8932c45f37

+ 0 - 1
src/models/refresh.js

@@ -25,7 +25,6 @@ export default {
     changState(state, action) {
       if (isObject(action.payload)) {
         const { main, target } = action.payload
-        console.log({ ...state, [main]: !state[main], [target]: !state[target] })
         return { ...state, [main]: !state[main], [target]: !state[target] }
       }
       if (isUnDef(state[action.payload])) {

+ 25 - 16
src/pages/Customer/Company/components/CompanyDetail/TabList.jsx

@@ -46,7 +46,8 @@ const CompanyTabList = ({ initData, customerId, client, software, customer, busi
         if (key !== defaultSelectedKey) {
           changePriority(key, id)
         }
-      }}>
+      }}
+    >
       <Menu.Item key="1">1</Menu.Item>
       <Menu.Item key="2">2</Menu.Item>
       <Menu.Item key="3">3</Menu.Item>
@@ -90,7 +91,10 @@ const CompanyTabList = ({ initData, customerId, client, software, customer, busi
       ellipsis: true,
       render: (clientName, record) => (
         <div className="text-primary hover:text-hex-967bbd">
-          <span onClick={() => dispatchModal('D_CLIENT_DETAIL', { dataId: record.id })} className="cursor-pointer ">
+          <span
+            onClick={() => dispatchModal('D_CLIENT_DETAIL', { dataId: record.id })}
+            className="cursor-pointer "
+          >
             {clientName}
           </span>
         </div>
@@ -123,9 +127,11 @@ const CompanyTabList = ({ initData, customerId, client, software, customer, busi
       render: (clientName, record) => (
         <span
           onClick={() => dispatchModal('D_LOCK_DETAIL', { dataId: record.id })}
-          className={['cursor-pointer hover:text-hex-967bbd', record.preserveStatus === 3 ? null : 'text-primary'].join(
-            ' '
-          )}>
+          className={[
+            'cursor-pointer hover:text-hex-967bbd',
+            record.preserveStatus === 3 ? null : 'text-primary'
+          ].join(' ')}
+        >
           {record.preserveStatus === 3 ? (
             <Text delete type="secondary">
               {clientName}
@@ -214,7 +220,8 @@ const CompanyTabList = ({ initData, customerId, client, software, customer, busi
       render: (text, record) => (
         <span
           onClick={() => dispatchModal('D_BUSINESS_DETAIL', { dataId: record.id })}
-          className="text-primary cursor-pointer hover:text-[#967bbd]">
+          className="text-primary cursor-pointer hover:text-[#967bbd]"
+        >
           {text}
         </span>
       )
@@ -260,6 +267,7 @@ const CompanyTabList = ({ initData, customerId, client, software, customer, busi
         payload: updatePayload
       })
     }
+    return code === consts.RET_CODE.SUCCESS
   }
 
   const handleAddClient = async values => {
@@ -298,14 +306,6 @@ const CompanyTabList = ({ initData, customerId, client, software, customer, busi
                 scroll={{ y: clientHeight }}
                 components={vList}
               />
-              {/* <Table
-                virtualized
-                scroll={{ y: clientHeight }}
-                border={false}
-                columns={columns}
-                data={client.client}
-                pagination={false}
-              /> */}
             </div>
           </TabPane>
           <TabPane tab={<span>软件锁{renderBadge(software.total, true)}</span>} key="2">
@@ -341,6 +341,15 @@ const CompanyTabList = ({ initData, customerId, client, software, customer, busi
       <div className="sheet-btns pl-15px pt-15px flex items-center">
         <Button
           type="primary"
+          ghost
+          size="small"
+          className="mr-1"
+          onClick={() => dispatchModal('M_RECORD_ADD', { onConfirm: handleAddCustomerService })}
+        >
+          <Plus className="mr-1" /> 添加服务记录
+        </Button>
+        <Button
+          type="primary"
           className="mr-1"
           size="small"
           ghost
@@ -355,11 +364,11 @@ const CompanyTabList = ({ initData, customerId, client, software, customer, busi
                 landmarks: customer.landmarks
               }
             })
-          }>
+          }
+        >
           <Plus className="mr-1" />
           客户
         </Button>
-        <AddRecord onConfirm={handleAddCustomerService} />
         <SyncClient actionPayload={updatePayload} customer={customer} client={client.client} />
       </div>
     </div>