xieyonghong пре 3 година
родитељ
комит
df8260b6ca
2 измењених фајлова са 2 додато и 2 уклоњено
  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>
         parentChange={(pId) => {
-          console.log(getSortIndex(treeData, pId));
           return getSortIndex(treeData, pId);
         }}
         title={

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

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