Browse Source

fix: 项目类型选项11111

outaozhen 3 years ago
parent
commit
9f024b2f96
1 changed files with 5 additions and 4 deletions
  1. 5 4
      src/pages/Schema/Option/index.tsx

+ 5 - 4
src/pages/Schema/Option/index.tsx

@@ -51,6 +51,7 @@ const Option = () => {
       enable: true
     }
   })
+  console.log(state.items)
 
   const { run: tryFetchList } = useRequest(queryDataSource, {
     onSuccess: (result: API.DataSourceMenuItem) => {
@@ -122,7 +123,7 @@ const Option = () => {
               ...state,
               modalType: ModalType.UPDATE,
               modalVisible: true,
-              items: state.menuDataItems,
+              // items: state.menuDataItems,
               current: {
                 ID: record.ID,
                 name: record.name,
@@ -233,14 +234,13 @@ const Option = () => {
                 await tryAddDataSourceItem({ ...values, dataSourceID: state.activeID })
               } else {
                 const newItemData = state.menuDataItems.map(item => {
-                  const newItem = { ...item }
                   if (item.ID === state.current.ID) {
-                    newItem.items = values
+                    const newItem = { ...values }
                     return newItem
                   }
                   return item
                 })
-
+                setState({ ...state, items: newItemData })
                 await tryUpdateDataSourceItem({
                   ...values,
                   ID: state.activeID,
@@ -254,6 +254,7 @@ const Option = () => {
               return false
             }
           }}>
+          <ProFormText name="ID" hidden />
           <ProFormText
             name="name"
             label="选项名称"