dedsudiyu 1 jaar geleden
bovenliggende
commit
6430ce1bf2

+ 64 - 23
src/views/iotDevice/hardwareManagement/hardwareClassification/index.vue

@@ -35,7 +35,9 @@
       <div class="page-content-box">
         <el-table class="table-box" v-loading="loading" border :data="dataList">
           <el-table-column label="名称" prop="hardwareTypeName"  show-overflow-tooltip/>
-          <el-table-column label="标识" prop="hardwareTypeKey" width="200" show-overflow-tooltip/>
+          <el-table-column label="硬件标识" prop="hardwareTypeKey" width="200" show-overflow-tooltip/>
+          <el-table-column label="物联分类" prop="deviceTypeName" width="200" show-overflow-tooltip/>
+          <el-table-column label="物联标识" prop="deviceTypeKey" width="200" show-overflow-tooltip/>
           <el-table-column label="状态" prop="state" width="100" show-overflow-tooltip
                            v-hasPermiRouter="['iot:hardwareType:edit']">
             <template slot-scope="scope">
@@ -90,12 +92,12 @@
                :close-on-click-modal="false" :close-on-press-escape="false">
       <el-form :model="dialogForm" ref="dialogForm" :inline="true"
                :rules="dialogRules" class="addCheckPage-min" label-width="120px">
-        <el-form-item label="名称" prop="hardwareTypeName">
-          <el-input v-model="dialogForm.hardwareTypeName"
-                    placeholder="请输入名称" maxLength="10" style="width:320px;"/>
-        </el-form-item>
-        <el-form-item label="标识" prop="hardwareTypeKey">
-          <el-select v-model="dialogForm.hardwareTypeKey" placeholder="请选择标识" style="width: 320px">
+        <!--<el-form-item label="名称" prop="hardwareTypeName">-->
+          <!--<el-input v-model="dialogForm.hardwareTypeName" disabled-->
+                    <!--placeholder="请输入名称" maxLength="10" style="width:320px;"/>-->
+        <!--</el-form-item>-->
+        <el-form-item label="硬件标识" prop="hardwareTypeKey">
+          <el-select v-model="dialogForm.hardwareTypeKey" @change="hardwareChange" placeholder="请选择硬件标识" style="width: 320px">
             <el-option
               v-for="dict in keyOptionList"
               :key="dict.code"
@@ -104,20 +106,22 @@
             />
           </el-select>
         </el-form-item>
-        <div>
-          <el-form-item label="关联继电器" prop="correlationRelay">
-            <el-radio-group v-model="dialogForm.correlationRelay">
-              <el-radio :label="true" style="margin-left:20px;">是</el-radio>
-              <el-radio :label="false">否</el-radio>
-            </el-radio-group>
-          </el-form-item>
-        </div>
         <el-form-item label="状态" prop="state">
           <el-radio-group v-model="dialogForm.state">
             <el-radio :label="true" style="margin-left:20px;">启用</el-radio>
             <el-radio :label="false">禁用</el-radio>
           </el-radio-group>
         </el-form-item>
+        <el-form-item label="物联标识" prop="deviceTypeKey">
+          <el-select v-model="dialogForm.deviceTypeKey" clearable @change="deviceChange" placeholder="请选择物联标识" style="width: 320px">
+            <el-option
+              v-for="dict in iotTypeOptions"
+              :key="dict.typeKey"
+              :label="dict.typeName"
+              :value="dict.typeKey"
+            />
+          </el-select>
+        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer dialog-footer-box">
         <p class="dialog-footer-button-null"></p>
