Преглед изворни кода

feat: 增加云版相关菜单设置

lanjianrong пре 5 година
родитељ
комит
85f88994d9

+ 31 - 21
config/routes.js

@@ -104,28 +104,38 @@ export default [
           //   component: './Product/Lock/LockCount'
           // }
         ]
+      },
+      {
+        path: '/product/cloud',
+        name: 'cloud',
+        icon: 'icon-cloud',
+        routes: [
+          {
+            path: '/product/cloud',
+            redirect: '/product/cloud/building'
+          },
+          {
+            path: '/product/cloud/building',
+            name: 'build',
+            component: './Product/Cloud/Building'
+          },
+          {
+            path: '/product/cloud/curing',
+            name: 'curing',
+            component: './Product/Cloud/Curing'
+          },
+          {
+            path: '/product/cloud/highway',
+            name: 'highway',
+            component: './Product/Cloud/Highway'
+          },
+          {
+            path: '/product/cloud/gs',
+            name: 'gs',
+            component: './Product/Cloud/Gs'
+          }
+        ]
       }
-      // {
-      //   path: '/product/cloud',
-      //   name: 'cloud',
-      //   icon: 'icon-cloud',
-      //   routes: [
-      //     {
-      //       path: '/product/cloud',
-      //       redirect: '/product/cloud/building'
-      //     },
-      //     {
-      //       path: '/product/cloud/building',
-      //       name: 'build',
-      //       component: './Product/Cloud/Building'
-      //     },
-      //     {
-      //       path: '/product/cloud/curing',
-      //       name: 'curing',
-      //       component: './Product/Cloud/Curing'
-      //     }
-      //   ]
-      // }
     ]
   },
   {

+ 35 - 1
src/hooks/core/useWebSocketFn.ts

@@ -1,5 +1,6 @@
 /* eslint-disable react-hooks/rules-of-hooks */
 import { useWebSocket } from 'ahooks'
+import { notification } from 'antd'
 import { useEffect } from 'react'
 import { useModel } from 'umi'
 
@@ -15,6 +16,19 @@ export enum noticeType {
   Message = 2
 }
 
+// function noticeHandler (op) {}
+
+// function cmdReducer(cmd: cmdType, op: any) {
+//   switch (cmd) {
+//     case 13:
+
+//       break
+
+//     default:
+//       break
+//   }
+// }
+
 export default function useWebSocketFn() {
   const { initialState } = useModel('@@initialState')
 
@@ -25,7 +39,27 @@ export default function useWebSocketFn() {
     {
       manual: true,
       reconnectLimit: 3,
-      reconnectInterval: 2000
+      reconnectInterval: 2000,
+      onMessage: (message: WebSocketEventMap['message']) => {
+        const data = message && JSON.parse(message.data)
+        // console.log('data', data)
+        // cmdReducer(data.cmd)
+        if (data.cmd === cmdType.Notice) {
+          notification.warning({
+            message: '有新的版本更新, 请及时刷新页面',
+            description: data.title,
+            duration: null,
+            btn: (
+              <span
+                className="text-primary cursor-pointer hover:text-hex-967bbd"
+                onClick={() => window.location.reload()}
+              >
+                点击刷新
+              </span>
+            )
+          })
+        }
+      }
     }
   )
   useEffect(() => {

+ 2 - 0
src/locales/zh-CN/menu.js

@@ -14,6 +14,8 @@ export default {
   'menu.product.cloud': '云版管理',
   'menu.product.cloud.curing': '养护云造价',
   'menu.product.cloud.build': '大司空云计价',
+  'menu.product.cloud.highway': '公路云计价',
+  'menu.product.cloud.gs': '大司空概算',
   'menu.hr': '人资',
   'menu.hr.employee': '部门与员工',
   'menu.login': '登录',

+ 2 - 1
src/models/refresh.js

@@ -7,7 +7,8 @@ export default {
     longle: false,
     department: false,
     staffList: false,
-    business: false
+    business: false,
+    cloud: false
   },
   // 用于处理异步操作和业务逻辑,由action触发,但不能修改state
   effects: {

+ 0 - 5
src/pages/Product/Cloud/Building/index.jsx

@@ -14,11 +14,6 @@ export const roadpricingEnum = {
   GS: 4 // 大司空概算
 }
 
-// const CloudTable = () =>
-//   connect(({ cloud, refresh }) => ({
-//     cloud,
-//     shouldUpdate: refresh.cloud
-//   }))()
 const CloudTable = ({ columnStateType }) => {
   const dispatch = useDispatch()
   const { cloud } = useSelector(state => ({

+ 10 - 6
src/pages/Product/Lock/Lockstore/components/LocksDetail/LockModal.jsx

@@ -3,10 +3,10 @@ import { Modal, Form, Select, Input, Spin, Button, Radio, Popconfirm, message }
 import styles from './index.less'
 import { SearchOutlined } from '@ant-design/icons'
 import { queryClient } from '@/services/customer'
-import { queryLock } from '@/services/lock'
+import { queryLock } from '@/services/product'
 import consts from '@/basic/consts'
 import { useDebounceFn } from 'ahooks'
-import { apiSoftwareAddLonglelog } from '@/services/lock'
+import { apiSoftwareAddLonglelog } from '@/services/product'
 import { useDispatch, connect } from 'umi'
 // import { createUid } from '@/utils/utils'
 // import DragIniter from '@/components/Modal/src/components/DragIniter'
@@ -245,7 +245,8 @@ const LockModal = props => {
             </Button>
           </div>
         )
-      }>
+      }
+    >
       {type === lockTypeEnum.SALE ? (
         <div className="text-center mb-6">
           <Radio.Group value={state.sellStatus} buttonStyle="solid" onChange={checkGroupOnChange}>
@@ -260,7 +261,8 @@ const LockModal = props => {
           className={styles.modalContainer}
           ref={scrollRef}
           onScroll={handleListScroll}
-          style={{ paddingBottom: 0 }}>
+          style={{ paddingBottom: 0 }}
+        >
           <div className={styles.modalContent}>
             <Spin spinning={state.loading}>
               {type === lockTypeEnum.SALE &&
@@ -275,7 +277,8 @@ const LockModal = props => {
                         title="确认选择ta"
                         onConfirm={() => connectClient(item.id)}
                         okText="确认"
-                        cancelText="取消">
+                        cancelText="取消"
+                      >
                         <Button type="primary" size="small">
                           选择ta
                         </Button>
@@ -293,7 +296,8 @@ const LockModal = props => {
                         title="确认选择ta"
                         onConfirm={() => connectLongle(item.id)}
                         okText="确认"
-                        cancelText="取消">
+                        cancelText="取消"
+                      >
                         <Button type="primary" size="small">
                           更换
                         </Button>

+ 13 - 7
src/pages/Product/Lock/Lockstore/components/LocksDetail/TabList.jsx

@@ -2,7 +2,7 @@ import React, { useState } from 'react'
 import { Row, Col, List, Tabs, message, Button } from 'antd'
 import { dayjsFormat } from '@/utils/utils'
 import consts from '@/consts'
-import { apiSoftwareAddLonglelog } from '@/services/lock'
+import { apiSoftwareAddLonglelog } from '@/services/product'
 import { ProductLabel } from '@/pages/Product/Lock/LockStore'
 import LockModal, { lockTypeEnum } from './LockModal'
 import ClientDetail from '@/pages/Customer/Client/components/ClientDetail'
@@ -89,7 +89,8 @@ const LockTabList = props => {
                         {servicelogEnum[item.status]}{' '}
                         <span
                           className="textPurple text-hex-967bbd cursor-pointer"
-                          onClick={handleClientClick}>
+                          onClick={handleClientClick}
+                        >
                           {item.client}
                         </span>
                         <br />
@@ -120,7 +121,8 @@ const LockTabList = props => {
           className="mr-3px"
           onClick={() =>
             setAddLonglelog({ ...setAddLonglelog, visible: true, type: lockTypeEnum.SALE })
-          }>
+          }
+        >
           借出/销售/赠送
         </Button>
         <Button
@@ -130,7 +132,8 @@ const LockTabList = props => {
           className="mr-1"
           onClick={() =>
             setAddLonglelog({ ...setAddLonglelog, visible: true, type: lockTypeEnum.UPDATE })
-          }>
+          }
+        >
           升级
         </Button>
         <Button
@@ -144,7 +147,8 @@ const LockTabList = props => {
               visible: true,
               type: lockTypeEnum.CHANGE
             })
-          }>
+          }
+        >
           更换
         </Button>
         <Button
@@ -154,7 +158,8 @@ const LockTabList = props => {
           className="mr-1"
           onClick={() =>
             setAddLonglelog({ ...setAddLonglelog, visible: true, type: lockTypeEnum.RECOVER })
-          }>
+          }
+        >
           收回
         </Button>
         <Button
@@ -163,7 +168,8 @@ const LockTabList = props => {
           size="small"
           onClick={() =>
             setAddLonglelog({ ...setAddLonglelog, visible: true, type: lockTypeEnum.REMARK })
-          }>
+          }
+        >
           备注
         </Button>
 

+ 5 - 3
src/pages/Product/Lock/Lockstore/components/LocksDetail/index.jsx

@@ -1,7 +1,7 @@
 import React, { useState, useEffect } from 'react'
 import { Row, Col, Tooltip } from 'antd'
 import consts from '@/consts'
-import { apiSoftwareDetail } from '@/services/lock'
+import { apiSoftwareDetail } from '@/services/product'
 import LockForm from './Form.jsx'
 import LockLowerList from './LowerList'
 import LockTabList from './TabList'
@@ -55,7 +55,8 @@ const Index = props => {
             md={{ span: 24 }}
             lg={{ span: 9 }}
             xl={{ span: 9 }}
-            className="sheet-box-left">
+            className="sheet-box-left"
+          >
             {orderIds.length ? (
               <div className="mb-3">
                 <Tooltip title="上一条记录">
@@ -90,7 +91,8 @@ const Index = props => {
             md={{ span: 24 }}
             lg={{ span: 15 }}
             xl={{ span: 15 }}
-            className="sheet-box-right">
+            className="sheet-box-right"
+          >
             <LockTabList
               longleLog={state.longleLog}
               longleId={state.longle.id}

+ 3 - 2
src/pages/Product/Lock/Lockstore/components/ReceiveLock.jsx

@@ -2,7 +2,7 @@ import { Button, Input, message } from 'antd'
 import React, { useState, useRef } from 'react'
 import styles from '@/pages/Customer/Company/components/ConnectCompany/index.less'
 import consts from '@/basic/consts'
-import { apiReceiveOldLock, queryOldLockList } from '@/services/lock'
+import { apiReceiveOldLock, queryOldLockList } from '@/services/product'
 import { ProductLabel } from '../index'
 import ProTable from '@ant-design/pro-table'
 import CustomModal from '@/components/Modal/src/components/CustomModal'
@@ -68,7 +68,8 @@ const ReceiveLock = ({ refresh }) => {
             onSearch={handleOnSearch}
           />
         </div>
-      }>
+      }
+    >
       <div className={styles.modalContent}>
         <ProTable
           rowKey={record => record.id}

+ 3 - 2
src/pages/Product/Lock/Lockstore/components/ReceiveNewLock.jsx

@@ -2,7 +2,7 @@ import { Button, Input, message } from 'antd'
 import React, { useRef, useState } from 'react'
 import styles from '@/pages/Customer/Company/components/ConnectCompany/index.less'
 import consts from '@/basic/consts'
-import { apiReceiveLock, queryReceiveList } from '@/services/lock'
+import { apiReceiveLock, queryReceiveList } from '@/services/product'
 import { ProductLabel } from '../index'
 import ProTable from '@ant-design/pro-table'
 import CustomModal from '@/components/Modal/src/components/CustomModal'
@@ -64,7 +64,8 @@ const ReceiveNewLock = ({ refresh }) => {
             onSearch={handleOnSearch}
           />
         </div>
-      }>
+      }
+    >
       <div className={styles.modalContent}>
         <ProTable
           rowKey={record => record.id}

+ 9 - 5
src/pages/Product/Lock/Lockstore/index.jsx

@@ -2,7 +2,7 @@ import React, { useEffect, useState, useRef } from 'react'
 import { Tag, Select, Tooltip, Input, DatePicker, Button } from 'antd'
 import consts from '@/consts'
 import { useModel, connect } from 'umi'
-import { queryLock } from '@/services/lock'
+import { queryLock } from '@/services/product'
 import LocksDetail from '@/pages/Product/Lock/LockStore/components/LocksDetail'
 import ContactDetail from '@/pages/Customer/Client/components/ClientDetail'
 import SoftwareDetail from '@/pages/Product/Lock/LockStore/components/SoftwareDetail'
@@ -193,7 +193,8 @@ const LockStore = ({ prodList = [], dispatch, shouldUpdate }) => {
       render: (keyNum, record) => (
         <span
           onClick={() => showDrawer(record.id)}
-          className="text-primary cursor-pointer hover:text-[#967bbd]">
+          className="text-primary cursor-pointer hover:text-[#967bbd]"
+        >
           {keyNum}
         </span>
       )
@@ -282,7 +283,8 @@ const LockStore = ({ prodList = [], dispatch, shouldUpdate }) => {
       render: (text, record) => (
         <span
           onClick={() => showDrawerResponsible(record.responsibleId)}
-          className="text-primary cursor-pointer hover:text-[#967bbd]">
+          className="text-primary cursor-pointer hover:text-[#967bbd]"
+        >
           {text}
         </span>
       )
@@ -294,7 +296,8 @@ const LockStore = ({ prodList = [], dispatch, shouldUpdate }) => {
       render: (text, record) => (
         <span
           onClick={() => showCompanyDrawer(record.customerId)}
-          className="text-primary cursor-pointer hover:text-[#967bbd]">
+          className="text-primary cursor-pointer hover:text-[#967bbd]"
+        >
           {text}
         </span>
       )
@@ -306,7 +309,8 @@ const LockStore = ({ prodList = [], dispatch, shouldUpdate }) => {
       render: (text, record) => (
         <span
           onClick={() => showDrawerClient(record.clientId)}
-          className="text-primary cursor-pointer hover:text-[#967bbd]">
+          className="text-primary cursor-pointer hover:text-[#967bbd]"
+        >
           {text}
         </span>
       )

+ 14 - 0
src/services/lock.js

@@ -55,3 +55,17 @@ export async function apiReceiveLock(params) {
     data: params
   })
 }
+
+/** 云版产品列表 */
+export async function queryRoadpricingList(params) {
+  return request.post('/RoadPricing/list', {
+    data: params
+  })
+}
+
+/** 编办列表 */
+export async function queryCompilationList(params) {
+  return request('/RoadPricing/compilation', {
+    params
+  })
+}

+ 9 - 1
src/utils/cache/cacheEnum.ts

@@ -42,7 +42,15 @@ export enum ColumnStateEnum {
   /** @name 公共锁库 */
   LOCKSTORE = 'LOCKSTORE',
   /** @name 部门与员工 */
-  EMPLOYEE = 'EMPLOYEE'
+  EMPLOYEE = 'EMPLOYEE',
+  /** @name  养护云造价 */
+  CURING = 'CURING',
+  /** @name  大司空云计价 */
+  BUILDING = 'BUILDING',
+  /** @name  公路云造价 */
+  HIGHWAY = 'HIGHWAY',
+  /** @name  大司空概算 */
+  GS = 'GS'
 }
 export enum CacheTypeEnum {
   SESSION,