wenhongquan il y a 2 ans
Parent
commit
4af8903124

+ 1 - 1
ruoyi-admin/src/main/resources/application-dev.yml

@@ -49,7 +49,7 @@ spring:
           driverClassName: com.mysql.cj.jdbc.Driver
           # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
           # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
-          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
+          url: jdbc:mysql://${DBHOST:200.200.19.121}:${DBPORT:31000}/iotc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
           username: ${DBUSER:root}
           password: ${DBPWD:root}
         # 从库数据源

+ 1 - 1
ruoyi-admin/src/main/resources/application.yml

@@ -274,4 +274,4 @@ mqtt:
   user: ${MQTT_USER:iotc}
   password: ${MQTT_PWD:iotc}
   topic: ${MQTT_TOPIC:/sensor/#}
-  saveAndForward: ${DATASAVE:false}
+  saveAndForward: ${DATASAVE:true}

+ 46 - 7
ruoyi-ui-vue3/src/views/device/equipmentdash/add.vue

@@ -6,8 +6,8 @@
           <span v-show="objId == null">设备台账-新增</span>
           <span v-show="objId != null">设备台账-修改</span>
           <div>
-            <el-button type="warning" @click="" v-if="isDisabled.value">复位</el-button>
-            <el-button type="primary" @click="submit()" v-if="isDisabled.value">保存</el-button>
+            <el-button type="warning" @click="inintdata" v-if="!isDisabled">复位</el-button>
+            <el-button type="primary" @click="submit" v-if="!isDisabled">保存</el-button>
             <el-button type="primary" plain @click="router.back();">返回</el-button>
           </div>
         </div>
@@ -342,7 +342,7 @@
         <div class="card-header" >
           <span>Mqtt分发</span>
           <div>
-            <el-button type="primary" plain @click="getnoListByDeviceId" v-if="isDisabled.value">添加</el-button>
+            <el-button type="primary" plain @click="getnoListByDeviceId" v-if="!isDisabled">添加</el-button>
           </div>
         </div>
       </template>
@@ -373,7 +373,7 @@
           </el-table-column>
           <el-table-column prop="name" label="操作" width="150">
             <template #default="scope">
-              <el-popconfirm title="确定解绑该设备?" @confirm="dellink(scope.row)" v-if="isDisabled.value">
+              <el-popconfirm title="确定解绑该设备?" @confirm="dellink(scope.row)" v-if="isDisabled">
                 <template #reference>
                   <el-button link><el-tooltip effect="dark" content="解绑设备"><el-icon>
                         <Delete />
@@ -430,8 +430,40 @@ const router = useRouter();
 
 const { proxy } = getCurrentInstance();
 
-const isDisabled = ref(true)
+const isDisabled = ref(true);
 
+
+const inintdata = () => {
+  var id = queryParams.value.id;
+  queryParams.value = ({
+  id: id,
+  equipmentTreeId: "",
+  sn: "",
+  spareSn: "",
+  name: "",
+  equipmentInfoId: "",
+  deptId: "",
+  deptName: "",
+  equipmentTypeId: "",
+  personInCharge: "",
+  installationDate: "",
+  address: "",
+  gatewayId: "",
+  tagids: "",
+  status: "",
+  endOfWarrantyPeriod: "",
+  manufacturingDate: "",
+  assetNo: "",
+  serialNumber: "",
+  useCertificateNo: "",
+  securityLevel: "",
+  usefulLife: "",
+  changeDate: "",
+  supplier: "",
+  dialogFormVisible: true,
+})
+
+}
 const queryParams = ref({
   id: null,
   equipmentTreeId: "",
@@ -464,11 +496,18 @@ const tagidArry = ref([])
 
 const listSelectId = ref([])
 const mqttSelect = ref([])
+ let objId = route.query.id
+try {
 
-let objId = route.query.id
 console.log(objId);
-isDisabled.value = route.query.isEdit
+
+isDisabled.value = route.query.isEdit ?? false;
+
 console.log(isDisabled.value)
+} catch (error) {
+
+}
+
 // queryParams.value = router.params;
 
 const equipmentObj = ref({

+ 11 - 3
ruoyi-ui-vue3/src/views/gateway/manager/add.vue

@@ -232,7 +232,7 @@ const {proxy} = getCurrentInstance();
 const {gateway_status, flow_units, protocal_type} = proxy.useDict("gateway_status", "flow_units", "protocal_type");
 import {delModbusRtu, listModbusRtu} from "@/api/data/modbusRtu";
 import {listModbusTcp} from "@/api/data/modbusTcp";
-import {updateGateway} from "@/api/data/gateway";
+import {updateGateway,addGateway} from "@/api/data/gateway";
 import {listEquipmentSbook,updateEquipmentSbook} from "@/api/data/equipmentSbook"
 import {ElMessage} from "element-plus";
 import {cloneDeep} from "lodash";
@@ -313,9 +313,17 @@ const dosave = () => {
   addshow.value = false;
 }
 const savedata = () => {
-  updateGateway(currentgateway.value).then(res => {
-    ElMessage.success("修改成功")
+  if (currentgateway.value.id != undefined && currentgateway.value.id!= null) {
+    updateGateway(currentgateway.value).then(res => {
+      ElMessage.success("修改成功")
+    });
+
+  }else {
+     addGateway(currentgateway.value).then(res => {
+    ElMessage.success("添加成功")
   });
+  }
+
 }
 const initdata = () => {
   currentgateway.value = {