فهرست منبع

Merge branch 'master' of http://192.168.1.41:3000/outaozhen/cldV2react

outaozhen 5 سال پیش
والد
کامیت
65689435f9

+ 6 - 6
config/routes.js

@@ -25,7 +25,7 @@ export default [
             routes: [
               {
                 path: '/',
-                redirect: '/Customer/Contact'
+                redirect: '/customer/contact'
               },
               {
                 path: '/workbench',
@@ -34,7 +34,7 @@ export default [
                 routes: [
                   {
                     path: '/workbench',
-                    redirect: '/Workbench/Dashboard'
+                    redirect: '/workbench/dashboard'
                   },
                   {
                     path: '/workbench/dashboard',
@@ -98,17 +98,17 @@ export default [
                     routes: [
                       {
                         path: '/product/lock',
-                        redirect: '/Product/Lock/Lockstore'
+                        redirect: '/product/lock/lockstore'
                       },
                       {
                         path: '/product/lock/lockstore',
                         name: 'lockstore',
-                        component: './Product/Lock/Lockstore'
+                        component: './Product/Lock/LockStore'
                       },
                       {
                         path: '/product/lock/lockcount',
                         name: 'lockcount',
-                        component: './Product/Lock/Lockcount'
+                        component: './Product/Lock/LockCount'
                       }
                     ]
                   },
@@ -119,7 +119,7 @@ export default [
                     routes: [
                       {
                         path: '/product/cloud',
-                        redirect: '/Product/Cloud/Building'
+                        redirect: '/product/cloud/building'
                       },
                       {
                         path: '/product/cloud/building',

+ 3 - 1
src/pages/Customer/Business/components/AddBusiness.jsx

@@ -56,7 +56,9 @@ const AddBusiness = props => {
                 label="商机状态"
                 options={groupList
                   .find(item => item.value === businessGroupId)
-                  ?.items?.map(i => ({ label: i.name, value: i.id }))}
+                  ?.items?.filter(item => !item.endProcess)
+                  ?.sort((a, b) => a.sort - b.sort)
+                  ?.map(i => ({ label: i.name, value: i.id }))}
                 required
               />
             )}

+ 59 - 36
src/pages/Customer/Company/components/AddCompany/index.jsx

@@ -1,12 +1,15 @@
-import React, { useEffect } from 'react'
+import React, { useState, useRef, useEffect } from 'react'
 import { Form, Row, Col, Button } from 'antd'
+import { validCascaderRule } from '@/components/LazyCascader'
 import LazyCascader from '@/components/LazyCascader'
-import { ModalForm, ProFormSelect, ProFormText } from '@ant-design/pro-form'
+import { ModalForm, ProFormText, ProFormCheckbox } from '@ant-design/pro-form'
+import { PlusOutlined } from '@ant-design/icons'
 import { connect } from 'dva'
-import { Plus } from '@icon-park/react'
+import { ChangeCompMap } from '../../../Contact/components/ChangeCompany'
 
-const AddCompany = props => {
-  const { natures, onConfirm, dispatch } = props
+const AddCompanyModal = ({ dataId, dataType, onConfirm, dispatch, natures }) => {
+  const formRef = useRef()
+  // const [modalVisible, setModalVisible] = useState(false)
   const layout = {
     layout: 'horizontal',
     labelCol: { flex: '100px' }
@@ -19,14 +22,41 @@ const AddCompany = props => {
     }
     !natures.length && getNatures()
   }, [])
+  const [showDataItem, setShowDataItem] = useState(false)
   return (
     <ModalForm
-      title="添加客户"
+      formRef={formRef}
+      title="添加新客户"
       {...layout}
+      // visible={modalVisible}
+      // onVisibleChange={setModalVisible}
+      submitter={{
+        render: ({ submit }, defaultDoms) => [
+          ...defaultDoms,
+          dataId ? (
+            <Button
+              type="primary"
+              key="2"
+              onClick={() => {
+                setShowDataItem(true)
+                const values = {}
+                if (dataType === ChangeCompMap.CLIENT.key) {
+                  values.clientId = dataId
+                }
+                if (dataType === ChangeCompMap.BUSINESS.key) {
+                  values.businessId = dataId
+                }
+                formRef.current && formRef.current.setFieldsValue(values)
+                submit()
+              }}>
+              添加并关联
+            </Button>
+          ) : null
+        ]
+      }}
       trigger={
-        <Button key="button" type="primary" className="mr-1">
-          <Plus theme="filled" className="mr-1" />
-          <span>客户</span>
+        <Button prefix={<PlusOutlined />} type="primary">
+          添加新客户
         </Button>
       }
       onFinish={async values => {
@@ -35,43 +65,36 @@ const AddCompany = props => {
       }}>
       <ProFormText
         name="companyName"
-        label="公司全称"
-        rules={[{ required: true, message: '请输入公司全称' }]}
-      />
-      <Row>
-        <Col span={10}>
-          <Form.Item
-            label="公司地区"
-            name="district"
-            rules={[{ required: true, message: '请选择公司地区' }]}>
-            <LazyCascader />
-          </Form.Item>
-        </Col>
-        <Col span={14}>
-          <ProFormSelect label="公司性质" name="natureIds" options={natures} mode="multiple" />
-        </Col>
-      </Row>
-      <ProFormText
-        name="address"
-        label="公司地址"
-        rules={[{ required: true, message: '请填写公司地址' }]}
+        label="客户名称"
+        placeholder="请输入客户全称"
+        rules={[{ required: true, message: '请输入客户全称' }]}
       />
+      {showDataItem ? <ProFormText name={`${dataType}Id`} hidden /> : null}
+      <Form.Item
+        name="district"
+        label="客户地区"
+        required={true}
+        rules={[{ validator: validCascaderRule }]}>
+        <LazyCascader />
+      </Form.Item>
+      <ProFormCheckbox.Group name="natureIds" label="客户性质" options={natures} />
+      <ProFormText name="address" label="客户地址" placeholder="" rules={[{ required: true }]} />
       <Row>
         <Col span={12}>
-          <ProFormText name="fax" label="公司传真" />
+          <ProFormText name="fax" label="客户传真" placeholder="" />
+          <ProFormText name="ride" label="乘车路线" placeholder="" />
+          <ProFormText name="stay" label="参考住宿" placeholder="" />
         </Col>
         <Col span={12}>
-          <ProFormText name="webservice" label="网址" />
+          <ProFormText name="webservice" label="网址" placeholder="" />
+          <ProFormText name="landmarks" label="地标建筑" placeholder="" />
+          <ProFormText name="remarks" label="备注" placeholder="" />
         </Col>
       </Row>
-      <ProFormText name="ride" label="乘车路线" />
-      <ProFormText name="landmarks" label="地标建筑" />
-      <ProFormText name="stay" label="参考住宿" />
-      <ProFormText name="remarks" label="备注" />
     </ModalForm>
   )
 }
 
 export default connect(({ customer }) => ({
   natures: customer.natures
-}))(AddCompany)
+}))(AddCompanyModal)

+ 0 - 98
src/pages/Customer/Contact/components/AddCustomerModal/index.jsx

@@ -1,98 +0,0 @@
-import React, { useState, useRef, useEffect } from 'react'
-import { Form, Row, Col, Button } from 'antd'
-import { validCascaderRule } from '@/components/LazyCascader'
-import LazyCascader from '@/components/LazyCascader'
-import { ModalForm, ProFormText, ProFormCheckbox } from '@ant-design/pro-form'
-import { PlusOutlined } from '@ant-design/icons'
-import { connect } from 'dva'
-import { ChangeCompMap } from '../ChangeCompany'
-
-const AddCustomerModal = ({ dataId, dataType, onConfirm, dispatch, natures }) => {
-  const formRef = useRef()
-  const [modalVisible, setModalVisible] = useState(false)
-  const layout = {
-    layout: 'horizontal',
-    labelCol: { flex: '100px' }
-  }
-  useEffect(() => {
-    const getNatures = () => {
-      dispatch({
-        type: 'customer/fetch'
-      })
-    }
-    !natures.length && getNatures()
-  }, [])
-  const [showDataItem, setShowDataItem] = useState(false)
-  return (
-    <ModalForm
-      formRef={formRef}
-      title="添加新客户"
-      {...layout}
-      visible={modalVisible}
-      onVisibleChange={setModalVisible}
-      submitter={{
-        render: ({ submit }, defaultDoms) => [
-          ...defaultDoms,
-          <Button
-            type="primary"
-            key="2"
-            onClick={() => {
-              setShowDataItem(true)
-              const values = {}
-              if (dataType === ChangeCompMap.CLIENT.key) {
-                values.clientId = dataId
-              }
-              if (dataType === ChangeCompMap.BUSINESS.key) {
-                values.businessId = dataId
-              }
-              formRef.current && formRef.current.setFieldsValue(values)
-              submit()
-            }}>
-            添加并关联
-          </Button>
-        ]
-      }}
-      trigger={
-        <Button prefix={<PlusOutlined />} onClick={() => setModalVisible(true)} type="primary">
-          添加新客户
-        </Button>
-      }
-      onFinish={async values => {
-        await onConfirm(values)
-        return true
-      }}>
-      <ProFormText
-        name="companyName"
-        label="客户名称"
-        placeholder="请输入客户全称"
-        rules={[{ required: true, message: '请输入客户全称' }]}
-      />
-      {showDataItem ? <ProFormText name={`${dataType}Id`} hidden /> : null}
-      <Form.Item
-        name="district"
-        label="客户地区"
-        required={true}
-        rules={[{ validator: validCascaderRule }]}>
-        <LazyCascader />
-      </Form.Item>
-      <ProFormCheckbox.Group name="natureIds" label="客户性质" options={natures} />
-      <ProFormText name="address" label="客户地址" placeholder="" rules={[{ required: true }]} />
-      <Row>
-        <Col span={12}>
-          <ProFormText name="fax" label="客户传真" placeholder="" />
-          <ProFormText name="ride" label="乘车路线" placeholder="" />
-          <ProFormText name="stay" label="参考住宿" placeholder="" />
-        </Col>
-        <Col span={12}>
-          <ProFormText name="webservice" label="网址" placeholder="" />
-          <ProFormText name="landmarks" label="地标建筑" placeholder="" />
-          <ProFormText name="remarks" label="备注" placeholder="" />
-        </Col>
-      </Row>
-    </ModalForm>
-  )
-}
-
-export default connect(({ customer }) => ({
-  natures: customer.natures
-}))(AddCustomerModal)

+ 3 - 3
src/pages/Customer/Contact/components/CustomerModal/index.jsx

@@ -4,7 +4,7 @@ import styles from './index.less'
 import { SearchOutlined, CloseOutlined } from '@ant-design/icons'
 import { useDebounceFn } from 'ahooks'
 import { useDispatch } from 'dva'
-import AddCustomerModal from '../AddCustomerModal'
+import AddCompany from '@/pages/Customer/Company/components/AddCompany'
 import { createCustomer, queryCustomers } from '@/services/customer'
 import consts from '@/basic/consts'
 import { formatValues } from '@/components/LazyCascader'
@@ -61,7 +61,7 @@ const SearchModal = ({ dataId, onSelect, preUrl }) => {
     const payload = formatValues(values)
     const { code = -1, msg = '新增成功' } = await createCustomer(payload)
     if (code === consts.RET_CODE.SUCCESS) {
-      if (Object.hasOwnProperty.call(values, 'clientId')) {
+      if (Object.hasOwnProperty.call(values, `${preUrl}Id`)) {
         message.success('新增成功并且绑定成功')
         onSelect(values.companyName)
         closeModal()
@@ -124,7 +124,7 @@ const SearchModal = ({ dataId, onSelect, preUrl }) => {
         </Spin>
       </div>
       <div className={styles.modalFooter}>
-        <AddCustomerModal onConfirm={addConfirm} dataId={dataId} dataType={preUrl} />
+        <AddCompany onConfirm={addConfirm} dataId={dataId} dataType={preUrl} />
       </div>
     </div>
   )

+ 5 - 1
src/pages/Product/Lock/Lockstore/components/LocksDetail/LockForm.jsx

@@ -1,6 +1,10 @@
-import React, { useEffect } from 'react'
+import React from 'react'
 import { Row, Col, Divider } from 'antd'
+<<<<<<< HEAD
 import { ProductLabel } from '@/pages/Product/Lock/Lockstore'
+=======
+import { ProductLabel } from '@/pages/Product/Lock/LockStore'
+>>>>>>> ce41012c72a93a1241284d7c982dc65b09393eba
 
 // import EditableForm from '@/components/EditableForm'
 

+ 4 - 0
src/pages/Product/Lock/Lockstore/components/LocksDetail/LockTabList.jsx

@@ -3,7 +3,11 @@ import { Row, Col, List, Tabs, message, Button } from 'antd'
 import { dayjsFormat } from '@/utils/utils'
 import consts from '@/consts'
 import { apiSoftwareAddLonglelog } from '@/services/lock'
+<<<<<<< HEAD
 import { ProductLabel } from '@/pages/Product/Lock/Lockstore'
+=======
+import { ProductLabel } from '@/pages/Product/Lock/LockStore'
+>>>>>>> ce41012c72a93a1241284d7c982dc65b09393eba
 import LockModal from './LockModal'
 import { lockTypeEnum } from './LockModal'
 import { servicelogEnum, showProductsStatus, showNewLongleStatus, showMarkStatus } from './consts'

+ 6 - 0
src/pages/Product/Lock/Lockstore/components/LocksDetail/index.jsx

@@ -2,9 +2,15 @@ import React, { useState, useEffect } from 'react'
 import { Row, Col } from 'antd'
 import consts from '@/consts'
 import { apiSoftwareDetail } from '@/services/lock'
+<<<<<<< HEAD
 import LockForm from '@/pages/Product/lock/Lockstore/components/LocksDetail/LockForm.jsx'
 import LockLowerList from '@/pages/Product/Lock/Lockstore/components/LocksDetail/LockLowerList'
 import LockTabList from '@/pages/Product/Lock/Lockstore/components/LocksDetail/LockTabList'
+=======
+import LockForm from './LockForm.jsx'
+import LockLowerList from './LockLowerList'
+import LockTabList from './LockTabList'
+>>>>>>> ce41012c72a93a1241284d7c982dc65b09393eba
 import { connect } from 'dva'
 
 const Index = props => {

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

@@ -3,7 +3,7 @@ import { Tag } from 'antd'
 import ProTable from '@ant-design/pro-table'
 import consts from '@/consts'
 import { queryLock } from '@/services/lock'
-import LocksDetail from '@/pages/Product/lock/Lockstore/components/LocksDetail'
+import LocksDetail from '@/pages/Product/Lock/LockStore/components/LocksDetail'
 import { useModal } from '@/components/Modal'
 import { useTableScroll } from '@/hooks/useAutoTable'
 
@@ -37,8 +37,8 @@ const longleStatusNum = {
   9: '赠送'
 }
 
-const Lockstore = () => {
-  const [selectKeys, setSelectKeys] = useState([])
+const LockStore = () => {
+  const [selectKeys] = useState([])
   const { toggleDrawer, setDrawerProps } = useModal()
   const [state, setState] = useState({
     params: {},
@@ -161,4 +161,4 @@ const Lockstore = () => {
   )
 }
 
-export default Lockstore
+export default LockStore