课程新增

This commit is contained in:
2024-05-14 14:46:12 +08:00
parent 338de0ac5d
commit 6638f02de6
3 changed files with 111 additions and 92 deletions

View File

@@ -328,7 +328,7 @@ export default {
methods: {
init(row) {
console.log("11111", row);
if (row.id) {
if (row&&row.id) {
this.$http
.request({
url: this.$http.adornUrl(this.urlList.info),

View File

@@ -1,8 +1,5 @@
<template>
<div
style="width: 100%; height: 100%;"
>
<div style="width: 100%; height: 100%;">
<!-- <el-form
:inline="true"
:model="dataForm"
@@ -85,7 +82,6 @@
border
size="mini"
v-loading="dataListLoading"
style="width: 100%"
>
<!-- <el-table-column
@@ -97,12 +93,7 @@
>
</el-table-column> -->
<!-- -->
<el-table-column
label="课程ID"
width="70"
align="center"
prop="id"
>
<el-table-column label="课程ID" width="70" align="center" prop="id">
<!-- <template slot-scope="scope">
{{ (pageIndex - 1) * pageSize + scope.$index + 1 }}
</template> -->
@@ -114,6 +105,26 @@
label="课程名称"
>
</el-table-column>
<el-table-column
prop="sort"
header-align="center"
align="center"
label="排序"
width="180"
>
<template slot-scope="scope">
<el-input
v-focus
v-if="scope.row[scope.column.property + 'Show']"
clearable
v-model="scope.row.sort"
@keyup.enter.native="onBlurFirst(scope.row, scope.column)"
@blur="onBlurFirst(scope.row, scope.column)"
>
</el-input>
<span v-else>{{ scope.row.sort }}</span>
</template>
</el-table-column>
<!-- <el-table-column
prop="product.price"
width="120"
@@ -260,8 +271,8 @@ export default {
bookIds: [],
selectShopArr: [],
dataForm: {
keywords: "",
},
keywords: ""
}
};
},
watch: {
@@ -273,28 +284,39 @@ export default {
console.log("🚀 ~ handler ~ val:", val);
this.selectShopArr = [];
this.$forceUpdate();
},
},
}
}
},
components: {
// AddOrUpdate,
// chooseBook
},
async activated() {
this.multipleSelection = [];
await this.getAssociatedGoodsList({ ...this.dataForm });
// await this.getGoodsTypeList();
},
methods: {
onBlurFirst(row, column) {
//由于修改的数据只会让合并列的第一行数据改变,因此循环遍历列表修改相同类型的合并列的其余数据
this.associatedGoodsList.map(item => {
if (row.rootTargetCode == item.rootTargetCode) {
item.sort = Number(row.sort);
}
});
//修改原型数据
row[column.property + "Show"] = false;
this.updateTable();
},
shopDelete(row) {
this.$emit('delete',row)
this.$emit("delete", row);
},
// 获取商品类型
getGoodsTypeList() {
this.$http({
url: this.$http.adornUrl("/book/sysdictdata/selectByType/goodsType"),
method: "get",
method: "get"
}).then(({ data }) => {
// console.log(data.dataList)
this.goodsTypeList = data.dataList;
@@ -306,8 +328,7 @@ this.$emit('delete',row)
// } else {
// this.selectShopArr = [];
// }
this.$emit('delete',this.associatedGoodsList,'all')
this.$emit("delete", this.associatedGoodsList, "all");
this.$forceUpdate();
},
@@ -363,18 +384,18 @@ this.$emit('delete',row)
params: this.$http.adornParams({
page: this.pageIndex,
limit: this.pageSize,
keywords: this.dataForm.keywords,
}),
keywords: this.dataForm.keywords
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataList = data.page.list;
console.log('this.dataList at line 372:', this.dataList)
console.log("this.dataList at line 372:", this.dataList);
this.totalPage = data.page.totalPage;
} else {
this.dataList = [];
this.totalPage = 0;
}
this.$forceUpdate()
this.$forceUpdate();
// setTimeout(async () => {
// await this.setSelectRow();
// }, 200);
@@ -395,7 +416,7 @@ this.$emit('delete',row)
// if (this.currentType == "bookLabelId") {
// form.bookLabelId = this.currentId;
form.id = this.currentId;
console.log("🚀 ~ getAssociatedGoodsList ~ form:", form)
console.log("🚀 ~ getAssociatedGoodsList ~ form:", form);
// }
// else if (this.currentType == "bookMarketId") {
// form.bookMarketId = this.currentId;
@@ -411,10 +432,9 @@ this.$emit('delete',row)
page: 1,
limit: 99999999,
...form,
...form
// bookLabelId: bookLabelId,
}),
})
}).then(async ({ data }) => {
if (data && data.code === 0) {
this.associatedGoodsList = [...data.courseList];
@@ -452,7 +472,7 @@ this.$emit('delete',row)
deleteHandle(id) {
var ids = id
? [id]
: this.dataListSelections.map((item) => {
: this.dataListSelections.map(item => {
return item.productId;
});
this.$confirm(
@@ -461,13 +481,13 @@ this.$emit('delete',row)
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
type: "warning"
}
).then(() => {
this.$http({
url: this.$http.adornUrl("/book/shopproduct/delete"),
method: "post",
data: this.$http.adornData(ids, false),
data: this.$http.adornData(ids, false)
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
@@ -476,7 +496,7 @@ this.$emit('delete',row)
duration: 1500,
onClose: () => {
this.getDataList();
},
}
});
} else {
this.$message.error(data.msg);
@@ -488,33 +508,32 @@ this.$emit('delete',row)
/*点击时他会自动把你绑定的值变更,直接去请求数据就可以了*/
var parms = {
publishStatus: event.publishStatus,
productId: event.productId,
productId: event.productId
};
// console.log(parms)
this.$http({
url: this.$http.adornUrl("/book/shopproduct/update"),
method: "post",
data: parms,
data: parms
})
.then((res) => {
.then(res => {
this.$message({
message: "成功",
type: "success",
type: "success"
});
this.loading = false;
this.getDataList();
})
.catch((error) => {
.catch(error => {
this.loading = false;
console.log(error);
});
console.log(event);
},
},
}
}
};
</script>
<style lang="less" scoped>
li {
padding: 0;
@@ -609,4 +628,3 @@ li {
padding: 6px !important;
}
</style>

View File

@@ -50,6 +50,7 @@
</el-table-column>
<el-table-column prop="title" header-align="center" align="center" label="课程名称">
</el-table-column>
<!-- <el-table-column prop="price" width="120" header-align="center" align="center" sortable label="价格">
</el-table-column>
<el-table-column prop="activityPrice" width="120" header-align="center" align="center" sortable label="活动价">