123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- <script setup>
- // import Sheet from '@/components/Sheet.vue'
- import { ref, reactive, computed, onMounted, watch } from 'vue'
- import Sheet from './Sheet.vue';
- // 定义 props
- const props = defineProps({
- TableInfo:{
- type:Object,
- default:{}
- }
- })
- //手机端pc端不同样式
- const dynamicSty = computed(()=>{
- return isMobile() ? 'mobile-sty' : 'pc-sty';
- })
- //判断是否是手机设备
- function isMobile() {
- // 判断是否是移动设备的正则表达式
- const mobileRegex = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i;
-
- // 获取用户代理信息
- const userAgent = navigator.userAgent;
-
- // 使用正则表达式检查用户代理信息
- return mobileRegex.test(userAgent);
- }
-
- </script>
- <template>
- <div class="sheet-show-wrapper">
- <div :class="['table-wrapper',dynamicSty ]" >
-
- <Sheet
- :limit="{
- disabled:true
- }"
- :sheetInfo="{
- ExcelInfoId: TableInfo.ExcelInfoId,
- ExcelName: TableInfo.ExcelName,
- ExcelClassifyId: TableInfo.ExcelClassifyId,
- Source: TableInfo.Source
- }"
- :option="{
- data: [{
- ...JSON.parse(TableInfo.Content),
- scrollTop: 0,
- scrollLeft: 0
- }]
- }"
- >
- </Sheet>
- </div>
- <div class="tool sheet-bottom">
- <div class="sheet-source"
- v-if="TableInfo.SourcesFrom&&JSON.parse(TableInfo.SourcesFrom).isShow"
- :style="`
- color: ${ JSON.parse(TableInfo.SourcesFrom).color };
- font-size: ${ JSON.parse(TableInfo.SourcesFrom).fontSize }px;
- `"
- >
- source:<em>{{ JSON.parse(TableInfo.SourcesFrom).text}}</em>
- </div>
- </div>
- </div>
- </template>
- <style lang='scss' scoped>
- .sheet-show-wrapper {
- max-width: 1200px;
- overflow: hidden;
- position: relative;
- margin: 0 auto;
- background: #fff;
- .tool{
- // text-align: right;
- margin-top: 5px;
- span{
- cursor: pointer;
- }
- }
- .sheet-bottom{
- display: flex;
- align-items: center;
- justify-content: space-between;
- white-space: nowrap;
- padding: 0 10px;
- .sheet-source{
- width: 30%;
- min-width: 150px;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .right-btns {
- display: flex;
- align-items: center;
- gap:15px;
- color: #666;
- }
- }
- }
- @media screen and (min-width: 650px) {
- .sheet-show-wrapper {
- height: calc(100vh - 190px);
- }
- }
- </style>
- <style lang='scss' scoped>
- ::-webkit-scrollbar {
- width: 6px;
- height: 6px;
- }
- ::-webkit-scrollbar-track {
- background: rgb(239, 239, 239);
- border-radius: 2px;
- }
- ::-webkit-scrollbar-thumb {
- background: #ccc;
- border-radius: 10px;
- }
- ::-webkit-scrollbar-thumb:hover {
- background: #888;
- }
- ::-webkit-scrollbar-corner {
- background: #666;
- }
- .table-wrapper {
- max-width: calc(100vw - 20px);
- height: calc(100vh - 400px);
- margin: 0 auto;
- // margin-right: -5px;
- overflow: auto;
- -webkit-overflow-scrolling: touch; /* ios滚动条 */
- }
- .pc-sty table {
- table-layout: auto;
- td,th {
- width: auto;
- height: auto;
- padding: 0.4em 0;
- }
- }
- .mobile-sty table {
- table-layout: auto;
- td,th {
- min-width: 120px;
- height: 40px;
- }
- }
- </style>
|