Browse Source

fix: 概括页内容显示异常修复

lanjianrong 4 years ago
parent
commit
dcd34b5ac1

+ 1 - 1
src/pages/Contract/Content/Income/components/Modal/index.tsx

@@ -102,7 +102,7 @@ const ContractModal: React.FC<iModalCommonProps> = ({ modalObj: { type, visible,
         const { content = '', name = '', price = 0, partyA = '', partyB = '', partyASigner = '', partyBSigner = '', signerTime = '', remarks = '' } = contractStore.contract
         form.setFieldsValue({ content, name, price, partyA, partyB, partyASigner, partyBSigner, signerTime: signerTime ? dayjs(signerTime) : '', remarks })
       } else if (type === 'add') {
-        commonStore.returnWayOptions && commonStore.queryWayOptions()
+        commonStore.returnWayOptions?.length && commonStore.queryWayOptions()
         form.setFieldsValue({ contractsId: contractStore.contract.id })
       } else {
         form.setFieldsValue({ id: contractStore.contract.id })

+ 5 - 4
src/pages/Dashboard/index.tsx

@@ -70,10 +70,10 @@ const Index = () => {
                                 <span className={[ 'pi-pd-lr-15', 'pi-height-18', messageType[item.dataType]?.class ].join(' ')}>{messageType[item.dataType]?.title}</span>
                                 <span className="pi-pd-lr-15">
                                   <span>{item.bidsectionName}</span>
-                                  <Link to={{ pathname: messageType[item.dataType]?.path, state: { id: item.dataId } }}>{item.inspection}</Link>
+                                  <Link to={{ pathname: messageType[item.dataType]?.path, state: { id: item.dataId, name: item.bidsectionName } }}>{item.inspection}</Link>
                                 </span>
                               </div>
-                              <ZhButton size="small"><Link to={{ pathname: messageType[item.dataType]?.path, state: { id: item.dataId } }}>审批</Link></ZhButton>
+                              <ZhButton size="small"><Link to={{ pathname: messageType[item.dataType]?.path, state: { id: item.dataId, name: item.bidsectionName } }}>审批</Link></ZhButton>
                             </div>
                             <div className="pi-justify-between mt-1 ">
                               <span>{item.name}-{item.position}</span>
@@ -101,12 +101,13 @@ const Index = () => {
                         <div className="pi-justify-start">
                           <span className={[ 'pi-pd-lr-15', 'pi-height-18', messageType[item.dataType]?.class ].join(' ')}>{messageType[item.dataType]?.title}</span>
                           <span className="pi-pd-lr-15">
+                          <span>{item.bidsectionName}</span>
                             {
                               item.content.split('|').map((content, idx) => {
                                 if (idx === 0) {
                                   return <span key={idx}>{content} </span>
                                 } else if (idx === 1) {
-                                  return <Link key={idx} to={{ pathname: messageType[item.dataType]?.path, state: { id: item.dataId } }} className="pi-mg-lr-5">
+                                  return <Link key={idx} to={{ pathname: messageType[item.dataType]?.path, state: { id: item.dataId, name: item.bidsectionName } }} className="pi-mg-lr-5">
                                     {content}
                                   </Link>
                                 } else {
@@ -129,7 +130,7 @@ const Index = () => {
             </div>
           </div>
           <div className="pi-flex-twice pi-flex-column">
-            <div className={styles.card} style={{height: 'auto'}}>
+            <div className={styles.card} style={{ height: 'auto' }}>
               <div className={styles.cardBody} >
                 <div className={styles.cardTitle}>
                   <h5>纵横技术支持</h5>

+ 10 - 3
src/pages/Quality/Content/List/index.tsx

@@ -12,7 +12,7 @@ import consts from '@/utils/consts'
 import { dayjsFormat } from '@/utils/util'
 import { Button, message, Table } from 'antd'
 import { ColumnsType } from 'antd/lib/table'
-import React, { useEffect } from 'react'
+import React, { useEffect, useState } from 'react'
 import { Link } from 'react-router-dom'
 import { apiCreateQuality, apiQualityList, apiSaveRule } from './api'
 import AddModel from './modal'
@@ -32,7 +32,13 @@ interface iQualityList {
 const QualityList: React.FC<{}> = () => {
   const [ state, setState ] = useListModal(consts.DATA_TYPE.QUALITY)
 
+  const [page, setPage] = useState({
+    pageNo: 1,
+    pageSize: consts.PAGE_SIZE
+  })
+
   const initData = async (pageNo: number = 1, pageSize: number = consts.PAGE_SIZE) => {
+    setPage({...page, pageNo, pageSize})
     const initModal = {
       ruleModal: { loading: false, visible: false },
       addModal: { loading: false, visible: false }
@@ -54,7 +60,7 @@ const QualityList: React.FC<{}> = () => {
       width: '5%',
       // eslint-disable-next-line react/display-name
       render: (_: string, record: any, i: number) => {
-        return <span>{i + 1}</span>
+        return <span>{(page.pageNo - 1) * page.pageSize + i + 1}</span>
       }
     },
     {
@@ -169,7 +175,8 @@ const QualityList: React.FC<{}> = () => {
         pagination={{
           hideOnSinglePage: true,
           size: 'small',
-          pageSize: consts.PAGE_SIZE,
+          current: page.pageNo,
+          pageSize: page.pageSize,
           onChange: (page, pageSize) => initData(page, pageSize),
           total: state.total
         }}

+ 9 - 4
src/pages/Safe/Content/List/index.tsx

@@ -12,7 +12,7 @@ import consts from '@/utils/consts'
 import { dayjsFormat } from '@/utils/util'
 import { Button, message, Table } from 'antd'
 import { ColumnsType } from 'antd/lib/table'
-import React, { useEffect } from 'react'
+import React, { useEffect, useState } from 'react'
 import { Link } from 'react-router-dom'
 import { apiCreateSafe, apiSafeList, apiSaveRule } from './api'
 import AddModel from './modal'
@@ -20,7 +20,10 @@ import AddModel from './modal'
 
 const SafeList: React.FC<{}> = () => {
   const [ state, setState ] = useListModal(consts.DATA_TYPE.SAFE)
-
+  const [page, setPage] = useState({
+    pageNo: 1,
+    pageSize: consts.PAGE_SIZE
+  })
   useEffect(() => {
     initData()
   }, [])
@@ -31,7 +34,7 @@ const SafeList: React.FC<{}> = () => {
       width: '5%',
       // eslint-disable-next-line react/display-name
       render: (_: string, record: any, i: number) => {
-        return <span>{i + 1}</span>
+        return <span>{(page.pageNo - 1) * page.pageSize + i + 1}</span>
       }
     },
     {
@@ -97,6 +100,7 @@ const SafeList: React.FC<{}> = () => {
   ]
 
   const initData = (pageNo: number = 1, pageSize: number = consts.PAGE_SIZE) => {
+    setPage({...page, pageNo, pageSize})
     const initModal = {
       ruleModal: { loading: false, visible: false },
       addModal: { loading: false, visible: false }
@@ -161,7 +165,8 @@ const SafeList: React.FC<{}> = () => {
         pagination={{
           hideOnSinglePage: true,
           size: 'small',
-          pageSize: consts.PAGE_SIZE,
+          current: page.pageNo,
+          pageSize: page.pageSize,
           onChange: (page, pageSize) => initData(page, pageSize),
           total: state.total
         }}

+ 1 - 0
src/types/dashboard.d.ts

@@ -36,4 +36,5 @@ interface MessageDatum {
   title: string;
   content: string;
   createTime: string;
+  bidsectionName: string;
 }