<template>
    <div>
      <el-card>
        <div style="
                  float: left;
                  text-align: left;
                  font-weight: bold;
                  margin-bottom: 8px;
                ">
          <span>产品标识:</span>
        </div>

        <el-table  :data="detailList" style="width: 100%" border key="3" highlight-current-row>
          <el-table-column label="产品最小销售标识" prop="nameCode" show-overflow-tooltip></el-table-column>
          <el-table-column label="物资名称" prop="cpmctymc" show-overflow-tooltip></el-table-column>
          <el-table-column label="包装级别" prop="packLevel" show-overflow-tooltip></el-table-column>
          <el-table-column label="包装单位" prop="packUnit" show-overflow-tooltip></el-table-column>
        </el-table>
      </el-card>
        <el-card>
            <el-form :model="editQuery" :rules="rules" ref="editQuery"   label-width="150px" style="margin-top: 20px" >

              <el-row v-if="editQuery.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>

              <el-row>
                <el-col :span="12">
                  <el-form-item label="审核意见:">
                    <el-input style="width: 65%"  size="small" :disabled="editQuery.isAudit!=2" splaceholder="请输入审核意见" v-model="remark"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>

              <el-row>
                <el-col :span="12" class="el-col">
                  <el-form-item label="商品条码:">
                    <el-input style="width: 65%" size="small" :disabled="true" splaceholder="请输入内容" v-model="editQuery.sptm"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12" class="el-col">
                  <el-form-item label="医保编码:">
                    <el-input style="width: 65%" size="small" :disabled="true" splaceholder="请输入内容" v-model="editQuery.ybbm" @input="change($event)"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>

              <el-row>
                <el-col :span="12" class="el-col">
                  <el-form-item label="计量单位:">
                    <el-input style="width: 65%" size="small" :disabled="true" splaceholder="请输入内容" v-model="editQuery.measname"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12" class="el-col">
                  <el-form-item label="生产企业:">
                    <el-input style="width: 65%" size="small" :disabled="true" v-model="editQuery.manufactory" splaceholder="请输入内容" @input="change($event)"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>

              <el-row>
                <el-col :span="12" class="el-col">
                  <el-form-item label="商品名称:">
                    <el-input style="width: 65%" size="small" :disabled="true" splaceholder="请输入内容" v-model="editQuery.cpmctymc"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12" class="el-col">
                  <el-form-item label="产品描述:">
                    <el-input style="width: 65%" size="small" :disabled="true" splaceholder="请输入内容"   v-model="editQuery.cpms"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>

              <el-row>
                <el-col :span="12" class="el-col">
                  <el-form-item label="产品价格:">
                    <el-input style="width: 65%" size="small" :disabled="true"  splaceholder="请输入内容" type="number" step="0.01" v-model="editQuery.price"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>


              <el-row>
                <el-col :span="12" class="el-col" v-if="productRemarkSet.remarkEnable1">
                  <el-form-item :label="productRemarkSet.remarkTitle1 ">
                    <el-input style="width: 65%" size="small" splaceholder="请输入内容" :disabled="true" v-model="editQuery.basicPrductRemak1"></el-input>
                  </el-form-item>
                </el-col>

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

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

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

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

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

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

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

                <el-collapse v-model="activeNames">
                    <el-collapse-item name="1">
                        <template slot="title">
                            <p class="form-title">产品标识基本信息</p>
                        </template>
                      <el-row :gutter="20" class="el-row" type="flex">
                            <el-col :span="12" class="el-col">
                              <div class="text item">
                                <div class="itemTag">
                                  <span>产品标识:&nbsp;</span>
                                </div>
                                    <el-input style="width: 65%" :disabled="true" size="small" splaceholder="请输入内容" v-model="editQuery.nameCode"></el-input>
                              </div>
                            </el-col>
                            <el-col :span="12" class="el-col">
                                <div class="text item">
                                  <div class="itemTag">
                                    <span>最小包装单元内包含使用单元数量:&nbsp;</span>
                                  </div>
                                    <el-input style="width: 65%" :disabled="true" size="small" splaceholder="请输入内容" v-model="editQuery.zxxsbzbhsydysl"></el-input>
                                </div>
                            </el-col>
                        </el-row>

                          <el-row :gutter="20" class="el-row" type="flex">
                            <el-col :span="12" class="el-col">
                                <div class="text item">
                                  <div class="itemTag">
                                    <span>包含下级产品编码:&nbsp;</span>
                                  </div>
                                <el-input style="width: 65%" size="small" :disabled="true" splaceholder="请输入内容" v-model="editQuery.bhxjcpbm"></el-input>
                                </div>
                            </el-col>

                            <el-col :span="12" class="el-col">
                                <div class="text item">
                                  <div class="itemTag">
                                    <span>包含最小销售包装数量:&nbsp;</span>
                                  </div>
                                    <el-input style="width: 65%" size="small" :disabled="true" splaceholder="请输入内容" v-model="editQuery.bhzxxsbzsl"></el-input>
                                </div>
                            </el-col>
                        </el-row>

                    </el-collapse-item>

                    <el-collapse-item name="2">
                        <template slot="title">
                            <p class="form-title">产品基本信息</p>
                        </template>

                      <el-row :gutter="20" class="el-row" type="flex">
                            <el-col :span="12" class="el-col">
                                <div class="text item">
                                  <div class="itemTag">
                                    <span>物资名称:&nbsp;</span>
                                  </div>
                                    <el-input style="width: 65%" size="small" splaceholder="请输入内容" :disabled="true" v-model="editQuery.cpmctymc"></el-input>
                                </div>
                            </el-col>

                            <el-col :span="12" class="el-col">
                                <div class="text item">
                                  <div class="itemTag">
                                    <span>规格型号:&nbsp;</span>
                                  </div>
                                    <el-input style="width: 65%" :disabled="true" size="small" splaceholder="请输入内容" v-model="editQuery.ggxh"></el-input>
                                </div>
                            </el-col>
                        </el-row>

                         <el-row :gutter="20" class="el-row" type="flex">
                            <el-col :span="12" class="el-col">
                                <div class="text item">
                                  <div class="itemTag">
                                    <span>产品类别:&nbsp;</span>
                                  </div>
                                    <el-input style="width: 65%" :disabled="true" size="small" splaceholder="请输入内容" v-model="editQuery.cplb"></el-input>
                                </div>
                            </el-col>
                            <el-col :span="12" class="el-col">
                                <div class="text item">
                                  <div class="itemTag">
                                    <span>分类编码:&nbsp;</span>
                                  </div>
                                    <el-input style="width: 65%" :disabled="true" size="small" splaceholder="请输入内容" v-model="editQuery.flbm"></el-input>
                                </div>
                            </el-col>
                        </el-row>

                          <el-row :gutter="20" class="el-row" type="flex">
                            <el-col :span="12" class="el-col">
                                <div class="text item">
                                  <div class="itemTag">
                                    <span>医疗器械注册人:&nbsp;</span>
                                  </div>
                                    <el-input style="width: 65%" :disabled="true" size="small" splaceholder="ylqxzcrbarmc" v-model="editQuery.ylqxzcrbarmc"></el-input>
                                </div>
                            </el-col>
                            <el-col :span="12" class="el-col">
                                <div class="text item">
                                  <div class="itemTag">
                                    <span>注册人英文名称:&nbsp;</span>
                                  </div>
                                    <el-input style="width: 65%" :disabled="true" size="small" splaceholder="请输入内容" v-model="editQuery.ylqxzcrbarywmc"></el-input>
                                </div>
                            </el-col>
                        </el-row>

                          <el-row :gutter="20" class="el-row" type="flex">
                            <el-col :span="12" class="el-col">
                                <div class="text item">
                                  <div class="itemTag">
                                    <span>器械类别:&nbsp;</span>
                                  </div>
                                    <el-input style="width: 65%" :disabled="true" size="small" splaceholder="请输入内容" v-model="editQuery.qxlb"></el-input>
                                </div>
                            </el-col>
                            <el-col :span="12" class="el-col">
                                <div class="text item">
                                  <div class="itemTag">
                                    <span>生产企业:&nbsp;</span>
                                  </div>
                                    <el-input style="width: 65%" :disabled="true" size="small" splaceholder="请输入内容" v-model="editQuery.manufactory"></el-input>
                                </div>
                            </el-col>
                        </el-row>

                         <el-row :gutter="20" class="el-row" type="flex">
                            <el-col :span="12" class="el-col">
                                <div class="text item">
                                  <div class="itemTag">
                                    <span>商品条码:&nbsp;</span>
                                  </div>
                                    <el-input style="width: 65%" size="small" :disabled="true" splaceholder="请输入内容" v-model="editQuery.sptm"></el-input>
                                </div>
                            </el-col>
                            <el-col :span="12" class="el-col">
                                <div class="text item">
                                  <div class="itemTag">
                                    <span>医保编码:&nbsp;</span>
                                  </div>
                                    <el-input style="width: 65%" :disabled="true" size="small" splaceholder="请输入内容" v-model="editQuery.ybbm"></el-input>
                                </div>
                            </el-col>
                        </el-row>

                          <el-row :gutter="20" class="el-row" type="flex">
                            <el-col :span="12" class="el-col">
                                <div class="text item">
                                  <div class="itemTag">
                                    <span>统一社会信用号:&nbsp;</span>
                                  </div>
                                    <el-input style="width: 65%" :disabled="true" size="small" splaceholder="请输入内容" v-model="editQuery.tyshxydm"></el-input>
                                </div>
                            </el-col>
                            <el-col :span="12" class="el-col">
                                <div class="text item">
                                  <div class="itemTag">
                                    <span>注册证/备案号:&nbsp;</span>
                                  </div>
                                    <el-input style="width: 65%" :disabled="true" size="small" splaceholder="请输入内容" v-model="editQuery.zczbhhzbapzbh"></el-input>
                                </div>
                            </el-col>
                        </el-row>

                          <el-row :gutter="20" class="el-row" type="flex">
                            <el-col :span="12" class="el-col">
                                <div class="text item">
                                  <div class="itemTag">
                                    <span>产品描述:&nbsp;</span>
                                  </div>
                                    <el-input style="width: 65%" :disabled="!checked" size="small" splaceholder="请输入内容" v-model="editQuery.cpms"></el-input>
                                </div>
                            </el-col>
                        </el-row>
                    </el-collapse-item>


                    <el-collapse-item name="3">
                        <template slot="title">
                            <p class="form-title">生产标识基本信息</p>
                        </template>

                      <el-row :gutter="20" class="el-row" type="flex">
                            <el-col :span="12" class="el-col">
                                <div class="text item">
                                  <div class="itemTag">
                                    <span>是否包含批号:&nbsp;</span>
                                  </div>
                                    <el-input style="width: 65%" :disabled="true" size="small" splaceholder="请输入内容" v-model="editQuery.scbssfbhph"></el-input>
                                </div>
                            </el-col>
                            <el-col :span="12" class="el-col">
                                <div class="text item">
                                  <div class="itemTag">
                                    <span>是否包含序列号:&nbsp;</span>
                                  </div>
                                    <el-input style="width: 65%" :disabled="true" size="small" v-model="editQuery.scbssfbhxlh" splaceholder="请输入内容"></el-input>
                                </div>
                            </el-col>
                        </el-row>

                          <el-row :gutter="20" class="el-row" type="flex">
                            <el-col :span="12" class="el-col">
                                <div class="text item">
                                  <div class="itemTag">
                                    <span>是否包含生产日期:&nbsp;</span>
                                  </div>
                                    <el-input style="width: 65%" :disabled="true" size="small" splaceholder="请输入内容" v-model="editQuery.scbssfbhscrq"></el-input>
                                </div>
                            </el-col>
                            <el-col :span="12" class="el-col">
                                <div class="text item">
                                  <div class="itemTag">
                                    <span>是否包含失效日期:&nbsp;</span>
                                  </div>
                                    <el-input style="width: 65%" :disabled="true" v-model="editQuery.scbssfbhsxrq" size="small" splaceholder="请输入内容"></el-input>
                                </div>
                            </el-col>
                        </el-row>
                    </el-collapse-item>

                    <el-collapse-item name="4">
                        <template slot="title">
                            <p class="form-title">包装标识信息</p>
                        </template>

                          <el-row :gutter="20" class="el-row" type="flex">
                            <el-col :span="12" class="el-col">
                                <div class="text item">
                                  <div class="itemTag">
                                    <span>上级产品编码:&nbsp;</span>
                                  </div>
                                    <el-input style="width: 65%" :disabled="true" size="small" splaceholder="请输入内容" v-model="editQuery.sjcpbm"></el-input>
                                </div>
                            </el-col>
                            <el-col :span="12" class="el-col">
                                <div class="text item">
                                  <div class="itemTag">
                                    <span>包装级别:&nbsp;</span>
                                  </div>
                                    <el-input style="width: 65%" size="small" splaceholder="请输入内容" :disabled="true" v-model="editQuery.packLevel"></el-input>
                                </div>
                            </el-col>
                        </el-row>

                          <el-row :gutter="20" class="el-row" type="flex">
                            <el-col :span="12" class="el-col">
                                <div class="text item">
                                  <div class="itemTag">
                                    <span>包装级别:&nbsp;</span>
                                  </div>
                                    <el-input style="width: 65%" size="small" splaceholder="请输入内容" v-model="editQuery.bzcj" :disabled="true"></el-input>
                                </div>
                            </el-col>

                            <el-col :span="12" class="el-col">
                                <div class="text item">
                                  <div class="itemTag">
                                    <span>包含下级包装数量:&nbsp;</span>
                                  </div>
                                    <el-input style="width: 65%" size="small" splaceholder="请输入内容" :disabled="true" v-model="editQuery.bhxjsl"></el-input>
                                </div>
                            </el-col>
                        </el-row>
                    </el-collapse-item>

                </el-collapse>

            </el-form>
        </el-card>
    </div>
