|
|
@@ -19,8 +19,9 @@ export default () => { |
|
|
|
const [fromType, setFromType] = useState<any>('table') |
|
|
|
const ref = useRef<ProFormInstance>(); |
|
|
|
const actionRef = useRef<ActionType>(); |
|
|
|
|
|
|
|
const [selectDataRow, setSelectDataRow] = useState<dictType.output>() |
|
|
|
// const actionRef1 = useRef<ActionType>(); |
|
|
|
const actionRef1 = useRef<ActionType>(); |
|
|
|
// 编辑子项 |
|
|
|
const [modelTitle, setModelTitle] = useState<string>(); |
|
|
|
const [dataSource, setdataSource] = useState([]) |
|
|
@@ -29,7 +30,7 @@ export default () => { |
|
|
|
|
|
|
|
// // 拿到当前子项id |
|
|
|
const [thisitem, setthisitem] = useState({}); |
|
|
|
// const [thisaaa, setthisaaa] = useState({}); |
|
|
|
; |
|
|
|
|
|
|
|
// 设置新增子项的弹窗 |
|
|
|
const [isitemModalOpen, setisitemModalOpen] = useState(false); |
|
|
@@ -113,10 +114,12 @@ export default () => { |
|
|
|
return { |
|
|
|
data: [], |
|
|
|
success: false, |
|
|
|
total: 0, |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
setIsModalOpen(true) |
|
|
|
actionRef1.current?.reload() |
|
|
|
|
|
|
|
}} key={+new Date() + Math.random()} target="_blank" rel="noopener noreferrer"> |
|
|
|
设置子项 |
|
|
@@ -224,7 +227,7 @@ export default () => { |
|
|
|
if (r.statusCode === 200) { |
|
|
|
message.success(r.statusCode === 200 ? '删除成功' : r.message); |
|
|
|
// 重新加载页面 |
|
|
|
actionRef.current?.reload(); |
|
|
|
actionRef1.current?.reload() |
|
|
|
} |
|
|
|
}); |
|
|
|
}} |
|
|
@@ -249,20 +252,26 @@ export default () => { |
|
|
|
if (values.id) { |
|
|
|
const response = await dictDataApi.Update(values); |
|
|
|
if (response.statusCode === 200) { |
|
|
|
|
|
|
|
message.success('修改成功'); |
|
|
|
actionRef.current?.reload(); |
|
|
|
// 重新加载页面 |
|
|
|
actionRef1.current?.reload(); |
|
|
|
|
|
|
|
setisitemModalOpen(false); |
|
|
|
} else { |
|
|
|
message.error(JSON.stringify(response.errors) || '修改失败'); |
|
|
|
} |
|
|
|
} else { |
|
|
|
const response = await dictDataApi.Add(values); |
|
|
|
actionRef.current?.reload() |
|
|
|
// 重新加载页面 |
|
|
|
|
|
|
|
actionRef1.current?.reload(); |
|
|
|
console.log('response', response); |
|
|
|
if (response.statusCode === 200) { |
|
|
|
|
|
|
|
|
|
|
|
actionRef.current?.reload(); |
|
|
|
// 重新加载 |
|
|
|
|
|
|
|
actionRef1.current?.reload(); |
|
|
|
message.success('添加成功'); |
|
|
|
|
|
|
|
// actionR.current?.reload(); |
|
|
@@ -337,7 +346,7 @@ export default () => { |
|
|
|
} |
|
|
|
}} |
|
|
|
pagination={{ |
|
|
|
pageSize: 5, |
|
|
|
pageSize: 10, |
|
|
|
}} |
|
|
|
rowKey="id" |
|
|
|
dateFormatter="string" |
|
|
@@ -365,13 +374,13 @@ export default () => { |
|
|
|
search={false} |
|
|
|
|
|
|
|
dataSource={dataSource} |
|
|
|
actionRef={actionRef} |
|
|
|
request={async () => { |
|
|
|
actionRef={actionRef1} |
|
|
|
request={async(params = {}) => { |
|
|
|
const jsonData: dictData.queryPage = { |
|
|
|
pageIndex: 1, |
|
|
|
pageSize: 10, |
|
|
|
name: '', |
|
|
|
typeId: thisitem.id |
|
|
|
pageIndex: params.current || 1, |
|
|
|
pageSize: params.pageSize || 10, |
|
|
|
name: params.name || '', |
|
|
|
typeId: thisitem.id, |
|
|
|
|
|
|
|
// code:params.code||'' |
|
|
|
}; |
|
|
@@ -380,6 +389,7 @@ export default () => { |
|
|
|
|
|
|
|
if (res.statusCode === 200) { |
|
|
|
setdataSource(res.data.items); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return { |
|
|
@@ -390,6 +400,7 @@ export default () => { |
|
|
|
}} |
|
|
|
onChange={(pagination) => { |
|
|
|
console.log(pagination); |
|
|
|
|
|
|
|
|
|
|
|
}} |
|
|
|
pagination={{ |
|
|
@@ -405,17 +416,19 @@ export default () => { |
|
|
|
key="button" |
|
|
|
type="primary" |
|
|
|
onClick={() => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typeForm.resetFields(); |
|
|
|
setisitemModalOpen(true) |
|
|
|
|
|
|
|
|
|
|
|
setModelTitle('新增子项'); |
|
|
|
typeForm.setFieldsValue({"typeId":thisitem.id}); |
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
> |
|
|
|
新增子项 |
|
|
|
</Button>, |
|
|
|