refactor: application add show_exec
This commit is contained in:
parent
8ab4456ec3
commit
66d4b6c81a
@ -26,6 +26,7 @@ class ApplicationAccessToken(AppModelMixin):
|
||||
base_field=models.CharField(max_length=128, blank=True)
|
||||
, default=list)
|
||||
show_source = models.BooleanField(default=False, verbose_name="是否显示知识来源")
|
||||
show_exec = models.BooleanField(default=False, verbose_name="是否显示执行详情")
|
||||
|
||||
language = models.CharField(max_length=10, verbose_name="语言", default=None, null=True)
|
||||
|
||||
|
||||
@ -9,8 +9,8 @@
|
||||
<el-form label-position="top" ref="displayFormRef" :model="form">
|
||||
<el-form-item>
|
||||
<span>{{
|
||||
$t('views.applicationOverview.appInfo.SettingDisplayDialog.languageLabel')
|
||||
}}</span>
|
||||
$t('views.applicationOverview.appInfo.SettingDisplayDialog.languageLabel')
|
||||
}}</span>
|
||||
<el-select v-model="form.language" clearable>
|
||||
<el-option
|
||||
v-for="item in langList"
|
||||
@ -24,11 +24,15 @@
|
||||
<el-space direction="vertical" alignment="start">
|
||||
<el-checkbox
|
||||
v-model="form.show_source"
|
||||
:label="
|
||||
isWorkFlow(detail.type)
|
||||
? $t('views.applicationOverview.appInfo.SettingDisplayDialog.showExecutionDetail')
|
||||
: $t('views.applicationOverview.appInfo.SettingDisplayDialog.showSourceLabel')
|
||||
"
|
||||
:label="$t('views.applicationOverview.appInfo.SettingDisplayDialog.showSourceLabel')"
|
||||
/>
|
||||
</el-space>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-space direction="vertical" alignment="start">
|
||||
<el-checkbox
|
||||
v-model="form.show_exec"
|
||||
:label="$t('views.applicationOverview.appInfo.SettingDisplayDialog.showExecutionDetail')"
|
||||
/>
|
||||
</el-space>
|
||||
</el-form-item>
|
||||
@ -44,16 +48,16 @@
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import type { FormInstance, FormRules, UploadFiles } from 'element-plus'
|
||||
import {ref, watch} from 'vue'
|
||||
import {useRoute} from 'vue-router'
|
||||
import type {FormInstance, FormRules, UploadFiles} from 'element-plus'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import { isWorkFlow } from '@/utils/application'
|
||||
import { MsgSuccess, MsgError } from '@/utils/message'
|
||||
import { getBrowserLang, langList, t } from '@/locales'
|
||||
import {MsgSuccess, MsgError} from '@/utils/message'
|
||||
import {getBrowserLang, langList, t} from '@/locales'
|
||||
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id }
|
||||
params: {id}
|
||||
} = route
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
@ -61,6 +65,7 @@ const emit = defineEmits(['refresh'])
|
||||
const displayFormRef = ref()
|
||||
const form = ref<any>({
|
||||
show_source: false,
|
||||
show_exec: false,
|
||||
language: ''
|
||||
})
|
||||
|
||||
@ -73,6 +78,7 @@ watch(dialogVisible, (bool) => {
|
||||
if (!bool) {
|
||||
form.value = {
|
||||
show_source: false,
|
||||
show_exec: false,
|
||||
language: ''
|
||||
}
|
||||
}
|
||||
@ -80,6 +86,7 @@ watch(dialogVisible, (bool) => {
|
||||
const open = (data: any, content: any) => {
|
||||
detail.value = content
|
||||
form.value.show_source = data.show_source
|
||||
form.value.show_exec = data.show_exec
|
||||
form.value.language = data.language
|
||||
dialogVisible.value = true
|
||||
}
|
||||
@ -98,6 +105,6 @@ const submit = async (formEl: FormInstance | undefined) => {
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
defineExpose({open})
|
||||
</script>
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
@ -17,11 +17,11 @@
|
||||
<div class="flex align-center">
|
||||
<el-button type="primary" @click.prevent="resetForm" link>
|
||||
<el-icon class="mr-4">
|
||||
<Refresh />
|
||||
<Refresh/>
|
||||
</el-icon>
|
||||
{{ $t('views.applicationOverview.appInfo.SettingDisplayDialog.restoreDefault') }}
|
||||
</el-button>
|
||||
<el-divider direction="vertical" />
|
||||
<el-divider direction="vertical"/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -39,7 +39,7 @@
|
||||
:size="32"
|
||||
style="background: none"
|
||||
>
|
||||
<img :src="detail?.icon" alt="" />
|
||||
<img :src="detail?.icon" alt=""/>
|
||||
</el-avatar>
|
||||
<el-avatar
|
||||
v-else-if="detail?.name"
|
||||
@ -72,7 +72,7 @@
|
||||
color: xpackForm.custom_theme?.header_font_color
|
||||
}"
|
||||
>
|
||||
<Close />
|
||||
<Close/>
|
||||
</el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
@ -134,7 +134,7 @@
|
||||
style="width: 28px; height: 28px; display: block"
|
||||
/>
|
||||
<el-avatar v-else>
|
||||
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
|
||||
<img src="@/assets/user-icon.svg" style="width: 54%" alt=""/>
|
||||
</el-avatar>
|
||||
</div>
|
||||
</div>
|
||||
@ -143,7 +143,7 @@
|
||||
style="position: absolute; bottom: 0; padding-bottom: 8px; box-sizing: border-box"
|
||||
class="p-16 text-center w-full"
|
||||
>
|
||||
<img src="@/assets/display-bg1.png" alt="" class="w-full" />
|
||||
<img src="@/assets/display-bg1.png" alt="" class="w-full"/>
|
||||
<el-text type="info" v-if="xpackForm.disclaimer" class="mt-8" style="font-size: 12px">
|
||||
<auto-tooltip :content="xpackForm.disclaimer_value">
|
||||
{{ xpackForm.disclaimer_value }}
|
||||
@ -177,7 +177,7 @@
|
||||
{{ $t('views.applicationOverview.appInfo.SettingDisplayDialog.customThemeColor') }}
|
||||
</h5>
|
||||
<div>
|
||||
<el-color-picker v-model="xpackForm.custom_theme.theme_color" />
|
||||
<el-color-picker v-model="xpackForm.custom_theme.theme_color"/>
|
||||
{{
|
||||
!xpackForm.custom_theme.theme_color
|
||||
? $t('views.applicationOverview.appInfo.SettingDisplayDialog.default')
|
||||
@ -191,7 +191,7 @@
|
||||
$t('views.applicationOverview.appInfo.SettingDisplayDialog.headerTitleFontColor')
|
||||
}}
|
||||
</h5>
|
||||
<el-color-picker v-model="xpackForm.custom_theme.header_font_color" />
|
||||
<el-color-picker v-model="xpackForm.custom_theme.header_font_color"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row class="w-full mb-8">
|
||||
@ -210,12 +210,12 @@
|
||||
<el-card shadow="never" class="mb-8">
|
||||
<div class="flex-between mb-8">
|
||||
<span class="lighter">{{
|
||||
$t('views.applicationOverview.appInfo.SettingDisplayDialog.AIAvatar')
|
||||
}}</span>
|
||||
$t('views.applicationOverview.appInfo.SettingDisplayDialog.AIAvatar')
|
||||
}}</span>
|
||||
<span class="flex align-center">
|
||||
<el-checkbox v-model="xpackForm.show_avatar">{{
|
||||
$t('views.applicationOverview.appInfo.SettingDisplayDialog.display')
|
||||
}}</el-checkbox>
|
||||
$t('views.applicationOverview.appInfo.SettingDisplayDialog.display')
|
||||
}}</el-checkbox>
|
||||
<el-upload
|
||||
class="ml-8"
|
||||
ref="uploadRef"
|
||||
@ -238,8 +238,8 @@
|
||||
<el-card shadow="never" class="mb-8">
|
||||
<div class="flex-between mb-8">
|
||||
<span class="lighter">{{
|
||||
$t('views.applicationOverview.appInfo.SettingDisplayDialog.askUserAvatar')
|
||||
}}</span>
|
||||
$t('views.applicationOverview.appInfo.SettingDisplayDialog.askUserAvatar')
|
||||
}}</span>
|
||||
<span class="flex align-center">
|
||||
<el-checkbox v-model="xpackForm.show_user_avatar">
|
||||
{{
|
||||
@ -262,14 +262,14 @@
|
||||
</span>
|
||||
</div>
|
||||
<el-text type="info" size="small"
|
||||
>{{ $t('views.applicationOverview.appInfo.SettingDisplayDialog.imageMessage') }}
|
||||
>{{ $t('views.applicationOverview.appInfo.SettingDisplayDialog.imageMessage') }}
|
||||
</el-text>
|
||||
</el-card>
|
||||
<el-card shadow="never" class="mb-8">
|
||||
<div class="flex-between mb-8">
|
||||
<span class="lighter">{{
|
||||
$t('views.applicationOverview.appInfo.SettingDisplayDialog.floatIcon')
|
||||
}}</span>
|
||||
$t('views.applicationOverview.appInfo.SettingDisplayDialog.floatIcon')
|
||||
}}</span>
|
||||
<el-upload
|
||||
ref="uploadRef"
|
||||
action="#"
|
||||
@ -289,8 +289,8 @@
|
||||
<div class="border-t mt-8">
|
||||
<div class="flex-between mb-8">
|
||||
<span class="lighter">{{
|
||||
$t('views.applicationOverview.appInfo.SettingDisplayDialog.iconDefaultPosition')
|
||||
}}</span>
|
||||
$t('views.applicationOverview.appInfo.SettingDisplayDialog.iconDefaultPosition')
|
||||
}}</span>
|
||||
<el-checkbox
|
||||
v-model="xpackForm.draggable"
|
||||
:label="
|
||||
@ -370,11 +370,11 @@
|
||||
<el-space direction="vertical" alignment="start" :size="2">
|
||||
<el-checkbox
|
||||
v-model="xpackForm.show_source"
|
||||
:label="
|
||||
isWorkFlow(detail.type)
|
||||
? $t('views.applicationOverview.appInfo.SettingDisplayDialog.showExecutionDetail')
|
||||
: $t('views.applicationOverview.appInfo.SettingDisplayDialog.showSourceLabel')
|
||||
"
|
||||
:label="$t('views.applicationOverview.appInfo.SettingDisplayDialog.showSourceLabel')"
|
||||
/>
|
||||
<el-checkbox
|
||||
v-model="xpackForm.show_exec"
|
||||
:label="$t('views.applicationOverview.appInfo.SettingDisplayDialog.showExecutionDetail')"
|
||||
/>
|
||||
<el-checkbox
|
||||
v-model="xpackForm.show_history"
|
||||
@ -390,7 +390,7 @@
|
||||
@change="changeDisclaimer"
|
||||
/>
|
||||
<span v-if="xpackForm.disclaimer"
|
||||
><el-tooltip :content="xpackForm.disclaimer_value" placement="top">
|
||||
><el-tooltip :content="xpackForm.disclaimer_value" placement="top">
|
||||
<el-input
|
||||
v-model="xpackForm.disclaimer_value"
|
||||
style="width: 422px; margin-bottom: 10px"
|
||||
@ -413,28 +413,28 @@
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import type { FormInstance, FormRules, UploadFiles } from 'element-plus'
|
||||
import { isWorkFlow } from '@/utils/application'
|
||||
import { isAppIcon } from '@/utils/common'
|
||||
import {computed, ref, watch} from 'vue'
|
||||
import {useRoute} from 'vue-router'
|
||||
import type {FormInstance, FormRules, UploadFiles} from 'element-plus'
|
||||
import {isAppIcon} from '@/utils/common'
|
||||
import applicationXpackApi from '@/api/application/application-xpack'
|
||||
import { MsgSuccess, MsgError } from '@/utils/message'
|
||||
import { langList, t } from '@/locales'
|
||||
import {MsgSuccess, MsgError} from '@/utils/message'
|
||||
import {langList, t} from '@/locales'
|
||||
import useStore from '@/stores'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import {cloneDeep} from 'lodash'
|
||||
|
||||
const { user } = useStore()
|
||||
const {user} = useStore()
|
||||
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id }
|
||||
params: {id}
|
||||
} = route
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
const defaultSetting = {
|
||||
show_source: false,
|
||||
show_exec: false,
|
||||
language: '',
|
||||
show_history: true,
|
||||
draggable: true,
|
||||
@ -452,8 +452,8 @@ const defaultSetting = {
|
||||
header_font_color: '#1f2329'
|
||||
},
|
||||
float_location: {
|
||||
y: { type: 'bottom', value: 30 },
|
||||
x: { type: 'right', value: 0 }
|
||||
y: {type: 'bottom', value: 30},
|
||||
x: {type: 'right', value: 0}
|
||||
},
|
||||
show_avatar: true,
|
||||
show_user_avatar: false
|
||||
@ -463,6 +463,7 @@ const displayFormRef = ref()
|
||||
|
||||
const xpackForm = ref<any>({
|
||||
show_source: false,
|
||||
show_exec: false,
|
||||
language: '',
|
||||
show_history: false,
|
||||
draggable: false,
|
||||
@ -480,8 +481,8 @@ const xpackForm = ref<any>({
|
||||
header_font_color: '#1f2329'
|
||||
},
|
||||
float_location: {
|
||||
y: { type: 'bottom', value: 30 },
|
||||
x: { type: 'right', value: 0 }
|
||||
y: {type: 'bottom', value: 30},
|
||||
x: {type: 'right', value: 0}
|
||||
},
|
||||
show_avatar: true,
|
||||
show_user_avatar: false
|
||||
@ -531,6 +532,7 @@ const onChange = (file: any, fileList: UploadFiles, attr: string) => {
|
||||
const open = (data: any, content: any) => {
|
||||
detail.value = content
|
||||
xpackForm.value.show_source = data.show_source
|
||||
xpackForm.value.show_exec = data.show_exec
|
||||
xpackForm.value.show_history = data.show_history
|
||||
xpackForm.value.language = data.language
|
||||
xpackForm.value.draggable = data.draggable
|
||||
@ -591,7 +593,7 @@ const submit = async (formEl: FormInstance | undefined) => {
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
defineExpose({open})
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.setting-preview {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user