|
@@ -1,52 +1,25 @@
|
|
|
<template>
|
|
|
- <section :style="asideStyle" class="yvan-print-designer-left__main">
|
|
|
- <div class="yvan-print-designer-left__title">
|
|
|
- <i class="fa fa-cube vsm--icon"></i>
|
|
|
- <span>组件列表</span>
|
|
|
- </div>
|
|
|
- <div class="yvan-print-designer-left__content">
|
|
|
- <el-collapse v-model="collapseOptions.activeName">
|
|
|
- <el-collapse-item
|
|
|
- v-for="componentType in componentTypeList"
|
|
|
- :title="componentType.title"
|
|
|
- :name="componentType.name">
|
|
|
- <div class="yvan-print-designer-left__collapse_item">
|
|
|
- <el-space wrap @dragstart="handleDragStart">
|
|
|
- <div
|
|
|
- v-for="component in componentType.componentList"
|
|
|
- :key="component.code"
|
|
|
- :data-code="component.code"
|
|
|
- draggable="true">
|
|
|
- <el-button> {{ component.name }}</el-button>
|
|
|
- </div>
|
|
|
- </el-space>
|
|
|
- </div>
|
|
|
- </el-collapse-item>
|
|
|
- </el-collapse>
|
|
|
- </div>
|
|
|
- </section>
|
|
|
+ <div class="yvan-print-designer-left-component">
|
|
|
+ <yvan-print-designer-left-component/>
|
|
|
+ </div>
|
|
|
+ <div class="yvan-print-designer-left-structure">
|
|
|
+ <yvan-print-designer-left-structure/>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import commonMixin from '@/mixin/commonMixin'
|
|
|
-import menuConfig from "@/components/config/menuConfig";
|
|
|
-import {componentTypeList} from "@/components/config/componentList";
|
|
|
-import YvanPrintSidebarMenu from "@/components/yvan-ui/yvan-sidebar-menu/SidebarMenu.vue";
|
|
|
+import YvanPrintDesignerLeftComponent from "@/components/yvan-print-designer-left-component.vue";
|
|
|
+import YvanPrintDesignerLeftStructure from "@/components/yvan-print-designer-left-structure.vue";
|
|
|
|
|
|
export default {
|
|
|
name: 'yvan-print-designer-left',
|
|
|
- components: {YvanPrintSidebarMenu},
|
|
|
- mixins: [commonMixin],
|
|
|
+ components: {
|
|
|
+ YvanPrintDesignerLeftComponent,
|
|
|
+ YvanPrintDesignerLeftStructure
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
isNightMode: false,
|
|
|
- componentTypeList,
|
|
|
- menuList: menuConfig.menuList,
|
|
|
- curActiveComponent: null,
|
|
|
- curActiveComponentCode: '',
|
|
|
- collapseOptions: {
|
|
|
- activeName: componentTypeList.map(componentType => componentType.name)
|
|
|
- }
|
|
|
}
|
|
|
},
|
|
|
props: {
|
|
@@ -55,98 +28,24 @@ export default {
|
|
|
default: true
|
|
|
}
|
|
|
},
|
|
|
- computed: {
|
|
|
- // ...mapState({
|
|
|
- // paletteCount: (state) => state.printTemplateModule.paletteCount,
|
|
|
- // globalCount: (state) => state.printTemplateModule.globalCount,
|
|
|
- // isNightMode: (state) => state.printTemplateModule.nightMode.isNightMode
|
|
|
- // }),
|
|
|
- asideStyle() {
|
|
|
- return this.showRight ? 'width: 300px' : 'width: 65px'
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- handleDragStart(e) {
|
|
|
- console.log(' >>>> ', e, e.target.dataset.code)
|
|
|
- e.dataTransfer.setData('componentCode', e.target.dataset.code)
|
|
|
- },
|
|
|
-
|
|
|
- onMenuSelect(e, item) {
|
|
|
- this.curActiveComponent = item.relativeComponent
|
|
|
- this.curActiveComponentCode = item.code
|
|
|
- this.menuList.forEach((mItem) => {
|
|
|
- if (item.code === mItem.code) {
|
|
|
- mItem.isActive = true
|
|
|
- return
|
|
|
- }
|
|
|
- mItem.isActive = false
|
|
|
- })
|
|
|
- },
|
|
|
- clickPaletteMenu() {
|
|
|
- this.$refs.sideMenu.$refs.menuItems.forEach((item) => {
|
|
|
- if (item.item.code === 'palette' && this.curActiveComponentCode !== 'palette') {
|
|
|
- this.onMenuSelect(null, item.item)
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- clickGlobalMenu() {
|
|
|
- this.$refs.sideMenu.$refs.menuItems.forEach((item) => {
|
|
|
- if (item.item.code === 'setting' && this.curActiveComponentCode !== 'setting') {
|
|
|
- this.onMenuSelect(null, item.item)
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
+ computed: {},
|
|
|
+ methods: {},
|
|
|
mounted() {
|
|
|
- const currentMenu = this.menuList[0]
|
|
|
- this.curActiveComponent = currentMenu?.relativeComponent
|
|
|
- this.curActiveComponentCode = currentMenu?.code
|
|
|
},
|
|
|
- watch: {
|
|
|
- paletteCount() {
|
|
|
- this.clickPaletteMenu()
|
|
|
- },
|
|
|
- globalCount() {
|
|
|
- this.clickGlobalMenu()
|
|
|
- }
|
|
|
- }
|
|
|
+ watch: {}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
-.yvan-print-designer-left__main {
|
|
|
- height: 100%;
|
|
|
+.yvan-print-designer-left-component {
|
|
|
+ height: calc(50% - 10px);
|
|
|
width: 100%;
|
|
|
+}
|
|
|
|
|
|
- .yvan-print-designer-left__title {
|
|
|
- width: 100%;
|
|
|
- height: 45px;
|
|
|
- text-align: left;
|
|
|
- line-height: 45px;
|
|
|
- background: var(--yvan-menu-bar-background);
|
|
|
- color: #fff;
|
|
|
- align-items: center;
|
|
|
-
|
|
|
- i {
|
|
|
- margin: 0 5px 0 10px;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .yvan-print-designer-left__content {
|
|
|
- padding: 0 5px;
|
|
|
- background: var(--yvan-bg-color-overlay);
|
|
|
-
|
|
|
- .yvan-print-designer-left__collapse_item {
|
|
|
- margin: 0 10px;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .yvan-print-designer-left__right_panel {
|
|
|
- width: calc(100% - 64px);
|
|
|
- background: var(--yvan-bg-color-overlay);
|
|
|
- position: absolute;
|
|
|
- right: 0;
|
|
|
- top: 0;
|
|
|
- }
|
|
|
+.yvan-print-designer-left-structure {
|
|
|
+ height: calc(50% - 10px);
|
|
|
+ width: 100%;
|
|
|
+ margin-top: 10px;
|
|
|
}
|
|
|
+
|
|
|
</style>
|