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

fix: 合同管理功能逻辑以及巡检bug修复

lanjianrong пре 4 година
родитељ
комит
1c9613c955

+ 3 - 4
src/pages/Contract/Content/Income/components/TableContent/index.tsx

@@ -37,7 +37,6 @@ interface iTableContentPorps {
 }
 
 const GCsheet: React.FC<iTableContentPorps> = ({ changeModalType, row, setRow, history, type }) => {
-
   const [ sectionTemplate, setSectionTemplate ] = useState<iShowTemplateState>({
     isShow: false,
     template: '',
@@ -240,17 +239,17 @@ const GCsheet: React.FC<iTableContentPorps> = ({ changeModalType, row, setRow, h
     return record.id === row.id ? 'ant-table-row-selected editable-row' : ''
   }
   const tabOnClick = (key: string) => {
-    contractStore.changeUpdate(key)
+    contractStore.changeActiveKey(key)
   }
 
   // 阿里oss上传弹窗
   const onShow = (show: boolean) => setVisible(show)
 
   const onCreate = async (fileList: iFile[]) => {
-    const { code = -1 } = await apiSaveFileInfo(fileList, type === 'income' ? consts.DATA_TYPE.CONTRACT_RETURN : consts.DATA_TYPE.CONTRACT_PAID, row.contractId)
+    const { code = -1 } = await apiSaveFileInfo(fileList, type === ContractType.INCOME ? consts.DATA_TYPE.INCOME : consts.DATA_TYPE.EXPENDITURE, row.contractId)
     if (code === consts.RET_CODE.SUCCESS) {
       setVisible(false)
-      contractStore.changeUpdate('3')
+      contractStore.changeActiveKey('3')
     }
   }
 

+ 2 - 2
src/pages/Contract/Content/Income/components/Tabs/Detail/index.tsx

@@ -15,10 +15,10 @@ const Detail:React.FC<DetailProps> = (props) => {
   const { contract, type } = props
   const type_name = type === ContractType.INCOME ? '回款' : '支付'
   const progress = useMemo(() => {
-    const i = new BigNumber(type === ContractType.INCOME ? contract.returned : contract.paid).dividedBy(contract.price).toFixed(2)
+    const i = new BigNumber(type === ContractType.INCOME ? contract.returned : contract.paid).dividedBy(contract.price)
     const j = new BigNumber(1).minus(i)
     const k = new BigNumber(contract.price).minus(type === ContractType.INCOME ? contract.returned : contract.paid)
-    return { returned: new BigNumber(i).multipliedBy(100) + '%', unReturned: new BigNumber(j).multipliedBy(100) + '%', unReturnedMoney: k }
+    return { returned: i.multipliedBy(100).toFixed(2) + '%', unReturned: j.multipliedBy(100).toFixed(2) + '%', unReturnedMoney: k }
   }, [ contract ])
   return contract.id ? (
     <div className={styles.detailTab}>

+ 8 - 4
src/pages/Contract/Content/Income/components/Tabs/File/index.tsx

@@ -1,4 +1,5 @@
 import { contractStore } from '@/store/mobx'
+import { ContractType } from '@/store/mobx/contract'
 import { apiDelFile, apiGetFileList } from '@/utils/common/api'
 import consts from '@/utils/consts'
 import { dayjsFormat } from '@/utils/util'
@@ -28,19 +29,22 @@ const File: React.FC<{ type: 'income' | 'expenditure' }> = ({ type }) => {
       if (contractStore.contract.id !== id) {
         setId(contractStore.contract.id)
         initData()
-      } else if (contractStore.shouldUpdate && contractStore.shouldUpdate === '3') {
+      } else if (contractStore.activeKey && contractStore.activeKey === '3') {
         initData(pagination.pageNo, pagination.pageSize)
       }
-      contractStore.shouldUpdate && (contractStore.changeUpdate(''))
+    } else {
+      setData([])
+      setTotal(0)
     }
-  }, [ contractStore.contract.id, contractStore.shouldUpdate ])
+  }, [ contractStore.contract.id, contractStore.activeKey ])
 
   const initData = async (pageNo: number = 1, pageSize: number = 7) => {
     setPagination({ ...pagination, pageNo, pageSize })
-    const { code = -1, data = [], total = 0 } = await apiGetFileList(type === 'income' ? consts.DATA_TYPE.CONTRACT_RETURN : consts.DATA_TYPE.CONTRACT_PAID, contractStore.contract.id, pageNo, pageSize)
+    const { code = -1, data = [], total = 0 } = await apiGetFileList(type === ContractType.INCOME ? consts.DATA_TYPE.INCOME : consts.DATA_TYPE.EXPENDITURE, contractStore.contract.id, pageNo, pageSize)
     if (code === consts.RET_CODE.SUCCESS) {
       setData(data)
       setTotal(total)
+      contractStore.activeKey && (contractStore.changeActiveKey(''))
     }
   }
 

+ 11 - 4
src/pages/Contract/Content/Income/components/Tabs/Receivable/index.tsx

@@ -70,7 +70,7 @@ const Receivable: React.FC<ReceivableProps> = ({ updateTreeAndContract, type })
   const [ id, setId ] = useState<string>('')
   const [ fileModal, setFileModal ] = useState<iFileModal>({
     visible: false,
-    dataType: consts.DATA_TYPE.RETURN,
+    dataType: consts.DATA_TYPE[type === ContractType.INCOME ? 'CONTRACT_RETURN' : 'CONTRACT_PAID'],
     dataId: ''
   })
   const [ editingKey, setEditingKey ] = useState<string>('')
@@ -85,22 +85,29 @@ const Receivable: React.FC<ReceivableProps> = ({ updateTreeAndContract, type })
   }
 
   useEffect(() => {
+    console.log(contractStore.activeKey)
+
     !commonStore.returnWayOptions.length && (commonStore.queryWayOptions())
     if (contractStore.contract.id) {
       if (contractStore.contract.id !== id) {
         setId(contractStore.contract.id)
         initData()
-      } else if (contractStore.shouldUpdate && contractStore.shouldUpdate === '2') {
+      } else if (contractStore.activeKey && contractStore.activeKey === '2') {
+        console.log('进来了')
+
         initData()
       }
-      contractStore.shouldUpdate && (contractStore.changeUpdate(''))
+    } else {
+      // 项目节的点击,数据为空数组
+      setData([])
     }
-  }, [ contractStore.contract.id, contractStore.shouldUpdate ])
+  }, [ contractStore.activeKey, contractStore.contract.id ])
 
   const initData = async () => {
     const { code = -1, data = [] } = await apiGetReturns(type, contractStore.contract.id, contractStore.contract.bidsectionId)
     if (code === consts.RET_CODE.SUCCESS) {
       setData(data)
+      contractStore.activeKey && (contractStore.changeActiveKey(''))
     }
   }
   const save = async (key: React.Key) => {

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

@@ -74,7 +74,7 @@ const Income: React.FC<RouteComponentProps> = (props) => {
       contractStore.updateContract(contract)
       contractStore.resetTree(ContractType.INCOME, tenderStore.bid)
       if (type === 'add') {
-        contractStore.changeUpdate('2')
+        contractStore.changeActiveKey('2')
       }
     }
     setModalObj({

+ 2 - 2
src/pages/Contract/Content/Spending/index.tsx

@@ -70,8 +70,8 @@ const Expenditure: React.FC<RouteComponentProps> = ({ history }) => {
     if (code === consts.RET_CODE.SUCCESS) {
       contractStore.updateContract(contract)
       contractStore.resetTree(ContractType.EXPENDITURE, tenderStore.bid)
-      if (type === 'paid') {
-        contractStore.changeUpdate('2')
+      if (type === 'add') {
+        contractStore.changeActiveKey('2')
       }
     }
     setModalObj({

+ 18 - 17
src/pages/Contract/Content/Summary/components/Content/index.tsx

@@ -95,7 +95,7 @@ const Content: React.FC<iContentProps> = ({ data, type }) => {
           obj.value = datum.count + '%'
           return obj
         }
-        if (type === 'expenditure') {
+        if (type === ContractType.INCOME) {
           obj.name = '回款金额'
         } else {
           obj.name = '支付金额'
@@ -108,11 +108,11 @@ const Content: React.FC<iContentProps> = ({ data, type }) => {
         geometry: 'column',
         seriesField: 'value',
         columnWidthRatio: 0.4,
-        color: type === 'expenditure' ? '#B5C4B1' : '#A27E7E'
+        color: type === ContractType.INCOME ? '#B5C4B1' : '#A27E7E'
       },
       {
         geometry: 'line',
-        color: type === 'expenditure' ? '#965454' : '#8C8C8C',
+        color: type === ContractType.INCOME ? '#965454' : '#8C8C8C',
         isStack: true,
         isPercent: true
         // smooth: true
@@ -125,30 +125,31 @@ const Content: React.FC<iContentProps> = ({ data, type }) => {
         {
           value: 'value',
           name: '回款金额',
-          marker: { symbol: 'square', style: { fill: type === 'expenditure' ? '#B5C4B1' : '#A27E7E', r: 5 } }
+          marker: { symbol: 'square', style: { fill: type === ContractType.INCOME ? '#B5C4B1' : '#A27E7E', r: 5 } }
         },
         {
           value: 'count',
           name: '占总金额比例',
-          marker: { symbol: 'square', style: { fill: type === 'expenditure' ? '#965454' : '#8C8C8C', r: 5 } }
+          marker: { symbol: 'square', style: { fill: type === ContractType.INCOME ? '#965454' : '#8C8C8C', r: 5 } }
         }
       ]
     }
   }
 
+
   return (
     <div className="pi-flex-column ">
       <div className="card-body card-border">
         <h5 className="card-title">{type === ContractType.INCOME ? '收入' : '支出'}合同结算进度</h5>
           <div className="progress-content">
-            <Tooltip title={type === 'expenditure' ? '已回款: ¥' : '已支付: ¥' + data.totalContractPriceShow}>
-              <div className={[ "progress-bar", type === ContractType.INCOME ? 'pi-bg-success' : 'pi-bg-red' ].join(' ')} style={{ width: (data.progress * 100) + '%' }}>
-                {data.progress * 100}%
+            <Tooltip title={type === ContractType.INCOME ? '已回款: ¥' : '已支付: ¥' + data.totalContractPriceShow}>
+              <div className={[ "progress-bar", type === ContractType.INCOME ? 'pi-bg-success' : 'pi-bg-red' ].join(' ')} style={{ width: data.progress + '%' }}>
+                {data.progress}%
               </div>
             </Tooltip>
-            <Tooltip title={type === 'expenditure' ? '未回款:¥' + data.totalPaidPriceShow : '未支付:¥' + data.totalReturnPriceShow}>
-              <div className="progress-bar pi-bg-gray" style={{ width: ((1 - data.progress) * 100) + '%' }} >
-                {((1 - data.progress) * 100)}%
+            <Tooltip title={type === ContractType.INCOME ? '未回款:¥' + data.totalReturnPriceShow : '未支付:¥' + data.totalPaidPriceShow}>
+              <div className="progress-bar pi-bg-gray" style={{ width: (100 - data.progress) + '%' }} >
+                {parseFloat(new BigNumber(100).minus(data.progress).toFixed(2))}%
               </div>
             </Tooltip>
           </div>
@@ -161,21 +162,21 @@ const Content: React.FC<iContentProps> = ({ data, type }) => {
           <div className="pi-flex-column pi-justify-between">
             <div className="card-body card-border pi-flex-column pi-justify-between">
               <h5 className="card-title">{formatMoney(data.totalContractPrice)}</h5>
-              <span className="pi-text-center">{type === 'expenditure' ? '收入' : '支出'}合同金额</span>
+              <span className="pi-text-center">{type === ContractType.INCOME ? '收入' : '支出'}合同金额</span>
             </div>
             <div className="card-body card-border pi-flex-column pi-mg-tb-15">
-              <h5 className="card-title">{formatMoney(data.totalContractPriceShow)}</h5>
-              <span className="pi-text-center">{type === 'expenditure' ? '未回款' : '未支付'}</span>
+              <h5 className="card-title">{formatMoney(new BigNumber(data.totalContractPriceShow).minus(type === ContractType.INCOME ? data.totalReturnPriceShow || 0 : data.totalPaidPriceShow || 0))}</h5>
+              <span className="pi-text-center">{type === ContractType.INCOME ? '未回款' : '未支付'}</span>
             </div>
             <div className="card-body card-border pi-flex-column">
-              <h5 className="card-title">{formatMoney(type === 'expenditure' ? data.totalPaidPriceShow : data.totalReturnPriceShow)}</h5>
-              <span className="pi-text-center">{type === 'expenditure' ? '已回款' : '已支付'}</span>
+              <h5 className="card-title">{formatMoney(type === ContractType.INCOME ? data.totalReturnPriceShow : data.totalPaidPriceShow)}</h5>
+              <span className="pi-text-center">{type === ContractType.INCOME ? '已回款' : '已支付'}</span>
             </div>
           </div>
         </div>
       </div>
       <div className="card-body card-border dual-axes-content">
-        {/* <h5>{type === 'expenditure' ? '收入' : '支出'}合同结算趋势</h5> */}
+        {/* <h5>{type === ContractType.INCOME ? '收入' : '支出'}合同结算趋势</h5> */}
         <DualAxes {...dualAxesConfig} />
       </div>
     </div>

+ 6 - 2
src/pages/Contract/Content/Summary/index.tsx

@@ -91,11 +91,14 @@ export default function Summary() {
       return { ...item, count: new BigNumber(item.value).dividedBy(totalContractPrice).multipliedBy(100).toFixed(2) }
     })
 
-    let progress = parseFloat(new BigNumber(totalPaidPriceShow).dividedBy(totalContractPrice).toFixed(2))
+
+    let progress = parseFloat(new BigNumber(totalPaidPriceShow).dividedBy(totalContractPrice).multipliedBy(100).toFixed(2))
+
     isNaN(progress) && (progress = 0)
     return { pieData, returnDate: newDualAxes, totalContractPrice, totalContractPriceShow, totalPaidPriceShow, progress }
   }, [ state.expenditureData ])
 
+
   const incomePieData = useMemo(() => {
     const { closeNumber, performNumber, uncloseNumber, returnDate, totalContractPrice, totalContractPriceShow, totalReturnPriceShow } = state.incomeData
 
@@ -124,7 +127,8 @@ export default function Summary() {
     const newDualAxes = dualAxes.map(item => {
       return { ...item, count: new BigNumber(item.value).dividedBy(totalContractPrice).multipliedBy(100).toFixed(2) }
     })
-    let progress = parseFloat(new BigNumber(totalReturnPriceShow).dividedBy(totalContractPrice).toFixed(2))
+
+    let progress = parseFloat(new BigNumber(totalReturnPriceShow).dividedBy(totalContractPrice).multipliedBy(100).toFixed(2))
     isNaN(progress) && (progress = 0)
     return { pieData, returnDate: newDualAxes, totalContractPrice, totalContractPriceShow, totalReturnPriceShow, progress }
   }, [ state.incomeData ])

+ 20 - 14
src/pages/Quality/Content/Info/Detail/components/AuditContent/index.tsx

@@ -14,9 +14,12 @@ import './index.scss'
 
 interface iGroupItem extends iAccountGroupItem {
   onSelect: (item: iUserInfo) => void
+  filterGroups?: string[]
 }
 export const GroupItem: React.FC<iGroupItem> = props => {
-  const { onSelect } = props
+  const { onSelect, filterGroups } = props
+
+  // console.log(filterGroups)
 
   const [ visible, setVisible ] = useState<boolean>(true)
 
@@ -34,7 +37,7 @@ export const GroupItem: React.FC<iGroupItem> = props => {
       <QueueAnim>
         {visible
           ? props.children.map((account: iUserInfo) => {
-              return (
+              return filterGroups && filterGroups.includes(account.id) ? null : (
                 <div key={account.id} className={[ 'group-item-content', 'pi-justify-between', 'item-border-bottom' ].join(' ')} onClick={() => onSelect(account)}>
                   <div className="pi-flex-column">
                     <span className="pi-blue">{account.name}</span>
@@ -53,6 +56,7 @@ export const GroupItem: React.FC<iGroupItem> = props => {
 interface iAuditContentProps {
   onSelect: (type: string, item: iUserInfo) => void
   onDelete: (id: string, progress: string) => void
+  filterGroup: (progress: string) => string[]
   data : {
     uid: string
     auditors: iAuditor[]
@@ -63,15 +67,12 @@ interface iAuditContentProps {
 }
 
 const AuditContent: React.FC<iAuditContentProps> = props => {
-  const { onSelect, onDelete, data: { auditors, status, auditHistory, uid } } = props
+  const { onSelect, onDelete, filterGroup, data: { auditors, status, auditHistory, uid } } = props
   const [ visible, setVisible ] = useState({
     check: false,
     reCheck: false
   })
 
-  const showPopover = (type: string) => {
-    setVisible({ ...visible, [type]: true })
-  }
   const [ searchValue, setSearchValue ] = useState<string>('')
   const [ groups, setGroups ] = useState<Array<iAccountGroupItem>>([])
   useEffect(() => {
@@ -86,6 +87,11 @@ const AuditContent: React.FC<iAuditContentProps> = props => {
     const data = await getUserGroup({ name: serach, bidsectionId: tenderStore.bid })
     setGroups(data)
   }
+
+  const showPopover = (type: string) => {
+    setVisible({ ...visible, [type]: true })
+  }
+
   const handleVisibleChange = (type: string, isShow: boolean) => {
     setVisible({ ...visible, [type]: isShow })
   }
@@ -118,7 +124,7 @@ const AuditContent: React.FC<iAuditContentProps> = props => {
               .filter(item => item.progress === '0')
               .map((item, idx) => {
                 return (
-                  <li key={item.audit_id}>
+                  <li key={item.id + idx}>
                     <div className="pi-flex-column">
                       <p>
                         <span>{idx + 1}</span> {item.name}
@@ -136,7 +142,7 @@ const AuditContent: React.FC<iAuditContentProps> = props => {
               .filter(item => item.progress === '2')
               .map((item, idx) => {
                 return (
-                  <li key={item.audit_id}>
+                  <li key={item.id + idx}>
                     <div className="pi-flex-column">
                       <p>
                         <span>{idx + 1}</span> {item.name}
@@ -282,7 +288,7 @@ const AuditContent: React.FC<iAuditContentProps> = props => {
           .filter(item => item.progress === '0')
           .map((item, idx) => {
             return idx === 0 ? (
-              <tr key={item.id}>
+              <tr key={item.id + idx}>
                 <td rowSpan={auditors.filter(item => item.progress === '0').length} className="pi-text-center">
                   审批
                 </td>
@@ -298,7 +304,7 @@ const AuditContent: React.FC<iAuditContentProps> = props => {
                 ) : null}
               </tr>
             ) : (
-              <tr key={item.id}>
+              <tr key={item.id + idx}>
                 <td>
                   <SvgIcon type={item.status === 0 ? 'xxh-stop-circle' : 'xxh-chevron-circle-down'} />
                   <span className="pi-mg-left-3">{item.name}</span>
@@ -347,7 +353,7 @@ const AuditContent: React.FC<iAuditContentProps> = props => {
           .filter(item => item.progress === '2')
           .map((item, idx) => {
             return idx === 0 ? (
-              <tr key={item.id}>
+              <tr key={item.id + idx}>
                 <td rowSpan={auditors.filter(item => item.progress === '2').length} className="pi-text-center">
                   复查
                 </td>
@@ -363,7 +369,7 @@ const AuditContent: React.FC<iAuditContentProps> = props => {
                 ) : null}
               </tr>
             ) : (
-              <tr key={item.id}>
+              <tr key={item.id + idx}>
                 <td>
                   <SvgIcon type={item.status === 0 ? 'xxh-stop-circle' : 'xxh-chevron-circle-down'} />
                   <span className="pi-mg-left-3">{item.name}</span>
@@ -444,7 +450,7 @@ const AuditContent: React.FC<iAuditContentProps> = props => {
                   <Popover
                     title={<Input.Search size="small" placeholder="姓名/手机 检索" onSearch={search} onChange={e => change(e)} />}
                     content={groups.map(item => (
-                      <GroupItem {...item} key={item.value} onSelect={(item: iUserInfo) => itemSelectHandler('check', item)} />
+                      <GroupItem {...item} key={item.value} onSelect={(item: iUserInfo) => itemSelectHandler('check', item)} filterGroups={filterGroup('0')}/>
                     ))}
                     overlayClassName="popover-card"
                     trigger="click"
@@ -472,7 +478,7 @@ const AuditContent: React.FC<iAuditContentProps> = props => {
                   <Popover
                     title={<Input.Search size="small" placeholder="姓名/手机 检索" onSearch={search} onChange={e => change(e)} />}
                     content={groups.map(item => (
-                      <GroupItem {...item} key={item.value} onSelect={(item: iUserInfo) => itemSelectHandler('reCheck', item)} />
+                      <GroupItem {...item} key={item.value} onSelect={(item: iUserInfo) => itemSelectHandler('reCheck', item)} filterGroups={filterGroup('2')}/>
                     ))}
                     overlayClassName="popover-card"
                     trigger="click"

+ 13 - 5
src/pages/Quality/Content/Info/Detail/components/Modal/index.tsx

@@ -44,7 +44,7 @@ const AuditModal: React.FC<iAuditModalProps> = props => {
       return true
     }
     return false
-  }, [ auditors ])
+  }, [ auditors, type ])
   const [ groups, setGroups ] = useState<Array<iAccountGroupItem>>([])
   const [ user, setUser ] = useState<iUserInfo>({
     account: '',
@@ -75,6 +75,8 @@ const AuditModal: React.FC<iAuditModalProps> = props => {
       if (type === 'back' && !user.id) {
         return message.error('请选择退回流程')
       }
+
+      setUser({ ...user, id: '' })
       onCreate(values)
     })
   }
@@ -135,7 +137,7 @@ const AuditModal: React.FC<iAuditModalProps> = props => {
         const newAuditors = auditors
           .filter(item => item.progress === '')
           .map(item => {
-            return mapUser(item.name, '', item.position, item.company, item.mobile)
+            return mapUser(item.name, item.id, item.position, item.company, item.mobile)
           })
         newGroup.push({ value: '检查人', children: newAuditors })
       }
@@ -226,6 +228,8 @@ const AuditModal: React.FC<iAuditModalProps> = props => {
   const itemSelectHandler = (item: iUserInfo, type: string = '') => {
     setUser({ ...user, ...item })
 
+    console.log(item)
+
     setModal({ ...modal, visible: false, auditType: type })
   }
 
@@ -237,15 +241,19 @@ const AuditModal: React.FC<iAuditModalProps> = props => {
     setModal({ ...modal, visible: true })
   }
 
+  const handleModalCancel = () => {
+    setUser({ ...user, id: '' })
+    onCancel()
+  }
   return (
     <Modal
       visible={visible}
       title={textObj[type]?.title}
-      onCancel={onCancel}
+      onCancel={handleModalCancel}
       getContainer={false}
       footer={
         <div className="pi-justify-end">
-          <ZhCloseButton size="small" onClick={onCancel} className="pi-mg-right-5">
+          <ZhCloseButton size="small" onClick={handleModalCancel} className="pi-mg-right-5">
             关闭
           </ZhCloseButton>
           {renderOkBtn(type)}
@@ -266,7 +274,7 @@ const AuditModal: React.FC<iAuditModalProps> = props => {
                 placement="bottomLeft">
                 <ZhButton size="small" onClick={showPopover}>
                   <span>选择退回流程</span>
-                  <SvgIcon type="xxh-caret-down1" />
+                  <SvgIcon type="xxh-caret-down" />
                 </ZhButton>
               </Popover>
             ) : null}

+ 62 - 59
src/pages/Quality/Content/Info/Detail/index.tsx

@@ -17,7 +17,7 @@ import { dayjsFormat } from '@/utils/util'
 import { Button, Input, message, Pagination, Tooltip } from 'antd'
 import locale from 'antd/es/date-picker/locale/zh_CN'
 import dayjs from 'dayjs'
-import React, { useEffect, useState, useMemo, useCallback } from 'react'
+import React, { useEffect, useState, useMemo } from 'react'
 import { RouteComponentProps } from 'react-router'
 import { apiGetQualityDetail, apiResfulQualityAudit } from './api'
 import AuditModal from './components/Modal'
@@ -159,16 +159,19 @@ const Detail: React.FC<RouteComponentProps> = props => {
     }
   }
 
-  const delAuditor = useCallback((id: string, progress: string) => {
+  const delAuditor = (id: string, progress: string) => {
     const newAuditors = detail.auditors.filter(item => item.progress !== progress)
-    const auditor = detail.auditors.find(item => item.progress === progress && item.audit_id !== id)
+    const auditors = detail.auditors.filter(item => item.progress === progress && item.audit_id !== id)
 
-    if (auditor) {
-      newAuditors.push(auditor)
-    }
-    setDetail({ ...detail, auditors: newAuditors })
-  }, [])
+    // if (auditor) {
+    //   newAuditors.push(auditor)
+    // }
+    setDetail({ ...detail, auditors: [ ...newAuditors, ...auditors ] })
+  }
 
+  const filterGroup = (progress: string) => {
+    return detail.auditors.filter(item => item.progress === progress).map(item => item.audit_id)
+  }
   const btnClick = (type: string) => {
     if (type === 'start') {
       if (!detail.inspectionDetail || !detail.demand) {
@@ -303,12 +306,12 @@ const Detail: React.FC<RouteComponentProps> = props => {
                   {isEdited ? (
                     <span>{detail.inspection}</span>
                   ) : (
-                    <TextArea
-                      value={detail.inspection}
-                      onChange={e => {
-                        setDetail({ ...detail, inspection: e.currentTarget.value })
-                      }} />
-                  )}
+                      <TextArea
+                        value={detail.inspection}
+                        onChange={e => {
+                          setDetail({ ...detail, inspection: e.currentTarget.value })
+                        }} />
+                    )}
                 </td>
               </tr>
               <tr>
@@ -317,12 +320,12 @@ const Detail: React.FC<RouteComponentProps> = props => {
                   {isEdited ? (
                     <span>{detail.inspectionDetail}</span>
                   ) : (
-                    <TextArea
-                      value={detail.inspectionDetail}
-                      onChange={e => {
-                        setDetail({ ...detail, inspectionDetail: e.currentTarget.value })
-                      }} />
-                  )}
+                      <TextArea
+                        value={detail.inspectionDetail}
+                        onChange={e => {
+                          setDetail({ ...detail, inspectionDetail: e.currentTarget.value })
+                        }} />
+                    )}
                 </td>
               </tr>
               <tr>
@@ -331,12 +334,12 @@ const Detail: React.FC<RouteComponentProps> = props => {
                   {isEdited ? (
                     <span>{detail.demand}</span>
                   ) : (
-                    <TextArea
-                      value={detail.demand}
-                      onChange={e => {
-                        setDetail({ ...detail, demand: e.currentTarget.value })
-                      }} />
-                  )}
+                      <TextArea
+                        value={detail.demand}
+                        onChange={e => {
+                          setDetail({ ...detail, demand: e.currentTarget.value })
+                        }} />
+                    )}
                 </td>
               </tr>
               <tr>
@@ -345,13 +348,13 @@ const Detail: React.FC<RouteComponentProps> = props => {
                   {isEdited ? (
                     <span>{detail.createTime && dayjsFormat(detail.createTime, 'YYYY-MM-DD')}</span>
                   ) : (
-                    <DatePicker
-                      size="small"
-                      locale={locale}
-                      allowClear={false}
-                      value={dayjs(detail.createTime)}
-                      onChange={value => setDetail({ ...detail, createTime: value?.format() })} />
-                  )}
+                      <DatePicker
+                        size="small"
+                        locale={locale}
+                        allowClear={false}
+                        value={dayjs(detail.createTime)}
+                        onChange={value => setDetail({ ...detail, createTime: value?.format() })} />
+                    )}
                 </td>
               </tr>
               <tr>
@@ -396,32 +399,32 @@ const Detail: React.FC<RouteComponentProps> = props => {
               </tbody>
             </table>
           ) : (
-            detail.rectifiedInfo.map(item => (
-              <table className="pi-table pi-bordered" key={item.create_time}>
-                <thead>
-                  <tr>
-                    <th colSpan={2} className="pi-text-center">
-                      整改单
+              detail.rectifiedInfo.map(item => (
+                <table className="pi-table pi-bordered" key={item.create_time}>
+                  <thead>
+                    <tr>
+                      <th colSpan={2} className="pi-text-center">
+                        整改单
                     </th>
-                  </tr>
-                </thead>
-                <tbody>
-                  <tr>
-                    <th style={{ width: '150px' }}>整改情况</th>
-                    <td>{item.opinion}</td>
-                  </tr>
-                  <tr>
-                    <th style={{ width: '150px' }}>整改日期</th>
-                    <td>{dayjsFormat(item.create_time, 'YYYY-MM-DD')}</td>
-                  </tr>
-                  <tr>
-                    <th style={{ width: '150px' }}>整改人</th>
-                    <td>{item.name}</td>
-                  </tr>
-                </tbody>
-              </table>
-            ))
-          )}
+                    </tr>
+                  </thead>
+                  <tbody>
+                    <tr>
+                      <th style={{ width: '150px' }}>整改情况</th>
+                      <td>{item.opinion}</td>
+                    </tr>
+                    <tr>
+                      <th style={{ width: '150px' }}>整改日期</th>
+                      <td>{dayjsFormat(item.create_time, 'YYYY-MM-DD')}</td>
+                    </tr>
+                    <tr>
+                      <th style={{ width: '150px' }}>整改人</th>
+                      <td>{item.name}</td>
+                    </tr>
+                  </tbody>
+                </table>
+              ))
+            )}
           <table className="pi-table pi-bordered mt-3">
             <thead>
               <tr>
@@ -475,7 +478,7 @@ const Detail: React.FC<RouteComponentProps> = props => {
               ) : null}
             </tbody>
           </table>
-          <AuditContent data={auditData} onSelect={addAuditor} onDelete={delAuditor} />
+          <AuditContent data={auditData} onSelect={addAuditor} onDelete={delAuditor} filterGroup={filterGroup} />
         </div>
       </div>
       <OssUploadModal visible={modalObj.ossModal} onCancel={() => setModalObj({ ...modalObj, ossModal: false })} onCreate={onCreate} onShow={onOssModalShow} />

+ 10 - 6
src/pages/Safe/Content/Info/Detail/index.tsx

@@ -163,12 +163,16 @@ const Detail: React.FC<RouteComponentProps> = props => {
 
   const delAuditor = (id: string, progress: string) => {
     const newAuditors = detail.auditors.filter(item => item.progress !== progress)
-    const auditor = detail.auditors.find(item => item.progress === progress && item.audit_id !== id)
+    const auditors = detail.auditors.filter(item => item.progress === progress && item.audit_id !== id)
 
-    if (auditor) {
-      newAuditors.push(auditor)
-    }
-    setDetail({ ...detail, auditors: newAuditors })
+    // if (auditor) {
+    //   newAuditors.push(auditor)
+    // }
+    setDetail({ ...detail, auditors: [ ...newAuditors, ...auditors ] })
+  }
+
+  const filterGroup = (progress: string) => {
+    return detail.auditors.filter(item => item.progress === progress).map(item => item.audit_id)
   }
 
   const btnClick = (type: string) => {
@@ -448,7 +452,7 @@ const Detail: React.FC<RouteComponentProps> = props => {
               ) : null}
             </tbody>
           </table>
-          <AuditContent data={auditData} onSelect={addAuditor} onDelete={delAuditor} />
+          <AuditContent data={auditData} onSelect={addAuditor} onDelete={delAuditor} filterGroup={filterGroup}/>
         </div>
       </div>
       <OssUploadModal

+ 3 - 3
src/store/mobx/common/index.ts

@@ -7,9 +7,9 @@ class Common {
 
   @action async queryWayOptions() {
     const { code = -1, data = [] } = await apiGetReturnWay()
-      if (code === consts.RET_CODE.SUCCESS) {
-        this.returnWayOptions = data
-      }
+    if (code === consts.RET_CODE.SUCCESS) {
+      this.returnWayOptions = data
+    }
   }
 }
 

+ 4 - 4
src/store/mobx/contract/index.ts

@@ -34,10 +34,10 @@ export enum ContractType {
 class Contract {
   @observable tree: ContractTree[] = []
   @observable contract: iContractState = initData
-  @observable shouldUpdate: string = ''
+  @observable activeKey: string = ''
 
-  @action changeUpdate(i: string) {
-    this.shouldUpdate = i
+  @action changeActiveKey(i: string) {
+    this.activeKey = i
   }
   @action updateTree(tree: ContractTree[]) {
     this.tree = tree
@@ -58,7 +58,7 @@ class Contract {
   @action resetContractStore() {
     this.tree = []
     this.contract = initData
-    this.shouldUpdate = ''
+    this.activeKey = ''
   }
   // 增加行
   // @action addRowTree(id: string) {

+ 1 - 1
src/utils/consts.ts

@@ -14,7 +14,7 @@ export default {
   RULE: { SAFE: 'safeRule', QUALITY: 'qualityRule', CONTRACT_RETURN: 'contractReturnRule', CONTRACT_PAID: 'contractPaidRule' }, // 编号规则弹窗常量
   UPLOAD_WHITE: "(.json|.txt|.xls|.xlsx|.doc|.docx|.pdf|.ppt|.pptx|.png|.jpg|.jpeg|.gif|.bmp|.cad|.dwg|.zip|.rar|.7z)$"  , // 上传类型-白名单
   UPLOAD_LIMIT: 30, // 上传限制30MB
-  DATA_TYPE: { RETURN: 1, QUALITY: 2, SAFE: 3, CONTRACT_RETURN: 4, PAID: 5, CONTRACT_PAID: 6 }, // 附件类型
+  DATA_TYPE: { CONTRACT_RETURN: 1, QUALITY: 2, SAFE: 3, INCOME: 4, CONTRACT_PAID: 5, EXPENDITURE: 6 }, // 附件类型:1.回款证明2.质量附件3.安全附件4.合同文件(收入)5.支出证明6.合同文件(支出)
   PAGE_SIZE: 10, // 默认页数
   OSS_PATH: {
     REVIEW: 'https://file-upload.6jlzf.cn/',