dedsudiyu 2 years ago
parent
commit
378bb9c6ec
1 changed files with 19 additions and 49 deletions
  1. 19 49
      src/views/emergencyManagement/electronicInformationBoard/index.vue

+ 19 - 49
src/views/emergencyManagement/electronicInformationBoard/index.vue

@@ -130,6 +130,7 @@
         dataList: [],
         dataList: [],
         total: 0,
         total: 0,
         addDialogType:false,
         addDialogType:false,
+        dialogType:null,
         dialogTitle:"",
         dialogTitle:"",
         addForm:{},
         addForm:{},
         rules:{
         rules:{
@@ -181,35 +182,43 @@
       //新增编辑按钮
       //新增编辑按钮
       addButton(type,row){
       addButton(type,row){
         if(type == 1){
         if(type == 1){
+          this.$set(this,'dialogType','1');
           this.$set(this,'dialogTitle','新增电子信息牌');
           this.$set(this,'dialogTitle','新增电子信息牌');
           this.$set(this,'addForm',{
           this.$set(this,'addForm',{
             cardNum:"",
             cardNum:"",
             subjectId:"",
             subjectId:"",
+            subjectName:"",
+            deptId:"",
+            deptName:"",
             location:"",
             location:"",
             isStart:1,
             isStart:1,
           });
           });
+          this.$set(this,'selectList',[]);
         }else if(type == 2){
         }else if(type == 2){
+          this.$set(this,'dialogType','2');
           this.$set(this,'dialogTitle','编辑电子信息牌');
           this.$set(this,'dialogTitle','编辑电子信息牌');
           this.$set(this,'addForm',{
           this.$set(this,'addForm',{
             id:row.id,
             id:row.id,
             cardNum:row.cardNum,
             cardNum:row.cardNum,
             subjectId:row.subjectId,
             subjectId:row.subjectId,
             subjectName:row.subjectName,
             subjectName:row.subjectName,
+            deptId:row.deptId,
+            deptName:row.deptName,
             location:row.location,
             location:row.location,
             isStart:row.isStart,
             isStart:row.isStart,
           });
           });
-          this.getSelectList(row.subjectName,row.subjectId);
+          this.getSelectList(row.subjectName);
         }
         }
         this.$set(this,'addDialogType',true);
         this.$set(this,'addDialogType',true);
       },
       },
-      getSelectList(val,id){
-        if(val||id){
+      getSelectList(val){
+        if(val){
           let obj = {}
           let obj = {}
-          if(id){
-            obj.id = id;
-          }
-          if(val){
-            obj.name = val.slice(0,30);
+          if(this.dialogType == 1){
+            obj.name = val
+          }else if(this.dialogType == 2){
+            obj.name = val
+            obj.id = this.addForm.subjectId
           }
           }
           getSubList(obj).then(response => {
           getSubList(obj).then(response => {
             this.$set(this,'selectList',response.data);
             this.$set(this,'selectList',response.data);
@@ -218,56 +227,17 @@
           this.$set(this,'selectList',[]);
           this.$set(this,'selectList',[]);
         }
         }
       },
       },
-      //查询当前院系
-      // filterDept(){
-      //   filterDept().then(response => {
-      //     let idText = "";
-      //     for(let i=0;i<response.data.length;i++){
-      //       if(i==0){
-      //         idText = idText + response.data[i].deptId;
-      //       }else{
-      //         idText = idText +','+ response.data[i].deptId;
-      //       }
-      //     }
-      //     //查询院系下实验室
-      //     getSubList(idText).then(response => {
-      //       //当前列表
-      //       this.selectList = JSON.parse(JSON.stringify(response.data));
-      //       //原始列表数据
-      //       this.selectListData = JSON.parse(JSON.stringify(response.data));
-      //     });
-      //   });
-      // },
       //实验室选中
       //实验室选中
       selectChange(id){
       selectChange(id){
         let self = this;
         let self = this;
         for(let i=0;i<self.selectList.length;i++){
         for(let i=0;i<self.selectList.length;i++){
           if(id == self.selectList[i].id){
           if(id == self.selectList[i].id){
             this.$set(this.addForm,'subjectName',self.selectList[i].name);
             this.$set(this.addForm,'subjectName',self.selectList[i].name);
+            this.$set(this.addForm,'deptId',self.selectList[i].deptId);
+            this.$set(this.addForm,'deptName',self.selectList[i].deptName);
           }
           }
         }
         }
       },
       },
-      // /** 实验室-本地懒加载 */
-      // getSelectList(val) {
-      //   let self = this;
-      //   let list = [];
-      //   for(let i=0;i<self.selectListData.length;i++){
-      //     if(self.selectListData[i].name.indexOf(val) != -1){
-      //       list.push(self.selectListData[i]);
-      //     }
-      //   }
-      //   this.selectList = JSON.parse(JSON.stringify(list))
-      // },
-      //实验室选中清除
-      // clearClick(){
-      //   this.selectList = JSON.parse(JSON.stringify(this.selectListData))
-      // },
-      // selectFocus(){
-      //   if(!this.selectList[0]){
-      //     // this.filterDept();
-      //     this.getSubList();
-      //   }
-      // },
       submitForm(){
       submitForm(){
         this.$refs["form"].validate((valid) => {
         this.$refs["form"].validate((valid) => {
           if (valid) {
           if (valid) {