natasha vor 1 Jahr
Ursprung
Commit
93a8858125
1 geänderte Dateien mit 63 neuen und 20 gelöschten Zeilen
  1. 63 20
      src/views/organize_manage/CreateOrganize.vue

+ 63 - 20
src/views/organize_manage/CreateOrganize.vue

@@ -14,13 +14,13 @@
                     </div>
                 </div>
                 <el-steps :active="stepIndex" align-center>
-                    <el-step title="机构信息" description="完善机构基本信息">
+                    <el-step title="机构信息" :description="id?'修改机构基本信息':'完善机构基本信息'">
                         <svg-icon icon-class="dot" slot="icon" class="svg-dot"></svg-icon>
                     </el-step>
-                    <el-step title="设置管理账号" description="设置机构默认管理账号">
+                    <el-step title="设置管理账号" description="设置机构默认管理账号" v-if="!id">
                         <svg-icon icon-class="dot" slot="icon" class="svg-dot"></svg-icon>
                     </el-step>
-                    <el-step :title="id?'完成编辑':'完成创建'" :description="id?'机构编辑完成':'机构创建完成'">
+                    <el-step :title="id?'完成修改':'完成创建'" :description="id?'机构修改完成':'机构创建完成'">
                         <svg-icon icon-class="dot" slot="icon" class="svg-dot"></svg-icon>
                     </el-step>
                 </el-steps>
@@ -312,24 +312,42 @@ export default {
     // 上一步下一步
     handleStep(type){
         if(type=='-'){ 
-            if(this.stepIndex>0) this.stepIndex--
+            if(this.id){
+                if(this.stepIndex===2){
+                    this.stepIndex = 0
+                }
+            }else{
+                if(this.stepIndex>0) this.stepIndex--
+            }
         }else{
-            if(this.stepIndex===0){
-                this.$refs['organizeForm'].validate((valid) => {
-                    if (!valid) {
-                        return false;
-                    }else{
-                        this.stepIndex++
-                    }
-                });
-            }else if(this.stepIndex===1){
-                this.$refs['managerForm'].validate((valid) => {
-                    if (!valid) {
-                        return false;
-                    }else{
-                        this.handleSubmit()
-                    }
-                });
+            if(this.id){
+                if(this.stepIndex===0){
+                    this.$refs['organizeForm'].validate((valid) => {
+                        if (!valid) {
+                            return false;
+                        }else{
+                            this.editInfo()
+                        }
+                    });
+                }
+            }else{
+                if(this.stepIndex===0){
+                    this.$refs['organizeForm'].validate((valid) => {
+                        if (!valid) {
+                            return false;
+                        }else{
+                            this.stepIndex++
+                        }
+                    });
+                }else if(this.stepIndex===1){
+                    this.$refs['managerForm'].validate((valid) => {
+                        if (!valid) {
+                            return false;
+                        }else{
+                            this.handleSubmit()
+                        }
+                    });
+                }
             }
         }
     },
@@ -433,6 +451,31 @@ export default {
         .catch(() => {
             
         });
+    },
+    // 编辑信息
+    editInfo(){
+        this.loading = true
+        let MethodName = "/OrgServer/Manager/OrgManager/UpdateOrg";
+        let data = {
+            id: this.id,
+            name: this.organizeForm.name,
+            sn: this.organizeForm.sn,
+            type: this.organizeForm.orgType,
+            city_id: this.organizeForm.selectedOptions,
+            max_person_count: this.organizeForm.personalCeil*1,
+            effective_date_begin: this.organizeForm.validity[0],
+            effective_date_end: this.organizeForm.validity[1]
+        }
+        getLogin(MethodName, data)
+        .then((res) => {
+            this.loading = false
+            if(res.status===1){
+                this.stepIndex = 2
+            }
+        })
+        .catch(() => {
+            this.loading = false
+        });
     }
   },
   //生命周期 - 创建完成(可以访问当前this实例)