<template>
    <div>
      <el-table :data="sysList" style="width: 100%" border highlight-current-row>
        <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="thirdName" show-overflow-tooltip></el-table-column>
        <el-table-column label="第三方产品ID" prop="thirdId" show-overflow-tooltip></el-table-column>
      </el-table>

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


      <el-form :model="editQuery" :rules="rules" ref="editQuery" label-width="190px" style="margin-top: 20px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="产品名称" prop="cpmctymc">
              <el-input style="width: 90%" size="small" splaceholder="请输入产品名称" :disabled="true" v-model="editQuery.cpmctymc"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12" class="el-col">
            <el-form-item label="产品标识" prop="nameCode">
              <el-input style="width: 90%" :disabled="true" size="small" splaceholder="请输入产品标识" v-model="editQuery.nameCode"></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12" class="el-col">
            <el-form-item label="规格型号" prop="ggxh">
              <el-input style="width: 90%" :disabled="true" size="small" splaceholder="请输入内容" v-model="editQuery.ggxh"></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="12" class="el-col">
            <el-form-item label="器械类别" prop="qxlb">
              <el-input style="width: 90%" :disabled="true" size="small" splaceholder="请输入器械类别" v-model="editQuery.qxlb"></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12" class="el-col">
            <el-form-item label="产品类别" prop="cplb">
              <el-input style="width: 90%" :disabled="true" size="small" splaceholder="请输入产品类别" v-model="editQuery.cplb"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12" class="el-col">
            <el-form-item label="分类编码" prop="flbm">
              <el-input style="width: 90%" :disabled="true" size="small" splaceholder="请输入分类编码" v-model="editQuery.flbm"></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12" class="el-col">
            <el-form-item label="商品条码" prop="sptm">
              <el-input style="width: 90%" :disabled="true" size="small" splaceholder="请输入商品条码" v-model="editQuery.sptm"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12" class="el-col">
            <el-form-item label="医保编码" prop="ybbm">
              <el-input style="width: 90%" :disabled="true" size="small" splaceholder="请输入医保编码" v-model="editQuery.ybbm"></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12" class="el-col">
            <el-form-item label="医疗器械注册人" prop="ylqxzcrbarmc">
              <el-input style="width: 90%" :disabled="true" size="small" splaceholder="请输入医疗器械注册人" v-model="editQuery.ylqxzcrbarmc"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12" class="el-col">
            <el-form-item label="注册人英文名称" prop="ylqxzcrbarywmc">
              <el-input style="width: 90%" :disabled="true" size="small" splaceholder="请输入注册人英文名称" v-model="editQuery.ylqxzcrbarywmc"></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12" class="el-col">
            <el-form-item label="统一社会信用号" prop="tyshxydm">
              <el-input style="width: 90%" :disabled="true" size="small" splaceholder="请输入统一社会信用号" v-model="editQuery.tyshxydm"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12" class="el-col">
            <el-form-item label="注册证/备案号" prop="zczbhhzbapzbh">
              <el-input style="width: 90%" :disabled="true" size="small" splaceholder="请输入注册证/备案号" v-model="editQuery.zczbhhzbapzbh"></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12" class="el-col">
            <el-form-item label="上级产品编码" prop="sjcpbm">
              <el-input style="width: 90%" :disabled="true" size="small" splaceholder="请输入上级产品编码" v-model="editQuery.sjcpbm"></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="12" class="el-col">
            <el-form-item label="包装级别" prop="packLevel">
              <el-input style="width: 90%" size="small" splaceholder="请输入包装级别" :disabled="true" v-model="editQuery.packLevel"></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12" class="el-col">
            <el-form-item label="包装单位/包装级别" prop="bzcj">
              <el-input style="width: 90%" size="small" splaceholder="请输入包装单位/包装级别" v-model="editQuery.bzcj" :disabled="true"></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="12" class="el-col">
            <el-form-item label="包含下级包装数量" prop="bhxjsl">
              <el-input style="width: 90%" size="small" splaceholder="请输入包含下级包装数量" :disabled="true" v-model="editQuery.bhxjsl"></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12" class="el-col">
            <el-form-item label="包含下级产品编码" prop="bhxjcpbm">
              <el-input style="width: 90%" size="small" :disabled="true" splaceholder="请输入包含下级产品编码" v-model="editQuery.bhxjcpbm"></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="12" class="el-col">
            <el-form-item label="包含最小销售包装数量" prop="bhzxxsbzsl">
              <el-input style="width: 90%" size="small" :disabled="true" splaceholder="请输入包含最小销售包装数量" v-model="editQuery.bhzxxsbzsl"></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12" class="el-col">
            <el-form-item label="是否包含批号" prop="scbssfbhph">
              <el-input style="width: 90%" :disabled="true" size="small"  v-model="editQuery.scbssfbhph"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12" class="el-col">
            <el-form-item label="是否包含序列号" prop="scbssfbhxlh">
              <el-input style="width: 90%" :disabled="true" size="small" v-model="editQuery.scbssfbhxlh" splaceholder="请输入内容"></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12" class="el-col">
            <el-form-item label="是否包含生产日期" prop="scbssfbhscrq">
              <el-input style="width: 90%" :disabled="true" size="small" v-model="editQuery.scbssfbhscrq"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12" class="el-col">
            <el-form-item label="是否包含失效日期" prop="scbssfbhsxrq">
              <el-input style="width: 90%" :disabled="true" v-model="editQuery.scbssfbhsxrq" ></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12" class="el-col">
            <el-form-item label="产品描述" prop="cpms">
              <el-input style="width: 90%" :disabled="true" size="small"  v-model="editQuery.cpms"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12" class="el-col">
            <el-form-item label="计量单位" prop="measname">
              <el-input style="width: 90%" :disabled="true" size="small" splaceholder="请输入内容" v-model="editQuery.measname"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row >
          <el-col :span="12" class="el-col">
            <el-form-item label="最小包装单元内包含使用单元数量" prop="zxxsbzbhsydysl">
              <el-input style="width: 90%" :disabled="!checked" size="small" splaceholder="请输入内容" v-model="editQuery.zxxsbzbhsydysl"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>

    </div>
</template>

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

export default {
    name: "UdiRlDetail",
    props: {
        editQuery: {
            type: Object,
            required: true,
        },
    },
    data() {
        return {
            sysList: [],
            checked: false,
            detailList: [],
            loading: false,
        }
    },
    methods: {
        getThirdSysDetail() {
            let query = {
                id: this.editQuery.rlId,
            };

            thirdSysDetail(query)
                .then((response) => {
                    this.loading = false;
                    this.sysList = response.data.list || [];
                })
                .catch(() => {
                    this.loading = false;
                    this.sysList = [];
                });
        },
        getDetailList(detailQuery) {
            this.loading = true;
            filterByUuid(detailQuery)
                .then((response) => {
                    this.loading = false;
                    this.detailList = response.data || [];
                })
                .catch(() => {
                    this.loading = false;
                    this.detailList = [];
                });
        },
    },

    created() {
        if(this.editQuery.isUseDy==1){
            this.checked=true
        }
        let ttquery = {
            id: this.editQuery.rlId,
            page: 1,
            limit: 10,
        };
        this.getDetailList(ttquery);
        this.getThirdSysDetail();
    },
}
</script>

<style scoped>

</style>
