Parcourir la source

fix: bug#4917

xieyonghong il y a 3 ans
Parent
commit
df8260b6ca
2 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 0 1
      src/pages/system/Department/index.tsx
  2. 2 1
      src/pages/system/Department/save.tsx

+ 0 - 1
src/pages/system/Department/index.tsx

@@ -368,7 +368,6 @@ export default observer(() => {
       />
       />
       <Save<DepartmentItem>
       <Save<DepartmentItem>
         parentChange={(pId) => {
         parentChange={(pId) => {
-          console.log(getSortIndex(treeData, pId));
           return getSortIndex(treeData, pId);
           return getSortIndex(treeData, pId);
         }}
         }}
         title={
         title={

+ 2 - 1
src/pages/system/Department/save.tsx

@@ -73,7 +73,8 @@ const Save = <T extends object>(props: SaveModalProps<T>) => {
     initialValues: data || {},
     initialValues: data || {},
     effects: () => {
     effects: () => {
       onFieldReact('sortIndex', (field) => {
       onFieldReact('sortIndex', (field) => {
-        if (props.parentChange) {
+        const value = (field as Field).value;
+        if (props.parentChange && !value) {
           const sortIndex = props.parentChange(field.query('parentId').value());
           const sortIndex = props.parentChange(field.query('parentId').value());
           (field as Field).value = !!sortIndex ? sortIndex : sortIndex + 1;
           (field as Field).value = !!sortIndex ? sortIndex : sortIndex + 1;
         }
         }