<template>
    <div>
        <el-card>
            <el-table :data="sysList" style="width: 100%" 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-column label="操作" fixed="right">
                    <template slot-scope="scope">
                        <el-button
                            type="text"
                            size="small"
                            @click="addSelectErp(scope.row)"
                            :disabled="scope.row.thirdId==editQuery.nameCode"
                        >关联
                        </el-button
                        >
                        <el-button type="text" size="small" @click.native.stop="removeErp(scope.row)"
                                   disabled
                        >解绑
                        </el-button>
                    </template>
                </el-table-column>
            </el-table>
        </el-card>
        <el-card>
            <div style=" float: left;
                        text-align: left;
                        font-weight: bold;
                        margin-bottom: 8px">
                <span>产品标识:</span>
            </div>
            <div style=" float: right;
                        text-align: right;
                        margin-bottom: 8px;">
                <el-button type="primary" size="mini" icon="search" @click="removeDi" v-if="productType!=1"
                           style="text-align:right"
                >解绑DI器械信息
                </el-button
                >
            </div>
            <el-table
                v-loading="loading"
                :data="detailList"
                highlight-current-row
                style="width: 100%; margin-top: 20px"
                border
                @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-card>
        <el-card>
            <el-form
                :model="editQuery"
                :rules="rules"
                ref="editQuery"
                label-width="100px"
                style="margin-top: 20px"
            >
                <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.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%"
                                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%"
                                size="small"
                                splaceholder="请输入内容"
                                v-model="editQuery.spmc"
                            ></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"
                                v-model="editQuery.manufactory"
                                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%"
                                size="small"
                                splaceholder="请输入内容"
                                type='number'
                                step="0.01"
                                v-model="editQuery.price"
                            ></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="请输入内容"
                                v-model="editQuery.measname"
                            ></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.cpms"
                            ></el-input>
                        </div>
                    </el-col>
                </el-row>
                <el-row :gutter="20" class="el-row" type="flex">

                    <el-col :span="12" class="el-col" v-if="productRemarkSet.remarkEnable1">
                        <div class="text item">
                            <div class="itemTag">
                                <span>{{ productRemarkSet.remarkTitle1 }}:&nbsp;</span>
                            </div>
                            <el-input
                                style="width: 65%"
                                size="small"
                                splaceholder="请输入内容"
                                v-model="editQuery.basicPrductRemak1"
                            ></el-input>
                        </div>
                    </el-col>

                    <el-col :span="12" class="el-col" v-if="productRemarkSet.remarkEnable2">
                        <div class="text item">
                            <div class="itemTag">
                                <span>{{ productRemarkSet.remarkTitle2 }}:&nbsp;</span>
                            </div>
                            <el-input
                                style="width: 65%"
                                size="small"
                                splaceholder="请输入内容"
                                v-model="editQuery.basicPrductRemak2"
                            ></el-input>
                        </div>
                    </el-col>
                </el-row>

                <el-row :gutter="20" class="el-row" type="flex">

                    <el-col :span="12" class="el-col" v-if="productRemarkSet.remarkEnable3">
                        <div class="text item">
                            <div class="itemTag">
                                <span>{{ productRemarkSet.remarkTitle3 }}:&nbsp;</span>
                            </div>
                            <el-input
                                style="width: 65%"
                                size="small"
                                splaceholder="请输入内容"
                                v-model="editQuery.basicPrductRemak3"
                            ></el-input>
                        </div>
                    </el-col>

                    <el-col :span="12" class="el-col" v-if="productRemarkSet.remarkEnable4">
                        <div class="text item">
                            <div class="itemTag">
                                <span>{{ productRemarkSet.remarkTitle4 }}:&nbsp;</span>
                            </div>
                            <el-input
                                style="width: 65%"
                                size="small"
                                splaceholder="请输入内容"
                                v-model="editQuery.basicPrductRemak4"
                            ></el-input>
                        </div>
                    </el-col>
                </el-row>

                <el-row :gutter="20" class="el-row" type="flex">

                    <el-col :span="12" class="el-col" v-if="productRemarkSet.remarkEnable5">
                        <div class="text item">
                            <div class="itemTag">
                                <span>{{ productRemarkSet.remarkTitle5 }}:&nbsp;</span>
                            </div>
                            <el-input
                                style="width: 65%"
                                size="small"
                                splaceholder="请输入内容"
                                v-model="editQuery.basicPrductRemak5"
                            ></el-input>
                        </div>
                    </el-col>

                    <el-col :span="12" class="el-col" v-if="productRemarkSet.remarkEnable6">
                        <div class="text item">
                            <div class="itemTag">
                                <span>{{ productRemarkSet.remarkTitle6 }}:&nbsp;</span>
                            </div>
                            <el-input
                                style="width: 65%"
                                size="small"
                                splaceholder="请输入内容"
                                v-model="editQuery.basicPrductRemak6"
                            ></el-input>
                        </div>
                    </el-col>
                </el-row>

                <el-row :gutter="20" class="el-row" type="flex">

                    <el-col :span="12" class="el-col" v-if="productRemarkSet.remarkEnable7">
                        <div class="text item">
                            <div class="itemTag">
                                <span>{{ productRemarkSet.remarkTitle7 }}:&nbsp;</span>
                            </div>
                            <el-input
                                style="width: 65%"
                                size="small"
                                splaceholder="请输入内容"
                                v-model="editQuery.basicPrductRemak7"
                            ></el-input>
                        </div>
                    </el-col>

                    <el-col :span="12" class="el-col" v-if="productRemarkSet.remarkEnable8">
                        <div class="text item">
                            <div class="itemTag">
                                <span>{{ productRemarkSet.remarkTitle8 }}:&nbsp;</span>
                            </div>
                            <el-input
                                style="width: 65%"
                                size="small"
                                splaceholder="请输入内容"
                                v-model="editQuery.basicPrductRemak8"
                            ></el-input>
                        </div>
                    </el-col>
                </el-row>


                <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="!isUseDyCheck"
                            >启用使用单元
                            </el-checkbox>
                            <el-checkbox v-model="editQuery.isDisable" disabled
                            >是否禁用
                            </el-checkbox>
                            <el-checkbox v-model="editQuery.isAdavence" disabled
                            >是否寄售
                            </el-checkbox>
                            <el-checkbox v-model="editQuery.allowNoBatch" class=""
                                         disabled
                            >允许无批次号
                            </el-checkbox>
                            <el-checkbox v-model="editQuery.allowNoExpire" class="" disabled
                            >允许无失效日期
                            </el-checkbox>
                            <el-checkbox v-model="editQuery.allowNoProduct" class="" disabled
                            >允许无生产日期
                            </el-checkbox>
                        </div>
                    </el-col>
                </el-row>


                <el-divider></el-divider>

                <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="editQuery.productType==0"
                                        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="editQuery.productType==0"
                                        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="editQuery.productType==0"
                                        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="editQuery.productType==0"
                                        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="editQuery.productType==0"
                                        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="editQuery.productType==0"
                                        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="editQuery.productType==0"
                                        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="editQuery.productType==0"
                                        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="editQuery.productType==0"
                                        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="editQuery.productType==0"
                                        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="editQuery.productType==0"
                                        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="editQuery.productType==0"
                                        size="small"
                                        splaceholder="请输入内容"
                                        v-model="editQuery.qxlb"
                                    ></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="editQuery.productType==0"
                                        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="editQuery.productType==0"
                                        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="editQuery.productType==0"
                                        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="editQuery.productType==0"
                                        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="editQuery.productType==0"
                                        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="editQuery.productType==0"
                                        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="editQuery.productType==0"

                                    ></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="editQuery.productType==0"
                                        v-model="editQuery.bhxjsl"
                                    ></el-input>
                                </div>
                            </el-col>
                        </el-row>
                    </el-collapse-item>

                    <el-collapse-item name="5">
                        <template slot="title">
                            <p class="form-title">版本信息</p>
                        </template>
                        <el-row :gutter="20" class="el-row" type="flex">
                            <el-col :span="8" class="el-col">
                                <div class="text item">
                                    <div class="itemTag">
                                        <span>当前版本号:&nbsp;</span>
                                    </div>
                                    <el-input
                                        style="width: 35%"
                                        :disabled="true"
                                        size="small"
                                        splaceholder="请输入内容"
                                        v-model="editQuery.versionNumber"
                                    ></el-input>
                                </div>
                            </el-col>

                            <el-col :span="2" class="el-col">
                                <el-button type="text" size="small" @click.native.stop="selectVersion()"
                                           style="margin-left: 5%"
                                >切换版本
                                </el-button>
                            </el-col>
                            <el-col :span="2" class="el-col">
                                <el-button type="text" size="small" @click.native.stop="updateVersion()"
                                           :loading="updateLoading"
                                           style="margin-left: 5%"
                                >更新当前版本信息
                                </el-button>
                            </el-col>
                        </el-row>
                    </el-collapse-item>

                </el-collapse>

            </el-form>
        </el-card>
        <div style="text-align: center;margin-top: 12px">
            <el-button type="primary" size="small" icon="search" @click="onAddSubmit"
            >提交
            </el-button>
            <el-button type="primary" size="small" icon="search" @click="closeSelfDialog"
            >取消
            </el-button>
        </div>
        <el-dialog
            :title="selectErpTitle"
            :visible.sync="selectErpDialogVisible"
            width="85%"
            :close-on-click-modal="false"
            :close-on-press-escape="false"
            append-to-body
            v-if="selectErpDialogVisible"
        >
            <selectErp
                :closeDialog="closeDialog"
                :uuid="uuid"
                :relId="relId"
                :intentThirdId="intentThirdId"
                :isImport="isImport"
                :data="thisData"
                :defaultSys="defaultSys"
                @closeUdi="closeUdi"
                :supEnable="true"
            ></selectErp>
        </el-dialog>


        <el-dialog
            title="选择DI版本"
            :visible.sync="selectVersionVisible"
            :close-on-click-modal="false"
            :close-on-press-escape="false"
            width="85%"
            append-to-body
            v-if="selectVersionVisible"
        >
            <selectUdiVersion
                :closeDialog="closeDialog"
                :relId="relId"
                :uuid="uuid"
                :originUuid="originUuid"
                @closeUdi="closeUdi"
            ></selectUdiVersion>
        </el-dialog>
    </div>
