Commit d96bc940 by zhaochengxiang

标签增加哪行

parent a9dcad0f
...@@ -8,6 +8,31 @@ import './AddTagModal.less'; ...@@ -8,6 +8,31 @@ import './AddTagModal.less';
const { Option } = Select; const { Option } = Select;
const ClassifySelect = ({ value = '', data = [], onChange, ...restProps }) => {
const onClassifyChange = (value) => {
onChange((value||[]).join(','));
}
return (
<Select
mode="multiple"
value={value?value.split(','):[]}
onChange={onClassifyChange}
allowClear
style={{ width: '100%' }}
>
{
(data?.tagClassifyNodes||[]).map((item, index) => {
return (
<Option key={item.id}>{item.cnName||''}</Option>
);
})
}
</Select>
)
}
const AddTagModal = (props) => { const AddTagModal = (props) => {
const { visible, onCancel, id, type, creator } = props; const { visible, onCancel, id, type, creator } = props;
...@@ -150,12 +175,7 @@ const AddTagModal = (props) => { ...@@ -150,12 +175,7 @@ const AddTagModal = (props) => {
const newTagForm = JSON.parse(JSON.stringify(tagForm)); const newTagForm = JSON.parse(JSON.stringify(tagForm));
(newTagForm?.targetParameters||[]).forEach(param => { (newTagForm?.targetParameters||[]).forEach(param => {
param.value = row[param.name];
if (param.selectMode === 'multiSelect') {
param.value = row[param.name].join(',');
} else {
param.value = row[param.name];
}
}) })
setConfirmLoading(true); setConfirmLoading(true);
...@@ -226,6 +246,7 @@ const AddTagModal = (props) => { ...@@ -226,6 +246,7 @@ const AddTagModal = (props) => {
const reset = () => { const reset = () => {
setConfirmLoading(false); setConfirmLoading(false);
form.resetFields();
setStep(0); setStep(0);
setSelectTag(null); setSelectTag(null);
setKeyword(''); setKeyword('');
...@@ -337,19 +358,9 @@ const AddTagModal = (props) => { ...@@ -337,19 +358,9 @@ const AddTagModal = (props) => {
); );
} else if (param.selectMode==='multiSelect') { } else if (param.selectMode==='multiSelect') {
itemComponent = ( itemComponent = (
<Select <ClassifySelect
mode="multiple" data={param}
allowClear />
style={{ width: '100%' }}
>
{
(param?.tagClassifyNodes||[]).map((item, index) => {
return (
<Option key={item.id}>{item.cnName||''}</Option>
);
})
}
</Select>
); );
} }
......
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