index.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <div class="powerEquip">
  3. <el-tabs
  4. v-model="activeName"
  5. type="card"
  6. style="background-color: #fff; height: 100%"
  7. class="tabsSizeColor"
  8. >
  9. <el-tab-pane label="电力监测设备" name="powerEquip">
  10. <div class="first">
  11. <div class="firstTop">
  12. <div class="firstTopLeft">
  13. <el-button
  14. class="goBack"
  15. @click="goBack"
  16. v-if="deviceNumData.length != ''"
  17. >
  18. 返回
  19. </el-button>
  20. <span class="firstTopLeftTitle">
  21. {{ deviceNumData.length != '' ? '设备或编号' : '名称或地址' }}:
  22. </span>
  23. <el-input
  24. placeholder="输入关键字进行过滤"
  25. v-model="filterText"
  26. class="firstTopLeftInput"
  27. >
  28. <template #suffix>
  29. <i class="el-icon-search el-input__icon"></i>
  30. </template>
  31. </el-input>
  32. <el-button
  33. class="search-button"
  34. icon="el-icon-plus"
  35. type="success"
  36. @click="addItem()"
  37. >
  38. 新增
  39. </el-button>
  40. </div>
  41. </div>
  42. <div class="firstContent" v-if="deviceNumData.length == ''">
  43. <el-table
  44. :data="
  45. tableData.filter(
  46. (data) =>
  47. !filterText ||
  48. data.siteName
  49. .toLowerCase()
  50. .includes(filterText.toLowerCase()) ||
  51. data.siteAddress
  52. .toLowerCase()
  53. .includes(filterText.toLowerCase())
  54. )
  55. "
  56. border
  57. stripe
  58. :header-cell-style="headClass"
  59. :height="Height"
  60. >
  61. <el-table-column
  62. prop="siteName"
  63. label="站点名称"
  64. width=""
  65. ></el-table-column>
  66. <el-table-column
  67. prop="siteAddress"
  68. label="站点地址"
  69. width=""
  70. ></el-table-column>
  71. <el-table-column
  72. prop="userName"
  73. label="联系人"
  74. width=""
  75. ></el-table-column>
  76. <el-table-column
  77. prop="phone"
  78. label="手机号"
  79. width=""
  80. ></el-table-column>
  81. <el-table-column prop="deviceCount" label="设备数量" width="">
  82. <template #default="scope">
  83. <div
  84. style="margin-right: 15px; cursor: pointer; color: #409eff"
  85. @click="
  86. deviceNumSelect({
  87. id: scope.row.id,
  88. deviceCount: scope.row.deviceCount,
  89. })
  90. "
  91. >
  92. {{ scope.row.deviceCount }}
  93. </div>
  94. </template>
  95. </el-table-column>
  96. </el-table>
  97. </div>
  98. <div class="firstContent" v-if="deviceNumData.length != ''">
  99. <deviceDetails
  100. :filter_Text="filterText"
  101. :Height="Height"
  102. :refresh="refresh"
  103. @updateRow="update"
  104. ></deviceDetails>
  105. </div>
  106. <!-- 新增 -->
  107. <insert-Dialog
  108. :flag="show"
  109. :data_list="datalist"
  110. :deviceNumDataContent="deviceNumData"
  111. :updateTitle="updateTitle"
  112. @show="showValue"
  113. ></insert-Dialog>
  114. </div>
  115. </el-tab-pane>
  116. <el-tab-pane label="视频监测设备" name="videoEquip">
  117. <video-Equip :Height="Height"></video-Equip>
  118. </el-tab-pane>
  119. <el-tab-pane label="通信设备" name="communicateEquip">
  120. <communicate-Equip :Height="Height"></communicate-Equip>
  121. </el-tab-pane>
  122. <el-tab-pane label="通道列表" name="channelList">
  123. <channel-List :Height="Height"></channel-List>
  124. </el-tab-pane>
  125. </el-tabs>
  126. </div>
  127. </template>
  128. <script>
  129. import { useStore } from 'vuex'
  130. import { defineComponent, ref, reactive, onMounted } from 'vue'
  131. import deviceDetails from './deviceDetails.vue'
  132. import videoEquip from './videoEquip/index.vue'
  133. import insertDialog from './powerDialog/insertDialog.vue'
  134. import communicateEquip from './communicateEquip/index.vue'
  135. import channelList from './channelList/index.vue'
  136. import * as api from '@/api/deviceManage/powerEquip/deviceAttribute'
  137. import { ElMessage } from 'element-plus'
  138. export default defineComponent({
  139. name: 'powerEquip',
  140. components: {
  141. deviceDetails,
  142. videoEquip,
  143. insertDialog,
  144. communicateEquip,
  145. channelList,
  146. },
  147. props: {},
  148. setup() {
  149. const store = useStore()
  150. const tableData = ref([])
  151. const deviceNumData = ref('') //判断设备列表详情是否显示
  152. const refresh = ref(false) //设备列表详情table 是否重新调用
  153. const activeName = ref('powerEquip')
  154. const filterText = ref('')
  155. const show = ref(false)
  156. const updateTitle = ref('')
  157. const datalist = reactive([])
  158. //新增 向子组件 参数传递
  159. const addItem = () => {
  160. refresh.value = false
  161. datalist.value = [
  162. {
  163. monitorDeviceCode: '',
  164. monitorDeviceName: '',
  165. loopMeterAddress: 1,
  166. ratedVoltage: null,
  167. ratedCurrent: 1,
  168. currentLoadRate: 0,
  169. siteId: '',
  170. variableListId: 0,
  171. qualityAnalysis: true,
  172. },
  173. ]
  174. if (deviceNumData.value.length > 0) {
  175. datalist.value[0].siteId = store.state.siteId
  176. }
  177. updateTitle.value = '新增设备信息'
  178. show.value = true
  179. }
  180. //修改 向子组件 参数传递
  181. const update = (row) => {
  182. datalist.value = [
  183. {
  184. id: row.id,
  185. monitorDeviceCode: row.monitorDeviceCode,
  186. monitorDeviceName: row.monitorDeviceName,
  187. loopMeterAddress: row.loopMeterAddress,
  188. ratedVoltage: row.ratedVoltage,
  189. ratedCurrent: row.ratedCurrent,
  190. currentLoadRate: row.currentLoadRate,
  191. siteId: row.siteId,
  192. variableListId: row.variableListId,
  193. qualityAnalysis: row.qualityAnalysis === '是' ? true : false,
  194. },
  195. ]
  196. updateTitle.value = '修改设备信息'
  197. show.value = true
  198. }
  199. //点击事件 查询设备详情
  200. const deviceNumSelect = (data) => {
  201. filterText.value = ''
  202. if (data.deviceCount != null && data.deviceCount != '') {
  203. store.state.siteId = data.id
  204. deviceNumData.value = JSON.stringify(data.id)
  205. } else {
  206. ElMessage({
  207. message: '此站点下暂无设备',
  208. type: 'warning',
  209. })
  210. }
  211. }
  212. //电力监测设备列表
  213. function monitorDeviceList() {
  214. api.monitorDeviceList({}).then((requset) => {
  215. if (requset.status === 'SUCCESS') {
  216. tableData.value = requset.data
  217. store.state.siteList = tableData
  218. } else {
  219. ElMessage.error(requset.msg)
  220. }
  221. })
  222. }
  223. //新增弹窗控制
  224. const showValue = (value) => {
  225. show.value = value
  226. deviceNumData.value != '' ? (refresh.value = true) : monitorDeviceList()
  227. }
  228. //返回
  229. const goBack = () => {
  230. deviceNumData.value = ''
  231. monitorDeviceList()
  232. }
  233. // 表头样式设置
  234. const headClass = () => {
  235. return 'background:#FAFAFA !important;color: black;'
  236. }
  237. const Height = ref(0)
  238. Height.value = window.innerHeight - 300 + 'px'
  239. window.addEventListener('resize', () => {
  240. Height.value = window.innerHeight - 300 + 'px'
  241. })
  242. onMounted(() => {
  243. monitorDeviceList()
  244. })
  245. return {
  246. refresh,
  247. Height,
  248. deviceNumData,
  249. tableData,
  250. activeName,
  251. filterText,
  252. show,
  253. addItem,
  254. update,
  255. datalist,
  256. deviceNumSelect,
  257. showValue,
  258. updateTitle,
  259. goBack,
  260. headClass,
  261. }
  262. },
  263. })
  264. </script>
  265. <style lang="scss">
  266. .powerEquip {
  267. height: calc(100vh - 130px);
  268. min-width: 810px;
  269. // padding: 30px;
  270. // margin-top: 50px;
  271. }
  272. //first样式
  273. .first {
  274. margin: 15px;
  275. //顶部左侧样式
  276. .firstTop {
  277. display: flex;
  278. height: 32px;
  279. line-height: 32px;
  280. .firstTopLeft {
  281. width: 70%;
  282. .goBack {
  283. margin-right: 15px;
  284. }
  285. .firstTopLeftTitle {
  286. font-size: 14px;
  287. margin-right: 10px;
  288. }
  289. .firstTopLeftInput {
  290. width: 15rem;
  291. }
  292. .el-input__icon {
  293. color: #409eff;
  294. }
  295. .el-input__inner:hover {
  296. border-color: #409eff;
  297. }
  298. .el-input__inner:focus {
  299. border-color: #409eff;
  300. }
  301. .search-button {
  302. margin-left: 1rem;
  303. }
  304. }
  305. }
  306. .firstContent {
  307. margin-top: 15px;
  308. }
  309. }
  310. // tab重置样式
  311. .tabsSizeColor > .el-tabs__header .el-tabs__item {
  312. line-height: 50px;
  313. height: 50px;
  314. font-size: 16px;
  315. }
  316. .tabsSizeColor > .el-tabs__header .el-tabs__item.is-active {
  317. border-bottom: 2px solid #409eff;
  318. color: #409eff;
  319. }
  320. .el-tabs__header {
  321. margin-bottom: 0;
  322. }
  323. .el-tabs--card > .el-tabs__header .el-tabs__item,
  324. .el-tabs--card > .el-tabs__header .el-tabs__nav {
  325. border: none;
  326. }
  327. </style>