CidTree.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. <template>
  2. <div>
  3. <div class="bigBox" :class="{'bigBoxUp':isUPdate=='update'}">
  4. <div>
  5. <div class="titles">
  6. <img
  7. style="width: 20px; height: 20px"
  8. src="../../../assets/icon/HardDrives.png"
  9. alt=""
  10. />
  11. <div>装置列表</div>
  12. </div>
  13. </div>
  14. <div class="tagBox">
  15. <div
  16. class="cont-line tagP"
  17. :class="{ 'clicktag': tagChoose == index }"
  18. v-for="(item, index) in tagList"
  19. :key="index"
  20. @click="tagClick(item, index)"
  21. >
  22. <span v-if="!OpensclTrue">{{
  23. `(${item.ied_name})${item.desc}`
  24. }}</span>
  25. <span v-else>{{ `(${item.ied_name})${item.ied_desc}` }}</span>
  26. </div>
  27. </div>
  28. <div class="setting">
  29. <el-tree
  30. :data="treeData"
  31. :props="defaultProps"
  32. highlight-current
  33. @node-click="handleNodeClick"
  34. >
  35. <template #default="{ node }">
  36. <span class="label" :class="{ 'tree-label': node.expanded }">{{
  37. node.label
  38. }}</span>
  39. </template>
  40. </el-tree>
  41. </div>
  42. </div>
  43. </div>
  44. </template>
  45. <script setup>
  46. import { ref, onMounted, toRefs, watch } from "vue";
  47. import cid from "@/api/cid/cid";
  48. import scdCheck from "@/api/scdCheck/scdCheck";
  49. import { compIedstatType } from "@/api/scdCheck/scdCheck2";
  50. import { useRoute } from "vue-router";
  51. const route = useRoute();
  52. const props = defineProps({
  53. OpensclTrue: {
  54. type: Boolean,
  55. default: false,
  56. },
  57. iedRelation: {
  58. type: Object,
  59. default: () => {},
  60. },
  61. UPdate: {
  62. //判断是否是点击更改 进入的界面
  63. type: String,
  64. default: "",
  65. },
  66. clickRowDatas: {
  67. type: Object,
  68. default: () => {},
  69. },
  70. });
  71. const emit = defineEmits(["treeBack", "clickCode","treeBackDefalut"]);
  72. let tagList = ref(props.iedRelation);
  73. let tagChoose = ref('');
  74. let treeData = ref([
  75. {
  76. label: "装置信息",
  77. itemcode: "ied",
  78. num:0,
  79. children: [
  80. {
  81. label: "基本信息",
  82. itemcode: "scd.ied",
  83. num:0
  84. },
  85. ],
  86. },
  87. {
  88. label: "通信参数",
  89. itemcode: "Communication",
  90. num:0,
  91. children: [
  92. {
  93. label: "通信接入点",
  94. itemcode: "scd.ied.Communication",
  95. num:0,
  96. },
  97. {
  98. label: "站控层通信参数",
  99. itemcode: "scd.ied.Communication.S1",
  100. num:0,
  101. },
  102. {
  103. label: "GOOSE 通信参数",
  104. itemcode: "scd.ied.Communication.GSE",
  105. num:0,
  106. },
  107. {
  108. label: "SV 通信参数",
  109. itemcode: 'scd.ied.Communication.SMV',
  110. num:0,
  111. },
  112. ],
  113. },
  114. {
  115. label: "测点信息",
  116. itemcode: "Point",
  117. children: [
  118. {
  119. label: "遥信",
  120. itemcode: "scd.ied.YX",
  121. num:0,
  122. },
  123. {
  124. label: "遥控",
  125. itemcode: "scd.ied.YK",
  126. num:0,
  127. },
  128. {
  129. label: "遥测",
  130. itemcode: "scd.ied.YC",
  131. num:0,
  132. },
  133. {
  134. label: "遥脉",
  135. num: 0,
  136. itemcode: "scd.ied.YM",
  137. },
  138. {
  139. label: "定值",
  140. itemcode: "scd.ied.DZ",
  141. num:0,
  142. },
  143. ],
  144. },
  145. {
  146. label: "回路配置",
  147. itemcode: "config",
  148. num:0,
  149. children: [
  150. {
  151. label: "发布虚端子",
  152. itemcode: "scd.ied.FCDA",
  153. num:0,
  154. },
  155. {
  156. label: "定阅虚端子",
  157. itemcode: "scd.ied.ExtRef",
  158. num:0,
  159. },
  160. {
  161. label: "虚回路信息",
  162. itemcode: "scd.ied.Relation",
  163. num:0,
  164. },
  165. ],
  166. },
  167. {
  168. label: "建模信息",
  169. itemcode: "model",
  170. num:0,
  171. children: [
  172. {
  173. label: "数据集",
  174. itemcode: "scd.ied.DatSet",
  175. num:0,
  176. },
  177. {
  178. label: "数据集成员",
  179. itemcode: "scd.ied.DatSetMeber",
  180. num:0,
  181. },
  182. {
  183. label: "GOOSE控制块",
  184. itemcode: "scd.ied.GSEControl",
  185. num:0,
  186. },
  187. {
  188. label: "SV控制块",
  189. itemcode: "scd.ied.SampledValueControl",
  190. num:0,
  191. },
  192. {
  193. label: "报告控制块",
  194. itemcode: "scd.ied.ReportControl",
  195. num:0,
  196. },
  197. {
  198. label: "日志控制块",
  199. itemcode: "scd.ied.LogControl",
  200. num:0,
  201. },
  202. ],
  203. },
  204. ]);
  205. let needName = ref("");
  206. //得到差异项code的数字数据
  207. const codeStaticList = ref(null);
  208. const codeStatic = async () => {
  209. const ids = clickRow.value ? clickRow.value.id : "";
  210. const names = clickTage.value ? clickTage.value.ied_name :"";
  211. const res = await compIedstatType({
  212. comp_id: ids,
  213. ied_name: names,
  214. comptype: "u",
  215. });
  216. codeStaticList.value = res.data;
  217. updateNum(treeData.value, codeStaticList.value);
  218. console.log('treeData.value', treeData.value)
  219. };
  220. const updateNum = (treeNode, data) => {
  221. for (let node of treeNode) {
  222. // 检查当前节点的 itemcode 是否在 data 中
  223. if (data.hasOwnProperty(node.itemcode)) {
  224. node.num = parseInt(data[node.itemcode], 10);
  225. }
  226. // 如果当前节点有子节点,递归处理子节点
  227. if (node.children) {
  228. updateNum(node.children, data);
  229. }
  230. }
  231. }
  232. let defaultProps = ref({
  233. label: "label",
  234. children: "children",
  235. });
  236. const isUPdate = ref(props.UPdate);
  237. watch(
  238. () => props.UPdate,
  239. (newValue) => {
  240. isUPdate.value = newValue;
  241. }
  242. );
  243. watch(
  244. () => props.iedRelation,
  245. (newValue) => {
  246. if (newValue) {
  247. tagList.value = newValue;
  248. console.log('firsttagList.value', tagList.value)
  249. }
  250. }
  251. );
  252. const reload = () => {
  253. if (!props.OpensclTrue) {
  254. cid.getAll({ scd_id: route.query.id, ied_name: "" }).then((res) => {
  255. tagList.value = res.data;
  256. });
  257. }
  258. };
  259. const clickTage =ref(null);
  260. const tagClick = (row, num) => {
  261. tagChoose.value = num;
  262. clickTage.value = row;
  263. cid
  264. .findFile({
  265. scd_id: route.query.id,
  266. ied_name: row.desc,
  267. pageno: 1,
  268. pagesize: 10,
  269. station_id: route.query.stationId,
  270. })
  271. .then((res) => {});
  272. scdCheck
  273. .lookCheck({
  274. pageindex: 1,
  275. pagesize: 10,
  276. station_id: route.query.stationId,
  277. scd_id: route.query.id,
  278. is_checkin: 2,
  279. ied_name: row.ied_name,
  280. })
  281. .then((res) => {
  282. let fileInfo;
  283. if (res.data) {
  284. fileInfo = res.data.filter((item) => item.scd_id == route.query.id);
  285. console.log("res", fileInfo);
  286. if (fileInfo.length > 0) {
  287. emit("treeBack", row, fileInfo[0]);
  288. }
  289. }
  290. // let a = res.data.filter((item) => item.type_name == "CID");
  291. // if (a.length > 0) {
  292. // needName.value = a[0].file_name;
  293. // emit("treeBack", needName.value, a[0].id);
  294. // }
  295. });
  296. codeStatic()
  297. };
  298. const clickRow = ref(props.clickRowDatas);
  299. //对比文件:头部对比的单个数据
  300. watch(
  301. () => props.clickRowDatas,
  302. (newValue) => {
  303. if (newValue) {
  304. clickRow.value = newValue;
  305. }
  306. }
  307. );
  308. const handleNodeClick = (e) => {
  309. emit("clickCode", e.itemcode);
  310. };
  311. onMounted(() => {
  312. tagChoose.value = props.iedRelation?Object.keys(props.iedRelation)[0]:'';
  313. clickTage.value = props.iedRelation?Object.values(props.iedRelation)[0]:'';
  314. emit("treeBackDefalut",clickTage.value);
  315. reload();
  316. codeStatic()
  317. });
  318. </script>
  319. <style scoped lang="scss">
  320. p,
  321. h3 {
  322. margin: 0;
  323. padding: 0;
  324. }
  325. .bigBox {
  326. width: 100%;
  327. height: calc(100vh - 280px);
  328. margin-top: 20px;
  329. border: 1px solid #a3ade0;
  330. border-radius: 2px;
  331. cursor: pointer;
  332. background: #f7f8fb;
  333. & > div:first-child {
  334. display: flex;
  335. justify-content: flex-start;
  336. align-items: center;
  337. color: #1a2447;
  338. margin: 16px 0 0 16px;
  339. }
  340. }
  341. .bigBoxUp{
  342. height: calc(100vh - 230px) !important;
  343. }
  344. :deep(.el-tree) {
  345. --el-fill-color-blank: #f7f8fb;
  346. }
  347. .tagBox {
  348. width: 92%;
  349. height: 45%;
  350. overflow-y: auto;
  351. margin: 8px 16px 0px 16px;
  352. }
  353. .tagP {
  354. overflow: hidden;
  355. text-overflow: ellipsis;
  356. white-space: nowrap;
  357. margin-top: 8px;
  358. font-size: 16px;
  359. }
  360. .setting {
  361. width: 92%;
  362. height: 45%;
  363. overflow-y: auto;
  364. border-top: 1px solid #a3ade0;
  365. margin: 2px auto;
  366. .label {
  367. padding: 5px 8px;
  368. }
  369. :deep(.el-tree--highlight-current .el-tree-node) {
  370. margin: 5px 0;
  371. color: #1a2447;
  372. }
  373. :deep(
  374. .el-tree--highlight-current
  375. .el-tree-node.is-current
  376. > .el-tree-node__content
  377. ) {
  378. background: transparent;
  379. }
  380. :deep(
  381. .el-tree--highlight-current
  382. .el-tree-node.is-current
  383. > .el-tree-node__content
  384. .label
  385. ) {
  386. color: #134bea;
  387. border: 1px solid #255ce7;
  388. background: #f6f9ff;
  389. }
  390. }
  391. .titles {
  392. display: flex;
  393. align-items: center;
  394. & > div {
  395. font-size: 16px;
  396. margin-left: 8px;
  397. vertical-align: middle;
  398. font-weight: bold;
  399. }
  400. }
  401. .cont-line,
  402. :deep(.el-tree-node__label) {
  403. color: #1a2447;
  404. font-size: 14px;
  405. }
  406. .clicktag {
  407. color: #255ce7;
  408. }
  409. .tree-label {
  410. color: #134bea;
  411. }
  412. </style>