浏览代码

Merge branch 'VERSIONS-AppUp' into VERSIONS-AnQuanJianCha-1223

dedsudiyu 3 月之前
父节点
当前提交
513415967e
共有 1 个文件被更改,包括 104 次插入31 次删除
  1. 104 31
      src/views/integratedManagement/laboratoryManagement/subject/addSubject.vue

+ 104 - 31
src/views/integratedManagement/laboratoryManagement/subject/addSubject.vue

@@ -6,7 +6,7 @@
       <p class="page-top-title-submit-p" @click="upData">提交</p>
     </div>
     <div class="content-box scrollbar-box">
-      <el-form ref="form" :model="form" label-width="120px" :rules="rules" >
+      <el-form ref="form" :model="form" label-width="120px" :rules="form.dynamicLeveling?rulesOne:rules" >
         <div class="title-box">
           <p class="left-title">基本信息</p>
         </div>
@@ -66,21 +66,11 @@
           </el-form-item>
           <p class="page-reset-common-style-button" @click="classifyClick()" style="margin-left:12px;margin-bottom:20px;width:90px;">分类配置</p>
         </div>
-        <el-form-item label="实验室面积" prop="subArea" class="form-item">
-          <el-input
-            style="width:320px;"
-            v-model="form.subArea"
-            placeholder="请输入面积"
-            oninput="value=value.replace(/[^0-9.]/g,'')"
-            maxlength="4"
-            size="small">
-            <template slot="append">M²</template>
-          </el-input>
-        </el-form-item>
-<!--        <el-form-item label="动态评级" class="form-item" style="width:440px;">
+        <el-form-item label="动态评级" class="form-item" style="width:440px;">
           <div class="tableListPaginationSwitch">
             <el-switch
               class="switch captcha-img"
+              @change="switchChange"
               v-model="form.dynamicLeveling"
               :active-value="true"
               :inactive-value="false"
@@ -90,7 +80,18 @@
             <i class="el-icon-warning tip-img"></i>
             <i class="tip-content">如需人工评定,请关闭动态评级</i>
           </div>
-        </el-form-item>-->
+        </el-form-item>
+        <el-form-item label="实验室面积" prop="subArea" class="form-item">
+          <el-input
+            style="width:320px;"
+            v-model="form.subArea"
+            placeholder="请输入面积"
+            oninput="value=value.replace(/[^0-9.]/g,'')"
+            maxlength="4"
+            size="small">
+            <template slot="append">M²</template>
+          </el-input>
+        </el-form-item>
         <el-form-item label="楼栋"  prop="buildId" class="form-item">
           <el-select v-model="form.buildId" placeholder="请选择楼栋"
                      @change="changeBuild" style="width:320px;">
@@ -353,6 +354,35 @@ import { chemicalMsdsEdit } from '@/api/chemicalManage'
               {required: true, message: '请选择详细位置', trigger: 'blur'}
             ],
 
+          },
+          rulesOne: {
+            subName:[
+              {required: true, message: '请输实验室名称', trigger: 'blur'},
+              { required: true, message: "请输实验室名称", validator: this.spaceJudgment, trigger: "blur" }
+            ],
+            moldId:[
+              {required: true, message: '请选择类型', trigger: 'blur'}
+            ],
+            deptId:[
+              {required: true, message: '请选择学院', trigger: 'blur'}
+            ],
+            buildId:[
+              {required: true, message: '请选择楼栋', trigger: 'blur'}
+            ],
+            adminId:[
+              {required: true, message: '请选择实验室负责人', trigger: 'blur'}
+            ],
+
+            floorId:[
+              {required: true, message: '请选择层数', trigger: 'blur'}
+            ],
+            // roomId:[
+            //   {required: true, message: '请输入房间号', trigger: 'blur'}
+            // ],
+            layoutId:[
+              {required: true, message: '请选择详细位置', trigger: 'blur'}
+            ],
+
           },
           labMoldList:[],
           //一体机/电子信息牌状态切换
@@ -364,7 +394,8 @@ import { chemicalMsdsEdit } from '@/api/chemicalManage'
           levelBasisList:[],
           levelEvaluateList:[],
           classifyList:[],
