|
@@ -128,14 +128,51 @@
|
|
|
<el-form-item label="课程名称" prop="title">
|
|
|
<el-input v-model="form.title" placeholder="请输入课程名称" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="所属店铺" prop="shopId">
|
|
|
- <el-input v-model="form.shopId" placeholder="请输入所属店铺" />
|
|
|
+ <el-form-item label="所属店铺" prop="userId">
|
|
|
+ <el-select
|
|
|
+ v-model="form.shopId"
|
|
|
+ placeholder="请选择店铺"
|
|
|
+ @change="handleShopChange"
|
|
|
+ size="large"
|
|
|
+ style="width: 240px"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="user1 in course"
|
|
|
+ :key="user1.id"
|
|
|
+ :label="user1.name"
|
|
|
+ :value="user1.id"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="主讲老师" prop="teacherId">
|
|
|
- <el-input v-model="form.teacherId" placeholder="请输入主讲老师" />
|
|
|
+ <el-form-item label="主讲师" prop="teacherId">
|
|
|
+ <el-select
|
|
|
+ v-model="form.teacherId"
|
|
|
+ placeholder="请选择讲师"
|
|
|
+ size="large"
|
|
|
+ style="width: 240px"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="user1 in teacher"
|
|
|
+ :key="user1.id"
|
|
|
+ :label="user1.name"
|
|
|
+ :value="user1.id"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="分类" prop="categoryId">
|
|
|
- <el-input v-model="form.categoryId" placeholder="请输入分类" />
|
|
|
+ <el-select
|
|
|
+ v-model="form.categoryId"
|
|
|
+ placeholder="请选择讲师"
|
|
|
+ size="large"
|
|
|
+ style="width: 240px"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="user1 in category"
|
|
|
+ :key="user1.id"
|
|
|
+ :label="user1.name"
|
|
|
+ :value="user1.id"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="原价" prop="price">
|
|
|
<el-input v-model="form.price" placeholder="请输入原价" />
|
|
@@ -179,6 +216,9 @@
|
|
|
|
|
|
<script>
|
|
|
import { listCourse, getCourse, delCourse, addCourse, updateCourse } from "@/api/system1/course"
|
|
|
+import {listAll} from "../../../api/system1/shop";
|
|
|
+import {All} from "../../../api/system1/teacher";
|
|
|
+import {listCategoryAll} from "../../../api/system1/category";
|
|
|
|
|
|
export default {
|
|
|
name: "Course",
|
|
@@ -198,16 +238,19 @@ export default {
|
|
|
total: 0,
|
|
|
// 课程表格数据
|
|
|
courseList: [],
|
|
|
+ category: [],
|
|
|
// 弹出层标题
|
|
|
title: "",
|
|
|
// 是否显示弹出层
|
|
|
open: false,
|
|
|
+ teacher: [],
|
|
|
// 查询参数
|
|
|
queryParams: {
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
title: null,
|
|
|
},
|
|
|
+ course:[],
|
|
|
// 表单参数
|
|
|
form: {},
|
|
|
// 表单校验
|
|
@@ -232,8 +275,32 @@ export default {
|
|
|
},
|
|
|
created() {
|
|
|
this.getList()
|
|
|
+ this.All()
|
|
|
+ this.category1()
|
|
|
},
|
|
|
methods: {
|
|
|
+ All(){
|
|
|
+ listAll().then(response=>{
|
|
|
+ this.course=response.rows
|
|
|
+ })
|
|
|
+ },
|
|
|
+ category1(){
|
|
|
+ listCategoryAll().then(response=>{
|
|
|
+ this.category=response.rows
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ handleShopChange(shopId) {
|
|
|
+ if (shopId) {
|
|
|
+ All(shopId).then(response=>{
|
|
|
+ this.teacher=response.rows
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.teachers = []
|
|
|
+ }
|
|
|
+ // 重置已选的讲师
|
|
|
+ this.form.teacherId = null
|
|
|
+ },
|
|
|
/** 查询课程列表 */
|
|
|
getList() {
|
|
|
this.loading = true
|
|
@@ -243,6 +310,11 @@ export default {
|
|
|
this.loading = false
|
|
|
})
|
|
|
},
|
|
|
+ shopAll(){
|
|
|
+ All().then(response =>{
|
|
|
+ this.teacher=response.rows
|
|
|
+ })
|
|
|
+ },
|
|
|
// 取消按钮
|
|
|
cancel() {
|
|
|
this.open = false
|
|
@@ -270,6 +342,7 @@ export default {
|
|
|
this.queryParams.pageNum = 1
|
|
|
this.getList()
|
|
|
},
|
|
|
+
|
|
|
/** 重置按钮操作 */
|
|
|
resetQuery() {
|
|
|
this.resetForm("queryForm")
|
|
@@ -297,6 +370,7 @@ export default {
|
|
|
this.title = "修改课程"
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
/** 提交按钮 */
|
|
|
submitForm() {
|
|
|
this.$refs["form"].validate(valid => {
|