|  | @@ -3,6 +3,7 @@
 | 
	
		
			
				|  |  |      <el-dialog
 | 
	
		
			
				|  |  |        :title="id ? '编辑防区' : '新增防区'"
 | 
	
		
			
				|  |  |        :visible.sync="isShow"
 | 
	
		
			
				|  |  | +      @close="onHide"
 | 
	
		
			
				|  |  |        width="500px"
 | 
	
		
			
				|  |  |      >
 | 
	
		
			
				|  |  |        <div class="page-body">
 | 
	
	
		
			
				|  | @@ -16,11 +17,15 @@
 | 
	
		
			
				|  |  |            label-prefix=":"
 | 
	
		
			
				|  |  |          >
 | 
	
		
			
				|  |  |            <el-form-item label="所属机构" prop="orgId">
 | 
	
		
			
				|  |  | -            <orgDropDown v-model="formData.orgId" placeholder="选择所属机构" @select="onOrgSelect"/>
 | 
	
		
			
				|  |  | +            <orgDropDown
 | 
	
		
			
				|  |  | +              v-model="formData.orgId"
 | 
	
		
			
				|  |  | +              placeholder="选择所属机构"
 | 
	
		
			
				|  |  | +              @select="onOrgSelect"
 | 
	
		
			
				|  |  | +            />
 | 
	
		
			
				|  |  |            </el-form-item>
 | 
	
		
			
				|  |  |            <el-form-item prop="name" label="防区名称:">
 | 
	
		
			
				|  |  |              <el-input
 | 
	
		
			
				|  |  | -              v-model="formData.name"
 | 
	
		
			
				|  |  | +            v-model="formData.name"
 | 
	
		
			
				|  |  |                :maxlength="50"
 | 
	
		
			
				|  |  |                name="name"
 | 
	
		
			
				|  |  |                placeholder="请输入防区名称"
 | 
	
	
		
			
				|  | @@ -40,7 +45,7 @@
 | 
	
		
			
				|  |  |        </div>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |        <div slot="footer" class="dialog-footer">
 | 
	
		
			
				|  |  | -        <el-button @click="onHide">取消</el-button>
 | 
	
		
			
				|  |  | +        <el-button @click="isShow=false">取消</el-button>
 | 
	
		
			
				|  |  |          <el-button type="primary" @click="onSubmit">确定</el-button>
 | 
	
		
			
				|  |  |        </div>
 | 
	
		
			
				|  |  |      </el-dialog>
 | 
	
	
		
			
				|  | @@ -48,7 +53,7 @@
 | 
	
		
			
				|  |  |  </template>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  <script>
 | 
	
		
			
				|  |  | -import { mapState, mapMutations } from "vuex";
 | 
	
		
			
				|  |  | +import { mapState, mapMutations, mapGetters } from "vuex";
 | 
	
		
			
				|  |  |  import * as api from "@/api/resumption/protection";
 | 
	
		
			
				|  |  |  import orgDropDown from "../../../components/orgTree/orgDropDown.vue";
 | 
	
		
			
				|  |  |  export default {
 | 
	
	
		
			
				|  | @@ -59,15 +64,21 @@ export default {
 | 
	
		
			
				|  |  |        formData: this.reset(),
 | 
	
		
			
				|  |  |        // 机构树选项
 | 
	
		
			
				|  |  |        formDataRules: {
 | 
	
		
			
				|  |  | -        name: [{ required: true, message: "请选择所属机构" }],
 | 
	
		
			
				|  |  | +        orgId: [{ required: true, message: "请选择所属机构" }],
 | 
	
		
			
				|  |  |          name: [{ required: true, message: "请输入防区名称" }],
 | 
	
		
			
				|  |  |        },
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    props: {},
 | 
	
		
			
				|  |  | -  watch: {},
 | 
	
		
			
				|  |  | +  watch: {
 | 
	
		
			
				|  |  | +    // "formData.orgId":{
 | 
	
		
			
				|  |  | +    //   handler(v){
 | 
	
		
			
				|  |  | +    //     console.info("formData.orgId",v)
 | 
	
		
			
				|  |  | +    //   }
 | 
	
		
			
				|  |  | +    // }
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  |    computed: {
 | 
	
		
			
				|  |  | -    ...mapState([]),
 | 
	
		
			
				|  |  | +    ...mapGetters(["orgId"]),
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    methods: {
 | 
	
		
			
				|  |  |      ...mapMutations([]),
 | 
	
	
		
			
				|  | @@ -75,8 +86,8 @@ export default {
 | 
	
		
			
				|  |  |        return {
 | 
	
		
			
				|  |  |          id: null,
 | 
	
		
			
				|  |  |          orgId: null,
 | 
	
		
			
				|  |  | -        orgPath:null,
 | 
	
		
			
				|  |  | -        orgName:null,
 | 
	
		
			
				|  |  | +        orgPath: null,
 | 
	
		
			
				|  |  | +        orgName: null,
 | 
	
		
			
				|  |  |          name: null,
 | 
	
		
			
				|  |  |          allHour: null,
 | 
	
		
			
				|  |  |        };
 | 
	
	
		
			
				|  | @@ -92,25 +103,22 @@ export default {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // 事件
 | 
	
		
			
				|  |  |      onHide() {
 | 
	
		
			
				|  |  | -      this.$refs.form.resetFields();
 | 
	
		
			
				|  |  | -      this.formData=this.reset();
 | 
	
		
			
				|  |  | -      this.isShow = false;
 | 
	
		
			
				|  |  | +      this.$refs.form.resetFields();     
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      onSubmit() {
 | 
	
		
			
				|  |  |        this.$refs.form.validate(async (isValidate) => {
 | 
	
		
			
				|  |  |          if (!isValidate) return;
 | 
	
		
			
				|  |  |          await api.update(this.formData);
 | 
	
		
			
				|  |  |          this.$emit("success");
 | 
	
		
			
				|  |  | -        this.onHide();
 | 
	
		
			
				|  |  | +        this.isShow = false;
 | 
	
		
			
				|  |  |        });
 | 
	
		
			
				|  |  | -    },  
 | 
	
		
			
				|  |  | -    onOrgSelect(node){      
 | 
	
		
			
				|  |  | -      this.formData.orgPath=node.path;
 | 
	
		
			
				|  |  | -      this.formData.orgName=node.name;
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -  },
 | 
	
		
			
				|  |  | -  created() {
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    onOrgSelect(node) {
 | 
	
		
			
				|  |  | +      this.formData.orgPath = node.path;
 | 
	
		
			
				|  |  | +      this.formData.orgName = node.name;
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  | +  created() {},
 | 
	
		
			
				|  |  |    mounted() {},
 | 
	
		
			
				|  |  |    components: { orgDropDown },
 | 
	
		
			
				|  |  |  };
 |