@ -15,7 +15,7 @@
* limitations under the License .
* limitations under the License .
* /
* /
import { defineComponent , toRefs , PropType , watch } from 'vue'
import { defineComponent , toRefs , PropType , watch , computed } from 'vue'
import { NForm , NFormItem , NInput } from 'naive-ui'
import { NForm , NFormItem , NInput } from 'naive-ui'
import { useI18n } from 'vue-i18n'
import { useI18n } from 'vue-i18n'
import Modal from '@/components/modal'
import Modal from '@/components/modal'
@ -62,8 +62,10 @@ export default defineComponent({
state . folderForm . description = props . row . description
state . folderForm . description = props . row . description
}
}
)
)
const fileEdit = computed ( ( ) = > props . row . id && ! props . row . directory )
return {
return {
fileEdit ,
hideModal ,
hideModal ,
handleCreate ,
handleCreate ,
handleRename ,
handleRename ,
@ -76,7 +78,9 @@ export default defineComponent({
return (
return (
< Modal
< Modal
show = { this . $props . show }
show = { this . $props . show }
title = { t ( 'resource.udf.create_folder' ) }
title = {
this . row . id ? t ( 'resource.udf.edit' ) : t ( 'resource.udf.create_folder' )
}
onCancel = { this . hideModal }
onCancel = { this . hideModal }
onConfirm = { this . row . id ? this . handleRename : this.handleCreate }
onConfirm = { this . row . id ? this . handleRename : this.handleCreate }
confirmClassName = 'btn-submit'
confirmClassName = 'btn-submit'
@ -84,7 +88,14 @@ export default defineComponent({
confirmLoading = { this . saving }
confirmLoading = { this . saving }
>
>
< NForm rules = { this . rules } ref = 'folderFormRef' >
< NForm rules = { this . rules } ref = 'folderFormRef' >
< NFormItem label = { t ( 'resource.udf.folder_name' ) } path = 'name' >
< NFormItem
label = {
this . fileEdit
? t ( 'resource.udf.file_name' )
: t ( 'resource.udf.folder_name' )
}
path = 'name'
>
< NInput
< NInput
v - model = { [ this . folderForm . name , 'value' ] }
v - model = { [ this . folderForm . name , 'value' ] }
placeholder = { t ( 'resource.udf.enter_name_tips' ) }
placeholder = { t ( 'resource.udf.enter_name_tips' ) }