Unverified Commit c2a7716e authored by ZackYoung's avatar ZackYoung Committed by GitHub

udf添加空模板选择 (#1219)

parent 1828f3e3
......@@ -61,6 +61,7 @@ const SimpleTaskForm: React.FC<UpdateFormProps> = (props) => {
});
const [dialect, setDialect] = useState<string>('')
const [isShowUDFClassName, setShowUDFClassName] = useState<boolean>(true)
const [templateTree, setTemplateTree] = useState<Object[]>([])
const [templateData, setTemplateData] = useState<Object[]>([])
const [form] = Form.useForm();
......@@ -96,12 +97,23 @@ const SimpleTaskForm: React.FC<UpdateFormProps> = (props) => {
setFormVals(data);
handleUpdate(data);
};
const handlerChangeUdf = (value: any[]) => {
if (value[1] == 0) {
setShowUDFClassName(false)
}else{
setShowUDFClassName(true)
}
}
const handlerSetDialect = (value: string) => {
setDialect(value)
if (isUDF(value)) {
templateTree.map(x => {
if (x.label == value) {
setTemplateData(x.children)
const data = x.children
data.splice(data.length, 0, {label: "Empty", value: "Empty", children: [{label: "Empty", value: 0}]})
setTemplateData(data)
setShowUDFClassName(true)
form.setFieldsValue({"config.templateId": [x.children[0].label, x.children[0].children[0].label, x.children[0].children[0].value]})
}
})
......@@ -156,12 +168,13 @@ const SimpleTaskForm: React.FC<UpdateFormProps> = (props) => {
{<Cascader
displayRender={(label: string[]) => label.slice(0, 2).join(" / ")}
options={templateData}
onChange={handlerChangeUdf}
/>}
</Form.Item>
<Form.Item
hidden={!isShowUDFClassName}
name="config.className"
label="类名或方法名"
rules={[{required: true, message: '请输入类名或方法名!'}]}>
label="类名或方法名">
<Input placeholder="请输入"/>
</Form.Item>
</>) : undefined}
......
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