dedsudiyu 1 年之前
父節點
當前提交
fb819de3d9

+ 50 - 0
src/api/medicUniversity-3_1/index.js

@@ -706,3 +706,53 @@ export function getRestStockByManyCabinet(query) {
     params: query
   })
 }
+
+/*******************************柜锁配置********************************/
+
+// 柜锁配置-列表
+export function laboratoryLockGatewayList(query) {
+  return request({
+    url: '/laboratory/lockGateway/list',
+    method: 'get',
+    params: query
+  })
+}
+// 柜锁配置-详情
+export function laboratoryLockGatewayId(id) {
+  return request({
+    url: '/laboratory/lockGateway/'+id,
+    method: 'get',
+  })
+}
+// 柜锁配置-详情
+export function laboratoryLockGatewayGetList(query) {
+  return request({
+    url: '/laboratory/lockGateway/getList',
+    method: 'get',
+    params: query
+  })
+}
+// 柜锁配置-新增
+export function laboratoryLockGatewayAdd(data) {
+  return request({
+    url: '/laboratory/lockGateway',
+    method: 'post',
+    data: data
+  })
+}
+//柜锁配置-修改
+export function laboratoryLockGatewayPut(data) {
+  return request({
+    url: '/laboratory/lockGateway',
+    method: 'put',
+    data: data
+  })
+}
+//柜锁配置-删除
+export function laboratoryLockGatewayDelGateway(data) {
+  return request({
+    url: '/laboratory/lockGateway/delGateway',
+    method: 'put',
+    data: data
+  })
+}

+ 280 - 0
src/views/medicUniversity-3_1/chemicalManagement/chemicalLibrary/cabinetLockDisposition/index.vue

