SharedSheet.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <script setup>
  2. // import Sheet from '@/components/Sheet.vue'
  3. import { ref, reactive, computed, onMounted, watch } from 'vue'
  4. import Sheet from './Sheet.vue';
  5. // 定义 props
  6. const props = defineProps({
  7. TableInfo:{
  8. type:Object,
  9. default:{}
  10. }
  11. })
  12. //手机端pc端不同样式
  13. const dynamicSty = computed(()=>{
  14. return isMobile() ? 'mobile-sty' : 'pc-sty';
  15. })
  16. //判断是否是手机设备
  17. function isMobile() {
  18. // 判断是否是移动设备的正则表达式
  19. const mobileRegex = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i;
  20. // 获取用户代理信息
  21. const userAgent = navigator.userAgent;
  22. // 使用正则表达式检查用户代理信息
  23. return mobileRegex.test(userAgent);
  24. }
  25. </script>
  26. <template>
  27. <div class="sheet-show-wrapper">
  28. <div :class="['table-wrapper',dynamicSty ]" >
  29. <Sheet
  30. :limit="{
  31. disabled:true
  32. }"
  33. :sheetInfo="{
  34. ExcelInfoId: TableInfo.ExcelInfoId,
  35. ExcelName: TableInfo.ExcelName,
  36. ExcelClassifyId: TableInfo.ExcelClassifyId,
  37. Source: TableInfo.Source
  38. }"
  39. :option="{
  40. data: [{
  41. ...JSON.parse(TableInfo.Content),
  42. scrollTop: 0,
  43. scrollLeft: 0
  44. }]
  45. }"
  46. >
  47. </Sheet>
  48. </div>
  49. <div class="tool sheet-bottom">
  50. <div class="sheet-source"
  51. v-if="TableInfo.SourcesFrom&&JSON.parse(TableInfo.SourcesFrom).isShow"
  52. :style="`
  53. color: ${ JSON.parse(TableInfo.SourcesFrom).color };
  54. font-size: ${ JSON.parse(TableInfo.SourcesFrom).fontSize }px;
  55. `"
  56. >
  57. source:<em>{{ JSON.parse(TableInfo.SourcesFrom).text}}</em>
  58. </div>
  59. </div>
  60. </div>
  61. </template>
  62. <style lang='scss' scoped>
  63. .sheet-show-wrapper {
  64. max-width: 1200px;
  65. overflow: hidden;
  66. position: relative;
  67. margin: 0 auto;
  68. background: #fff;
  69. .tool{
  70. // text-align: right;
  71. margin-top: 5px;
  72. span{
  73. cursor: pointer;
  74. }
  75. }
  76. .sheet-bottom{
  77. display: flex;
  78. align-items: center;
  79. justify-content: space-between;
  80. white-space: nowrap;
  81. padding: 0 10px;
  82. .sheet-source{
  83. width: 30%;
  84. min-width: 150px;
  85. overflow: hidden;
  86. text-overflow: ellipsis;
  87. }
  88. .right-btns {
  89. display: flex;
  90. align-items: center;
  91. gap:15px;
  92. color: #666;
  93. }
  94. }
  95. }
  96. @media screen and (min-width: 650px) {
  97. .sheet-show-wrapper {
  98. height: calc(100vh - 190px);
  99. }
  100. }
  101. </style>
  102. <style lang='scss' scoped>
  103. ::-webkit-scrollbar {
  104. width: 6px;
  105. height: 6px;
  106. }
  107. ::-webkit-scrollbar-track {
  108. background: rgb(239, 239, 239);
  109. border-radius: 2px;
  110. }
  111. ::-webkit-scrollbar-thumb {
  112. background: #ccc;
  113. border-radius: 10px;
  114. }
  115. ::-webkit-scrollbar-thumb:hover {
  116. background: #888;
  117. }
  118. ::-webkit-scrollbar-corner {
  119. background: #666;
  120. }
  121. .table-wrapper {
  122. max-width: calc(100vw - 20px);
  123. height: calc(100vh - 400px);
  124. margin: 0 auto;
  125. // margin-right: -5px;
  126. overflow: auto;
  127. -webkit-overflow-scrolling: touch; /* ios滚动条 */
  128. }
  129. .pc-sty table {
  130. table-layout: auto;
  131. td,th {
  132. width: auto;
  133. height: auto;
  134. padding: 0.4em 0;
  135. }
  136. }
  137. .mobile-sty table {
  138. table-layout: auto;
  139. td,th {
  140. min-width: 120px;
  141. height: 40px;
  142. }
  143. }
  144. </style>