|
@@ -23,10 +23,12 @@ interface iTableContentPorps {
|
|
|
changeModalType: (type: string) => void
|
|
|
row: iIncomeTree
|
|
|
setRow: (record: iIncomeTree) => void
|
|
|
+ history: any
|
|
|
}
|
|
|
|
|
|
|
|
|
-const GCsheet: React.FC<iTableContentPorps> = ({ changeModalType, row, setRow }) => {
|
|
|
+const GCsheet: React.FC<iTableContentPorps> = ({ changeModalType, row, setRow, history }) => {
|
|
|
+
|
|
|
const [ sectionTemplate, setSectionTemplate ] = useState<iShowTemplateState>({
|
|
|
isShow: false,
|
|
|
template: '',
|
|
@@ -63,9 +65,9 @@ const GCsheet: React.FC<iTableContentPorps> = ({ changeModalType, row, setRow })
|
|
|
const { TabPane } = Tabs
|
|
|
|
|
|
useEffect(() => {
|
|
|
- initHandler()
|
|
|
+ initData()
|
|
|
}, [])
|
|
|
- const initHandler = async () => {
|
|
|
+ const initData = async () => {
|
|
|
const data = await apiContractIncome(tenderStore.bid)
|
|
|
if (data.code === consts.RET_CODE.SUCCESS) {
|
|
|
if (data.isTemplate && data.isTemplate === 1) {
|
|
@@ -83,13 +85,13 @@ const GCsheet: React.FC<iTableContentPorps> = ({ changeModalType, row, setRow })
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- interface iLabelHandlerProps {
|
|
|
+ interface HandleLabelProps {
|
|
|
id: string
|
|
|
bidsectionId: string
|
|
|
name?: string
|
|
|
}
|
|
|
|
|
|
- const newLabelHandler = async (type: string, payload: iLabelHandlerProps) => {
|
|
|
+ const handleNewLabel = async (type: string, payload: HandleLabelProps) => {
|
|
|
let RET_CODE: number = -1
|
|
|
if (type === 'create') {
|
|
|
payload.name = inputEl.current?.state.value
|
|
@@ -109,7 +111,7 @@ const GCsheet: React.FC<iTableContentPorps> = ({ changeModalType, row, setRow })
|
|
|
const codeChange = async (row: iIncomeTree, value: string) => {
|
|
|
const { code = -1 } = await apiUpdateSerial(row.id, row.bidsectionId, value)
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
|
- initHandler()
|
|
|
+ initData()
|
|
|
}
|
|
|
}
|
|
|
const inputEl = useRef<Input>(null)
|
|
@@ -165,8 +167,8 @@ const GCsheet: React.FC<iTableContentPorps> = ({ changeModalType, row, setRow })
|
|
|
size="small"
|
|
|
type="text"
|
|
|
ref={inputEl}
|
|
|
- onPressEnter={() => newLabelHandler(type, { id: type === 'edit' ? record.id : record.parentId, bidsectionId: record.bidsectionId })}
|
|
|
- onBlur={() => newLabelHandler(type, { id: type === 'edit' ? record.id : record.parentId, bidsectionId: record.bidsectionId })}
|
|
|
+ onPressEnter={() => handleNewLabel(type, { id: type === 'edit' ? record.id : record.parentId, bidsectionId: record.bidsectionId })}
|
|
|
+ onBlur={() => handleNewLabel(type, { id: type === 'edit' ? record.id : record.parentId, bidsectionId: record.bidsectionId })}
|
|
|
/>)
|
|
|
} else {
|
|
|
return <span>{text}</span>
|
|
@@ -219,7 +221,7 @@ const GCsheet: React.FC<iTableContentPorps> = ({ changeModalType, row, setRow })
|
|
|
}
|
|
|
const { code = -1 } = await apiSetTemplate(sectionTemplate.template, tenderStore.tender.bidsectionId, 0)
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
|
- await initHandler()
|
|
|
+ await initData()
|
|
|
}
|
|
|
setSectionTemplate({
|
|
|
...sectionTemplate,
|
|
@@ -227,6 +229,12 @@ const GCsheet: React.FC<iTableContentPorps> = ({ changeModalType, row, setRow })
|
|
|
isShow: false
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+ // modal 关闭 - 回调
|
|
|
+ const handleModalCancel = () => {
|
|
|
+ history.push('/console/contract/content/summary')
|
|
|
+ }
|
|
|
+
|
|
|
// 模板选择radio切换回调
|
|
|
const handleRadioEvent = (e: RadioChangeEvent) => {
|
|
|
if (e.target.checked) {
|
|
@@ -283,6 +291,7 @@ const GCsheet: React.FC<iTableContentPorps> = ({ changeModalType, row, setRow })
|
|
|
okText="确定"
|
|
|
confirmLoading={sectionTemplate.loading}
|
|
|
cancelText="关闭"
|
|
|
+ onCancel={handleModalCancel}
|
|
|
closable={false}
|
|
|
keyboard={false}
|
|
|
onOk={() => handleModalConfirm()}
|