|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div>
|
|
<div>
|
|
|
- <el-card class="mb-12px" body-class="pr-0px!">
|
|
|
|
|
|
|
+ <el-card class="mb-12px" body-class="p-0px!">
|
|
|
<template #header>
|
|
<template #header>
|
|
|
<div class="flex items-center justify-between">
|
|
<div class="flex items-center justify-between">
|
|
|
<span class="flex items-center gap-4px">
|
|
<span class="flex items-center gap-4px">
|
|
@@ -23,13 +23,13 @@
|
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
- <el-scrollbar height="120px">
|
|
|
|
|
|
|
+ <el-scrollbar height="300px">
|
|
|
<div
|
|
<div
|
|
|
v-for="(section, sectionIndex) in props.values?.value.children || []"
|
|
v-for="(section, sectionIndex) in props.values?.value.children || []"
|
|
|
- :key="v4()"
|
|
|
|
|
- class="border-border border-solid border-1px p-4px bg-gray-800 mb-12px mr-12px rounded-4px"
|
|
|
|
|
|
|
+ :key="sectionIndex"
|
|
|
|
|
+ class="border-border border-solid border-1px p-8px bg-gray-800 mb-12px mx-12px rounded-4px"
|
|
|
>
|
|
>
|
|
|
- <div class="flex items-center gap-8px">
|
|
|
|
|
|
|
+ <div class="flex items-center gap-8px mb-6px">
|
|
|
<LanguageInput
|
|
<LanguageInput
|
|
|
v-model="section.name"
|
|
v-model="section.name"
|
|
|
type="textarea"
|
|
type="textarea"
|
|
@@ -47,98 +47,112 @@
|
|
|
size="14px"
|
|
size="14px"
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
|
- <div
|
|
|
|
|
- v-for="(item, index) in section.children || []"
|
|
|
|
|
- :key="v4()"
|
|
|
|
|
- class="flex items-center justify-between"
|
|
|
|
|
- @click="handleEdit(item)"
|
|
|
|
|
|
|
+ <el-collapse
|
|
|
|
|
+ v-model="activeCollapseName"
|
|
|
|
|
+ class="box-border border-none!"
|
|
|
|
|
+ expand-icon-position="left"
|
|
|
|
|
+ accordion
|
|
|
>
|
|
>
|
|
|
- <span class="flex items-center">
|
|
|
|
|
- <el-radio
|
|
|
|
|
- v-model="activeIndex"
|
|
|
|
|
- :value="`[${sectionIndex}].children.[${index}]`"
|
|
|
|
|
- class="mr-0!"
|
|
|
|
|
- @click.stop
|
|
|
|
|
- />
|
|
|
|
|
- <span class="flex-1 truncate text-#00ff00 cursor-pointer">{{ item.name }}</span>
|
|
|
|
|
- </span>
|
|
|
|
|
-
|
|
|
|
|
- <LuTrash2
|
|
|
|
|
- class="cursor-pointer shrink-0"
|
|
|
|
|
- @click.stop="handleDeleteItem(sectionIndex, index)"
|
|
|
|
|
- size="14px"
|
|
|
|
|
- />
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <el-collapse-item
|
|
|
|
|
+ v-for="(item, index) in section.children || []"
|
|
|
|
|
+ :key="index"
|
|
|
|
|
+ :name="getCollapseName(sectionIndex, index)"
|
|
|
|
|
+ class="py-4px"
|
|
|
|
|
+ >
|
|
|
|
|
+ <template #title>
|
|
|
|
|
+ <div class="flex items-center justify-between w-full pr-12px gap-4px">
|
|
|
|
|
+ <el-radio
|
|
|
|
|
+ v-model="activeIndex"
|
|
|
|
|
+ :value="`[${sectionIndex}].children.[${index}]`"
|
|
|
|
|
+ class="mr-0!"
|
|
|
|
|
+ @click.stop
|
|
|
|
|
+ />
|
|
|
|
|
+ <span class="flex-1 truncate text-#00ff00">{{ item.name }}</span>
|
|
|
|
|
+ <LuTrash2
|
|
|
|
|
+ class="cursor-pointer shrink-0"
|
|
|
|
|
+ @click.stop="handleDeleteItem(sectionIndex, index)"
|
|
|
|
|
+ size="14px"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <el-form :model="item" label-position="left" label-width="60px" class="px-8px">
|
|
|
|
|
+ <el-form-item label="类型">
|
|
|
|
|
+ <el-select v-model="item.titleIcon.type">
|
|
|
|
|
+ <el-option label="Symbol" value="symbol" />
|
|
|
|
|
+ <el-option label="Image" value="img" />
|
|
|
|
|
+ <el-option label="Text" value="text" />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="文本">
|
|
|
|
|
+ <LanguageInput v-model="item.name" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item v-if="item.titleIcon.type === 'symbol'" label="图标">
|
|
|
|
|
+ <el-input spellcheck="false" readonly @click="handleShowSymbolModal(item)">
|
|
|
|
|
+ <template #prefix>
|
|
|
|
|
+ <i
|
|
|
|
|
+ class="lvgl-icon not-italic"
|
|
|
|
|
+ v-html="getSymbol(item.titleIcon.img_symbol)"
|
|
|
|
|
+ ></i>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-input>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <template v-if="item.titleIcon.type === 'img'">
|
|
|
|
|
+ <el-form-item label="图片">
|
|
|
|
|
+ <ImageSelect v-model="item.titleIcon.img_id" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-row :gutter="12">
|
|
|
|
|
+ <el-col :span="12">
|
|
|
|
|
+ <el-form-item label="尺寸">
|
|
|
|
|
+ <input-number
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ v-model="item.titleIcon.img_width"
|
|
|
|
|
+ :min="0"
|
|
|
|
|
+ >
|
|
|
|
|
+ <template #prefix>宽度</template>
|
|
|
|
|
+ </input-number>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="12">
|
|
|
|
|
+ <el-form-item label-width="0">
|
|
|
|
|
+ <input-number
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ v-model="item.titleIcon.img_height"
|
|
|
|
|
+ :min="0"
|
|
|
|
|
+ >
|
|
|
|
|
+ <template #prefix>高度</template>
|
|
|
|
|
+ </input-number>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+ <el-form-item label="图片遮罩" label-position="left" label-width="60px">
|
|
|
|
|
+ <ColorPicker
|
|
|
|
|
+ use-type="pure"
|
|
|
|
|
+ picker-type="chrome"
|
|
|
|
|
+ format="hex8"
|
|
|
|
|
+ v-model:pureColor="item.titleIcon.img_recolor"
|
|
|
|
|
+ />
|
|
|
|
|
+ <span class="text-text-active">{{ item.titleIcon.img_recolor }}</span>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="透明度" label-position="left" label-width="60px">
|
|
|
|
|
+ <div class="w-full flex gap-20px items-center">
|
|
|
|
|
+ <el-slider
|
|
|
|
|
+ v-model="item.titleIcon.img_alpha"
|
|
|
|
|
+ :max="255"
|
|
|
|
|
+ :min="0"
|
|
|
|
|
+ style="flex: 1"
|
|
|
|
|
+ />
|
|
|
|
|
+ <span class="text-text-active inline w-30px cursor-pointer">
|
|
|
|
|
+ {{ item.titleIcon.img_alpha }}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ </el-collapse-item>
|
|
|
|
|
+ </el-collapse>
|
|
|
</div>
|
|
</div>
|
|
|
</el-scrollbar>
|
|
</el-scrollbar>
|
|
|
</el-card>
|
|
</el-card>
|
|
|
- <el-dialog draggable append-to-body v-model="dialogVisible" title="编辑" width="440px">
|
|
|
|
|
- <el-form ref="formRef" :model="formData" label-position="left" label-width="60px">
|
|
|
|
|
- <el-form-item label="类型">
|
|
|
|
|
- <el-select v-model="formData.titleIcon.type">
|
|
|
|
|
- <el-option label="Symbol" value="symbol"></el-option>
|
|
|
|
|
- <el-option label="Image" value="img"></el-option>
|
|
|
|
|
- <el-option label="Text" value="text"></el-option>
|
|
|
|
|
- </el-select>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item label="文本">
|
|
|
|
|
- <LanguageInput v-model="formData.name" />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item v-if="formData.type === 'symbol'" label="图标">
|
|
|
|
|
- <el-input spellcheck="false" readonly @click="handleShowSymbolModal">
|
|
|
|
|
- <template #prefix>
|
|
|
|
|
- <i class="lvgl-icon not-italic" v-html="getSymbol(formData.titleIcon.img_symbol)"></i>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-input>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <template v-if="formData.titleIcon.type === 'img'">
|
|
|
|
|
- <el-form-item label="图片">
|
|
|
|
|
- <ImageSelect v-model="formData.titleIcon.img_id" />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-row :gutter="12">
|
|
|
|
|
- <el-col :span="12">
|
|
|
|
|
- <el-form-item label="尺寸">
|
|
|
|
|
- <input-number style="width: 100%" v-model="formData.titleIcon.img_width" :min="0">
|
|
|
|
|
- <template #prefix>宽度</template>
|
|
|
|
|
- </input-number>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-col>
|
|
|
|
|
- <el-col :span="12">
|
|
|
|
|
- <el-form-item label-width="0">
|
|
|
|
|
- <input-number style="width: 100%" v-model="formData.titleIcon.img_height" :min="0">
|
|
|
|
|
- <template #prefix>高度</template>
|
|
|
|
|
- </input-number>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-col>
|
|
|
|
|
- </el-row>
|
|
|
|
|
- <el-form-item label="图片遮罩" label-position="left" label-width="60px">
|
|
|
|
|
- <ColorPicker
|
|
|
|
|
- use-type="pure"
|
|
|
|
|
- picker-type="chrome"
|
|
|
|
|
- format="hex8"
|
|
|
|
|
- v-model:pureColor="formData.titleIcon.img_recolor"
|
|
|
|
|
- />
|
|
|
|
|
- <span class="text-text-active">{{ formData.titleIcon.img_recolor }}</span>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item label="透明度" label-position="left" label-width="60px">
|
|
|
|
|
- <div class="w-full flex gap-20px items-center">
|
|
|
|
|
- <el-slider
|
|
|
|
|
- v-model="formData.titleIcon.img_alpha"
|
|
|
|
|
- :max="255"
|
|
|
|
|
- :min="0"
|
|
|
|
|
- style="flex: 1"
|
|
|
|
|
- ></el-slider>
|
|
|
|
|
- <span class="text-text-active inline w-30px cursor-pointer">
|
|
|
|
|
- {{ formData.titleIcon.img_alpha }}
|
|
|
|
|
- </span>
|
|
|
|
|
- </div>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-form>
|
|
|
|
|
- <template #footer>
|
|
|
|
|
- <el-button type="primary" @click="dialogVisible = false">确定</el-button>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-dialog>
|
|
|
|
|
<SymbolSelectModal ref="symbolModalRef" @select="handleSelectSymbol" />
|
|
<SymbolSelectModal ref="symbolModalRef" @select="handleSelectSymbol" />
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
@@ -148,9 +162,9 @@ import type { MenuItem } from './data'
|
|
|
|
|
|
|
|
import { ref, computed, type Ref } from 'vue'
|
|
import { ref, computed, type Ref } from 'vue'
|
|
|
import { LuPlus, LuTrash2, LuArrowRightToLine, LuArrowLeftToLine } from 'vue-icons-plus/lu'
|
|
import { LuPlus, LuTrash2, LuArrowRightToLine, LuArrowLeftToLine } from 'vue-icons-plus/lu'
|
|
|
-import { v4 } from 'uuid'
|
|
|
|
|
import { symbols } from '@/constants'
|
|
import { symbols } from '@/constants'
|
|
|
import { getNextIndex } from '@/utils'
|
|
import { getNextIndex } from '@/utils'
|
|
|
|
|
+import { ColorPicker } from '@/components'
|
|
|
|
|
|
|
|
import ImageSelect from '@/views/designer/config/property/components/ImageSelect.vue'
|
|
import ImageSelect from '@/views/designer/config/property/components/ImageSelect.vue'
|
|
|
import SymbolSelectModal from '@/views/designer/config/property/components/SymbolSelectModal.vue'
|
|
import SymbolSelectModal from '@/views/designer/config/property/components/SymbolSelectModal.vue'
|
|
@@ -160,19 +174,8 @@ const props = defineProps<{
|
|
|
values: Ref<any>
|
|
values: Ref<any>
|
|
|
}>()
|
|
}>()
|
|
|
|
|
|
|
|
-const dialogVisible = ref(false)
|
|
|
|
|
-const formData = ref<MenuItem>({
|
|
|
|
|
- name: '',
|
|
|
|
|
- titleIcon: {
|
|
|
|
|
- img_id: '',
|
|
|
|
|
- type: 'symbol',
|
|
|
|
|
- img_width: 0,
|
|
|
|
|
- img_height: 0,
|
|
|
|
|
- img_alpha: 255,
|
|
|
|
|
- img_recolor: '#ffffff00',
|
|
|
|
|
- img_symbol: ''
|
|
|
|
|
- }
|
|
|
|
|
-})
|
|
|
|
|
|
|
+const activeCollapseName = ref<number | string>('')
|
|
|
|
|
+const activeSymbolItem = ref<MenuItem>()
|
|
|
const symbolModalRef = ref<InstanceType<typeof SymbolSelectModal>>()
|
|
const symbolModalRef = ref<InstanceType<typeof SymbolSelectModal>>()
|
|
|
|
|
|
|
|
// 当前激活
|
|
// 当前激活
|
|
@@ -244,17 +247,25 @@ const handleAddItem = (sectionIndex: number | string) => {
|
|
|
*/
|
|
*/
|
|
|
const handleDeleteItem = (sectionIndex: number | string, index: number | string) => {
|
|
const handleDeleteItem = (sectionIndex: number | string, index: number | string) => {
|
|
|
props.values?.value.children?.[sectionIndex]?.children?.splice(index, 1)
|
|
props.values?.value.children?.[sectionIndex]?.children?.splice(index, 1)
|
|
|
|
|
+ if (activeCollapseName.value === getCollapseName(sectionIndex, index)) {
|
|
|
|
|
+ activeCollapseName.value = ''
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const handleChangeInPage = () => {
|
|
const handleChangeInPage = () => {
|
|
|
inPage.value = !inPage.value
|
|
inPage.value = !inPage.value
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const getCollapseName = (sectionIndex: number | string, index: number | string) => {
|
|
|
|
|
+ return `${sectionIndex}-${index}`
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const getSymbol = (symbol: string) => {
|
|
const getSymbol = (symbol: string) => {
|
|
|
return symbols.find((item) => item.label === symbol)?.value
|
|
return symbols.find((item) => item.label === symbol)?.value
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const handleShowSymbolModal = () => {
|
|
|
|
|
|
|
+const handleShowSymbolModal = (item: MenuItem) => {
|
|
|
|
|
+ activeSymbolItem.value = item
|
|
|
symbolModalRef.value?.open()
|
|
symbolModalRef.value?.open()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -262,12 +273,9 @@ const handleShowSymbolModal = () => {
|
|
|
* 选择图标
|
|
* 选择图标
|
|
|
*/
|
|
*/
|
|
|
const handleSelectSymbol = (val: string) => {
|
|
const handleSelectSymbol = (val: string) => {
|
|
|
- formData.value.titleIcon.img_symbol = val
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-const handleEdit = (record: MenuItem) => {
|
|
|
|
|
- formData.value = record
|
|
|
|
|
- dialogVisible.value = true
|
|
|
|
|
|
|
+ if (activeSymbolItem.value) {
|
|
|
|
|
+ activeSymbolItem.value.titleIcon.img_symbol = val
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|