ScdNow.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template>
  2. <div style="display: flex;justify-content: space-around; align-items: center;">
  3. <div class="scdBox">
  4. <div>
  5. <img src="../../../assets/image/squer_scd.png" alt="">
  6. <p>SCD版本</p>
  7. </div>
  8. <div>
  9. <div id="oldScd">
  10. <img src="../../../assets/icon/cilce_gray.png" alt="">
  11. <span>V1.1.0</span>
  12. </div>
  13. <div id="newScd">
  14. <img src="../../../assets/icon/clice_blue.png" alt="">
  15. <span>V1.1.1</span>
  16. </div>
  17. </div>
  18. </div>
  19. <div class="crcBox">
  20. <div>
  21. <img src="../../../assets/image/squer_crc.png" alt="">
  22. <p>CRC</p>
  23. </div>
  24. <div>
  25. <div id="oldCrc">
  26. <img src="../../../assets/icon/cilce_gray.png" alt="">
  27. <span>1000000111100000</span>
  28. </div>
  29. <div id="newCrc">
  30. <img src="../../../assets/icon/clice_blue.png" alt="">
  31. <span>1000000111100022</span>
  32. </div>
  33. </div>
  34. </div>
  35. <div class="iedBox">
  36. <div id="oldIed">
  37. <img src="../../../assets/image/squer_ied.png" alt="">
  38. <p>IED</p>
  39. </div>
  40. <div id="newIed">
  41. <p id="addId" @click="lookAdd">
  42. <el-icon style="color: #1D48E8;font-size: 18px;display: block;">
  43. <CirclePlus />
  44. </el-icon>
  45. <span style="display: block;color: #1D48E8;">新增(5)</span>
  46. </p>
  47. <p id="editId" @click="lookEdit">
  48. <el-icon style="color: #FECC2A;font-size: 18px;display: block;">
  49. <EditPen />
  50. </el-icon>
  51. <span style="display: block;color: #FECC2A;">修改(10)</span>
  52. </p>
  53. <p id="delId" @click="lookDel">
  54. <el-icon style="color: red;font-size: 18px;display: block;">
  55. <Delete />
  56. </el-icon>
  57. <span style="display: block;color: red;">删除(2)</span>
  58. </p>
  59. </div>
  60. </div>
  61. </div>
  62. </template>
  63. <script>
  64. import { ref, onMounted, toRefs, watch, onBeforeUnmount } from 'vue';
  65. import LeaderLine from '../../../../public/leader-line.min.js';
  66. export default {
  67. setup(props,{emit}) {
  68. let lineList = []
  69. let lookType = ref(0)
  70. function lineWrite() {
  71. let oldScd = document.getElementById("oldScd")
  72. let newScd = document.getElementById("newScd")
  73. let oldCrc = document.getElementById("oldCrc")
  74. let newCrc = document.getElementById("newCrc")
  75. let oldIed = document.getElementById("oldIed")
  76. let newIed = document.getElementById("newIed")
  77. let addId = document.getElementById("addId")
  78. let editId = document.getElementById('editId')
  79. let delId = document.getElementById("delId")
  80. lineList.push(new LeaderLine(oldScd, newScd, {
  81. color: "blue",//连接线颜色
  82. size: 10,//连接线宽度
  83. path: "straight",//连接线样式
  84. startSocket: "bottom",//开始链接元素位置
  85. endSocket: "top",//结束链接元素位置
  86. dash: {
  87. // 绘制线的长度 'auto'=size*2
  88. len: 1,
  89. // 绘制线之间的间隙 'auto'=size
  90. gap: 6,
  91. // 线条滚动 true 是(或者{duration: 1000, timing: 'linear'},详见动画选项), false 否(默认)
  92. animation: {
  93. duration: 800,//动画速度
  94. timing: "linear",
  95. },
  96. },//动画开启
  97. endPlug: 'arrow3',//结束箭头
  98. endPlugSize: 0.5,//结束箭头size
  99. }))
  100. lineList.push(new LeaderLine(oldCrc, newCrc, {
  101. color: "blue",//连接线颜色
  102. size: 10,//连接线宽度
  103. path: "straight",//连接线样式
  104. startSocket: "bottom",//开始链接元素位置
  105. endSocket: "top",//结束链接元素位置
  106. dash: {
  107. // 绘制线的长度 'auto'=size*2
  108. len: 1,
  109. // 绘制线之间的间隙 'auto'=size
  110. gap: 6,
  111. // 线条滚动 true 是(或者{duration: 1000, timing: 'linear'},详见动画选项), false 否(默认)
  112. animation: {
  113. duration: 800,//动画速度
  114. timing: "linear",
  115. },
  116. },//动画开启
  117. endPlug: 'arrow3',//结束箭头
  118. endPlugSize: 0.5,//结束箭头size
  119. }))
  120. lineList.push(new LeaderLine(oldIed, addId, {
  121. color: "gray",//连接线颜色
  122. size: 2,//连接线宽度
  123. path: "grid",//连接线样式
  124. startSocket: "bottom",//开始链接元素位置
  125. endSocket: "left",//结束链接元素位置
  126. endPlug: 'disc',//结束箭头
  127. endPlugSize: 2,//结束箭头size
  128. }))
  129. lineList.push(new LeaderLine(oldIed, editId, {
  130. color: "gray",//连接线颜色
  131. size: 2,//连接线宽度
  132. path: "grid",//连接线样式
  133. startSocket: "bottom",//开始链接元素位置
  134. endSocket: "left",//结束链接元素位置
  135. endPlug: 'disc',//结束箭头
  136. endPlugSize: 2,//结束箭头size
  137. }))
  138. lineList.push(new LeaderLine(oldIed, delId, {
  139. color: "gray",//连接线颜色
  140. size: 2,//连接线宽度
  141. path: "grid",//连接线样式
  142. startSocket: "bottom",//开始链接元素位置
  143. endSocket: "left",//结束链接元素位置
  144. endPlug: 'disc',//结束箭头
  145. endPlugSize: 2,//结束箭头size
  146. }))
  147. }
  148. function lookAdd() {
  149. lookType.value = 1
  150. emit('nowBack',lookType.value)
  151. }
  152. function lookEdit() {
  153. lookType.value = 2
  154. emit('nowBack',lookType.value)
  155. }
  156. function lookDel() {
  157. lookType.value = 3
  158. emit('nowBack',lookType.value)
  159. }
  160. onMounted(()=>{
  161. setTimeout(()=>{
  162. lineWrite()
  163. },1500)
  164. })
  165. onBeforeUnmount(()=>{
  166. lineList.forEach(item=>item.remove())
  167. })
  168. return {
  169. lineWrite,
  170. lineList,
  171. lookType,
  172. lookAdd,//查看新增
  173. lookDel,//查看删除
  174. lookEdit,//查看修改
  175. }
  176. }
  177. }
  178. </script>
  179. <style>
  180. p {
  181. margin: 0;
  182. padding: 0;
  183. }
  184. .scdBox {
  185. width: 33%;
  186. height: auto;
  187. text-align: center;
  188. /* border: 1px solid red; */
  189. }
  190. .crcBox {
  191. width: 33%;
  192. height: auto;
  193. text-align: center;
  194. /* border: 1px solid red; */
  195. }
  196. .iedBox {
  197. width: 33%;
  198. height: auto;
  199. text-align: center;
  200. /* border: 1px solid red; */
  201. position: relative;
  202. }
  203. #newIed {
  204. position: absolute;
  205. top: 100px;
  206. right: -10px;
  207. }
  208. #oldScd {
  209. margin-bottom: 40px;
  210. }
  211. #oldCrc {
  212. margin-bottom: 40px;
  213. }
  214. #addId {
  215. display: flex;
  216. justify-content: center;
  217. align-items: center;
  218. width: 112px;
  219. height: 40px;
  220. border: 1px dashed #1D48E8;
  221. background-color: rgb(239, 243, 255);
  222. border-radius: 5px;
  223. margin-bottom: 20px;
  224. cursor: pointer;
  225. }
  226. #editId {
  227. display: flex;
  228. justify-content: center;
  229. align-items: center;
  230. width: 112px;
  231. height: 40px;
  232. border: 1px dashed #FECC2A;
  233. background-color: rgb(255, 251, 242);
  234. border-radius: 5px;
  235. margin-bottom: 20px;
  236. cursor: pointer;
  237. }
  238. #delId {
  239. display: flex;
  240. justify-content: center;
  241. align-items: center;
  242. width: 112px;
  243. height: 40px;
  244. border: 1px dashed red;
  245. background-color: rgb(255, 236, 236);
  246. border-radius: 5px;
  247. margin-bottom: 20px;
  248. cursor: pointer;
  249. }
  250. </style>