<template>
    <div>
        <el-card>
            <el-form :inline="true" :model="filterQuery" size="mini">

                <el-row>
                    <el-form-item class="query-form-item">
                        <el-input v-model="filterQuery.unionCode" placeholder="DI/医保编码/商品条码"
                                  clearable="true"></el-input>
                    </el-form-item>
                    <el-form-item class="query-form-item">
                        <el-input v-model="filterQuery.cpmctymc" placeholder="产品通用名" clearable="true"></el-input>
                    </el-form-item>
                    <el-form-item class="query-form-item">
                        <el-input v-model="filterQuery.ggxh" placeholder="规格型号" clearable="true"></el-input>
                    </el-form-item>
                    <el-form-item class="query-form-item">
                        <el-select v-model="filterQuery.filterType" placeholder="请选择过滤对照条件">
                            <el-option
                                v-for="item in filterList"
                                :key="item.filterType"
                                :label="item.sysName"
                                :value="item.filterType">
                                <span style="float: left">{{ item.sysName }}</span>
                            </el-option>
                        </el-select>
                    </el-form-item>
                </el-row>

                <el-row>
                    <el-form-item class="query-form-item">
                        <el-input v-model="filterQuery.ylqxzcrbarmc" placeholder="生产企业/注册备案人"
                                  clearable="true"></el-input>
                    </el-form-item>
                    <el-form-item class="query-form-item">
                        <el-input v-model="filterQuery.thrPiId" placeholder="第三方产品编码" clearable="true"></el-input>
                    </el-form-item>
                    <!--                    <el-form-item class="query-form-item">-->
                    <!--                        <el-select v-model="filterQuery.auditStatus" placeholder="审核状态">-->
                    <!--                            <el-option label="全部" value=""></el-option>-->
                    <!--                            <el-option label="通过" value='1'></el-option>-->
                    <!--                            <el-option label="不通过" value='2'></el-option>-->
                    <!--                            <el-option label="反审" value='3'></el-option>-->
                    <!--                            <el-option label="申请反审" value='4'></el-option>-->
                    <!--                            <el-option label="拒绝反审" value='5'></el-option>-->
                    <!--                        </el-select>-->
                    <!--                    </el-form-item>-->
                    <el-form-item class="query-form-item" v-if="isSpCombine">
                        <el-select v-model="filterQuery.lockStatus" placeholder="审核状态">
                            <el-option label="全部" value=""></el-option>
                            <el-option label="未提交" value="1"></el-option>
                            <el-option label="已提交" value="2"></el-option>
                            <el-option label="已锁定" value="3"></el-option>
                        </el-select>
                    </el-form-item>

                    <el-form-item>
                        <el-button-group>
                            <el-button type="primary" icon="el-icon-refresh" @click="onReset"></el-button>
                            <el-button type="primary" icon="search" @click="getList">查询</el-button>
                            <!--<el-button type="primary" icon="search" @click="intentDetail"-->
                            <!--&gt;关联选入-->
                            <!--</el-button>-->

                            <!--<el-button type="primary" icon="search" @click="intentImportUdi"-->
                            <!--&gt;选入DI器械-->
                            <!--</el-button-->
                            <!--&gt;-->


                            <el-button
                                type="primary"
                                icon="search"
                                @click="selectProduct()"
                            >选入产品
                            </el-button
                            >
                            <el-button type="primary" icon="search" @click="intentImportErp"
                            >添加产品信息
                            </el-button
                            >