@@ -0,0 +1,280 @@
+<!-- 柜锁配置 -->
+<template>
+  <div class="app-container cabinetLockDisposition">
+    <div class="cabinetLockDispositionPage" v-if="pageType === 1">
+      <div class="page-form-title-box">
+        <el-form :model="queryParams" class="form-box" ref="queryForm"
+                 :inline="true" style="width:100%;">
+          <el-form-item label="名称" prop="gatewayName" label-width="90px">
+            <el-input
+              maxLength="30"
+              v-model="queryParams.gatewayName"
+              placeholder="请输入"
+              clearable
+              style="width: 200px"
+            />
+          </el-form-item>
+          <el-form-item style="float: right;">
+            <el-col :span="1.5">
+              <p class="add-button-one-90"
+                 @click="tableButton(1)"
+                 v-hasPermi="['demo:demo:add']"
+              >新增</p>
+            </el-col>
+          </el-form-item>
+          <el-form-item>
+            <p class="inquire-button-one" @click="handleQuery" style="margin-right:10px;">查询</p>
+            <p class="reset-button-one" @click="resetQuery">重置</p>
+          </el-form-item>
+        </el-form>
+      </div>
+      <div class="page-content-box">
+        <el-table class="table-box" v-loading="loading" border :data="dataList">
+          <el-table-column label="名称" prop="gatewayName"  show-overflow-tooltip/>
+          <el-table-column label="地址" prop="gatewayMac" width="300" show-overflow-tooltip/>
+          <el-table-column label="创建人" prop="createBy" width="200" show-overflow-tooltip/>
+          <el-table-column label="创建时间" prop="createTime" width="200" show-overflow-tooltip>
+            <template slot-scope="scope">
+              <span>{{ parseTime(scope.row.createTime) }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="操作" width="200" show-overflow-tooltip v-if="tableButtonType">
+            <template slot-scope="scope">
+              <div class="table-button-box">
+                <p class="table-button-null"></p>
+                <p class="table-button-p"
+                   @click="tableButton(2,scope.row)"
+                   v-hasPermi="['demo:demo:detail']"
+                >详情</p>
+                <p class="table-button-p"
+                   @click="tableButton(3,scope.row)"
+                   v-hasPermi="['demo:demo:edit']"
+                >编辑</p>
+                <p class="table-button-p"
+                   @click="tableButton(4,scope.row)"
+                   v-hasPermi="['demo:demo:del']"
+                >删除</p>
+                <p class="table-button-null"></p>
+              </div>
+            </template>
+          </el-table-column>
+        </el-table>
+        <pagination :page-sizes="[20, 30, 40, 50]"
+                    v-show="total>0"
+                    :total="total"
+                    :page.sync="queryParams.pageNum"
+                    :limit.sync="queryParams.pageSize"
+                    @pagination="getList"
+        />
+      </div>
+    </div>
+    <el-dialog :title="dialogTitle" :visible.sync="dialogType " @close="handleClose" width="500px" append-to-body>
+      <div style="text-align: center">
+        <el-form ref="dialogForm" :model="dialogForm" :rules="rules" label-width="80px">
+          <el-form-item label="名称:" prop="gatewayName" style="margin-bottom:40px;">
+            <el-input
+              :disabled="dialogForm.showType"
+              v-model="dialogForm.gatewayName"
+              maxlength="25"
+              placeholder="请输入名称"
+            />
+          </el-form-item>
+          <el-form-item label="地址:" prop="gatewayMac" style="margin-bottom:40px;">
+            <el-input
+              :disabled="dialogForm.showType"
+              v-model="dialogForm.gatewayMac"
+              maxlength="25"
+              placeholder="请输入地址"
+            />
+          </el-form-item>
+        </el-form>
+        <div slot="footer" class="dialog-footer">
+          <p class="dialog-footer-null-p"></p>
+          <el-button @click="handleClose">{{dialogForm.showType?'关 闭':'取 消'}}</el-button>
+          <el-button type="primary" @click="submitForm" v-if="!dialogForm.showType">确 定</el-button>
+          <p class="dialog-footer-null-p"></p>
+        </div>
+        <!--        <vue-qr id="form1"  style="display: block;height:200px;width:200px;cursor:pointer;margin:0 auto;" text="12123123123123" :size="200"></vue-qr>-->
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import { laboratoryLockGatewayList,laboratoryLockGatewayId,laboratoryLockGatewayAdd,laboratoryLockGatewayPut,laboratoryLockGatewayDelGateway } from "@/api/medicUniversity-3_1/index";
+  export default {
+    name: 'index',
+    data () {
+      return {
+        tableButtonType:this.hasPermiDom(['demo:demo:detail','demo:demo:edit','demo:demo:del',]),
+        //页面状态
+        pageType:1,
+        //页面遮罩
+        loading:false,
+        //下拉列表数据
+        optionList:[{value:true,label:'启用'},{value:false,label:'停用'}],
+        //查询条件
+        queryParams:{
+          pageNum:1,
+          pageSize:20,
+          gatewayName:"",
+        },
+        //列表数据
+        dataList:[],
+        //数据数量
+        total:0,
+        //组件传参
+        dialogTitle:'',
+        dialogForm:{},
+        dialogType:false,
+        rules: {
+          gatewayName: [
+            { required: true, message: "请输入名称", trigger: "blur" },
+            { required: true, message: "请输入名称", validator: this.spaceJudgmentHTML, trigger: "blur" }
+          ],
+          gatewayMac: [
+            { required: true, message: "请输入地址", trigger: "blur" },
+            { required: true, message: "请输入地址", validator: this.spaceJudgmentHTML, trigger: "blur" }
+          ],
+        },
+      }
+    },
+    created () {
+
+    },
+    mounted () {
+      this.getList();
+    },
+    methods: {
+      //查询按钮
+      handleQuery(){
+        this.$set(this.queryParams,'page',1);
+        this.getList();
+      },
+      //重置按钮
+      resetQuery(){
+        this.$set(this,'queryParams',{
+          pageNum:1,
+          pageSize:20,
+          gatewayName:"",
+        });
+        this.getList();
+      },
+      //获取数据列表
+      getList(){
+        this.$set(this,'loading',true);
+        laboratoryLockGatewayList(this.queryParams).then(response => {
+          this.$set(this,'dataList',response.rows);
+          this.$set(this,'total',response.total);
+          this.$set(this,'loading',false);
+        });
+      },
+      //操作按钮
+      tableButton(type,row){
+        let self = this;
+        if(type == 1){
+          //新增
+          this.$set(this,'dialogTitle','新增');
+          this.$set(this,'dialogForm',{
+            showType:false,
+            gatewayName:'',
+            gatewayMac:'',
+          });
+          this.$set(this,'dialogType',true);
+        }else if(type == 2){
+          //详情
+          let obj = JSON.parse(JSON.stringify(row))
+          obj.showType = true;
+          this.$set(this,'dialogTitle','详情');
+          this.$set(this,'dialogForm',obj);
+          this.$set(this,'dialogType',true);
+        }else if(type == 3){
+          //编辑
+          let obj = JSON.parse(JSON.stringify(row))
+          obj.showType = false;
+          this.$set(this,'dialogTitle','编辑');
+          this.$set(this,'dialogForm',obj);
+          this.$set(this,'dialogType',true);
+        }else if(type == 4){
+          //删除
+          this.$confirm('是否确认删除?', "警告", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          }).then(function() {
+          }).then(() => {
+            laboratoryLockGatewayDelGateway({id:row.id}).then(response => {
+              self.msgSuccess(response.message)
+              self.getList();
+            });
+          }).catch(() => {});
+        }
+      },
+      //弹窗相关
+
+      //监听关联记录弹窗关闭
+      handleClose(){
+        this.$refs["dialogForm"].clearValidate();
+        this.$set(this,'dialogType',false);
+      },
+      //提交
+      submitForm(){
+        this.$refs["dialogForm"].validate(valid => {
+          if (valid) {
+            if(this.dialogForm.id){
+              //编辑
+              let obj = {
+                id:this.dialogForm.id,
+                gatewayName:this.dialogForm.gatewayName,
+                gatewayMac:this.dialogForm.gatewayMac,
+              }
+              laboratoryLockGatewayPut(obj).then(response => {
+                this.$set(this,'dialogType',false);
+                this.msgSuccess(response.msg)
+                this.getList();
+              });
+            }else{
+              //新增
+              let obj = {
+                gatewayName:this.dialogForm.gatewayName,
+                gatewayMac:this.dialogForm.gatewayMac,
+              }
+              laboratoryLockGatewayAdd(obj).then(response => {
+                this.$set(this,'dialogType',false);
+                this.msgSuccess(response.msg)
+                this.getList();
+              });
+            }
+          }
+        })
+      }
+    },
+  }
+</script>
+<style scoped lang="scss">
+  .cabinetLockDisposition{
+    flex: 1;
+    display: flex;
+    flex-direction: column;
+    overflow: hidden;
+    .cabinetLockDispositionPage{
+      flex: 1;
+      display: flex;
+      flex-direction: column;
+      overflow: hidden;
+      .page-form-title-box{
+        padding-top:20px;
+        display: flex;
+        border-bottom:1px solid #dedede;
+      }
+      .page-content-box{
+        padding:20px;
+        flex: 1;
+        display: flex;
+        flex-direction: column;
+        overflow: hidden;
+      }
+
+    }
+  }
+</style>

