Browse Source

政府管理

tanyanfei 5 years ago
parent
commit
2a417b99ed
1 changed files with 8 additions and 5 deletions
  1. 8 5
      src/views/government/Index.vue

+ 8 - 5
src/views/government/Index.vue

@@ -81,7 +81,7 @@
                         <el-input style="width:62%;margin-left:5px;" @change="getData"  v-model="filter.name" placeholder="政府名称"></el-input>
                     </el-form-item>
                 </el-form>
-                <el-button type="primary" icon="el-icon-circle-plus" size="mini" style="width:100%;margin-bottom:10px;">新增政府单位</el-button>
+                <el-button type="primary" @click="show=1,form={parent_id:null,is_active:false}" icon="el-icon-circle-plus" size="mini" style="width:100%;margin-bottom:10px;">新增政府单位</el-button>
                 <el-tree  
                     :data="data"
                     node-key="id"  :props='props'
@@ -111,7 +111,7 @@
                     </span>
                 </el-tree>
             </li>
-            <li>
+            <li v-show="show">
                 <p v-if="form.parent_id">上级政府:{{form.parent_name}} <el-divider></el-divider></p>
                 
                 <el-form class="form" label-width="80px" label-position='right' size="small">
@@ -148,11 +148,11 @@
                     </el-form-item>
                     <el-form-item>
                         <el-button @click="save" type="primary">保存</el-button>
-                        <el-button @click="form={parent_id:null,is_active:false}" type="info">取消</el-button>
+                        <el-button @click="show=0,form={parent_id:null,is_active:false}" type="info">取消</el-button>
                     </el-form-item>
                 </el-form>
             </li>
-            <li class="company">
+            <li class="company" v-show="show">
                 <h1 v-if="form.id">{{form.name}}下属企业  <el-button @click="dialogFormVisible=true" size='mini' type="primary">添加</el-button></h1>
                 <p v-for="item in form.enterprise" :key="item.id">{{item.name}}
                     <el-button
@@ -210,7 +210,8 @@ export default {
                 enterprise_id:''
             },
             enterpriseList:[],
-            area:[]
+            area:[],
+            show:0
 		};
 	},
 	methods: {
@@ -224,12 +225,14 @@ export default {
             })
         },
         append(data){
+            this.show=1;
             this.form={
                 parent_id:data.id,
                 parent_name:data.name
             }
         },
         edit(data){
+            this.show=1;
             this.$api.getGoverment({id:data.id}).then(res=>{
                 this.form=res.data.data;
                 this.form.is_active=Boolean(this.form.is_active);