<template>
  <div>

    <!--        配送企业资质       -->
    <el-card>
      <el-form if="queryList && queryList.length > 0" :model="filterQuery" class="query-form" size="mini" label-width="120px" v-show="showSearch">
        <!--        <el-row>-->
        <!--          <el-col :span="6">-->
        <!--            <el-form-item label="配送企业名称:">-->
        <!--              <el-input v-model="filterQuery.companyName" style="width: 90%" placeholder="请输入配送企业名称"-->
        <!--                        clearable></el-input>-->
        <!--            </el-form-item>-->
        <!--          </el-col>-->
        <!--          <el-col :span="6">-->
        <!--            <el-form-item label="统一社会信用号:">-->
        <!--              <el-input v-model="filterQuery.creditNum" style="width: 90%" placeholder="请输入统一社会信用号"-->
        <!--                        clearable></el-input>-->
        <!--            </el-form-item>-->
        <!--          </el-col>-->
        <!--        </el-row>-->
        <el-row style=" display:flex;  flex-wrap: wrap; ">
          <template v-for="(item, index) in queryList" >
            <el-form-item  :style="item.style?item.style:item.width?'width:'+(item.width)+'px':''" 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-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="onSubmit">查询</el-button>
        </el-button-group>
      </div>

      <el-divider style="margin: 15px"></el-divider>

      <el-table v-loading="loading" :data="list" style="width: 100%" border highlight-current-row
                @row-click="(row) => executeFuc(row,'0',tableObj.handleChangeFuc)">
        <!--        <el-table-column type="index" label="序号" width="50"></el-table-column>-->
        <!--        <el-table-column label="配送企业名称" prop="companyName" width="160" show-overflow-tooltip></el-table-column>-->
        <!--        <el-table-column label="统一社会信用号" prop="creditNum" width="160"></el-table-column>-->
        <!--        <el-table-column label="所属地区" prop="area" width="180"></el-table-column>-->
        <!--        <el-table-column label="详细地址" prop="detailAddr" :show-overflow-tooltip="true" width="180"></el-table-column>-->


        <!--        <el-table-column label="审核状态" prop="auditStatus" width="120">-->
        <!--          <template slot-scope="scope">-->
        <!--            <el-tag :type="(scope.row.auditStatus) | statusFilterType">-->
        <!--              {{ checkFlag[scope.row.auditStatus] }}-->
        <!--            </el-tag>-->
        <!--          </template>-->
        <!--        </el-table-column>-->


        <!--        <el-table-column label="生产企业证书" prop="auditStatus" width="120">-->
        <!--          <template slot-scope="scope">-->

        <!--            <el-tag type="danger" v-if="scope.row.failCout==0 && scope.row.passCout==0">-->
        <!--              未添加证书-->
        <!--            </el-tag>-->
        <!--            <el-tag type="warning" v-if="scope.row.failCout>0">-->
        <!--              未全部审核-->
        <!--            </el-tag>-->
        <!--            <el-tag type="success" v-if="scope.row.failCout==0 && scope.row.passCout>0">-->
        <!--              已全部审核-->
        <!--            </el-tag>-->
        <!--          </template>-->
        <!--        </el-table-column>-->

        <!--        <el-table-column label="配送产品证书" prop="auditStatus" width="120">-->
        <!--          <template slot-scope="scope">-->
        <!--            <el-tag type="danger" v-if="scope.row.productFailCout==0 && scope.row.prouctPassCout==0">-->
        <!--              未添加证书-->
        <!--            </el-tag>-->
        <!--            <el-tag type="warning" v-if="scope.row.productFailCout>0">-->
        <!--              未全部审核-->
        <!--            </el-tag>-->
        <!--            <el-tag type="success" v-if="scope.row.productFailCout==0 && scope.row.prouctPassCout>0">-->
        <!--              已全部审核-->
        <!--            </el-tag>-->
        <!--          </template>-->
        <!--        </el-table-column>-->


        <!--        <el-table-column label="操作" width="120">-->
        <!--          <template slot-scope="scope">-->
        <!--            <el-button-->
        <!--              type="text"-->
        <!--              v-if="scope.row.auditStatus ==6 || scope.row.auditStatus ==3|| scope.row.auditStatus ==4"-->
        <!--              @click.native.stop="editCompany(scope.row)"-->
        <!--            >审核-->
        <!--            </el-button>-->

        <!--            <el-button-->
        <!--              type="text"-->
        <!--              v-if="scope.row.auditStatus !=6 && scope.row.auditStatus !=3 && scope.row.auditStatus !=4"-->
        <!--              @click.native.stop="editCompany(scope.row)"-->
        <!--            >详情-->
        <!--            </el-button>-->

        <!--          </template>-->
        <!--        </el-table-column>-->
        <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>

          <el-table-column v-if="item.columnName == 'failCout'"  :label="item.columnDesc" prop="auditStatus"  :width="item.width">
            <template slot-scope="scope">

              <el-tag type="danger" v-if="scope.row.failCout==0 && scope.row.passCout==0">
                未添加证书
              </el-tag>
              <el-tag type="warning" v-if="scope.row.failCout>0">
                未全部审核
              </el-tag>
              <el-tag type="success" v-if="scope.row.failCout==0 && scope.row.passCout>0">
                已全部审核
              </el-tag>
            </template>
          </el-table-column>

          <el-table-column v-if="item.columnName == 'productFailCout'"  :label="item.columnDesc" prop="auditStatus"  :width="item.width">
            <template slot-scope="scope">
              <el-tag type="danger" v-if="scope.row.productFailCout==0 && scope.row.prouctPassCout==0">
                未添加证书
              </el-tag>
              <el-tag type="warning" v-if="scope.row.productFailCout>0">
                未全部审核
              </el-tag>
              <el-tag type="success" v-if="scope.row.productFailCout==0 && scope.row.prouctPassCout>0">
                已全部审核
              </el-tag>
            </template>
          </el-table-column>
        </template>

      </el-table>

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

    <el-dialog
      :title="formMap[formName]"
      :visible.sync="supCompanyVisible"
      :before-close="close"
      width="80%"
      v-if="supCompanyVisible"
      @close='closeDialog'
      :close-on-click-modal="false"
      :close-on-press-escape="false"
    >
      <supCompanyEditAdudit
        :closeDialog="closeDialog"
        :inputQuery="inputQuery"
        :editType="editType"
        :auditType="auditType"
      ></supCompanyEditAdudit>
    </el-dialog>


    <!--        生产企业资质       -->
    <el-card class="el-card">
      <el-form v-if="queryList2 && queryList2.length > 0" :model="filterManufacturerQuery" class="query-form" label-width="120px" v-show="showSearch2">
        <!--        <el-row>-->
        <!--          <el-col :span="6">-->
        <!--            <el-form-item label="生产企业名称">-->
        <!--              <el-input v-model="filterManufacturerQuery.companyName" style="width: 90%"-->
        <!--                        placeholder="请输入生产企业名称" clearable></el-input>-->
        <!--            </el-form-item>-->
        <!--          </el-col>-->
        <!--          <el-col :span="6">-->
        <!--            <el-form-item label="统一社会信用号">-->
        <!--              <el-input v-model="filterManufacturerQuery.creditCode" style="width: 90%"-->
        <!--                        placeholder="请输入统一社会信用号" clearable></el-input>-->
        <!--            </el-form-item>-->
        <!--          </el-col>-->
        <!--        </el-row>-->
        <el-row style=" display:flex;  flex-wrap: wrap; ">
          <template v-for="(item, index) in queryList2" >
            <el-form-item v-if="item.columnType == 'input' && executeEval(row,item.expression,true)" :label="item.columnDesc+`:`" :key="item.id">
              <el-input
                v-model="filterManufacturerQuery[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="filterManufacturerQuery[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="filterManufacturerQuery[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="filterManufacturerQuery[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-form>

      <div class="top-right-btn">
        <el-button-group style="display:flex;">
          <el-button icon="el-icon-view" type="primary" @click="hideSearch2">显示/隐藏搜索栏</el-button>
          <el-button type="primary" icon="el-icon-refresh" @click="onManufacturerReset">重置</el-button>
          <el-button type="primary" icon="el-icon-search" @click="onManufacturerSubmit">查询</el-button>
        </el-button-group>
      </div>

      <el-divider style="margin: 15px"></el-divider>
      <el-table v-loading="loadManufacturerLoading" :data="manufacturerList" style="width: 100%" ref="table"
      highlight-current-row border  @row-click="(row) => executeFuc(row,'0',tableObj2.handleChangeFuc)">
      <!--        <el-table-column label="序号" type="index"></el-table-column>-->
      <!--        <el-table-column label="生产企业名称" prop="companyName" width="200" show-overflow-tooltip></el-table-column>-->
      <!--        <el-table-column label="社会信用号" prop="creditCode"></el-table-column>-->
      <!--        <el-table-column label="企业类型" prop="bussinessStatus" width="120">-->
      <!--          <template slot-scope="scope">-->
      <!--            <span>{{ companyTypeMap[scope.row.companyType] }}</span>-->
      <!--          </template>-->
      <!--        </el-table-column>-->
      <!--        <el-table-column label="所在地区" prop="placeArea"></el-table-column>-->
      <!--        <el-table-column label="所在地址" prop="placeAddress" :show-overflow-tooltip="true"></el-table-column>-->
      <!--        <el-table-column label="所属供应商" prop="supName" :show-overflow-tooltip="true"></el-table-column>-->
      <!--        <el-table-column label="配送产品证书" prop="auditStatus" width="120">-->
      <!--          <template slot-scope="scope">-->
          <!--            <el-tag type="danger" v-if="scope.row.failCout==0 && scope.row.passCout==0">-->
          <!--              未添加证书-->
          <!--            </el-tag>-->
          <!--            <el-tag type="warning" v-if="scope.row.failCout>0">-->
          <!--              未全部审核-->
          <!--            </el-tag>-->
          <!--            <el-tag type="success" v-if="scope.row.failCout==0 && scope.row.passCout>0">-->
          <!--              已全部审核-->
          <!--            </el-tag>-->

          <!--          </template>-->
          <!--        </el-table-column>-->
          <!--        <el-table-column label="审核状态" prop="auditStatus" width="120">-->
          <!--          <template slot-scope="scope">-->
          <!--            <el-tag :type="(scope.row.auditStatus) | statusFilterType">-->
          <!--              {{ checkFlag[scope.row.auditStatus] }}-->
          <!--            </el-tag>-->
          <!--          </template>-->
          <!--        </el-table-column>-->

          <!--        <el-table-column label="操作" width="120">-->
          <!--          <template slot-scope="scope">-->
          <!--            <el-button type="text" size="small"-->
          <!--                       v-if="scope.row.auditStatus ==6 || scope.row.auditStatus ==3|| scope.row.auditStatus ==4"-->
          <!--                       @click.native.stop="addInfoDialog(scope.row)">审核-->
          <!--            </el-button>-->
          <!--            <el-button type="text" size="small"-->
          <!--                       v-if="scope.row.auditStatus !=6 && scope.row.auditStatus !=3 && scope.row.auditStatus !=4"-->
          <!--                       @click.native.stop="addInfoDialog(scope.row)">详情-->
          <!--            </el-button>-->
          <!--          </template>-->
          <!--        </el-table-column>-->
          <template v-for="(item, index) in tableHeader2">
            <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>

            <el-table-column v-if="item.columnName == 'failCout'" :label="item.columnDesc" prop="auditStatus" :width="item.width">
              <template slot-scope="scope">

                <el-tag type="danger" v-if="scope.row.failCout==0 && scope.row.passCout==0">
                  未添加证书
                </el-tag>
                <el-tag type="warning" v-if="scope.row.failCout>0">
                  未全部审核
                </el-tag>
                <el-tag type="success" v-if="scope.row.failCout==0 && scope.row.passCout>0">
                  已全部审核
                </el-tag>

              </template>
            </el-table-column>
          </template>
          </el-table>

          <pagination
            v-show="manufacturerTotal>0"
            :total="manufacturerTotal"
            :page.sync="filterManufacturerQuery.page"
            :limit.sync="filterManufacturerQuery.limit"
            @pagination="handleManuChange"

          ></pagination>


    </el-card>
    <el-dialog
      :title="formManufacturerMap[formManufacturerName]"
      :visible.sync="addInfoVisible"
      width="80%"
      :before-close="headClose"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      v-if="addInfoVisible"
      @close='closeDialog'
    >
      <supManufacturerAuditDialog
        :addCloseDialog="closeManufacturerDialog"
        :enterpriseId="enterpriseId"
        :auditType="auditType"
        :inputQuery="inputManufacturerQuery"
        :editType="editManufacturerType"
      ></supManufacturerAuditDialog>
    </el-dialog>


    <!--        配送产品资质       -->
    <el-card class="el-card">
      <el-form v-if="queryList3 && queryList3.length > 0" :model="registrationQuery" class="query-form" label-width="120px" v-show="showSearch3">
        <!--        <el-row>-->
        <!--          <el-col :span="6">-->
        <!--            <el-form-item label="物资名称:">-->
        <!--              <el-input v-model="registrationQuery.recordProductName" style="width: 90%;" clearable="true"-->
        <!--                        placeholder="请输入物资名称"></el-input>-->
        <!--            </el-form-item>-->
        <!--          </el-col>-->
        <!--          <el-col :span="6">-->
        <!--            <el-form-item label="注册备案号:">-->
        <!--              <el-input v-model="registrationQuery.recordCode" style="width: 90%;" clearable="true"-->
        <!--                        placeholder="请输入注册备案号"></el-input>-->
        <!--            </el-form-item>-->
        <!--          </el-col>-->
        <!--          <el-col :span="6">-->
        <!--            <el-form-item label="注册备案人:">-->
        <!--              <el-input v-model="registrationQuery.recordPeopleName" style="width: 90%;" clearable="true"-->
        <!--                        placeholder="请输入注册备案人"></el-input>-->
        <!--            </el-form-item>-->
        <!--          </el-col>-->
        <!--        </el-row>-->
        <el-row style=" display:flex;  flex-wrap: wrap; ">
          <template v-for="(item, index) in queryList3" >
            <el-form-item v-if="item.columnType == 'input' && executeEval(row,item.expression,true)" :label="item.columnDesc+`:`" :key="item.id">
              <el-input
                v-model="registrationQuery[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="registrationQuery[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="registrationQuery[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="registrationQuery[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-form>


      <div class="top-right-btn">
        <el-button-group style="display:flex;">
          <el-button icon="el-icon-view" type="primary" @click="hideSearch3">显示/隐藏搜索栏</el-button>
          <el-button type="primary" icon="el-icon-refresh" @click="onReset2">重置</el-button>
          <el-button type="primary" icon="el-icon-search" @click="onSubmit2">查询</el-button>
        </el-button-group>
      </div>
      <el-divider style="margin: 15px"></el-divider>

      <el-table v-loading="registrationLoading" :data="registrationList" border highlight-current-row
                style="width: 100%">
        <!--        <el-table-column type="index" label="序号" width="50"></el-table-column>-->
        <!--        <el-table-column label="物资名称" prop="recordProductName" show-overflow-tooltip></el-table-column>-->
        <!--        <el-table-column label="规格型号" prop="ggxh" show-overflow-tooltip></el-table-column>-->
        <!--        <el-table-column label="注册/备案号" prop="recordCode" show-overflow-tooltip></el-table-column>-->
        <!--        <el-table-column label="注册/备案人名称" prop="recordPeopleName" show-overflow-tooltip></el-table-column>-->
        <!--        <el-table-column label="生产企业" prop="manufacturerName" show-overflow-tooltip></el-table-column>-->
        <!--        <el-table-column label="所属供应商" prop="supName" show-overflow-tooltip></el-table-column>-->
        <!--        <el-table-column label="审核状态" prop="auditStatus" width="120">-->
        <!--          <template slot-scope="scope">-->
        <!--            <el-tag :type="(scope.row.auditStatus) | statusFilterType">-->
        <!--              {{ checkFlag[scope.row.auditStatus] }}-->
        <!--            </el-tag>-->
        <!--          </template>-->
        <!--        </el-table-column>-->
        <!--        <el-table-column label="操作" width="120">-->
        <!--          <template slot-scope="scope">-->
        <!--            <el-button-->
        <!--              type="text"-->
        <!--              size="small"-->
        <!--              v-if="scope.row.auditStatus ==6 || scope.row.auditStatus ==3|| scope.row.auditStatus ==4"-->
        <!--              @click.native.stop="registrationDialog(scope.row)"-->
        <!--            >审核-->
        <!--            </el-button>-->


        <!--            <el-button-->
        <!--              type="text"-->
        <!--              size="small"-->
        <!--              v-if="scope.row.auditStatus !=6 && scope.row.auditStatus !=3 && scope.row.auditStatus !=4"-->
        <!--              @click.native.stop="registrationDialog(scope.row)"-->
        <!--            >详情-->
        <!--            </el-button>-->

        <!--          </template>-->
        <!--        </el-table-column>-->
        <template v-for="(item, index) in tableHeader3">
          <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>

      <pagination
        v-show="certTotal>0"
        :total="certTotal"
        :page.sync="registrationQuery.page"
        :limit.sync="registrationQuery.limit"
        @pagination="certHandleCurrentChange"

      ></pagination>
    </el-card>
    <el-dialog
      :title="formProductMap[formProductName]"
      :visible.sync="registrationVisible"
      width="80%"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      v-if="registrationVisible"
      @close='closeProductDialog'
    >
      <suppliersRegistrationBasic
        :closeRegistrationDialog="closeProductDialog"
        :inputQuery="inputProudtQuery"
        :auditType="auditType"
        :editType="editProductType"
      ></suppliersRegistrationBasic>
    </el-dialog>

  </div>
</template>

<script>
import {getSupComapnys, delSupComapnys} from "@/api/purchase/supCompany";
import supCompanyEditAdudit from "@/views/purchase/company/supCompanyAduditDialog";
import supManufacturerAuditDialog from "@/views/purchase/manufacturer/supManufacturerAuditDialog";
import {deleteCompany, getCompanyList} from "@/api/purchase/supManufacturer";
import suppliersRegistrationBasic from "@/views/purchase/product/supProductAuditDialog";
import {deleteRegistration, getRegistrationList} from "@/api/purchase/suppliersRegistrationBasic";
import {
  getHead,executeFuc
} from "@/utils/customConfig";


export default {
  data() {
    return {
      /**-----------------配送企业资质----------------------------*/
      showSearch: true,
      filterQuery: {
        companyName: "",
        checkType: "",
        creditNum: "",
        auditStatus: "21",
        page: 1,
        limit: 20,
      },
      auditType: 1,
      loading: false,
      list: [],
      total: 0,
      tableHeader:[],
      queryList:[],
      fromList:[],
      tableHeader2:[],
      queryList2:[],
      fromList2:[],
      tableHeader3:[],
      queryList3:[],
      fromList3:[],
      options:{
      },
      formName: 1,
      formMap: {
        1: "配送企业资质详情",
        2: "配送企业资质审核",
      },
      checkFlag: {
        0: "草稿",
        1: "已通过",
        2: "已拒绝",
        3: "变更未审核",
        6: "未审核",
      },
      supCompanyVisible: false,
      inputQuery: {},
      editType: 0,            //0:新增，1：编辑

      /**-----------------生产企业资质----------------------------*/
      showSearch2: true,
      filterManufacturerQuery: {
        customerId: null,
        companyName: "",
        creditCode: "",
        placeArea: "",
        auditStatus: "21",
        page: 1,
        limit: 10,
      },
      manufacturerTotal: 0,
      companyTypeMap: {
        1: "境内企业",
        2: "境外企业"
      },
      productManageTypeMap: {
        1: "Ⅰ类",
        2: "Ⅱ类",
        3: "Ⅲ类",
      },
      formManufacturerName: 1,
      formManufacturerMap: {
        1: "生产企业资质详情",
        2: "生产企业资质审核",
      },

      manufacturerLoading: false,
      manufacturerList: [],
      fromOptions: [],
      addInfoVisible: false,
      enterpriseId: "",
      inputManufacturerQuery: {},
      editManufacturerType: 1,
      loadManufacturerLoading: false,


      /**----------------------------配送产品资质--------------------------------*/
      showSearch3: true,
      productLoading: false,
      value: "",
      registrationVisible: false,
      registrationQuery: {
        customerId: null,
        manufacturerIdFk: null,
        auditStatus: "21",
        recordProductName: "",
        recordCode: "",
        recordPeopleName: "",
        page: 1,
        limit: 20
      },
      registrationList: [],
      registrationLoading: false,

      pmQuery: {
        customerId: null,
        companyName: null,
        page: 1,
        limit: 10,
      },
      formProductName: 1,
      formProductMap: {
        1: "配送产品资质详情",
        2: "配送产品资质审核",
      },

      inputProudtQuery: {},
      editProductType: 0,
      certTotal: 0,

    };
  },
  filters: {


    statusFilterType(status) {
      const statusMap = {
        0: "warning",
        1: "success",
        2: "danger",
        6: "warning",
        3: "warning",
      };
      return statusMap[status];
    },
    manufacturerStatusType(passCount, failCout) {
      const statusMap = {
        0: "warning",
        1: "success",
        2: "danger",
        6: "warning",
        3: "warning",
      };
      return statusMap[status];
    },

    statusFilterName(status) {
      const statusMap = {
        0: "禁用",
        1: "正常",
        2: "未验证",
      };
      return statusMap[status];
    },
  },

  methods: {
    /**-------------------------配送企业资质--------------------------*/
    onReset() {
      this.$router.push({
        path: "",
      });
      this.filterQuery = {
        companyName: "",
        creditNum: "",
        auditStatus: 21,
        page: 1,
        limit: 20,
      };
      this.getList();
      this.manufacturerList = [];
      this.registrationList = [];
      this.productList = [];
      this.salesmanList = [];
    },
    hideSearch() {
      this.showSearch = !this.showSearch;
    },
    getList() {
      this.loading = true;
      this.filterQuery.manufacturerStatus = 1;
      getSupComapnys(this.filterQuery)
        .then((response) => {
          console.log(response)
          this.loading = false;
          this.list = response.data.list || [];
          this.total = response.data.total || 0;
        })
        .catch(() => {
          this.loading = false;
          this.list = [];
          this.total = 0;
        });
    },
    onSubmit() {
      this.filterQuery.page=1;
      this.getList();
    },
    editCompany(_this,row) {
      if (row.auditStatus == 6 || row.auditStatus == 3 || row.auditStatus == 4) {
        _this.formName = 2;
        _this.editType = 2;
      } else {
        _this.editType = 1;
        _this.formName = 1;
      }
      _this.supCompanyVisible = true;
      _this.inputQuery = row;
    },

    handleCurrentChange(val) {
      this.filterQuery.page = val.page;
      this.getList();
    },
    deleteDialog(row) {
      this.$confirm("删除后将清空该供应商以及所有关联信息?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          let tQuery = {
            id: row.customerId,
          };
          delSupComapnys(tQuery).then(() => {
            this.getList();
          });
        })
        .catch(() => {
        });
    },
    closeDialog() {
      this.supCompanyVisible = false;
    },

    supCompanyClick(_this,row) {
      _this.filterManufacturerQuery.customerId = row.customerId;
      _this.registrationList = [];
      _this.onManufacturerReset();
    },


    /**-------------------------生产企业资质--------------------------*/
    onManufacturerReset() {
      let customerId = this.filterManufacturerQuery.customerId;
      this.filterManufacturerQuery = {
        customerId: customerId,
        companyName: "",
        creditCode: "",
        placeArea: "",
        page: 1,
        auditStatus: 21,
        limit: 10,
      };
      this.manufacturerList = [];
      this.registrationList = [];
      this.getManufacturerList();
    },
    close() {
      this.getList();
      this.supCompanyVisible = false;
    },
    headClose() {
      this.addInfoVisible = false;
      this.getManufacturerList();
    },
    onManufacturerSubmit() {
      this.filterManufacturerQuery.page=1;
      //this.onManufacturerReset();
      this.getManufacturerList();
      this.addInfoVisible = false;
    },
    hideSearch2() {
      this.showSearch2 = !this.showSearch2;
    },
    getManufacturerList() {
      this.manufacturerLoading = true;
      this.filterManufacturerQuery.productStatus = 1;
      getCompanyList(this.filterManufacturerQuery)
        .then((response) => {
          this.manufacturerLoading = false;
          this.manufacturerList = response.data.list || [];
          this.manufacturerTotal = response.data.total || 0;
        })
        .catch(() => {
          this.manufacturerLoading = false;
          this.manufacturerList = [];
          this.total = 0;
        });
    },
    addInfoDialog(_this,row) {

      if (row.auditStatus == 6 || row.auditStatus == 3 || row.auditStatus == 4) {
        _this.editManufacturerType = 2;
        _this.formManufacturerName = 2;
      } else {
        _this.editManufacturerType = 1;
        _this.formManufacturerName = 1;
      }
      _this.enterpriseId = row.id;
      _this.inputManufacturerQuery = row;
      _this.addInfoVisible = true;
    },
    closeManufacturerDialog(type) {
      if (type == true) {
        this.addInfoVisible = false;
        this.enterpriseId = null;
        this.manufacturerList = [];
        this.getManufacturerList();
      } else {
        this.getManufacturerList();
      }

    },
    handleManuChange(val) {
      this.filterManufacturerQuery.page = val.page;
      this.getManufacturerList();
    },

    supManufacturerClick(_this,row) {
      _this.registrationQuery.customerId = row.customerId;
      _this.registrationQuery.manufacturerIdFk = row.manufacturerId;
      _this.onReset2();
    },


    /**-------------------------配送产品资质--------------------------*/
    onReset2() {

      let customerId = this.registrationQuery.customerId;
      let manufacturerIdFk = this.registrationQuery.manufacturerIdFk;

      this.registrationQuery = {
        customerId: customerId,
        manufacturerIdFk: manufacturerIdFk,
        recordProductName: "",
        recordCode: "",
        recordPeopleName: "",
        auditStatus: 21,
        page: 1,
        limit: 10
      };
      this.getRegistrationList();
    },
    onSubmit2() {
      this.registrationQuery.page=1;
      this.getRegistrationList();
    },
    hideSearch3() {
      this.showSearch3 = !this.showSearch3;
    },
    registrationDialog(_this,row) {
      if (row.auditStatus == 2) {
        _this.editProductType = 2;
        _this.formProductName = 1;
      } else if (row.auditStatus == 6 || row.auditStatus == 3 || row.auditStatus == 4) {
        _this.formProductName = 2;
        _this.editProductType = 2;
      } else {
        _this.editProductType = 1;
        _this.formProductName = 1;
      }
      _this.registrationId = row.id;
      _this.inputProudtQuery = row;
      _this.registrationVisible = true;
    },
    closeProductDialog() {
      this.registrationVisible = false;
      this.enterpriseId = null;
      this.registrationId = null;
      this.registrationList = [];
      this.getRegistrationList();
    },
    getRegistrationList() {
      this.registrationLoading = true;
      getRegistrationList(this.registrationQuery)
        .then((response) => {
          this.registrationLoading = false;
          this.registrationList = response.data.list || [];
          this.certTotal = response.data.total
        })
        .catch(() => {
          this.registrationLoading = false;
          this.registrationList = [];
        });
    },
    certHandleCurrentChange(val) {
      this.registrationQuery.page = val.page;
      this.getRegistrationList();
    },
    executeFuc(row,type,clickFuc,value){
      return executeFuc(this,row,type,clickFuc,value);
    },
    executeEval(row,expression,defaultRet){
      if(expression){
        return eval(expression);
      }
      return defaultRet;
    }

  },
  components: {
    supCompanyEditAdudit, supManufacturerAuditDialog, suppliersRegistrationBasic
  }
  ,

  created() {
    getHead("supCertAudit-1","1").then((re) => {
      // 处理返回的数据
      this.tableObj = re.data;
      this.tableHeader = re.data.tableList;
      this.queryList = re.data.queryList;
      this.fromList = re.data.fromList;
      this.getList();
    });
    getHead("supCertAudit-2","1").then((re) => {
      // 处理返回的数据
      this.tableObj2 = re.data;
      this.tableHeader2 = re.data.tableList;
      this.queryList2 = re.data.queryList;
      this.fromList2 = re.data.fromList;
    });
    getHead("supCertAudit-3","1").then((re) => {
      // 处理返回的数据
      this.tableObj3= re.data;
      this.tableHeader3 = re.data.tableList;
      this.queryList3 = re.data.queryList;
      this.fromList3 = re.data.fromList;
    });
  },
};
</script>