+ 97 - 12
src/views/medicUniversity-3_1/chemicalManagement/deviceManagement/smartLocker/index.vue

@@ -89,7 +89,9 @@
           <!--<template slot-scope="scope">{{scope.row.status == 3||scope.row.status == 4?'在线':'离线'}}</template>-->
         <!--</el-table-column>-->
         <el-table-column label="关联化学品柜" align="center" prop="cabinetName" width="160"/>
-        <el-table-column label="锁柜ID" align="center" prop="lockId" width="100"/>
+        <el-table-column label="锁柜ID/mac地址" align="center" prop="lockId" width="140">
+          <template slot-scope="scope">{{scope.row.lockType==1?scope.row.lockId:scope.row.lockMac}}</template>
+        </el-table-column>
         <el-table-column label="摄像头IP" align="center" prop="ipAddress" width="200"/>
         <el-table-column label="采集器编号" align="center" prop="relayCode" width="200"/>
         <!--<el-table-column label="操作最大时长" align="center" prop="operateTime" width="120">-->
@@ -195,15 +197,29 @@
             </el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="锁柜ID:" prop="lockId">
-          <el-input v-model="form.lockId" placeholder="0-253" maxlength="3" style="width:360px;" onkeyup="value=value.replace(/[^\d]/g,'')"/>
-        </el-form-item>
         <el-form-item label="摄像头IP:" prop="ipAddress">
           <el-input v-model="form.ipAddress" placeholder="请输入摄像头IP" maxlength="20" style="width:360px;"/>
         </el-form-item>