-
+          //选中分级分类零时存储
+          checkLevelTypeData:{},
         }
       },
       created() {
@@ -383,6 +414,7 @@ import { chemicalMsdsEdit } from '@/api/chemicalManage'
           this.$set(this.form,'subType',this.subjectData.typeName)
           this.$set(this.form,'levelId',this.subjectData.levelId)
           this.$set(this.form,'titleName',this.subjectData.levelName)
+          this.$set(this.form,'dynamicLeveling',this.subjectData.dynamicLeveling?this.subjectData.dynamicLeveling:false)
           this.$set(this.form,'deptId',this.subjectData.deptId)
           this.$set(this.form,'buildId',this.subjectData.buildId)
           this.$set(this.form,'floorId',this.subjectData.floorId)
@@ -454,10 +486,18 @@ import { chemicalMsdsEdit } from '@/api/chemicalManage'
       },
       methods:{
         LevelClick(){
-          this.$set(this,'dialogLevelVisible',true);
+          if(!this.form.dynamicLeveling){
+            this.$set(this,'dialogLevelVisible',true);
+          }else{
+            this.msgError('如需人工评定,请关闭动态评级')
+          }
         },
         classifyClick(){
-          this.$set(this,'dialogClassifyVisible',true);
+          if(!this.form.dynamicLeveling){
+            this.$set(this,'dialogClassifyVisible',true);
+          }else{
+            this.msgError('如需人工评定,请关闭动态评级')
+          }
         },
         tabsClick(index){
           this.tabsIndex=index;
@@ -553,6 +593,7 @@ import { chemicalMsdsEdit } from '@/api/chemicalManage'
                 cancelButtonText: "取消",
                 type: "warning"
               }).then(function() {
+                self.form.dynamicLeveling = self.form.dynamicLeveling?self.form.dynamicLeveling:false;
                 if(self.form.hazardCategory) {
                   self.form.hazardCategory = self.form.hazardCategory.join() ;
                 }
@@ -672,21 +713,22 @@ import { chemicalMsdsEdit } from '@/api/chemicalManage'
         laboratoryTypeConfigGetList(){
           let self=this;
           laboratoryTypeConfigGetList().then(response => {
-            if (this.subjectData.typeId){
-              response.data.forEach(function(item) {
-                item.selected=false;
-              })
-              response.data.forEach(function(item) {
-                if (item.typeId==self.subjectData.typeId){
-                  item.selected=true;
-                }
-              })
-            }else{
-              response.data.forEach(function(item) {
-                item.selected=false;
-              })
+            if (!this.form.dynamicLeveling){
+              if (this.subjectData.typeId){
+                response.data.forEach(function(item) {
+                  item.selected=false;
+                })
+                response.data.forEach(function(item) {
+                  if (item.typeId==self.subjectData.typeId){
+                    item.selected=true;
+                  }
+                })
+              }else{
+                response.data.forEach(function(item) {
+                  item.selected=false;
+                })
+              }
             }
-
             this.$set(this, 'classifyList',response.data)
           });
         },
@@ -801,6 +843,37 @@ import { chemicalMsdsEdit } from '@/api/chemicalManage'
             self.msgError("请选择实验室分类!");
           }
         },
+        //switch开关
+        switchChange(val){
+          if(!val){
+            let obj = {};
+            if(this.form.typeId){
+              obj.typeId = this.form.typeId
+              obj.subType = this.form.subType
+            }
+            if(this.form.levelId){
+              obj.titleName = this.form.titleName
+              obj.levelId = this.form.levelId
+            }
+            if (obj.typeId || obj.levelId){
+              this.$set(this,'checkLevelTypeData',JSON.parse(JSON.stringify(obj)));
+            }
+            this.$set(this.form,'subType',null);
+            this.$set(this.form,'typeId',null);
+            this.$set(this.form,'titleName',null);
+            this.$set(this.form,'levelId',null);
+          }else{
+            if(this.checkLevelTypeData.typeId){
+              this.$set(this.form,'subType',this.checkLevelTypeData.subType);
+              this.$set(this.form,'typeId',this.checkLevelTypeData.typeId);
+            }
+            if(this.checkLevelTypeData.levelId){
+              this.$set(this.form,'titleName',this.checkLevelTypeData.titleName);
+              this.$set(this.form,'levelId',this.checkLevelTypeData.levelId);
+            }
+          }
+          this.$refs['form'].clearValidate();
+        },
       }
     }
 </script>