<!--                            <el-button type="primary" @click="addProductVisible=true">新增产品信息</el-button>-->
                        </el-button-group>
                    </el-form-item>
                </el-row>
            </el-form>
            <el-table
                v-loading="loading"
                :data="list"
                style="width: 100%"
                @selection-change="handleSelectionChange"
            >
                <el-table-column label="序号" type="index"></el-table-column>
                <el-table-column
                    label="最小销售产品标识"
                    prop="nameCode"
                    width="140"
                    show-overflow-tooltip
                ></el-table-column>
                <el-table-column
                    label="产品编码"
                    prop="thirdId"
                    show-overflow-tooltip
                ></el-table-column>
                <el-table-column
                    label="生产企业"
                    prop="ylqxzcrbarmc"
                    show-overflow-tooltip
                ></el-table-column>
                <el-table-column
                    label="产品通用名"
                    prop="cpmctymc"
                    show-overflow-tooltip
                ></el-table-column>
                <el-table-column
                    label="规格型号"
                    prop="ggxh"
                    show-overflow-tooltip
                ></el-table-column>
                <el-table-column
                    label="注册/备案凭证"
                    prop="zczbhhzbapzbh"
                    show-overflow-tooltip
                ></el-table-column>
                <el-table-column
                    label="器械类别"
                    prop="qxlb"
                    show-overflow-tooltip
                ></el-table-column>
                <el-table-column
                    v-if="isSpCombine"
                    label="审核状态"
                    prop="lockStatus"
                    show-overflow-tooltip
                >
                    <template slot-scope="scope">
                        {{ lockStatusMap[scope.row.lockStatus] }}
                    </template>
                </el-table-column>
                <el-table-column width="200" label="操作" fixed="right">
                    <template slot-scope="scope">

                        <el-button
                            v-if="isSpCombine"
                            type="text"
                            size="small"
                            :disabled="scope.row.thirdId == null
                            || scope.row.thirdId == ''
                            || scope.row.flbm!=null
                            || scope.row.lockStatus===3"
                            @click.native.stop="intentSelectUdi(scope.row)"
                        >关联DI
                        </el-button>
                        <!--<el-button-->
                        <!--type="text"-->
                        <!--size="small"-->
                        <!--@click.native.stop="intentSelectErp(scope.row)"-->
                        <!--&gt;关联ERP-->
                        <!--</el-button>-->
                        <!--:disabled="scope.row.tyshxydm == null"-->
                        <el-button
                            v-if="scope.row.lockStatus!=3"
                            type="text"
                            size="small"
                            :disabled="scope.row.lockStatus===3"
                            @click.native.stop="handleModifyClick(scope.row)"
                        >编辑
                        </el-button>
                        <el-button
                            v-if=" scope.row.lockStatus==3"
                            type="text"
                            size="small"
                            @click.native.stop="handleDetailClick(scope.row)"
                        >详情
                        </el-button>
                        <el-button
                            v-if="isSpCombine"
                            type="text"
                            size="small"
                            :disabled="scope.row.lockStatus===3"
                            @click.native.stop="sumitLockStatus(scope.row)"
                        >提交审核
                        </el-button>


                        <el-button type="text" size="small"
                                   @click.native.stop="deleteCompanyProductRelevance(scope.row)"
                        >移除
                        </el-button>
                    </template>
                </el-table-column>
            </el-table>
            <el-dialog
                title="产品信息编辑"
                :visible.sync="editDialogVisible"
                width="70%"
                :close-on-click-modal="false"
                :close-on-press-escape="false"
                v-if="editDialogVisible"
            >
                <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>
                                <!--                                :disabled="editQuery.flbm==null || scope.row.thirdId==null || scope.row.thirdId==''"-->
                            </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"
                        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-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="请输入内容"
                                    :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.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="false"
                                    size="small"
                                    splaceholder="请输入内容"
                                    v-model="editQuery.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="false"
                                    size="small"
                                    splaceholder="请输入内容"
                                    v-model="editQuery.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="false"
                                    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="false"
                                    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%"
                                    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%"
                                    :disabled="false"
                                    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="false"
                                    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="false"
                                    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="false"
                                    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="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-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-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.zxxsbzbhsydysl"
                                ></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="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%"
                                    :disabled="!checked"
                                    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="!checked"
                                    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="!checked"
                                    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="!checked"
                                    v-model="editQuery.scbssfbhsxrq"
                                    size="small"
                                    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="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">
                        </el-col>
                        <el-col :span="4" class="el-col">
                            <el-form-item prop="name">
                                <el-checkbox v-model="checked" class="text item itemTag"
                                >以使用单元数量入库
                                </el-checkbox>
                            </el-form-item>
                        </el-col>
                        <el-col :span="3" class="el-col">
                            <el-form-item prop="name">
                                <el-checkbox v-model="editQuery.isDisable" class="text item itemTag"
                                >是否禁用
                                </el-checkbox>
                            </el-form-item>
                        </el-col>
                        <el-col :span="3" class="el-col">
                            <el-form-item prop="name">
                                <el-checkbox v-model="editQuery.isAdavence" class="text item itemTag"
                                >是否寄售
                                </el-checkbox>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-form>

                <div style="text-align: center">
                    <el-button type="primary" size="small" icon="search" @click="onAddSubmit"
                    >提交
                    </el-button>
                    <el-button type="primary" size="small" icon="search" @click="cancelDialog"
                    >取消
                    </el-button>
                </div>
            </el-dialog>
            <el-dialog
                title="产品信息详情"
                :visible.sync="detailDialogVisible"
                width="70%"
                :close-on-click-modal="false"
                :close-on-press-escape="false"
                v-if="detailDialogVisible"
            >


                <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
                                >关联
                                </el-button
                                >
                                <el-button type="text" size="small" @click.native.stop="removeErp(scope.row)"
                                           disabled
                                >解绑
                                </el-button>
                                <!--                                :disabled="editQuery.flbm==null || scope.row.thirdId==null || scope.row.thirdId==''"-->
                            </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" disabled
                        >解绑DI器械信息
                        </el-button
                        >

                    </div>

                    <el-table
                        v-loading="loading"
                        :data="detailList"
                        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-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="请输入内容"
                                    :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.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="false"
                                    size="small"
                                    splaceholder="请输入内容"
                                    v-model="editQuery.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="false"
                                    size="small"
                                    splaceholder="请输入内容"
                                    v-model="editQuery.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="false"
                                    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="false"
                                    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%"
                                    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%"
                                    :disabled="false"
                                    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="false"
                                    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="false"
                                    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="false"
                                    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="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-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-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="false"
                                    size="small"
                                    splaceholder="请输入内容"
                                    v-model="editQuery.zxxsbzbhsydysl"
                                ></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="false"
                                    size="small"
                                    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="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="!checked"
                                    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="!checked"
                                    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="!checked"
                                    v-model="editQuery.scbssfbhsxrq"
                                    size="small"
                                    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="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">
                        </el-col>
                        <el-col :span="4" class="el-col">
                            <el-form-item prop="name">
                                <el-checkbox v-model="checked" class="text item itemTag" disabled
                                >以使用单元数量入库
                                </el-checkbox>
                            </el-form-item>
                        </el-col>
                        <el-col :span="3" class="el-col">
                            <el-form-item prop="name">
                                <el-checkbox v-model="editQuery.isDisable" class="text item itemTag" disabled
                                >是否禁用
                                </el-checkbox>
                            </el-form-item>
                        </el-col>
                        <el-col :span="3" class="el-col">
                            <el-form-item prop="name">
                                <el-checkbox v-model="editQuery.isAdavence" class="text item itemTag" disabled
                                >是否寄售
                                </el-checkbox>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-form>

            </el-dialog>
            <el-dialog
                title="关联选入耗材信息"
                :visible.sync="selectUdiDialogVisible"
                width="85%"
                :close-on-click-modal="false"
                :close-on-press-escape="false"
                v-if="selectUdiDialogVisible"
            >
                <selectUdi @closeUdi="closeUdi" :isImportUdi="isImportUdi"></selectUdi>
            </el-dialog>
            <el-dialog
                title="从指定系统添加耗材信息"
                :visible.sync="selectErpDialogVisible"
                width="85%"
                :close-on-click-modal="false"
                :close-on-press-escape="false"
                v-if="selectErpDialogVisible"
            >
                <selectErp
                    :closeDialog="closeDialog"
                    :uuid="uuid"
                    :relId="relId"
                    :isImport="isImport"
                    :data="thisData"
                    :defaultSys="defaultSys"
                    @closeUdi="closeUdi"
                    :supEnable="true"
                ></selectErp>
            </el-dialog>
            <el-dialog
                title="选入DI器械信息"
                :visible.sync="selectLocalVisible"
                width="85%"
                :close-on-click-modal="false"
                :close-on-press-escape="false"
                v-if="selectLocalVisible"
            >
                <selectLocalUdi
                    :closeDialog="closeDialog"
                    :relId="relId"
                    :isImportUdi="isImportUdi"
                    :data="thisData"
                    @closeUdi="closeUdi"
                ></selectLocalUdi>
            </el-dialog>
            <el-dialog
                title="选入产品信息"
                :visible.sync="selectProductVisible"
                width="85%"
                :close-on-click-modal="false"
                :close-on-press-escape="false"
                v-if="selectProductVisible"
            >
                <selectProduct
                    :closeSelDialog="closeSelDialog"
                    :uuid="uuid"
                ></selectProduct>
            </el-dialog>
            <el-pagination
                :page-size="filterQuery.limit"
                @current-change="handleCurrentChange"
                layout="prev, pager, next"
                :total="total"
            ></el-pagination>
            <el-dialog
                :close-on-click-modal="false"
                :close-on-press-escape="false"
                title="新增配送产品"
                :visible.sync="addProductVisible"
                width="85%"
                v-if="addProductVisible"
                @close="closeAddDialog"
            >
                <ThrProductsAdd
                    :closeAddDialog="closeAddDialog"
                    :newType="newType"></ThrProductsAdd>
            </el-dialog>

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

