<template>
  <div>
    <el-card>
      <el-form v-if="queryList && queryList.length > 0 && showSearch" :model="filterQuery" label-width="120px">
        <el-row style=" display:flex;  flex-wrap: wrap; ">
          <template v-for="(item, index) in queryList">
            <el-form-item v-if="item.columnType == 'input' && executeEval(row,item.expression,true)"
                          :label="item.columnDesc+`:`" :key="item.id">
              <el-input
                v-model="filterQuery[item.columnName]"
                :placeholder="item.columnDesc"
                :disabled="executeEval(null,item.disabledFuc,false)"
                @keyup.enter.native="executeFuc($event,'5',item.clickFuc)"
                clearable
              ></el-input>
            </el-form-item>
            <el-form-item v-if="item.columnType == 'select' && executeEval(row,item.expression,true)"
                          :label="item.columnDesc+`:`">
              <el-select v-model="filterQuery[item.columnName]"
                         :placeholder="item.columnDesc"
                         :disabled="executeEval(null,item.disabledFuc,false)"
                         clearable>
                <el-option
                  v-for="dict in item.lableRuleObj"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
            <el-form-item v-if="item.columnType == 'selectServer' && executeEval(row,item.expression,true)"
                          :label="item.columnDesc+`:`">
              <el-select
                v-model="filterQuery[`${item.columnName}`]"
                :placeholder="item.columnDesc"
                :disabled="executeEval(null,item.disabledFuc,false)"
                filterable
                remote
                :remote-method="(query) => executeFuc(query,'5',item.clickFuc)"
                clearable>
                <el-option
                  v-for="item in options[item.clickFuc]"
                  :key="item.code"
                  :label="item.label"
                  :value="item.code"
                />
              </el-select>
            </el-form-item>
            <el-form-item v-if="item.columnType == 'datePicker' && executeEval(row,item.expression,true)"
                          :label="item.columnDesc+`:`">
              <el-date-picker
                v-model="dateRange"
                :style="`width:${item.width+'px'}`"
                value-format="yyyy-MM-dd HH:mm:ss"
                :disabled="executeEval(null,item.disabledFuc,false)"
                type="daterange"
                range-separator="-"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                :default-time="['00:00:00', '23:59:59']"
              ></el-date-picker>
            </el-form-item>
            <el-form-item v-if="item.columnType == 'date' && executeEval(row,item.expression,true)"
                          :label="item.columnDesc+`:`">
              <el-date-picker
                v-model="filterQuery[item.columnName]"
                :style="`width:${item.width+'px'}`"
                value-format="yyyy-MM-dd"
                :disabled="executeEval(null,item.disabledFuc,false)"
                type="date"
                :placeholder="item.columnDesc"
              ></el-date-picker>
            </el-form-item>
          </template>
        </el-row>
        <!--        <el-row>-->
        <!--          <el-col :span="6">-->
        <!--            <el-form-item label="供应商:">-->
        <!--              <el-select-->
        <!--                v-model="filterQuery.unitFk"-->
        <!--                style="width: 90%"-->
        <!--                filterable-->
        <!--                remote-->
        <!--                clearable="true"-->
        <!--                reserve-keyword-->
        <!--                placeholder="请选择供应商"-->
        <!--                :remote-method="findMethod"-->
        <!--                :loading="loading"-->
        <!--              >-->
        <!--                <el-option-->
        <!--                  v-for="item in fromOptions"-->
        <!--                  :key="item.name"-->
        <!--                  :label="item.name"-->
        <!--                  :value="item.erpId"-->
        <!--                >-->
        <!--                  <span style="float: left">{{ item.name }}</span>-->
        <!--                </el-option>-->
        <!--              </el-select>-->
        <!--            </el-form-item>-->
        <!--          </el-col>-->
        <!--          <el-col :span="6">-->
        <!--            <el-form-item label="物资编码:">-->
        <!--              <el-input v-model="filterQuery.unionCode" style="width: 90%" placeholder="请输入DI/医保编码/商品条码"-->
        <!--                        clearable="true"></el-input>-->
        <!--            </el-form-item>-->
        <!--          </el-col>-->
        <!--          <el-col :span="6">-->
        <!--            <el-form-item label="物资名称:">-->
        <!--              <el-input v-model="filterQuery.cpmctymc" style="width: 90%" placeholder="请输入物资名称"-->
        <!--                        clearable="true"></el-input>-->
        <!--            </el-form-item>-->
        <!--          </el-col>-->
        <!--          <el-col :span="6">-->
        <!--            <el-form-item label="规格型号:">-->
        <!--              <el-input v-model="filterQuery.ggxh" style="width: 90%" placeholder="请输入规格型号" clearable="true"></el-input>-->
        <!--            </el-form-item>-->
        <!--          </el-col>-->
        <!--        </el-row>-->

        <!--        <el-row>-->
        <!--          <el-col :span="6">-->
        <!--            <el-form-item label="对照条件:">-->
        <!--              <el-select v-model="filterQuery.filterType" style="width: 90%" 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-col>-->
        <!--          <el-col :span="6">-->
        <!--            <el-form-item label="生产企业:">-->
        <!--              <el-input v-model="filterQuery.ylqxzcrbarmc" style="width: 90%" placeholder="请输入生产企业/注册备案人"-->
        <!--                        clearable="true"></el-input>-->
        <!--            </el-form-item>-->
        <!--          </el-col>-->
        <!--          <el-col :span="6">-->
        <!--            <el-form-item label="第三方物资编码:">-->
        <!--              <el-input v-model="filterQuery.thrPiId" style="width: 90%" placeholder="请输入第三方物资编码"-->
        <!--                        clearable="true"></el-input>-->
        <!--            </el-form-item>-->
        <!--          </el-col>-->
        <!--          <el-col :span="6">-->
        <!--            <el-form-item label="状态:" v-if="isSpCombine">-->
        <!--              <el-select v-model="filterQuery.lockStatus" style="width: 90%" 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-col>-->
        <!--        </el-row>-->
      </el-form>


      <div class="top-right-btn">
        <el-button-group style="display:flex;">
          <el-button icon="el-icon-view" type="primary" @click="hideSearch">显示/隐藏搜索栏</el-button>
          <el-button type="primary" icon="el-icon-refresh" @click="onReset">重置</el-button>
          <el-button type="primary" icon="el-icon-search" @click="search">查询</el-button>
          <el-button type="primary" icon="el-icon-bottom-right" @click="selectProduct()">选入药品</el-button>
          <el-button type="primary" icon="search" @click="lockProducts('3')" v-if="isSpCombine">锁定</el-button>
          <el-button type="primary" icon="search" @click="lockProducts('1')" v-if="isSpCombine">退回</el-button>
        </el-button-group>
      </div>
      <el-divider style="margin: 15px"></el-divider>

      <el-table v-loading="loading" :data="list" key="1" @selection-change="handleSelectionChange" style="width: 100%"
                border>
        <template v-for="(item, index) in tableHeader">
          <el-table-column
            v-if="item.columnType == 'id' && executeEval(row,item.expression,true)"
            type="index" :label="item.columnDesc"></el-table-column>
          <el-table-column
            v-if="item.columnType == 'selection'"
            type="selection"
            :width="item.width"
            :selectable="(row,number) => executeFuc(row,'3',item.clickFuc)"></el-table-column>

          <el-table-column
            v-if="item.columnType == 'radio' && executeEval(row,item.expression,true)"
            :prop="item.columnName"
            :label="item.columnDesc"
            :sortable="item.sort"
            :width="item.width"
            :show-overflow-tooltip="item.tooltip"
            :key="item.columnName"
          >
            <template slot-scope="scope">
              <el-radio :label="scope.row.id" v-model="radioCheck"><span></span></el-radio>
            </template>
          </el-table-column>
          <el-table-column
            v-if="item.columnType == 'laber' && executeEval(row,item.expression,true)"
            :prop="item.columnName"
            :label="item.columnDesc"
            :sortable="item.sort"
            :width="item.width"
            :show-overflow-tooltip="item.tooltip"
            :key="item.columnName"
          >
            <template slot-scope="scope">
              <span :style="{color: executeFuc(scope.row,'4',item.lableRuleObj[scope.row[item.columnName]])}">{{
                  item.lableRuleObj[scope.row[item.columnName]]
                }}</span>
            </template>
          </el-table-column>
          <el-table-column
            v-if="item.columnType == 'eltag' && executeEval(row,item.expression,true)"
            :prop="item.columnName"
            :label="item.columnDesc"
            :sortable="item.sort"
            :width="item.width"
            :show-overflow-tooltip="item.tooltip"
            :key="item.columnName"
          >
            <template slot-scope="scope">
              <el-tag
                :type="executeFuc(scope.row,'4',item,item.lableRuleObj?item.lableRuleObj[scope.row[item.columnName]]:scope.row[item.columnName])">
                <span>{{
                    item.lableRuleObj ? item.lableRuleObj[scope.row[item.columnName]] : scope.row[item.columnName]
                  }}</span>
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column
            v-if="item.columnType == 'button' && executeEval(row,item.expression,true)"
            :prop="item.columnName"
            :label="item.columnDesc"
            :width="item.width"
            :key="item.columnName"
            fixed="right"
          >
            <template slot-scope="scope">
              <el-button v-for="(buttonItem, buttonIndex) in item.buttonRulObj"
                         :type="buttonItem.type"
                         :size="buttonItem.size"
                         :style="buttonItem.style"
                         :key="buttonItem"
                         v-if="executeEval(scope.row,buttonItem.hasPermi,true)"
                         :disabled="executeEval(scope.row,buttonItem.disabledFuc,false)"
                         @click.native.stop="executeFuc(scope.row,'1',buttonItem.clickFuc)"
              >{{ buttonItem.name }}
              </el-button>
            </template>
          </el-table-column>
          <el-table-column
            v-if="item.columnType == 'text' && executeEval(row,item.expression,true)"
            :prop="item.columnName"
            :label="item.columnDesc"
            :sortable="item.sort"
            :width="item.width"
            :show-overflow-tooltip="item.tooltip"
            :key="item.columnName"
          >
            <template slot-scope="scope">
              <span :style="{color: executeFuc(scope.row,'4',item,scope.row[item.columnName])}">{{
                  scope.row[item.columnName]
                }}</span>
            </template>
          </el-table-column>

        </template>
        <!--        <el-table-column type="selection" width="55"></el-table-column>-->
        <!--        <el-table-column label="序号" type="index"></el-table-column>-->
        <!--        <el-table-column label="供应商" prop="companyName" show-overflow-tooltip></el-table-column>-->
        <!--        <el-table-column label="最小销售产品标识" prop="nameCode" show-overflow-tooltip></el-table-column>-->
        <!--        <el-table-column label="主系统物资编码" prop="mainId" 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="price" show-overflow-tooltip></el-table-column>-->
        <!--        <el-table-column label="物资分类" prop="classifyName" show-overflow-tooltip></el-table-column>-->
        <!--        <el-table-column-->
        <!--          v-if="isSpCombine"-->
        <!--          label="状态"-->
        <!--          prop="lockStatus"-->
        <!--          width="80"-->
        <!--          show-overflow-tooltip-->
        <!--        >-->
        <!--          <template slot-scope="scope">-->
        <!--            {{ lockStatusMap[scope.row.lockStatus] }}-->
        <!--          </template>-->
        <!--        </el-table-column>-->

        <!--        <el-table-column width="120" label="操作">-->
        <!--          <template slot-scope="scope">-->
        <!--            <el-button type="text" @click.native.stop="handleModifyClick(scope.row)">详情</el-button>-->
        <!--            <el-button type="text" @click.native.stop="handleDeleteClick(scope.row.id)">移除</el-button>-->
        <!--          </template>-->
        <!--        </el-table-column>-->
      </el-table>

      <el-dialog
        title="药品信息详情"
        :visible.sync="editDialogVisible"
        :close-on-click-modal="false"
        :close-on-press-escape="false"
        width="60%"
        v-if="editDialogVisible"
      >
        <selectDetail
          :detailQuery="detailQuery"
          :relevanceEdit="relevanceEdit"
          :checked="checked"
          @closeUdi="closeUdi"
        >
        </selectDetail>
      </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"
          :unitFk="filterQuery.unitFk"
        ></selectProduct>
      </el-dialog>

      <pagination
        v-show="total>0"
        :total="total"
        :limit.sync="filterQuery.limit"
        :page.sync="filterQuery.page"
        @pagination="handleCurrentChange"
      ></pagination>

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

