Browse Source

分站管理-新设备启动添加提交

lxh 4 months ago
parent
commit
5f8127adb3

+ 1 - 0
src/views/vent/home/clique/dustComponents/mine-wind.vue

@@ -515,6 +515,7 @@ watch(
           height: 100%;
           font-size: 12px;
           color: #fff;
+          border-right: 1px solid rgba(0, 216, 255, 0.1);
 
 
           &:nth-child(1) {

+ 28 - 14
src/views/vent/safetyList/index.vue

@@ -45,15 +45,23 @@
       <div class="right-box">
         <div class="right-title">详细信息:</div>
         <a-table size="small" :scroll="{ y: 680 }" :columns="columns" :data-source="tableData" :pagination="pagination"
-          @change="pageChange" >
+          @change="pageChange">
+          <template #action="{ record }">
+            <a v-show="record.linkId == '0'" class="table-action-link" @click="handlerunDeviceMonitor(record)">启动</a>
+          </template>
           <template #bodyCell="{ column, text }">
-                    <template v-if="column.dataIndex === 'valueJc' && text ">
-                        <div v-for="item in text.split(',')" :key="item" >
-                          <span style="display: inline-block;width: 50%;text-align: right; color:rgb(0, 242, 255);margin-right:5px" >{{ item.substring(0,item.indexOf(':')+1) }}</span>
-                          <span style="display: inline-block; width:45%;text-align: left; color:#fff">{{ item.substring(item.indexOf(':')+1) }} </span>
-                        </div>
-                    </template>
-                </template>
+            <template v-if="column.dataIndex === 'valueJc' && text">
+              <div v-for="item in text.split(',')" :key="item">
+                <span v-if="item.substring(item.indexOf(':') + 1)"
+                  style="display: inline-block;width: 50%;text-align: right; color:rgb(0, 242, 255);margin-right:5px">{{
+                    item.substring(0, item.indexOf(':') + 1) }}</span>
+                <span v-if="item.substring(item.indexOf(':') + 1)"
+                  style="display: inline-block; width:45%;text-align: left; color:#fff">{{
+                    item.substring(item.indexOf(':') + 1) }} </span>
+              </div>
+            </template>
+
+          </template>
         </a-table>
       </div>
     </div>
@@ -63,7 +71,7 @@
 <script setup lang="ts">
 import { ref, nextTick, reactive, onMounted } from 'vue';
 import customHeader from '/@/components/vent/customHeader.vue';
-import { subStationList, getList, getEdit } from './safetyList.api';
+import { subStationList, getList, getEdit, runDeviceMonitor } from './safetyList.api';
 import { columns } from './safetyList.data'
 
 let isShow = ref(false)
@@ -93,7 +101,7 @@ let tableData = ref<any[]>([])
 
 //获取分站信息
 async function getSubStationList() {
-  let res = await subStationList({strtype:"modbus"})
+  let res = await subStationList({ strtype: "modbus" })
   console.log(res, '分站-----------')
   if (res.length != 0) {
     cardList.value = res
@@ -130,17 +138,17 @@ async function getChangeStation() {
 async function getStationList() {
   let res = await getList({ pageNo: pagination.current, pageSize: pagination.pageSize, })
   console.log(res, '详细信息列表--------')
-  
+
   res.forEach(el => {
-    el.key=el.id
+    el.key = el.id
     el.linkstatusC = el.linkstatus ? '连接' : '未连接'
     el.children = el.devInfoList
     el.children.forEach(v => {
-      v.key=v.id
+      v.key = v.deviceID
       v.linkstatus = v.netStatus
       v.linkstatusC = v.linkstatus ? '连接' : '未连接'
       v.updateTime = v.time
-      v.valueJc=`密度:${v.density},气压:${v.pa},温度:${v.temperature},湿度:${v.humidity},风速:${v.windSpeed},压差:${v.difPress}`
+      v.valueJc = `密度:${v.density || ''},气压:${v.pa || ''},温度:${v.temperature || ''},湿度:${v.humidity || ''},风速:${v.windSpeed || ''},压差:${v.difPress || ''}`
 
     })
   })
@@ -153,6 +161,12 @@ function pageChange(val) {
   pagination.pageSize = val.pageSize;
   getStationList();
 }
+//启动新设备
+async function handlerunDeviceMonitor(record) {
+  let res = await runDeviceMonitor({ devId: record.deviceID })
+  console.log(res,'新设备启动---')
+  getStationList();
+}
 
 onMounted(() => {
   getSubStationList()

+ 4 - 1
src/views/vent/safetyList/safetyList.api.ts

@@ -3,7 +3,8 @@ import { defHttp } from '/@/utils/http/axios';
 enum Api {
   subStationList = '/safety/ventanalySubStation/alllist',
   getList='/safety/ventanalyDeviceInfo/getDeviceListBySubId',
-  getEdit='/safety/ventanalySubStation/edit'
+  getEdit='/safety/ventanalySubStation/edit',
+  runDeviceMonitor='/safety/ventanalyDeviceInfo/runDeviceMonitor'
 }
 
 
@@ -13,3 +14,5 @@ export const subStationList = (params) => defHttp.get({ url: Api.subStationList,
 export const getList = (params) => defHttp.post({ url: Api.getList, params });
 //分站编辑
 export const getEdit = (params) => defHttp.put({ url: Api.getEdit, params });
+//启动新设备
+export const runDeviceMonitor = (params) => defHttp.post({ url: Api.runDeviceMonitor, params });

+ 7 - 1
src/views/vent/safetyList/safetyList.data.ts

@@ -37,5 +37,11 @@ export const columns: BasicColumn[] = [
         key: 'updateTime',
         align: 'center',
     },
-
+    {
+        title: '操作',
+        dataIndex: 'action',
+        width: 100,
+        align: 'center',
+        slots: { customRender: 'action' },
+    },
 ];