index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  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. align="center"
  65. ></el-table-column>
  66. <el-table-column
  67. prop="siteAddress"
  68. label="站点地址"
  69. align="center"
  70. ></el-table-column>
  71. <el-table-column
  72. prop="userName"
  73. label="联系人"
  74. align="center"
  75. ></el-table-column>
  76. <el-table-column
  77. prop="phone"
  78. label="手机号"
  79. align="center"
  80. ></el-table-column>
  81. <el-table-column
  82. prop="deviceCount"
  83. label="设备数量"
  84. align="center"
  85. width=""
  86. >
  87. <template #default="scope">
  88. <div
  89. style="margin-right: 15px; cursor: pointer; color: #409eff"
  90. @click="
  91. deviceNumSelect({
  92. id: scope.row.id,
  93. deviceCount: scope.row.deviceCount,
  94. })
  95. "
  96. >
  97. {{ scope.row.deviceCount }}
  98. </div>
  99. </template>
  100. </el-table-column>
  101. </el-table>
  102. <div class="listPagination1">
  103. <el-pagination
  104. v-model:currentPage="currentPage"
  105. :page-sizes="[15, 20, 25, 30]"
  106. :page-size="pageSize"
  107. layout="total, sizes, prev, pager, next, jumper"
  108. :total="total"
  109. @size-change="handleSizeChange"
  110. @current-change="handleCurrentChange"
  111. background
  112. ></el-pagination>
  113. </div>
  114. </div>
  115. <div class="firstContent" v-if="deviceNumData.length != ''">
  116. <deviceDetails
  117. :filter_Text="filterText"
  118. :Height="Height"
  119. :refresh="refresh"
  120. @updateRow="update"
  121. ></deviceDetails>
  122. </div>
  123. <!-- 新增 -->
  124. <insert-Dialog
  125. :flag="show"
  126. :data_list="datalist"
  127. :deviceNumDataContent="deviceNumData"
  128. :updateTitle="updateTitle"
  129. @show="showValue"
  130. ></insert-Dialog>
  131. </div>
  132. </el-tab-pane>
  133. <el-tab-pane label="视频监测设备" name="videoEquip">
  134. <video-Equip :Height="Height"></video-Equip>
  135. </el-tab-pane>
  136. <el-tab-pane label="通信设备" name="communicateEquip">
  137. <communicate-Equip :Height="Height"></communicate-Equip>
  138. </el-tab-pane>
  139. <el-tab-pane label="通道列表" name="channelList">
  140. <channel-List :Height="Height"></channel-List>
  141. </el-tab-pane>
  142. </el-tabs>
  143. </div>
  144. </template>
  145. <script>
  146. import { useStore } from 'vuex'
  147. import { defineComponent, ref, reactive, onMounted } from 'vue'
  148. import deviceDetails from './deviceDetails.vue'
  149. import videoEquip from './videoEquip/index.vue'
  150. import insertDialog from './powerDialog/insertDialog.vue'
  151. import communicateEquip from './communicateEquip/index.vue'
  152. import channelList from './channelList/index.vue'
  153. import * as api from '@/api/deviceManage/powerEquip/deviceAttribute'
  154. import { ElMessage } from 'element-plus'
  155. export default defineComponent({
  156. name: 'powerEquip',
  157. components: {
  158. deviceDetails,
  159. videoEquip,
  160. insertDialog,
  161. communicateEquip,
  162. channelList,
  163. },
  164. props: {},
  165. setup() {
  166. const store = useStore()
  167. const tableData = ref([])
  168. const total = ref(0)
  169. const pageSize = ref(15)
  170. const currentPage = ref(1)
  171. const deviceNumData = ref('') //判断设备列表详情是否显示
  172. const refresh = ref(false) //设备列表详情table 是否重新调用
  173. const activeName = ref('powerEquip')
  174. const filterText = ref('')
  175. const show = ref(false)
  176. const updateTitle = ref('')
  177. const datalist = reactive([])
  178. //新增 向子组件 参数传递
  179. const addItem = () => {
  180. refresh.value = false
  181. datalist.value = [
  182. {
  183. monitorDeviceCode: '',
  184. monitorDeviceName: '',
  185. loopMeterAddress: 1,
  186. ratedVoltage: null,
  187. ratedCurrent: 1,
  188. currentLoadRate: 0,
  189. siteId: '',
  190. variableListId: 0,
  191. qualityAnalysis: true,
  192. },
  193. ]
  194. if (deviceNumData.value.length > 0) {
  195. datalist.value[0].siteId = store.state.siteId
  196. }
  197. updateTitle.value = '新增设备信息'
  198. show.value = true
  199. }
  200. //修改 向子组件 参数传递
  201. const update = (row) => {
  202. datalist.value = [
  203. {
  204. id: row.id,
  205. monitorDeviceCode: row.monitorDeviceCode,
  206. monitorDeviceName: row.monitorDeviceName,
  207. loopMeterAddress: row.loopMeterAddress,
  208. ratedVoltage: row.ratedVoltage,
  209. ratedCurrent: row.ratedCurrent,
  210. currentLoadRate: row.currentLoadRate,
  211. siteId: row.siteId,
  212. variableListId: row.variableListId,
  213. qualityAnalysis: row.qualityAnalysis === '是' ? true : false,
  214. },
  215. ]
  216. updateTitle.value = '修改设备信息'
  217. show.value = true
  218. }
  219. //点击事件 查询设备详情
  220. const deviceNumSelect = (data) => {
  221. filterText.value = ''
  222. if (data.deviceCount != null && data.deviceCount != '') {
  223. store.state.siteId = data.id
  224. deviceNumData.value = JSON.stringify(data.id)
  225. } else {
  226. ElMessage({
  227. message: '此站点下暂无设备',
  228. type: 'warning',
  229. })
  230. }
  231. }
  232. //电力监测设备列表
  233. function monitorDeviceList() {
  234. api
  235. .monitorDeviceList({
  236. size: pageSize.value,
  237. current: currentPage.value,
  238. })
  239. .then((requset) => {
  240. if (requset.status === 'SUCCESS') {
  241. tableData.value = requset.data.records
  242. total.value = requset.data.total
  243. store.state.siteList = tableData
  244. } else {
  245. ElMessage.error(requset.msg)
  246. }
  247. })
  248. }
  249. //新增弹窗控制
  250. const showValue = (value) => {
  251. show.value = value
  252. deviceNumData.value != '' ? (refresh.value = true) : monitorDeviceList()
  253. }
  254. //返回
  255. const goBack = () => {
  256. deviceNumData.value = ''
  257. monitorDeviceList()
  258. }
  259. const handleSizeChange = (val) => {
  260. pageSize.value = val
  261. monitorDeviceList()
  262. }
  263. const handleCurrentChange = (val) => {
  264. currentPage.value = val
  265. monitorDeviceList()
  266. }
  267. // 表头样式设置
  268. const headClass = () => {
  269. return 'background:#FAFAFA !important;color: black;'
  270. }
  271. const Height = ref(0)
  272. Height.value = window.innerHeight - 300 + 'px'
  273. window.addEventListener('resize', () => {
  274. Height.value = window.innerHeight - 300 + 'px'
  275. })
  276. onMounted(() => {
  277. monitorDeviceList()
  278. })
  279. return {
  280. refresh,
  281. Height,
  282. deviceNumData,
  283. tableData,
  284. activeName,
  285. filterText,
  286. show,
  287. addItem,
  288. update,
  289. datalist,
  290. deviceNumSelect,
  291. showValue,
  292. updateTitle,
  293. goBack,
  294. headClass,
  295. total,
  296. pageSize,
  297. currentPage,
  298. handleSizeChange,
  299. handleCurrentChange,
  300. }
  301. },
  302. })
  303. </script>
  304. <style lang="scss">
  305. .powerEquip {
  306. height: calc(100vh - 130px);
  307. min-width: 810px;
  308. // padding: 30px;
  309. // margin-top: 50px;
  310. }
  311. //first样式
  312. .first {
  313. margin: 15px;
  314. //顶部左侧样式
  315. .firstTop {
  316. display: flex;
  317. height: 32px;
  318. line-height: 32px;
  319. .firstTopLeft {
  320. width: 70%;
  321. .goBack {
  322. margin-right: 15px;
  323. }
  324. .firstTopLeftTitle {
  325. font-size: 14px;
  326. margin-right: 10px;
  327. }
  328. .firstTopLeftInput {
  329. width: 15rem;
  330. }
  331. .el-input__icon {
  332. color: #409eff;
  333. }
  334. .el-input__inner:hover {
  335. border-color: #409eff;
  336. }
  337. .el-input__inner:focus {
  338. border-color: #409eff;
  339. }
  340. .search-button {
  341. margin-left: 1rem;
  342. }
  343. }
  344. }
  345. .firstContent {
  346. margin-top: 15px;
  347. }
  348. }
  349. // tab重置样式
  350. .tabsSizeColor > .el-tabs__header .el-tabs__item {
  351. line-height: 50px;
  352. height: 50px;
  353. font-size: 16px;
  354. }
  355. .tabsSizeColor > .el-tabs__header .el-tabs__item.is-active {
  356. border-bottom: 2px solid #409eff;
  357. color: #409eff;
  358. }
  359. .el-tabs__header {
  360. margin-bottom: 0;
  361. }
  362. .el-tabs--card > .el-tabs__header .el-tabs__item,
  363. .el-tabs--card > .el-tabs__header .el-tabs__nav {
  364. border: none;
  365. }
  366. .listPagination1 {
  367. margin-top: 15px;
  368. float: right;
  369. }
  370. </style>