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

+ 53 - 33
src/views/chemicalManage/basicManagement/chemicalsCabinetManage/addPage.vue

@@ -111,7 +111,7 @@
             <div class="item-box">
               <el-form-item label="开门方式:" label-width="100px"
                             :prop="'cabinetDoorModelList.'+ index +'.unlockingMethod'" :rules="rules.unlockingMethod">
-                <el-select v-model="item.unlockingMethod" placeholder="请选择开门方式" @change="unlockingMethodChange(item)" style="width: 460px">
+                <el-select v-model="item.unlockingMethod" placeholder="请选择开门方式" @change="unlockingMethodChange(index)" style="width: 460px">
                   <el-option
                     v-for="item in openOptions"
                     :key="item.value"
@@ -124,7 +124,7 @@
             <div class="item-box" v-if="item.unlockingMethod == 2">
               <el-form-item label="智能锁:" label-width="100px"
                             :prop="'cabinetDoorModelList.'+ index +'.cabinetLockList'" :rules="rules.cabinetLockList">
-                <el-select v-model="item.cabinetLockList" multiple placeholder="请选择" @change="lockChange(item)"  :multiple-limit='2' style="width: 460px">
+                <el-select v-model="item.cabinetLockList" multiple placeholder="请选择" @change="(val)=>lockChange(index,val)"  :multiple-limit='2' style="width: 460px">
                   <el-option
                     v-for="item in lockOptions"
                     :key="item.lockId"
@@ -138,7 +138,7 @@
             <div class="item-box" v-if="item.unlockingMethod == 3" style="display: flex;">
               <el-form-item label="钥匙柜:" label-width="100px"
                             :prop="'cabinetDoorModelList.'+ index +'.cabinetLockList'" :rules="rules.cabinetLockList">
-                <el-select v-model="item.cabinetLockList" multiple placeholder="请选择"  @change="cabinetLockChange(item)" :multiple-limit='1' style="width: 180px">
+                <el-select v-model="item.cabinetLockList" multiple placeholder="请选择"  @change="(val)=>cabinetLockChange(index,val)" :multiple-limit='1' style="width: 180px">
                   <el-option
                     v-for="item in keyCabinetOptions"
                     :key="item.lockId"
@@ -200,7 +200,7 @@
         openOptions:[
           {label:'无锁',value:'1'},
           {label:'智能锁',value:'2'},
-          {label:'钥匙柜',value:'3'},
+          // {label:'钥匙柜',value:'3'},
         ],
         lockOptions:[],
         keyCabinetOptions:[
@@ -410,6 +410,13 @@
       },
       //学院选中
       deptChange(){
+        this.$set(this.newData,'subId','');
+        this.$set(this,'userOptions',[]);
+        this.newData.cabinetDoorModelList.forEach((item)=>{
+          item.cabinetLockList = [];
+          item.cabinetLockListArr = [];
+          item.cabinetAdminModelList = [];
+        })
         for (let i=0;i<this.deptOptions.length;i++){
           if (this.newData.deptId==this.deptOptions[i].deptId){
             this.$set(this.newData, 'deptName', this.deptOptions[i].deptName)
@@ -430,6 +437,11 @@
       },
       //实验室选中
       subChange(){
+        this.newData.cabinetDoorModelList.forEach((item)=>{
+          item.cabinetLockList = [];
+          item.cabinetLockListArr = [];
+          item.cabinetAdminModelList = [];
+        })
         this.adminAndSafeFun();
         this.iotDeviceFindByType(this.newData.subId);
       },
@@ -497,45 +509,53 @@
         }
       },
       //开门方式切换