</template>

<script>

import { updateDiProduct } from '@/api/supplier/supProductsAddDi'
import { finProductSet } from '@/api/param/systemParamConfig'
import { selectOriginuuid } from '@/api/basic/product/udiInfo'

export default {
    name: "SelectDIDetailDialog",
    props: {
        editQuery: {
            type: Object,
            required: true,
        },
      close:{
          type:Function,
          required: true,
      },
      editDate: {
        type: Object,
        required: true,
      },
      remark: {
        type: Object,
        required: true,
      }
    },
    data() {
        return {
            activeNames: ['1'],
            remark:"",
          detailList:[],
          productRemarkSet:{}
        }
    },
    methods: {

      checkPass(val) {
        let query = {
          id: this.editDate.id,
          status: val,
          uuid: this.editDate.uuid,
          customerId: this.editDate.customerId,
          remark: this.remark
        }
        updateDiProduct(query).then((res) => {
          if (res.code === 20000) {
          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 {
            //出错了
          }
        })
      },
      getDetailList(detailQuery) {
        selectOriginuuid(detailQuery)
          .then((response) => {
            this.detailList = response.data || [];
          })
          .catch(() => {
            this.detailList = [];
          });
      },
    },

    created() {
      this.findBasicProductSet()
      //获取产品标识列表
      let ttquery = {
        uuid: this.editQuery.uuid,
      };
      this.getDetailList(ttquery);
    },
};
</script>

<style scoped>

.form-title {
  font-size: 16px;
  font-family: Noto Sans SC;
  font-weight: bold;
  color: #303133;
  padding-bottom: 17px;
  padding-top: 17px;
}
.itemTag {
  float: left;
  text-align: right;
  margin-top: 5px;
  padding-right: 10px;
  width: 35%;
}

.text {
  font-size: 13px;
  font-family: "Microsoft YaHei";
}

.query-form-item {
  display: block !important;
  margin-right: 10px;
  margin-bottom: 5px;
}

.edit-row {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 0px;
}

.el-row {
  display: flex;
}

/* .el-col {
  border-radius: 4px;
  flex-wrap: wrap;
} */

.el-table .cell.el-tooltip {
  white-space: pre-wrap;
}

.form-title {
  font-size: 16px;
  font-family: Noto Sans SC;
  font-weight: bold;
  color: #303133;
  padding-bottom: 17px;
  padding-top: 17px;
}
</style>
