Commit 4e03cefc by zhaochengxiang

分支模型设置

parent 80906d50
.branch-select-model {
.tree {
height: calc(80vh - 30px);
overflow: auto;
}
}
\ No newline at end of file
...@@ -2,10 +2,11 @@ import React from 'react' ...@@ -2,10 +2,11 @@ import React from 'react'
import { Modal, Button, Spin, Form, Input, Select, } from 'antd' import { Modal, Button, Spin, Form, Input, Select, } from 'antd'
import { useDebounceEffect } from 'ahooks' import { useDebounceEffect } from 'ahooks'
import { SettingOutlined } from '@ant-design/icons' import { SettingOutlined } from '@ant-design/icons'
import produce from 'immer'
import { dispatch } from '../../../../model' import { dispatch } from '../../../../model'
import { AppContext } from '../../../../App' import { AppContext } from '../../../../App'
import produce from 'immer' import SelectModel from './branch-select-model'
const FC = (props) => { const FC = (props) => {
const { visible, type, item, onCancel} = props const { visible, type, item, onCancel} = props
...@@ -92,7 +93,7 @@ const Basic = React.forwardRef(function ({ type, item }, ref) { ...@@ -92,7 +93,7 @@ const Basic = React.forwardRef(function ({ type, item }, ref) {
let rows = await form.validateFields() let rows = await form.validateFields()
if (type === 'add') { if (type === 'add') {
rows = {...rows, easyDataModelerMemberShip: { rows = {...rows, easyDataModelerMemberShip: {
easyDataModelerMemberShip: [ easyDataModelerMembers: [
{ {
admin: true, admin: true,
id: app?.user?.userId, id: app?.user?.userId,
...@@ -183,6 +184,7 @@ const Basic = React.forwardRef(function ({ type, item }, ref) { ...@@ -183,6 +184,7 @@ const Basic = React.forwardRef(function ({ type, item }, ref) {
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label='模型设置' label='模型设置'
name='forked'
style={{ marginBottom }} style={{ marginBottom }}
> >
<ModelConfigItem /> <ModelConfigItem />
...@@ -224,12 +226,37 @@ const UsersItem = ({ loading, users, value, onChange }) => { ...@@ -224,12 +226,37 @@ const UsersItem = ({ loading, users, value, onChange }) => {
) )
} }
const ModelConfigItem = () => { const ModelConfigItem = ({ value, onChange }) => {
const [selectModelParams, setSelectModelParams] = React.useState({
visible: false,
items: undefined,
})
const onConfigClick = () => { const onConfigClick = () => {
setSelectModelParams({
visible: true,
items: (value??[]).map(item => ({
id: item
})),
})
} }
return ( return (
<span>
<span className='mr-3'>{`共${(value??[]).length}个`}</span>
<Button icon={<SettingOutlined />} onClick={onConfigClick} /> <Button icon={<SettingOutlined />} onClick={onConfigClick} />
<SelectModel
{...selectModelParams}
onCancel={(val) => {
setSelectModelParams({
visible: false,
items: undefined,
})
if (val) {
onChange?.(val.map(item => item.id))
}
}}
/>
</span>
) )
} }
\ No newline at end of file
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