<template>
  <div id="commodityManageMentAdd">
    <h5>商品信息</h5>
    <div class="boxsSTTs">
      <h5 class="fengs">基本信息</h5>
      <el-row :gutter="20">
        <el-col :span="12">
          <el-form
            label-position="right"
            label-width="120px"
            :model="listData"
            :rules="rules"
            ref="listData1"
          >
            <el-form-item label="商品类型" prop="goodsType">
              <el-select
                v-model="listData.goodsType"
                placeholder="请选择商品类型"
              >
                <el-option
                  v-for="(item, index) in goodsTypeOptions"
                  :key="index"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="商品名称" prop="goodsName">
              <el-input
                style="width: 300px"
                v-model="listData.goodsName"
              ></el-input>
            </el-form-item>
            <el-form-item label="学时" prop="classHours">
              <el-input
                class="numInputs"
                type="age"
                v-model.number="listData.classHours"
                ><template slot="append">分钟</template></el-input
              >
            </el-form-item>
            <el-form-item label="教育类型" prop="educationTypeId">
              <el-select
                v-model="listData.educationTypeId"
                placeholder="请选择教育类型"
                @change="changeEducationTypeId"
              >
                <el-option
                  v-for="(item, index) in eduTypeOptions"
                  :key="index"
                  :label="item.educationName"
                  :value="item.id"
                >
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="业务层次" prop="businessId">
              <el-select
                v-model="listData.businessId"
                placeholder="请选择业务层次"
                @change="changeBusinessId"
              >
                <el-option
                  v-for="(item, index) in newCourTypeOptions"
                  :key="index"
                  :label="item.businessName"
                  :value="item.id"
                >
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item
              label="院校"
              prop="schoolId"
              v-if="listData.businessId && avtives()"
            >
              <el-select v-model="listData.schoolId" placeholder="请选择院校">
                <el-option
                  v-for="(item, index) in newSchoolOption"
                  :key="index"
                  :label="item.schoolName"
                  :value="item.id"
                >
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item
              label="专业"
              prop="majorId"
              v-if="listData.businessId && avtivesMajor()"
            >
              <el-select v-model="listData.majorId" placeholder="请选择专业">
                <el-option
                  v-for="(item, index) in newMajorOption"
                  :key="index"
                  :label="item.categoryName"
                  :value="item.id"
                >
                </el-option>
              </el-select>
            </el-form-item>
            <!-- <el-form-item
              label="科目/类目"
              prop="subjectId"
              v-if="listData.businessId"
            >
              <el-select
                v-model="listData.subjectId"
                placeholder="请选择科目/类目"
              >
                <el-option
                  v-for="(item, index) in newSujectOption"
                  :key="index"
                  :label="item.subjectName"
                  :value="item.id"
                >
                </el-option>
              </el-select>
            </el-form-item> -->
          </el-form>
        </el-col>
        <el-col :span="12">
          <el-form label-position="right" label-width="120px" :model="listData">
            <el-form-item label="年份" prop="year">
              <el-date-picker
                v-model="listData.year"
                type="year"
                value-format="yyyy"
                placeholder="请选择年份"
              >
              </el-date-picker>
            </el-form-item>
            <el-form-item label="供应方（服务）" prop="supplyId">
              <el-select
                v-model="listData.supplyId"
                placeholder="请选择供应方（服务）"
              >
                <el-option
                  v-for="(item, index) in supplyOption"
                  :key="index"
                  :label="item.supplyName"
                  :value="item.supplyId"
                >
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="课程封面">
              <div class="imgBoxins">
                <img
                  :src="$methodsTools.splitImgHost(listData.coverUrl)"
                  alt=""
                />
                <div
                  class="posimg"
                  v-if="
                    listData.coverUrl === null ||
                    listData.coverUrl === '' ||
                    listData.coverUrl === undefined
                  "
                >
                  <label for="uplose">
                    <i class="el-icon-circle-plus-outline iconStsz"></i
                  ></label>
                  <input
                    ref="file"
                    type="file"
                    style="display: none"
                    id="uplose"
                    @change="getImgFile"
                  />
                  <p>
                    注：请上传小于300kb，尺寸为750*440的图片，支持gif、jpg、jpeg、png等类型
                  </p>
                </div>
              </div>
              <el-button
                v-if="
                  listData.coverUrl !== null &&
                  listData.coverUrl !== '' &&
                  listData.coverUrl !== undefined
                "
                type="danger"
                size="mini"
                class="margin-top: 20px;"
                @click="clearImgs"
                >删除</el-button
              >
            </el-form-item>
          </el-form>
        </el-col>
      </el-row>
      <h5 class="fengs">商品价格和有效期</h5>
      <el-row :gutter="20">
        <el-col :span="12">
          <el-form
            label-position="right"
            label-width="120px"
            :model="listData"
            :rules="rulesMors"
            ref="listData2"
          >
            <el-form-item label="商品标准价格" prop="standPrice">
              <el-input class="numInputs" v-model="listData.standPrice"
                ><template slot="append">元</template></el-input
              >
            </el-form-item>
            <el-form-item label="商品最低价格" prop="lowestPrice">
              <el-input class="numInputs" v-model="listData.lowestPrice"
                ><template slot="append">元</template></el-input
              >
            </el-form-item>
            <el-form-item label="状态" prop="status">
              <el-radio-group v-model="listData.status">
                <el-radio :label="1">有效</el-radio>
                <el-radio :label="0">无效</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="商品有效期" prop="timeArrays">
              <el-date-picker
                v-model="listData.timeArrays"
                type="daterange"
                value-format="timestamp"
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
              >
              </el-date-picker>
            </el-form-item>
          </el-form>
        </el-col>
        <el-col :span="12">
          <h5 style="margin-bottom: 10px">
            商品标准价格明细表：
            <span class="clickSpan" @click="openBoxs(1)">添加</span>
          </h5>
          <el-table
            :data="listData.standPriceJson"
            show-summary
            border
            :header-cell-style="{
              'background-color': '#eee',
              padding: '8px',
              color: '#333',
            }"
          >
            <el-table-column
              type="index"
              label="序号"
              width="80"
              align="center"
            >
            </el-table-column>
            <template v-for="(item, index) in tableSet">
              <el-table-column
                :width="item.width"
                :key="index"
                :label="item.label"
                align="center"
                :show-overflow-tooltip="true"
                header-align="center"
                :prop="item.prop"
              >
                <template slot-scope="scope">
                  <span
                    v-if="item.scope === 'editInfo'"
                    @click="openBoxs(2, scope.row)"
                    class="clickSpan"
                    >{{ scope.row[item.prop] }}</span
                  >
                  <span v-else>{{ scope.row[item.prop] }}</span></template
                >
              </el-table-column></template
            >
            <el-table-column
              label="操作"
              align="center"
              fixed="right"
              width="100px"
            >
              <template slot-scope="scope">
                <el-button type="text" @click="delList(scope.row)"
                  >删除</el-button
                >
              </template>
            </el-table-column>
          </el-table>
        </el-col>
      </el-row>
      <div v-if="listData.goodsType === 1">
        <h5 class="fengs">课程内容</h5>
        <div style="margin-bottom: 20px">
          <el-button @click="editAddBoxs" size="small">添加</el-button>
          <el-button
            @click="openSet"
            type="success"
            size="small"
            v-if="tableData.length"
            >试听设置</el-button
          >
          <el-button type="primary" @click="openJY" size="small"
            >关联讲义</el-button
          >
        </div>
        <el-table
          :data="tableData"
          border
          :header-cell-style="{
            'background-color': '#eee',
            padding: '8px',
            color: '#333',
          }"
          :default-sort="{ prop: 'sort', order: 'ascending' }"
        >
          <template v-for="(item, index) in tableSetTSB">
            <el-table-column
              :width="item.width"
              :key="index"
              :label="item.label"
              align="center"
              :show-overflow-tooltip="true"
              header-align="center"
              :sortable="item.prop === 'sort'"
              sort-by="sort"
              :prop="item.prop"
            >
              <template slot-scope="scope">
                <span v-if="item.scope === 'types'">{{
                  scope.row[item.prop] === 1
                    ? "录播"
                    : scope.row[item.prop] === 2
                    ? "直播"
                    : scope.row[item.prop] === 3
                    ? "回放"
                    : "未知"
                }}</span>
                <span v-else-if="item.scope === 'busin'">
                  {{ scope.row[item.prop1] + " - " + scope.row[item.prop2] }}
                </span>
                <span v-else-if="item.scope === 'Status'">
                  {{
                    scope.row[item.prop] === 1
                      ? "发布"
                      : scope.row[item.prop] === 0
                      ? "未发布"
                      : "未知"
                  }}
                </span>
                <div v-else-if="item.scope === 'inputs'">
                  <el-input-number
                    style="width: 50px"
                    size="small"
                    :controls="false"
                    v-model="scope.row[item.prop]"
                    controls-position="right"
                    :min="0"
                  ></el-input-number>
                </div>
                <span v-else>{{ scope.row[item.prop] }}</span></template
              >
            </el-table-column></template
          >
          <el-table-column
            label="操作"
            align="center"
            fixed="right"
            width="100px"
          >
            <template slot-scope="scope">
              <el-button type="text" @click="del(scope.row, scope.$index)"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div v-if="listData.goodsType === 2">
        <h5 class="fengs">题卷内容</h5>
        <div style="margin-bottom: 20px">
          <el-button @click="editAddBoxs2(1)" size="small">添加</el-button>
          <el-button
            @click="openSetTK"
            type="success"
            size="small"
            v-if="tableData2.length"
            >试做设置</el-button
          >
        </div>
        <el-table
          :data="tableData2"
          border
          :header-cell-style="{
            'background-color': '#eee',
            padding: '8px',
            color: '#333',
          }"
          :default-sort="{ prop: 'sort', order: 'ascending' }"
        >
          <template v-for="(item, index) in tableSetTSB2">
            <el-table-column
              :width="item.width"
              :key="index"
              :label="item.label"
              align="center"
              :show-overflow-tooltip="true"
              header-align="center"
              :sortable="item.prop === 'sort'"
              sort-by="sort"
              :prop="item.prop"
            >
              <template slot-scope="scope">
                <span v-if="item.scope === 'types'">{{
                  scope.row[item.prop] === 1
                    ? "录播"
                    : scope.row[item.prop] === 2
                    ? "直播"
                    : scope.row[item.prop] === 3
                    ? "回放"
                    : "未知"
                }}</span>
                <span v-else-if="item.scope === 'type'">
                  {{
                    scope.row[item.prop] === 1
                      ? "模块卷"
                      : scope.row[item.prop] === 2
                      ? "章卷"
                      : scope.row[item.prop] === 3
                      ? "试卷"
                      : "未知"
                  }}
                </span>
                <span v-else-if="item.scope === 'busin'">
                  {{ scope.row[item.prop1] + " - " + scope.row[item.prop2] }}
                </span>
                <span v-else-if="item.scope === 'Status'">
                  {{
                    scope.row[item.prop] === 1
                      ? "发布"
                      : scope.row[item.prop] === 0
                      ? "未发布"
                      : "未知"
                  }}
                </span>
                <div v-else-if="item.scope === 'inputs'">
                  <el-input-number
                    style="width: 50px"
                    size="small"
                    :controls="false"
                    v-model="scope.row[item.prop]"
                    controls-position="right"
                    :min="0"
                  ></el-input-number>
                </div>
                <span v-else>{{ scope.row[item.prop] }}</span></template
              >
            </el-table-column></template
          >
          <el-table-column
            label="操作"
            align="center"
            fixed="right"
            width="100px"
          >
            <template slot-scope="scope">
              <el-button type="text" @click="del2(scope.row, scope.$index)"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>
      </div>
      <h5 class="fengs">颁发证书</h5>
      <div class="dis_fs">
        <el-popover placement="bottom" trigger="click">
          <el-checkbox-group v-model="listData.certificateIds">
            <el-checkbox
              v-for="(item, index) in certificateOption"
              :key="index"
              :label="item.id"
              >{{ item.certificateName }}</el-checkbox
            >
          </el-checkbox-group>
          <el-button slot="reference" size="small">选择证书</el-button>
        </el-popover>
        <ul>
          <li
            class="boxlefs"
            v-for="item in listData.certificateIds"
            :key="item"
          >
            {{ checkListName(item) }}
            <i
              class="el-icon-error"
              style="color: #f56c6c"
              @click="clearBtns(item)"
            ></i>
          </li>
          <div style="clear: both"></div>
        </ul>
      </div>
    </div>
    <h5>商品包装介绍</h5>
    <div class="boxsSTTs">
      <el-form
        label-position="right"
        label-width="70px"
        :model="listData"
        :rules="rules"
        ref="listData"
      >
        <el-form-item label="商品简介" prop="introduce">
          <el-input type="textarea" v-model="listData.introduce"></el-input>
        </el-form-item>
        <el-form-item label="适合对象" prop="suitableObject">
          <el-input
            type="textarea"
            v-model="listData.suitableObject"
          ></el-input>
        </el-form-item>
        <el-form-item label="购买须知" prop="buyNote">
          <el-input type="textarea" v-model="listData.buyNote"></el-input>
        </el-form-item>
      </el-form>
      <div class="courseStyle">
        商品详情<span style="color: #999; margin-left: 6px">支持图文</span>
      </div>
      <div style="text-align: center; margin-bottom: 10px">
        <el-button
          size="mini"
          :type="active === 1 ? 'success' : ''"
          @click="active = 1"
          >PC端</el-button
        >
        <el-button
          size="mini"
          :type="active === 2 ? 'success' : ''"
          @click="active = 2"
          >手机端</el-button
        >
      </div>
      <editor
        v-show="active === 1"
        v-model="listData.pcDetailHtml"
        :min-height="300"
        :max-height="500"
        :uploadStatus="uploadStatus"
      />
      <editor
        v-show="active === 2"
        v-model="listData.mobileDetailHtml"
        :min-height="300"
        :max-height="500"
        :uploadStatus="uploadStatus"
      />
    </div>
    <div style="text-align: center; margin-top: 20px">
      <el-button @click="backPage" size="mini">取消</el-button>
      <el-button type="primary" @click="submit('listData', 1)" size="mini"
        >保存</el-button
      >
      <el-button type="primary" @click="submit('listData', 2)" size="mini"
        >上架</el-button
      >
    </div>
    <el-dialog
      :title="statusBox === 1 ? '添加' : '编辑'"
      :visible.sync="dialogVisible"
      width="800px"
    >
      <el-form
        label-position="right"
        label-width="110px"
        :model="listitemData"
        :rules="rulesItem"
        ref="listitemData"
      >
        <el-form-item
          v-for="(items, indexs) in listitem"
          :key="indexs"
          :label="items.label"
          :prop="items.prop"
        >
          <el-select
            v-if="items.scope === 'select'"
            v-model="listitemData[items.prop]"
            placeholder="请选择费用类型"
          >
            <el-option
              v-for="(item, index) in items.options"
              :key="index"
              :label="item.costName"
              :value="item.costId"
            >
            </el-option>
          </el-select>
          <el-input v-else v-model="listitemData[items.prop]"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="submitForm('listitemData')"
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <el-dialog
      title="添加课程"
      :visible.sync="dialogVisibleTableBoxs"
      width="800px"
    >
      <el-table
        ref="multipleTable"
        :data="boxtableData"
        border
        @select-all="selectAll"
        @select="select"
        :row-key="getRowKeys"
        :header-cell-style="{
          'background-color': '#eee',
          padding: '8px',
          color: '#333',
        }"
      >
        <el-table-column
          align="center"
          type="selection"
          width="55"
          header-align="center"
          :selectable="checkboxT"
          :reserve-selection="true"
        >
        </el-table-column>
        <template v-for="(item, index) in tableSetTSBBOX">
          <el-table-column
            v-if="item.scope !== 'inputs'"
            :width="item.width"
            :key="index"
            :label="item.label"
            align="center"
            :show-overflow-tooltip="true"
            header-align="center"
          >
            <template slot-scope="scope">
              <span v-if="item.scope === 'Status'">
                {{
                  scope.row[item.prop] === 1
                    ? "发布"
                    : scope.row[item.prop] === 0
                    ? "未发布"
                    : "未知"
                }}
              </span>
              <span v-else>{{ scope.row[item.prop] }}</span></template
            >
          </el-table-column></template
        >
      </el-table>
      <pagination
        :total="total"
        :pageSize="pageSize"
        :currentPage="currentPage"
        @handleSizeChange="handleSizeChange"
        @handleCurrentChange="handleCurrentChange"
      />
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisibleTableBoxs = false">取 消</el-button>
        <el-button
          type="primary"
          :disabled="activeLists.length === 0"
          @click="submitTab"
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <el-dialog
      title="添加题卷"
      :visible.sync="dialogVisibleTableBoxs2"
      width="800px"
    >
      <el-select
        v-model="optionsNums"
        placeholder="请选择类型"
        @change="changeOptionsType2"
      >
        <el-option
          v-for="item in optionsType"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select>
      <el-table
        ref="multipleTable2"
        :data="boxtableData2"
        border
        @select-all="selectAll2"
        @select="select2"
        :row-key="getRowKeys2"
        :header-cell-style="{
          'background-color': '#eee',
          padding: '8px',
          color: '#333',
        }"
      >
        <el-table-column
          align="center"
          type="selection"
          width="55"
          header-align="center"
          :selectable="checkboxT2"
          :reserve-selection="true"
        >
        </el-table-column>
        <template v-for="(item, index) in tableSetTSBBOX2">
          <el-table-column
            v-if="item.scope !== 'inputs'"
            :width="item.width"
            :key="index"
            :label="item.label"
            align="center"
            :show-overflow-tooltip="true"
            header-align="center"
          >
            <template slot-scope="scope">
              <span v-if="item.scope === 'Status'">
                {{
                  scope.row[item.prop] === 1
                    ? "发布"
                    : scope.row[item.prop] === 0
                    ? "未发布"
                    : "未知"
                }}
              </span>
              <span v-else-if="item.scope === 'type'">
                {{
                  scope.row[item.prop] === 1
                    ? "模块卷"
                    : scope.row[item.prop] === 2
                    ? "章卷"
                    : scope.row[item.prop] === 3
                    ? "试卷"
                    : "未知"
                }}
              </span>
              <span v-else>{{ scope.row[item.prop] }}</span></template
            >
          </el-table-column></template
        >
      </el-table>
      <pagination
        :total="total2"
        :pageSize="pageSize2"
        :currentPage="currentPage2"
        @handleSizeChange="handleSizeChange2"
        @handleCurrentChange="handleCurrentChange2"
      />
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisibleTableBoxs2 = false">取 消</el-button>
        <el-button type="primary" @click="submitTab2">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog title="关联讲义" :visible.sync="aboutJYBox" width="400px">
      <el-button @click="openJYActiveBox">选择讲义</el-button>
      <div v-if="handoutsArray">
        {{ handoutsArray.handoutsName }}
        <i
          class="el-icon-error"
          style="color: #f56c6c"
          @click="delHandouts"
        ></i>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="aboutJYBox = false">取 消</el-button>
        <el-button type="primary" @click="submitJYs">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="关联讲义列表"
      :visible.sync="jYactiveBoxs"
      width="780px"
      append-to-body
    >
      <el-table
        ref="multipleTable"
        :data="jYtableData"
        border
        :header-cell-style="{
          'background-color': '#eee',
          padding: '8px',
          color: '#333',
        }"
      >
        <el-table-column label="" width="45" align="center">
          <template scope="scope">
            <el-radio
              :label="scope.row.handoutsId"
              v-model="templateRadio"
              @change.native="getTemplateRow(scope.$index, scope.row)"
              >{{ "" }}</el-radio
            >
          </template>
        </el-table-column>
        <template v-for="(item, index) in jYtableSet">
          <el-table-column
            v-if="item.scope !== 'inputs'"
            :width="item.width"
            :key="index"
            :label="item.label"
            align="center"
            :show-overflow-tooltip="true"
            header-align="center"
          >
            <template slot-scope="scope">
              <span v-if="item.scope === 'Status'">
                {{
                  scope.row[item.prop] === 1
                    ? "发布"
                    : scope.row[item.prop] === 0
                    ? "未发布"
                    : "未知"
                }}
              </span>
              <span v-else>{{ scope.row[item.prop] }}</span></template
            >
          </el-table-column></template
        >
      </el-table>

      <span slot="footer" class="dialog-footer">
        <el-button @click="jYactiveBoxs = false">取 消</el-button>
        <el-button type="primary" @click="activejY">确 定</el-button>
      </span>
    </el-dialog>
    <popple-set
    :key="Math.random()"
      ref="poppleSet"
      :tableData="tableData"
      @uploadArrays="uploadArrays"
    />
    <popple-set-tk
      :key="Math.random()"
      ref="poppleSetTk"
      :tableData="tableData2"
      :examConfigList="examConfigList"
      @uploadArrays="uploadArraysTK"
    />
  </div>
