view-report.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <hc-new-drawer v-model="isShow" ui="hc-view-report-drawer" to-id="hc-main-box">
  3. <div class="relative h-full flex">
  4. <div :id="`hc_tree_card_${uuid}`">
  5. <hc-new-card scrollbar>
  6. <div class="hc-pdf-view-report-item">
  7. <hc-icon name="printer" />
  8. <span class="name">中间支付报表封面</span>
  9. </div>
  10. <div class="hc-pdf-view-report-item cur">
  11. <hc-icon name="printer" />
  12. <span class="name">工程进度款审核表</span>
  13. </div>
  14. <div class="hc-pdf-view-report-item">
  15. <hc-icon name="printer" />
  16. <span class="name">中间计量支付证书</span>
  17. </div>
  18. <div class="hc-pdf-view-report-item">
  19. <hc-icon name="printer" />
  20. <span class="name">中间计量支付申请表</span>
  21. </div>
  22. </hc-new-card>
  23. </div>
  24. <div :id="`hc_table_card_${uuid}`" class="flex-1">
  25. <hc-new-card>
  26. <template #header>
  27. <div class="text-18px font-bold">工程进度款审核表</div>
  28. </template>
  29. <template #extra>
  30. <el-button hc-btn type="warning" @click="backClick">返回</el-button>
  31. </template>
  32. <hc-pdfs url="http://bladex-chongqing-info.oss-cn-hangzhou.aliyuncs.com//upload/20230504/911982ba85e66cfa58fb02d5a738bb2b.pdf" />
  33. </hc-new-card>
  34. </div>
  35. </div>
  36. </hc-new-drawer>
  37. </template>
  38. <script setup>
  39. import { getArrValue, getRandom } from 'js-fast-way'
  40. import { nextTick, ref, watch } from 'vue'
  41. const props = defineProps({
  42. index: {
  43. type: [String, Number],
  44. default: '0',
  45. },
  46. datas: {
  47. type: Array,
  48. default: () => ([]),
  49. },
  50. })
  51. const emit = defineEmits(['search'])
  52. defineOptions({
  53. name: 'HcViewReport',
  54. })
  55. const uuid = getRandom(4)
  56. //双向绑定
  57. // eslint-disable-next-line no-undef
  58. const isShow = defineModel('modelValue', {
  59. default: '',
  60. })
  61. //监听
  62. watch(isShow, (val) => {
  63. if (val) {
  64. setSplitRef()
  65. }
  66. })
  67. //初始化设置拖动分割线
  68. const setSplitRef = () => {
  69. //配置参考: https://split.js.org/#/?direction=vertical&snapOffset=0
  70. nextTick(() => {
  71. window.$split(['#hc_tree_card_' + uuid, '#hc_table_card_' + uuid], {
  72. sizes: [20, 80],
  73. snapOffset: 0,
  74. minSize: [50, 500],
  75. })
  76. })
  77. }
  78. //深度监听数据
  79. const pdfData = ref(props.datas)
  80. watch(() => props.datas, (data) => {
  81. pdfData.value = getArrValue(data)
  82. }, { deep: true })
  83. //深度监听索引
  84. const pdfIndex = ref(props.index)
  85. watch(() => props.index, (val) => {
  86. pdfIndex.value = val ?? 0
  87. }, { deep: true })
  88. //返回
  89. const backClick = () => {
  90. isShow.value = false
  91. }
  92. </script>
  93. <style lang="scss" scoped>
  94. .hc-pdf-view-report-item {
  95. position: relative;
  96. padding: 8px;
  97. display: flex;
  98. align-items: center;
  99. cursor: pointer;
  100. border-radius: 2px;
  101. transition: background-color .2s;
  102. .name {
  103. margin-left: 5px;
  104. }
  105. &:hover {
  106. background-color: var(--el-color-primary-light-8);
  107. }
  108. &.cur {
  109. background-color: var(--el-color-primary-light-8);
  110. color: var(--el-color-primary);
  111. }
  112. }
  113. </style>
  114. <style lang="scss">
  115. .el-overlay .el-drawer.hc-view-report-drawer {
  116. background-color: #F1F5F8;
  117. }
  118. </style>