index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. <template>
  2. <div>
  3. <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
  4. <div class="nav">
  5. <div
  6. v-for="(item, index) in navtopData"
  7. :key="index"
  8. :class="{ 'nav-item-active': activeNav == index }"
  9. @click="clickNav(item, index)"
  10. class="nav-item"
  11. style="font-size: 12px"
  12. >
  13. {{ item.name }}
  14. </div>
  15. </div>
  16. <div class="mostHead mostHead-cid" v-if="activeNav == 0">
  17. <div>
  18. <span class="scd-title"> CID文件一次性检测 </span>
  19. <span class="export-bottom" @click="portExcel">结果导出Excel</span>
  20. </div>
  21. <span class="closeX" @click="closeX">×</span>
  22. </div>
  23. <el-tab-pane label="网络结构图" name="first">
  24. <net-work v-if="activeName == 'first' && activeNav == null"></net-work>
  25. </el-tab-pane>
  26. <el-tab-pane label="SCD可视化" name="second">
  27. <scd-visual v-if="!clickNavCode"></scd-visual>
  28. </el-tab-pane>
  29. </el-tabs>
  30. <div>
  31. <!-- CID一致性校核========= -->
  32. <div
  33. class="disappear"
  34. v-if="activeNav == 0"
  35. v-loading="isCidLoading"
  36. element-loading-text="数据加载中,请耐心等待..."
  37. >
  38. <!-- 左侧树形数据 -->
  39. <div style="width: 15%">
  40. <CidTree
  41. @treeBack="treeBack"
  42. @clickCode="clickCode"
  43. :allCidStart="allCidStart"
  44. :upName="upName"
  45. ></CidTree>
  46. </div>
  47. <!-- 右侧展示图 -->
  48. <div
  49. style="
  50. width: 85%;
  51. height: calc(100vh - 280px);
  52. margin: 20px 0 0 16px;
  53. background: #f7f8fb;
  54. "
  55. >
  56. <div class="abBox">
  57. <div>
  58. <span style="border-right: 1px solid #516380; padding-right: 30px"
  59. >基准文件:
  60. <span style="color: #09162c">{{ newChicken }}</span></span
  61. >
  62. </div>
  63. <div style="padding-left: 30px">
  64. <span
  65. >对比文件:<span style="color: #09162c">{{ upName }}</span></span
  66. >
  67. </div>
  68. <div class="uploadBox">
  69. <el-upload
  70. ref="upload"
  71. class="upload-demo"
  72. :http-request="nowUpload"
  73. :limit="2"
  74. element-loading-text="上传中..."
  75. element-loading-background="rgba(255, 255, 255, 0.8)"
  76. :on-remove="handleRemove"
  77. :on-change="fileSuccess"
  78. :show-file-list="false"
  79. >
  80. <template #trigger>
  81. <el-button
  82. style="border-bottom: 1px solid #255ce7; color: #255ce7"
  83. type="text"
  84. plain
  85. >上传CID</el-button
  86. >
  87. </template>
  88. </el-upload>
  89. </div>
  90. </div>
  91. <div v-if="!upName" class="tips-cid">请上传CID文件进行对比</div>
  92. <Gsix
  93. v-if="upName && clickCodeValue != 'scd.ied.Relation' && !isContrast"
  94. @clickCode="clickCode"
  95. :clickList="backName"
  96. :clickCodeInfoCid="clickCodeInfoCid"
  97. :isCid="isCid"
  98. :clickCodeValue="clickCodeValue"
  99. :uploadAnniu="uploadAnniu"
  100. ></Gsix>
  101. <!-- 对比失败 -->
  102. <div v-else-if="isContrast" class="fail-contrast">
  103. {{ isContrastDes }}
  104. </div>
  105. </div>
  106. </div>
  107. <!-- SCD一致性校核========= -->
  108. <div class="scdCheck" v-if="activeNav == 1">
  109. <div class="mostHead mostHead-scd" v-if="activeNav == 1">
  110. <div class="scd-title">SCD文件一次性检测</div>
  111. <span class="closeX" @click="closeX">×</span>
  112. </div>
  113. <!-- 右侧内容 -->
  114. <div
  115. style="
  116. width: 97%;
  117. display: flex;
  118. justify-content: space-between;
  119. align-items: center;
  120. margin-top: 5px;
  121. "
  122. >
  123. <div class="treeBtn">
  124. <scdTree
  125. :nowStation="nowStation"
  126. @scdTreeBack="scdTreeBack"
  127. @scdView="scdView"
  128. @scdJpadList="scdJpadList"
  129. ></scdTree>
  130. </div>
  131. <div class="scdMap">
  132. <scdMap
  133. :antherBack="antherBack"
  134. :scdipadMini="scdipadMini"
  135. :activeNav="activeNav"
  136. :clickView="clickView"
  137. ></scdMap>
  138. </div>
  139. </div>
  140. </div>
  141. <CrcCheck
  142. v-if="activeNav == 3"
  143. :nowScdId="nowScdId"
  144. @sclBack="sclBack"
  145. ></CrcCheck>
  146. <SlcCheck
  147. v-if="activeNav == 2"
  148. :nowScdId="nowScdId"
  149. @sclBack="sclBack"
  150. ></SlcCheck>
  151. <!-- 虚端子关系图 -->
  152. <div v-if="clickNavCode == 'virtual'">
  153. <virtual-table @sclBack="sclBack"></virtual-table>
  154. </div>
  155. </div>
  156. </div>
  157. </template>
  158. <script setup>
  159. import { ref, watch, onMounted } from "vue";
  160. import netWork from "./components/netWork";
  161. import scdVisual from "./components/scdVisual";
  162. import CidTree from "./components/CidTree.vue";
  163. import Gsix from "./components/Gsix.vue";
  164. import scdTree from "./components/scdTree.vue";
  165. import scdMap from "./components/scdMap.vue";
  166. import VirtualTable from "./components/VirtualTable.vue";
  167. import CrcCheck from "./newTitle/CrcCheck";
  168. import SlcCheck from "./newTitle/SlcCheck.vue";
  169. import { useRoute } from "vue-router";
  170. import cid from "@/api/cid/cid";
  171. import { ElMessage, ElMessageBox, ElNotification } from "element-plus";
  172. import systemRow from "@/api/systemRow";
  173. import scdCheck from "@/api/scdCheck/scdCheck";
  174. let route = useRoute();
  175. const isCid = ref(true); //判断是否是CID界面
  176. const isCidLoading = ref(false); //判断是否正在解析CID文件
  177. const isContrast = ref(false); //判断是否对比成功
  178. const isContrastDes = ref(false); //对比错误的描述
  179. const activeName = ref("first"); //默认展示网络结构图
  180. const navtopData = ref([
  181. { name: "CID一致性校核", code: "CID" },
  182. { name: "SCD文件一致性校核", code: "SCD" },
  183. { name: "SCL文件校核", code: "SCL" },
  184. { name: "CRC校核", code: "CRC" },
  185. { name: "虚端子关系表", code: "virtual" },
  186. ]);
  187. const activeNav = ref(null);
  188. const upload = ref(null); //上传按钮的ref
  189. const backName = ref({}); //树组件返回名称
  190. let mustVal = ref(false);
  191. let upName = ref(""); //上传的文件名称
  192. let arrName = ref(""); //基准的文件名称
  193. let upFile = ref({}); //上传文件流
  194. let backId = ref(""); //返回id
  195. let nowScdId = ref(null); //路由传参的scdid
  196. let antherBack = ref([]);
  197. let nowStation = ref(""); //变电站id
  198. watch(
  199. () => antherBack.value,
  200. (newVal) => {
  201. antherBack.value = newVal;
  202. },
  203. {
  204. deep: true,
  205. }
  206. );
  207. const reload = () => {
  208. nowScdId.value = route.query.id;
  209. nowStation.value = route.query.stationId;
  210. };
  211. //虚端子关系====
  212. const isOpen = ref(false);
  213. //虚端子关系====
  214. const clickNavCode = ref(""); //点击导航栏的头部
  215. const clickNav = (item, navIndex) => {
  216. //点击导航栏事件
  217. clickNavCode.value = item.code;
  218. activeNav.value = navIndex;
  219. switch (item.code) {
  220. case "virtual":
  221. isOpen.value = true;
  222. break;
  223. }
  224. };
  225. const handleClick = (val) => {
  226. activeNav.value = null;
  227. activeName.value = val.props.name;
  228. clickNavCode.value = "";
  229. };
  230. //点击左侧装置列表树返回的信息,
  231. const newChicken = ref(""); //基准文件
  232. const treeBack = (data, val) => {
  233. console.log("data", data);
  234. newChicken.value = `(${data.ied_name})${data.desc}`;
  235. isContrast.value = "";
  236. upName.value = "";
  237. backName.value = data; //返回的点击行的信息
  238. arrName.value = data;
  239. uploadAnniu.value = false;
  240. // backId.value = val.id;
  241. };
  242. const closeX = () => {
  243. activeName.value = "first";
  244. activeNav.value = null;
  245. };
  246. const allCidStart = ref([]);
  247. const uploadAnniu = ref(false); //代表点击了上传按钮,用于清空上次的连线
  248. const nowUpload = (file, e) => {
  249. ElMessageBox.confirm(
  250. "该操作耗时较长,校验开始后将清除原有校验结果且无法中止,确定开始吗?",
  251. "Warning",
  252. {
  253. confirmButtonText: "确定",
  254. cancelButtonText: "取消",
  255. type: "warning",
  256. }
  257. )
  258. .then(async () => {
  259. upload.value.clearFiles(); //清空上次上传的文件
  260. clickCodeInfoCid.value = [];
  261. uploadAnniu.value = true;
  262. upFile.value = file.file;
  263. upName.value = file.file.name;
  264. ElNotification({
  265. title: "信息",
  266. message: "正在进行CID的一致性比对...请稍候",
  267. duration: 0,
  268. });
  269. isCidLoading.value = true;
  270. cid
  271. .fileUpload({
  272. station_id: nowStation.value - 0,
  273. file: upFile.value,
  274. attachment_type: "cid",
  275. ied_name: backName.value.ied_name,
  276. })
  277. .then((res) => {
  278. if (res.code == 0) {
  279. allCidStart.value = [];
  280. let idp = `${backName.value.ied_name},${res.data.fileid}`;
  281. scdCheck
  282. .scdStart({
  283. type: "CID",
  284. station_id: route.query.stationId,
  285. source_scd_id: route.query.id,
  286. station_id: nowStation.value - 0,
  287. ids: idp,
  288. })
  289. .then((res) => {
  290. ElNotification.closeAll();
  291. if (res && res.code == 0) {
  292. ElMessage({
  293. type: "success",
  294. message: "对比成功!",
  295. });
  296. allCidStart.value = res.data.list;
  297. isCidLoading.value = false;
  298. isContrast.value = res.data && res.data.list ? false : true; //对比成功并且有数据
  299. isContrastDes.value =
  300. res.data && res.data.list ? "" : "两个对比的CID没有差异";
  301. } else {
  302. isCidLoading.value = false;
  303. isContrast.value = true; //对比失败
  304. isContrastDes.value = res.msg;
  305. }
  306. });
  307. } else {
  308. ElMessage({
  309. type: "error",
  310. message: res.msg,
  311. });
  312. isCidLoading.value = false;
  313. }
  314. });
  315. })
  316. .catch((err) => {});
  317. };
  318. const handleRemove = (file, e) => {};
  319. const fileSuccess = (files, e) => {
  320. mustVal.value = true;
  321. };
  322. function scdTreeBack(data) {
  323. antherBack.value = data;
  324. }
  325. const clickView = ref(null);
  326. //点击左侧树查看的当前数据行
  327. const scdView = (row) => {
  328. clickView.value = row;
  329. };
  330. //点击差异项的code
  331. const clickCodeValue = ref(null);
  332. const clickCodeInfoCid = ref([]);
  333. const clickCode = (code, e) => {
  334. clickCodeValue.value = code;
  335. if (e) {
  336. clickCodeInfoCid.value = e;
  337. }
  338. allCidStart.value = [];
  339. };
  340. const sclBack = (num) => {
  341. activeName.value = "first";
  342. activeNav.value = null;
  343. };
  344. // 点击左侧树查看返回图的数据
  345. const scdipadMini = ref([]);
  346. const scdJpadList = (data) => {
  347. scdipadMini.value = data;
  348. };
  349. const portExcel = () => {
  350. systemRow
  351. .portExcel({
  352. code: "scd-comp-result",
  353. })
  354. .then((res) => {
  355. if (res.data) {
  356. return;
  357. } else {
  358. ElMessage({
  359. message: res.msg,
  360. type: "info",
  361. });
  362. }
  363. });
  364. };
  365. onMounted(() => {
  366. reload();
  367. // Object.values(props.iedRelation)[0]
  368. });
  369. </script>
  370. <style scoped lang="scss">
  371. $height: 40px;
  372. @mixin mid-center {
  373. display: flex;
  374. align-items: center;
  375. justify-content: center;
  376. }
  377. :deep(.el-tabs__item) {
  378. margin: 16px 0 0 32px;
  379. font-size: 18px;
  380. }
  381. :deep(.el-tabs__item:last-child) {
  382. margin-left: 0;
  383. }
  384. :deep(.el-tabs__nav-wrap::after) {
  385. --el-border-color-light: none;
  386. }
  387. :deep(.el-tabs__item.is-active),
  388. :deep(.el-tabs__active-bar) {
  389. color: #255ce7;
  390. }
  391. :deep(.el-tabs__active-bar) {
  392. background-color: #255ce7;
  393. }
  394. //设置导航栏样式
  395. .nav {
  396. @include mid-center;
  397. .nav-item {
  398. width: 144px;
  399. height: $height;
  400. @include mid-center;
  401. margin-right: 8px;
  402. cursor: pointer;
  403. background: #fff url("~@/assets/image/instruct/navtop.png") no-repeat center;
  404. background-size: 144px $height;
  405. }
  406. .nav-item-active {
  407. background: #fff url("~@/assets/image/instruct/navtop_active.png") no-repeat
  408. center;
  409. background-size: 144px $height;
  410. color: #fff;
  411. }
  412. }
  413. //最外层的滚动条不要
  414. :deep(.el-main) {
  415. // overflow: hidden;
  416. }
  417. //ied的高度
  418. :deep(.network-wrap) {
  419. height: 70vh;
  420. overflow: auto;
  421. }
  422. // 头部导出excel
  423. .mostHead {
  424. align-items: center;
  425. margin-left: 32px;
  426. width: 97%;
  427. height: auto;
  428. border-bottom: 1px solid #a3ade0;
  429. margin-bottom: 16px;
  430. display: flex;
  431. justify-content: space-between;
  432. align-items: center;
  433. }
  434. .mostHead-scd {
  435. margin-left: 0;
  436. }
  437. .closeX {
  438. font-size: 24px;
  439. color: #7484ab;
  440. cursor: pointer;
  441. }
  442. // CID显示
  443. .disappear {
  444. width: 97%;
  445. height: calc(100vh - 260px);
  446. margin: 0 auto;
  447. display: flex;
  448. justify-content: flex-start;
  449. align-items: center;
  450. }
  451. .abBox {
  452. width: 95%;
  453. height: 40px;
  454. position: relative;
  455. margin: 10px auto;
  456. display: flex;
  457. font-size: 14px;
  458. background: #fff;
  459. justify-content: center;
  460. align-items: center;
  461. color: #516380;
  462. }
  463. .uploadBox {
  464. position: absolute;
  465. top: 0px;
  466. right: 32px;
  467. }
  468. .scdCheck {
  469. width: 97.5%;
  470. height: calc(100vh - 205px);
  471. margin: 0 33px;
  472. // border: 1px solid red;
  473. }
  474. .treeBtn {
  475. width: 32%;
  476. // margin-right: 16px;
  477. height: calc(100vh - 205px);
  478. // border: 1px solid rebeccapurple;
  479. }
  480. .scdMap {
  481. width: 67%;
  482. height: calc(100vh - 205px);
  483. // border: 1px solid teal;
  484. background-color: #f6f8fa;
  485. }
  486. //scd一致性校验
  487. .scd-title {
  488. display: inline-block;
  489. margin-right: 16px;
  490. font-size: 16px;
  491. color: #1a2447;
  492. padding-bottom: 12px;
  493. }
  494. .mostHead-cid {
  495. margin-top: 20px;
  496. padding-bottom: 8px;
  497. margin-bottom: 0;
  498. .export-bottom {
  499. cursor: pointer;
  500. display: inline-block;
  501. border: 1px solid #255ce7;
  502. background: #f6f9ff;
  503. color: #255ce7;
  504. border-radius: 0;
  505. padding: 5px 8px;
  506. font-size: 14px;
  507. }
  508. }
  509. .tips-cid {
  510. text-align: center;
  511. font-size: 14px;
  512. margin: 20px 0;
  513. }
  514. .fail-contrast {
  515. text-align: center;
  516. margin-top: 30px;
  517. color: red;
  518. font-size: 16px;
  519. }
  520. </style>