
<template>
  <el-row>
    <el-col :span="24">
      <el-form
        :model="drugRegNameForm"
        ref="drugRegNameForm"
        class="sub-form"
        :validate-on-rule-change="false"
      >
        <el-form-item label="药品高危级别" label-width="110px" prop="risklevel">
          <el-select
            v-model="drugRegNameForm.risklevel"
            placeholder="请选择药品高危级别"
            clearable
            @change="handleValue('risklevel')"
            style="width: 100%"
          >
            <el-option label="A级高危" value="A级高危"></el-option>
            <el-option label="B级高危" value="B级高危"></el-option>
            <el-option label="C级高危" value="C级高危"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="禁忌给药途径" label-width="110px" prop="conflict_geiyao">
          <el-input
            v-model.trim="drugRegNameForm.conflict_geiyao"
            placeholder="请输入禁忌给药途径"
            @blur="handleValue('conflict_geiyao')"
          ></el-input>
        </el-form-item>
        <el-form-item label="禁忌性别" label-width="110px" prop="conflict_gender">
          <el-select
            v-model="drugRegNameForm.conflict_gender"
            placeholder="请选择禁忌性别"
            clearable
            @change="handleValue('conflict_gender')"
            style="width: 100%"
          >
            <el-option label="男" value="男"></el-option>
            <el-option label="女" value="女"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="结果" label-width="110px" prop="result">
          <el-input
            v-model.trim="drugRegNameForm.result"
            placeholder="请输入结果"
            @blur="handleValue('result')"
          ></el-input>
        </el-form-item>

        <el-form-item label="名称" label-width="110px" prop="alias">
          <el-input
            v-model.trim="drugRegNameForm.alias"
            placeholder="请输入名称"
            @blur="handleValue('alias')"
          ></el-input>
        </el-form-item>
      </el-form>
    </el-col>
  </el-row>
</template>

<script>
export default {
  name: 'DrugRegNameForm',
  props: ['data'],
  data() {
    return {
      drugRegNameForm: {
        risklevel: '',
        conflict_geiyao: '',
        conflict_gender: '',
        result: '',
        alias: ''
      }
    };
  },
  computed: {},
  created() {
    this._initData();
  },
  mounted() {},
  methods: {
    _initData() {
      this.drugRegNameForm.risklevel = this.data.risklevel;
      this.drugRegNameForm.conflict_geiyao = this.data.conflict_geiyao;
      this.drugRegNameForm.conflict_gender = this.data.conflict_gender;
      this.drugRegNameForm.result = this.data.result;
      this.drugRegNameForm.alias = this.data.alias;
    },
    // 传值
    handleValue(from) {
      this.$emit('handleInput', {
        type: from,
        value: this.drugRegNameForm[from]
      });
    }
  }
};
</script>

<style lang="less" scoped>
</style>