zhouwx
2024-11-14 27be908067bc9ea1b91f581fb4e5ae118c168773
src/views/onlineEducation/classHourBatch/components/chooseStudent.vue
@@ -37,7 +37,7 @@
      <!-- 表格数据 -->
      <el-table
          ref="tableRef"
          v-loading="loading"
          v-loading="state.allLoading"
          :data="state.dataList"
          :border="true"
          :row-key="getRowKey"
@@ -76,7 +76,8 @@
      <template #footer>
        <span class="dialog-footer">
            <el-button @click="handleClose" size="default">取 消</el-button>
            <el-button type="primary"  @click="onSubmit" size="default" v-preReClick>确认</el-button>
           <el-button type="primary" v-if="state.allLoading && state.DisableSelection " disabled>全选加载中</el-button>
          <el-button type="primary" v-else @click="onSubmit" size="default" v-preReClick>确认</el-button>
        </span>
      </template>
    </el-dialog>
@@ -115,7 +116,8 @@
  companyId: null,
  selectRowKeys: [],
  DisableSelection:false,
  allStuList: []
  allStuList: [],
  allLoading: false
})
const loading = ref(false);
@@ -125,12 +127,12 @@
}
const openDialog = async (data) => {
  // state.selectRowKeys = [10,11]
  state.phaseId = data.queryParams.phaseId
  title.value = '学员选择';
  dialogVisible.value = true;
  await getList()
  await getAllStudent()
  await getList()
}
const getList = async () => {
@@ -155,6 +157,7 @@
}
const onSubmit = async () => {
  console.log('state.chooseStu',state.chooseStu)
    const res = await batchAddStudent(state.chooseStu)
    if(res.code === 200){
      ElMessage({
@@ -182,6 +185,7 @@
    companyName: '',
    companyId: null
  }
  tableRef.value.clearSelection();
  state.dataList = []
  state.allStuList = []
@@ -226,7 +230,6 @@
  }
  getList()
  getAllStudent()
}
const selectable = (row,rowIndex) => {
  if(state.DisableSelection){
@@ -260,13 +263,14 @@
  }
}
const getAllStudent = async () => {
  state.allLoading = true
  const res = await getStudentAll()
  if(res.code == 200){
    state.allStuList = res.data
    state.allLoading = false
  }else{
    ElMessage.warning(res.message)
  }
}
defineExpose({