outaozhen 5 gadi atpakaļ
vecāks
revīzija
15d6da3872

+ 1 - 0
src/components/EditableForm/editableForm.jsx

@@ -27,6 +27,7 @@ const EditableForm = ({ dataSource, columns, type, tartgetUrl }) => {
       {newColumns.map(column => {
         return (
           <EditableFormItem
+            type={type}
             key={column.dataIndex}
             label={column.label}
             dataSource={dataSource}

+ 6 - 1
src/components/EditableForm/editableFormItem.jsx

@@ -7,6 +7,7 @@ import { connect } from 'dva'
 import './index.less'
 
 const EditableFormItem = ({
+  type,
   label,
   dataSource,
   dataIndex,
@@ -68,6 +69,10 @@ const EditableFormItem = ({
     const { code = -1 } = await editFormApi(requestUrl, { ...params })
     if (code === consts.RET_CODE.SUCCESS) {
       toggleEdit()
+      dispatch({
+        type: 'refresh/commitAction',
+        payload: type
+      })
     }
   }
   const save = async e => {
@@ -127,7 +132,7 @@ const EditableFormItem = ({
             defaultValue={val}
             // onChange={handleOnChange}
           />
-          )
+        )
         break
       default:
         cell = (

+ 6 - 1
src/components/PopContent/Contacts/ContanctForm.jsx

@@ -127,7 +127,12 @@ const ContanctForm = props => {
           {client.staffName} 创建于{client.createTime}
         </Col>
       </Row>
-      <EditableForm dataSource={client} columns={columns} tartgetUrl="/api/client/update" />
+      <EditableForm
+        dataSource={client}
+        columns={columns}
+        tartgetUrl="/api/client/update"
+        type="contact"
+      />
     </div>
   )
 }

+ 3 - 7
src/components/PopContent/Contacts/ContanctLowerList.jsx

@@ -10,9 +10,7 @@ const ContanctLowerList = props => {
     servicelist,
     collapsed
   } = props
-  useEffect(() => {
-    // console.log(log)
-  }, [])
+
   // console.log(servicelist)
   const { TabPane } = Tabs
   const needSubtractHeight = 48 + 48 + 48 + 64 + 24 // 需要被裁掉的高度
@@ -73,8 +71,6 @@ const ContanctLowerList = props => {
 
 export default ContanctLowerList
 
-// export default connect(({ journallist, servicelist, loading }) => ({
-//   journalName: journallist,
-//   servicelistName: servicelist,
-//   getlist: loading.effects['journallist/fetch']
+// export default connect(({ refresh }) => ({
+//   shouldUpdate: refresh.contactLog
 // }))(ContanctLowerList)

+ 14 - 8
src/components/PopContent/Contacts/index.jsx

@@ -7,9 +7,10 @@ import ContanctLowerList from '@/components/PopContent/Contacts/ContanctLowerLis
 import { apiContactDetail } from '@/services/contact'
 import useAutoTable from '@/hooks/useAutoTable'
 import consts from '@/consts'
+import { connect } from 'dva'
 
 const Popcontent = props => {
-  const { visible, onClose, collapsed, id = '' } = props
+  const { dispatch, shouldUpdate, visible, onClose, collapsed, id = '' } = props
   const needSubtractHeight = 55 // 需要被裁掉的高度
   // const needSubtractWidth = (collapsed ? 208 : 48) + 48 + 48 + 48 // 需要被裁掉的高度
   const [x, y] = useAutoTable(collapsed, needSubtractHeight)
@@ -28,11 +29,17 @@ const Popcontent = props => {
       code = -1
     } = await apiContactDetail(id)
     if (code === consts.RET_CODE.SUCCESS) {
+      if (shouldUpdate) {
+        dispatch({
+          type: 'refresh/commitAction',
+          payload: 'contact'
+        })
+      }
       setState({ ...state, client, log, serviceLog })
     }
   }
   useEffect(() => {
-    if (visible) {
+    if (visible || shouldUpdate) {
       initData()
     }
     window.addEventListener('resize', () => {
@@ -41,7 +48,7 @@ const Popcontent = props => {
     return () => {
       window.removeEventListener('resize', () => {})
     }
-  }, [visible])
+  }, [visible, shouldUpdate])
   return (
     <div>
       <div className="sheet-box">
@@ -75,9 +82,8 @@ const Popcontent = props => {
   )
 }
 
-export default Popcontent
+// export default Popcontent
 
-// export default connect(({ journallist, loading }) => ({
-//   journalName: journallist,
-//   getlist: loading.effects['journallist/fetch']
-// }))(Popcontent)
+export default connect(({ refresh }) => ({
+  shouldUpdate: refresh.contact
+}))(Popcontent)

+ 1 - 1
src/models/refresh.js

@@ -1,7 +1,7 @@
 export default {
   namespace: 'refresh',
   state: {
-    contactLog: false
+    contact: false
   },
   // 用于处理异步操作和业务逻辑,由action触发,但不能修改state
   effects: {

+ 1 - 1
src/pages/Product/Lock/Lockstore/index.jsx

@@ -62,7 +62,7 @@ const Lockstore = props => {
       dataIndex: 'product',
       key: 'product',
       width: 350,
-      render: text => {
+      render: (text, record) => {
         const productArr = text.split('+')
         return (
           <div>