<script>
import {
  getUdiInfos,
  deletetUdiInfos,
  updatetUdiInfos,
  updateErpProduct,
  uploadSmp,
  thirdSysDetail,
  removeRl, sysFilter, sysFilterOptimize, spcombie, lockStatus
} from "@/api/basic/udiRelevance";
import {selectSysParamByKey} from "@/api/param/systemParamConfig";
import {filterByUuid, filterCompany} from "@/api/basic/udiInfo";
import {filterCompanyProductRelevance, deleteCompanyProductRelevance} from "@/api/basic/udiRlSuptRelevance";
import {getBasicUnitMaintainsOptimize} from "@/api/basic/basicUnitMaintain"
import selectProduct from "./basicCompanyDrugsImport";
// import selectUdi from "./udiInfoRelevance.vue";
// import selectErp from "./udiInfoselectErpUdi";
// import selectLocalUdi from "./UdiInfoSelectLocalUdi";
import selectDetail from "./drugInfoManageSpDetail";
import {executeFuc, getHead} from "@/utils/customConfig";

export default {
  data() {
    return {
      showSearch: true,
      filterQuery: {
        lockStatus: null,
        unionCode: null,
        udiCode: null,
        ylqxzcrbarmc: "",
        cpmctymc: "",
        nameCode: "",
        ggxh: null,
        page: 1,
        limit: 20,
        addType: 1,
        thrPiId: null,
        filterType: null,
        companyName: null,
        unitFk: null,
        productsType: 2
      },
      fromOptions: [],
      editQuery: null,
      relevanceEdit: {
        id: null,
        thirdId: "",
        isDisable: null,
        isUseDy: false,
        isLock: null,
        isAdavence: null,
      },
      detailQuery: null,
      defaultSys: null,
      isImport: false,
      isImportUdi: false,
      isUploadSmp: false,
      isSpCombine: false,
      isImportFile: false,
      uploadFileUrl: null,
      checked: false,
      list: [],
      detailList: [],
      sysList: [],
      filterList: [],
      options: {
        findMethod: [],
        getSysFilter: [],
      },
      queryList: [],
      tableHeader: [],
      fromList: [],
      total: 0,
      thirdNo: "",
      uuid: "111",
      originUuid: null,
      thirdId: null,
      relId: "",
      thisData: {
        nameCode: null,
        cpmctymc: null,
        ggxh: null
      },
      selectProductVisible: false,
      multipleSelection: [],
      editDialogVisible: false,       //详情
      selectUdiDialogVisible: false,  //关联选入
      selectErpDialogVisible: false,  //选入ERP产品
      selectLocalVisible: false,      //关联UDI
      selectVersionVisible: false,
      isUseDyCheck: false,
      lockStatusMap: {"1": "未提交", "2": "已提交", "3": "已锁定"},
      loading: false,
      activeNames: ['1'],
      unitFk: ''
    };
  },

  methods: {
    onReset() {
      this.$router.push({
        path: "",
      });
      this.filterQuery = {
        lockStatus: null,
        unionCode: null,
        udiCode: null,
        ylqxzcrbarmc: "",
        cpmctymc: "",
        thrPiId: null,
        nameCode: "",
        ggxh: null,
        page: 1,
        limit: 20,
        addType: 1,
        productsType: 2
      };
      this.total = 0;
      this.list = [];
      this.getList();
    },
    search() {
      this.filterQuery.page = 1;
      this.getList();
    },
    hideSearch() {
      this.showSearch = !this.showSearch;
    },
    getList() {
      // if (this.$isBlank(this.filterQuery.unitFk)) {
      //   this.$message.error("请先选择供应商！");
      //   return;
      // }
      this.loading = true;
      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();
    },
    handleDetail(row) {
      this.editQuery = row;
    },
    deleteOrders(data) {
      this.loading = true;
      let tquery = {
        id: data.id + "",
      };

      deletetUdiInfos(tquery)
        .then((response) => {
          this.loading = false;
          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(() => {
        });
    },
    selectProduct() {
      if (this.$isBlank(this.filterQuery.unitFk)) {
        this.$message.error("请先选择供应商！");
        return;
      }
      this.unitFk = this.filterQuery.unitFk
      this.selectProductVisible = true;
    },
    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.id,
            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(() => {
        });
    },

    intentSelectErp(val) {
      this.uuid = val.uuid;
      this.relId = val.id;
      this.isImport = false;
      this.thisData = val;
      this.selectErpDialogVisible = true;
    },

    intentImportErp(val) {
      this.defaultSys = null;
      this.uuid = val.uuid;
      this.relId = val.id;
      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.id;
      this.isImportUdi = true;
      this.thisData = val;
      this.selectLocalVisible = true;
    },


    intentImportUdi() {
      this.relId = null;
      this.selectLocalVisible = true;
    },


    handleSelectionChange( val) {
      this.multipleSelection = val;
    },
    cancelDialog() {
      this.editDialogVisible = false;
    },
    handleCurrentChange(val) {
      this.filterQuery.page = val.page;
      this.getList();
    },
    handleModifyClick(_this, row) {
      _this.uuid = row.uuid;
      _this.relId = row.rlId;
      _this.isImport = false;
      _this.thisData = row;
      _this.editDialogVisible = true;
      _this.detailQuery = row;
      _this.relevanceEdit = {
        id: row.rlId,
        // thirdId: row.thirdId,
        isUseDy: row.isUseDy,
        isDisable: row.isDisable,
        isLock: row.isLock,
        isAdavence: row.isAdavence,
      };
      _this.checked = row.isUseDy == 1;
    },
    handleDeleteClick(_this, row) {
      _this.$confirm("此操作将删除该供应商器械信息, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          let dQuery = {
            id: row.id,
          };
          deleteCompanyProductRelevance(dQuery)
            .then((response) => {
              _this.loading = false;
              if (response.code == 20000) {
                _this.$message.success("删除成功");
              } else {
                _this.$message.error(response.message);
              }
              _this.getList();
            })
            .catch(() => {
              _this.loading = false;
            });
        })
        .catch(() => {
        });
    },
    lockProducts(status) {
      let selectData = this.multipleSelection;
      console.log("dayin dangqian",this.multipleSelection)
      let postQuery = {
        ids: [],
        lockStatus: status,
      }
      selectData.forEach((row) => {
        postQuery.ids.push(row.rlId);
      });
      if (postQuery.ids.length <= 0) {
        this.$message.error("请先选择产品！");
        return
      }
      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;
        });
    },
    closeUdi(val) {
      this.selectUdiDialogVisible = false;
      this.selectErpDialogVisible = false;
      this.selectLocalVisible = false;
      this.getThirdSysDetail();
      if (val) {
        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(_this, query) {
      sysFilterOptimize()
        .then((response) => {
          _this.loading = false;
          _this.options.getSysFilter = response.data.list || [];
        })
        .catch(() => {
          _this.loading = false;
          _this.options.getSysFilter = []
        });
    },


    uploadErpProduct() {
      updateErpProduct()
        .then((response) => {
          if (response.code == 20000) {
            this.$message({
              type: "success",
              message: response.data,
            });
          } else {
            this.$message.error(response.message);
          }
        })
        .catch(() => {
        });
    },
    selectVersion() {
      this.selectVersionVisible = true;
      this.uuid = this.editQuery.uuid;
      this.originUuid = this.editQuery.originUuid;
    },
    closeDialog() {
      this.selectErpDialogVisible = false;
      this.selectLocalVisible = false;
      this.selectVersionVisible = false;
      this.getList();
    },
    closeSelDialog(){
      this.selectProductVisible = false
      this.filterQuery.unitFk = this.unitFk
      this.getList()
    },
    onAddSubmit() {
      if (this.checked == true) {
        this.relevanceEdit.isUseDy = 1;
      } else {
        this.relevanceEdit.isUseDy = 0;
      }
      this.relevanceEdit.isDisable = this.editQuery.isDisable;
      this.relevanceEdit.isLock = this.editQuery.isLock;
      this.relevanceEdit.isAdavence = this.editQuery.isAdavence;
      updatetUdiInfos(this.relevanceEdit)
        .then((response) => {
          this.loading = false;
          this.getList();
          this.cancelDialog();
        })
        .catch(() => {
          this.loading = false;
          this.cancelDialog();
        });
    },

    selectSysParam() {
      let query = {
        paramKey: "smp_isUploadProuct",
      };

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

      selectSysParamByKey(query).then((response) => {
        if (response.code == 20000) {
          if (response.data.paramValue == "1") {
            this.isUploadSmp = true;
          } else {
            this.isUploadSmp = false;
          }
        }
      });
      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;
        }
      });
    },

    findMethod(_this, query) {
      let cQuery = {
        key: query,
        corpType: 2,
        page: 1,
        limit: 10,
      };
      getBasicUnitMaintainsOptimize(cQuery)
        .then((response) => {
          _this.loading = false;
          _this.options.findMethod = response.data.list || [];
        })
        .catch(() => {
          _this.loading = false;
          _this.options.findMethod = [];
        });
    },
    executeFuc(row, type, clickFuc, value) {
      return executeFuc(this, row, type, clickFuc, value);
    },
    executeEval(row, expression, defaultRet) {
      if (expression) {
        return eval(expression);
      }
      return defaultRet;
    }
  }
  ,
  mounted() {
  }
  ,
  components: {
    // selectUdi,
    // selectErp,
    // selectLocalUdi,
    selectProduct,
    selectDetail
  }
  ,
  created() {
    getHead("basicCompanyDrugProducts", "1").then((re) => {
      // 处理返回的数据
      this.tableObj = re.data;
      this.tableHeader = re.data.tableList;
      this.queryList = re.data.queryList;
      this.fromList = re.data.fromList;
      this.getList()
    });
    this.selectSysParam();
    this.getSysFilter(this, "");
    this.findMethod(this, "");
  }
  ,
}
;
</script>
<style scoped>


.el-table .cell.el-tooltip {
  white-space: pre-wrap;
}


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

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