</template>

<script>
import poppleSet from "../poppleSet.vue";
import poppleSetTk from "../poppleSetTK.vue";
import pagination from "@/components/pagination";
import Editor from "@/components/Editor";
export default {
  components: { Editor, pagination, poppleSet,poppleSetTk },
  data() {
    return {
      active: 1,
      uploadStatus: 2,
      bfImg: "oss/images/avatar/20211013/1634097664410_1397766697",
      listData: {
        coverUrl: "oss/images/avatar/20211013/1634097664410_1397766697",
        educationTypeId: "",
        businessId: "",
        schoolId: "",
        majorId: "",
        subjectId: "",
        standPriceJson: [],
        certificateIds: [],
      },

      eduTypeOptions: [], //教育类型数据
      courTypeOptions: [], //业务层次数据
      sujectOption: [], //科目数据
      schoolOption: [], //院校数据
      majorOption: [], //专业数据
      supplyOption: [], //供应方数据

      certificateOption: [], //证书数据

      goodsTypeOptions: [
        {
          label: "视频",
          value: 1,
        },
        {
          label: "题库",
          value: 2,
        },
        {
          label: "面授",
          value: 3,
        },
        {
          label: "服务",
          value: 4,
        },
        {
          label: "组合",
          value: 5,
        },
      ], //商品类型

      newCourTypeOptions: [], //当前业务层次数据
      newSujectOption: [], //当前科目数据数据
      newSchoolOption: [], //当前院校数据
      newMajorOption: [], //当前专业数据
      tableSet: [
        {
          label: "费用类型",
          prop: "priceTypeName",
          prop1: "priceTypeId",
          scope: "editInfo",
        },
        {
          label: "费用金额（元）",
          prop: "price",
          scope: "price",
        },
      ],
      listitemData: {},
      // 弹窗字段
      listitem: [
        {
          label: "费用类型",
          prop: "priceTypeId",
          scope: "select",
          options: [],
        },
        {
          label: "费用金额",
          prop: "price",
        },
      ],
      statusBox: 1, //1添加2编辑
      dialogVisible: false,
      NUMBerS: 0,
      rules: {
        goodsType: [
          {
            required: true,
            message: "请选择商品类型",
            trigger: ["blur", "change"],
          },
        ],
        goodsName: [
          {
            required: true,
            message: "请输入商品名称",
            trigger: "change",
          },
        ],
        educationTypeId: [
          {
            required: true,
            message: "请选择教育类型",
            trigger: ["blur", "change"],
          },
        ],
        businessId: [
          {
            required: true,
            message: "请选择业务层次",
            trigger: ["blur", "change"],
          },
        ],
        schoolId: [
          {
            required: true,
            message: "请选择院校",
            trigger: ["blur", "change"],
          },
        ],
        majorId: [
          {
            required: true,
            message: "请选择专业",
            trigger: ["blur", "change"],
          },
        ],
        subjectId: [
          {
            required: true,
            message: "请选择科目",
            trigger: ["blur", "change"],
          },
        ],
        classHours: [
          { required: true, message: "请输入学时", trigger: "blur" },
          {
            validator(rule, value, callback) {
              if (
                Number.isInteger(Number(value)) &&
                Number(value) >= 0 &&
                Number(value) < 9999999
              ) {
                callback();
              } else {
                callback(new Error("请输入正整数"));
              }
            },
            trigger: "blur",
          },
        ],
      },
      rulesMors: {
        timeArrays: [
          {
            required: true,
            message: "请选择有效期",
            trigger: ["blur", "change"],
          },
        ],
        status: [
          {
            required: true,
            message: "请选择状态",
            trigger: ["blur", "change"],
          },
        ],
        standPrice: [
          { required: true, message: "请输入标准价格", trigger: "blur" },
          {
            validator(rule, value, callback) {
              var reg = /(^[1-9]\d*(\.\d{1,2})?$)|(^0(\.\d{1,2})?$)/;
              if (reg.test(value)) {
                callback();
              } else {
                callback(new Error("请输入不超过两位小数点的价格数值"));
              }
            },
            trigger: "blur",
          },
        ],
        lowestPrice: [
          { required: true, message: "请输入最低价格", trigger: "blur" },
          {
            validator(rule, value, callback) {
              var reg = /(^[1-9]\d*(\.\d{1,2})?$)|(^0(\.\d{1,2})?$)/;
              if (reg.test(value)) {
                callback();
              } else {
                callback(new Error("请输入不超过两位小数点的价格数值"));
              }
            },
            trigger: "blur",
          },
        ],
      },
      rulesItem: {
        priceTypeId: [
          {
            required: true,
            message: "请选择费用类型",
            trigger: ["blur", "change"],
          },
        ],
        price: [
          { required: true, message: "请输入费用金额", trigger: "blur" },
          {
            validator(rule, value, callback) {
              var reg = /(^[1-9]\d*(\.\d{1,2})?$)|(^0(\.\d{1,2})?$)/;
              if (reg.test(value)) {
                callback();
              } else {
                callback(new Error("请输入不超过两位小数点的价格数值"));
              }
            },
            trigger: "blur",
          },
        ],
      },
      //   视频商品表格数据------------------------------------------------------------------------start
      tableSetTSB: [
        { label: "排序", prop: "sort", scope: "inputs", width: "100" },
        { label: "科目名称", prop: "code" },
        { label: "课程名称", prop: "prefixName", width: "120" },
        { label: "科目", prop: "subjectName" },
        { label: "专业", prop: "categoryName" },
        { label: "院校", prop: "schoolName" },
        {
          label: "业务层次",
          prop1: "projectName",
          prop2: "businessName",
          scope: "busin",
        },
        { label: "教育类型", prop: "educationName" },
        {
          label: "发布状态",
          prop: "publishStatus",
          scope: "Status",
          width: "120",
        },
      ],
      tableSetTSBBOX: [
        { label: "课程编码", prop: "code" },
        { label: "名称前缀", prop: "prefixName", width: "120" },
        { label: "课程标题", prop: "courseName" },
        {
          label: "发布状态",
          prop: "publishStatus",
          scope: "Status",
          width: "120",
        },
      ],
      total: 0, //一共多少条
      pageSize: 10, //每页多少条数据
      currentPage: 1, //当前页码
      disCheckList: [],
      tableData: [],
      dialogVisibleTableBoxs: false,
      boxtableData: [],
      activeLists: [],
      auditionList: [],
      aboutJYBox: false,
      jYtableSet: [
        { label: "讲义编码", prop: "encoder" },
        { label: "讲义标题", prop: "handoutsName" },
        { label: "发布状态", prop: "status", scope: "Status" },
      ],
      jYtableData: [],
      jYactiveBoxs: false,
      templateRadio: "",
      handoutsArray: undefined,
      handoutsIdTable: "",
      //   视频商品表格数据------------------------------------------------------------------------end

      //   题库商品表格数据------------------------------------------------------------------------start
      tableSetTSB2: [
        { label: "排序", prop: "sort", scope: "inputs", width: "100" },
        { label: "题卷名称", prop: "prefixName", width: "120" },
        { label: "题库类型", prop: "type", scope: "type" },
        { label: "模块卷数", prop: "code" },
        { label: "章卷数", prop: "code" },
        { label: "试卷数", prop: "code" },
        // {
        //   label: "发布状态",
        //   prop: "publishStatus",
        //   scope: "Status",
        //   width: "120",
        // },
      ],
      tableSetTSBBOX2: [
        { label: "编码", prop: "code" },
        { label: "前缀", prop: "prefixName", width: "120" },
        { label: "名称", prop: "name" },
        { label: "题库类型", prop: "type", scope: "type" },
        {
          label: "发布状态",
          prop: "publishStatus",
          scope: "Status",
          width: "120",
        },
      ],
      total2: 0, //一共多少条
      pageSize2: 10, //每页多少条数据
      currentPage2: 1, //当前页码
      disCheckList2: {
        moduleCheck: [],
        chapterCheck: [],
        examCheck: [],
      },
      tableData2: [],
      dialogVisibleTableBoxs2: false,
      boxtableData2: [],
      activeLists2: {
        moduleCheck: [],
        chapterCheck: [],
        examCheck: [],
      },
      optionsNums: 1,
      optionsType: [
        {
          label: "模块卷",
          value: 1,
        },
        { label: "章卷", value: 2 },
        { label: "试卷", value: 3 },
      ],
      examConfigList: [],
      //   题库商品表格数据------------------------------------------------------------------------end
    };
  },
  watch: {
    handoutsIdTable: {
      handler(newValue, oldValue) {
        this.showTitles();
      },
    },
  },
  created() {
    this.getDict();
  },
  mounted(){
    this.getJyData();
  },
  methods: {
    avtives() {
      if (this.listData.educationTypeId) {
        for (let i = 0; i < this.eduTypeOptions.length; i++) {
          if (this.eduTypeOptions[i].id === this.listData.educationTypeId) {
            return this.eduTypeOptions[i].tireStatus.indexOf("3") != -1;
          }
        }
      }
    },
    avtivesMajor() {
      if (this.listData.educationTypeId) {
        for (let i = 0; i < this.eduTypeOptions.length; i++) {
          if (this.eduTypeOptions[i].id === this.listData.educationTypeId) {
            return this.eduTypeOptions[i].tireStatus.indexOf("4") != -1;
          }
        }
      }
    },
    //根据ID回显讲义标题
    showTitles() {
      const sta = this.jYtableData.some((item) => {
        return item.handoutsId == this.handoutsIdTable;
      });
      if (sta) {
        this.jYtableData.map((item) => {
          if (item.handoutsId == this.handoutsIdTable) {
            this.handoutsArray = item;
          }
        });
      } else {
        this.handoutsArray = undefined;
      }
    },
    //删除讲义
    delHandouts() {
      this.handoutsIdTable = "";
    },
    activejY() {
      this.handoutsIdTable = this.templateRadio;
      this.jYactiveBoxs = false;
    },
    getTemplateRow(index, row) {
      this.templateRadio = row.handoutsId;
    },
    getJyData() {
      this.$api.inquireCourseHandoutsList({ status: "1,0" }).then((res) => {
        this.jYtableData = res.rows;
      });
    },
    //确定讲义ID
    submitJYs() {
      this.listData.handoutsId = this.handoutsIdTable;
      this.aboutJYBox = false;
    },
    openJY() {
      this.aboutJYBox = true;
      this.handoutsIdTable = this.listData.handoutsId;
    },
    openJYActiveBox() {
      this.jYactiveBoxs = true;
      this.templateRadio = this.handoutsIdTable;
    },
    uploadArrays(arrays) {
      this.auditionList = arrays;
    },
    uploadArraysTK(arrays) {
      this.examConfigList = arrays;
    },
    openSet() {
      this.$refs.poppleSet.dialogVisible = true;
    },
    openSetTK() {
      this.$refs.poppleSetTk.dialogVisible = true;
    },
    getDict() {
      this.$api.inquireCourseEducationType({ status: 1 }).then((res) => {
        this.eduTypeOptions = res.rows;
      });
      this.$api.inquireCourseProjectType({ status: 1 }).then((res) => {
        this.projectTypeOptions = res.rows;
      });
      this.$api.inquirebusinessList({ status: 1 }).then((res) => {
        this.courTypeOptions = res.rows;
        this.newCourTypeOptions = res.rows;
      });
      this.$api.inquireCourseSubject({ status: 1 }).then((res) => {
        res.rows.map((item, index) => {
          var array = [];
          item.courseProjectTypes.map((items, indexs) => {
            array.push(items.id);
          });
          item.courseArrays = array;
        });
        this.sujectOption = res.rows;
      });
      this.$api.inquireUserSchool({ status: 1 }).then((res) => {
        res.rows.map((item, index) => {
          var array = [];
          item.courseProjectTypes.map((items, indexs) => {
            array.push(items.id);
          });
          item.courseArrays = array;
        });
        this.schoolOption = res.rows;
      });
      this.$api.inquireCourseMajor({ status: 1 }).then((res) => {
        res.rows.map((item, index) => {
          var array = [];
          item.courseProjectTypeVo.map((items, indexs) => {
            array.push(items.id);
          });
          item.courseArrays = array;
        });
        this.majorOption = res.rows;
      });
      this.$api.inquirepaysupply({ status: 1 }).then((res) => {
        this.supplyOption = res.rows;
      });
      this.$api.inquirepaycost({ status: 1 }).then((res) => {
        this.listitem[0].options = res.rows;
      });
      this.$api.inquireBaseCertificate({ status: 1 }).then((res) => {
        this.certificateOption = res.rows;
      });
    },
    //改变教育类型
    changeEducationTypeId() {
      var arrays = [];
      this.courTypeOptions.map((item) => {
        if (item.educationId === this.listData.educationTypeId) {
          arrays.push(item);
        }
      });
      this.newCourTypeOptions = arrays;
      this.listData.businessId = "";
    },
    //改变业务层次触发
    changeBusinessId() {
      this.listData.schoolId = "";
      this.listData.majorId = "";
      this.listData.subjectId = "";
      this.courTypeOptions.map((item) => {
        if (item.id === this.listData.businessId) {
          this.listData.educationTypeId = item.educationId;
          var newSujectOption = [];
          var newSchoolOption = [];
          var newMajorOption = [];
          this.sujectOption.map((items) => {
            if (items.courseArrays.indexOf(item.projectId) !== -1) {
              newSujectOption.push(items);
            }
          });
          this.schoolOption.map((items) => {
            if (items.courseArrays.indexOf(item.projectId) !== -1) {
              newSchoolOption.push(items);
            }
          });
          this.majorOption.map((items) => {
            if (items.courseArrays.indexOf(item.projectId) !== -1) {
              newMajorOption.push(items);
            }
          });
          this.newSujectOption = newSujectOption;
          this.newSchoolOption = newSchoolOption;
          this.newMajorOption = newMajorOption;
        }
      });
    },
    getImgFile() {
      var self = this;
      var file = self.$refs.file.files[0];
      if (file === undefined) {
        self.$set(self.listData, "coverUrl", "");
        return;
      }
      if (file.size > 2 * 1024 * 1024) {
        self.$message.error("图片不得大于2MB");
        return;
      }
      var type = self.$refs.file.value.toLowerCase().split(".").splice(-1);
      if (
        type[0] != "jpg" &&
        type[0] != "png" &&
        type[0] != "jpeg" &&
        type[0] != "gif"
      ) {
        self.$message.error("上传格式需为：.jpg/.png/.jpeg/gif");
        self.$refs.file.value = "";
        return;
      }
      this.$upload.upload(file, 0).then((res) => {
        self.listData.coverUrl = res;
      });
    },
    clearImgs() {
      this.listData.coverUrl = "";
    },
    async submit(formName, int) {
      //多表单启动验证，这里有四个表单
      let formNameList = ["listData1", "listData2"];
      var result = true;
      for (let index = 0; index < formNameList.length; index++) {
        await this.$refs[formNameList[index]].validate((e) => {
          result = e;
        });
        if (!result) {
          break;
        }
      }
      if (!result) {
        this.$message.error("请填写必填信息");
        return;
      } else {
        if (
          this.listData.coverUrl === "" ||
          this.listData.coverUrl === null ||
          this.listData.coverUrl === undefined
        ) {
          this.$message.error("请上传节封面");
          return false;
        }
        //保存表单
        this.rulesTableSumbit(int);
      }
    },
    rulesTableSumbit(int) {
      var datas = JSON.parse(JSON.stringify(this.listData));
      if (int === 2) {
        datas.goodsStatus = 1;
      }
      this.courTypeOptions.map((item) => {
        if (item.id === this.listData.businessId) {
          datas.projectId = item.projectId;
        }
      });
      datas.status = 1;
      datas.certificateIds = this.listData.certificateIds.toString();
      datas.validityStartTime = this.$methodsTools.time10to13(
        this.listData.timeArrays[0],
        1
      );
      datas.validityEndTime = this.$methodsTools.time10to13(
        this.listData.timeArrays[1],
        1
      );
      datas.standPriceJson = JSON.stringify(this.listData.standPriceJson);
      datas.standPrice = Number(this.listData.standPrice);
      datas.lowestPrice = Number(this.listData.lowestPrice);
      datas.lowestPrice = Number(this.listData.year);
      delete datas.timeArrays;
      if (this.listData.goodsType === 1) {
        var courseIdList = [];
        this.tableData.map((item) => {
          courseIdList.push({
            courseId: item.courseId,
            sort: Number(item.sort),
          });
        });
        var auditionListArray = [];
        this.auditionList.map((item) => {
          if (item.type == 3) {
            auditionListArray.push({
              auditionMinute: item.auditionMinute,
              courseId: item.courseId,
              sectionId: item.menuId,
            });
          }
        });
        datas.auditionList = auditionListArray;
        datas.courseList = courseIdList;
        if(!this.listData.handoutsId){
          datas.handoutsId = 0
        }
        this.$api.addGoods(datas).then((res) => {
          this.$message.success("新增成功");
          setTimeout(() => {
            this.$router.go(-1);
          }, 300);
        });
      } else if (this.listData.goodsType === 2) {
        var courseIdList = [];
        this.tableData2.map((item) => {
          if (item.type === 1) {
            courseIdList.push({
              majorId: item.moduleExamId,
              sort: Number(item.sort),
              type: item.type,
            });
          }
          if (item.type === 2) {
            courseIdList.push({
              majorId: item.chapterExamId,
              sort: Number(item.sort),
              type: item.type,
            });
          }
          if (item.type === 3) {
            courseIdList.push({
              majorId: item.examId,
              sort: Number(item.sort),
              type: item.type,
            });
          }
        });
        datas.bankList = courseIdList;
        var examConfigListArray = [];
        this.examConfigList.map((item) => {
          examConfigListArray.push({
            num: item.num,
            chapterExamId: item.chapterExamId,
            examId: item.examId,
            moduleExamId: item.moduleExamId,
          });
        });
        datas.examConfigList = examConfigListArray;
        this.$api.addGoodsbank(datas).then((res) => {
          this.$message.success("新增成功");
          setTimeout(() => {
            this.$router.go(-1);
          }, 300);
        });
      } else {
        this.$message.warning("当前商品类型正在开发中...");
      }
    },
    backPage() {
      this.$router.go(-1);
    },
    openBoxs(int, item) {
      if (int === 1) {
        this.listitemData = {};
      } else {
        this.NUMBerS = this.listData.standPriceJson.indexOf(item);
        this.listitemData = JSON.parse(JSON.stringify(item));
      }
      this.statusBox = int;
      this.dialogVisible = true;
      this.$nextTick(() => {
        this.$refs.listitemData.clearValidate();
      });
    },
    submitForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.rulesTable();
        } else {
          return false;
        }
      });
    },
    rulesTable() {
      if (this.statusBox === 2) {
        this.$set(
          this.listData.standPriceJson,
          this.NUMBerS,
          this.listitemData
        );
        // this.listData.standPriceJson[this.NUMBerS] = this.listitemData;
      } else {
        this.listitem[0].options.map((i, k) => {
          if (i.costId === Number(this.listitemData.priceTypeId)) {
            this.listitemData.priceTypeName = i.costName;
          }
        });
        this.listData.standPriceJson.push(this.listitemData);
      }
      this.dialogVisible = false;
    },
    delList(item) {
      this.listData.standPriceJson.splice(
        this.listData.standPriceJson.indexOf(item),
        1
      );
    },
    checkListName(id) {
      var a = "";
      this.certificateOption.map((item, index) => {
        if (item.id === id) {
          a = item.certificateName;
        }
      });
      return a;
    },
    clearBtns(id) {
      this.listData.certificateIds.map((item, index) => {
        if (item === id) {
          this.listData.certificateIds.splice(index, 1);
        }
      });
    },
    //视频商品表格函数START
    getInfos() {
      this.$api
        .inquireCourseListS({
          status: 1,
          pageNum: this.currentPage,
          pageSize: this.pageSize,
        })
        .then((res) => {
          this.boxtableData = res.rows;
          this.total = res.total;
        });
    },
    editAddBoxs() {
      var self = this;
      this.$api
        .inquireCourseListS({
          status: 1,
          pageNum: this.currentPage,
          pageSize: this.pageSize,
        })
        .then((res) => {
          var aList = [];
          this.tableData.map((item) => {
            aList.push(item.courseId);
          });
          this.disCheckList = aList;
          this.boxtableData = res.rows;
          this.total = res.total;
          this.dialogVisibleTableBoxs = true;
          this.$nextTick(function () {
            self.$refs.multipleTable.clearSelection();
          });
        });
    },
    submitTab() {
      if (this.activeLists.length === 0) {
        this.dialogVisibleTableBoxs = false;
        return;
      }
      this.tableData = this.tableData.concat(this.activeLists);

      // if (this.$refs.poppleSet.$refs.trees) {
      //   console.log(this.$refs.poppleSet.$refs.trees);
      //   this.activeLists.map((item) => {
      //     item.TypeId = "0" + "-" + item.courseId;
      //     item.disabled = true;
      //     item.hasChildren = true;
      //   });
      //   for (let i = 0; i < this.activeLists.length; i++) {
      //     this.$refs.poppleSet.$refs.trees.insertAfter(
      //       this.activeLists[i],
      //       this.$refs.poppleSet.$refs.trees.root.childNodes[
      //         this.$refs.poppleSet.$refs.trees.root.childNodes.length - 1
      //       ]
      //     );
      //   }
      // }
      this.dialogVisibleTableBoxs = false;
      this.$message.success("添加成功");
      this.activeLists = [];
    },
    del(item, index) {
      this.tableData.splice(index, 1);
      // if (this.$refs.poppleSet.$refs.trees) {
      //   this.$refs.poppleSet.$refs.trees.remove(
      //     this.$refs.poppleSet.$refs.trees.root.childNodes[index]
      //   );
      // }
      // this.auditionList = this.auditionList.filter((items) => {
      //   return items.courseId !== item.courseId;
      // });
      this.$message.success("删除成功");
    },
    selectAll(value) {
      this.activeLists = value;
    },
    select(value) {
      this.activeLists = value;
    },
    checkboxT(row, index) {
      if (this.disCheckList.indexOf(row.courseId) !== -1) {
        return false;
      } else {
        return true;
      }
    },
    getRowKeys(row) {
      return row.courseId;
    },
    handleSizeChange(v) {
      this.pageSize = v;
      this.currentPage = 1;
      this.getInfos();
    },
    handleCurrentChange(v) {
      this.currentPage = v;
      this.getInfos();
    },
    //视频商品表格函数END
    //题库商品表格函数START
    getInfos2() {
      this.$api
        .inquireCourseListS({
          status: 1,
          pageNum: this.currentPage2,
          pageSize: this.pageSize2,
        })
        .then((res) => {
          this.boxtableData = res.rows;
          this.total = res.total;
        });
    },
    changeOptionsType2() {
      this.editAddBoxs2();
    },
    editAddBoxs2(int) {
      var self = this;
      if (self.optionsNums === 1) {
        self.$api
          .inquireBankModule({
            status: 1,
            pageNum: self.currentPage2,
            pageSize: self.pageSize2,
          })
          .then((res) => {
            var aList = [];
            self.tableData2.map((item) => {
              if (item.type === 1) {
                aList.push(item.moduleExamId);
              }
            });
            res.rows.forEach((item) => {
              item.ids = 1 + "-" + item.moduleExamId;
              item.type = 1;
              item.name = item.moduleName;
              item.sort = 0;
            });
            self.disCheckList2.moduleCheck = aList;
            self.boxtableData2 = res.rows;
            self.total2 = res.total;
            self.dialogVisibleTableBoxs2 = true;
            if (int === 1) {
              self.$nextTick(function () {
                self.$refs.multipleTable2.clearSelection();
              });
            }
          });
      }
      if (self.optionsNums === 2) {
        self.$api
          .inquirebankchapterList({
            status: 1,
            pageNum: self.currentPage2,
            pageSize: self.pageSize2,
          })
          .then((res) => {
            var aList = [];
            self.tableData2.map((item) => {
              if (item.type === 2) {
                aList.push(item.chapterExamId);
              }
            });
            res.rows.forEach((item) => {
              item.ids = 2 + "-" + item.chapterExamId;
              item.sort = 0;
              item.type = 2;
            });
            self.disCheckList2.chapterCheck = aList;
            self.boxtableData2 = res.rows;
            self.total2 = res.total;
            self.dialogVisibleTableBoxs2 = true;
            if (int === 1) {
              self.$nextTick(function () {
                self.$refs.multipleTable2.clearSelection();
              });
            }
          });
      }
      if (self.optionsNums === 3) {
        self.$api
          .inquirebankexamList({
            status: 1,
            pageNum: self.currentPage2,
            pageSize: self.pageSize2,
          })
          .then((res) => {
            var aList = [];
            self.tableData2.map((item) => {
              if (item.type === 3) {
                aList.push(item.examId);
              }
            });
            res.rows.forEach((item) => {
              item.ids = 3 + "-" + item.examId;
              item.sort = 0;
              item.type = 3;
              item.name = item.examName;
            });
            self.disCheckList2.examCheck = aList;
            self.boxtableData2 = res.rows;
            self.total2 = res.total;
            self.dialogVisibleTableBoxs2 = true;
            if (int === 1) {
              self.$nextTick(function () {
                self.$refs.multipleTable2.clearSelection();
              });
            }
          });
      }
    },
    submitTab2() {
      if (
        this.activeLists2.moduleCheck.length === 0 &&
        this.activeLists2.chapterCheck.length === 0 &&
        this.activeLists2.examCheck.length === 0
      ) {
        this.dialogVisibleTableBoxs2 = false;
        return;
      }
      if (this.activeLists2.moduleCheck.length) {
        this.tableData2 = this.tableData2.concat(this.activeLists2.moduleCheck);
      }
      if (this.activeLists2.chapterCheck.length) {
        this.tableData2 = this.tableData2.concat(
          this.activeLists2.chapterCheck
        );
      }
      if (this.activeLists2.examCheck.length) {
        this.tableData2 = this.tableData2.concat(this.activeLists2.examCheck);
      }
      this.dialogVisibleTableBoxs2 = false;
      this.$message.success("添加成功");
      this.activeLists2 = {
        moduleCheck: [],
        chapterCheck: [],
        examCheck: [],
      };
      console.log(this.tableData2);
    },
    del2(item, index) {
      this.tableData2.splice(index, 1);
      this.$message.success("删除成功");
    },
    selectAll2(value) {
      var lis = {
        moduleCheck: [],
        chapterCheck: [],
        examCheck: [],
      };
      value.map((item) => {
        if (item.type === 1) {
          lis.moduleCheck.push(item);
        }
        if (item.type === 2) {
          lis.chapterCheck.push(item);
        }
        if (item.type === 3) {
          lis.examCheck.push(item);
        }
      });
      this.activeLists2 = lis;
    },
    select2(value) {
      var lis = {
        moduleCheck: [],
        chapterCheck: [],
        examCheck: [],
      };
      value.map((item) => {
        if (item.type === 1) {
          lis.moduleCheck.push(item);
        }
        if (item.type === 2) {
          lis.chapterCheck.push(item);
        }
        if (item.type === 3) {
          lis.examCheck.push(item);
        }
      });
      this.activeLists2 = lis;
    },
    checkboxT2(row, index) {
      if (this.optionsNums === 1) {
        if (this.disCheckList2.moduleCheck.indexOf(row.moduleExamId) !== -1) {
          return false;
        } else {
          return true;
        }
      }
      if (this.optionsNums === 2) {
        if (this.disCheckList2.chapterCheck.indexOf(row.chapterExamId) !== -1) {
          return false;
        } else {
          return true;
        }
      }
      if (this.optionsNums === 3) {
        if (this.disCheckList2.examCheck.indexOf(row.examId) !== -1) {
          return false;
        } else {
          return true;
        }
      }
    },
    getRowKeys2(row) {
      return row.ids;
    },
    handleSizeChange2(v) {
      this.pageSize = v;
      this.currentPage = 1;
      this.getInfos2();
    },
    handleCurrentChange2(v) {
      this.currentPage = v;
      this.getInfos2();
    },
    //题库商品表格函数END
  },
};
</script>

