wenhongquan 2 lat temu
rodzic
commit
a4d5766ea7

+ 3 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java

@@ -23,6 +23,7 @@ public class TableDataInfo<T> implements Serializable {
      * 总记录数
      */
     private long total;
+    private long page;
 
     /**
      * 列表数据
@@ -48,6 +49,7 @@ public class TableDataInfo<T> implements Serializable {
     public TableDataInfo(List<T> list, long total) {
         this.rows = list;
         this.total = total;
+        this.page = 0;
     }
 
     public static <T> TableDataInfo<T> build(IPage<T> page) {
@@ -55,6 +57,7 @@ public class TableDataInfo<T> implements Serializable {
         rspData.setCode(HttpStatus.HTTP_OK);
         rspData.setMsg("查询成功");
         rspData.setRows(page.getRecords());
+        rspData.setPage(page.getCurrent());
         rspData.setTotal(page.getTotal());
         return rspData;
     }

+ 3 - 3
ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application-dev.yml

@@ -14,9 +14,9 @@ spring:
   datasource:
     type: com.zaxxer.hikari.HikariDataSource
     driver-class-name: com.mysql.cj.jdbc.Driver
-    url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
-    username: root
-    password: root
+    url: jdbc:mysql://${DBHOST:xt.wenhq.top}:${DBPORT:8583}/iotc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
+    username: ${DBUSER:root}
+    password: ${DBPWD:root}
     hikari:
       auto-commit: true
       connection-test-query: SELECT 1

+ 16 - 0
ruoyi-system/src/main/java/com/ruoyi/data/controller/TblDataController.java

@@ -4,6 +4,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 
+import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONObject;
 import com.ruoyi.common.core.domain.entity.SysDictData;
@@ -47,6 +48,10 @@ public class TblDataController extends BaseController {
 
     private final ISysDictTypeService iSysDictTypeService;
 
+    private final ITblModbusTcpService iTblModbusTcpService;
+
+    private final ITblModbusRtuService iTblModbusRtuService;
+
 
     /**
      * 查询网关设备列表
@@ -79,6 +84,17 @@ public class TblDataController extends BaseController {
         }
         for(GateWaySensor gateWaySensor:gateWaySensorList){
             gateWaySensor.setSn(gateWaySensor.getTblGateway().getSn());
+            //不是assictcp
+            if(gateWaySensor.getTblGateway().getProtocalType()!=3){
+                if(gateWaySensor.getTblGateway().getProtocalId()!=null && gateWaySensor.getTblGateway().getProtocalType().intValue() == 1){
+                    TblModbusTcpVo v= iTblModbusTcpService.queryById(gateWaySensor.getTblGateway().getProtocalId());
+                    gateWaySensor.setProtocalInfo(BeanUtil.beanToMap(v));
+                }
+                if(gateWaySensor.getTblGateway().getProtocalId()!=null && gateWaySensor.getTblGateway().getProtocalType().intValue() == 2) {
+                    TblModbusRtuVo v = iTblModbusRtuService.queryById(gateWaySensor.getTblGateway().getProtocalId());
+                    gateWaySensor.setProtocalInfo(BeanUtil.beanToMap(v));
+                }
+            }
               for(SysDictData sysDictData:sysDictTypeList){
                         if(gateWaySensor.getTblGateway().getProtocalType() == Integer.valueOf(sysDictData.getDictValue())){
                             gateWaySensor.setProtocalTypeName(sysDictData.getDictLabel());

+ 2 - 5
ruoyi-system/src/main/java/com/ruoyi/data/controller/TblEquipmentSbookController.java

@@ -114,10 +114,7 @@ public class TblEquipmentSbookController extends BaseController {
      */
     @SaCheckPermission("data:equipmentSbook:list")
     @GetMapping("/alllist")
-    public TableDataInfo<TblEquipmentSbookVo> alllist(TblEquipmentSbookBo bo) {
-        TableDataInfo<TblEquipmentSbookVo> obj= new TableDataInfo<>();
-        List<TblEquipmentSbookVo> tblEquipmentVoList = iTblEquipmentSbookService.queryList(bo);
-        obj.setRows(tblEquipmentVoList);
-        return obj;
+    public TableDataInfo<TblEquipmentSbookVo> alllist(TblEquipmentSbookBo bo,PageQuery query) {
+        return iTblEquipmentSbookService.queryPageList(bo,query);
     }
 }

+ 2 - 0
ruoyi-system/src/main/java/com/ruoyi/data/domain/GateWaySensor.java

@@ -4,6 +4,7 @@ import com.ruoyi.data.domain.vo.TblGatewayVo;
 import lombok.Data;
 
 import java.util.List;
+import java.util.Map;
 
 @Data
 public class GateWaySensor {
@@ -11,6 +12,7 @@ public class GateWaySensor {
     private String sn;
 
     private String protocalTypeName;
+    private Map protocalInfo;
 
     private TblGatewayVo tblGateway;
 

+ 1 - 7
ruoyi-ui-vue3/src/api/data/equipment.js

@@ -10,13 +10,7 @@ export function listEquipment(query) {
 }
 
 
-export function listGatewayEquipments(query) {
-  return request({
-    url: '/data/equipment/alllist',
-    method: 'get',
-    params: query
-  })
-}
+
 
 // 查询设备详细
 export function getEquipment(id) {

+ 8 - 0
ruoyi-ui-vue3/src/api/data/equipmentSbook.js

@@ -17,6 +17,14 @@ export function getEquipmentSbook(id) {
   })
 }
 
+export function listGatewayEquipmentSbook(query) {
+  return request({
+    url: '/data/equipmentSbook/alllist',
+    method: 'get',
+    params: query
+  })
+}
+
 // 新增设备台账
 export function addEquipmentSbook(data) {
   return request({

+ 77 - 41
ruoyi-ui-vue3/src/views/gateway/manager/add.vue

@@ -141,12 +141,12 @@
       </el-row>
     </el-card>
 
-    <el-card class="box-card" style="margin-top: 20px">
+    <el-card class="box-card" style="margin-top: 20px" v-if="route.query['type']==1">
       <template #header>
         <div class="card-header">
           <span>设备台账</span>
           <div>
-            <el-button type="primary" plain @click="addshow = true">添加</el-button>
+            <el-button type="primary" plain @click="adddevice">添加</el-button>
           </div>
         </div>
       </template>
@@ -155,7 +155,18 @@
           <el-col :span="24">
             <el-table :data="tabledata" border>
               <el-table-column v-for="item in columns.filter(i=>i.visible)" :prop="item.prop" :label="item.label" ></el-table-column>
-              <el-table-column label="操作" fixed="right" ></el-table-column>
+              <el-table-column label="操作" fixed="right" >
+                <template #default="scope">
+                <el-popconfirm title="解绑该设备?" @confirm="deleterow(scope.row)">
+                  <template #reference>
+                    <el-button link
+                    ><el-tooltip effect="dark" content="删除"
+                    ><el-icon><Delete /></el-icon></el-tooltip
+                    ></el-button>
+                  </template>
+                </el-popconfirm>
+                </template>
+              </el-table-column>
 
             </el-table>
           </el-col>
@@ -183,21 +194,20 @@
       title="设备台账"
       v-model="addshow">
 
-      <el-table height="400px">
+      <el-table :data="alldevice" height="400px">
         <el-table-column type="selection" width="55"  fixed="left" />
         <el-table-column v-for="item in columns.filter(i=>i.visible)" :prop="item.prop" :label="item.label" ></el-table-column>
       </el-table>
 
       <div style="text-align: center;display: flex;justify-content: center;margin-top: 10px" >
-
         <el-pagination style="float: right;"
                        small
                        background
                        layout="prev, pager, next"
-                       :total="pagedata.total"
-                       :page-size="pagedata.size"
-                       :current-page="pagedata.current"
-                       @current-change="onchangepage"
+                       :total="pagedata1.total"
+                       :page-size="pagedata1.size"
+                       :current-page="pagedata1.current"
+                       @current-change="onchangepage1"
                        class="mt-4"
         />
 
@@ -216,10 +226,10 @@ import {useRoute, useRouter} from "vue-router";
 
 const {proxy} = getCurrentInstance();
 const {gateway_status, flow_units, protocal_type} = proxy.useDict("gateway_status", "flow_units", "protocal_type");
-import {listModbusRtu} from "@/api/data/modbusRtu";
+import {delModbusRtu, listModbusRtu} from "@/api/data/modbusRtu";
 import {listModbusTcp} from "@/api/data/modbusTcp";
 import {updateGateway} from "@/api/data/gateway";
-import {listGatewayEquipments} from "@/api/data/equipment"
+import {listGatewayEquipmentSbook,updateEquipmentSbook} from "@/api/data/equipmentSbook"
 import {ElMessage} from "element-plus";
 
 
@@ -227,34 +237,29 @@ const route = useRoute();
 const router = useRouter();
 
 const columns = ref([
-  {label: '上层位置', prop: 'v', visible: true},
-  {label: '设备编码', prop: 'commPortId', visible: true},
-  {label: '备用编码', prop: 'commPortType', visible: true},
-  {label: '设备名称', prop: 'baudRate', visible: true},
-  {label: '设备信息', prop: 'dateBits', visible: true},
-  {label: '所属公司', prop: 'parity', visible: true},
-  {label: '所属组织机构', prop: 'stopBits', visible: true},
-  {label: '所属类型', prop: 'apiUrl', visible: true},
-  {label: '负责人', prop: 'uuid', visible: true},
-  {label: '安装日期', prop: 'intervals', visible: true},
-  {label: '安装地点地址', prop: 'protocolDesc', visible: true},
-  {label: '关联设备Id', prop: 'protocolDesc', visible: true},
-  {label: '标签', prop: 'protocolDesc', visible: true},
-  {label: '状态', prop: 'protocolDesc', visible: true},
-  {label: '保修期结束日期', prop: 'protocolDesc', visible: true},
-  {label: '制造日期', prop: 'protocolDesc', visible: true},
-  {label: '资产编码', prop: 'protocolDesc', visible: true},
-  {label: '资产编号', prop: 'protocolDesc', visible: true},
-  {label: '使用证编号', prop: 'protocolDesc', visible: true},
-  {label: '安全级别', prop: 'protocolDesc', visible: true},
-  {label: '变动日期', prop: 'protocolDesc', visible: true},
-  {label: '供货厂家', prop: 'protocolDesc', visible: true},
-  {label: '创建人', prop: 'protocolDesc', visible: true},
-  {label: '创建时间', prop: 'protocolDesc', visible: true},
-  {label: '更新人', prop: 'protocolDesc', visible: true},
-  {label: '更新时间', prop: 'protocolDesc', visible: true},
-  {label: '备注', prop: 'protocolDesc', visible: true},
-  {label: '设备编码', prop: 'protocolDesc', visible: true},
+  {label: '上层位置', prop: 'equipmentTreeId', visible: true},
+  {label: '设备编码', prop: 'sn', visible: true},
+  {label: '备用编码', prop: 'spareSn', visible: true},
+  {label: '设备名称', prop: 'name', visible: true},
+  {label: '设备信息', prop: 'equipmentInfoId', visible: true},
+  {label: '所属公司', prop: 'deptId', visible: true},
+  {label: '所属组织机构', prop: 'deptName', visible: true},
+  {label: '所属类型', prop: 'equipmentTypeId', visible: true},
+  {label: '负责人', prop: 'personInCharge', visible: true},
+  {label: '安装日期', prop: 'installationDate', visible: true},
+  {label: '安装地点地址', prop: 'address', visible: true},
+  {label: '所属网关', prop: 'gatewayId', visible: true},
+  {label: '标签', prop: 'tagids', visible: true},
+  {label: '状态', prop: 'status', visible: true},
+  {label: '保修期结束日期', prop: 'endOfWarrantyPeriod', visible: true},
+  {label: '制造日期', prop: 'manufacturingDate', visible: true},
+  {label: '资产编码', prop: 'assetNo', visible: true},
+  {label: '资产编号', prop: 'serialNumber', visible: true},
+  {label: '使用证编号', prop: 'useCertificateNo', visible: true},
+  {label: '安全级别', prop: 'usefulLife', visible: true},
+  {label: '变动日期', prop: 'changeDate', visible: true},
+  {label: '供货厂家', prop: 'supplier', visible: true},
+  {label: '备注', prop: 'remark', visible: true},
 
 ])
 
@@ -276,6 +281,19 @@ const currentgateway = ref({
 });
 
 
+const adddevice = () => {
+  addshow.value = true;
+  getalldevicedata();
+}
+const deleterow =(item)=>{
+  item.gatewayId = 0;
+  updateEquipmentSbook(item).then((res)=>{
+    ElMessage.success("解绑成功");
+    getalldata();
+  })
+}
+
+
 const savedata = () => {
   updateGateway(currentgateway.value).then(res => {
     ElMessage.success("修改成功")
@@ -300,6 +318,7 @@ const initdata = () => {
   };
 }
 
+const alldevice = ref([]);
 
 const protocallist = ref([]);
 
@@ -327,12 +346,28 @@ const pagedata = ref({
   size: 10,
   current: 1
 });
+
+const getalldevicedata = () => {
+  listGatewayEquipmentSbook({gatewayId:0, ...pagedata1.value}).then(res => {
+    alldevice.value = res.rows;
+  })
+}
+const onchangepage1 = (page) => {
+  pagedata1.value.current = page;
+  getalldevicedata();
+}
+
+const pagedata1 = ref({
+  total: 0,
+  size: 10,
+  current: 1
+});
 const getalldata = () => {
-  listGatewayEquipments({pageSize: 10000}).then(res => {
+  listGatewayEquipmentSbook({...pagedata.value,gatewayId:currentgateway.value.id}).then(res => {
     tabledata.value = res.rows;
   })
 }
-getalldata();
+
 
 
 const addshow = ref(false);
@@ -346,6 +381,7 @@ onMounted(() => {
       route.query["type"] = 0;
     }
   }
+  getalldata();
 })