@sigmaott/base-library-next 2.2.6 → 2.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.npmrc +3 -0
- package/locales/en.yaml +289 -289
- package/locales/vi.yaml +294 -294
- package/nuxt.config.ts +18 -18
- package/package.json +32 -33
- package/public/routes.json +33 -33
- package/src/api/axios.ts +3 -3
- package/src/api/index.ts +86 -86
- package/src/api-client-library/.openapi-generator/FILES +20 -20
- package/src/api-client-library/.openapi-generator-ignore +23 -23
- package/src/api-client-library/api/health-api.ts +119 -119
- package/src/api-client-library/api/presets-api.ts +599 -599
- package/src/api-client-library/api/profiles-api.ts +676 -676
- package/src/api-client-library/api.ts +20 -20
- package/src/api-client-library/base.ts +72 -72
- package/src/api-client-library/common.ts +150 -150
- package/src/api-client-library/configuration.ts +101 -101
- package/src/api-client-library/git_push.sh +57 -57
- package/src/api-client-library/index.ts +18 -18
- package/src/api-client-library/models/create-preset-dto.ts +223 -223
- package/src/api-client-library/models/create-profile-dto.ts +45 -45
- package/src/api-client-library/models/health-controller-get-health200-response-info-value.ts +32 -32
- package/src/api-client-library/models/health-controller-get-health200-response.ts +51 -51
- package/src/api-client-library/models/health-controller-get-health503-response.ts +51 -51
- package/src/api-client-library/models/index.ts +7 -7
- package/src/api-client-library/models/update-preset-dto.ts +223 -223
- package/src/api-client-library/models/update-profile-dto.ts +45 -45
- package/src/components/MediaSelection.vue +40 -40
- package/src/components/PresetModify.vue +154 -154
- package/src/components/PresetTable.vue +114 -114
- package/src/components/ProfileAllList.vue +137 -137
- package/src/components/ProfileFormModal.vue +79 -79
- package/src/components/ProfileModify.vue +152 -152
- package/src/components/ProfileTable.vue +68 -68
- package/src/components/WatermarkDraggableItem.vue +88 -88
- package/src/components/channel/ConfigWatermarkItem.vue +239 -239
- package/src/components/channel/WatermarkPreview.vue +19 -19
- package/src/components/common/Vue3DraggableResizable/Container.vue +71 -71
- package/src/components/common/Vue3DraggableResizable/index.vue +1327 -1327
- package/src/components/common/Vue3DraggableResizable/utils/dom.js +63 -63
- package/src/components/common/Vue3DraggableResizable/utils/fns.js +37 -37
- package/src/components/common/VueDraggableResizable/dom.js +63 -63
- package/src/components/common/VueDraggableResizable/fns.js +37 -37
- package/src/components/common/VueDraggableResizable/index.vue +958 -958
- package/src/components/preset/ConfigItem.vue +956 -956
- package/src/components/profile/ConfigItem.vue +765 -765
- package/src/components/profile/TableColumns.vue +137 -137
- package/src/components/shared/AudioInfoViewer.vue +101 -101
- package/src/components/shared/MediaInfoViewer.vue +249 -249
- package/src/components/shared/MediaInfoViewerSmall.vue +111 -105
- package/src/components/shared/PopoverProfile.vue +17 -17
- package/src/components/shared/VideoInfoViewer.vue +136 -136
- package/src/components/shared/fileSizeFilter.ts +26 -26
- package/src/composables/preset.ts +141 -141
- package/src/public/build-time.json +1 -1
- package/src/public/favicon.svg +15 -15
- package/src/public/logo.svg +9 -9
- package/src/public/routes.json +86 -86
- package/src/utils/common.ts +175 -175
- package/src/utils/config.ts +19 -19
- package/src/utils/preset.ts +353 -353
- package/src/utils/profile.ts +30 -30
- package/tsconfig.json +3 -3
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* Sigma Library
|
|
5
|
-
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6
|
-
*
|
|
7
|
-
* The version of the OpenAPI document: 1.0
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
-
* https://openapi-generator.tech
|
|
12
|
-
* Do not edit the class manually.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// May contain unused imports in some cases
|
|
17
|
-
// @ts-ignore
|
|
18
|
-
import { UpdatePresetDto } from './update-preset-dto';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
*
|
|
22
|
-
* @export
|
|
23
|
-
* @interface UpdateProfileDto
|
|
24
|
-
*/
|
|
25
|
-
export interface UpdateProfileDto {
|
|
26
|
-
/**
|
|
27
|
-
* Tên
|
|
28
|
-
* @type {string}
|
|
29
|
-
* @memberof UpdateProfileDto
|
|
30
|
-
*/
|
|
31
|
-
'name'?: string;
|
|
32
|
-
/**
|
|
33
|
-
* mô tả tuỳ chỉnh của đầu ra
|
|
34
|
-
* @type {string}
|
|
35
|
-
* @memberof UpdateProfileDto
|
|
36
|
-
*/
|
|
37
|
-
'description'?: string;
|
|
38
|
-
/**
|
|
39
|
-
*
|
|
40
|
-
* @type {Array<UpdatePresetDto>}
|
|
41
|
-
* @memberof UpdateProfileDto
|
|
42
|
-
*/
|
|
43
|
-
'presets'?: Array<UpdatePresetDto>;
|
|
44
|
-
}
|
|
45
|
-
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Sigma Library
|
|
5
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
// May contain unused imports in some cases
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
import { UpdatePresetDto } from './update-preset-dto';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @export
|
|
23
|
+
* @interface UpdateProfileDto
|
|
24
|
+
*/
|
|
25
|
+
export interface UpdateProfileDto {
|
|
26
|
+
/**
|
|
27
|
+
* Tên
|
|
28
|
+
* @type {string}
|
|
29
|
+
* @memberof UpdateProfileDto
|
|
30
|
+
*/
|
|
31
|
+
'name'?: string;
|
|
32
|
+
/**
|
|
33
|
+
* mô tả tuỳ chỉnh của đầu ra
|
|
34
|
+
* @type {string}
|
|
35
|
+
* @memberof UpdateProfileDto
|
|
36
|
+
*/
|
|
37
|
+
'description'?: string;
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
* @type {Array<UpdatePresetDto>}
|
|
41
|
+
* @memberof UpdateProfileDto
|
|
42
|
+
*/
|
|
43
|
+
'presets'?: Array<UpdatePresetDto>;
|
|
44
|
+
}
|
|
45
|
+
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
const props = defineProps<{
|
|
3
|
-
mediaType: 'audio' | 'video' | 'data' | string & {}
|
|
4
|
-
exclusion: string[]
|
|
5
|
-
}>()
|
|
6
|
-
|
|
7
|
-
defineEmits(['selectItem'])
|
|
8
|
-
|
|
9
|
-
const mediaType = toRef(props, 'mediaType')
|
|
10
|
-
function getQuery() {
|
|
11
|
-
return JSON.stringify({
|
|
12
|
-
type: {
|
|
13
|
-
$eq: mediaType.value,
|
|
14
|
-
},
|
|
15
|
-
})
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const params = ref({
|
|
19
|
-
page: 1,
|
|
20
|
-
perPage: 15,
|
|
21
|
-
q: getQuery(),
|
|
22
|
-
sort: '',
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
watch(
|
|
26
|
-
mediaType,
|
|
27
|
-
() => {
|
|
28
|
-
params.value.q = getQuery()
|
|
29
|
-
},
|
|
30
|
-
{ immediate: true },
|
|
31
|
-
)
|
|
32
|
-
</script>
|
|
33
|
-
|
|
34
|
-
<template>
|
|
35
|
-
<PresetTable
|
|
36
|
-
v-model:params="params"
|
|
37
|
-
height="400px"
|
|
38
|
-
@select="(item) => $emit('selectItem', item)"
|
|
39
|
-
/>
|
|
40
|
-
</template>
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
const props = defineProps<{
|
|
3
|
+
mediaType: 'audio' | 'video' | 'data' | string & {}
|
|
4
|
+
exclusion: string[]
|
|
5
|
+
}>()
|
|
6
|
+
|
|
7
|
+
defineEmits(['selectItem'])
|
|
8
|
+
|
|
9
|
+
const mediaType = toRef(props, 'mediaType')
|
|
10
|
+
function getQuery() {
|
|
11
|
+
return JSON.stringify({
|
|
12
|
+
type: {
|
|
13
|
+
$eq: mediaType.value,
|
|
14
|
+
},
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const params = ref({
|
|
19
|
+
page: 1,
|
|
20
|
+
perPage: 15,
|
|
21
|
+
q: getQuery(),
|
|
22
|
+
sort: '',
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
watch(
|
|
26
|
+
mediaType,
|
|
27
|
+
() => {
|
|
28
|
+
params.value.q = getQuery()
|
|
29
|
+
},
|
|
30
|
+
{ immediate: true },
|
|
31
|
+
)
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<template>
|
|
35
|
+
<PresetTable
|
|
36
|
+
v-model:params="params"
|
|
37
|
+
height="400px"
|
|
38
|
+
@select="(item) => $emit('selectItem', item)"
|
|
39
|
+
/>
|
|
40
|
+
</template>
|
|
@@ -1,154 +1,154 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { objectMap } from '@antfu/utils'
|
|
3
|
-
import { presetsApi } from '../api'
|
|
4
|
-
import type { CreatePresetDto } from '~/api-client-library'
|
|
5
|
-
|
|
6
|
-
const props = withDefaults(defineProps<{
|
|
7
|
-
id?: string
|
|
8
|
-
mode?: 'create' | 'edit' | 'clone'
|
|
9
|
-
item: any
|
|
10
|
-
exclusion: string[]
|
|
11
|
-
disable: string[]
|
|
12
|
-
defaultMediaType?: 'video' | 'audio' | 'data'
|
|
13
|
-
prop?: string
|
|
14
|
-
isPackage?: boolean
|
|
15
|
-
}>(), {
|
|
16
|
-
mode: 'create',
|
|
17
|
-
item: () => { },
|
|
18
|
-
exclusion: () => [],
|
|
19
|
-
disable: () => [],
|
|
20
|
-
})
|
|
21
|
-
const emit = defineEmits(['close'])
|
|
22
|
-
const id = toRef(props, 'id')
|
|
23
|
-
|
|
24
|
-
const initFields = ref({
|
|
25
|
-
id: '',
|
|
26
|
-
// TODO: refactor me
|
|
27
|
-
type: props.defaultMediaType as 'video' | 'audio' | 'data',
|
|
28
|
-
name: '',
|
|
29
|
-
codec: '',
|
|
30
|
-
option: '',
|
|
31
|
-
bitrate: 0,
|
|
32
|
-
sampleRate: 0,
|
|
33
|
-
fps: 0,
|
|
34
|
-
width: 0,
|
|
35
|
-
height: 0,
|
|
36
|
-
pixelFormat: '',
|
|
37
|
-
bframe: 0,
|
|
38
|
-
scaleType: '',
|
|
39
|
-
cq: 0,
|
|
40
|
-
interlaced: false,
|
|
41
|
-
cbr: false,
|
|
42
|
-
channel: 2,
|
|
43
|
-
profile: '',
|
|
44
|
-
volume: '',
|
|
45
|
-
streamId: '',
|
|
46
|
-
streamIndex: '',
|
|
47
|
-
})
|
|
48
|
-
const fields = ref(klona(initFields.value))
|
|
49
|
-
|
|
50
|
-
if (props.item) {
|
|
51
|
-
initFields.value = klona(props.item)
|
|
52
|
-
fields.value = klona(props.item)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
useQuery(
|
|
56
|
-
[QueryKeys.LibraryPresetDetail, id],
|
|
57
|
-
async () => {
|
|
58
|
-
const { data } = await presetsApi.presetsControllerGet({ id: id.value })
|
|
59
|
-
return {
|
|
60
|
-
// Add streamId and streamIndex to fields
|
|
61
|
-
...data,
|
|
62
|
-
streamIndex: 0,
|
|
63
|
-
streamId: '',
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
enabled: computed(() => !!id.value),
|
|
68
|
-
onSuccess(data) {
|
|
69
|
-
initFields.value = klona(data)
|
|
70
|
-
fields.value = klona(data)
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
function formToPayloadPreset(presetForm: any) {
|
|
76
|
-
const preset = emptyStr2Undefined(presetForm)
|
|
77
|
-
let removedKeys: string[] = []
|
|
78
|
-
if (presetForm.type === 'video')
|
|
79
|
-
removedKeys = ['sampleRate', 'channel', 'profile', 'volume']
|
|
80
|
-
else if (presetForm.type === 'audio')
|
|
81
|
-
removedKeys = ['fps', 'height', 'width', 'cbr', 'pixelFormat', 'scaleType', 'cq', 'interlaced']
|
|
82
|
-
else if (presetForm.type === 'data')
|
|
83
|
-
removedKeys = ['fps', 'height', 'width', 'cbr', 'pixelFormat', 'scaleType', 'cq', 'interlaced']
|
|
84
|
-
|
|
85
|
-
const payload = objectMap(preset, (k, v) => removedKeys.includes(k) ? undefined : [k, v])
|
|
86
|
-
|
|
87
|
-
return payload
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function resetFields() {
|
|
91
|
-
fields.value = klona(initFields.value)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const { createPresetMutation, isMutationLoading, updatePresetMutation } = usePresetMutation()
|
|
95
|
-
const { t } = useI18n()
|
|
96
|
-
const { formRef, formValue, handleSubmit, handleValidate, formErrors, getAtrrs, submitLocks } = useElForm<CreatePresetDto>({
|
|
97
|
-
initialValues: fields,
|
|
98
|
-
async onSubmit(values) {
|
|
99
|
-
if (props.mode === 'create') {
|
|
100
|
-
await createPresetMutation.mutateAsync(formToPayloadPreset(values))
|
|
101
|
-
ElMessage.success(t('library_preset.preset_created_successfully'))
|
|
102
|
-
formRef.value?.resetFields()
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (props.mode === 'edit') {
|
|
106
|
-
await updatePresetMutation.mutateAsync({
|
|
107
|
-
id: fields.value.id,
|
|
108
|
-
updatePresetDto: formToPayloadPreset(fields.value),
|
|
109
|
-
})
|
|
110
|
-
ElMessage.success(t('library_preset.preset_updated_successfully'))
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (props.mode === 'clone') {
|
|
114
|
-
const { id, ...rest } = fields.value
|
|
115
|
-
await createPresetMutation.mutateAsync(formToPayloadPreset(rest))
|
|
116
|
-
ElMessage.success(t('library_preset.preset_cloned_successfully'))
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
emit('close')
|
|
120
|
-
resetFields()
|
|
121
|
-
},
|
|
122
|
-
})
|
|
123
|
-
if (props.prop)
|
|
124
|
-
useSyncElForm(props.prop, { formValue, formErrors, submitLocks, formRef })
|
|
125
|
-
|
|
126
|
-
const isSubmitting = ref(false)
|
|
127
|
-
|
|
128
|
-
function handleClose() {
|
|
129
|
-
if (!isSubmitting.value)
|
|
130
|
-
emit('close')
|
|
131
|
-
}
|
|
132
|
-
</script>
|
|
133
|
-
|
|
134
|
-
<template>
|
|
135
|
-
<el-form
|
|
136
|
-
ref="formRef" label-position="top" label-width="80px" :model="formValue" :validate-on-rule-change="true"
|
|
137
|
-
@validate="handleValidate"
|
|
138
|
-
>
|
|
139
|
-
<slot name="input" :fields="fields" :get-atrrs="getAtrrs" />
|
|
140
|
-
<PresetConfigItem :is-package="isPackage" :default-media-type="defaultMediaType" />
|
|
141
|
-
|
|
142
|
-
<div v-if="!exclusion.includes('action')" class="flex items-center justify-end">
|
|
143
|
-
<el-button :disabled="isMutationLoading" @click="handleClose">
|
|
144
|
-
{{ $t('library_action.cancel') }}
|
|
145
|
-
</el-button>
|
|
146
|
-
<!-- <el-button :disabled="isMutationLoading" type="info" @click="resetFields">
|
|
147
|
-
{{ $t('library_action.reset') }}
|
|
148
|
-
</el-button> -->
|
|
149
|
-
<el-button type="primary" :loading="isMutationLoading" @click="handleSubmit">
|
|
150
|
-
{{ $t('library_action.submit') }}
|
|
151
|
-
</el-button>
|
|
152
|
-
</div>
|
|
153
|
-
</el-form>
|
|
154
|
-
</template>
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { objectMap } from '@antfu/utils'
|
|
3
|
+
import { presetsApi } from '../api'
|
|
4
|
+
import type { CreatePresetDto } from '~/api-client-library'
|
|
5
|
+
|
|
6
|
+
const props = withDefaults(defineProps<{
|
|
7
|
+
id?: string
|
|
8
|
+
mode?: 'create' | 'edit' | 'clone'
|
|
9
|
+
item: any
|
|
10
|
+
exclusion: string[]
|
|
11
|
+
disable: string[]
|
|
12
|
+
defaultMediaType?: 'video' | 'audio' | 'data'
|
|
13
|
+
prop?: string
|
|
14
|
+
isPackage?: boolean
|
|
15
|
+
}>(), {
|
|
16
|
+
mode: 'create',
|
|
17
|
+
item: () => { },
|
|
18
|
+
exclusion: () => [],
|
|
19
|
+
disable: () => [],
|
|
20
|
+
})
|
|
21
|
+
const emit = defineEmits(['close'])
|
|
22
|
+
const id = toRef(props, 'id')
|
|
23
|
+
|
|
24
|
+
const initFields = ref({
|
|
25
|
+
id: '',
|
|
26
|
+
// TODO: refactor me
|
|
27
|
+
type: props.defaultMediaType as 'video' | 'audio' | 'data',
|
|
28
|
+
name: '',
|
|
29
|
+
codec: '',
|
|
30
|
+
option: '',
|
|
31
|
+
bitrate: 0,
|
|
32
|
+
sampleRate: 0,
|
|
33
|
+
fps: 0,
|
|
34
|
+
width: 0,
|
|
35
|
+
height: 0,
|
|
36
|
+
pixelFormat: '',
|
|
37
|
+
bframe: 0,
|
|
38
|
+
scaleType: '',
|
|
39
|
+
cq: 0,
|
|
40
|
+
interlaced: false,
|
|
41
|
+
cbr: false,
|
|
42
|
+
channel: 2,
|
|
43
|
+
profile: '',
|
|
44
|
+
volume: '',
|
|
45
|
+
streamId: '',
|
|
46
|
+
streamIndex: '',
|
|
47
|
+
})
|
|
48
|
+
const fields = ref(klona(initFields.value))
|
|
49
|
+
|
|
50
|
+
if (props.item) {
|
|
51
|
+
initFields.value = klona(props.item)
|
|
52
|
+
fields.value = klona(props.item)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
useQuery(
|
|
56
|
+
[QueryKeys.LibraryPresetDetail, id],
|
|
57
|
+
async () => {
|
|
58
|
+
const { data } = await presetsApi.presetsControllerGet({ id: id.value })
|
|
59
|
+
return {
|
|
60
|
+
// Add streamId and streamIndex to fields
|
|
61
|
+
...data,
|
|
62
|
+
streamIndex: 0,
|
|
63
|
+
streamId: '',
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
enabled: computed(() => !!id.value),
|
|
68
|
+
onSuccess(data) {
|
|
69
|
+
initFields.value = klona(data)
|
|
70
|
+
fields.value = klona(data)
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
function formToPayloadPreset(presetForm: any) {
|
|
76
|
+
const preset = emptyStr2Undefined(presetForm)
|
|
77
|
+
let removedKeys: string[] = []
|
|
78
|
+
if (presetForm.type === 'video')
|
|
79
|
+
removedKeys = ['sampleRate', 'channel', 'profile', 'volume']
|
|
80
|
+
else if (presetForm.type === 'audio')
|
|
81
|
+
removedKeys = ['fps', 'height', 'width', 'cbr', 'pixelFormat', 'scaleType', 'cq', 'interlaced']
|
|
82
|
+
else if (presetForm.type === 'data')
|
|
83
|
+
removedKeys = ['fps', 'height', 'width', 'cbr', 'pixelFormat', 'scaleType', 'cq', 'interlaced']
|
|
84
|
+
|
|
85
|
+
const payload = objectMap(preset, (k, v) => removedKeys.includes(k) ? undefined : [k, v])
|
|
86
|
+
|
|
87
|
+
return payload
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function resetFields() {
|
|
91
|
+
fields.value = klona(initFields.value)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const { createPresetMutation, isMutationLoading, updatePresetMutation } = usePresetMutation()
|
|
95
|
+
const { t } = useI18n()
|
|
96
|
+
const { formRef, formValue, handleSubmit, handleValidate, formErrors, getAtrrs, submitLocks } = useElForm<CreatePresetDto>({
|
|
97
|
+
initialValues: fields,
|
|
98
|
+
async onSubmit(values) {
|
|
99
|
+
if (props.mode === 'create') {
|
|
100
|
+
await createPresetMutation.mutateAsync(formToPayloadPreset(values))
|
|
101
|
+
ElMessage.success(t('library_preset.preset_created_successfully'))
|
|
102
|
+
formRef.value?.resetFields()
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (props.mode === 'edit') {
|
|
106
|
+
await updatePresetMutation.mutateAsync({
|
|
107
|
+
id: fields.value.id,
|
|
108
|
+
updatePresetDto: formToPayloadPreset(fields.value),
|
|
109
|
+
})
|
|
110
|
+
ElMessage.success(t('library_preset.preset_updated_successfully'))
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (props.mode === 'clone') {
|
|
114
|
+
const { id, ...rest } = fields.value
|
|
115
|
+
await createPresetMutation.mutateAsync(formToPayloadPreset(rest))
|
|
116
|
+
ElMessage.success(t('library_preset.preset_cloned_successfully'))
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
emit('close')
|
|
120
|
+
resetFields()
|
|
121
|
+
},
|
|
122
|
+
})
|
|
123
|
+
if (props.prop)
|
|
124
|
+
useSyncElForm(props.prop, { formValue, formErrors, submitLocks, formRef })
|
|
125
|
+
|
|
126
|
+
const isSubmitting = ref(false)
|
|
127
|
+
|
|
128
|
+
function handleClose() {
|
|
129
|
+
if (!isSubmitting.value)
|
|
130
|
+
emit('close')
|
|
131
|
+
}
|
|
132
|
+
</script>
|
|
133
|
+
|
|
134
|
+
<template>
|
|
135
|
+
<el-form
|
|
136
|
+
ref="formRef" label-position="top" label-width="80px" :model="formValue" :validate-on-rule-change="true"
|
|
137
|
+
@validate="handleValidate"
|
|
138
|
+
>
|
|
139
|
+
<slot name="input" :fields="fields" :get-atrrs="getAtrrs" />
|
|
140
|
+
<PresetConfigItem :is-package="isPackage" :default-media-type="defaultMediaType" />
|
|
141
|
+
|
|
142
|
+
<div v-if="!exclusion.includes('action')" class="flex items-center justify-end">
|
|
143
|
+
<el-button :disabled="isMutationLoading" @click="handleClose">
|
|
144
|
+
{{ $t('library_action.cancel') }}
|
|
145
|
+
</el-button>
|
|
146
|
+
<!-- <el-button :disabled="isMutationLoading" type="info" @click="resetFields">
|
|
147
|
+
{{ $t('library_action.reset') }}
|
|
148
|
+
</el-button> -->
|
|
149
|
+
<el-button type="primary" :loading="isMutationLoading" @click="handleSubmit">
|
|
150
|
+
{{ $t('library_action.submit') }}
|
|
151
|
+
</el-button>
|
|
152
|
+
</div>
|
|
153
|
+
</el-form>
|
|
154
|
+
</template>
|