<style lang="less" scoped>
.boxsSTTs {
  margin: 10px 0px;
  border: 1px solid #a4a4a4;
  border-top: 2px solid rgb(179, 204, 255);
  padding: 20px 40px;
}
.fengs {
  border-bottom: 1px dashed #a4a4a4;
  color: #a4a4a4;
  padding: 4px 0px;
  margin-bottom: 20px;
}
.imgBoxins {
  width: 375px;
  height: 220px;
  text-align: center;
  img {
    height: 100%;
  }
}
.iconStsz {
  font-size: 40px;
  color: #67c23a;
  cursor: pointer;
}
.numInputs {
  width: 220px;
}
/deep/ .el-date-editor .el-range-separator {
  width: 7%;
}
.courseStyle {
  margin-top: 20px;
  margin-bottom: 10px;
  font-size: 14px;
  border-bottom: 2px solid rgb(179, 204, 255);
}
.clickSpan {
  color: blue;
  cursor: pointer;
}
.boxlefs {
  font-size: 14px;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid #a4a4a4;
  float: left;
  margin: 5px 10px;
  height: 30px;
  line-height: 30px;
  padding: 0px 10px;
  padding-right: 5px;
  margin: 5px 10px;
}
.dis_fs {
  display: flex;
  align-items: center;
}
</style>
