<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="packLevel" show-overflow-tooltip></el-table-column>
      <el-table-column label="层级单位" prop="packUnit" show-overflow-tooltip></el-table-column>
      <el-table-column label="上级标识" prop="sjcpbm" show-overflow-tooltip></el-table-column>
      <el-table-column label="下级标识" prop="bhxjcpbm" show-overflow-tooltip></el-table-column>
      <el-table-column label="下级数量" prop="bhxjsl" 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="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.bzgg"
                ></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.prepnSpec"
                ></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.prepnUnit"
                ></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="请输入内容"
                  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="请输入内容"
                  v-model="detailQuery.manufactory"
                ></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>

    </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: "drugInfoManageSpDetail",
  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,
      },
      activeNames: ["2"]
    }
  },
  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() {
    console.log("detailQuery",this.detailQuery)
    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>
