scdDialogIndex.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <!-- 整个弹窗 -->
  2. <template>
  3. <div>
  4. <el-dialog
  5. @close="cancelClick"
  6. v-model="isOpen"
  7. width="70vw"
  8. append-to-body
  9. draggable
  10. >
  11. <template #header>
  12. <div class="my-header">
  13. <div class="title">{{ props.checkLabel }}</div>
  14. </div>
  15. </template>
  16. <el-scrollbar height="470px">
  17. <div class="container">
  18. <div
  19. class="cont-item"
  20. v-for="(item, index) in props.dialogData"
  21. :key="index"
  22. @click="clickIed(item)"
  23. >
  24. <img :src="devicePng" alt="" />
  25. <div class="name">{{ item.ied_name }}</div>
  26. <div class="desc">{{ item.desc }}</div>
  27. </div>
  28. </div>
  29. </el-scrollbar>
  30. </el-dialog>
  31. <dialog-index
  32. :openBig="openBig"
  33. @done="done"
  34. :checkDialogData="checkDialogData"
  35. :iedRelationData="iedRelationData"
  36. ></dialog-index>
  37. </div>
  38. </template>
  39. <script setup>
  40. import { watch, ref, inject, onMounted } from "vue";
  41. import { defineEmits } from "vue";
  42. import { scdIedRelation } from "@/api/iedNetwork";
  43. import devicePng from "@/assets/image/instruct/device.png";
  44. import dialogIndex from "./dialogIndex.vue";
  45. const scdIdValue = inject("scdId");
  46. const openBig = ref(false);
  47. const props = defineProps({
  48. open: {
  49. type: Boolean,
  50. default: false,
  51. },
  52. dialogData: {
  53. type: Object,
  54. default: () => {},
  55. },
  56. checkLabel: {
  57. type: String,
  58. default: "",
  59. },
  60. iedRelationData:{
  61. type: Object,
  62. default: () => {},
  63. }
  64. });
  65. const isOpen = ref(props.open);
  66. watch(
  67. () => props.open,
  68. (newValue) => {
  69. isOpen.value = newValue;
  70. }
  71. );
  72. //弹窗=============
  73. const emit = defineEmits(["done", "update:visible"]);
  74. const cancelClick = () => {
  75. isOpen.value = false;
  76. emit("done", false);
  77. };
  78. const checkDialogData = ref(null);
  79. onMounted(() => {
  80. });
  81. const clickIed = (value) => {
  82. openBig.value = true;
  83. Object.values(props.iedRelationData).find((item) => {
  84. if (item.ied_name == value.ied_name) {
  85. checkDialogData.value = item;
  86. }
  87. });
  88. };
  89. const done = (emits) => {
  90. openBig.value = emits;
  91. checkDialogData.value = null;
  92. };
  93. // emit('done', data.id);
  94. // emit('update:visible', value);
  95. </script>
  96. <style scoped lang="scss">
  97. :deep(.el-dialog__header) {
  98. border-bottom: 1px solid #a3ade0;
  99. }
  100. .my-header {
  101. border-bottom: 1px solid #a3ade0;
  102. font-size: 16px;
  103. color: #1a2447;
  104. .title {
  105. padding-bottom: 15px;
  106. }
  107. }
  108. .container {
  109. display: flex;
  110. flex-wrap: wrap;
  111. .cont-item {
  112. display: flex;
  113. align-items: center;
  114. flex-direction: column;
  115. flex-wrap: wrap;
  116. flex-basis: 20%;
  117. margin-bottom: 15px;
  118. cursor: pointer;
  119. }
  120. img {
  121. widows: 65px;
  122. height: 65px;
  123. }
  124. .desc {
  125. color: #255ce7;
  126. }
  127. }
  128. </style>