zhouwx
2024-07-17 246f7b6fd81cf2ba620b8f9bf7cf24b61d7cf521
src/views/onlineEducation/courseManage/index.vue
@@ -30,11 +30,15 @@
      </el-table-column>
      <el-table-column label="课程名称" prop="name" align="center"  />
      <el-table-column label="课程分类" prop="categoryName" align="center" />
      <el-table-column label="要求课时" prop="period" align="center" />
      <el-table-column label="要求课时" prop="period" align="center" >
        <template #default="scope">
          <span>{{ scope.row.period?(scope.row.period/60).toFixed(2).replace(/\.00$/, '') + '分钟':'' }}</span>
        </template>
      </el-table-column>
      <el-table-column label="提交单位" prop="companyName" align="center" />
      <el-table-column label="审核状态" prop="state" align="center" >
        <template #default="scope">
          <span>{{scope.row.state == 1?'待审核':scope.row.state == 2?'审批通过':'审批不通过'}}</span>
          <span>{{scope.row.state == 0?'待提交':scope.row.state == 1?'待审核':scope.row.state == 2?'审批通过':'审批不通过'}}</span>
        </template>
      </el-table-column>
      <el-table-column label="创建时间" prop="createTime" align="center" width="180" />
@@ -58,31 +62,51 @@
          <span v-else>--</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180">
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="240">
        <template #default="scope">
          <div v-if="scope.row.state == 2">
            <div v-if="data.isAdmin">
            <div v-if="scope.row.state !== 3">
              <el-button link type="primary" @click="openDialog('edit',scope.row)">编辑</el-button>
              <el-button link type="primary" v-if="scope.row.state == 1" @click="openApprove(scope.row)">审核</el-button>
              <el-button link type="primary" @click="toChapters(scope.row)">章节</el-button>
              <el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>
            </div>
            <div v-else>--</div>
          </div>
          <div v-else-if="!data.isAdmin">
            <div v-if="scope.row.state !== 2">
              <el-button link type="primary" v-if="scope.row.state == 0 || scope.row.state == 3" @click="submitApprove(scope.row)">提交审核</el-button>
              <el-button link type="primary" v-if="scope.row.state == 1" @click="submitApprove(scope.row)">取消审批</el-button>
              <el-button link type="primary" @click="openDialog('edit',scope.row)">编辑</el-button>
              <el-button link type="primary" @click="toChapters(scope.row)">章节</el-button>
              <el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>
            </div>
            <div v-else><el-button link type="primary" @click="toChapters(scope.row)">章节</el-button></div>
            <div v-else>--</div>
          </div>
          <div v-else-if="scope.row.state == 1" >
              <el-button link type="primary" @click="openDialog('edit',scope.row)">编辑</el-button>
              <el-button link type="primary" v-if="data.isAdmin" @click="openApprove(scope.row)">审核</el-button>
            <el-button link type="primary" @click="toChapters(scope.row)">章节</el-button>
              <el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>
          </div>
          <div v-else-if="scope.row.state == 3" >
            <div v-if="data.isAdmin">--</div>
            <div v-else>
              <el-button link type="primary" @click="openDialog('edit',scope.row)">编辑</el-button>
              <el-button link type="primary" @click="submitApprove(scope.row)">提交审核</el-button>
              <el-button link type="primary" @click="toChapters(scope.row)">章节</el-button>
              <el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>
            </div>
          </div>
<!--          <div v-if="scope.row.state == 2">-->
<!--            <div v-if="data.isAdmin">-->
<!--              <el-button link type="primary" @click="openDialog('edit',scope.row)">编辑</el-button>-->
<!--              <el-button link type="primary" @click="toChapters(scope.row)">章节</el-button>-->
<!--              <el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>-->
<!--            </div>-->
<!--            <div v-else><el-button link type="primary" @click="toChapters(scope.row)">章节</el-button></div>-->
<!--          </div>-->
<!--          <div v-else-if="scope.row.state == 1" >-->
<!--              <el-button link type="primary" @click="openDialog('edit',scope.row)">编辑</el-button>-->
<!--              <el-button link type="primary" v-if="data.isAdmin" @click="openApprove(scope.row)">审核</el-button>-->
<!--            <el-button link type="primary" @click="toChapters(scope.row)">章节</el-button>-->
<!--              <el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>-->
<!--          </div>-->
<!--          <div v-else-if="scope.row.state == 3" >-->
<!--            <div v-if="data.isAdmin">&#45;&#45;</div>-->
<!--            <div v-else>-->
<!--              <el-button link type="primary" @click="openDialog('edit',scope.row)">编辑</el-button>-->
<!--              <el-button link type="primary" @click="submitApprove(scope.row)">提交审核</el-button>-->
<!--              <el-button link type="primary" @click="toChapters(scope.row)">章节</el-button>-->
<!--              <el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>-->
<!--            </div>-->
<!--          </div>-->
        </template>
      </el-table-column>
    </el-table>
@@ -244,13 +268,19 @@
  }
}
const submitApprove = async (val) => {
  const param = {
  let param = {
    id: val.id,
    state: 1
    state: null
  }
  //取消审批
  if(val.state == 1){
    param.state = 0
  }else {
    param.state = 1
  }
  const res = await doCourse(param)
  if(res.code == 200){
    ElMessage.success('提交成功')
    ElMessage.success('操作成功')
    await getList()
  }else{
    ElMessage.warning(res.message)