<template>
  <div class="eibs-tab">
    <el-col :span="11">
    <c-col :span="24">
        <el-form-item label="单据类型" prop="brdgrp.srm.djutyp">
            <c-select v-model="model.brdgrp.srm.djutyp" style="width:100%" placeholder="请选择单据类型"
            :code="codes.djutyp"
            >
              </c-select>
        </el-form-item>
       </c-col>
    
     <c-col :span="24">
        <el-form-item label="单据出具人" prop="brdgrp.srm.djuusr">
            <c-input :disabled="this.typ1" v-model="model.brdgrp.srm.djuusr" maxlength="80"  placeholder="请输入单据出具人"></c-input>
        </el-form-item>
       </c-col>
       </el-col>
    <el-col :span="11" :offset="1">
         <c-col :span="24">
        <el-form-item label="单据出具日期" prop="brdgrp.srm.djudat">
            <c-date-picker :disabled="this.typ1" type="date"  v-model="model.brdgrp.srm.djudat" style="width:100%"  placeholder="请选择单据出具日期"></c-date-picker>
        </el-form-item>
       </c-col>
                                   
       <c-col :span="24">
        <el-form-item label="货权单据编号" prop="brdgrp.srm.djuref">
            <c-input  :disabled="this.typ1" v-model="model.brdgrp.srm.djuref" maxlength="40"  placeholder="请输入货权单据编号"></c-input>
        </el-form-item>
       </c-col>
    </el-col>
                                               
       
                                   
      
                                   
      
  </div>
</template>
<script>
import Api from "~/service/Api"
import commonProcess from "~/mixin/commonProcess";
import CodeTable from "~/config/CodeTable"
import Event from "~/model/Litdck/Event"

export default {
    inject: ['root'],
    props:["model","codes"],
    mixins: [commonProcess],
    data(){
        return {
          typ1:true
        }
    },
    watch:{
      "model.brdgrp.srm.djutyp":{
        immediate:true,
        handler(val,oldval){
          if(this.model.brdgrp.srm.djutyp == 'D'){
            this.typ1 = true
            // ommonProcess里的 changeFormItemRequired （property，Boolean）
            this.changeFormItemRequired('brdgrp.srm.djuusr', false)
            this.changeFormItemRequired('brdgrp.srm.djudat', false)
            this.changeFormItemRequired('brdgrp.srm.djuref', false)
            this.model.brdgrp.srm.djuusr =''
            this.model.brdgrp.srm.djudat =''
            this.model.brdgrp.srm.djuref =''

          }else if(this.model.brdgrp.srm.djutyp == ''){
            this.typ1 = true 
            this.changeFormItemRequired('brdgrp.srm.djuusr', false)
            this.changeFormItemRequired('brdgrp.srm.djudat', false)
            this.changeFormItemRequired('brdgrp.srm.djuref', false)
          }
          else{
            this.typ1 = false
            this.changeFormItemRequired('brdgrp.srm.djuusr', true)
            this.changeFormItemRequired('brdgrp.srm.djudat', true)
            this.changeFormItemRequired('brdgrp.srm.djuref', true)
          }
        }
      }

    },
    methods:{...Event},
    created:function(){

    }
}
</script>
<style>

</style>
