Selaa lähdekoodia

feat: 大司空2.0个人版相关接口调整

outaozhen 4 vuotta sitten
vanhempi
commit
bdb9b72f0a

+ 1 - 1
config/proxy.js

@@ -8,7 +8,7 @@
 export default {
   dev: {
     '/api/': {
-      target: 'http://cld2.com',
+      target: 'http://cld2qa.com',
       changeOrigin: true,
       pathRewrite: {
         '^': ''

+ 4 - 0
src/app.tsx

@@ -109,10 +109,14 @@ const errorHandler = error => {
     }
     switch (showType) {
       case ErrorShowType.ERROR_MESSAGE:
+        console.log('error', showType === ErrorShowType.ERROR_MESSAGE)
+
         message.error(errorMessage)
       case ErrorShowType.WARN_MESSAGE:
+        console.log('warn', showType === ErrorShowType.WARN_MESSAGE)
         message.warn(errorMessage)
       case ErrorShowType.NOTIFICATION:
+        console.log('noti', showType === ErrorShowType.NOTIFICATION)
         const title = consts.TOKEN_INVALID_CODE.includes(errorCode) ? '用户信息过期' : '请求失败'
         notification.error({
           message: title,

+ 7 - 22
src/pages/Product/Road/Personal/components/Detail/Form.jsx

@@ -1,6 +1,7 @@
 import React from 'react'
 import { Row, Col } from 'antd'
 import EditableForm from '@/components/EditableForm'
+import { dayjsFormat } from '@/utils/utils'
 
 const PersonalForm = props => {
   const { cloudUser, updateKey, projectType } = props
@@ -24,22 +25,17 @@ const PersonalForm = props => {
       span: 24
     },
     {
-      dataIndex: 'qq',
-      label: 'QQ',
-      editable: false,
-      span: 24
-    },
-    {
-      dataIndex: 'real_name',
+      dataIndex: 'realName',
       label: '真实姓名',
       editable: false,
       span: 24
     },
     {
-      dataIndex: 'create_time',
+      dataIndex: 'createTime',
       label: '注册云版',
       editable: false,
-      span: 24
+      span: 24,
+      renderText: text => dayjsFormat(text, 'YYYY-MM-DD HH:mm')
     },
     {
       dataIndex: 'company',
@@ -48,13 +44,7 @@ const PersonalForm = props => {
       span: 24
     },
     {
-      dataIndex: 'province',
-      label: '企业地区',
-      editable: false,
-      span: 24
-    },
-    {
-      dataIndex: 'latest_usedName',
+      dataIndex: 'latestUsedName',
       label: '最近使用',
       editable: false,
       span: 24
@@ -80,12 +70,7 @@ const PersonalForm = props => {
         </Col>
         <Col span={2} />
       </Row>
-      <EditableForm
-        dataSource={cloudUser}
-        columns={columns}
-        tartgetUrl="/cloud/update"
-        type={updateKey}
-      />
+      <EditableForm dataSource={cloudUser} columns={columns} tartgetUrl="/cloud/update" type={updateKey} />
     </div>
   )
 }

+ 98 - 61
src/pages/Product/Road/Personal/components/Detail/TabList.jsx

@@ -12,19 +12,36 @@ import {
   modalTitleEnum
 } from '@/pages/Product/Cloud/components/Detail/UpgradeModal'
 import { apiRoadPricingUpgradeV2 } from '@/services/product'
+import { dayjsFormat } from '@/utils/utils'
 
 const PersonalTabList = props => {
   const {
-    compilationList,
-    cloudUser: { online_list = [], mobile, username },
+    // compilationList,
+    cloudUser: {
+      // online_list = [],
+      mobile,
+      username,
+      proCptList
+    },
     projectType,
     ssoId,
     actionPayload = { main: 'personal' }
   } = props
+  console.log(proCptList)
   const isUpgradeEnum = {
     true: '已升级',
     undefined: ''
   }
+  const salesTypeEnum = {
+    GIFT: 'gift',
+    SALES: 'sales',
+    LEND: 'lend'
+  }
+  const salesTypeTitle = {
+    gift: '赠送',
+    sales: '销售',
+    lend: '借出'
+  }
   const { TabPane } = Tabs
   const dispatch = useDispatch()
   const [roadPricingUpgradev2, setRoadPricingUpgradev2] = useState({
@@ -34,6 +51,7 @@ const PersonalTabList = props => {
     upgradeTypeEnum: '',
     compilationListName: '',
     deadline: '',
+    salesType: '',
     lockTypeEnum: '',
     visible: false,
     loading: false
@@ -64,47 +82,23 @@ const PersonalTabList = props => {
     },
     {
       title: '状态',
-      dataIndex: 'lock',
+      dataIndex: 'salesType',
       onFilter: true,
       width: '8%',
-      render: lock => <span>{isUpgradeEnum[lock]}</span>
-    },
-    {
-      title: '专业版',
-      dataIndex: 'isUpgrade',
-      width: '10%',
-      render: isUpgrade => <span>{isUpgradeEnum[isUpgrade]}</span>
+      render: salesType => <span>{salesTypeTitle[salesType]}</span>
     },
     {
       title: '限期',
       dataIndex: 'deadline',
-      width: '10%'
+      width: '10%',
+      render: text => dayjsFormat(text, 'YYYY-MM-DD HH:mm')
     },
     {
       title: '操作',
       width: '25%',
       render: (_, record) => (
         <>
-          <Button
-            type="primary"
-            ghost
-            size="small"
-            className="m-2px"
-            onClick={() =>
-              setRoadPricingUpgradev2({
-                ...setRoadPricingUpgradev2,
-                visible: true,
-                type: titleType.GIVE,
-                // eslint-disable-next-line no-underscore-dangle
-                compilationId: record._id,
-                compilationName: record.name,
-                lockTypeEnum: lockTypeEnum.GIVE,
-                upgradeTypeEnum: upgradeTypeEnum.UPGRADE
-              })
-            }>
-            赠送
-          </Button>
-          {record.lock === 1 ? (
+          {record.activated ? (
             <>
               <Button
                 type="primary"
@@ -116,8 +110,9 @@ const PersonalTabList = props => {
                     ...setRoadPricingUpgradev2,
                     visible: true,
                     type: titleType.SALE,
+                    salesType: salesTypeEnum.SALES,
                     // eslint-disable-next-line no-underscore-dangle
-                    compilationId: record._id,
+                    compilationId: record.ID,
                     compilationName: record.name,
                     lockTypeEnum: lockTypeEnum.SALE,
                     upgradeTypeEnum: upgradeTypeEnum.UPGRADE
@@ -125,10 +120,6 @@ const PersonalTabList = props => {
                 }>
                 销售
               </Button>
-            </>
-          ) : null}
-          {record.isUpgrade ? (
-            <>
               <Button
                 type="primary"
                 ghost
@@ -138,19 +129,63 @@ const PersonalTabList = props => {
                   setRoadPricingUpgradev2({
                     ...setRoadPricingUpgradev2,
                     visible: true,
-                    type: titleType.DEMOTION,
+                    salesType: salesTypeEnum.GIFT,
+                    type: titleType.GIVE,
                     // eslint-disable-next-line no-underscore-dangle
-                    compilationId: record._id,
+                    compilationId: record.ID,
                     compilationName: record.name,
-                    compilationListName: record.name,
-                    upgradeTypeEnum: upgradeTypeEnum.DEMOTION
+                    lockTypeEnum: lockTypeEnum.GIVE,
+                    upgradeTypeEnum: upgradeTypeEnum.UPGRADE
                   })
                 }>
-                降级
+                赠送
               </Button>
               <Button
                 type="primary"
                 ghost
+                size="small"
+                className="m-2px"
+                onClick={() =>
+                  setRoadPricingUpgradev2({
+                    ...setRoadPricingUpgradev2,
+                    visible: true,
+                    type: titleType.LEND,
+                    salesType: salesTypeEnum.LEND,
+                    compilationId: record.ID,
+                    compilationName: record.name,
+                    lockTypeEnum: lockTypeEnum.LEND,
+                    upgradeTypeEnum: upgradeTypeEnum.UPGRADE
+                  })
+                }>
+                借出
+              </Button>
+            </>
+          ) : null}
+          {/* <Button
+            type="primary"
+            ghost
+            size="small"
+            className="m-2px"
+            onClick={() =>
+              setRoadPricingUpgradev2({
+                ...setRoadPricingUpgradev2,
+                visible: true,
+                salesType: salesTypeEnum.GIFT,
+                type: titleType.GIVE,
+                // eslint-disable-next-line no-underscore-dangle
+                compilationId: record.ID,
+                compilationName: record.name,
+                lockTypeEnum: lockTypeEnum.GIVE,
+                upgradeTypeEnum: upgradeTypeEnum.UPGRADE
+              })
+            }>
+            赠送
+          </Button> */}
+          {/* {record.isUpgrade ? (
+            <>
+              <Button
+                type="primary"
+                ghost
                 danger
                 size="small"
                 onClick={() =>
@@ -160,7 +195,7 @@ const PersonalTabList = props => {
                     type: titleType.DEADLINE,
                     deadline: record.deadline,
                     // eslint-disable-next-line no-underscore-dangle
-                    compilationId: record._id,
+                    compilationId: record.ID,
                     compilationName: record.name,
                     compilationListName: record.name,
                     lockTypeEnum: record.lock,
@@ -182,7 +217,8 @@ const PersonalTabList = props => {
                     ...setRoadPricingUpgradev2,
                     visible: true,
                     type: titleType.LEND,
-                    compilationId: record._id,
+                    salesType: salesTypeEnum.LEND,
+                    compilationId: record.ID,
                     compilationName: record.name,
                     lockTypeEnum: lockTypeEnum.LEND,
                     upgradeTypeEnum: upgradeTypeEnum.UPGRADE
@@ -200,7 +236,8 @@ const PersonalTabList = props => {
                     ...setRoadPricingUpgradev2,
                     visible: true,
                     type: titleType.SALE,
-                    compilationId: record._id,
+                    salesType: salesTypeEnum.SALES,
+                    compilationId: record.ID,
                     compilationName: record.name,
                     lockTypeEnum: lockTypeEnum.SALE,
                     upgradeTypeEnum: upgradeTypeEnum.UPGRADE
@@ -209,23 +246,23 @@ const PersonalTabList = props => {
                 销售
               </Button>
             </>
-          )}
+          )} */}
         </>
       )
     }
   ]
-  const columnOnline = [
-    {
-      title: '日期',
-      dataIndex: 'dateString',
-      width: '12%'
-    },
-    {
-      title: '时长',
-      dataIndex: 'online_times',
-      width: '17%'
-    }
-  ]
+  // const columnOnline = [
+  //   {
+  //     title: '日期',
+  //     dataIndex: 'dateString',
+  //     width: '12%'
+  //   },
+  //   {
+  //     title: '时长',
+  //     dataIndex: 'online_times',
+  //     width: '17%'
+  //   }
+  // ]
   return (
     <div>
       <div className="pl-15px">
@@ -237,13 +274,13 @@ const PersonalTabList = props => {
                 columns={columns}
                 search={false}
                 toolBarRender={false}
-                rowKey={record => record._id}
-                dataSource={compilationList}
+                rowKey={record => record.ID}
+                dataSource={proCptList}
                 pagination={false}
               />
             </div>
           </TabPane>
-          <TabPane tab="在线时长" key="在线时长">
+          {/* <TabPane tab="在线时长" key="在线时长">
             <div className="sheet-right-panel">
               <ProTable
                 size="small"
@@ -255,7 +292,7 @@ const PersonalTabList = props => {
                 pagination={false}
               />
             </div>
-          </TabPane>
+          </TabPane> */}
         </Tabs>
       </div>
       <UpgradeModalv2

+ 2 - 0
src/pages/Product/Road/Personal/components/Detail/UpgradeModal.jsx

@@ -23,6 +23,7 @@ const UpgradeModal = props => {
       type,
       loading,
       visible,
+      salesType,
       compilationId,
       compilationName,
       compilationListName,
@@ -57,6 +58,7 @@ const UpgradeModal = props => {
         ...newVal,
         projectType,
         ssoId,
+        salesType,
         compilationId,
         compilationName,
         compilationListName,

+ 3 - 9
src/pages/Product/Road/Personal/components/Detail/index.jsx

@@ -25,7 +25,6 @@ const PersonalDetail = props => {
   const [state, setState] = useState({
     loading: false,
     cloudUser: {},
-    compilationList: [],
     log: [],
     serviceLog: [],
     client: {}
@@ -44,14 +43,14 @@ const PersonalDetail = props => {
   const initData = async id => {
     setState({ ...state, loading: true })
     const {
-      data: { cloudUser = {}, compilationList = [], log = [], serviceLog = [], client = {} },
+      data: { cloudUser = {}, log = [], serviceLog = [], client = {} },
       code = -1
     } = await apiRoadpricingDetailV2({ ssoId: id, projectType })
     if (code === consts.RET_CODE.SUCCESS) {
       if (shouldUpdate) {
         refreshDetail()
       }
-      setState({ ...state, cloudUser, compilationList, log, serviceLog, client, loading: false })
+      setState({ ...state, cloudUser, log, serviceLog, client, loading: false })
     }
   }
   const handleConnectClient = () => {
@@ -143,12 +142,7 @@ const PersonalDetail = props => {
               // xl={{ span: 15 }}
               flex={{ flexDirection: 'column' }}
               className="sheet-box-right">
-              <TabList
-                compilationList={state.compilationList}
-                cloudUser={state.cloudUser}
-                projectType={projectType}
-                ssoId={state.cloudUser.ssoId}
-              />
+              <TabList cloudUser={state.cloudUser} projectType={projectType} ssoId={state.cloudUser.ssoID} />
               <LowerList log={state.log} serviceLog={state.serviceLog} />
             </Col>
           </Row>

+ 2 - 33
src/pages/Product/Road/Personal/index.jsx

@@ -8,7 +8,7 @@ import { Input, Tooltip, Tag } from 'antd'
 import { useModal } from '@/components/ModalStore'
 
 const Personal = props => {
-  const { compilationv2, provincev2, shouldUpdate } = props
+  const { compilationv2, shouldUpdate } = props
   const dispatch = useDispatch()
   const dispatchModal = useModal()
   const tRef = useRef()
@@ -27,14 +27,6 @@ const Personal = props => {
         }
       })
     }
-    if (!provincev2?.length) {
-      dispatch({
-        type: 'personal/fetchProvincev2',
-        payload: {
-          projectType: 1
-        }
-      })
-    }
     if (shouldUpdate) {
       tRef.current.reload()
     }
@@ -50,7 +42,7 @@ const Personal = props => {
         <span
           onClick={() =>
             dispatchModal('D_PERSONAL_DETAIL', {
-              dataId: record.ssoId,
+              dataId: record.ssoID,
               projectType: 1
             })
           }
@@ -72,12 +64,6 @@ const Personal = props => {
       width: 100
     },
     {
-      title: 'QQ',
-      dataIndex: 'qq',
-      key: 'qq',
-      width: 110
-    },
-    {
       title: '企业名称',
       dataIndex: 'company',
       key: 'company',
@@ -164,22 +150,6 @@ const Personal = props => {
       )
     },
     {
-      title: '地区',
-      dataIndex: 'province',
-      key: 'province',
-      width: 80,
-      filters: true,
-      valueEnum: provincev2.reduce((prev, curr) => {
-        // console.log(curr)
-        const obj = { ...prev }
-        obj[curr.value] = {
-          text: curr.label.name
-        }
-        return obj
-      }, {}),
-      filterMultiple: false
-    },
-    {
       title: '注册时间',
       dataIndex: 'createTime',
       key: 'createTime',
@@ -295,6 +265,5 @@ const Personal = props => {
 
 export default connect(({ personal, refresh }) => ({
   compilationv2: personal.compilationv2,
-  provincev2: personal.provincev2,
   shouldUpdate: refresh.personal
 }))(Personal)