refactor: 增加模板市场分类,增加应用模板分类

This commit is contained in:
wangjiahao 2024-07-19 09:44:39 +08:00
parent 111bca90ea
commit 622cddbf7f
5 changed files with 66 additions and 4 deletions

View File

@ -193,6 +193,8 @@ const saveResource = () => {
initCanvasData(dvInfo.value.id, 'dashboard', () => {
useEmitt().emitter.emit('refresh-dataset-selector')
resourceAppOpt.value.close()
dvMainStore.setAppDataInfo(null)
snapshotStore.resetSnapshot()
})
}
})

View File

@ -137,6 +137,8 @@ const saveResource = () => {
initCanvasData(dvInfo.value.id, 'dataV', () => {
useEmitt().emitter.emit('refresh-dataset-selector')
resourceAppOpt.value.close()
dvMainStore.setAppDataInfo(null)
snapshotStore.resetSnapshot()
})
}
})

View File

@ -138,6 +138,18 @@ export const snapshotStore = defineStore('snapshot', {
resetStyleChangeTimes() {
this.styleChangeTimes = 0
},
resetSnapshot() {
this.styleChangeTimes = -1
this.cacheStyleChangeTimes = 0
this.snapshotCacheTimes = 0
this.cacheViewIdInfo = {
snapshotCacheViewCalc: [],
snapshotCacheViewRender: []
}
this.snapshotData = []
this.snapshotIndex = -1
this.recordSnapshot()
},
recordSnapshot() {
this.styleChangeTimes = ++this.styleChangeTimes

View File

@ -81,6 +81,14 @@
:value="item.value"
/>
</el-select>
<el-select class="title-type" v-model="state.templateClassifyType" placeholder="Select">
<el-option
v-for="item in state.templateClassifyOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<template v-if="['branchCreate', 'create'].includes(state.curPosition)">
<el-divider class="custom-divider-line" direction="vertical" />
<el-icon class="custom-market-icon hover-icon" @click="close"><Close /></el-icon>
@ -203,9 +211,24 @@ const state = reactive({
value: 'label',
label: 'label'
},
templateType: 'all',
templateSourceType: 'all',
templateType: 'all', //
templateSourceType: 'all', //
templateClassifyType: 'all', //
treeShow: true,
templateClassifyOptions: [
{
value: 'all',
label: '全部分类'
},
{
value: 'app',
label: '应用模板'
},
{
value: 'template',
label: '样式模板'
}
],
templateSourceOptions: [
{
value: 'all',
@ -231,7 +254,7 @@ const state = reactive({
},
{
value: 'SCREEN',
label: '大屏'
label: '数据大屏'
}
],
loading: false,
@ -353,6 +376,17 @@ watch(
})
}
)
watch(
() => state.templateClassifyType,
() => {
state.treeShow = false
initTemplateShow()
nextTick(() => {
state.treeShow = true
initStyle()
})
}
)
const nodeClick = data => {
state.marketActiveTab = data.label
@ -497,6 +531,7 @@ const templateShow = templateItem => {
let searchMarch = false
let templateTypeMarch = false
let templateSourceTypeMarch = false
let templateClassifyTypeMarch = false
if (!state.searchText || templateItem.title.indexOf(state.searchText) > -1) {
searchMarch = true
}
@ -508,7 +543,14 @@ const templateShow = templateItem => {
if (state.templateSourceType === 'all' || templateItem.source === state.templateSourceType) {
templateSourceTypeMarch = true
}
return searchMarch && templateTypeMarch && templateSourceTypeMarch
if (
state.templateClassifyType === 'all' ||
templateItem.classify === state.templateClassifyType
) {
templateClassifyTypeMarch = true
}
return searchMarch && templateTypeMarch && templateSourceTypeMarch && templateClassifyTypeMarch
}
const templatePreview = previewId => {

View File

@ -31,6 +31,9 @@ public class TemplateMarketDTO implements Comparable<TemplateMarketDTO> {
// 模板来源 market = 模板市场manage=模板管理
private String source = "market";
// 模板分类 app = 应用模板manage=样式模板
private String classify = "template";
private List<MarketCategoryVO> categories;
private List<String> categoryNames;
@ -49,6 +52,7 @@ public class TemplateMarketDTO implements Comparable<TemplateMarketDTO> {
this.templateType = "dataV".equalsIgnoreCase(manageDTO.getDvType()) ? "SCREEN" : "PANEL";
this.thumbnail = manageDTO.getSnapshot();
this.source = "manage";
this.classify = manageDTO.getNodeType();
if (manageDTO.getRecentUseTime() != null) {
this.recentUseTime = manageDTO.getRecentUseTime();
this.categories.add(new MarketCategoryVO("最近使用"));