index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <template>
  2. <div class="powerEquip">
  3. <el-tabs
  4. v-model="activeName"
  5. type="card"
  6. @tab-click="handleClick"
  7. style="background-color: #fff; height: 100%"
  8. class="tabsSizeColor"
  9. >
  10. <el-tab-pane label="电力监测设备" name="powerEquip">
  11. <div class="first">
  12. <div class="firstTop">
  13. <div class="firstTopLeft">
  14. <el-button
  15. class="goBack"
  16. @click="goBack"
  17. v-if="deviceNumData.length > 0"
  18. >返回</el-button
  19. >
  20. <span class="firstTopLeftTitle"
  21. >{{
  22. deviceNumData.length > 0 ? "设备或编号" : "厂家或型号"
  23. }}:</span
  24. >
  25. <el-input
  26. placeholder="输入关键字进行过滤"
  27. v-model="filterText"
  28. class="firstTopLeftInput"
  29. >
  30. <template #suffix>
  31. <i class="el-icon-search el-input__icon"></i>
  32. </template>
  33. </el-input>
  34. <!-- <el-button
  35. type="primary"
  36. icon="el-icon-search"
  37. class="search-button"
  38. >搜索</el-button
  39. > -->
  40. <el-button class="search-button" icon="el-icon-plus" type="success" @click="addItem()"
  41. >新增</el-button
  42. >
  43. </div>
  44. <div class="firstRight">
  45. <el-button type="primary">导入</el-button>
  46. <el-button type="primary">导出</el-button>
  47. </div>
  48. </div>
  49. <div class="firstContent" v-if="deviceNumData.length <= 0">
  50. <el-table
  51. :data="
  52. tableData.filter(
  53. (data) =>
  54. !filterText ||
  55. data.manufactor
  56. .toLowerCase()
  57. .includes(filterText.toLowerCase()) ||
  58. data.deviceModel
  59. .toLowerCase()
  60. .includes(filterText.toLowerCase())
  61. )
  62. "
  63. border
  64. stripe
  65. :header-cell-style="headClass"
  66. >
  67. <el-table-column fixed prop="manufactor" label="厂家" width="">
  68. </el-table-column>
  69. <el-table-column prop="deviceModel" label="型号" width="">
  70. </el-table-column>
  71. <el-table-column prop="deviceNum" label="设备数量" width="">
  72. <template #default="scope">
  73. <div
  74. style="margin-right: 15px; cursor: pointer; color: #409eff"
  75. @click="deviceNumSelect({ id: scope.row.manufactor })"
  76. >
  77. {{ scope.row.deviceNum }}
  78. </div>
  79. </template>
  80. </el-table-column>
  81. <el-table-column fixed="right" label="操作" width="250">
  82. <template #default="scope">
  83. <el-button
  84. type="text"
  85. size="small"
  86. style="color: #409eff"
  87. @click.prevent="editRow(scope.row)"
  88. >编辑</el-button
  89. >
  90. <el-button
  91. @click="handleDelete(scope.$index, scope.row)"
  92. type="text"
  93. size="small"
  94. style="color: red"
  95. >删除</el-button
  96. >
  97. </template>
  98. </el-table-column>
  99. </el-table>
  100. </div>
  101. <div class="firstContent" v-if="deviceNumData.length > 0">
  102. <deviceDetails
  103. :device_NumData="deviceNumData"
  104. :filter_Text="filterText"
  105. ></deviceDetails>
  106. </div>
  107. </div>
  108. </el-tab-pane>
  109. <el-tab-pane label="视频监测设备" name="videoEquip"> </el-tab-pane>
  110. <el-tab-pane label="通信设备" name="communicateEquip"> </el-tab-pane>
  111. <el-tab-pane label="通道列表" name="channelList"> </el-tab-pane>
  112. </el-tabs>
  113. </div>
  114. </template>
  115. <script lang="ts">
  116. import { defineComponent, ref, Ref } from "vue";
  117. import deviceDetails from "./deviceDetails.vue";
  118. interface PowerEquipData {
  119. deviceNumData: Ref;
  120. tableData: Ref;
  121. activeName: Ref;
  122. filterText: Ref;
  123. }
  124. export default defineComponent({
  125. name: "powerEquip",
  126. components: {
  127. deviceDetails,
  128. },
  129. props: {},
  130. setup(): PowerEquipData {
  131. const deviceNumData = ref([]);
  132. const tableData = ref([
  133. {
  134. manufactor: "上海永天科技股份有限公司",
  135. deviceModel: "测试设备",
  136. deviceNum: "8",
  137. },
  138. {
  139. manufactor: "上海永天科技股份有限公司",
  140. deviceModel: "测试设备",
  141. deviceNum: "8",
  142. },
  143. {
  144. manufactor: "海永天科技股份有限公司",
  145. deviceModel: "试设备",
  146. deviceNum: "8",
  147. },
  148. {
  149. manufactor: "上海永天科技股份有限公司",
  150. deviceModel: "测试设备",
  151. deviceNum: "8",
  152. },
  153. {
  154. manufactor: "上海永天科技股份有限公司",
  155. deviceModel: "测试设备",
  156. deviceNum: "8",
  157. },
  158. {
  159. manufactor: "上海永天科技股份有限公司",
  160. deviceModel: "测试设备",
  161. deviceNum: "8",
  162. },
  163. {
  164. manufactor: "上海永天科技股份有限公司",
  165. deviceModel: "测试设备",
  166. deviceNum: "8",
  167. },
  168. {
  169. manufactor: "上海永天科技股份有限公司",
  170. deviceModel: "测试设备",
  171. deviceNum: "8",
  172. },
  173. ]);
  174. const activeName = ref("powerEquip");
  175. const filterText = ref("");
  176. return {
  177. deviceNumData,
  178. tableData,
  179. activeName,
  180. filterText,
  181. };
  182. },
  183. methods: {
  184. //返回
  185. goBack() {
  186. this.deviceNumData = [];
  187. },
  188. //新增
  189. addItem() {
  190. console.log("");
  191. },
  192. //设备数量查询
  193. deviceNumSelect(data) {
  194. console.log(data);
  195. this.filterText = "";
  196. this.deviceNumData = [
  197. {
  198. stationStatus: 0,
  199. deviceName: "测试设备",
  200. deviceCode: "cubbs",
  201. location: "站点1",
  202. ratedVoltage: 10,
  203. ratedCurrent: 58,
  204. currentLoRaTh: 80,
  205. powerQuAn: "开启",
  206. meterAddress: "1",
  207. },
  208. {
  209. stationStatus: 1,
  210. deviceName: "测试设备",
  211. deviceCode: "cubbs",
  212. location: "站点1",
  213. ratedVoltage: 10,
  214. ratedCurrent: 58,
  215. currentLoRaTh: 80,
  216. powerQuAn: "开启",
  217. meterAddress: "1",
  218. },
  219. ];
  220. console.log(this.deviceNumData);
  221. },
  222. // 表头样式设置
  223. headClass() {
  224. return "background:#FAFAFA !important;color: black;";
  225. },
  226. handleClick(tab, event) {
  227. console.log(tab, event);
  228. },
  229. },
  230. });
  231. </script>
  232. <style lang="scss">
  233. .powerEquip {
  234. height: calc(100vh - 100px);
  235. padding: 30px;
  236. margin-top: 50px;
  237. }
  238. //firstInput样式
  239. .first {
  240. margin: 15px;
  241. //顶部左侧样式
  242. .firstTop {
  243. display: flex;
  244. height: 32px;
  245. line-height: 32px;
  246. .firstTopLeft {
  247. width: 70%;
  248. .goBack {
  249. margin-right: 15px;
  250. }
  251. .firstTopLeftTitle {
  252. font-size: 14px;
  253. margin-right: 10px;
  254. }
  255. .firstTopLeftInput {
  256. width: 15rem;
  257. }
  258. .el-input__icon {
  259. color: #409eff;
  260. }
  261. .el-input__inner:hover {
  262. border-color: #409eff;
  263. }
  264. .el-input__inner:focus {
  265. border-color: #409eff;
  266. }
  267. .search-button {
  268. margin-left: 1rem;
  269. }
  270. }
  271. //顶部右侧样式
  272. .firstRight {
  273. width: 30%;
  274. button {
  275. margin-left: 1rem;
  276. float: right;
  277. }
  278. }
  279. }
  280. .firstContent {
  281. margin-top: 15px;
  282. }
  283. }
  284. // tab重置样式
  285. .tabsSizeColor > .el-tabs__header .el-tabs__item {
  286. line-height: 50px;
  287. height: 50px;
  288. font-size: 16px;
  289. }
  290. .tabsSizeColor > .el-tabs__header .el-tabs__item.is-active {
  291. border-bottom: 2px solid #409eff;
  292. color: #409eff;
  293. }
  294. .el-tabs__header {
  295. margin-bottom: 0;
  296. }
  297. .el-tabs--card > .el-tabs__header .el-tabs__item,
  298. .el-tabs--card > .el-tabs__header .el-tabs__nav {
  299. border: none;
  300. }
  301. </style>