<template>
  <div>
    <el-card class="el-card">
      <div v-if="!isImport" style="margin-bottom: 20px">
        <el-form :model="data" size="mini" label-width="150px">

          <el-row v-if="data.isAudit!=null && data.isAudit==2" type="flex" justify="end">
            <el-button-group style="display: flex;margin-bottom: 15px; margin-right: 50px;margin-top: -10px">
              <el-button type="primary" @click="checkPass(2)">通过</el-button>
              <el-button type="primary" @click="checkPass(3)">不通过</el-button>
            </el-button-group>
          </el-row>

          <div style="margin-bottom: 20px">
            <el-row>
              <el-col :span="12" class="el-col">
                <el-form-item label="产品编码:">
                  <el-input style="width: 90%" size="small" :disabled="true" placeholder="请输入内容"
                            v-model="data.code"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12" class="el-col">
                <el-form-item label="物资名称:">
                  <el-input style="width: 90%" size="small" :disabled="true" placeholder="请输入内容"
                            v-model.trim="data.name"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12" class="el-col">
                <el-form-item label="规格型号:">
                  <el-input style="width: 90%" size="small" :disabled="true" placeholder="请输入内容"
                            v-model.trim="data.spec"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12" class="el-col">
                <el-form-item label="计量单位:">
                  <el-input style="width: 90%" size="small" :disabled="true" placeholder="请输入内容"
                            v-model.trim="data.measname"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12" class="el-col">
                <el-form-item label="生产企业:">
                  <el-input style="width: 90%" size="small" :disabled="true" placeholder="请输入内容"
                            v-model.trim="data.manufactory"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12" class="el-col">
                <el-form-item label="注册证号:">
                  <el-input style="width: 90%" size="small" :disabled="true" placeholder="请输入内容"
                            v-model.trim="data.registerNo"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12" class="el-col">
                <el-form-item label="医疗器械注册人:">
                  <el-input style="width: 90%" size="small" :disabled="true" placeholder="请输入内容"
                            v-model.trim="data.ylqxzcrbarmc"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12" class="el-col">
                <el-form-item label="注册人英文名称:">
                  <el-input style="width: 90%" size="small" :disabled="true" placeholder="请输入内容"
                            v-model.trim="data.ylqxzcrbarywmc"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12" class="el-col">
                <el-form-item label="产品类别:">
                  <el-input style="width: 90%" size="small" :disabled="true" placeholder="请输入内容"
                            v-model.trim="data.cplb"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12" class="el-col">
                <el-form-item label="分类编码:">
                  <el-input style="width: 90%" size="small" :disabled="true" placeholder="请输入内容"
                            v-model.trim="data.flbm"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12" class="el-col">
                <el-form-item label="商品条码:">
                  <el-input style="width: 90%" size="small" :disabled="true" placeholder="请输入内容"
                            v-model.trim="data.sptm"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12" class="el-col">
                <el-form-item label="医保编码:">
                  <el-input style="width: 90%" size="small" :disabled="true" placeholder="请输入内容"
                            v-model.trim="data.ybbm"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12" class="el-col">
                <el-form-item label="统一社会信用号:">
                  <el-input style="width: 90%" size="small" :disabled="true" placeholder="请输入内容"
                            v-model.trim="data.tyshxydm"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12" class="el-col">
                <el-form-item label="器械类别:">
                  <el-input style="width: 90%" size="small" :disabled="true" placeholder="请输入内容"
                            v-model.trim="data.qxlb"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="产品价格:">
                  <el-input style="width: 90%" size="small" :disabled="true" splaceholder="请输入内容" type="number"
                            step="0.01"
                            v-model="data.price"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12" v-if="productRemarkSet.remarkEnable1">
                <el-form-item :label="productRemarkSet.remarkTitle1 ">
                  <el-input style="width: 90%" size="small" splaceholder="请输入内容" :disabled="true"
                            v-model="data.basicPrductRemak1"></el-input>
                </el-form-item>
              </el-col>

              <el-col :span="12" v-if="productRemarkSet.remarkEnable2">
                <el-form-item :label="productRemarkSet.remarkTitle2 ">
                  <el-input style="width: 90%" size="small" splaceholder="请输入内容" :disabled="true"
                            v-model="data.basicPrductRemak2"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12" v-if="productRemarkSet.remarkEnable3">
                <el-form-item :label="productRemarkSet.remarkTitle3 ">
                  <el-input style="width: 90%" size="small" splaceholder="请输入内容" :disabled="true"
                            v-model="data.basicPrductRemak3"></el-input>
                </el-form-item>
              </el-col>

              <el-col :span="12" v-if="productRemarkSet.remarkEnable4">
                <el-form-item :label="productRemarkSet.remarkTitle4 ">
                  <el-input style="width: 90%" size="small" splaceholder="请输入内容" :disabled="true"
                            v-model="data.basicPrductRemak4"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12" v-if="productRemarkSet.remarkEnable5">
                <el-form-item :label="productRemarkSet.remarkTitle5 ">
                  <el-input style="width: 90%" size="small" splaceholder="请输入内容" :disabled="true"
                            v-model="data.basicPrductRemak5"></el-input>
                </el-form-item>
              </el-col>

              <el-col :span="12" v-if="productRemarkSet.remarkEnable6">
                <el-form-item :label="productRemarkSet.remarkTitle6    ">
                  <el-input style="width: 90%" size="small" splaceholder="请输入内容" :disabled="true"
                            v-model="data.basicPrductRemak6"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12" v-if="productRemarkSet.remarkEnable7">
                <el-form-item :label="productRemarkSet.remarkTitle7 ">
                  <el-input style="width: 90%" size="small" splaceholder="请输入内容" :disabled="true"
                            v-model="data.basicPrductRemak7"></el-input>
                </el-form-item>
              </el-col>

              <el-col :span="12" v-if="productRemarkSet.remarkEnable8">
                <el-form-item :label="productRemarkSet.remarkTitle8">
                  <el-input style="width: 90%" size="small" splaceholder="请输入内容" :disabled="true"
                            v-model="data.basicPrductRemak8"></el-input>
                </el-form-item>
              </el-col>
            </el-row>


            <el-row v-if="data.isAudit==2">
              <el-col :span="12">
                <el-form-item label="审核意见:">
                  <el-input style="width: 90%" size="small" splaceholder="请输入审核意见" v-model="remark"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12" class="el-col">
                <el-form-item label="产品描述:">
                  <el-input style="width: 90%" :disabled="true" type="textarea" size="small" rows="1"
                            placeholder="请输入内容" v-model.trim="data.cpms"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </div>
        </el-form>
      </div>
    </el-card>
  </div>
</template>

<script>
import {updateDiProduct} from '@/api/supplier/supProductsAddDi'
import {finProductSet} from "@/api/param/systemParamConfig";

export default {
  name: "ThrProductsDetail",
  props: {
    data: {
      type: Object,
      required: true,
    },
    close: {
      type: Function,
      required: true,
    },
  },
  data() {
    return {
      remark: "",
      productRemarkSet: {}
    }
  },
  methods: {

    checkPass(val) {
      let query = {
        id: this.data.id,
        status: val,
        uuid: this.data.uuid,
        customerId: this.data.customerId,
        remark: this.remark
      }
      updateDiProduct(query).then((res) => {
        if (res.code === 20000) {
          this.$message.success("操作成功!")
          this.close();
        } else {
          this.$message.error(res.message)
        }
      }).catch((error) => {
        this.$message.error(error.message)
      })
    },
    findBasicProductSet() {
      finProductSet().then((response) => {
        if (response.code == 20000) {
          this.productRemarkSet = response.data
        } else {
          //出错了
        }
      })
    },

  },
  created() {
    this.findBasicProductSet()
  }
}
</script>

<style scoped>

</style>