-        <el-form-item label="采集器编号:" prop="relayCode">
+        <el-form-item label="柜锁类型" prop="lockType">
+          <el-select v-model="form.lockType" placeholder="请选择柜锁类型" style="width:360px;">
+            <el-option label="485" :value="1"></el-option>
+            <el-option label="蓝牙" :value="2"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="锁柜ID:" prop="lockId">
+          <el-input v-model="form.lockId" placeholder="0-253" maxlength="3" style="width:360px;" onkeyup="value=value.replace(/[^\d]/g,'')"/>
+        </el-form-item>
+        <el-form-item label="采集器编号:" prop="relayCode" v-if="form.lockType == 1">
           <el-input v-model="form.relayCode" placeholder="请输入采集器编号" maxlength="20" onkeyup="value=value.replace(/[^\w\.\/]/ig,'')" style="width:360px;"/>
         </el-form-item>
+        <el-form-item label="mac地址:" prop="lockMac" v-if="form.lockType == 2">
+          <el-input v-model="form.lockMac" placeholder="请输入mac地址,多个请用逗号隔开如:8.8.8.8,9.9.9.9" maxlength="20" style="width:360px;"/>
+        </el-form-item>
+        <el-form-item label="蓝牙网关" prop="gatewayId" v-if="form.lockType == 2">
+          <el-select v-model="form.gatewayId" placeholder="请选择蓝牙网关" style="width:360px;">
+            <el-option v-for="(item,index) in optionsLockGateway" :key="index" :label="item.gatewayName" :value="item.id"></el-option>
+          </el-select>
+        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>
@@ -237,7 +253,7 @@
 
 <script>
   import { hxpSmartTerminal,filterDept,getSubList,addHxpSmartTerminal,putHxpSmartTerminal,getHxpSmartTerminal,delHxpSmartTerminal } from "@/api/medicUniversity-3_1/index";
-  import { listHardware, delHardware, addHardware, updateHardware,setLock,getCabinetLockList } from "@/api/medicUniversity-3_1/index";
+  import { listHardware, delHardware, addHardware, updateHardware,setLock,getCabinetLockList,laboratoryLockGatewayGetList } from "@/api/medicUniversity-3_1/index";
   import { listDepartments } from "@/api/system/dept";
   import { getToken } from "@/utils/auth";
   import associatedCabinetLock from "./associatedCabinetLock.vue"
@@ -327,6 +343,12 @@
           subjectId: [
             { required: true, trigger: "blur", message: "搜索选择实验室" },
           ],
+          lockType: [
+            { required: true, trigger: "blur", message: "请选择柜锁类型" },
+          ],
+          gatewayId: [
+            { required: true, trigger: "blur", message: "请选择蓝牙网关" },
+          ],
           operateTime: [
             { required: true, trigger: "blur", message: "请输入操作时长" },
             { required: true, message: "请输入操作时长", validator: this.spaceJudgment, trigger: "blur" },
@@ -341,6 +363,10 @@
             { required: true, trigger: "blur", message: "请输入摄像头ip" },
             { required: true, message: "请输入摄像头ip", validator: this.spaceJudgment, trigger: "blur" }
           ],
