|
@@ -1,99 +0,0 @@
|
|
-<template>
|
|
|
|
- <yvan-print-main class="roy-page-toc">
|
|
|
|
- <div v-if="componentData.length">
|
|
|
|
- <div
|
|
|
|
- v-for="(item, index) in componentData"
|
|
|
|
- :key="index"
|
|
|
|
- :class="{ activated: transformIndex(index) === curComponentIndex }"
|
|
|
|
- class="roy-page-toc__list"
|
|
|
|
- @click="onClick(transformIndex(index))"
|
|
|
|
- >
|
|
|
|
- <i :class="getComponent(index).icon" style="padding-right: 5px"></i>
|
|
|
|
- <span class="roy-page-toc__label">{{ getComponent(index).label }}</span>
|
|
|
|
- <div class="roy-page-toc__buttons">
|
|
|
|
- <span class="ri-arrow-up-line" @click="upComponent(transformIndex(index))"></span>
|
|
|
|
- <span class="ri-arrow-down-line" @click="downComponent(transformIndex(index))"></span>
|
|
|
|
- <span class="ri-delete-bin-4-line" @click="deleteComponent(transformIndex(index))"></span>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- <div v-else class="roy-page-toc__empty animate__animated animate__headShake">
|
|
|
|
- <i class="ri-door-lock-box-line animate__backInUp" style="color: var(--roy-color-warning)"/>
|
|
|
|
- <div>当前没有组件,您可以通过拖拽添加组件</div>
|
|
|
|
- </div>
|
|
|
|
- </yvan-print-main>
|
|
|
|
-</template>
|
|
|
|
-
|
|
|
|
-<script lang="js">
|
|
|
|
-import {mapState} from 'pinia'
|
|
|
|
-import {globalStore} from "@/store";
|
|
|
|
-import commonMixin from '@/mixin/commonMixin'
|
|
|
|
-import YvanPrintMain from "@/components/yvan-ui/yvan-print-main.vue";
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * 页面大纲
|
|
|
|
- */
|
|
|
|
-export default {
|
|
|
|
- name: 'PageToc',
|
|
|
|
- mixins: [commonMixin],
|
|
|
|
- components: {YvanPrintMain},
|
|
|
|
- props: {},
|
|
|
|
- data() {
|
|
|
|
- return {}
|
|
|
|
- },
|
|
|
|
- computed: {
|
|
|
|
- ...mapState(globalStore, ['componentData', 'curComponentIndex', "curComponent"])
|
|
|
|
- },
|
|
|
|
- methods: {
|
|
|
|
- initMounted() {
|
|
|
|
- },
|
|
|
|
- getComponent(index) {
|
|
|
|
- return this.componentData[this.componentData.length - 1 - index]
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- transformIndex(index) {
|
|
|
|
- return this.componentData.length - 1 - index
|
|
|
|
- },
|
|
|
|
- onClick(index) {
|
|
|
|
- this.setCurComponent(index)
|
|
|
|
- },
|
|
|
|
- deleteComponent() {
|
|
|
|
- setTimeout(() => {
|
|
|
|
- this.$store.commit('printTemplateModule/deleteComponent')
|
|
|
|
- this.$store.commit('printTemplateModule/recordSnapshot')
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- upComponent() {
|
|
|
|
- setTimeout(() => {
|
|
|
|
- this.$store.commit('printTemplateModule/upComponent')
|
|
|
|
- this.$store.commit('printTemplateModule/recordSnapshot')
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- downComponent() {
|
|
|
|
- setTimeout(() => {
|
|
|
|
- this.$store.commit('printTemplateModule/downComponent')
|
|
|
|
- this.$store.commit('printTemplateModule/recordSnapshot')
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- setCurComponent(index) {
|
|
|
|
- this.$store.commit('printTemplateModule/setCurComponent', {
|
|
|
|
- component: this.componentData[index],
|
|
|
|
- index
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- created() {
|
|
|
|
- },
|
|
|
|
- mounted() {
|
|
|
|
- this.initMounted()
|
|
|
|
- },
|
|
|
|
- watch: {}
|
|
|
|
-}
|
|
|
|
-</script>
|
|
|
|
-
|
|
|
|
-<style lang="less" scoped>
|
|
|
|
-
|
|
|
|
-</style>
|
|
|