<template>
  <div class="search-box">
    <el-form :model="form" :inline="true" ref="create">
      <el-form-item label="药品名称" prop="genname">
        <el-input
          v-model="form.genname"
          style="width: 170px; margin-right: 2px"
          placeholder="请输入药品名称"
          clearable
        />
      </el-form-item>
      <el-form-item label="药品编码" prop="drugCode">
        <el-input
          v-model="form.drugCode"
          style="width: 170px; margin-right: 2px"
          placeholder="请输入药品编码"
          clearable
        />
      </el-form-item>
      <el-form-item label="规格" prop="specName">
        <el-input
          v-model="form.specName"
          style="width: 170px; margin-right: 2px"
          placeholder="请输入规格"
          clearable
        />
      </el-form-item>
      <el-form-item label="剂型" prop="dosformName">
        <el-input
          v-model="form.dosformName"
          style="width: 170px; margin-right: 2px"
          placeholder="请输入剂型"
          clearable
        />
      </el-form-item>
      <el-form-item label="生产厂家" prop="prodentpName">
        <el-input
          v-model="form.prodentpName"
          style="width: 170px; margin-right: 2px"
          placeholder="请输入生产厂家"
          clearable
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">查询</el-button>
        <el-button @click="resetForm('create')">重置</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import { searchInputData } from "./searchData";
export default {
  name: "searchView",
  data() {
    return {
      form: {
        genname: "",
        specName: "",
        dosformName: "",
        prodentpName: "",
        drugCode: "",
      },
      userType: "", //判断用户是医疗机构还是配送企业
      searchData: [],
    };
  },
  mounted() {
    let { orgType, userID } = this.$store.state.user;
    this.userType = orgType;
  },
  methods: {
    onSubmit() {
      this.$refs["create"].validate((valid) => {
        if (valid) {
          this.$emit("searchSuses", this.form);
        }
      });
    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
      this.$emit("searchSuses", this.form);
    },
  },
};
</script>
<style scoped lang="scss">
.search-box {
  padding: 0;
}
</style>
