Commit a669fc26 by zhaochengxiang

评估方案

parent b0f5c229
......@@ -301,8 +301,8 @@ export function* saveEvaluation(payload) {
return yield call(service.saveEvaluation, payload)
}
export function* runEvaluation(payload) {
return yield call(service.runEvaluation, payload)
export function* runEvaluations(payload) {
return yield call(service.runEvaluations, payload)
}
export function* deleteEvaluations(payload) {
......
......@@ -308,7 +308,7 @@ export function saveEvaluation(payload) {
return PostJSON('/dataassetmanager/evaluationApi/saveProject', payload)
}
export function runEvaluation(payload) {
export function runEvaluations(payload) {
return PostJSON('/dataassetmanager/evaluationApi/run', payload)
}
......
......@@ -5,7 +5,7 @@ import produce from "immer"
import { dispatch } from '../../../model'
const FC = (props) => {
const { visible, onCancel } = props
const { visible, item, action, onCancel } = props
const [waiting, setWaiting] = React.useState(false)
const [loading, setLoading] = React.useState(false)
const [elements, setElements] = React.useState()
......@@ -43,7 +43,7 @@ const FC = (props) => {
dispatch({
type: 'assetmanage.saveEvaluation',
payload: {
data: row
data: (action==='add')?row:{...item, ...row}
},
callback: data => {
close(true)
......@@ -80,7 +80,7 @@ const FC = (props) => {
onCancel={() => { close() }}
>
<Spin spinning={loading || waiting}>
<Basic ref={basicRef} elements={elements} />
<Basic ref={basicRef} item={item} elements={elements} />
</Spin>
</Modal>
)
......@@ -88,15 +88,21 @@ const FC = (props) => {
export default FC
const Basic = React.forwardRef(function ({ elements }, ref) {
const Basic = React.forwardRef(function ({ item, elements }, ref) {
const [form] = Form.useForm()
React.useImperativeHandle(ref, () => ({
validate: async () => {
return await form.validateFields()
return await form?.validateFields()
},
}), [form])
React.useEffect(() => {
if (item) {
form?.setFieldsValue(item)
}
}, [item])
return (
<Form
form={form}
......
......@@ -28,7 +28,9 @@ const FC = (props) => {
const $keyword = React.useMemo(() => new Subject(), [])
const [keyword, setKeyword] = React.useState()
const [addEvaluateParams, setAddEvaluateParams] = React.useState({
visible: false
visible: false,
item: undefined,
action: undefined
})
const [selectedRows, setSelectedRows] = React.useState([])
......@@ -126,6 +128,20 @@ const FC = (props) => {
ellipsis: true,
render: (_, record) => record.createTimestamp ? new Date(record.createTimestamp).toLocaleString() : ''
},
{
title: '操作',
key: 'action',
width: 120,
render: (_,record) => (
<a onClick={() => {
setAddEvaluateParams({
visible: true,
item: record,
action: 'edit',
})
}}>编辑</a>
)
}
]
const getEvaluations = () => {
......@@ -163,7 +179,9 @@ const FC = (props) => {
<Space>
<Button onClick={() => {
setAddEvaluateParams({
visible: true
visible: true,
item: undefined,
action: 'add',
})
}}>新增</Button>
<Tooltip title={((selectedRows??[]).length===0)?'请先选择评估方案':''}>
......@@ -184,7 +202,7 @@ const FC = (props) => {
}
},
callback: data => {
showMessage('warn', '运行成功')
showMessage('success', '运行成功')
},
})
}
......@@ -209,7 +227,7 @@ const FC = (props) => {
}
},
callback: data => {
showMessage('warn', '删除成功')
showMessage('success', '删除成功')
getEvaluations()
},
})
......@@ -220,7 +238,7 @@ const FC = (props) => {
</Space>
<Space>
<Input size="middle"
placeholder="任务编号/分配人"
placeholder="方案名称"
value={keyword}
bordered={true} allowClear
onChange={(e) => {
......@@ -271,7 +289,9 @@ const FC = (props) => {
{...addEvaluateParams}
onCancel={(refresh) => {
setAddEvaluateParams({
visible: false
visible: false,
item: undefined,
action: undefined
})
refresh && getEvaluations()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment