物管理前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

125 lines
2.7 KiB

  1. <template>
  2. <div class="block" ref="blockRef">
  3. <div :class="['title']">
  4. <span>{{ item.title || '' }}</span>
  5. <div class="title-right">
  6. <el-select :model-value="dataForm.code" v-if="item.select" @change="$emit('change-code', $event)"><el-option v-for="(val, key, index) in dataForm.codeMap || {}" :key="index" :label="key" :value="key"></el-option></el-select>
  7. <span class="unit" v-if="item.unit">{{ item.unit }}</span>
  8. </div>
  9. </div>
  10. <div class="main">
  11. <slot></slot>
  12. </div>
  13. </div>
  14. </template>
  15. <script lang="ts">
  16. import { computed, defineComponent, h, nextTick, onMounted, reactive, toRefs } from 'vue';
  17. import { IObject } from '@/types/interface';
  18. import utilService from '@/service/utilService';
  19. export default defineComponent({
  20. name: 'block',
  21. props: { item: { type: Object, default: () => ({}) }, dataForm: { type: Object, default: () => ({}) }, width: { type: String, default: () => '484px' }, height: { type: String, default: () => '318px' } },
  22. setup(props) {
  23. const state = reactive({
  24. blockRef: null,
  25. });
  26. const block = computed(() => {
  27. return {
  28. w: props.width,
  29. h: props.height,
  30. };
  31. });
  32. return {
  33. ...toRefs(state),
  34. block,
  35. };
  36. },
  37. emits: ['change-code'],
  38. });
  39. </script>
  40. <style scoped lang="less">
  41. .block {
  42. width: v-bind('block.w');
  43. height: v-bind('block.h');
  44. background: url('@/assets/images/njhl/block.png') no-repeat center;
  45. background-size: 100% 100%;
  46. display: flex;
  47. flex-direction: column;
  48. > .title {
  49. position: relative;
  50. // height: v-bind("getSizeByType.titleHeight");
  51. display: flex;
  52. align-items: center;
  53. justify-content: space-between;
  54. padding: 10px 38px;
  55. color: #fff;
  56. > span {
  57. font-size: 20px;
  58. font-family: Microsoft YaHei;
  59. font-weight: bold;
  60. }
  61. > .title-right {
  62. position: absolute;
  63. top: 20px;
  64. right: 20px;
  65. ::v-deep .el-select {
  66. width: 100px;
  67. .el-input__wrapper {
  68. background: transparent;
  69. padding-right: 20px;
  70. .el-input__inner {
  71. color: #fff;
  72. }
  73. }
  74. .el-input__suffix-inner i {
  75. color: #0084ff;
  76. }
  77. .el-select:hover,
  78. .el-input__wrapper {
  79. box-shadow: 0 0 0 1px #0084ff;
  80. }
  81. }
  82. .unit {
  83. display: inline-block;
  84. margin-left: 8px;
  85. width: 2em;
  86. }
  87. }
  88. }
  89. > .dot {
  90. > span {
  91. padding-left: 25px;
  92. }
  93. &:before {
  94. position: absolute;
  95. left: 0;
  96. top: 50%;
  97. content: '';
  98. width: 14px;
  99. height: 41px;
  100. transform: translateY(-50%);
  101. background: rgba(#3c8ef5, 0.34);
  102. }
  103. }
  104. > .main {
  105. position: relative;
  106. flex: 1;
  107. }
  108. }
  109. </style>