From 55cc4c8bbbd66ce4b33fff8712d4c53e2080b5a0 Mon Sep 17 00:00:00 2001 From: zhouwx <1175765986@qq.com> Date: 星期一, 22 七月 2024 16:25:25 +0800 Subject: [PATCH] 提交 --- src/views/onlineEducation/courseManage/index.vue | 117 +++++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 86 insertions(+), 31 deletions(-) diff --git a/src/views/onlineEducation/courseManage/index.vue b/src/views/onlineEducation/courseManage/index.vue index b87d702..67c8f8e 100644 --- a/src/views/onlineEducation/courseManage/index.vue +++ b/src/views/onlineEducation/courseManage/index.vue @@ -1,17 +1,35 @@ <template> <div class="app-container"> - <div style="margin-bottom: 10px"> - <el-button - type="primary" - plain - icon="Plus" - @click="openDialog('add',{})" - >新增</el-button> + <div style="display: flex;justify-content: space-between"> + <el-form :inline="true" style="display: flex;align-items: center;flex-wrap: wrap;" > + <el-form-item> + <el-button + type="primary" + plain + icon="Plus" + @click="openDialog('add',{})" + >新增</el-button> + </el-form-item> + <el-form-item label="课程名称:" > + <el-input v-model="data.queryParams.name" placeholder="请输入课程名称"></el-input> + </el-form-item> + <el-form-item > + <el-button + type="primary" + @click="getList" + >查询</el-button> + <el-button + type="primary" + plain + @click="reset" + >重置</el-button> + </el-form-item> + </el-form> </div> <!-- 表格数据 --> <el-table v-loading="loading" :data="dataList" :border="true"> <el-table-column label="序号" type="index" align="center" width="80" /> - <el-table-column label="封面" prop="logo" align="center" > + <el-table-column label="封面" prop="logo" align="center" width="130"> <template #default="scope"> <div class="demo-image__preview" v-if="scope.row.logo && scope.row.logo.length>0"> <el-image @@ -30,11 +48,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 +80,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="data.isAdmin"> + <div v-if="scope.row.state !== 3"> + <el-button link type="primary" v-if="scope.row.state == 1" @click="openApprove(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 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" v-if="scope.row.state !== 1" @click="openDialog('edit',scope.row)" >编辑</el-button> + <el-button link type="primary" v-if="scope.row.state !== 1" @click="toChapters(scope.row)">章节</el-button> + <el-button link type="danger" v-if="scope.row.state !== 1" @click="handleDelete(scope.row)">删除</el-button> </div> + <div v-else>--</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">--</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> @@ -127,6 +169,7 @@ queryParams: { pageNum: 1, pageSize: 10, + name: '' }, total: 0, dataList: [], @@ -179,7 +222,12 @@ /** 重置新增的表单以及其他数据 */ function reset() { - proxy.resetForm("roleRef"); + data.queryParams = { + pageNum: 1, + pageSize: 10, + name: '' + } + getList() } const handleDelete = (val) => { ElMessageBox.confirm( @@ -244,13 +292,20 @@ } } const submitApprove = async (val) => { - const param = { + let param = { + companyId: val.companyId, 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) -- Gitblit v1.9.2