zhiyin.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <div class="body1" id="body1" :key="pageKey">
  3. <div class="left">
  4. <div style="margin-bottom: 20px">
  5. <el-button type="info" @click="reset"> 重置页面 </el-button>
  6. </div>
  7. <el-table
  8. :data="tableData1"
  9. style="margin-bottom: 20px"
  10. class="tableView1"
  11. border
  12. >
  13. <el-table-column prop="a" label="序号" align="center" />
  14. <el-table-column prop="b" label="起始端" align="center" />
  15. <el-table-column prop="c" label="连接端" align="center" />
  16. <el-table-column prop="d" label="标识" align="center" />
  17. <el-table-column prop="e" label="定义" align="center" />
  18. <el-table-column prop="f" label="线号" align="center" />
  19. <el-table-column prop="g" label="线色" align="center" />
  20. <el-table-column
  21. label="连接状态"
  22. width="120"
  23. fixed="right"
  24. align="center"
  25. >
  26. <template #default="scope">
  27. <el-button
  28. type="success"
  29. @click="scope.row.status = true"
  30. :disabled="scope.row.status"
  31. >
  32. 完成
  33. </el-button>
  34. </template>
  35. </el-table-column>
  36. </el-table>
  37. <el-table
  38. :data="tableData2"
  39. style="width: 100%"
  40. v-if="status1"
  41. border
  42. class="tableView1"
  43. >
  44. <el-table-column prop="a" label="序号" align="center" />
  45. <el-table-column prop="b" label="起始端" align="center" />
  46. <el-table-column prop="c" label="连接端" align="center" />
  47. <el-table-column prop="d" label="标识" align="center" />
  48. <el-table-column prop="e" label="定义" align="center" />
  49. <el-table-column prop="f" label="线号" align="center" />
  50. <el-table-column prop="g" label="线色" align="center" />
  51. <el-table-column
  52. label="连接状态"
  53. width="120"
  54. fixed="right"
  55. align="center"
  56. >
  57. <template #default="scope">
  58. <el-button
  59. type="success"
  60. @click="scope.row.status = true"
  61. :disabled="scope.row.status"
  62. >
  63. 完成
  64. </el-button>
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. </div>
  69. <div class="right">
  70. <el-image
  71. :src="url"
  72. :zoom-rate="1.2"
  73. :max-scale="7"
  74. :min-scale="0.2"
  75. :preview-src-list="srcList"
  76. :initial-index="initialIndex"
  77. fit="contain"
  78. />
  79. </div>
  80. </div>
  81. </template>
  82. <script setup>
  83. const pageKey = ref(false);
  84. const reset = () => {
  85. tableData1.value[0].status = false;
  86. tableData1.value[1].status = false;
  87. tableData2.value[0].status = false;
  88. tableData2.value[1].status = false;
  89. tableData2.value[2].status = false;
  90. status1.value = false;
  91. status2.value = false;
  92. setTimeout(() => {
  93. url.value = "/images/bz1.png";
  94. initialIndex.value = 0;
  95. }, 0);
  96. };
  97. const status1 = ref(false);
  98. const status2 = ref(false);
  99. const initialIndex = ref(0);
  100. const tableData1 = ref([
  101. {
  102. a: "1",
  103. b: "X2-5",
  104. c: "X7-1",
  105. d: "-",
  106. e: "-",
  107. f: "L05",
  108. g: "蓝",
  109. status: false,
  110. },
  111. {
  112. a: "2",
  113. b: "X2-15",
  114. c: "X7-2",
  115. d: "-",
  116. e: "-",
  117. f: "L15",
  118. g: "蓝",
  119. status: false,
  120. },
  121. ]);
  122. const tableData2 = ref([
  123. {
  124. a: "3",
  125. b: "X2-1",
  126. c: "X4-6",
  127. d: "-",
  128. e: "-",
  129. f: "L01",
  130. g: "黑",
  131. status: false,
  132. },
  133. {
  134. a: "4",
  135. b: "X2-9",
  136. c: "X4-7",
  137. d: "-",
  138. e: "-",
  139. f: "L09",
  140. g: "黑",
  141. status: false,
  142. },
  143. {
  144. a: "5",
  145. b: "X2-10",
  146. c: "X4-8",
  147. d: "-",
  148. e: "-",
  149. f: "L10",
  150. g: "黑",
  151. status: false,
  152. },
  153. ]);
  154. const url = ref("/images/bz1.png");
  155. const srcList = ref([
  156. "/images/bz1.png",
  157. "/images/bz2.png",
  158. "/images/bz3.png",
  159. "/images/bz4.png",
  160. ]);
  161. watch(
  162. tableData1.value,
  163. () => {
  164. if (
  165. tableData1.value[0].status == true &&
  166. tableData1.value[1].status == true
  167. ) {
  168. status1.value = true;
  169. }
  170. if (status1.value == false) {
  171. url.value = "/images/bz1.png";
  172. initialIndex.value = 0;
  173. } else {
  174. url.value = "/images/bz3.png";
  175. initialIndex.value = 2;
  176. }
  177. },
  178. { deep: true }
  179. );
  180. watch(
  181. tableData2.value,
  182. () => {
  183. if (
  184. tableData2.value[0].status == true &&
  185. tableData2.value[1].status == true &&
  186. tableData2.value[2].status == true
  187. ) {
  188. status2.value = true;
  189. }
  190. if (status2.value == false) {
  191. url.value = "/images/bz3.png";
  192. initialIndex.value = 2;
  193. } else {
  194. url.value = "/images/bz4.png";
  195. initialIndex.value = 3;
  196. }
  197. },
  198. { deep: true }
  199. );
  200. </script>
  201. <style lang="scss" scoped>
  202. .body1 {
  203. width: calc(100vw - 340px);
  204. height: calc(100vh - 261px);
  205. display: flex;
  206. .left {
  207. padding-right: 20px;
  208. flex-shrink: 0;
  209. width: 50%;
  210. .tableView1 {
  211. border-radius: 16px;
  212. }
  213. }
  214. .right {
  215. width: 50%;
  216. flex-shrink: 0;
  217. }
  218. }
  219. </style>