1
1
<script setup lang="ts">
2
2
import {
3
- Attachment ,
4
- AttachmentReferenceTypeEnum ,
5
- Episode ,
6
- EpisodeCollection ,
7
- Subject ,
8
- SubjectCollection ,
9
- SubjectTag ,
10
- SubjectTypeEnum ,
3
+ Attachment ,
4
+ AttachmentReferenceTypeEnum ,
5
+ Episode ,
6
+ EpisodeCollection ,
7
+ Subject ,
8
+ SubjectCollection ,
9
+ SubjectTag ,
10
+ SubjectTypeEnum ,
11
11
} from ' @runikaros/api-client' ;
12
- import { apiClient } from ' @/utils/api-client' ;
13
- import { formatDate } from ' @/utils/date' ;
12
+ import {apiClient } from ' @/utils/api-client' ;
13
+ import {formatDate } from ' @/utils/date' ;
14
14
import EpisodeDetailsDialog from ' ./EpisodeDetailsDialog.vue' ;
15
15
import router from ' @/router' ;
16
- import { Check , Close } from ' @element-plus/icons-vue' ;
16
+ import {Check , Close } from ' @element-plus/icons-vue' ;
17
17
import SubjectSyncDialog from ' ./SubjectSyncDialog.vue' ;
18
- import { useRoute } from ' vue-router' ;
19
- import { nextTick , onMounted , ref , watch } from ' vue' ;
18
+ import {useRoute } from ' vue-router' ;
19
+ import {nextTick , onMounted , ref , watch } from ' vue' ;
20
20
import {
21
- ElButton ,
22
- ElCol ,
23
- ElDescriptions ,
24
- ElDescriptionsItem ,
25
- ElImage ,
26
- ElInput ,
27
- ElMessage ,
28
- ElOption ,
29
- ElPopconfirm ,
30
- ElRow ,
31
- ElSelect ,
32
- ElTable ,
33
- ElTableColumn ,
34
- ElTag ,
21
+ ElButton ,
22
+ ElCol ,
23
+ ElDescriptions ,
24
+ ElDescriptionsItem ,
25
+ ElImage ,
26
+ ElInput ,
27
+ ElMessage ,
28
+ ElOption ,
29
+ ElPopconfirm ,
30
+ ElRow ,
31
+ ElSelect ,
32
+ ElTable ,
33
+ ElTableColumn ,
34
+ ElTag ,
35
35
} from ' element-plus' ;
36
36
import SubjectRemoteActionDialog from ' ./SubjectRemoteActionDialog.vue' ;
37
- import { useSettingStore } from ' @/stores/setting' ;
38
- import { episodeGroupLabelMap } from ' @/modules/common/constants' ;
39
- import { useUserStore } from ' @/stores/user' ;
37
+ import {useSettingStore } from ' @/stores/setting' ;
38
+ import {episodeGroupLabelMap } from ' @/modules/common/constants' ;
39
+ import {useUserStore } from ' @/stores/user' ;
40
40
import SubjectRelationDialog from ' ./SubjectRelationDialog.vue' ;
41
- import { useSubjectStore } from ' @/stores/subject' ;
41
+ import {useSubjectStore } from ' @/stores/subject' ;
42
42
import AttachmentMultiSelectDialog from ' @/modules/content/attachment/AttachmentMultiSelectDialog.vue' ;
43
43
import AttachmentSelectDialog from ' @/modules/content/attachment/AttachmentSelectDialog.vue' ;
44
44
import SubjectCollectDialog from ' @/components/modules/content/subject/SubjectCollectDialog.vue' ;
45
- import { useI18n } from ' vue-i18n' ;
45
+ import {useI18n } from ' vue-i18n' ;
46
46
47
47
const route = useRoute ();
48
48
const settingStore = useSettingStore ();
@@ -491,6 +491,7 @@ const showNewTagInput = () => {
491
491
};
492
492
const newTag = ref <SubjectTag >({});
493
493
const onNewTagNameChange = async () => {
494
+ if (! newTagInputVisible .value ) return ;
494
495
var tagName = newTag .value .name ;
495
496
if (
496
497
! tagName ||
@@ -510,13 +511,13 @@ const onNewTagNameChange = async () => {
510
511
name: newTag .value .name ,
511
512
},
512
513
});
513
- ElMessage .success (' 新建标签【' + newTag .value .name + ' 】成功' );
514
514
ElMessage .success (
515
515
t (' module.subject.tag.message.operate.create' , { name: newTag .value .name })
516
516
);
517
517
await fetchTags ();
518
518
newTagInputVisible .value = false ;
519
519
newTagInputRef .value ! .input ! .value = ' ' ;
520
+ newTag .value .name = ' '
520
521
};
521
522
522
523
const batchCancenMatchingSubjectButtonLoading = ref (false );
@@ -642,7 +643,7 @@ onMounted(fetchDatas);
642
643
{{ tag.name }}
643
644
</el-tag >
644
645
<el-input v-if =" newTagInputVisible" ref =" newTagInputRef" v-model =" newTag.name" size =" small"
645
- style =" max-width : 80px " @blur =" onNewTagNameChange" />
646
+ style =" max-width : 80px " @blur =" onNewTagNameChange" @keydown.enter = " onNewTagNameChange " />
646
647
<el-button v-else size =" small" @click =" showNewTagInput" >
647
648
{{ t('module.subject.details.text.button.add-tag') }}
648
649
</el-button >
0 commit comments