CidTree.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <div>
  3. <div class="bigBox">
  4. <div class="tagBox">
  5. <div style="display: flex;justify-content: flex-start;align-items: center;">
  6. <div>
  7. <img style="width: 20px;height: 20px;" src="../../../assets/icon/HardDrives.png" alt="">
  8. </div>
  9. <div>
  10. <h3>装置列表</h3>
  11. </div>
  12. </div>
  13. <p :class="tagChoose == index ? 'result' : 'tagP'" v-for="(item, index) in tagList"
  14. @click="tagClick(item, index)">
  15. {{ item.desc }}
  16. </p>
  17. </div>
  18. <div class="setting">
  19. <el-tree :data="treeData" :props="defaultProps" @node-click="handleNodeClick" />
  20. </div>
  21. </div>
  22. </div>
  23. </template>
  24. <script>
  25. import { ref, onMounted, toRefs, watch } from 'vue';
  26. import cid from "@/api/cid/cid"
  27. import scdCheck from '@/api/scdCheck/scdCheck';
  28. import { stringify } from 'uuid';
  29. export default {
  30. props: {
  31. nowScdId: {
  32. type: Number || String,
  33. required: true
  34. }
  35. },
  36. setup(props, { emit }) {
  37. let tagList = ref([])
  38. let tagChoose = ref(0)
  39. let treeData = ref([
  40. {
  41. label: "通信参数部分",
  42. children: [
  43. {
  44. label: "站控层通信参数"
  45. },
  46. {
  47. label: "GOOSE通信参数"
  48. },
  49. {
  50. label: "SV通信参数"
  51. }
  52. ]
  53. }, {
  54. label: "测点信息部分",
  55. children: [
  56. {
  57. label: "信息部分-1"
  58. }
  59. ]
  60. }, {
  61. label: "回路配置",
  62. children: [
  63. {
  64. label: "回路配置-1"
  65. }
  66. ]
  67. }, {
  68. label: "建模信息",
  69. children: [
  70. {
  71. label: "建模信息-1"
  72. }
  73. ]
  74. }
  75. ])
  76. let needName = ref('')
  77. let defaultProps = ref({
  78. label: "label",
  79. children: "children"
  80. })
  81. let scdId = ref("")//传递的scdid
  82. watch(() => props.nowScdId, (newVal) => {
  83. scdId.value = newVal
  84. })
  85. function reload() {
  86. scdId.value = props.nowScdId
  87. cid.getAll({ scd_id: scdId.value - 0, ied_name: "" }).then(res => {
  88. tagList.value = res.data
  89. })
  90. }
  91. function tagClick(row, num) {
  92. tagChoose.value = num
  93. cid.findFile({
  94. scd_id: scdId.value - 0,
  95. ied_name: row.desc,
  96. pageno: 1,
  97. pagesize: 10,
  98. station_id: 861
  99. }).then(res => {
  100. console.log(res, '文件');
  101. })
  102. scdCheck.lookCheck({
  103. pageindex: 1,
  104. pagesize: 10,
  105. station_id: 861,
  106. scd_id: scdId.value - 0,
  107. is_checkin: 2,
  108. ied_name: row.ied_name
  109. }).then(res => {
  110. let a = res.data.filter(item => item.type_name == 'CID')
  111. if (a.length > 0) {
  112. needName.value = a[0].file_name
  113. emit('treeBack', needName.value, a[0].id)
  114. }
  115. })
  116. }
  117. function handleNodeClick(e) {
  118. console.log(e, 'eee');
  119. }
  120. onMounted(() => {
  121. reload()
  122. })
  123. return {
  124. tagList,//标签数据
  125. tagChoose,//标签点击事件
  126. treeData,//树形数据
  127. tagClick,//tag点击事件
  128. defaultProps,//树形默认展示
  129. handleNodeClick,//树形点击事件
  130. needName,//返回父组件的名称
  131. scdId,//传递的scdid
  132. }
  133. }
  134. }
  135. </script>
  136. <style scoped>
  137. p,
  138. h3 {
  139. margin: 0;
  140. padding: 0;
  141. }
  142. .bigBox {
  143. width: 100%;
  144. height: calc(100vh - 270px);
  145. border: 1px solid #A3ADE0;
  146. cursor: pointer;
  147. /* margin-left: 25px; */
  148. }
  149. .tagBox {
  150. width: 95%;
  151. height: calc(100vh - 550px);
  152. /* border: 1px solid green; */
  153. border-bottom: 1px solid #A3ADE0;
  154. margin: 0 auto;
  155. overflow-y: auto;
  156. }
  157. .tagP {
  158. width: 100%;
  159. overflow: hidden;
  160. text-overflow: ellipsis;
  161. white-space: nowrap;
  162. margin-top: 5px;
  163. font-size: 16px;
  164. }
  165. .result {
  166. width: 100%;
  167. overflow: hidden;
  168. text-overflow: ellipsis;
  169. white-space: nowrap;
  170. /* background-color: #A3ADE0; */
  171. color: #255CE7;
  172. margin-top: 5px;
  173. font-size: 16px;
  174. }
  175. .setting {
  176. width: 95%;
  177. height: calc(100vh - 670px);
  178. /* border: 1px solid skyblue; */
  179. margin: 2px auto;
  180. }
  181. </style>