<template>
  <div>
    <el-form :model="editQuery" :rules="rules" ref="editQuery" border label-width="120px">
      <el-row type="flex" class="edit-row">
        <el-col :span="12">
          <el-form-item label="商品条码:">
            <el-input style="width: 80%" size="small" splaceholder="请输入内容" v-model="editQuery.sptm"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="商品名称:">
            <el-input style="width: 80%" size="small" splaceholder="请输入内容" v-model="editQuery.spmc"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex" class="edit-row">
        <el-col :span="12">
          <el-form-item label="计量单位:">
            <el-input style="width: 80%" size="small" splaceholder="请输入内容" v-model="editQuery.measname"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="生产厂家:">
            <el-input style="width: 80%" size="small" splaceholder="请输入内容" v-model="editQuery.manufactory"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex" class="edit-row">
        <el-col :span="12">
          <el-form-item label="产品价格:">
            <el-input style="width: 80%" size="small" splaceholder="请输入内容" v-model="editQuery.price"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="产品描述:">
            <el-input style="width: 80%" size="small" splaceholder="请输入内容" v-model="editQuery.cpms"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex" class="edit-row">
        <el-col :span="12">
          <el-form-item label="医保编码:">
            <el-input style="width: 80%" size="small" splaceholder="请输入内容" v-model="editQuery.ybbm"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-button-group style="display: flex">
        <el-button type="primary" @click.native="submitUpload()" style="margin: 0 60px 10px auto; height: 35px"
                   :loading="loading"
        >提交
        </el-button>
      </el-button-group>
    </el-form>
  </div>
</template>

<script>
import { disableUdi } from '@/api/basic/product/udiRelevance'
import { updateById } from '@/api/basic/udiRelevance'

export default {
  name: 'productEdit',
  props: {
    editQuery: {
      type: Object,
      required: true
    },
    closeDialog: {
      type: Function,
      required: true
    },
  },

  data() {
    return {
      isUseDyCheck: false,
      useNumEnable: true,
      editDialogVisible:false
    }
  },

  methods: {
    submitUpload() {

      var data = {
        id: this.editQuery.prid,
        sptm: this.editQuery.sptm,
        spmc: this.editQuery.spmc,
        measname: this.editQuery.measname,
        manufactory: this.editQuery.manufactory,
        price: this.editQuery.price,
        cpms: this.editQuery.cpms,
        ybbm: this.editQuery.ybbm
      }

      updateById(data).then(res=>{
        if(res.code==20000){
          this.closeDialog();
        }else{
          this.$message.error(response.message);
        }
      })

    }

  }
}
</script>

<style scoped>

</style>
