// 课程管理CRUDimport axios from'../axios.js'//获取分类信息const zx_basic ='http://localhost:9999/basic'//去后台,获取所有分类的三级树exportconstAllCategory=async()=>{
const res =await axios.get(zx_basic+"/category/getTree")return res
}//去后台,获取一级分类exportconstLevel1Category=async()=>{
const res =await axios.get(zx_basic+"/category/level1Category")return res
}//根据字典编号,获取字典信息exportconstGetDict=async(code)=>{
const res =await axios.get(zx_basic+"/dictionary/getDicItems/"+code)return res
}//去后台//获取所有机构信息const zx_system ='http://localhost:8888/system'exportconstGetCompany=async()=>{
const res =await axios.get(zx_system+"/company/selectAll")return res
}
5.4.4.7 修改course.vue
<template><el-cardshadow="always"><h3><el-icon><ElementPlus/></el-icon>课程管理</h3><el-rowstyle="padding:10px;"gutter="3"><el-colspan="8"><el-buttontype="primary"size="small"@click="toAdd"><el-icon><CirclePlus/></el-icon> 新增
</el-button><el-buttonv-if="multipleSelection.length"type="danger"size="small"@click="handlerMuchDel">删除多条</el-button></el-col><el-colspan="16"><el-inputsize="small"v-model="searchName"placeholder="按课程名称搜索"><template#append><el-icon><Search/></el-icon></template></el-input></el-col></el-row><el-table:data="filterData"@selection-change="handleSelectionChange"border><el-table-columnprop="id"type="selection"width="55"></el-table-column><el-table-columnprop="planNum"label="计划数量"heder-align="center"></el-table-column><el-table-columnprop="companyName"label="公司名称"heder-align="center"></el-table-column><el-table-columnprop="name"label="课程名称"heder-align="center"></el-table-column><el-table-columnprop="tags"label="课程标签"heder-align="center"></el-table-column><el-table-columnprop="mtName"label="大分类名称"heder-align="center"></el-table-column><el-table-columnprop="stName"label="小分类名称"heder-align="center"></el-table-column><el-table-columnprop="grade"label="课程等级"heder-align="center"></el-table-column><el-table-columnprop="teachmode"label="教学模式"heder-align="center"></el-table-column><el-table-columnprop="auditStatus"label="审核状态"heder-align="center"></el-table-column><el-table-columnprop="coursePubId"label="发布标识"heder-align="center"></el-table-column><el-table-columnprop="price"label="课程单价"heder-align="center"></el-table-column><el-table-columnprop="createDate"label="创建时间":formatter="formatDate"align="center"/><el-table-columnprop="auditDate"label="审核时间":formatter="formatDate"align="center"/><el-table-columnlabel="操作"align="center"><template#default="scope"><el-button@click="toEdit(scope.$index)"type="success"size="small"><el-icon><EditPen/></el-icon>修改</el-button><el-button@click="handleDel(scope.row.id)"type="danger"size="small"><el-icon><Delete/></el-icon>删除</el-button><el-button@click="handlePub(scope.row.id)"type="danger"size="small"><el-icon><Delete/></el-icon>发布</el-button><el-button@click="handleDown(scope.row.id)"type="danger"size="small"><el-icon><Delete/></el-icon>下架</el-button></template></el-table-column></el-table><!-- 分页条 --><divstyle=""><el-pagination:current-page="page.pageNum":page-size="page.pageSize":page-sizes="[5,10,50,100]"layout="total,sizes,prev,pager,next,jumper":total="page.total"@size-change="handleSizeChange"@current-change="handleCurrentChange"></el-pagination></div></el-card><!-- 设置对话框 --><el-dialogv-model="dialogVisible"draggable><template#header><h4><el-icon><Brush/></el-icon> {
{dialogType==='add'?'新增':'修改'}}课程管理</h4></template><el-form:model="form.data"label-position="left"label-width="120px"><el-form-itemlabel="机构名称"><el-selectv-model="form.data.companyId"placeholder="请选择"><el-optionv-for="item in companyOptions":key="item.id":label="item.name":value="item.id"></el-option></el-select></el-form-item><el-form-itemlabel="课程名称"><el-inputv-model="form.data.name"show-word-limitmaxlength="100"></el-input></el-form-item><el-form-itemlabel="适用人群"><el-inputv-model="form.data.users"type="textarea"show-word-limitmaxlength="500":autosize="{minRows:2,maxRows:4}"></el-input></el-form-item><el-form-itemlabel="课程标签"><el-inputv-model="form.data.tags"></el-input></el-form-item><!-- 4个下拉框 --><el-form-itemlabel="一级分类"><el-selectv-model="form.data.mt"placeholder="请选择"><el-optionv-for="item in mtOptions":key="item.id":label="item.name":value="item.id"></el-option></el-select></el-form-item><el-form-itemlabel="二级分类"><!-- 二级分类树 --><el-selectv-model="form.data.st"placeholder="请选择"><el-