<template>
   <div>
     <el-card>
    <el-table :data="sysList" style="width: 100%" key="2" border>
      <el-table-column label="序号" type="index"></el-table-column>
      <el-table-column label="系统名称" prop="sysName" show-overflow-tooltip></el-table-column>
      <el-table-column label="物资编码" prop="thirdId" show-overflow-tooltip></el-table-column>
      <el-table-column label="产品名称" prop="thirdName" show-overflow-tooltip></el-table-column>
      <el-table-column label="规格型号" prop="spec" show-overflow-tooltip></el-table-column>
      <el-table-column label="注册/备案凭证号" prop="registerNo" show-overflow-tooltip></el-table-column>
      <el-table-column label="生产企业" prop="manufactory" show-overflow-tooltip></el-table-column>
    </el-table>


    <el-table v-loading="loading" :data="detailList" style="width: 100%; margin-top: 20px" border key="3" @current-change="handleDetail">
      <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="bzcj" show-overflow-tooltip></el-table-column>
    </el-table>

    <el-form :model="detailQuery" :rules="rules" ref="detailQuery" label-width="100px" style="margin-top: 20px">
      <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="detailQuery.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="!checked"
                  size="small"
                  splaceholder="请输入内容"
                  v-model="detailQuery.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="detailQuery.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="detailQuery.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="detailQuery.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="detailQuery.nameCode"
                ></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="detailQuery.ggxh"
                ></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="detailQuery.qxlb"
                ></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="detailQuery.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="detailQuery.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="请输入内容"
                  v-model="detailQuery.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="detailQuery.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="ylqxzcrbarmc"
                  v-model="detailQuery.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="detailQuery.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="detailQuery.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="detailQuery.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="请输入内容"
                ></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="!checked"
                  size="small"
                  splaceholder="请输入内容"
                  v-model="detailQuery.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="!checked"
                  size="small"
                  splaceholder="请输入内容"
                  v-model="detailQuery.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="!checked"
                  size="small"
                  v-model="detailQuery.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="!checked"
                  size="small"
                  splaceholder="请输入内容"
                  v-model="detailQuery.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="!checked"
                  v-model="detailQuery.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="detailQuery.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="detailQuery.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="detailQuery.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="detailQuery.bhxjsl"
                ></el-input>
              </div>
            </el-col>
          </el-row>

        </el-collapse-item>

      </el-collapse>

      <el-row :gutter="20" class="el-row" type="flex">
        <el-col :span="24" class="el-col">
          <div style="margin-top: 18px;margin-bottom: 18px">
            <el-checkbox v-model="checked" disabled
            >启用使用单元
            </el-checkbox>
            <el-checkbox v-model="detailQuery.isDisable" disabled
            >是否禁用
            </el-checkbox>
            <el-checkbox v-model="detailQuery.isAdavence" disabled
            >是否寄售
            </el-checkbox>
            <el-checkbox v-model="detailQuery.allowNoBatch" disabled
            >允许无批次号
            </el-checkbox>
            <el-checkbox v-model="detailQuery.allowNoExpire" disabled
            >允许无失效日期
            </el-checkbox>
            <el-checkbox v-model="detailQuery.allowNoProduct" disabled
            >允许无生产日期
            </el-checkbox>
          </div>
        </el-col>
      </el-row>
    </el-form>
     </el-card>
   </div>
</template>

<script>
import {filterDetail} from "@/api/basic/udiinfoImport";
import {thirdSysDetail} from "@/api/basic/udiRelevance";
import {filterByUuid} from "@/api/basic/udiInfo";

export default {
  name: "udilnfoManageSpDetail",
  props: {
    detailQuery: {
      type: Object,
      required: true,
    },
    relevanceEdit: {
      type: Object,
      required: true,
    },
    checked:{
      type: Boolean,
      required: true,
    },
  },
  data() {
    return {
      sysList: [],
      detailList:[],
      relevanceEdit: {
        id: null,
        thirdId: "",
        isDisable: null,
        isUseDy: false,
        isLock: null,
        isAdavence: null,
      },
    }
  },
  methods: {

    getThirdSysDetail() {
      let query = {
        id: this.relevanceEdit.id,
      };

      thirdSysDetail(query)
        .then((response) => {
          this.loading = false;
          this.sysList = response.data.list || [];
        })
        .catch(() => {
          this.loading = false;
          this.sysList = [];
        });
    },
    getDetailList() {
      let ttquery = {
        id: this.detailQuery.rlId
      };
      this.loading = true;
      filterByUuid(ttquery)
        .then((response) => {
          this.isUseDyCheck = false;
          this.loading = false;
          this.detailList = response.data || [];
          this.detailList.forEach((item, index, array) => {
            if (item.zxxsbzbhsydysl > 1) {
              this.isUseDyCheck = true;
            }
          });
        })
        .catch(() => {
          this.loading = false;
          this.detailList = [];
        });
    },
  },
  created() {
    this.getThirdSysDetail();
    this.getDetailList(this.detailQuery.id);
  }
}

</script>

<style scoped>
.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;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.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>
