李林
2024-03-25 d66eade2e194c38170930961fc67375400967aa6
src/components/tool/excel.vue
@@ -10,7 +10,7 @@
   }
</style>
<style>
   #luckysheet .save{
   #luckysheet .save {
      width: 50px;
      height: 26px;
      color: #fff;
@@ -20,11 +20,11 @@
      cursor: pointer;
   }
   #luckysheet .save:hover{
   #luckysheet .save:hover {
      opacity: .8;
   }
   #luckysheet .save:active{
   #luckysheet .save:active {
      opacity: .7;
   }
</style>
@@ -33,12 +33,12 @@
</template>
<script>
// import { data } from 'jquery';
import { data } from 'jquery';
   // import { data } from 'jquery';
   export default {
      props: ['data','execlTitle'],
      props: ['data', 'execlTitle'],
      data() {
         return {
         }
         return {}
      },
      mounted() {
         this.$nextTick(() => {
@@ -47,52 +47,75 @@
      },
      methods: {
         templateWrite() {
            if(this.data!=null&&this.data!=''){
               let option = JSON.parse(this.data)
               option.title = this.execlTitle
               luckysheet.create(option)
            }else{
               console.log(this.execlTitle);
               $(function() {
                  //配置项
                  var options = {
                     container: 'luckysheet',
                     title: this.execlTitle,
                     lang: "zh",
                     showsheetbar: false,
                     showstatisticBarConfig: {
                        view: false
                     },
                     data: [{
                        name: '模板',
                        order: '0'
                     }],
                     enableAddRow: false,
                     row: 60,
                     column: 26,
                     enableAddBackTop: false,
                     showtoolbarConfig: {
                        chart: false, // '图表'
                        pivotTable: false,  //'数据透视表'
                        protection:false, // '工作表保护'
                     },
                     cellRightClickConfig: {
                        copyAs: false, // 复制为
                        hideRow: false, // 隐藏选中行和显示选中行
                        hideColumn: false, // 隐藏选中列和显示选中列
                        sort: false, // 排序选区
                        filter: false, // 筛选选区
                        chart: false, // 图表生成
                        image: false, // 插入图片
                        matrix: false, // 矩阵操作选区
                     },
                     myFolderUrl: 'http://127.0.0.1/',
                     functionButton: '<button onClick="excelClosed()" class="save">保存</button>'
                  }
                  options.title = this.execlTitle
                  luckysheet.create(options)
               })
            var option = {}
            if (this.data != null && this.data != '') {
               option = JSON.parse(this.data)
            } else {
               let rowlen = {}
               let columnlen = {}
               for(let a = 0; a<60; a++){
                  rowlen[''+a] = 40
               }
               for(let a = 0; a<26; a++){
                  columnlen[''+a] = 100
               }
               option = {
                  data: [{
                     name: '模板',
                     order: '0',
                     config: {
                        rowlen: rowlen,
                        columnlen: columnlen
                     }
                  }],
                  row: 60,
                  column: 26
               }
            }
            option.title = this.execlTitle
            option.container = 'luckysheet',
            option.lang = "zh",
            option.showsheetbar = false,
            option.defaultFontSize = 14
            option.showstatisticBarConfig = {
               view: false
            },
            option.enableAddRow = false,
            option.enableAddBackTop = false,
            option.showtoolbarConfig = {
               chart: false, // '图表'
               pivotTable: false, //'数据透视表'
               protection: false, // '工作表保护'
               dataVerification: false, // '数据验证'
               frozenMode: false, // '冻结方式'
               currencyFormat: false, //货币格式
               percentageFormat: false, //百分比格式
               numberDecrease: false, // '减少小数位数'
               numberIncrease: false, // '增加小数位数
               moreFormats: false, // '更多格式'
               strikethrough: false, // '删除线 (Alt+Shift+5)'
               underline: false, // '下划线 (Alt+Shift+6)'
               italic: false, // '斜体 (Ctrl+I)'
               textWrapMode: false, // '换行方式'
               textRotateMode: false, // '文本旋转方式'
               conditionalFormat: false, // '条件格式'
               splitColumn: false, // '分列'
            },
            option.cellRightClickConfig = {
               copyAs: false, // 复制为
               hideRow: false, // 隐藏选中行和显示选中行
               hideColumn: false, // 隐藏选中列和显示选中列
               sort: false, // 排序选区
               filter: false, // 筛选选区
               chart: false, // 图表生成
               image: false, // 插入图片
               matrix: false, // 矩阵操作选区
               data: false, // 数据验证
               cellFormat: false // 设置单元格格式
            },
            option.myFolderUrl = this.LOCATIONVUE + '/',
            option.functionButton = '<button onClick="excelClosed()" class="save">保存</button>'
            luckysheet.create(option)
         }
      }
   }