dialogIndex.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. <!-- 整个装置大的弹窗 -->
  2. <template>
  3. <el-dialog @close="cancelClick" v-model="isOpen" width="93vw" append-to-body draggable top="5vh" style="height: 92vh">
  4. <template #header>
  5. <div class="my-header" :style="{ minHeight: checkData ? 'auto' : '36px' }">
  6. <div class="title" v-if="checkData">
  7. {{ `${checkData.desc}(${checkData.ied_name}) — 详细信息` }}
  8. </div>
  9. </div>
  10. </template>
  11. <div class="main">
  12. <div class="main-left">
  13. <el-input v-model="searchInput" class="w-50 m-2" size="large" placeholder="快捷搜索" :suffix-icon="Search"
  14. @change="searchClick" style="width: 90%; margin-left: 5%; margin-top: 10px" />
  15. <el-scrollbar height="72vh">
  16. <p v-for="(item, index) in iedRelation" :key="index" class="scrollbar-demo-item" @click="clickLeft(item, index)"
  17. :class="{ 'left-item-active': activeLeft == index }">
  18. <span class="ied-name">{{ item.ied_name }}</span><span class="desc" v-if="!isScdView">{{ item.desc }}</span>
  19. <span class="desc" v-else>{{ item.ied_desc }}</span>
  20. </p>
  21. </el-scrollbar>
  22. </div>
  23. <!-- 右侧版块 -->
  24. <div class="main-right" v-loading="loading">
  25. <div class="nav">
  26. <div v-for="(item, index) in navtopData" :key="index" :class="{ 'nav-item-active': activeNav == index }"
  27. @click="clickNav(index, item.code)" class="nav-item">
  28. {{ item.name }}
  29. </div>
  30. </div>
  31. <div v-if="inoutName.__name == 'inoutControl'" class="nav">
  32. <div v-for="(item, index) in inoutNav" :key="index" @click="clickInoutNav(item, index)" class="inout">
  33. <span class="inout-item" :class="{ 'inout-item-active': inoutItemNavIndex == index }">{{ item.name }}</span>
  34. </div>
  35. </div>
  36. <div class="main-right-item" :class="{
  37. 'inout-right-item': inoutName.__name == 'inoutControl',
  38. soures: inoutName.__name == 'virtualRelation',
  39. relatio: inoutName.__name == 'relationShip',
  40. }">
  41. <!-- isPhoto是输入输出控制块的, -->
  42. <component :is="activeNavName" :checkData="checkData" :isOpen="isOpen" :iedRelation="iedRelation"
  43. @result="result" :isPhoto="isPhoto" :delScdId="delScdId"></component>
  44. </div>
  45. </div>
  46. </div>
  47. </el-dialog>
  48. </template>
  49. <script setup>
  50. import {
  51. onMounted,
  52. watch,
  53. ref,
  54. computed,
  55. nextTick,
  56. shallowRef,
  57. defineEmits,
  58. provide,
  59. } from "vue";
  60. import devicePng from "@/assets/image/instruct/device.png";
  61. import { Search } from "@element-plus/icons-vue";
  62. import relationShip from "./relationShip.vue";
  63. import inoutControl from "./inoutControl.vue";
  64. import virtualRelation from "./virtualRelation.vue";
  65. import basicInfo from "./basicInfo.vue";
  66. import fixedEntry from "./fixedEntry.vue";
  67. import infoTable from "./infoTable.vue";
  68. import soureFile from "./soureFile.vue";
  69. import { scdIedRelation } from "@/api/iedNetwork";
  70. import { useRoute } from "vue-router";
  71. const props = defineProps({
  72. openBig: {
  73. type: Boolean,
  74. default: false,
  75. },
  76. iedRelationData: {
  77. type: Object,
  78. default: () => { },
  79. },
  80. checkDialogData: {
  81. type: Object,
  82. default: () => { },
  83. },
  84. scdView: {
  85. type: Boolean,
  86. default: false,
  87. },
  88. delScdId: {
  89. type: String,
  90. default: '',
  91. }
  92. });
  93. const isOpen = ref(props.openBig);
  94. const route = useRoute();
  95. const inoutNav = ref([
  96. { name: "关联图", code: "photo" },
  97. { name: "SV发送", code: "SVsend" },
  98. { name: "SV接收", code: "SVreceive" },
  99. { name: "GOOSE发送", code: "GOOSEsend" },
  100. { name: "GOOSE接收", code: "GOOSEreceive" },
  101. ]);
  102. const isScdView = ref(false);
  103. let loading = ref(false)
  104. watch(
  105. () => props.scdView,
  106. (newValue) => {
  107. isScdView.value = newValue;
  108. }
  109. );
  110. const delScdIds = ref('');
  111. watch(() => props.delScdId, (newValue) => {
  112. if (newValue) {
  113. delScdIds.value = newValue
  114. }
  115. })
  116. watch(
  117. () => props.openBig,
  118. (newValue) => {
  119. isOpen.value = newValue;
  120. }
  121. );
  122. const iedRelation = ref(null);
  123. watch(
  124. () => props.iedRelationData,
  125. (newValue) => {
  126. iedRelation.value = newValue;
  127. }
  128. );
  129. const checkData = ref(null); //选中的数据
  130. watch(
  131. () => props.checkDialogData,
  132. (newValue) => {
  133. console.log("checkDialogData", newValue);
  134. checkData.value = newValue;
  135. }
  136. );
  137. const result = (newData) => {
  138. checkData.value = newData;
  139. };
  140. const searchInput = ref("");
  141. //搜索ied编码或名称
  142. const searchIedList = ref([]);
  143. const searchClick = (value) => {
  144. if (value && iedRelation.value) {
  145. iedRelation.value = Object.values(iedRelation.value).filter((item) => {
  146. const lowercaseValue = value.toLowerCase(); //不区分大小写
  147. const iedNameLower = item.ied_name ? item.ied_name.toLowerCase() : null;
  148. const descLower = item.desc ? item.desc.toLowerCase() : null;
  149. return (
  150. (iedNameLower !== null && iedNameLower.includes(value)) ||
  151. (descLower !== null && descLower.includes(value))
  152. );
  153. });
  154. } else if (!value) {
  155. iedRelation.value = props.iedRelationData;
  156. }
  157. };
  158. //头部
  159. const navtopData = shallowRef([
  160. { name: "装置关联关系", code: relationShip },
  161. { name: "输入输出控制块", code: inoutControl },
  162. { name: "虚端子关系", code: virtualRelation },
  163. { name: "基础信息", code: basicInfo },
  164. { name: "定值条目", code: fixedEntry },
  165. { name: "信息点表", code: infoTable },
  166. { name: "源文件", code: soureFile },
  167. ]);
  168. const emit = defineEmits(["done"]);
  169. const cancelClick = () => {
  170. isOpen.value = false;
  171. activeLeft.value = null;
  172. checkData.value = null;
  173. isScdView.value = false;
  174. emit("done", false);
  175. };
  176. const activeNav = ref(0);
  177. const activeNavName = shallowRef(relationShip);
  178. const inoutName = ref("");
  179. const clickNav = (navIndex, name) => {
  180. //点击导航栏事件
  181. inoutName.value = name;
  182. activeNavName.value = name;
  183. activeNav.value = navIndex;
  184. };
  185. const activeLeft = ref(null);
  186. const clickLeft = async (item, navIndex) => {
  187. //点击侧边栏事件
  188. checkData.value = null;
  189. activeLeft.value = navIndex;
  190. loading.value = true
  191. if (!isScdView.value) {
  192. checkData.value = item;
  193. loading.value = false
  194. } else {
  195. let id = '';
  196. if (delScdIds.value) {
  197. id = delScdIds.value
  198. } else {
  199. id = route.query.id
  200. }
  201. const iedRes = await scdIedRelation({
  202. scd_id: id,
  203. ied_name: item.ied_name,
  204. reset: 1,
  205. });
  206. loading.value = false
  207. checkData.value = iedRes.data[item.ied_name];
  208. }
  209. };
  210. onMounted(() => {
  211. // const height = ref(0);
  212. // height.value = document.documentElement.clientHeight - 400 + "px;";
  213. });
  214. //点击头部
  215. const inoutItemNavIndex = ref("");
  216. const isPhoto = ref("photo");
  217. const clickInoutNav = (item, index) => {
  218. isPhoto.value = item.code;
  219. inoutItemNavIndex.value = index;
  220. };
  221. </script>
  222. <style scoped lang="scss">
  223. @mixin mid-center {
  224. display: flex;
  225. align-items: center;
  226. justify-content: center;
  227. }
  228. $height: 40px;
  229. :deep(.el-dialog__header) {
  230. border-bottom: 1px solid #a3ade0;
  231. }
  232. .my-header {
  233. border-bottom: 1px solid #a3ade0;
  234. font-size: 16px;
  235. color: #1a2447;
  236. .title {
  237. padding-bottom: 15px;
  238. }
  239. }
  240. .main {
  241. display: flex;
  242. }
  243. :deep(.el-scrollbar) {
  244. --el-scrollbar-bg-color: #7484ab;
  245. }
  246. .main-left {
  247. width: 23%;
  248. background-color: #f7f8fb;
  249. .scrollbar-demo-item {
  250. cursor: pointer;
  251. width: 90%;
  252. margin-left: 5%;
  253. display: flex;
  254. padding: 4px 0;
  255. .ied-name {
  256. width: 25%;
  257. }
  258. }
  259. }
  260. .main-right {
  261. width: 75%;
  262. display: flex;
  263. flex-direction: column;
  264. }
  265. .main-right-item {
  266. margin-top: 20px;
  267. height: 72vh;
  268. overflow-y: auto;
  269. }
  270. //设置导航栏样式
  271. .nav {
  272. height: 40px;
  273. @include mid-center;
  274. .nav-item {
  275. width: 144px;
  276. height: $height;
  277. @include mid-center;
  278. margin-right: 8px;
  279. cursor: pointer;
  280. background: #fff url("~@/assets/image/instruct/navtop.png") no-repeat center;
  281. background-size: 144px $height;
  282. }
  283. .nav-item-active {
  284. background: #fff url("~@/assets/image/instruct/navtop_active.png") no-repeat center;
  285. color: #fff;
  286. background-size: 144px $height;
  287. }
  288. }
  289. .left-item-active {
  290. color: #255ce7;
  291. }
  292. .inout {
  293. padding: 0 16px;
  294. border-right: 1px solid #7484ab;
  295. margin-top: 24px;
  296. }
  297. .inout-item {
  298. display: inline-block;
  299. width: 92px;
  300. height: 26px;
  301. cursor: pointer;
  302. text-align: center;
  303. color: #000;
  304. line-height: 26px;
  305. }
  306. .inout-item-active {
  307. background: #f6f9ff;
  308. border-radius: 2px 2px 2px 2px;
  309. opacity: 1;
  310. text-align: center;
  311. line-height: 26px;
  312. color: #255ce7;
  313. border: 1px solid #255ce7;
  314. }
  315. .inout-right-item,
  316. .soures,
  317. .relatio {
  318. margin-top: 27px;
  319. margin-left: 16px;
  320. height: 65vh;
  321. }
  322. .soures {
  323. height: 72vh;
  324. }
  325. .relatio {
  326. height: 65vh;
  327. }
  328. </style>