+          lockMac: [
+            { required: true, trigger: "blur", message: "请输入mac地址" },
+            { required: true, message: "请输入mac地址", validator: this.spaceJudgment, trigger: "blur" }
+          ],
           relayCode: [
             { required: true, trigger: "blur", message: "请输入采集器编号" },
             { required: true, message: "请输入采集器编号", validator: this.spaceJudgment, trigger: "blur" }
@@ -353,17 +379,25 @@
         operationRecordPropsData:{},
         //关联记录传参数据
         associatedCabinetLockPropsData:{},
+        //柜锁MAC列表
+        optionsLockGateway:[],
       };
     },
     created() {
 
     },
     mounted(){
+      this.laboratoryLockGatewayGetList();
       this.filterDept();
       this.listDepartments();
       this.getList();
     },
     methods: {
+      laboratoryLockGatewayGetList(){
+        laboratoryLockGatewayGetList().then(response => {
+          this.$set(this,'optionsLockGateway',response.data);
+        });
+      },
       selectFocus(){
         if(!this.selectList[0]){
           this.filterDept();
@@ -393,8 +427,15 @@
           //新增
           this.dialogTitle = '新增';
           this.$set(this,'form',{
-            hardwareNum:"",
-            subjectId:""
+            subjectId:'',
+            name:'',
+            hardwareNum:'',
+            lockId:'',
+            ipAddress:'',
+            relayCode:'',
+            lockType:'',
+            gatewayId:'',
+            lockMac:'',
           });
           this.clearClick();
           this.addDialogType = true;
@@ -409,6 +450,9 @@
             lockId:item.lockId,
             ipAddress:item.ipAddress,
             relayCode:item.relayCode,
+            lockType:item.lockType,
+            lockMac:item.lockMac,
+            gatewayId:item.gatewayId,
           };
           this.$set(this,'form',obj);
           this.clearClick();
@@ -501,8 +545,29 @@
           if (valid) {
             if(this.form.id){
               //编辑
-              this.form.type = "AI_CABINETLOCK";
-              updateHardware(this.form).then(response => {
+              let obj = {
+                id:this.form.id,
+                type:'AI_CABINETLOCK',
+                subjectId:this.form.subjectId,
+                name:this.form.name,
+                hardwareNum:this.form.hardwareNum,
+                lockId:this.form.lockId,
+                ipAddress:this.form.ipAddress,
+                relayCode:this.form.relayCode,
+                lockType:this.form.lockType,
+              }
+              if(obj.lockType == 1){
+                obj.lockId=this.form.lockId;
+                obj.relayCode=this.form.relayCode;
+                obj.gatewayId='';
+                obj.lockMac='';
+              }else if(obj.lockType == 2){
+                obj.gatewayId=this.form.gatewayId;
+                obj.lockMac=this.form.lockMac;
+                obj.lockId=this.form.lockId;
+                obj.relayCode='';
+              }
+              updateHardware(obj).then(response => {
                 if (response.code == 200){
                   this.addDialogType = false;
                   this.msgSuccess(response.msg);
@@ -511,8 +576,28 @@
               });
             }else{
               //新增
-              this.form.type = "AI_CABINETLOCK";
-              addHardware(this.form).then(response => {
+              let obj = {
+                type:'AI_CABINETLOCK',
+                subjectId:this.form.subjectId,
+                name:this.form.name,
+                hardwareNum:this.form.hardwareNum,
+                lockId:this.form.lockId,
+                ipAddress:this.form.ipAddress,
+                relayCode:this.form.relayCode,
+                lockType:this.form.lockType,
+              }
+              if(obj.lockType == 1){
+                obj.lockId=this.form.lockId;
+                obj.relayCode=this.form.relayCode;
+                obj.gatewayId='';
+                obj.lockMac='';
+              }else if(obj.lockType == 2){
+                obj.gatewayId=this.form.gatewayId;
+                obj.lockMac=this.form.lockMac;
+                obj.lockId=this.form.lockId;
+                obj.relayCode='';
+              }
+              addHardware(obj).then(response => {
                 if (response.code == 200){
                   this.addDialogType = false;
                   this.msgSuccess(response.msg);