dialogIndex.vue 8.4 KB

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