Merge pull request #6889 from dataease/pr@dev-v2@refactor_market-manage

refactor: 模版管理UI变更
This commit is contained in:
王嘉豪 2023-11-28 12:19:05 +08:00 committed by GitHub
commit 36846e9753
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 54 additions and 15 deletions

View File

@ -11,6 +11,16 @@
:description="'没有找到相关内容'" :description="'没有找到相关内容'"
/> />
<ul> <ul>
<li
:class="[{ select: state.activeTemplate === '1' }]"
@click="nodeClick({ id: '1', label: '默认分类' })"
>
<el-icon class="de-icon-sense">
<Icon name="scene" />
</el-icon>
<span class="text-template-overflow" :title="'默认分类'">默认分类</span>
</li>
<hr class="custom-line" />
<li <li
v-for="ele in templateListComputed" v-for="ele in templateListComputed"
:key="ele.name" :key="ele.name"
@ -43,16 +53,13 @@
</el-dropdown> </el-dropdown>
</span> </span>
</li> </li>
<li @click="add()">
<el-icon class="de-icon-sense">
<Plus />
</el-icon>
<span class="text-template-overflow">{{ t('visualization.add_category') }}</span>
</li>
</ul> </ul>
<el-button
v-if="state.templateFilterText === ''"
style="width: 100%"
icon="el-icon-plus"
secondary
@click="add()"
>
{{ t('visualization.add_category') }}
</el-button>
</div> </div>
</template> </template>
@ -92,8 +99,7 @@ const state = reactive({
}) })
const templateListComputed = computed(() => { const templateListComputed = computed(() => {
if (!state.templateFilterText) return [...props.templateList] return props.templateList.filter(ele => ele['id'] !== '1')
return props.templateList.filter(ele => ele['name']?.includes(state.templateFilterText))
}) })
const clickMore = (type, data) => { const clickMore = (type, data) => {
@ -247,4 +253,11 @@ defineExpose({
width: 20px; width: 20px;
height: 20px; height: 20px;
} }
.custom-line {
margin: 4px;
background: rgba(31, 35, 41, 0.15);
border: 0;
height: 1px;
}
</style> </style>

View File

@ -36,9 +36,15 @@
</div> </div>
<div class="de-tabs-right"> <div class="de-tabs-right">
<div v-if="state.currentTemplateLabel" class="active-template"> <div v-if="state.currentTemplateLabel" class="active-template">
{{ state.currentTemplateLabel }}&nbsp;&nbsp;({{ <span v-show="!state.templateFilterText"
state.currentTemplateShowList.length >{{ state.currentTemplateLabel }}&nbsp;&nbsp;({{
}}) state.currentTemplateShowList.length
}})</span
>
<span v-show="state.templateFilterText">
<span style="color: #3370ff">{{ state.currentTemplateLabel }}&nbsp;&nbsp;</span>
<span>的搜索结果&nbsp;{{ currentTemplateShowListComputed.length }}&nbsp;</span>
</span>
</div> </div>
<el-empty <el-empty
v-if="!state.currentTemplateShowList.length" v-if="!state.currentTemplateShowList.length"
@ -47,7 +53,7 @@
/> />
<div v-show="state.currentTemplateId !== ''" id="template-box" class="template-box"> <div v-show="state.currentTemplateId !== ''" id="template-box" class="template-box">
<de-template-item <de-template-item
v-for="item in state.currentTemplateShowList" v-for="item in currentTemplateShowListComputed"
:key="item.id" :key="item.id"
:width="state.templateCurWidth" :width="state.templateCurWidth"
:model="item" :model="item"
@ -174,6 +180,13 @@ const state = reactive({
} }
}) })
const currentTemplateShowListComputed = computed(() => {
if (!state.templateFilterText) return [...state.currentTemplateShowList]
return state.currentTemplateShowList.filter(ele =>
ele['name']?.includes(state.templateFilterText)
)
})
const nameList = computed(() => { const nameList = computed(() => {
const { nodeType } = state.templateEditForm || {} const { nodeType } = state.templateEditForm || {}
if (nodeType === 'template') { if (nodeType === 'template') {
@ -186,6 +199,18 @@ const nameList = computed(() => {
return [] return []
}) })
const initStyle = () => {
nextTick(() => {
const tree = document.querySelector('.ed-tree')
// 线
const line = document.createElement('hr')
line.classList.add('custom-line')
// 线
tree.firstElementChild.appendChild(line)
})
}
const nameRepeat = value => { const nameRepeat = value => {
if (!nameList.value) { if (!nameList.value) {
return false return false
@ -357,6 +382,7 @@ onMounted(() => {
state.templateCurWidth = Math.trunc(offsetWidth / curSeparator) - 24 - curSeparator state.templateCurWidth = Math.trunc(offsetWidth / curSeparator) - 24 - curSeparator
}) })
}) })
initStyle()
}) })
</script> </script>