outaozhen пре 4 година
родитељ
комит
fb43c09621

+ 1 - 1
src/pages/Product/Road/Enterprise/components/AddEnterprise/SearchCompanyInput.jsx

@@ -22,7 +22,7 @@ const SearchCompanyInput = ({ value, onChange, disabled, validateFn }) => {
     if (code === consts.RET_CODE.SUCCESS) {
       const { list = [] } = data
       console.log(data)
-      if (list?.length) {
+      if (list?.findIndex(item => (item.value === list.name) !== -1)) {
         validateFn(validateEnum.Error)
       } else {
         validateFn(validateEnum.Success)

+ 6 - 1
src/pages/Product/Road/Enterprise/components/AddEnterprise/index.jsx

@@ -22,7 +22,8 @@ const AddEnterprise = ({
   }
   const [state, setState] = useState({
     visible: false,
-    list: null
+    list: null,
+    newValue: ''
   })
   const dispatch = useDispatch()
   useEffect(() => {
@@ -39,7 +40,11 @@ const AddEnterprise = ({
   const selectProps = {
     mode: 'multiple',
     style: { width: '100%' },
+    value: state.newValue,
     options: compilationv2.map(item => ({ label: item.name, value: item.ID })),
+    onChange: newValue => {
+      setState({ ...state, newValue })
+    },
     placeholder: '请选择授权定额',
     maxTagCount: 'responsive'
   }