Merge pull request #7389 from dataease/pr@dev-v2@style_group

style: 模版管理文案等优化
This commit is contained in:
王嘉豪 2023-12-27 12:01:07 +08:00 committed by GitHub
commit 3ee9ed8c99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 9 deletions

View File

@ -9,10 +9,10 @@
>
<el-form-item :label="'模板名称'" prop="name">
<div class="flex-template">
<el-input v-model="state.templateInfo.name" clearable />
<el-button style="margin-left: 10px" class="el-icon-upload2" secondary @click="goFile">{{
t('visualization.upload_template')
}}</el-button>
<el-input v-model="state.templateInfo.name" placeholder="请输入模版名称" clearable />
<el-button style="margin-left: 10px" icon="Upload" secondary @click="goFile"
>导入模版</el-button
>
<input
id="input"
ref="filesRef"
@ -25,13 +25,22 @@
</el-form-item>
<el-row v-show="!!state.templateInfo.snapshot" class="preview" :style="classBackground" />
<el-form-item :label="'选择分类'" prop="categories" style="margin-top: 16px">
<el-select v-model="state.templateInfo.categories" multiple style="width: 100%">
<el-select
v-model="state.templateInfo.categories"
multiple
placeholder="可多选"
style="width: 100%"
:popper-class="templateCategories.length ? '' : 'custom-category-empty'"
>
<el-option
v-for="option in templateCategories"
:key="option.id"
:label="option.name"
:value="option.id"
/>
<div class="custom-dropdown__empty">
<span>暂无可选分类</span>
</div>
<div class="custom-option-line"></div>
<div>
<el-button
@ -187,7 +196,7 @@ const importTemplate = () => {
}
categoryTemplateNameCheck(nameCheckRequest).then(response => {
if (response.data.indexOf('exist') > -1) {
ElMessageBox.confirm('提示', {
ElMessageBox.confirm('提示', {
tip: '当前分类存在相同模版名称,是否覆盖?',
confirmButtonType: 'danger',
type: 'warning',
@ -301,4 +310,25 @@ if (props.templateId) {
height: 1px;
background-color: rgba(31, 35, 41, 0.15);
}
.custom-category-empty {
.ed-scrollbar {
display: inherit !important;
}
.custom-dropdown__empty {
display: inherit !important;
}
.ed-select-dropdown__empty {
display: none !important;
}
}
.custom-dropdown__empty {
display: none;
margin-left: 12px;
font-size: 14px;
color: rgba(143, 149, 158, 1);
}
</style>

View File

@ -105,8 +105,9 @@ const add = () => {
}
const categoryDelete = template => {
ElMessageBox.confirm('确定删除该分类吗?', {
tip: '',
tip: '删除后不可恢复,是否继续?',
confirmButtonType: 'danger',
confirmButtonText: t('common.delete'),
type: 'warning',
autofocus: false,
showClose: false

View File

@ -392,8 +392,8 @@ const categoryDelete = id => {
})
getTree()
} else {
ElMessageBox.confirm('无法删除分类', {
tip: '请移除该分类下所有模版再进行删除分类操作',
ElMessageBox.confirm('无法删除分类', {
tip: '请移除该分类下所有模版再进行删除分类操作',
confirmButtonText: '知道了',
confirmButtonType: 'default',
showCancelButton: false,
@ -411,6 +411,7 @@ const templateDeleteInfo = id => {
tip: '',
confirmButtonType: 'danger',
type: 'warning',
confirmButtonText: t('common.delete'),
autofocus: false,
showClose: false
}).then(() => {
@ -466,6 +467,11 @@ const saveTemplateEdit = templateEditForm => {
if (valid) {
save({ ...templateEditForm }).then(response => {
state.currentTemplateLabel = templateEditForm.name
ElMessage({
message: '添加成功',
type: 'success',
showClose: true
})
getTree()
close()
})
@ -521,6 +527,7 @@ const closeEditTemplateDialog = () => {
const templateImport = pid => {
state.templateDialog.visible = true
state.templateDialog.title = '导入模版'
state.templateDialog.templateId = null
state.templateDialog.optType = 'insert'
state.templateDialog.pid = pid