<!--组卷-->
<style>
  .examCreat_Top {
    width: 100%;
    height: 40px;
    line-height: 35px;
    padding: 0 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 20px;
  }

  .examTi_List {
    border: 1px solid #ddd;
    margin-bottom: 20px;
  }

  .examCreat_Top i {
    color: var(--q-color-negative);
    font-size: 20px;
  }

  .examCreat_Top i:hover {
    color: red;
    cursor: pointer;
  }

  .setpaperCreat {
    border: 1px dashed #E1E1E5;
    padding-top: 12px;
    border-radius: 4px;
    padding: 12px 4px 0 4px;
    margin: 20px 0 10px 60px;
  }

  .setpaperCreat span {
    display: inline-block;
    background: #F2F5FA;
    padding: 0 10px;
    height: 26px;
    line-height: 26px;
    border-radius: 14px;
    color: #181E33;
    margin-left: 10px;
    margin-bottom: 12px;
    font-size: 12px;
  }

  .paperCreate .EmpLine_title {
    display: flex;
    align-items: center;
    font-size: 12px;
    margin-bottom: 20px;
  }

  .paperCreate .Emp_Line {
    width: 3px;
    height: 10px;
    background-color: #3FC4FF;
    margin-right: 10px;
  }

</style>
<template>
  <div class="page-body paperCreate">
    <div style="display:flex;justify-content:space-between;">
      <div>
        组卷题库
        <q-btn color="accent" size="sm" @click="showQuestionBank" class="q-mr-md" label="选择题库"  />
      </div>
      <div>
        <q-btn color="accent" size="sm" @click="showExamTemplate" label="选择模板" />
      </div>
    </div>
    <div class="setpaperCreat" v-if="QuestionArray.length>0">
      <span v-for="(item,index) in QuestionArray" :key="index">{{item.BankName}}</span>
    </div>
    <br />
    <div class="EmpLine_title">
      <div class="Emp_Line"></div>
      <div>基本信息</div>
    </div>
    <div class="row">
      <q-input filled stack-label maxlength="100" :dense="false" v-model="templateMsg.TemplateName"
        class="col-6 q-pb-lg q-pr-lg" label="试卷标题" />
      <q-input filled stack-label maxlength="5" @keyup.native="checkInteger(templateMsg,'TemplateScore')" :dense="false"
        v-model="templateMsg.TemplateScore" class="col-6 q-pb-lg" label="满分" />
    </div>
    <div class="row">
      <q-input filled stack-label maxlength="5" :dense="false" ref="TemplateNum" v-model="templateMsg.TemplateNum"
        class="col-6 q-pb-lg q-pr-lg" label="随机组卷数量" @keyup.native="checkInteger(templateMsg,'TemplateNum')" />
      <q-select filled option-value="Id" option-label="Name" :options="questionDifficultyTypeList" emit-value
        map-options label="难易程度" class="col-6" use-input clearable v-model="templateMsg.TemplateDifficultyType" />
    </div>
    <div class="EmpLine_title">
      <div class="Emp_Line"></div>
      <div>试卷配置</div>
      <q-radio v-model="templateMsg.GroupType" :val="1" label="问题类型" @input="getQuestionTypeStaticList" />
      <q-radio v-model="templateMsg.GroupType" :val="2" label="题目大类" @input="getQuestionCategoryStaticList" />
    </div>
    <template v-if="templateMsg.GroupType==1">
      <!-- 分割线<br /> -->
      <template v-if="templateMsg&&templateMsg.TemplateData&&templateMsg.TemplateData.length>0">
        <div v-for="(item,index) in templateMsg.TemplateData" :key="index" class="examTi_List">
          <div class="examCreat_Top">
            <div>{{item.QuestionTypeName}}</div>
            <div><i @click="delQuestion(templateMsg.TemplateData,index)" class="iconfont icon-img_delete_small"></i>
            </div>
          </div>
          <div style="padding:0 20px 10px 20px;">
            <div class="row">
              <q-input filled stack-label maxlength="5" :dense="false" v-model="item.QuestionScore"
                class="col-6 q-pb-lg q-pr-lg" label="总分" @keyup.native="checkInteger(item,'QuestionScore')" />
              <q-input filled stack-label maxlength="100" :dense="false" v-model="item.QuestionDesc"
                class="col-6 q-pb-lg" label="题干信息" />
            </div>
            <span>
              <q-radio v-model="item.ChooseType" :val="1" label="从题库选题" />
              <template v-if="item.ChooseType==1">
                <span style="position:relative;top:2px;">共 {{item.QuestionTypeNum}} 道 抽
                  <el-input style="width:100px;" size="small"
                    :disabled="templateMsg.TemplateBankIds!=''&&item.QuestionTypeNum<=0" @input="getMaxInput(item)"
                    v-model="item.ChooseNum" @keyup.native="checkInteger(item,'ChooseNum')" maxlength="5"></el-input>
                  &nbsp;&nbsp;道</span>
              </template>
            </span>
            <br />
            <span>
              <q-radio v-model="item.ChooseType" :val="2" label="从题库按照难易度选题" />
              <template v-if="item.ChooseType==2">
                <div style="margin:0 0 20px 40px;" v-for="(subItem,subIndex) in item.ChooseList" :key="subIndex">
                  {{subItem.DifficultyTypeName}} （共
                  {{subItem.DifficultyTypeCount}} 道） 抽
                  <el-input style="width:100px;" size="small"
                    :disabled="templateMsg.TemplateBankIds!=''&&subItem.DifficultyTypeCount<=0"
                    @input="getMaxMiniInput(subItem)" @keyup.native="checkInteger(subItem,'ChooseNum')"
                    v-model="subItem.ChooseNum" maxlength="5"></el-input>
                  &nbsp;&nbsp;道
                </div>
              </template>
            </span>
          </div>
        </div>
      </template>
      <div class="row">
        <div class="col-6">
          <q-btn-dropdown color="primary" label="添加题型">
            <q-list>
              <q-item clickable v-close-popup @click="onItemClick(item)" v-for="(item,index) in newQuestionTypeList"
                :key="index">
                <q-item-section>
                  <q-item-label>{{item.Name}}</q-item-label>
                </q-item-section>
              </q-item>
            </q-list>
          </q-btn-dropdown>
        </div>
      </div>
    </template>
    <template v-if="templateMsg.GroupType==2">
      <!-- 分割线<br /> -->
      <template v-if="templateMsg&&templateMsg.TemplateData&&templateMsg.TemplateData.length>0">
        <div v-for="(item,index) in templateMsg.TemplateData" :key="index" class="examTi_List">
          <div class="examCreat_Top">
            <div>{{item.QuestionTypeName}}</div>
            <div><i @click="delQuestion(templateMsg.TemplateData,index)" class="iconfont icon-img_delete_small"></i>
            </div>
          </div>
          <div style="padding:0 20px 10px 20px;">
            <div class="row">
              <q-input filled stack-label maxlength="5" :dense="false" v-model="item.QuestionScore"
                class="col-6 q-pb-lg q-pr-lg" label="总分" @keyup.native="checkInteger(item,'QuestionScore')" />
              <q-input filled stack-label maxlength="100" :dense="false" v-model="item.QuestionDesc"
                class="col-6 q-pb-lg" label="题干信息" />
            </div>
            <span>
              <q-radio v-model="item.ChooseType" :val="1" label="从题库选题" />
              <template v-if="item.ChooseType==1">
                <span style="position:relative;top:2px;">共 {{item.QuestionTypeNum}} 道 抽
                  <el-input style="width:100px;" size="small"
                    :disabled="templateMsg.TemplateBankIds!=''&&item.QuestionTypeNum<=0" @input="getMaxInput(item)"
                    v-model="item.ChooseNum" @keyup.native="checkInteger(item,'ChooseNum')" maxlength="5"></el-input>
                  &nbsp;&nbsp;道</span>
              </template>
            </span>
            <br />
            <span>
              <q-radio v-model="item.ChooseType" :val="2" label="从题库按照难易度选题" />
              <template v-if="item.ChooseType==2">
                <div style="margin:0 0 20px 40px;" v-for="(subItem,subIndex) in item.ChooseList" :key="subIndex">
                  {{subItem.DifficultyTypeName}} （共
                  {{subItem.DifficultyTypeCount}} 道） 抽
                  <el-input style="width:100px;" size="small"
                    :disabled="templateMsg.TemplateBankIds!=''&&subItem.DifficultyTypeCount<=0"
                    @input="getMaxMiniInput(subItem)" @keyup.native="checkInteger(subItem,'ChooseNum')"
                    v-model="subItem.ChooseNum" maxlength="5"></el-input>
                  &nbsp;&nbsp;道
                </div>
              </template>
            </span>
          </div>
        </div>
      </template>
      <div class="row">
        <div class="col-6">
          <q-btn-dropdown color="primary" label="添加分类">
            <q-list>
              <q-item clickable v-close-popup @click="onCategoryItemClick(item)"
                v-for="(item,index) in newQuestionCategoryList" :key="index">
                <q-item-section>
                  <q-item-label>{{item.QuestionTypeName}}</q-item-label>
                </q-item-section>
              </q-item>
            </q-list>
          </q-btn-dropdown>
        </div>
      </div>
    </template>

    <div class="row q-mt-lg">
      <div class="col-6">
        <span>开放状态</span>
        <q-radio v-model="templateMsg.IsOpen" :val="1" label="私有" />
        <q-radio v-model="templateMsg.IsOpen" :val="2" label="公开" />
      </div>
      <div class="col-6">
        <q-checkbox v-model="templateMsg.IsSaveTemplate" label="同时保存为组卷模板" />
      </div>
    </div>
    <br />
    <div class="row">
      <q-btn color="accent" @click="setPaperTemplate" class="q-mr-md" label="保存" :loading="saveLoading" />
    </div>
    <questionbankForm v-if="isShowQuestionBank"  @close="closeExamForm" :CheckedArray="QuestionArray"
       @success="getBankData">
    </questionbankForm>
    <examtemplateForm v-if="isShowExamTemplate"  @close="closeExamForm"  @success="getTemplateData">
    </examtemplateForm>
  </div>