<script>
import {
    getUdiInfos,
    deletetUdiInfos,
    updatetUdiInfos,
    updateErpProduct,
    uploadSmp,
    thirdSysDetail,
    removeRl, sysFilter, spcombie, lockStatus, removeDiRl
} from "../../api/basic/udiRelevance";
import store from "../../store/index";
import {
    deleteCompanyProductRelevance,
    filterCompanyProductRelevance
} from "../../api/warehouse/companyProductRelevance";
import {selectSysParamByKey} from "../../api/param/systemParamConfig";
import {filterByUuid} from "../../api/basic/udiInfo";

import selectUdi from "./UdiInfoRelevance.vue";
import selectErp from "./UdiInfoselectErpUdi";
import selectLocalUdi from "./UdiInfoSelectLocalUdi";
import selectProduct from "./basicCompanyProductsImport";
import ThrProductsAdd from "@/views/thrsys/ThrProductsAdd";

export default {
    data() {
        return {
            filterQuery: {
                unionCode: null,
                udiCode: null,
                ylqxzcrbarmc: "",
                cpmctymc: "",
                nameCode: "",
                ggxh: null,
                page: 1,
                limit: 20,
                addType: 1,
                thrPiId: null,
                filterType: null,
                auditStatus: null,
            },
            newType: 2,
            selectProductVisible: false,
            addProductVisible: false,
            editQuery: null,
            relevanceEdit: {
                id: null,
                thirdId: "",
                isDisable: null,
                isUseDy: false,
                isAdavence: null,
            },
            productType: null,
            defaultSys: null,
            isImport: false,
            isSpCombine: false,
            isImportUdi: false,
            isUploadSmp: false,
            isImportFile: false,
            uploadFileUrl: null,
            checked: false,
            list: [],
            detailList: [],
            sysList: [],
            filterList: [],
            total: 0,
            thirdNo: "",
            uuid: "111",
            thirdId: null,
            relId: "",
            thisData: {
                nameCode: null,
                cpmctymc: null,
                ggxh: null
            },
            multipleSelection: [],
            editDialogVisible: false,       //编辑
            detailDialogVisible: false,//产品信息详情
            selectUdiDialogVisible: false,  //关联选入
            selectErpDialogVisible: false,  //选入ERP产品
            selectLocalVisible: false,      //关联UDI
            auditStatusMap: {
                1: '通过',
                2: '不通过',
                3: '反审',
                4: '申请反审',
                5: '拒绝反审',
            },
            lockStatusMap: {1: "未提交", 2: "已提交", 3: "已锁定"},
        };
    },

    methods: {
        onReset() {
            this.$router.push({
                path: "",
            });
            this.filterQuery = {
                unionCode: null,
                udiCode: null,
                ylqxzcrbarmc: "",
                cpmctymc: "", thrPiId: null,
                nameCode: "",
                ggxh: null,
                page: 1,
                limit: 20,
                addType: 1,
            };
            this.getList();
        },
        getList() {
            this.loading = true;
            this.getProductRelevanceList();
            // getUdiInfos(this.filterQuery)
            //     .then((response) => {
            //         this.loading = false;
            //         this.list = response.data.list || [];
            //         this.total = response.data.total || 0;
            //     })
            //     .catch(() => {
            //         this.loading = false;
            //         this.list = [];
            //         this.total = 0;
            //     });
        },
        getProductRelevanceList() {
            this.loading = true;
            this.filterQuery.customerId = store.getters.customerId;
            filterCompanyProductRelevance(this.filterQuery)
                .then((response) => {
                    this.loading = false;
                    this.list = response.data.list || [];
                    this.total = response.data.total || 0;
                })
                .catch(() => {
                    this.loading = false;
                    this.list = [];
                    this.total = 0;
                });
        },
        keyup_submit(event) {
            this.filterQuery.page = 1;
            this.getList();
            event.target.select();
        },
        getDetailList(detailQuery) {
            this.loading = true;
            filterByUuid(detailQuery)
                .then((response) => {
                    this.loading = false;
                    this.detailList = response.data || [];
                    this.productType = this.detailList[0].productType;
                })
                .catch(() => {
                    this.loading = false;
                    this.detailList = [];
                });
        },

        handleDetail(row) {
            this.editQuery = row;
            console.log(row);
        },
        deleteOrders(data) {
            this.loading = true;
            let tquery = {
                id: data.id + "",
            };

            deletetUdiInfos(tquery)
                .then((response) => {
                    if (response.code == 20000) {
                        this.getList();
                        this.$message({
                            type: "success",
                            message: "删除成功！",
                        });
                    } else {
                        this.$message.error(response.message);
                    }
                })
                .catch(() => {
                });
        },

        deleteDialog(rowId) {
            this.$confirm("此操作将永久删除该产品信息, 是否继续?", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    this.deleteOrders(rowId);
                })
                .catch(() => {
                });
        },

        intentDetail() {
            this.isImportUdi = false;
            this.selectUdiDialogVisible = true;
        },
        addSelectErp(row) {
            this.defaultSys = row.sysId;
            this.isImport = false;
            this.selectErpDialogVisible = true;
        },

        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.getList();
                                this.cancelDialog();
                            } else {
                                this.$message.error(response.message);
                            }
                        })
                        .catch(() => {
                        });
                })
                .catch(() => {
                });
        },
        intentSelectErp(val) {
            this.uuid = val.uuid;
            this.relId = val.rlId;
            this.isImport = false;
            this.thisData = val;
            this.selectErpDialogVisible = true;
        },

        intentImportErp(val) {
            this.defaultSys = null,
                this.uuid = val.uuid;
            this.relId = val.rlId;
            this.isImport = true;
            this.thisData = val;
            this.selectErpDialogVisible = true;
        },
        uploadSMP() {
            var selectData = this.multipleSelection;
            var keys = [];
            selectData.forEach((obj) => {
                keys.push(obj.id);
            });
            var tquery = {
                keys: keys,
            };
            uploadSmp(tquery)
                .then((response) => {
                    if (response.code == 20000) {
                        this.$message({
                            type: "success",
                            message: "上传成功！",
                        });
                    } else {
                        this.$message({
                            type: "error",
                            message: response.message,
                        });
                    }
                })
                .catch(() => {
                    this.$message({
                        type: "error",
                        message: "上传失败",
                    });
                });
        },
        intentSelectUdi(val) {
            this.relId = val.rlId;
            this.isImportUdi = true;
            this.thisData = val;
            console.log("-----" + this.relId);
            this.selectLocalVisible = true;
        },
        intentImportUdi() {
            this.relId = null;
            this.selectLocalVisible = true;
        },
        deleteCompanyProductRelevance(row) {
            this.$confirm("是否移除?", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            }).then(() => {
                this.productLoading = true;
                let tquery = {
                    id: row.id,
                };
                deleteCompanyProductRelevance(tquery)
                    .then((response) => {
                        this.productLoading = false;
                        if (response.code === 20000) {
                            this.getProductRelevanceList();
                            this.$message({
                                type: "success",
                                message: "移除成功！",
                            });
                        } else {
                            this.$message.error(response.message);
                        }
                    })
                    .catch(() => {
                        this.productLoading = false;
                    });
            }).catch(() => {
            });
        },
        handleSelectionChange(val) {
            console.log("----" + val);
            this.multipleSelection = val;
        },
        closeSelDialog(val) {
            this.selectProductVisible = false;
            this.addProductVisible = false;
        },
        cancelDialog() {
            this.editDialogVisible = false;
        },
        handleCurrentChange(val) {
            this.filterQuery.page = val;
            this.getList();
        },
        handleDetailClick(row) {
            this.thisData = row;
            this.detailDialogVisible = true;
            this.editQuery = row;
            this.relevanceEdit = {
                id: row.rlId,
                // thirdId: row.thirdId,
                isUseDy: row.isUseDy,
                isDisable: row.isDisable,
                isAdavence: row.isAdavence,
            };
            let ttquery = {
                uuid: row.uuid,
                page: 1,
                limit: 10,
            };
            console.log("this.editQuery.isUseDy = " + this.editQuery.isUseDy);

            this.getDetailList(ttquery);
            this.getThirdSysDetail();

        },
        sumitLockStatus(row) {
            let postQuery = {
                ids: [],
                lockStatus: 2,
            }
            postQuery.ids.push(row.rlId);
            lockStatus(postQuery)
                .then((response) => {
                    if (response.code == 20000) {
                        this.loading = false;
                        this.$message.success(response.data);
                        this.getList();
                    } else {
                        this.$message.error(response.message);
                    }

                })
                .catch(() => {
                    this.loading = false;
                });
        },
        handleModifyClick(row) {
            this.uuid = row.uuid;
            this.relId = row.rlId;
            this.isImport = false;
            this.thisData = row;
            this.editDialogVisible = true;
            this.editQuery = row;
            this.relevanceEdit = {
                id: row.rlId,
                // thirdId: row.thirdId,
                isUseDy: row.isUseDy,
                isDisable: row.isDisable,
                isAdavence: row.isAdavence,
            };
            this.checked = row.isUseDy == 1;

            let ttquery = {
                uuid: row.uuid,
                page: 1,
                limit: 10,
            };
            console.log("this.editQuery.isUseDy = " + this.editQuery.isUseDy);

            this.getDetailList(ttquery);
            this.getThirdSysDetail();
        },
        closeUdi(val) {
            this.selectUdiDialogVisible = false;
            this.selectErpDialogVisible = false;
            this.selectLocalVisible = false;
            this.getThirdSysDetail();
            this.getList();
        },
        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 = [];
                });
        },
        getSysFilter() {
            sysFilter()
                .then((response) => {
                    this.loading = false;
                    this.filterList = response.data.list || [];
                })
                .catch(() => {
                    this.loading = false;
                    this.filterList = [];
                });

        },
        uploadErpProduct() {
            updateErpProduct()
                .then((response) => {
                    if (response.code == 20000) {
                        this.$message({
                            type: "success",
                            message: response.data,
                        });
                    } else {
                        this.$message.error(response.message);
                    }
                })
                .catch(() => {
                });
        },
        closeDialog() {
            this.selectErpDialogVisible = false;
            this.selectLocalVisible = false;
            this.selectProductVisible = false;
            console.log("关闭弹窗2");
        },
        onAddSubmit() {
            if (this.checked == true) {
                this.relevanceEdit.isUseDy = 1;
            } else {
                this.relevanceEdit.isUseDy = 0;
            }
            this.relevanceEdit.isDisable = this.editQuery.isDisable;
            this.relevanceEdit.isAdavence = this.editQuery.isAdavence;

            console.log(this.relevanceEdit.isUseDy);
            updatetUdiInfos(this.relevanceEdit)
                .then((response) => {
                    this.loading = false;
                    this.getList();
                    this.cancelDialog();
                })
                .catch(() => {
                    this.loading = false;
                    this.cancelDialog();
                });
        },
        selectSysParam() {

            spcombie().then((response) => {
                if (response.code == 20000) {
                    if (response.data.paramValue == "1") {
                        this.isSpCombine = true;
                    } else {
                        this.isSpCombine = false;
                    }
                }
            });

            let query = {
                paramKey: "smp_isUploadProuct",
            };
            selectSysParamByKey(query).then((response) => {
                if (response.code == 20000) {
                    if (response.data.paramValue == "1") {
                        this.isUploadSmp = true;
                    }
                }
            });
            let query1 = {
                paramKey: "upload_pi_file_enabled",
            };
            selectSysParamByKey(query1).then((response) => {
                if (response.code == 20000) {
                    if (response.data.paramValue == "1") {
                        this.isImportFile = true;
                    }
                }
            });
            let query2 = {
                paramKey: "upload_pi_file_url",
            };
            selectSysParamByKey(query2).then((response) => {
                if (response.code == 20000) {
                    this.uploadFileUrl = response.data.paramValue;
                }
            });
        },
        selectProduct() {
            this.selectProductVisible = true;
        },
        closeAddDialog(val) {
            if (val) {
                this.getList();
            }
            this.addProductVisible = false;
            console.log("------closeAddDialog-------")
            // Object.keys(this.newProductData).forEach(key => this.newProductData[key] = null);
        }

    }
    ,
    mounted() {
    }
    ,
    components: {
        selectUdi,
        selectErp,
        selectLocalUdi,
        selectProduct,
        ThrProductsAdd
    }
    ,
    created() {
        this.getList();
        this.selectSysParam();
        this.getSysFilter();
    }
    ,
}
;
</script>
<style scoped>
.itemTag {
    float: left;
    text-align: left;
    margin-top: 10px;
    width: 25%;
}

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

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

.el-row {
    display: flex;
    flex-wrap: wrap;
}

.el-col {
    border-radius: 4px;
    flex-wrap: wrap;
}
</style>
