<template>
  <div>
    <form-col :options="dataLeft" ref="ruleForm1"  />
    <div class="interval" :style="'width:'+intervalWidth "></div>
    <form-col :options="dataRight" ref="ruleForm2" />
    <!-- <div class="button-submit"><el-button type="primary">提交</el-button></div> -->
  </div>
</template>

<script>
import FormCol from '@/common/components/FormCol.vue'
export default {
  name: 'ContentFormModifyOrgan',        
  data(){
    return{
      dataLeft: [
            {
              name:'客户类型：',
              type: 'select',
              placeholder: '请选择客户类型',
              required: true,
              options: [],
              value: '',    //绑定的vul
              disabled: true,  //是否禁用输入/选择框
              rules: 'trueDataNull' //验证规则
              
            },
            {
              name:'业务类型：',
              type: 'select',
              placeholder: '请选择业务类型',
              required: true,
              options: [],
              value: '',    //绑定的vul
              disabled: true,  //是否禁用输入/选择框
              rules: 'trueDataNull' //验证规则
            },
            {
              name:'业务引入部门：',
              type: 'select',
              placeholder: '请选择引入部门',
              required: true,
              options: [],
              value: '',    //绑定的vul
              disabled: true,  //是否禁用输入/选择框
              rules: 'trueDataNull' //验证规则
            },
              {
              name:'国泰君安联系人：',
              type: 'input',
              placeholder: '请输入',
              required: true,
              value: '',    //绑定的vul
              disabled: true,  //是否禁用输入/选择框
              rules: 'trueDataNull' //验证规则
            },
              {
              name:'分公司名称：',
              type: 'input',
              placeholder: '请输入',
              required: true,
              value: '',    //绑定的vul
              disabled: true,  //是否禁用输入/选择框
              rules: 'trueDataNull' //验证规则
            },
              {
              name:'分支机构代码：',
              type: 'input',
              placeholder: '请输入',
              required: true,
              value: '',    //绑定的vul
              disabled: true,  //是否禁用输入/选择框
              rules: 'trueDataNull' //验证规则
            }
      ],
      dataRight:[
              {
              name:'分支机构名称：',  //名称
              type: 'input',        //类型
              placeholder: '请输入', //提示信息
              required: true,   //是否进行验证
              disabled: true,  //是否禁用输入/选择框
              value: '',    //绑定的vul
              rules: 'trueDataNull' //验证规则
              
            },{
              name:'联系人姓名：',
              type: 'input',
              placeholder: '请输入',
              required: true,
              value: '',
              rules: 'name'

            },{
              name:'联系人证件类型：',
              type: 'select',
              placeholder: '请选择',
              required: true,
              options: [{
                value: '0',
                label: '身份证'
                }],
              value: '0',
              rules: 'selectType',

            },{
              name:'联系人证件号码：',
              type: 'input',
              placeholder: '请输入',
              required: true,
              value: '',
              rules: 'peopleID',
              maxlength: 18 //限制长度

            },{
              name:'联系人手机号：',
              type: 'input',
              placeholder: '请输入',
              required: true,
              value: '',
              rules: 'checkPhone',
              maxlength: 11 //限制长度


      }] 
    }
  },
  methods:{
    submitForm(){   //表单提交
    const _this = this;
    const resGetUserInfo = this.$store.state.userInfo ;//登录账号信息
    // console.log(this.testGetChildRef());
    if(!this.testGetChildRef()){
      return false
    }else{
      return true
    }
    let userFormObj={
      USER_TYPE:'',
      BUSIN_TYPE:'',
      BUSIN_DEPT:'',
      GTJA_RELATION_LIST:'',
      INST_RELATION_LIST:'',
      SYSTEM_ID:'77',
      ACTION_TYPE:'1',
      OPERATOR:resGetUserInfo.USER_CUSTID,
    }
    fql.WFW_USER_MANAGE_SERVICE['设置机构信息'](userFormObj)
      .then( res=>{
        console.log(res);
      })
    },
    testGetChildRef(){  //判断表单是否符合规范
      let isform = true
      let childRef1 = this.$refs.ruleForm1.$refs.ruleForm
      let childRef2 = this.$refs.ruleForm2.$refs.ruleForm
      for(let i = 0 ;i<childRef1.length;i++){
         childRef1[i].validate((valid) => {
           if(valid==false){
             isform = false
           }
          });
        }
      for(let i = 0 ;i<childRef2.length;i++){
         childRef2[i].validate((valid) => {
           if(valid==false){
             isform = false
           }
          });
        }
        return isform
    },
    resetForm(){  //表单重置
      let childRef1 = this.$refs.ruleForm1.$refs.ruleForm
      let childRef2 = this.$refs.ruleForm2.$refs.ruleForm
      for(let i = 0 ;i<childRef1.length;i++){
         childRef1[i].resetFields()
        }
      for(let i = 0 ;i<childRef2.length;i++){
         childRef2[i].resetFields()
        }
    }
  },
   computed:{
    userForm(){
        const resGetUserInfo =  this.$store.state.userInfo     
      return{ 
        NAME: this.dataRight[1].value,  //联系人姓名
        IDNO_TYPE: this.dataRight[2].value, //联系人证件类型 
        ID_NO: this.dataRight[3].value,  //联系人证件号码
        MOBILE: this.dataRight[4].value, //联系人手机号
      }
    }
  },
  components:{
      FormCol
  },
  props: {
    intervalWidth:{
       propA: Number,
      default: '40px',
      
    }
  }

}
</script>

<style scoped >
.interval{
  display: inline-block;
}
/* 提交按钮Style */

</style>
