diff --git a/dolphinscheduler-ui/src/views/resource/file/edit/index.tsx b/dolphinscheduler-ui/src/views/resource/file/edit/index.tsx index 9845bdbff417fc6d42c39a7dba4a1564f63dd0cd..73686ba0534c625d7e033b84984164123767d34e 100644 --- a/dolphinscheduler-ui/src/views/resource/file/edit/index.tsx +++ b/dolphinscheduler-ui/src/views/resource/file/edit/index.tsx @@ -17,7 +17,7 @@ import { useRoute, useRouter } from 'vue-router' import { defineComponent, toRefs, watch } from 'vue' -import { NButton, NForm, NFormItem, NSpace } from 'naive-ui' +import { NButton, NForm, NFormItem, NSpace, NSpin } from 'naive-ui' import { useI18n } from 'vue-i18n' import { useForm } from './use-form' import { useEdit } from './use-edit' @@ -38,7 +38,7 @@ export default defineComponent({ const { getResourceView, handleUpdateContent } = useEdit(state) const handleFileContent = () => { - state.fileForm.content = resourceViewRef.value.content + state.fileForm.content = resourceViewRef.state.value.content handleUpdateContent(fileId) } @@ -47,10 +47,9 @@ export default defineComponent({ } const resourceViewRef = getResourceView(fileId) - watch( - () => resourceViewRef.value.content, - () => (state.fileForm.content = resourceViewRef.value.content) + () => resourceViewRef.state.value.content, + () => (state.fileForm.content = resourceViewRef.state.value.content) ) return { @@ -65,44 +64,52 @@ export default defineComponent({ const { t } = useI18n() return ( -
-

- {this.resourceViewRef.alias} -

- - - - - - - {t('resource.file.return')} - - {this.componentName === 'resource-file-edit' && ( + {this.resourceViewRef.isReady.value ? ( +
+

+ {this.resourceViewRef.state.value.alias} +

+ + + + + this.handleFileContent()} - class='btn-submit' + text + style={{ marginRight: '15px' }} + onClick={this.handleReturn} + class='btn-cancel' > - {t('resource.file.save')} + {t('resource.file.return')} - )} - - -
+ {this.componentName === 'resource-file-edit' && ( + this.handleFileContent()} + class='btn-submit' + > + {t('resource.file.save')} + + )} +
+
+
+ ) : ( + + + + )}
) } diff --git a/dolphinscheduler-ui/src/views/resource/file/edit/use-edit.ts b/dolphinscheduler-ui/src/views/resource/file/edit/use-edit.ts index 7dac246bb3747746c38061473ae99a36a4660c9c..d2edaa96658c8b3af5fb17f7bc020ed96299a979 100644 --- a/dolphinscheduler-ui/src/views/resource/file/edit/use-edit.ts +++ b/dolphinscheduler-ui/src/views/resource/file/edit/use-edit.ts @@ -33,11 +33,10 @@ export function useEdit(state: any) { skipLineNum: 0, limit: 3000 } - const { state } = useAsyncState(viewResource(params, id), { + return useAsyncState(viewResource(params, id), { alias: '', content: '' }) - return state } const handleUpdateContent = (id: number) => {