-      unlockingMethodChange(data){
-        data.cabinetLockList=[];
+      unlockingMethodChange(index){
+        this.$set(this.newData.cabinetDoorModelList[index],'cabinetLockList',[]);
+        this.$set(this.newData.cabinetDoorModelList[index],'cabinetLockListArr',[]);
       },
       //查询智能锁列表
       iotDeviceFindByType(subId){
         iotDeviceFindByType({subjectId:subId,typeKeyList:['cabinetLock']}).then(response => {
-          if (response.data[0]){
-            let list=[];
-            response.data.forEach(function(item) {
-              list.push({lockName:item.deviceName,lockId:item.id,lockNum:item.deviceNo})
-            })
-            this.$set(this, 'lockOptions', list)
-          }
+          let list=[];
+          response.data.forEach(function(item) {
+            list.push({lockName:item.deviceName,lockId:item.id,lockNum:item.deviceNo})
+          })
+          this.$set(this, 'lockOptions', list)
         });
       },
       //智能锁选中触发
-      lockChange(data){
-         let list=[];//智能锁临时存储
-         for (let i=0;i<data.cabinetLockList.length;i++){
-           for (let b=0;b<this.lockOptions.length;b++){
-              if (data.cabinetLockList[i]==this.lockOptions[b].lockId){
-                list.push({lockName:this.lockOptions[b].lockName,lockId:this.lockOptions[b].lockId,lockNum:this.lockOptions[b].lockNum})
-              }
-           }
-         }
-         data.cabinetLockListArr=list;
-         this.$forceUpdate()
+      lockChange(index,val){
+        let self = this;
+        let list=[];
+        val.forEach((item)=>{
+          self.lockOptions.forEach((minItem)=>{
+            if(item == minItem.lockId){
+              list.push({
+                lockName:minItem.lockName,
+                lockId:minItem.lockId,
+                lockNum:minItem.lockNum
+              })
+            }
+          })
+        })
+        this.$set(this.newData.cabinetDoorModelList[index],'cabinetLockListArr',list);
       },
       //钥匙柜选中触发
-      cabinetLockChange(data){
-        let list=[];//钥匙柜临时存储
-        for (let i=0;i<data.cabinetLockList.length;i++){
-          for (let b=0;b<this.keyCabinetOptions.length;b++){
-            if (data.cabinetLockList[i]==this.keyCabinetOptions[b].lockId){
-              list.push({lockName:this.keyCabinetOptions[b].lockName,lockId:this.keyCabinetOptions[b].lockId,lockNum:this.keyCabinetOptions[b].lockNum})
+      cabinetLockChange(index,val){
+        let self = this;
+        let list=[];
+        val.forEach((item)=>{
+          self.keyCabinetOptions.forEach((minItem)=>{
+            if(item == minItem.lockId){
+              list.push({
+                lockName:minItem.lockName,
+                lockId:minItem.lockId,
+                lockNum:minItem.lockNum
+              })
             }
-          }
-        }
-        data.cabinetLockListArr=list;
+          })
+        })
+        this.$set(this.newData.cabinetDoorModelList[index],'cabinetLockListArr',list);
       },
 
       //添加柜门

+ 3 - 3
src/views/chemicalManage/basicManagement/chemicalsCabinetManage/index.vue

@@ -97,13 +97,13 @@
     <qr-code-dialog ref="qrCodeDialog" :qrCodeDialogData="qrCodeDialogData"></qr-code-dialog>
     <add-page :propsData="propsData" v-if="pageType === 2"></add-page>
     <list-page :propsData="propsData" v-if="pageType === 3"></list-page>
-    <records-page :propsData="propsData" v-if="pageType === 4"></records-page>
+    <info-page :propsData="propsData" v-if="pageType === 4"></info-page>
   </div>
 </template>
 <script>
   import addPage from "./addPage.vue";
   import listPage from "./listPage.vue";
-  import recordsPage from "./recordsPage.vue";
+  import infoPage from "./infoPage.vue";
   import qrCodeDialog from "@/components/qrCodeDialog/index.vue"
   import { getDeptDropList,systemBuildingGetTreeList,} from "@/api/commonality/permission";
   import {
@@ -117,7 +117,7 @@
     components: {
       addPage,
       listPage,
-      recordsPage,
+      infoPage,
       qrCodeDialog,
     },
     data () {

+ 0 - 104
src/views/chemicalManage/basicManagement/chemicalsCabinetManage/recordsPage.vue

@@ -1,104 +0,0 @@
-<template>
-  <div class="page-container chemicalsCabinetManage-recordsPage">
-    <div class="chemicalsCabinetManage-recordsPage-min" v-if="pageType == 1">
-      <div class="page-top-title-box">
-        <p class="page-top-title-name-p">{{newData.name}}</p>
-        <p class="page-top-title-out-p" @click="backPage">返回</p>
-      </div>
-      <div class="page-content-box">
-        <el-table class="table-box" border :data="dataList">
-          <el-table-column label="柜锁名称" prop="name" fixed show-overflow-tooltip/>
-          <el-table-column label="柜锁ID" prop="content" width="200" show-overflow-tooltip/>
-          <el-table-column label="摄像头IP" prop="content" width="200" show-overflow-tooltip/>
-          <el-table-column label="设备状态" prop="content" width="200" show-overflow-tooltip/>
-          <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(1,scope.row)"
-                   v-hasPermiRouter="['demo:demo:detail']"
-                >操作记录</p>
-                <p class="table-button-null"></p>
-              </div>
-            </template>
-          </el-table-column>
-        </el-table>
-      </div>
-    </div>
-    <info-page :propsInfoData="propsInfoData" v-if="pageType == 2"></info-page>
-  </div>
-</template>
-
-<script>
-  //import { getDicts } from "@/api/commonality/noPermission";
-  //import { systemUserSelect } from "@/api/commonality/permission";
-  //import { getInfo } from "@/api/basicsModules/index";
-  import infoPage from "./infoPage.vue";
-  export default {
-    name: 'recordsPage',
-    components: {
-      infoPage,
-    },
-    props:{
-      propsData:{},
-    },
-    data(){
-      return{
-        pageType:1,
-        tableButtonType:this.hasPermiDom(['demo:demo:detail','demo:demo:edit','demo:demo:del',]),
-        newData:{
-          name:"我是化学品柜名称",
-        },
-        queryParams:{
-          page:1,
-          pageSize:20,
-        },
-        dataList:[{}],
-        //子组件数据
-        propsInfoData:{},
-      }
-    },
-    created(){
-
-    },
-    mounted(){
-
-    },
-    methods:{
-      // 返回按钮
-      backPage(){
-        this.$parent.tableButton(5);
-      },
-      //获取列表记录
-      getList(){
-        // this.$set(this,'loading',true);
-        // getListFunction(this.queryParams).then(response => {
-        //   this.$set(this,'loading',false);
-        //   this.$set(this,'dataList',response.data.records);
-        //   this.$set(this,'total',response.data.total);
-        // });
-      },
-      /* 切换按钮 */
-      tableButton(type,row) {
-        if(type == 1){
-          this.$set(this,'pageType',2);
-          this.$set(this,'propsInfoData',row);
-        }else if(type == 2){
-          this.$set(this,'pageType',1);
-          this.getList();
-        }
-      }
-    },
-  }
-</script>
-
-<style scoped lang="scss">
-  .chemicalsCabinetManage-recordsPage{
-    .chemicalsCabinetManage-recordsPage-min{
-      flex:1;
-      display: flex;
-      flex-direction: column;
-    }
-  }
-</style>