<template>
  <div class="other">
      <el-form label-width="120px"  ref="form" :model="form">
         <div class="divider">
           <div class="title">
             <div class="ele-bg-primary"></div>
             <span>质量配置</span>
           </div>
           <div class="ele-bg-primary ele-width"></div>
         </div>
         <el-row :gutter="24">
           <el-col :span="8">
             <el-form-item label="是否来料检验" prop="isComeCheck">
                 <el-radio v-model="form.isComeCheck" :label="1">是</el-radio>
                 <el-radio v-model="form.isComeCheck" :label="0">否</el-radio>
             </el-form-item>
           </el-col>
           <el-col :span="8">
             <el-form-item label="检验方案" prop="checkFormula">
                <DictSelection dictName="检验方案" clearable v-model="form.checkFormula">
                </DictSelection>
             </el-form-item>
           </el-col>
           <el-col :span="8">
             <el-form-item label="采购组织" prop="checkDepart">
               <deptSelect v-model="form.checkDepart" @changeGroup="searchDeptNodeClick"/>
             </el-form-item>
           </el-col>
           <el-col :span="8">
             <el-form-item label="采购员" prop="checkPerson">
               <personSelect
                 ref="directorRef"
                 v-model="form.checkPerson"
                 @selfChange="handleDirectorChange"
                 :init="false"
               />
             </el-form-item>
           </el-col>
         </el-row>
      </el-form>
  </div>
</template>

<script>
  import deptSelect from '@/components/CommomSelect/dept-select.vue'
  import personSelect from '@/components/CommomSelect/person-select.vue';
  export default {
    props: {
      form: {
        type: Object,
        default: {}
      }
    },
    components: { deptSelect , personSelect },
    data() {
      return {
      };
    },
    watch: {
      form(data) {
        if (data.checkDepart) {
           const params = { executeGroupId: data.checkDepart };
            this.$nextTick(() => {
              this.$refs.directorRef.getList(params);
            });
        }
      }
    },
    methods: {
      // 选择所属部门
      searchDeptNodeClick (id, info) {
        // 根据部门获取人员
        const params = { executeGroupId: id };
        this.$nextTick(() => {
          this.$refs.directorRef.getList(params);
        });
      },
      //选择负责人
      handleDirectorChange (id, info) {
      },


    }
  };
</script>

<style lang="scss" scoped>
  .other{
    background: #fff;
    padding: 1px 17px;
  }
  .divider {
    margin: 0px 0 20px;
    .title {
      display: flex;
      align-items: center;
      margin-bottom: 10px;
      div {
        width: 8px;
        height: 20px;
        margin-right: 10px;
      }
      span {
        font-size: 20px;
      }
    }
    .ele-width{
      width: 100%;
      height: 2px;
    }
  }
  .form-line{
    display: flex;
    align-items: center;
    justify-content: space-between;
    .line-select{
      margin-left:15px;
    }
  }
</style>