@@ -135,7 +139,8 @@ import {
   iotHardwareTypeUpdate,
   iotHardwareTypeList,
   iotHardwareTypeDelete,
-  iotHardwareTypeGetTypeKey
+  iotHardwareTypeGetTypeKey,
+  iotTypeGetAllTypes
 } from '@/api/iotDevice/index'
 
   export default {
@@ -176,25 +181,57 @@ import {
             { required: true, message: "请输入标识", trigger: "blur" },
             { required: true, message: "请输入标识", validator: this.spaceJudgment, trigger: "blur" }
           ],
-          correlationRelay: [
-            { required: true, message: "请选择是否关联", trigger: "blur" },
-            { required: true, message: "请选择是否关联", validator: this.spaceJudgment, trigger: "blur" }
-          ],
           state: [
             { required: true, message: "请选择状态", trigger: "blur" },
             { required: true, message: "请选择状态", validator: this.spaceJudgment, trigger: "blur" }
           ],
         },
+        //物联分类下拉列表
+        iotTypeOptions:[],
       }
     },
     created () {
 
     },
     mounted () {
+      this.iotTypeGetAllTypes();
       this.iotHardwareTypeGetTypeKey();
       this.getList();
     },
     methods: {
+      //硬件选中
+      hardwareChange(val){
+        let self = this;
+        this.keyOptionList.forEach((item) => {
+          if(val == item.code){
+            self.$set(self.dialogForm,'hardwareTypeKey',item.code);
+            self.$set(self.dialogForm,'hardwareTypeName',item.name);
+          }
+        });
+      },
+      //物联选中
+      deviceChange(val){
+        let self = this;
+        if(val){
+          this.iotTypeOptions.forEach((item) => {
+            if(val == item.typeKey){
+              self.$set(self.dialogForm,'deviceTypeId',item.typeId);
+              self.$set(self.dialogForm,'deviceTypeKey',item.typeKey);
+              self.$set(self.dialogForm,'deviceTypeName',item.typeName);
+            }
+          });
+        }else{
+          this.$set(this.dialogForm,'deviceTypeId','');
+          this.$set(this.dialogForm,'deviceTypeKey','');
+          this.$set(this.dialogForm,'deviceTypeName','');
+        }
+      },
+      //获取物联分类下拉列表
+      iotTypeGetAllTypes(){
+        iotTypeGetAllTypes({}).then(response => {
+          this.$set(this,'iotTypeOptions',response.data);
+        });
+      },
       //查询按钮
       handleQuery(){
         this.$set(this.queryParams,'page',1);
@@ -278,7 +315,9 @@ import {
         this.$set(this,'dialogForm',{
           hardwareTypeName:"",
           hardwareTypeKey:"",
-          correlationRelay:"",
+          deviceTypeId:"",
+          deviceTypeName:"",
+          deviceTypeKey:"",
           state:"",
         });
         this.$set(this,'dialogType',true);
@@ -288,13 +327,15 @@ import {
         this.$refs["dialogForm"].validate(valid => {
           if (valid) {
             let obj = {
-              hardwareTypeId:this.dialogForm.hardwareTypeId,
               hardwareTypeName:this.dialogForm.hardwareTypeName,
               hardwareTypeKey:this.dialogForm.hardwareTypeKey,
-              correlationRelay:this.dialogForm.correlationRelay,
+              deviceTypeId:this.dialogForm.deviceTypeId,
+              deviceTypeName:this.dialogForm.deviceTypeName,
+              deviceTypeKey:this.dialogForm.deviceTypeKey,
               state:this.dialogForm.state,
             }
             if(this.dialogForm.hardwareTypeId){
+              obj.hardwareTypeId = this.dialogForm.hardwareTypeId;
               iotHardwareTypeUpdate(obj).then(response => {
                 this.msgSuccess(response.message)
                 this.dialogOff();

+ 250 - 240
src/views/iotDevice/hardwareManagement/hardwareEquipment/index.vue

@@ -84,14 +84,14 @@
       </div>
       <div class="page-content-box">
         <el-table class="table-box" v-loading="loading" border :data="dataList">
-          <el-table-column label="设备名" prop="hardwareName"  show-overflow-tooltip/>
+          <el-table-column label="设备名" prop="hardwareName" show-overflow-tooltip/>
           <el-table-column label="编号" prop="hardwareNo" width="200" show-overflow-tooltip/>
           <el-table-column label="设备类型" prop="hardwareTypeName" width="200" show-overflow-tooltip/>
           <el-table-column label="实验室" prop="subjectName" width="200" show-overflow-tooltip>
             <template slot-scope="scope">{{scope.row.subjectName?scope.row.subjectName:'-'}}</template>
           </el-table-column>
-          <el-table-column label="继电器" prop="relayNum" width="200" show-overflow-tooltip>
-            <template slot-scope="scope">{{scope.row.relayNum?scope.row.relayNum:'-'}}</template>
+          <el-table-column label="物联编号" prop="relayNum" width="200" show-overflow-tooltip>
+            <template slot-scope="scope">{{scope.row.deviceNo?scope.row.deviceNo:'-'}}</template>
           </el-table-column>
           <el-table-column label="工作状态" prop="operatingState" width="100" show-overflow-tooltip>
             <template slot-scope="scope">
@@ -118,7 +118,7 @@
           </el-table-column>
           <el-table-column label="创建时间" prop="createTime" width="200" show-overflow-tooltip>
             <template slot-scope="scope">
-              <span>{{ parseTime(scope.row.createTime,"{y}-{m}-{d} {h}:{i}") }}</span>
+              <span>{{ parseTime(scope.row.createTime,'{y}-{m}-{d} {h}:{i}') }}</span>
             </template>
           </el-table-column>
           <el-table-column label="操作" width="200" show-overflow-tooltip v-if="tableButtonType">
@@ -172,35 +172,34 @@
             />
           </el-select>
         </el-form-item>
-        <!--当前类型关联继电器才显示下列配置-->
-        <div v-if="dialogForm.correlationRelay">
-          <el-form-item label="继电器" prop="relayId" >
-            <el-select v-model="dialogForm.relayId" placeholder="请选择继电器" style="width: 320px" @change="relayFun">
-              <el-option
-                v-for="dict in relayList"
-                :key="dict.id"
-                :label="dict.deviceName"
-                :value="dict.id"
-              />
-            </el-select>
-          </el-form-item>
-          <el-form-item label="端子" prop="relayBit">
-            <el-select v-model="dialogForm.relayBit" placeholder="请选择继电器" style="width: 320px">
-              <el-option
-                v-for="dict in terminalList"
-                :key="dict.value"
-                :label="dict.label"
-                :value="dict.value"
-              />
-            </el-select>
-          </el-form-item>
-        </div>
+        <el-form-item label="物联设备" prop="deviceId">
+          <el-select v-model="dialogForm.deviceId" @change="deviceChange" placeholder="请选择物联设备" style="width: 320px">
+            <el-option
+              v-for="dict in relayList"
+              :key="dict.id"
+              :label="dict.deviceName"
+              :value="dict.id"
+            />
+          </el-select>
+        </el-form-item>
         <el-form-item label="状态" prop="state">
           <el-radio-group v-model="dialogForm.state">
             <el-radio :label="true" style="margin-left:20px;">启用</el-radio>
             <el-radio :label="false">禁用</el-radio>
           </el-radio-group>
         </el-form-item>
+        <el-form-item label="参数 A" prop="reservedOne">
+          <el-input v-model="dialogForm.reservedOne" placeholder="请输入名称"
+                    maxLength="10" style="width:320px;"/>
+        </el-form-item>
+        <el-form-item label="参数 B" prop="reservedTwo">
+          <el-input v-model="dialogForm.reservedTwo" placeholder="请输入名称"
+                    maxLength="10" style="width:320px;"/>
+        </el-form-item>
+        <el-form-item label="参数 C" prop="reservedThree">
+          <el-input v-model="dialogForm.reservedThree" placeholder="请输入名称"
+                    maxLength="10" style="width:320px;"/>
+        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer dialog-footer-box">
         <p class="dialog-footer-button-null"></p>
@@ -212,327 +211,338 @@
   </div>
 </template>
 <script>
-import {
-  iotHardwareAdd,
-  iotHardwareUpdate,
-  iotHardwareList,
-  iotHardwareDelete, iotHardwareTypeFindHardwareType, iotDeviceFindByType
-} from '@/api/iotDevice/index'
-import { systemBuildingGetTreeList,laboratorySubRelInfoGetListByFloor } from "@/api/commonality/permission";
+  import {
+    iotHardwareAdd,
+    iotHardwareUpdate,
+    iotHardwareList,
+    iotHardwareDelete,
+    iotHardwareTypeFindHardwareType,
+    iotDeviceFindByType
+
+  } from '@/api/iotDevice/index'
+  import { systemBuildingGetTreeList, laboratorySubRelInfoGetListByFloor } from '@/api/commonality/permission'
+
   export default {
     name: 'index',
-    data () {
+    data() {
       return {
-        tableButtonType:this.hasPermiDom(['iot:hardware:edit','iot:hardware:del',]),
+        tableButtonType: this.hasPermiDom(['iot:hardware:edit', 'iot:hardware:del']),
         //页面状态
-        pageType:1,
+        pageType: 1,
         //页面遮罩
-        loading:false,
+        loading: false,
         //下拉列表数据
-        optionList:[{value:true,label:'启用'},{value:false,label:'停用'}],
-        operatingStateList:[{value:true,label:'运行中'},{value:false,label:'未运行'}],
-        terminalList:[{value:1,label:'1'},{value:2,label:'2'},{value:3,label:'3'},{value:4,label:'4'},{value:5,label:'5'},{value:6,label:'6'},{value:7,label:'7'},{value:8,label:'8'}],
+        optionList: [{ value: true, label: '启用' }, { value: false, label: '停用' }],
+        operatingStateList: [{ value: true, label: '运行中' }, { value: false, label: '未运行' }],
+        terminalList: [{ value: 1, label: '1' }, { value: 2, label: '2' }, { value: 3, label: '3' }, {
+          value: 4,
+          label: '4'
+        }, { value: 5, label: '5' }, { value: 6, label: '6' }, { value: 7, label: '7' }, { value: 8, label: '8' }],
         //查询条件
-        queryParams:{
-          page:1,
-          pageSize:20,
-          searchValue:"",
-          hardwareTypeId :null,
-          schoolId :null,
-          buildId :null,
-          subjectId :null,
-          operatingState :null,
-          state :null,
+        queryParams: {
+          page: 1,
+          pageSize: 20,
+          searchValue: '',
+          hardwareTypeId: null,
+          schoolId: null,
+          buildId: null,
+          subjectId: null,
+          operatingState: null,
+          state: null
         },
-        typeList:[],//类型
-        relayList:[],//继电器
+        typeList: [],//类型
+        relayList: [],//继电器
         //列表数据
-        dataList:[],
+        dataList: [],
         //数据数量
-        total:0,
+        total: 0,
         //组件传参
-        propsData:{},
+        propsData: {},
         //弹窗相关
-        dialogTitle:'',
-        dialogType:false,
-        dialogForm:{},
-        dialogRules:{
+        dialogTitle: '',
+        dialogType: false,
+        dialogForm: {},
+        dialogRules: {
           hardwareName: [
-            { required: true, message: "请输入名称", trigger: "blur" },
-            { required: true, message: "请输入名称", validator: this.spaceJudgment, trigger: "blur" }
+            { required: true, message: '请输入名称', trigger: 'blur' },
+            { required: true, message: '请输入名称', validator: this.spaceJudgment, trigger: 'blur' }
           ],
           hardwareNo: [
-            { required: true, message: "请输入编号", trigger: "blur" },
-            { required: true, message: "请输入编号", validator: this.spaceJudgment, trigger: "blur" }
+            { required: true, message: '请输入编号', trigger: 'blur' },
+            { required: true, message: '请输入编号', validator: this.spaceJudgment, trigger: 'blur' }
           ],
           hardwareTypeId: [
-            { required: true, message: "请选择类型", trigger: "blur" },
-            { required: true, message: "请选择类型", validator: this.spaceJudgment, trigger: "blur" }
+            { required: true, message: '请选择类型', trigger: 'blur' },
+            { required: true, message: '请选择类型', validator: this.spaceJudgment, trigger: 'blur' }
+          ],
+          deviceId: [
+            { required: true, message: '请选择物联设备', trigger: 'blur' },
+            { required: true, message: '请选择物联设备', validator: this.spaceJudgment, trigger: 'blur' }
           ],
           subjectId: [
-            { required: true, message: "请搜索选择实验室", trigger: "blur" },
-            { required: true, message: "请搜索选择实验室", validator: this.spaceJudgment, trigger: "blur" }
+            { required: true, message: '请搜索选择实验室', trigger: 'blur' },
+            { required: true, message: '请搜索选择实验室', validator: this.spaceJudgment, trigger: 'blur' }
           ],
           relayId: [
-            { required: true, message: "请选择继电器", trigger: "blur" },
-            { required: true, message: "请选择继电器", validator: this.spaceJudgment, trigger: "blur" }
+            { required: true, message: '请选择继电器', trigger: 'blur' },
+            { required: true, message: '请选择继电器', validator: this.spaceJudgment, trigger: 'blur' }
           ],
           relayBit: [
-            { required: true, message: "请选择继电器端子", trigger: "blur" },
-            { required: true, message: "请选择继电器端子", validator: this.spaceJudgment, trigger: "blur" }
+            { required: true, message: '请选择继电器端子', trigger: 'blur' },
+            { required: true, message: '请选择继电器端子', validator: this.spaceJudgment, trigger: 'blur' }
           ],
           state: [
-            { required: true, message: "请选择状态", trigger: "blur" },
-            { required: true, message: "请选择状态", validator: this.spaceJudgment, trigger: "blur" }
-          ],
+            { required: true, message: '请选择状态', trigger: 'blur' },
+            { required: true, message: '请选择状态', validator: this.spaceJudgment, trigger: 'blur' }
+          ]
         },
         //校区楼栋原始数据
-        addressList:[],
+        addressList: [],
         //校区下拉列表
-        schoolOption:[],
+        schoolOption: [],
         //楼栋下拉列表
-        buildOption:[],
+        buildOption: [],
         //实验室下拉列表
-        subjectOption:[],
+        subjectOption: [],
+        //物联分类下拉列表
+        iotTypeOptions:[],
       }
     },
-    created () {
+    created() {
 
     },
-    mounted () {
-      this.systemBuildingGetTreeList();
-      this.iotHardwareTypeFindHardwareType();
-      this.getList();
+    mounted() {
+      this.systemBuildingGetTreeList()
+      this.iotHardwareTypeFindHardwareType()
+      this.getList()
     },
     methods: {
       //查询按钮
-      handleQuery(){
-        this.$set(this.queryParams,'page',1);
-        this.getList();
+      handleQuery() {
+        this.$set(this.queryParams, 'page', 1)
+        this.getList()
       },
       //重置按钮
-      resetQuery(){
-        this.$set(this,'buildOption',[]);
-        this.$set(this,'subjectOption',[]);
-        this.$set(this,'queryParams',{
-          page:1,
-          pageSize:20,
-          searchValue:"",
-          hardwareTypeId :null,
-          schoolId :null,
-          buildId :null,
-          subjectId :null,
-          operatingState :null,
-          state :null,
-        });
-        this.getList();
+      resetQuery() {
+        this.$set(this, 'buildOption', [])
+        this.$set(this, 'subjectOption', [])
+        this.$set(this, 'queryParams', {
+          page: 1,
+          pageSize: 20,
+          searchValue: '',
+          hardwareTypeId: null,
+          schoolId: null,
+          buildId: null,
+          subjectId: null,
+          operatingState: null,
+          state: null
+        })
+        this.getList()
       },
       //获取类型
-      iotHardwareTypeFindHardwareType(){
-        let obj={
-          searchValue:'',
+      iotHardwareTypeFindHardwareType() {
+        let obj = {
+          searchValue: ''
         }
         iotHardwareTypeFindHardwareType(obj).then(response => {
-          this.$set(this,'typeList',response.data);
-        });
+          this.$set(this, 'typeList', response.data)
+        })
       },
       //类型选中
-      typeFun(){
-        for (let i=0;i<this.typeList.length;i++){
-            if(this.dialogForm.hardwareTypeId==this.typeList[i].hardwareTypeId){
-              this.$set(this.dialogForm,'correlationRelay',this.typeList[i].correlationRelay);
-              this.$set(this.dialogForm,'hardwareTypeKey',this.typeList[i].hardwareTypeKey);
-              this.$set(this.dialogForm,'hardwareTypeName',this.typeList[i].hardwareTypeName);
-            }
-        }
+      typeFun(val) {
+        let self = this;
+        this.typeList.forEach((item) => {
+          if(val == item.hardwareTypeId){
+            self.$set(self.dialogForm, 'hardwareTypeKey', item.hardwareTypeKey)
+            self.$set(self.dialogForm, 'hardwareTypeName', item.hardwareTypeName)
+            self.$set(self.dialogForm, 'deviceTypeKey', item.deviceTypeKey)
+            self.$set(self.dialogForm, 'deviceId', '')
+            self.$set(self.dialogForm, 'deviceNo','')
+            self.iotDeviceFindByType(item.deviceTypeKey);
+          }
+        });
       },
-      //继电器
-      relayFun(){
-        for (let i=0;i<this.relayList.length;i++){
-          if(this.dialogForm.relayId==this.relayList[i].id){
-            this.$set(this.dialogForm,'relayNum',this.relayList[i].deviceNo);
+      //属性选中
+      deviceChange(val){
+        let self = this;
+        this.relayList.forEach((item) => {
+          if(val == item.id){
+            self.$set(self.dialogForm, 'deviceNo', item.deviceNo)
           }
-        }
+        });
       },
       //根据类型查询物联设备
-      iotDeviceFindByType(){
-        let obj={
-          searchValue:'',
-          subjectId:this.dialogForm.subjectId,
-          typeKey:'relay',//(relay 继电器,sensor 传感器)
+      iotDeviceFindByType(val) {
+        let obj = {
+          searchValue: '',
+          typeKey: val//(relay 继电器,sensor 传感器)
         }
         iotDeviceFindByType(obj).then(response => {
-          this.$set(this,'relayList',response.data);
-        });
+          this.$set(this, 'relayList', response.data)
+        })
       },
 
       //获取数据列表
-      getList(){
-        this.$set(this,'loading',true);
+      getList() {
+        this.$set(this, 'loading', true)
         let obj = JSON.parse(JSON.stringify(this.queryParams))
         iotHardwareList(obj).then(response => {
-          this.$set(this,'loading',false);
-          this.$set(this,'dataList',response.data.records);
-          this.$set(this,'total',response.data.total);
-        });
+          this.$set(this, 'loading', false)
+          this.$set(this, 'dataList', response.data.records)
+          this.$set(this, 'total', response.data.total)
+        })
       },
 
       //操作按钮
-      tableButton(type,row){
-        let self = this;
-        if(type == 3){
+      tableButton(type, row) {
+        let self = this
+        if (type == 3) {
           //编辑
           let obj = JSON.parse(JSON.stringify(row))
-          for (let i=0;i<this.typeList.length;i++){
-            if (obj.hardwareTypeId==this.typeList[i].hardwareTypeId){
-              obj.correlationRelay=this.typeList[i].correlationRelay
-            }
-          }
-          if (obj.correlationRelay){
-            //如果设备关联有继电器进行查询
-            this.iotDeviceFindByType()
-          }
-          this.$set(this,'dialogForm',obj);
-          this.$set(this,'dialogType',true);
-        }else if(type == 4){
+          this.iotDeviceFindByType(row.deviceTypeKey)
+          this.$set(this, 'dialogForm', obj)
+          this.$set(this, 'dialogType', true)
+        } else if (type == 4) {
           //删除
-          this.$confirm('是否确认删除?', "警告", {
-            confirmButtonText: "确定",
-            cancelButtonText: "取消",
-            type: "warning"
+          this.$confirm('是否确认删除?', '警告', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
           }).then(function() {
           }).then(() => {
-            iotHardwareDelete({id:row.id}).then(response => {
+            iotHardwareDelete({ id: row.id }).then(response => {
               self.msgSuccess(response.message)
-              self.getList();
-            });
-          }).catch(() => {});
-        }else if(type == 5){
+              self.getList()
+            })
+          }).catch(() => {
+          })
+        } else if (type == 5) {
           //启用&停用
-          let text = row.state  ? "停用" : "启用";
-          this.$confirm('是否确认' + text + '?', "警告", {
-            confirmButtonText: "确定",
-            cancelButtonText: "取消",
-            type: "warning"
+          let text = row.state ? '停用' : '启用'
+          this.$confirm('是否确认' + text + '?', '警告', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
           }).then(function() {
           }).then(() => {
-            iotHardwareUpdate({id:row.id,state:!row.state,}).then(response => {
+            iotHardwareUpdate({ id: row.id, state: !row.state }).then(response => {
               self.msgSuccess(response.message)
-              self.getList();
-            });
-          }).catch(() => {});
-        }else if(type == 6){
+              self.getList()
+            })
+          }).catch(() => {
+          })
+        } else if (type == 6) {
           //返回并刷新
-          this.$set(this,'pageType',1);
-          this.getList();
+          this.$set(this, 'pageType', 1)
+          this.getList()
         }
       },
       //**************************弹窗相关**************************
       //弹层关闭
-      dialogOff(){
-        this.$set(this,'dialogType',false);
+      dialogOff() {
+        this.$set(this, 'dialogType', false)
       },
       //弹层新增
-      dialogFormReset(){
-        this.$set(this,'dialogTitle','新增');
-        this.$set(this,'dialogForm',{
-          hardwareName:"",
-          hardwareNo:"",
-          hardwareTypeId:"",
-          hardwareTypeName:"",
-          hardwareTypeKey:"",
-          correlationRelay:"",
-          subjectId:"",
-          subjectName:"",
-          relayId:"",
-          relayNum:'',
-          relayBit:'',
-          state:true,
-        });
-        this.iotDeviceFindByType()
-        this.$set(this,'dialogType',true);
+      dialogFormReset() {
+        this.$set(this, 'dialogTitle', '新增')
+        this.$set(this, 'dialogForm', {
+          hardwareName: '',
+          hardwareNo: '',
+          hardwareTypeId: '',
+          hardwareTypeName: '',
+          hardwareTypeKey: '',
+          deviceTypeKey: '',
+          deviceId: '',
+          deviceNo: '',
+          state: true,
+          reservedOne:'',
+          reservedTwo:'',
+          reservedThree:'',
+        })
+        this.$set(this, 'relayList', [])
+        this.$set(this, 'dialogType', true)
       },
       //dialog提交按钮
-      dialogSubmit(){
-        this.$refs["dialogForm"].validate(valid => {
+      dialogSubmit() {
+        this.$refs['dialogForm'].validate(valid => {
           if (valid) {
             let obj = {
-              id:this.dialogForm.id,
-              hardwareName:this.dialogForm.hardwareName,
-              hardwareNo:this.dialogForm.hardwareNo,
-              hardwareTypeId:this.dialogForm.hardwareTypeId,
-              hardwareTypeName:this.dialogForm.hardwareTypeName,
-              hardwareTypeKey:this.dialogForm.hardwareTypeKey,
-              correlationRelay:this.dialogForm.correlationRelay,
-              subjectId:this.dialogForm.subjectId,
-              subjectName:this.dialogForm.subjectName,
-              relayId:this.dialogForm.relayId,
-              relayNum:this.dialogForm.relayNum,
-              relayBit:this.dialogForm.relayBit,
-              state:this.dialogForm.state,
+              id: this.dialogForm.id,
+              hardwareName: this.dialogForm.hardwareName,
+              hardwareNo: this.dialogForm.hardwareNo,
+              hardwareTypeId: this.dialogForm.hardwareTypeId,
+              hardwareTypeName: this.dialogForm.hardwareTypeName,
+              hardwareTypeKey: this.dialogForm.hardwareTypeKey,
+              deviceTypeKey: this.dialogForm.deviceTypeKey,
+              deviceId: this.dialogForm.deviceId,
+              deviceNo: this.dialogForm.deviceNo,
+              state: this.dialogForm.state,
+              reservedOne:this.dialogForm.reservedOne,
+              reservedTwo:this.dialogForm.reservedTwo,
+              reservedThree:this.dialogForm.reservedThree,
             }
-            if(this.dialogForm.id){
+            if (this.dialogForm.id) {
               iotHardwareUpdate(obj).then(response => {
                 this.msgSuccess(response.message)
-                this.dialogOff();
-                this.getList();
-              });
-            }else{
+                this.dialogOff()
+                this.getList()
+              })
+            } else {
               iotHardwareAdd(obj).then(response => {
                 this.msgSuccess(response.message)
-                this.dialogOff();
-                this.getList();
-              });
+                this.dialogOff()
+                this.getList()
+              })
             }
           }
         })
       },
       //获取校区
-      systemBuildingGetTreeList(){
+      systemBuildingGetTreeList() {
         systemBuildingGetTreeList({}).then(response => {
-          let list = [];
-          for(let i=0;i<response.data.length;i++){
+          let list = []
+          for (let i = 0; i < response.data.length; i++) {
             list.push({
-              id:response.data[i].id,
-              name:response.data[i].name,
+              id: response.data[i].id,
+              name: response.data[i].name
             })
           }
-          this.$set(this,'schoolOption',list);
-          this.$set(this,'addressList',response.data);
+          this.$set(this, 'schoolOption', list)
+          this.$set(this, 'addressList', response.data)
         })
       },
       //校区选中
-      changeSchool(val){
-        let self = this;
-        let list = [];
-        for(let i=0;i<self.addressList.length;i++){
-          if(val == self.addressList[i].id && self.addressList[i].buildFloorVoList[0]){
-            for(let o=0;o<self.addressList[i].buildFloorVoList.length;o++){
+      changeSchool(val) {
+        let self = this
+        let list = []
+        for (let i = 0; i < self.addressList.length; i++) {
+          if (val == self.addressList[i].id && self.addressList[i].buildFloorVoList[0]) {
+            for (let o = 0; o < self.addressList[i].buildFloorVoList.length; o++) {
               list.push({
-                id:self.addressList[i].buildFloorVoList[o].id,
-                name:self.addressList[i].buildFloorVoList[o].name,
+                id: self.addressList[i].buildFloorVoList[o].id,
+                name: self.addressList[i].buildFloorVoList[o].name
               })
             }
           }
         }
-        this.$set(this.queryParams,'buildId',null);
-        this.$set(this.queryParams,'subjectId',null);
-        this.$set(this,'buildOption',list);
-        this.$set(this,'subjectOption',[]);
+        this.$set(this.queryParams, 'buildId', null)
+        this.$set(this.queryParams, 'subjectId', null)
+        this.$set(this, 'buildOption', list)
+        this.$set(this, 'subjectOption', [])
       },
       //楼栋选中
-      buildSchool(val){
-        laboratorySubRelInfoGetListByFloor({buildId:val}).then(response => {
-          this.$set(this.queryParams,'subjectId',null);
-          this.$set(this,'subjectOption',response.data);
+      buildSchool(val) {
+        laboratorySubRelInfoGetListByFloor({ buildId: val }).then(response => {
+          this.$set(this.queryParams, 'subjectId', null)
+          this.$set(this, 'subjectOption', response.data)
         })
-      },
-    },
+      }
+    }
   }
 </script>
 <style scoped lang="scss">
-  .hardwareEquipment{
-    .hardwareEquipmentPage{
+  .hardwareEquipment {
+    .hardwareEquipmentPage {
 
     }
   }