|
@@ -4,7 +4,7 @@ import RuleModal from '@/components/RuleModal'
|
|
|
import SvgIcon from '@/components/SvgIcon'
|
|
|
import { apiSaveRule } from '@/pages/Safe/Content/List/api'
|
|
|
import { contractReturnStore, tenderStore } from '@/store/mobx'
|
|
|
-import { iIncomeTree, iModalBooleanProps } from '@/types/contract'
|
|
|
+import { iIncomeTree, iModalProps } from '@/types/contract'
|
|
|
import { contractTreeBaseId } from '@/utils/common/constStatus'
|
|
|
import consts from '@/utils/consts'
|
|
|
import { Button, message, Tooltip } from 'antd'
|
|
@@ -23,10 +23,11 @@ interface iModal {
|
|
|
|
|
|
const Income: React.FC<RouteComponentProps> = ({ history }) => {
|
|
|
|
|
|
- const [ modalObj, setModalObj ] = useState<iModalBooleanProps>({
|
|
|
+ const [ modalObj, setModalObj ] = useState<iModalProps>({
|
|
|
type: '',
|
|
|
visible: false,
|
|
|
- confirmLoading: false
|
|
|
+ confirmLoading: false,
|
|
|
+ contractType: 'income'
|
|
|
})
|
|
|
const [ row, setRow ] = useState<iIncomeTree>({
|
|
|
elderBrother: false,
|
|
@@ -64,6 +65,8 @@ const Income: React.FC<RouteComponentProps> = ({ history }) => {
|
|
|
})
|
|
|
const { code = -1, contract = {} } = await apiResfulContract(type, values)
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
|
+ console.log(contract)
|
|
|
+
|
|
|
contractReturnStore.updateContract(contract)
|
|
|
contractReturnStore.resetTree(tenderStore.bid)
|
|
|
if (type === 'return') {
|
|
@@ -89,7 +92,7 @@ const Income: React.FC<RouteComponentProps> = ({ history }) => {
|
|
|
return contractReturnStore.addRowTree(payload.id)
|
|
|
}
|
|
|
const { code = -1, section = {} } = await apiResfulContractTree(type, payload)
|
|
|
- if ( code === consts.RET_CODE.SUCCESS) {
|
|
|
+ if (code === consts.RET_CODE.SUCCESS) {
|
|
|
contractReturnStore.resetTree(tenderStore.bid)
|
|
|
if (type !== 'add' && type !== 'del') {
|
|
|
setRow({ ...row, ...section })
|
|
@@ -124,51 +127,51 @@ const Income: React.FC<RouteComponentProps> = ({ history }) => {
|
|
|
<div className="pi-flex-row">
|
|
|
{
|
|
|
row.id ?
|
|
|
- <>
|
|
|
- <Tooltip title="添加子项">
|
|
|
- <Button type="text" icon={<SvgIcon type="xxh-plus" style={{ color: '#007bff', fontSize: 12 }} />} onClick={() => treeResfulApiHandler('add', { id: row.id, bidsectionId: row.bidsectionId })} />
|
|
|
- </Tooltip>
|
|
|
- {
|
|
|
- !row.children?.length ?
|
|
|
- <Tooltip title="删除">
|
|
|
- <Button type="text" icon={<SvgIcon type="xxh-times" style={{ color: '#007bff', fontSize: 12 }} />} onClick={() => treeResfulApiHandler('del', { id: row.id, bidsectionId: row.bidsectionId })} />
|
|
|
- </Tooltip>
|
|
|
- : <span className="pi-width-32 pi-height-32 pi-pd-tb-4 pi-flex-row-center"><SvgIcon type="xxh-times" style={{ color: '#9a9a9a', fontSize: 12 }} /></span>
|
|
|
- }
|
|
|
- {
|
|
|
- row.parentId && row.parentId !== contractTreeBaseId ?
|
|
|
- <Tooltip title="升级">
|
|
|
- <Button type="text" icon={<SvgIcon type="xxh-arrow-left" style={{ color: '#007bff', fontSize: 12 }} onClick={() => treeResfulApiHandler('depth', { id: row.id, bidsectionId: row.bidsectionId, operation: 'upDepth' })} />} />
|
|
|
- </Tooltip>
|
|
|
- :
|
|
|
- <span className="pi-width-32 pi-height-32 pi-pd-tb-4 pi-flex-row-center"><SvgIcon type="xxh-arrow-left" style={{ color: '#9a9a9a', fontSize: 12 }}/></span>
|
|
|
- }
|
|
|
- {
|
|
|
- row.elderBrother ?
|
|
|
- <Tooltip title="降级">
|
|
|
- <Button type="text" icon={<SvgIcon type="xxh-arrow-right" style={{ color: '#007bff', fontSize: 12 }}/>} onClick={() => treeResfulApiHandler('depth', { id: row.id, bidsectionId: row.bidsectionId, operation: 'downDepth' })} />
|
|
|
- </Tooltip>
|
|
|
- :
|
|
|
- <span className="pi-width-32 pi-height-32 pi-pd-tb-4 pi-flex-row-center"><SvgIcon type="xxh-arrow-right" style={{ color: '#9a9a9a', fontSize: 12 }}/></span>
|
|
|
- }
|
|
|
- {
|
|
|
- row.elderBrother ?
|
|
|
- <Tooltip title="上移">
|
|
|
- <Button type="text" icon={<SvgIcon type="xxh-arrow-up" style={{ color: '#007bff', fontSize: 12 }}/>} onClick={() => treeResfulApiHandler('serial', { id: row.id, bidsectionId: row.bidsectionId, operation: 'upSerial' })} disabled={!row.elderBrother} />
|
|
|
- </Tooltip>
|
|
|
- :
|
|
|
- <span className="pi-width-32 pi-height-32 pi-pd-tb-4 pi-flex-row-center"><SvgIcon type="xxh-arrow-up" style={{ color: '#9a9a9a', fontSize: 12 }}/></span>
|
|
|
- }
|
|
|
- {
|
|
|
- !row.isEnd ?
|
|
|
- <Tooltip title="下移">
|
|
|
- <Button type="text" icon={<SvgIcon type="xxh-arrow-down" style={{ color: '#007bff', fontSize: 12 }}/>} onClick={() => treeResfulApiHandler('serial', { id: row.id, bidsectionId: row.bidsectionId, operation: 'downSerial' })} disabled={row.isEnd} />
|
|
|
+ <>
|
|
|
+ <Tooltip title="添加子项">
|
|
|
+ <Button type="text" icon={<SvgIcon type="xxh-plus" style={{ color: '#007bff', fontSize: 12 }} />} onClick={() => treeResfulApiHandler('add', { id: row.id, bidsectionId: row.bidsectionId })} />
|
|
|
</Tooltip>
|
|
|
- :
|
|
|
- <span className="pi-width-32 pi-height-32 pi-pd-tb-4 pi-flex-row-center"><SvgIcon type="xxh-arrow-down" style={{ color: '#9a9a9a', fontSize: 12 }}/></span>
|
|
|
- }
|
|
|
- </>
|
|
|
- : ''
|
|
|
+ {
|
|
|
+ !row.children?.length ?
|
|
|
+ <Tooltip title="删除">
|
|
|
+ <Button type="text" icon={<SvgIcon type="xxh-times" style={{ color: '#007bff', fontSize: 12 }} />} onClick={() => treeResfulApiHandler('del', { id: row.id, bidsectionId: row.bidsectionId })} />
|
|
|
+ </Tooltip>
|
|
|
+ : <span className="pi-width-32 pi-height-32 pi-pd-tb-4 pi-flex-row-center"><SvgIcon type="xxh-times" style={{ color: '#9a9a9a', fontSize: 12 }} /></span>
|
|
|
+ }
|
|
|
+ {
|
|
|
+ row.parentId && row.parentId !== contractTreeBaseId ?
|
|
|
+ <Tooltip title="升级">
|
|
|
+ <Button type="text" icon={<SvgIcon type="xxh-arrow-left" style={{ color: '#007bff', fontSize: 12 }} onClick={() => treeResfulApiHandler('depth', { id: row.id, bidsectionId: row.bidsectionId, operation: 'upDepth' })} />} />
|
|
|
+ </Tooltip>
|
|
|
+ :
|
|
|
+ <span className="pi-width-32 pi-height-32 pi-pd-tb-4 pi-flex-row-center"><SvgIcon type="xxh-arrow-left" style={{ color: '#9a9a9a', fontSize: 12 }} /></span>
|
|
|
+ }
|
|
|
+ {
|
|
|
+ row.elderBrother ?
|
|
|
+ <Tooltip title="降级">
|
|
|
+ <Button type="text" icon={<SvgIcon type="xxh-arrow-right" style={{ color: '#007bff', fontSize: 12 }} />} onClick={() => treeResfulApiHandler('depth', { id: row.id, bidsectionId: row.bidsectionId, operation: 'downDepth' })} />
|
|
|
+ </Tooltip>
|
|
|
+ :
|
|
|
+ <span className="pi-width-32 pi-height-32 pi-pd-tb-4 pi-flex-row-center"><SvgIcon type="xxh-arrow-right" style={{ color: '#9a9a9a', fontSize: 12 }} /></span>
|
|
|
+ }
|
|
|
+ {
|
|
|
+ row.elderBrother ?
|
|
|
+ <Tooltip title="上移">
|
|
|
+ <Button type="text" icon={<SvgIcon type="xxh-arrow-up" style={{ color: '#007bff', fontSize: 12 }} />} onClick={() => treeResfulApiHandler('serial', { id: row.id, bidsectionId: row.bidsectionId, operation: 'upSerial' })} disabled={!row.elderBrother} />
|
|
|
+ </Tooltip>
|
|
|
+ :
|
|
|
+ <span className="pi-width-32 pi-height-32 pi-pd-tb-4 pi-flex-row-center"><SvgIcon type="xxh-arrow-up" style={{ color: '#9a9a9a', fontSize: 12 }} /></span>
|
|
|
+ }
|
|
|
+ {
|
|
|
+ !row.isEnd ?
|
|
|
+ <Tooltip title="下移">
|
|
|
+ <Button type="text" icon={<SvgIcon type="xxh-arrow-down" style={{ color: '#007bff', fontSize: 12 }} />} onClick={() => treeResfulApiHandler('serial', { id: row.id, bidsectionId: row.bidsectionId, operation: 'downSerial' })} disabled={row.isEnd} />
|
|
|
+ </Tooltip>
|
|
|
+ :
|
|
|
+ <span className="pi-width-32 pi-height-32 pi-pd-tb-4 pi-flex-row-center"><SvgIcon type="xxh-arrow-down" style={{ color: '#9a9a9a', fontSize: 12 }} /></span>
|
|
|
+ }
|
|
|
+ </>
|
|
|
+ : ''
|
|
|
}
|
|
|
</div>
|
|
|
</Slot>
|
|
@@ -176,14 +179,14 @@ const Income: React.FC<RouteComponentProps> = ({ history }) => {
|
|
|
<Button type="ghost" size="small" icon={<SvgIcon type="xxh-cog" />} className="pi-mg-right-3" style={{ color: '#007bff' }} onClick={() => setRuleModal({ ...ruleModal, visible: true })}>设置</Button>
|
|
|
{
|
|
|
showCBtn ?
|
|
|
- <Authorization type="contract" auth="add">
|
|
|
- <Button type="primary" size="small" onClick={() => setModalObj({ ...modalObj, type: 'create', visible: true })}>新建收入合同</Button>
|
|
|
- </Authorization>
|
|
|
- : ""
|
|
|
+ <Authorization type="contract" auth="add">
|
|
|
+ <Button type="primary" size="small" onClick={() => setModalObj({ ...modalObj, type: 'create', visible: true })}>新建收入合同</Button>
|
|
|
+ </Authorization>
|
|
|
+ : ""
|
|
|
}
|
|
|
</Slot>
|
|
|
</Header>
|
|
|
- <TableContent changeModalType={changeModalType} row={row} setRow={(record: iIncomeTree) => setRow({ ...row, ...record })} history={history}/>
|
|
|
+ <TableContent changeModalType={changeModalType} row={row} setRow={(record: iIncomeTree) => setRow({ ...row, ...record })} history={history} />
|
|
|
<RuleModal
|
|
|
type={consts.RULE.CONTRACT_RETURN}
|
|
|
title="合同管理编号设置"
|
|
@@ -191,8 +194,8 @@ const Income: React.FC<RouteComponentProps> = ({ history }) => {
|
|
|
onCreate={onRuleCreate}
|
|
|
loading={ruleModal.loading}
|
|
|
onCancel={() => setRuleModal({ ...ruleModal, visible: false })}
|
|
|
- />
|
|
|
- <ContractModal row={row} modalObj={modalObj} onConfirm={onCreate} onCancel={ () => setModalObj({ ...modalObj, visible: false })} reload={(type) => handleReload(type)} />
|
|
|
+ />
|
|
|
+ <ContractModal row={row} modalObj={modalObj} onConfirm={onCreate} onCancel={() => setModalObj({ ...modalObj, visible: false })} reload={(type) => handleReload(type)} />
|
|
|
</div>
|
|
|
)
|
|
|
}
|