index.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  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. >
  19. 返回
  20. </el-button>
  21. <span class="firstTopLeftTitle">
  22. {{ deviceNumData.length > 0 ? '设备或编号' : '厂家或型号' }}:
  23. </span>
  24. <el-input
  25. placeholder="输入关键字进行过滤"
  26. v-model="filterText"
  27. class="firstTopLeftInput"
  28. >
  29. <template #suffix>
  30. <i class="el-icon-search el-input__icon"></i>
  31. </template>
  32. </el-input>
  33. <el-button
  34. class="search-button"
  35. icon="el-icon-plus"
  36. type="success"
  37. @click="addItem()"
  38. >
  39. 新增
  40. </el-button>
  41. </div>
  42. </div>
  43. <div class="firstContent" v-if="deviceNumData.length <= 0">
  44. <el-table
  45. :data="
  46. tableData.filter(
  47. (data) =>
  48. !filterText ||
  49. data.manufactor
  50. .toLowerCase()
  51. .includes(filterText.toLowerCase()) ||
  52. data.deviceModel
  53. .toLowerCase()
  54. .includes(filterText.toLowerCase())
  55. )
  56. "
  57. border
  58. stripe
  59. :header-cell-style="headClass"
  60. :height="Height"
  61. >
  62. <el-table-column
  63. fixed
  64. prop="manufactor"
  65. label="厂家"
  66. width=""
  67. ></el-table-column>
  68. <el-table-column
  69. prop="deviceModel"
  70. label="型号"
  71. width=""
  72. ></el-table-column>
  73. <el-table-column prop="deviceNum" label="设备数量" width="">
  74. <template #default="scope">
  75. <div
  76. style="margin-right: 15px; cursor: pointer; color: #409eff"
  77. @click="deviceNumSelect({ id: scope.row.manufactor })"
  78. >
  79. {{ scope.row.deviceNum }}
  80. </div>
  81. </template>
  82. </el-table-column>
  83. <el-table-column fixed="right" label="操作" width="250">
  84. <template #default="scope">
  85. <el-button
  86. type="text"
  87. size="small"
  88. style="color: #409eff"
  89. @click.prevent="update(scope.row)"
  90. >
  91. 编辑
  92. </el-button>
  93. <el-button
  94. @click="handleDelete(scope.$index, scope.row)"
  95. type="text"
  96. size="small"
  97. style="color: red"
  98. >
  99. 删除
  100. </el-button>
  101. </template>
  102. </el-table-column>
  103. </el-table>
  104. </div>
  105. <div class="firstContent" v-if="deviceNumData.length > 0">
  106. <deviceDetails
  107. :device_NumData="deviceNumData"
  108. :filter_Text="filterText"
  109. ></deviceDetails>
  110. </div>
  111. <!-- 新增 -->
  112. <insert-Dialog
  113. :flag="show"
  114. :data_list="datalist"
  115. :updateTitle="updateTitle"
  116. @show="showValue"
  117. ></insert-Dialog>
  118. </div>
  119. </el-tab-pane>
  120. <el-tab-pane label="视频监测设备" name="videoEquip">
  121. <video-Equip></video-Equip>
  122. </el-tab-pane>
  123. <el-tab-pane label="通信设备" name="communicateEquip">
  124. <communicate-Equip></communicate-Equip>
  125. </el-tab-pane>
  126. <el-tab-pane label="通道列表" name="channelList">
  127. <channel-List></channel-List>
  128. </el-tab-pane>
  129. </el-tabs>
  130. </div>
  131. </template>
  132. <script>
  133. import { defineComponent, ref, reactive } from 'vue'
  134. import deviceDetails from './deviceDetails.vue'
  135. import videoEquip from './videoEquip/index.vue'
  136. import insertDialog from './powerDialog/insertDialog.vue'
  137. import communicateEquip from './communicateEquip/index.vue'
  138. import channelList from './channelList/index.vue'
  139. export default defineComponent({
  140. name: 'powerEquip',
  141. components: {
  142. deviceDetails,
  143. videoEquip,
  144. insertDialog,
  145. communicateEquip,
  146. channelList,
  147. },
  148. props: {},
  149. data() {
  150. return {
  151. insertDialog_: false, //新增弹窗控制
  152. dialogTitle: '',
  153. }
  154. },
  155. setup() {
  156. const deviceNumData = ref([])
  157. const tableData = ref([
  158. {
  159. manufactor: '上海永天科技股份有限公司',
  160. deviceModel: '测试设备',
  161. deviceNum: '8',
  162. },
  163. {
  164. manufactor: '上海永天科技股份有限公司',
  165. deviceModel: '测试设备',
  166. deviceNum: '8',
  167. },
  168. {
  169. manufactor: '海永天科技股份有限公司',
  170. deviceModel: '试设备1',
  171. deviceNum: '8',
  172. },
  173. {
  174. manufactor: '上海永天科技股份有限公司',
  175. deviceModel: '测试设备',
  176. deviceNum: '8',
  177. },
  178. {
  179. manufactor: '上海永天科技股份有限公司',
  180. deviceModel: '测试设备',
  181. deviceNum: '8',
  182. },
  183. {
  184. manufactor: '上海永天科技股份有限公司',
  185. deviceModel: '测试设备',
  186. deviceNum: '8',
  187. },
  188. {
  189. manufactor: '上海永天科技股份有限公司',
  190. deviceModel: '测试设备',
  191. deviceNum: '8',
  192. },
  193. {
  194. manufactor: '上海永天科技股份有限公司',
  195. deviceModel: '测试设备',
  196. deviceNum: '8',
  197. },
  198. ])
  199. const activeName = ref('powerEquip')
  200. const filterText = ref('')
  201. const show = ref(false)
  202. const updateTitle = ref('')
  203. const deviceNumSelect = (data) => {
  204. data
  205. // console.log(data);
  206. filterText.value = ''
  207. deviceNumData.value = [
  208. {
  209. stationStatus: 0,
  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. stationStatus: 1,
  221. deviceName: '测试设备',
  222. deviceCode: 'cubbs',
  223. location: '站点1',
  224. ratedVoltage: 10,
  225. ratedCurrent: 58,
  226. currentLoRaTh: 80,
  227. powerQuAn: '开启',
  228. meterAddress: '1',
  229. },
  230. ]
  231. }
  232. const datalist = reactive([])
  233. const addItem = () => {
  234. datalist.value = [
  235. {
  236. id: '',
  237. stationName: '',
  238. stationCode: '',
  239. stationAddress: '',
  240. siteList: [],
  241. done: '',
  242. guaZai: '',
  243. deviceAbty: true,
  244. },
  245. ]
  246. updateTitle.value = '新增设备信息'
  247. show.value = true
  248. }
  249. const update = (row) => {
  250. console.log(row)
  251. datalist.value = [
  252. {
  253. id: '',
  254. stationName: '',
  255. stationCode: '',
  256. stationAddress: '',
  257. siteList: [],
  258. done: '',
  259. guaZai: '',
  260. deviceAbty: true,
  261. },
  262. ]
  263. updateTitle.value = '修改设备信息'
  264. show.value = true
  265. }
  266. const handleDelete = (ind, row) => {
  267. console.log(ind, row)
  268. }
  269. const showValue = (value) => {
  270. show.value = value
  271. }
  272. //返回
  273. const goBack = () => {
  274. deviceNumData.value = []
  275. }
  276. // 表头样式设置
  277. const headClass = () => {
  278. return 'background:#FAFAFA !important;color: black;'
  279. }
  280. const handleClick = (tab, event) => {
  281. console.log(tab, event)
  282. }
  283. const Height = ref(0)
  284. Height.value = window.innerHeight - 255 + 'px'
  285. window.addEventListener('resize', () => {
  286. Height.value = window.innerHeight - 255 + 'px'
  287. })
  288. return {
  289. Height,
  290. deviceNumData,
  291. tableData,
  292. activeName,
  293. filterText,
  294. show,
  295. addItem,
  296. datalist,
  297. deviceNumSelect,
  298. showValue,
  299. updateTitle,
  300. handleDelete,
  301. update,
  302. goBack,
  303. headClass,
  304. handleClick,
  305. }
  306. },
  307. })
  308. </script>
  309. <style lang="scss">
  310. .powerEquip {
  311. height: calc(100vh - 130px);
  312. min-width: 810px;
  313. // padding: 30px;
  314. // margin-top: 50px;
  315. }
  316. //first样式
  317. .first {
  318. margin: 15px;
  319. //顶部左侧样式
  320. .firstTop {
  321. display: flex;
  322. height: 32px;
  323. line-height: 32px;
  324. .firstTopLeft {
  325. width: 70%;
  326. .goBack {
  327. margin-right: 15px;
  328. }
  329. .firstTopLeftTitle {
  330. font-size: 14px;
  331. margin-right: 10px;
  332. }
  333. .firstTopLeftInput {
  334. width: 15rem;
  335. }
  336. .el-input__icon {
  337. color: #409eff;
  338. }
  339. .el-input__inner:hover {
  340. border-color: #409eff;
  341. }
  342. .el-input__inner:focus {
  343. border-color: #409eff;
  344. }
  345. .search-button {
  346. margin-left: 1rem;
  347. }
  348. }
  349. }
  350. .firstContent {
  351. margin-top: 15px;
  352. }
  353. }
  354. // tab重置样式
  355. .tabsSizeColor > .el-tabs__header .el-tabs__item {
  356. line-height: 50px;
  357. height: 50px;
  358. font-size: 16px;
  359. }
  360. .tabsSizeColor > .el-tabs__header .el-tabs__item.is-active {
  361. border-bottom: 2px solid #409eff;
  362. color: #409eff;
  363. }
  364. .el-tabs__header {
  365. margin-bottom: 0;
  366. }
  367. .el-tabs--card > .el-tabs__header .el-tabs__item,
  368. .el-tabs--card > .el-tabs__header .el-tabs__nav {
  369. border: none;
  370. }
  371. </style>