index.vue 11 KB

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