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

View File

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

View File

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