</template>
<script>
  import questionbankForm from '../../components/exam/questionbank-form'
  import examtemplateForm from '../../components/exam/examtemplate-form'
  import {
    queryQuestionTypeList,
    queryDifficultyType,
    queryQuestionTypeStaticList,
    queryQuestionCategoryStaticList
  } from '../../api/question/question'
  import {
    savePaperInfo,
    savePaperTemplate
  } from '../../api/teacher/index';
  import {
    date
  } from "quasar";
  export default {
    components: {
      questionbankForm,
      examtemplateForm
    },
    meta: {
      title: "组卷"
    },
    data() {
      return {
        isShowQuestionBank: false, //是否显示题库列表
        isShowExamTemplate: false, //是否显示模板列表
        questionDifficultyTypeList: [], //难易程度列表
        //模板数据
        templateMsg: {
          GroupType: 1, //类型(1-题目类型，2-题目大分类)'
          TemplateId: 0, //模板编号
          TemplateName: "", //模板名称
          TemplateScore: 100, //模板分数
          TemplateNum: 1, //随机组卷数量
          TemplateDifficultyType: 1, //难易程度
          TemplateData: [],
          TemplateBankIds: "",
          IsSaveTemplate: false,
          ParentId: 0,
          IsOpen: 1 //(1-私有,2-开放)
        },
        ShowBankName: "", //显示题库名称
        BankList: [],
        questionTypeList: [], //问题列表
        quastionCategory: [], //问题大类
        saveLoading: false,
        QuestionArray: [],
      }
    },
    computed: {
      //获取计算后的问题类型(单选题、多选他)
      newQuestionTypeList() {
        let newArray = JSON.parse(JSON.stringify(this.questionTypeList));
        if (newArray && newArray.length > 0) {
          if (this.templateMsg.TemplateData && this.templateMsg.TemplateData.length > 0) {
            this.templateMsg.TemplateData.forEach(x => {
              newArray.forEach((qItem, index) => {
                if (x.QuestionTypeId == qItem.QId) {
                  newArray.splice(index, 1);
                }
              })
            })
          }
        }
        return newArray;
      },
      //获取计算后的问题分类(读音选择题、汉字选择题等)
      newQuestionCategoryList() {
        let newArray = JSON.parse(JSON.stringify(this.quastionCategory));
        if (newArray && newArray.length > 0) {
          if (this.templateMsg.TemplateData && this.templateMsg.TemplateData.length > 0) {
            this.templateMsg.TemplateData.forEach(x => {
              newArray.forEach((qItem, index) => {
                if (x.QuestionTypeId == qItem.QuestionTypeId) {
                  newArray.splice(index, 1);
                }
              })
            })
          }
        }
        return newArray;
      }
    },
    created() {
      if (this.$route.query && this.$route.query.ToParentId) {
        if (parseInt(this.$route.query.ToParentId) > 0) {
          this.templateMsg.ParentId = parseInt(this.$route.query.ToParentId);
        }
      }
      this.getQuestionType();
      this.getDifficultyType();
      //this.getQuestionCategoryStaticList();
      this.getQuestionTypeStaticList();
    },
    mounted() {
      var timeStr = date.formatDate(Date.now(), "YYYYMMDDHHmmss");
      this.templateMsg.TemplateName = timeStr + "新建试卷";
    },
    methods: {
      //设置题库最大值
      getMaxInput(item) {
        if (item.ChooseNum > item.QuestionTypeNum) {
          item.ChooseNum = item.QuestionTypeNum;
        }
      },
      //难易程度
      getMaxMiniInput(item) {
        if (item.ChooseNum > item.DifficultyTypeCount) {
          item.ChooseNum = item.DifficultyTypeCount;
        }
      },
      //获取题型列表
      getQuestionType() {
        queryQuestionTypeList({}).then(res => {
          if (res.Code == 1) {
            this.questionTypeList = res.Data;
          }
        });
      },
      //点击添加题型
      onItemClick(myObj) {
        //获取问题类型
        var qTypeObj = this.questionTypeList.find((item) => {
          return item.QId === myObj.QId;
        });
        var newObj = this.createdTempObj();
        if (qTypeObj) {
          newObj.QuestionTypeId = qTypeObj.QId;
          newObj.QuestionTypeKey = qTypeObj.Key;
          newObj.QuestionTypeName = qTypeObj.Name;
        }
        //获取题库中的题型
        var chooseQuestion = this.BankList.find((item) => {
          return item.QuestionTypeId === myObj.QId;
        });
        //题库中有此题型
        if (chooseQuestion) {
          newObj.QuestionTypeNum = chooseQuestion.QuestionTypeNum;
          newObj.ChooseList = chooseQuestion.ChooseList;
          newObj.CategoryList = chooseQuestion.CategoryList;
        }
        if (newObj && newObj.QuestionTypeId > 0) {
          if (!this.checkExists(newObj.QuestionTypeId)) {
            this.templateMsg.TemplateData.push(newObj);
          } else {
            this.$q.notify({
              type: 'negative',
              position: "top",
              message: `已存在此题型,请勿重复选择!`
            })
          }
        }
      },
      //添加分类
      onCategoryItemClick(myObj) {
        var newObj = this.createdTempObj();
        if (myObj) {
          newObj.QuestionTypeId = myObj.QuestionTypeId;
          newObj.QuestionTypeKey = myObj.QuestionTypeKey;
          newObj.QuestionTypeName = myObj.QuestionTypeName;
        }
        //获取题库中的题型
        var chooseQuestion = this.BankList.find((item) => {
          return item.QuestionTypeId === myObj.QuestionTypeId;
        });
        //题库中有此题型
        if (chooseQuestion) {
          newObj.QuestionTypeNum = chooseQuestion.QuestionTypeNum;
          newObj.ChooseList = chooseQuestion.ChooseList;
        }
        if (newObj && newObj.QuestionTypeId > 0) {
          if (!this.checkExists(newObj.QuestionTypeId)) {
            this.templateMsg.TemplateData.push(newObj);
          } else {
            this.$q.notify({
              type: 'negative',
              position: "top",
              message: `已存在此题型,请勿重复选择!`
            })
          }
        }
      },
      //创建模板对象
      createdTempObj() {
        var newObj = {
          ChooseNum: 0,
          ChooseType: 1, //1-题库选题，2-题库难易程度选题，3-分类选题，4-分类难易程度选题
          QuestionDesc: "",
          QuestionScore: 0,
          QuestionTypeId: 0,
          QuestionTypeKey: "",
          QuestionTypeName: "",
          QuestionTypeNum: 0,
          ChooseList: [{
              DifficultyType: 1,
              DifficultyTypeName: "易",
              DifficultyTypeCount: 0,
              ChooseNum: 0
            },
            {
              DifficultyType: 2,
              DifficultyTypeName: "中",
              DifficultyTypeCount: 0,
              ChooseNum: 0
            },
            {
              DifficultyType: 3,
              DifficultyTypeName: "难",
              DifficultyTypeCount: 0,
              ChooseNum: 0
            }
          ],
        }
        return newObj;
      },
      //判断是否存在此题型
      checkExists(QuestionTypeId) {
        var isExists = false;
        if (this.templateMsg && this.templateMsg.TemplateData && this.templateMsg.TemplateData.length > 0) {
          this.templateMsg.TemplateData.forEach(item => {
            if (!isExists) {
              if (item.QuestionTypeId == QuestionTypeId) {
                isExists = true;
              }
            }
          })
        }
        return isExists;
      },
      //获取题目(汉字选择题、读音选择题等)列表
      getQuestionCategoryStaticList() {
        var qMsg = {
          QBankIds: this.templateMsg.TemplateBankIds
        }
        this.BankList = [];
        this.templateMsg.TemplateData = [];
        queryQuestionCategoryStaticList(qMsg).then(res => {
          if (res.Code == 1) {
            var tempArray = res.Data;
            if (tempArray && tempArray.length > 0) {
              this.quastionCategory = tempArray;
              this.BankList = tempArray;
              tempArray.forEach(item => {
                //默认添加【单选题，多选题、填空题，单选题(数字)】
                if (item.QuestionTypeId == 1 || item.QuestionTypeKey == 2) {
                  this.templateMsg.TemplateData.push(item);
                }
              })
            }
          }
        });
      },
      //获取题库题目题型(单选题、多选题等)列表
      getQuestionTypeStaticList() {
        var qMsg = {
          QBankIds: this.templateMsg.TemplateBankIds
        }
        this.BankList = [];
        this.templateMsg.TemplateData = [];
        queryQuestionTypeStaticList(qMsg).then(res => {
          if (res.Code == 1) {
            var tempArray = res.Data;
            if (tempArray && tempArray.length > 0) {
              this.templateMsg.TemplateData = [];
              this.BankList = tempArray;
              tempArray.forEach(item => {
                //默认添加【单选题，多选题、填空题，单选题(数字)】
                if (item.QuestionTypeKey == 'single' || item.QuestionTypeKey == 'multiple' || item
                  .QuestionTypeKey == 'fill-in' || item.QuestionTypeKey == 'single-number') {
                  this.templateMsg.TemplateData.push(item);
                }
              })
            }
          }
        })
      },
      //获取问题难易程度列表
      getDifficultyType() {
        queryDifficultyType().then(res => {
          if (res.Code == 1) {
            this.questionDifficultyTypeList = res.Data;
          }
        });
      },
      //显示题库
      showQuestionBank() {
        this.isShowQuestionBank = true;
      },
      //显示试卷模板
      showExamTemplate() {
        this.isShowExamTemplate = true;
      },
      //关闭题库
      closeExamForm() {
        this.isShowQuestionBank = false;
        this.isShowExamTemplate = false;
      },
      //获取选择的题库
      getBankData(bankArray) {
        this.QuestionArray = bankArray;
        this.isShowQuestionBank = false;
        var qBankIds = "";
        var sBankName = "";
        if (bankArray && bankArray.length > 0) {
          bankArray.forEach(item => {
            qBankIds += "," + item.BankId;
            sBankName += "," + item.BankName;
          });
        }
        if (qBankIds.substr(0, 1) == ',') {
          qBankIds = qBankIds.substr(1);
        }
        if (sBankName.substr(0, 1) == ',') {
          sBankName = sBankName.substr(1);
        }
        this.templateMsg.TemplateBankIds = qBankIds;
        this.ShowBankName = sBankName;
      },
      //获取模板数据
      getTemplateData(tempObj) {
        if (tempObj) {
          this.templateMsg.TemplateId = tempObj.TemplateId;
          this.templateMsg.TemplateName = tempObj.TemplateName;
          this.templateMsg.TemplateNum = tempObj.TemplateNum;
          this.templateMsg.TemplateScore = tempObj.TemplateScore;
          this.templateMsg.TemplateDifficultyType = tempObj.TemplateDifficultyType;
          this.templateMsg.GroupType=tempObj.GroupType;
          this.templateMsg.TemplateData = [];
          var tempData = tempObj.TemplateData;
          if (tempData && tempData.length > 0) {
            tempData.forEach(item => {
              var newObj = this.createdTempObj();
              newObj.ChooseNum = item.ChooseNum;
              newObj.ChooseType = item.ChooseType;
              newObj.QuestionDesc = item.QuestionDesc;
              newObj.QuestionScore = item.QuestionScore;
              newObj.QuestionTypeId = item.QuestionTypeId;
              newObj.QuestionTypeKey = item.QuestionTypeKey;
              newObj.QuestionTypeName = item.QuestionTypeName;
              newObj.QuestionTypeNum = item.QuestionTypeNum;
              //获取题库中的题型
              var chooseQuestion = this.BankList.find((bItem) => {
                return bItem.QuestionTypeId === item.QuestionTypeId;
              });
              //题库中有此题型
              if (chooseQuestion) {
                newObj.QuestionTypeNum = chooseQuestion.QuestionTypeNum;
                newObj.ChooseList = chooseQuestion.ChooseList;
              }
              this.templateMsg.TemplateData.push(newObj);
            });
          }
        }
      },
      //根据模板生成试卷
      setPaperTemplate() {
        if (this.templateMsg.TemplateScore == '' || this.templateMsg.TemplateScore == 0) {
          this.$q.notify({
            type: 'negative',
            position: "top",
            message: `请填写试卷满分`
          })
          return
        }
        if (this.templateMsg.TemplateNum == '') {
          this.$q.notify({
            type: 'negative',
            position: "top",
            message: `请填写随机组卷数量`
          })
          return
        }
        let totalScore = 0;
        if (this.templateMsg && this.templateMsg.TemplateData && this.templateMsg.TemplateData.length > 0) {
          for (let i = 0; i < this.templateMsg.TemplateData.length; i++) {
            var currentItem = this.templateMsg.TemplateData[i];
            if (currentItem.QuestionScore == "" || currentItem.QuestionScore == 0) {
              this.$q.notify({
                type: 'negative',
                position: "top",
                message: `请填写第${i+1}题【${currentItem.QuestionTypeName}】总分`
              })
              return
            }
            //题库选题
            if (currentItem.ChooseType == 1) {
              if (currentItem.ChooseNum == '' || currentItem.ChooseNum == 0) {
                this.$q.notify({
                  type: 'negative',
                  position: "top",
                  message: `请填写第${i+1}题【${currentItem.QuestionTypeName}】的抽取题目数量`
                })
                return
              }
            }
            //题库难易程度选题 
            else if (currentItem.ChooseType == 2) {
              if (currentItem.ChooseList && currentItem.ChooseList.length > 0) {
                var tempChooseNum = 0;
                currentItem.ChooseList.forEach(sItem => {
                  tempChooseNum += sItem.ChooseNum
                });
                if (tempChooseNum <= 0) {
                  this.$q.notify({
                    type: 'negative',
                    position: "top",
                    message: `请填写第${i+1}题【${currentItem.QuestionTypeName}】（难易程度）抽取题目数量`
                  })
                  return
                }
              }
            }
            totalScore += parseInt(currentItem.QuestionScore);
          }
        }
        if (totalScore != this.templateMsg.TemplateScore) {
          this.$q.notify({
            type: 'negative',
            position: "top",
            message: `题目总分（${totalScore}）和试卷满分（${this.templateMsg.TemplateScore}）不相等`
          })
          return
        }
        this.saveLoading = true;
        savePaperTemplate(this.templateMsg).then(res => {
          this.saveLoading = false;
          if (res.Code == 1) {
            this.$q.notify({
              icon: 'iconfont icon-chenggong',
              color: 'accent',
              timeout: 2000,
              message: '创建试卷成功!',
              position: 'top'
            })
            this.$router.push({
              path: '/exam/examPaper',
              query: {}
            });
          } else {
            this.$q.notify({
              type: 'negative',
              position: "top",
              message: `操作失败!`
            })
          }
        });
      },
      //删除
      delQuestion(item, index) {
        this.$q.dialog({
          title: '提示信息',
          message: "是否确定删除?",
          cancel: true,
          persistent: true,
          ok: "确定",
          cancel: "取消",
        }).onOk(() => {
          item.splice(index, 1);
        }).onCancel(() => {});
      }
    }
  }

</script>