</template>

<script>
import {removeDiRl, removeRl, updatetUdiInfos} from "@/api/basic/udiRelevance";
import {finProductSet} from "@/api/param/systemParamConfig";
import selectErp from "./UdiInfoselectErpUdi";
import selectUdiVersion from "./UdiinfoSelectVersion";
import {dlLastVersionByDi} from "../../api/basic/udiInfo";

export default {
    name: "basicProductEdit",
    props: {
        sysList: {
            type: Object,
            required: true,
        },
        detailList: {
            type: Object,
            required: true,
        },
        editQuery: {
            type: Object,
            required: true,
        },
        closeDialog: {
            type: Function,
            required: true,
        },
        productType: {
            type: Object,
            required: true,
        }

    },
    data() {
        return {
            selectErpTitle: "从指定系统添加耗材信息",
            loading: false,
            selectErpDialogVisible: false,  //选入ERP产品
            uuid: "111",
            relId: "",
            intentThirdId: null,
            isImport: false,
            thisData: {
                nameCode: null,
                cpmctymc: null,
                ggxh: null
            },
            defaultSys: null,
            checked: false,
            isUseDyCheck: false,
            activeNames: ['1'],
            productRemarkSet: {},
            relevanceEdit: {
                id: null,
                thirdId: "",
                isDisable: null,
                isUseDy: false,
                isAdavence: null,
            },
            originUuid: null,
            selectVersionVisible: false,
            updateLoading: false,
        }
    },

    methods: {

        onAddSubmit() {
            this.relevanceEdit.isDisable = this.editQuery.isDisable;
            this.relevanceEdit.isLock = this.editQuery.isLock;
            this.relevanceEdit.isAdavence = this.editQuery.isAdavence;
            this.relevanceEdit = this.editQuery;
            if (this.checked == true) {
                this.relevanceEdit.isUseDy = 1;
            } else {
                this.relevanceEdit.isUseDy = 0;
            }
            this.relevanceEdit.id = this.editQuery.rlId,
                updatetUdiInfos(this.relevanceEdit)
                    .then((response) => {
                        if (response.code == 20000) {
                            this.loading = false;
                            this.closeDialog();
                        } else {
                            this.loading = false;
                            this.$message.error(response.message);
                        }

                    })
                    .catch(() => {
                        this.loading = false;
                        this.closeDialog();
                    });
        },

        closeSelfDialog() {
            this.closeDialog();
        },

        closeUdi(val) {
            this.selectErpDialogVisible = false;
            this.closeDialog();
        },

        addSelectErp(row) {
            this.defaultSys = row.sysId;
            this.isImport = false;
            this.selectErpTitle = "从" + row.sysName + "选入耗材信息";
            this.selectErpDialogVisible = true;
        },

        handleDetail(row) {
            let rlId = this.editQuery.rlId;
            this.editQuery = row;
            this.editQuery.rlId = rlId;
        },

        findBasicProductSet() {
            finProductSet().then((response) => {
                if (response.code == 20000) {
                    this.productRemarkSet = response.data;
                } else {
                    //出错了
                }
            });
        },

        removeErp(row) {
            this.$confirm("此操作将解除该绑定产品信息, 是否继续?", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    let query = {
                        relId: this.editQuery.rlId,
                        thirdSys: row.sysId
                    };
                    removeRl(query)
                        .then((response) => {
                            if (response.code == 20000) {
                                this.getThirdSysDetail()();
                                this.$message({
                                    type: "success",
                                    message: "删除成功！",
                                });
                            } else {
                                this.$message.error(response.message);
                            }
                        })
                        .catch(() => {
                        });
                })
                .catch(() => {
                });
        },

        removeDi() {
            this.$confirm("此操作将解除该绑定DI器械信息, 是否继续?", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    let query = {
                        relId: this.editQuery.rlId,
                    };
                    removeDiRl(query)
                        .then((response) => {
                            if (response.code == 20000) {
                                this.$message({
                                    type: "success",
                                    message: "删除成功！",
                                });
                                this.closeUdi();
                            } else {
                                this.$message.error(response.message);
                            }
                        })
                        .catch(() => {
                        });
                })
                .catch(() => {
                });
        },

        selectVersion() {
            this.selectVersionVisible = true;
            this.uuid = this.editQuery.uuid;
            this.originUuid = this.editQuery.originUuid;
            this.relId = this.editQuery.rlId;
        },

        updateVersion() {
            this.$confirm("此操作将访问国家库查询最新版本信息, 是否继续?", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    this.updateLoading = true;
                    let query = {nameCode: this.editQuery.nameCode};
                    dlLastVersionByDi(query)
                        .then((response) => {
                            this.updateLoading = false;
                            if (response.code == 20000) {
                                this.$message.success("更新成功！");
                                this.closeUdi();
                            } else {
                                this.$message.error(response.message);
                            }
                        })
                        .catch(() => {
                            this.updateLoading = false;
                            this.udidlList = [];
                            this.total = 0;
                        });
                })
                .catch(() => {
                });

        },
    },
    created() {
        this.relId = this.editQuery.rlId;
        if (this.editQuery.isUseDy == 1) {
            this.checked = true
        }
        this.findBasicProductSet();
    }
    ,
    components: {
        selectErp, selectUdiVersion
    }


}
</script>


<style scoped>
.itemTag {
    float: left;
    text-align: left;
    margin-top: 10px;
    width: 25%;
}

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


.el-row {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

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

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