|
|
|
|
@ -36,6 +36,7 @@ const AddComponentModal = ({ visible, baseInfo, setVisible, onReFresh }) => {
|
|
|
|
|
const [componentDesignData, setComponentDesignData] = useState([]); // 新增状态用于存储接口设计数据
|
|
|
|
|
const [selectedApiData, setSelectedApiData] = useState(null); // 新增状态用于存储选中的API数据
|
|
|
|
|
const [showApiModal, setShowApiModal] = useState(false);
|
|
|
|
|
const [created, setCreated] = useState(false); // 是否提交了组件信息
|
|
|
|
|
const [file, setFile] = useState(null);
|
|
|
|
|
const [form] = Form.useForm();
|
|
|
|
|
|
|
|
|
|
@ -79,14 +80,14 @@ const AddComponentModal = ({ visible, baseInfo, setVisible, onReFresh }) => {
|
|
|
|
|
setSelectedApiData(record);
|
|
|
|
|
setShowApiModal(true);
|
|
|
|
|
}}
|
|
|
|
|
disabled={!['DEFAULT', 'DESIGN'].includes(baseInfo.componentStatus)}
|
|
|
|
|
disabled={baseInfo && !['DEFAULT', 'DESIGN'].includes(baseInfo.componentStatus)}
|
|
|
|
|
>
|
|
|
|
|
编辑
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
type="text"
|
|
|
|
|
status="danger"
|
|
|
|
|
disabled={!['DEFAULT', 'DESIGN'].includes(baseInfo.componentStatus)}
|
|
|
|
|
disabled={baseInfo && !['DEFAULT', 'DESIGN'].includes(baseInfo.componentStatus)}
|
|
|
|
|
onClick={async () => {
|
|
|
|
|
// 显示删除确认框
|
|
|
|
|
Modal.confirm({
|
|
|
|
|
@ -228,6 +229,7 @@ const AddComponentModal = ({ visible, baseInfo, setVisible, onReFresh }) => {
|
|
|
|
|
|
|
|
|
|
// 提交成功后获取组件设计数据
|
|
|
|
|
if (res.data && res.data.id) {
|
|
|
|
|
setCreated(true);
|
|
|
|
|
getComponentDesignData(res.data.id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -438,6 +440,7 @@ const AddComponentModal = ({ visible, baseInfo, setVisible, onReFresh }) => {
|
|
|
|
|
style={{ width: '90%' }}
|
|
|
|
|
allowClear
|
|
|
|
|
placeholder="请输入代码标识"
|
|
|
|
|
disabled={created || baseInfo}
|
|
|
|
|
onChange={(e) => validateProjectId(e)}
|
|
|
|
|
/>
|
|
|
|
|
</FormItem>
|
|
|
|
|
@ -483,6 +486,7 @@ const AddComponentModal = ({ visible, baseInfo, setVisible, onReFresh }) => {
|
|
|
|
|
<Select
|
|
|
|
|
placeholder="请选择组件语言"
|
|
|
|
|
style={{ width: '90%' }}
|
|
|
|
|
disabled={created || baseInfo}
|
|
|
|
|
>
|
|
|
|
|
{['Java:8', 'Python:3.10.12'].map((option, index) => (
|
|
|
|
|
<Option key={option} disabled={index === 3} value={option}>
|
|
|
|
|
@ -525,6 +529,7 @@ const AddComponentModal = ({ visible, baseInfo, setVisible, onReFresh }) => {
|
|
|
|
|
<Select
|
|
|
|
|
placeholder="请选择组件类型"
|
|
|
|
|
style={{ width: '90%' }}
|
|
|
|
|
disabled={created || baseInfo}
|
|
|
|
|
>
|
|
|
|
|
{['普通组件', '监听组件'].map((option, index) => (
|
|
|
|
|
<Option key={option} disabled={index === 3} value={option}>
|
|
|
|
|
@ -567,7 +572,7 @@ const AddComponentModal = ({ visible, baseInfo, setVisible, onReFresh }) => {
|
|
|
|
|
setSelectedApiData(null); // 确保新增时清空选中的API数据
|
|
|
|
|
setShowApiModal(true);
|
|
|
|
|
}}
|
|
|
|
|
disabled={!['DEFAULT', 'DESIGN'].includes(baseInfo.componentStatus)}
|
|
|
|
|
disabled={baseInfo && !['DEFAULT', 'DESIGN'].includes(baseInfo.componentStatus)}
|
|
|
|
|
>
|
|
|
|
|
+ 新增接口
|
|
|
|
|
</Button>
|
|
|
|
|
|