课程绑定
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
<template>
|
||||
<div class="commonShopproduct" :style="`width: 100%; height: 100%; margin-top: -50px`">
|
||||
|
||||
<div
|
||||
class="commonShopproduct"
|
||||
:style="`width: 100%; height: 100%; margin-top: -50px`"
|
||||
>
|
||||
<!-- <el-form
|
||||
:inline="true"
|
||||
:model="dataForm"
|
||||
@@ -29,9 +31,14 @@
|
||||
<div class="search_form">
|
||||
<div class="addFormBox shopFormBox">
|
||||
<el-form ref="addForm" label-width="80px" :model="dataForm">
|
||||
<slot name="searchFormItem" :dataForm="dataForm" v-if="!isNoSearch"></slot>
|
||||
<slot
|
||||
name="searchFormItem"
|
||||
:dataForm="dataForm"
|
||||
v-if="!isNoSearch"
|
||||
></slot>
|
||||
|
||||
<el-form-item v-if="!isNoSearch"
|
||||
<el-form-item
|
||||
v-if="!isNoSearch"
|
||||
label=""
|
||||
class="form_item"
|
||||
label-width="20px"
|
||||
@@ -159,7 +166,7 @@ export default {
|
||||
"isEdit",
|
||||
"currentId",
|
||||
"currentType",
|
||||
"isNoSearch",
|
||||
"isNoSearch"
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
@@ -306,29 +313,50 @@ export default {
|
||||
},
|
||||
// 获取关联数据列表
|
||||
async getAssociatedGoodsList() {
|
||||
console.log("🚀 ~ getAssociatedGoodsList ~ form:", form);
|
||||
|
||||
console.log("🚀 ~ getAssociatedGoodsList ~ form:11111", form);
|
||||
|
||||
var form = { ...this.defaultForm, ...this.dataForm };
|
||||
|
||||
|
||||
this.dataListLoading = true;
|
||||
await this.$http({
|
||||
url: this.$http.adornUrl(`${this.urlList.getAssociatedGoodsList}`),
|
||||
method: "post",
|
||||
data: this.$http.adornData({
|
||||
current: 1,
|
||||
limit: 99999999,
|
||||
|
||||
|
||||
...form
|
||||
|
||||
})
|
||||
}).then(async ({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.associatedGoodsList = [...data.result.records];
|
||||
if (this.defaultForm.httpType == "raw") {
|
||||
this.$http
|
||||
.request({
|
||||
url: this.$http.adornUrl(`${this.urlList.hasBindProductList}`),
|
||||
method: "POST",
|
||||
data: {
|
||||
productId: this.defaultForm.productId
|
||||
},
|
||||
header: {
|
||||
//默认 无 说明:请求头
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
})
|
||||
.then(async ({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.associatedGoodsList = [...data[this.defaultForm.httpDataValueName]];
|
||||
|
||||
this.dataListLoading = false;
|
||||
}
|
||||
});
|
||||
this.dataListLoading = false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
await this.$http({
|
||||
url: this.$http.adornUrl(`${this.urlList.getAssociatedGoodsList}`),
|
||||
method: "post",
|
||||
data: this.$http.adornData({
|
||||
current: 1,
|
||||
limit: 99999999,
|
||||
|
||||
...form
|
||||
})
|
||||
}).then(async ({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.associatedGoodsList = [...data.result.records];
|
||||
|
||||
this.dataListLoading = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<!-- @selection-change="handleSelectionChange" -->
|
||||
<!-- @current-change="handleCurrentChange" -->
|
||||
<el-table
|
||||
ref="table"
|
||||
height="calc(100% - 120px)"
|
||||
@@ -48,26 +50,38 @@
|
||||
size="mini"
|
||||
highlight-current-row
|
||||
v-loading="dataListLoading"
|
||||
@selection-change="handleSelectionChange"
|
||||
@current-change="handleCurrentChange"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-table-column align="center" width="40px">
|
||||
<!-- <el-table-column align="center" width="40px">
|
||||
<template slot-scope="scope">
|
||||
<el-radio v-model="currentRow" :label="scope.row"
|
||||
> </el-radio
|
||||
>
|
||||
<!-- //或者是<el-radio v-model="currentRow" :label="scope.row"><i></i></el-radio> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<!-- <el-table-column :reserve-selection="true" type="selection" header-align="center" align="center" width="50">
|
||||
</el-table-column> -->
|
||||
|
||||
<slot name="tableItem"></slot>
|
||||
<el-table-column
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="操作"
|
||||
width="80"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="text"
|
||||
@click="handleCurrentChange(scope.row)"
|
||||
size="mini"
|
||||
>绑定</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- -->
|
||||
</el-table>
|
||||
<el-pagination
|
||||
style="float: right;margin-top: 20px;"
|
||||
style="float: right;margin-top: 20px;"
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
:current-page="pageIndex"
|
||||
@@ -173,7 +187,7 @@ export default {
|
||||
handleCurrentChange(val) {
|
||||
console.log("🚀 ~ handleSelectionChange ~ val:", val);
|
||||
|
||||
this.$emit("submit", val.id);
|
||||
this.$emit("submit", val.id,val);
|
||||
|
||||
// table组件选中事件,记得加上@selection-change="handleSelectionChange"
|
||||
// this.multipleSelection = val;
|
||||
@@ -216,7 +230,7 @@ export default {
|
||||
var form = {
|
||||
...this.defaultForm,
|
||||
...this.dataForm,
|
||||
current: this.pageIndex,
|
||||
|
||||
limit: this.pageSize
|
||||
};
|
||||
// form["marketId"] = this.currentId.toString();
|
||||
@@ -231,24 +245,53 @@ export default {
|
||||
// }
|
||||
this.dataListLoading = true;
|
||||
this.clear();
|
||||
|
||||
await this.$http({
|
||||
url: this.$http.adornUrl(this.urlList.getNotToLabelList),
|
||||
method: "post",
|
||||
data: this.$http.adornData(form)
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.result.records;
|
||||
this.totalPage = data.result.total;
|
||||
} else {
|
||||
this.dataList = [];
|
||||
this.totalPage = 0;
|
||||
}
|
||||
// setTimeout(async () => {
|
||||
// await this.setSelectRow();
|
||||
// }, 200);
|
||||
this.dataListLoading = false;
|
||||
});
|
||||
if (this.defaultForm.httpType == "raw") {
|
||||
form.page = this.pageIndex;
|
||||
this.$http
|
||||
.request({
|
||||
url: this.$http.adornUrl(`${this.urlList.CanBindProductList}`),
|
||||
method: "POST",
|
||||
data: {
|
||||
...form
|
||||
},
|
||||
header: {
|
||||
//默认 无 说明:请求头
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
})
|
||||
.then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = [...data.page[this.defaultForm.httpDataValueName]];
|
||||
this.totalPage = data.page[this.defaultForm.httpDataTotalName];
|
||||
} else {
|
||||
this.dataList = [];
|
||||
this.totalPage = 0;
|
||||
}
|
||||
// setTimeout(async () => {
|
||||
// await this.setSelectRow();
|
||||
// }, 200);
|
||||
this.dataListLoading = false;
|
||||
});
|
||||
} else {
|
||||
form.current = this.pageIndex;
|
||||
await this.$http({
|
||||
url: this.$http.adornUrl(this.urlList.getNotToLabelList),
|
||||
method: "post",
|
||||
data: this.$http.adornData(form)
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.result.records;
|
||||
this.totalPage = data.result.total;
|
||||
} else {
|
||||
this.dataList = [];
|
||||
this.totalPage = 0;
|
||||
}
|
||||
// setTimeout(async () => {
|
||||
// await this.setSelectRow();
|
||||
// }, 200);
|
||||
this.dataListLoading = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
clear() {
|
||||
// this.$refs.table.clearSelection();
|
||||
|
||||
@@ -21,29 +21,37 @@
|
||||
>
|
||||
<i class="el-dialog__close el-icon el-icon-close"></i>
|
||||
</button>
|
||||
<div class="addFormBox commonTreeBox" style="overflow: hidden">
|
||||
<div class="addFormBox commonTreeBox" style="overflow: hidden;overflow-x: auto;">
|
||||
<div class="item-box" style="">
|
||||
<!-- <div class="title_box" slot="center">
|
||||
<div class="title"><span class="line"></span></div>
|
||||
</div> -->
|
||||
<div class="item-content">
|
||||
<el-collapse v-model="activeNames" @change="handleChange">
|
||||
<el-collapse-item title="已关联图书列表" name="1">
|
||||
<commonOperationsList
|
||||
ref="commonOperationsBook"
|
||||
title="图书"
|
||||
source="book"
|
||||
>
|
||||
</commonOperationsList>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item title="已关联课程列表" name="2">
|
||||
<commonOperationsList
|
||||
ref="commonOperationsCurriculum"
|
||||
title="课程"
|
||||
source="curriculum"
|
||||
></commonOperationsList>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
<p class="item-content-title" style=" ">
|
||||
已关联图书列表
|
||||
</p>
|
||||
<commonOperationsList
|
||||
:urlList="urlBookList"
|
||||
:productId="productId"
|
||||
ref="commonOperationsBook"
|
||||
title="图书"
|
||||
source="book"
|
||||
>
|
||||
</commonOperationsList>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-box" style="">
|
||||
<div class="item-content">
|
||||
<p class="item-content-title" style=" ">
|
||||
已关联课程列表
|
||||
</p>
|
||||
<commonOperationsList
|
||||
:urlList="urlCurriculumList"
|
||||
:productId="productId"
|
||||
ref="commonOperationsCurriculum"
|
||||
title="课程"
|
||||
source="curriculum"
|
||||
></commonOperationsList>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -129,15 +137,19 @@ export default {
|
||||
chooseBookVisible: false,
|
||||
bookIds: [],
|
||||
goodsTypeList: [],
|
||||
urlList: {
|
||||
treeList: "/master/shopProduct/getProductToLabel",
|
||||
treeMarketList: "/book/labelAndMarket/marketTree",
|
||||
deleteBookShop: "/book/labelAndMarket/delToLable",
|
||||
deleteBookShopMarket: "/book/labelAndMarket/delToMarket",
|
||||
saveBookShop: "/book/labelAndMarket/saveToLabel",
|
||||
saveBookShopMarket: "/book/labelAndMarket/saveToMarket",
|
||||
getToLabelList: "/book/labelAndMarket/getToLabelList",
|
||||
getToMarketList: "/book/labelAndMarket/getToMarketList"
|
||||
urlBookList: {
|
||||
deleteShop: "/master/shopProduct/unbindProductAndBook",
|
||||
saveShop: "/master/shopProduct/bindProductAndBook",
|
||||
|
||||
hasBindProductList: "/master/shopProduct/getHasBindProductAndBook", //已绑定
|
||||
CanBindProductList: "/master/shopProduct/getCanBindProductAndBook" //未绑定
|
||||
},
|
||||
urlCurriculumList: {
|
||||
deleteShop: "/master/shopProduct/unbindProductAndCourse",
|
||||
saveShop: "/master/shopProduct/bindProductAndCourse",
|
||||
|
||||
hasBindProductList: "/master/shopProduct/getHasBindProductAndCourse", //已绑定
|
||||
CanBindProductList: "/master/shopProduct/getCanBindProductAndCourse" //未绑定
|
||||
}
|
||||
};
|
||||
},
|
||||
@@ -366,7 +378,9 @@ export default {
|
||||
this.activeNames.push(e.collapseMarketKey);
|
||||
});
|
||||
setTimeout(async () => {
|
||||
await this.getDataList(id);
|
||||
// await this.getDataList(id);
|
||||
await this.$refs.commonOperationsBook.open(id);
|
||||
await this.$refs.commonOperationsCurriculum.open(id);
|
||||
}, 200);
|
||||
|
||||
// this.pageIndex = 1;
|
||||
@@ -626,10 +640,10 @@ export default {
|
||||
// border: 1px solid #ebeef5 !important;
|
||||
}
|
||||
.item-content {
|
||||
padding: 20px;
|
||||
padding: 10px 10px 0;
|
||||
padding-top: 0;
|
||||
overflow-y: auto;
|
||||
height: calc(100% - 80px);
|
||||
height: calc(100% );
|
||||
}
|
||||
/deep/.el-collapse-item {
|
||||
margin-bottom: 20px;
|
||||
@@ -652,4 +666,12 @@ export default {
|
||||
/deep/.el-collapse {
|
||||
border-bottom: none !important;
|
||||
}
|
||||
.item-content-title {
|
||||
background: #17b3a3 !important;
|
||||
height: 36px !important;
|
||||
color: #fff;
|
||||
font-size: 16px;
|
||||
padding-left: 15px;
|
||||
line-height: 36px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<div class="mod-config" style="height: auto;margin-top: 20px;">
|
||||
<div class="mod-config" style="margin-top: 20px;">
|
||||
<!-- v-if="isFresh"
|
||||
v-loading="!isFresh" -->
|
||||
<div
|
||||
style="width: calc(100% ); height: auto; float: right; border: 1px solid #bababa; box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); border-radius: 10px;position: relative;"
|
||||
style="width: calc(100% ); height: 100%; float: right; border: 1px solid #bababa; box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); border-radius: 10px;position: relative;"
|
||||
>
|
||||
<div class="border_box tree_content_box">
|
||||
<div class="border_box tree_content_box" style="">
|
||||
<div class="title_box" style="margin-bottom: 10px; height: 40px">
|
||||
<div class="title" style="width: 100%;display: block;">
|
||||
<!-- <span class="line"></span>已关联{{ title }}列表 -->
|
||||
@@ -19,10 +19,13 @@
|
||||
</div>
|
||||
</div>
|
||||
<commonShop
|
||||
:isNoSearch="true"
|
||||
:isNoSearch="true"
|
||||
:defaultForm="{
|
||||
title: '',
|
||||
marketId: addForm.id
|
||||
productId: this.productId,
|
||||
httpType: 'raw',
|
||||
httpDataValueName: this.source == 'book' ? 'books' : 'course'
|
||||
// marketId: addForm.id
|
||||
}"
|
||||
getAssociatedGoodsListKey="marketId"
|
||||
getAssociatedGoodsListValue="result"
|
||||
@@ -44,14 +47,19 @@
|
||||
class="form_item"
|
||||
style="width: 240px;"
|
||||
>
|
||||
|
||||
|
||||
<el-input
|
||||
size="small"
|
||||
placeholder="请输入课程名称"
|
||||
style="width: 100%"
|
||||
v-model="slotProps.dataForm.title"
|
||||
v-model="slotProps.dataForm.keywords"
|
||||
clearable
|
||||
>
|
||||
</el-input> </el-form-item
|
||||
</el-input>
|
||||
|
||||
|
||||
</el-form-item
|
||||
></template>
|
||||
<!-- <template v-if="source == 'book'">
|
||||
<el-form-item
|
||||
@@ -128,22 +136,29 @@
|
||||
label="课程ID"
|
||||
width="70"
|
||||
align="center"
|
||||
prop="id"
|
||||
prop="catalogueId"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="title"
|
||||
prop="courseTitle"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="课程名称"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="courseCatalogueTitle"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="目录名称"
|
||||
>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="课程图"
|
||||
width="140"
|
||||
width="120"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<img
|
||||
@@ -171,19 +186,19 @@
|
||||
label="书名"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
<!-- <el-table-column
|
||||
prop="authorName"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="作者名称"
|
||||
>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
|
||||
<el-table-column
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="插图"
|
||||
width="180"
|
||||
width="120"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<img
|
||||
@@ -195,7 +210,7 @@
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
<!-- <el-table-column
|
||||
width="180px
|
||||
"
|
||||
prop="state"
|
||||
@@ -217,7 +232,7 @@
|
||||
>
|
||||
</el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
</template>
|
||||
</template>
|
||||
</commonShop>
|
||||
@@ -235,8 +250,11 @@
|
||||
<commonShopTable
|
||||
:title="title"
|
||||
:defaultForm="{
|
||||
title: '',
|
||||
marketId: addForm.id
|
||||
keywords: '',
|
||||
id: productId,
|
||||
httpType: 'raw',
|
||||
httpDataValueName: this.source == 'book' ? 'records' : 'data',
|
||||
httpDataTotalName: this.source == 'book' ? 'total' : 'count'
|
||||
}"
|
||||
:urlList="urlList"
|
||||
:tableColumnList="tableColumnList"
|
||||
@@ -245,16 +263,16 @@
|
||||
ref="commonShopTable"
|
||||
:currentId="addForm.id"
|
||||
currentType="bookMarketId"
|
||||
@submit="handleSubmitShopTable"
|
||||
@submit="handleSubmit"
|
||||
>
|
||||
<template slot="searchFormItem" slot-scope="slotProps">
|
||||
<template v-if="source == 'curriculum'">
|
||||
<el-form-item label="课程名称" prop="title" class="form_item">
|
||||
<el-form-item label="课程名称" prop="keyWords" class="form_item">
|
||||
<el-input
|
||||
size="small"
|
||||
placeholder="请输入课程名称"
|
||||
style="width: 100%"
|
||||
v-model="slotProps.dataForm.title"
|
||||
v-model="slotProps.dataForm.keyWords"
|
||||
clearable
|
||||
>
|
||||
</el-input> </el-form-item
|
||||
@@ -262,7 +280,7 @@
|
||||
<template v-if="source == 'book'">
|
||||
<el-form-item
|
||||
label="图书名称"
|
||||
prop="bookName"
|
||||
prop="keywords"
|
||||
class="form_item"
|
||||
style="width: 280px;"
|
||||
>
|
||||
@@ -270,12 +288,13 @@
|
||||
size="small"
|
||||
placeholder="请输入图书名称"
|
||||
style="width: 100%"
|
||||
v-model="slotProps.dataForm.bookName"
|
||||
v-model="slotProps.dataForm.keywords"
|
||||
clearable
|
||||
>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
|
||||
<!-- <el-form-item
|
||||
label="出版社名称"
|
||||
prop="publisherName"
|
||||
label-width="100px"
|
||||
@@ -290,9 +309,9 @@
|
||||
clearable
|
||||
>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
|
||||
<el-form-item
|
||||
<!-- <el-form-item
|
||||
label="作者姓名"
|
||||
prop="authorName"
|
||||
class="form_item"
|
||||
@@ -306,26 +325,36 @@
|
||||
clearable
|
||||
>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
</template>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<template slot="tableItem" slot-scope="slotProps">
|
||||
<template v-if="source == 'curriculum'"
|
||||
><el-table-column label="课程ID" width="70" align="center" prop="id">
|
||||
><el-table-column
|
||||
label="课程ID"
|
||||
width="70"
|
||||
align="center"
|
||||
prop="catalogueId"
|
||||
>
|
||||
<!-- <template slot-scope="scope">
|
||||
{{ (pageIndex - 1) * pageSize + scope.$index + 1 }}
|
||||
</template> -->
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="title"
|
||||
prop="courseTitle"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="课程名称"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="courseCatalogueTitle"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="目录名称"
|
||||
>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
header-align="center"
|
||||
@@ -353,13 +382,13 @@
|
||||
label="书名"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
<!-- <el-table-column
|
||||
prop="authorName"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="作者名称"
|
||||
>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
|
||||
<el-table-column
|
||||
header-align="center"
|
||||
@@ -377,7 +406,29 @@
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
<!-- <el-table-column
|
||||
width="180px
|
||||
"
|
||||
prop="state"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="状态"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-switch
|
||||
style="display: block"
|
||||
v-model="value2"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
:active-value="360"
|
||||
:inactive-value="180"
|
||||
active-text="一年"
|
||||
inactive-text="半年"
|
||||
>
|
||||
</el-switch>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<!-- <el-table-column
|
||||
width="180px
|
||||
"
|
||||
prop="state"
|
||||
@@ -399,10 +450,95 @@
|
||||
>
|
||||
</el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
</template>
|
||||
</template>
|
||||
</commonShopTable>
|
||||
</template> </commonShopTable
|
||||
><el-dialog
|
||||
:append-to-body="true"
|
||||
:modal-append-to-body="false"
|
||||
title="课程目录绑定"
|
||||
:visible.sync="dialogVisible"
|
||||
width="30%"
|
||||
:before-close="handleClose"
|
||||
>
|
||||
<div class="addFormBox selectTimeBox">
|
||||
<el-form ref="addForm" :model="dataForm" label-width="80px">
|
||||
<slot name="searchFormItem" :dataForm="dataForm"></slot>
|
||||
|
||||
<el-form-item
|
||||
label="课程名称:"
|
||||
class="form_item"
|
||||
style="width: 100% !important"
|
||||
>
|
||||
|
||||
<p class="input_item">
|
||||
{{ selectCourse.courseTitle }}
|
||||
</p>
|
||||
<!-- courseCatalogueTitle
|
||||
:
|
||||
"课程目录2"
|
||||
courseId
|
||||
:
|
||||
345
|
||||
courseTitle
|
||||
:
|
||||
"111122222 -->
|
||||
<!-- <el-input v-model="selectCourse.courseTitle" readonly></el-input> -->
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="目录名称:"
|
||||
class="form_item"
|
||||
style="width: 100% !important"
|
||||
>
|
||||
<p class="input_item">
|
||||
{{ selectCourse.courseCatalogueTitle}}
|
||||
</p>
|
||||
<!-- selectCourse -->
|
||||
<!-- <el-input
|
||||
v-model="selectCourse.courseCatalogueTitle"
|
||||
readonly
|
||||
></el-input> -->
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="有效期:"
|
||||
class="form_item"
|
||||
style="width: 100% !important"
|
||||
>
|
||||
<el-select
|
||||
v-model="validityPeriod"
|
||||
placeholder="请选择有效期"
|
||||
style="width: 100%;"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in validityPeriodList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<!-- <el-switch
|
||||
@change="handleChangeValidityPeriod"
|
||||
style="display: block"
|
||||
v-model="validityPeriod"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
active-text="一年"
|
||||
inactive-text="半年"
|
||||
active-value="360"
|
||||
inactive-value="180"
|
||||
>
|
||||
</el-switch> -->
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="handleSubmitShopTable"
|
||||
>确 定</el-button
|
||||
>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -414,21 +550,31 @@ import commonShopTable from "@/views/components/commonBookTags/shopproductTable.
|
||||
import commonTree from "@/views/components/commonBookTags/tags.vue";
|
||||
// import dialogComponent from './seckillprodrelation'
|
||||
export default {
|
||||
props: ["title", "source"],
|
||||
props: ["title", "source", "urlList", "productId"],
|
||||
data() {
|
||||
return {
|
||||
selectCourseId: null,
|
||||
selectCourse: {
|
||||
courseTitle: "",
|
||||
courseCatalogueTitle: ""
|
||||
},
|
||||
|
||||
validityPeriodList: [
|
||||
{
|
||||
value: 180,
|
||||
label: "半年(180天)"
|
||||
},
|
||||
{
|
||||
value: 365,
|
||||
label: "一年(365天)"
|
||||
}
|
||||
],
|
||||
validityPeriod: 180,
|
||||
isEdit: false,
|
||||
dialogVisible: false,
|
||||
checkAll: false,
|
||||
isIndeterminate: true,
|
||||
urlList: {
|
||||
treeList: "/master/courseMarket/marketTree",
|
||||
delete: "/master/courseMarket/delMarket",
|
||||
deleteShop: "/master/courseMarket/delToMarket",
|
||||
saveShop: "/master/courseMarket/saveToMarket",
|
||||
add: "/master/courseMarket/saveOrUpdateMarket",
|
||||
getAssociatedGoodsList: "/master/courseMarket/getCourseByMarketId",
|
||||
getNotToLabelList: "/master/courseMarket/getNotToMarketList"
|
||||
},
|
||||
|
||||
addForm: {},
|
||||
isFresh: false,
|
||||
dataRule: {
|
||||
@@ -520,6 +666,9 @@ export default {
|
||||
this.getDataList();
|
||||
},
|
||||
methods: {
|
||||
handleChangeValidityPeriod(val) {
|
||||
console.log("val at line 584:", val);
|
||||
},
|
||||
UpNumber(e) {
|
||||
e.target.value = e.target.value.replace(/[^\d]/g, "");
|
||||
},
|
||||
@@ -532,33 +681,74 @@ export default {
|
||||
this.$refs.commonShop.handleCheckAllChange(val);
|
||||
});
|
||||
},
|
||||
open(id) {
|
||||
console.log("id at line 617:", id);
|
||||
// this.productId=id
|
||||
console.log("this.productId at line 615:", this.productId);
|
||||
if (this.$refs.commonShop) {
|
||||
this.$refs.commonShop.getAssociatedGoodsList();
|
||||
}
|
||||
},
|
||||
|
||||
handleSubmit(ids, data) {
|
||||
console.log("ids at line 646:", ids);
|
||||
|
||||
if (this.source == "curriculum") {
|
||||
this.selectCourseId = data.catalogueId;
|
||||
this.validityPeriod = 180;
|
||||
this.selectCourse = data;
|
||||
this.openSelectTime();
|
||||
} else {
|
||||
this.selectCourseId = ids;
|
||||
|
||||
this.handleSubmitShopTable();
|
||||
}
|
||||
},
|
||||
openSelectTime(ids) {
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
handleSubmitShopTable: debounce(async function(ids) {
|
||||
await this.$http({
|
||||
url: this.$http.adornUrl(`${this.urlList.saveShop}`),
|
||||
method: "post",
|
||||
data: this.$http.adornData({
|
||||
courseId: ids,
|
||||
marketId: this.addForm.id
|
||||
var data = {
|
||||
productId: this.productId
|
||||
};
|
||||
if (this.source == "curriculum") {
|
||||
data.days = this.validityPeriod;
|
||||
data.catalogueId = this.selectCourseId;
|
||||
} else {
|
||||
data.bookId = this.selectCourseId;
|
||||
}
|
||||
console.log(data, "绑定数据信息 111");
|
||||
this.$http
|
||||
.request({
|
||||
url: this.$http.adornUrl(`${this.urlList.saveShop}`),
|
||||
method: "POST",
|
||||
data: data,
|
||||
header: {
|
||||
//默认 无 说明:请求头
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
})
|
||||
}).then(async ({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message.success(data.msg);
|
||||
|
||||
if (this.$refs.commonShop) {
|
||||
// this.$refs.commonShop.getAssociatedGoodsList.dataForm={
|
||||
// ...this.$refs.commonShop.getAssociatedGoodsList.dataForm,
|
||||
// id:this.addForm.id ? this.addForm.id : null
|
||||
// }
|
||||
.then(async ({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message.success(data.msg);
|
||||
|
||||
this.$refs.commonShop.getAssociatedGoodsList();
|
||||
if (this.$refs.commonShop) {
|
||||
// this.$refs.commonShop.getAssociatedGoodsList.dataForm={
|
||||
// ...this.$refs.commonShop.getAssociatedGoodsList.dataForm,
|
||||
// id:this.addForm.id ? this.addForm.id : null
|
||||
// }
|
||||
|
||||
this.$refs.commonShop.getAssociatedGoodsList();
|
||||
}
|
||||
if (this.$refs.commonShopTable) {
|
||||
this.$refs.commonShopTable.close();
|
||||
}
|
||||
this.dialogVisible = false;
|
||||
} else {
|
||||
this.$message.error(data.msg);
|
||||
}
|
||||
if (this.$refs.commonShopTable) {
|
||||
this.$refs.commonShopTable.close();
|
||||
}
|
||||
} else {
|
||||
this.$message.error(data.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
}, 100),
|
||||
openTable() {
|
||||
this.isEdit = false;
|
||||
@@ -652,7 +842,7 @@ export default {
|
||||
dataFormDelete: debounce(async function(row, deleteType) {
|
||||
console.log("row at line 515:", row);
|
||||
this.$confirm(
|
||||
`确定要删除${deleteType != "all" ? "该" : "所有"}关联课程嘛?`,
|
||||
`确定要删除${deleteType != "all" ? "该" : "所有"}关联${this.title}嘛?`,
|
||||
"提示",
|
||||
{
|
||||
confirmButtonText: "确定",
|
||||
@@ -663,7 +853,12 @@ export default {
|
||||
.then(async () => {
|
||||
// var lableIds = row[0].bookLabelId;
|
||||
var productIds = row[0].id;
|
||||
|
||||
var data = { productId: this.productId };
|
||||
if (this.source == "curriculum") {
|
||||
data.catalogueId = row[0].catalogueId;
|
||||
} else {
|
||||
data.bookId = row[0].id;
|
||||
}
|
||||
// // return false
|
||||
// var selectShopArr = this.$refs.commonShop.selectShopArr;
|
||||
// console.log(selectShopArr, "1111");
|
||||
@@ -673,31 +868,42 @@ export default {
|
||||
// return false;
|
||||
// }
|
||||
this.$refs.commonShop.dataListLoading = true;
|
||||
|
||||
await this.$http({
|
||||
url: this.$http.adornUrl(
|
||||
`${this.urlList.deleteShop}?marketId=${
|
||||
this.addForm.id
|
||||
}&courseId=${productIds}`
|
||||
),
|
||||
method: "post"
|
||||
}).then(async ({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message.success("删除成功");
|
||||
} else {
|
||||
this.$message.error(data.msg);
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
// this.$refs.commonShop.selectShopArr = [];
|
||||
if (this.$refs.commonShop) {
|
||||
// this.$refs.commonShop.getAssociatedGoodsList.dataForm={
|
||||
// ...this.$refs.commonShop.getAssociatedGoodsList.dataForm,
|
||||
// id:this.addForm.id ? this.addForm.id : null
|
||||
// }
|
||||
this.$refs.commonShop.getAssociatedGoodsList();
|
||||
this.$http
|
||||
.request({
|
||||
url: this.$http.adornUrl(`${this.urlList.deleteShop}`),
|
||||
method: "POST",
|
||||
data: data,
|
||||
header: {
|
||||
//默认 无 说明:请求头
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
})
|
||||
// await this.$http({
|
||||
// url: this.$http.adornUrl(
|
||||
// `${this.urlList.deleteShop}?marketId=${
|
||||
// this.addForm.id
|
||||
// }&courseId=${productIds}`
|
||||
// ),
|
||||
// method: "post"
|
||||
// })
|
||||
|
||||
.then(async ({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message.success("删除成功");
|
||||
} else {
|
||||
this.$message.error(data.msg);
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
// this.$refs.commonShop.selectShopArr = [];
|
||||
if (this.$refs.commonShop) {
|
||||
// this.$refs.commonShop.getAssociatedGoodsList.dataForm={
|
||||
// ...this.$refs.commonShop.getAssociatedGoodsList.dataForm,
|
||||
// id:this.addForm.id ? this.addForm.id : null
|
||||
// }
|
||||
this.$refs.commonShop.getAssociatedGoodsList();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
}, 200),
|
||||
@@ -1129,7 +1335,7 @@ export default {
|
||||
|
||||
.mod-config {
|
||||
width: 100%;
|
||||
height: 82vh;
|
||||
height: calc(100% - 80px);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@@ -1249,4 +1455,23 @@ p {
|
||||
margin-top: -10px !important;
|
||||
// float: right !important;
|
||||
}
|
||||
/deep/.mod-config .shop_box {
|
||||
height: calc(100% - 0px);
|
||||
// float: right !important;
|
||||
}
|
||||
/deep/.mod-config .selectTimeBox {
|
||||
.input_item{
|
||||
color: #606266;
|
||||
display: inline-block;
|
||||
font-size: inherit;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
outline: 0;
|
||||
padding: 0 15px;
|
||||
}
|
||||
|
||||
// float: right !important;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
|
||||
<el-dropdown-item
|
||||
@click.native="handleEditCorrelation(scope.row.productId)"
|
||||
>关联绑定</el-dropdown-item
|
||||
>图书与课程</el-dropdown-item
|
||||
>
|
||||
<el-dropdown-item
|
||||
@click.native="handleEditTags(scope.row.productId)"
|
||||
|
||||
Reference in New Issue
Block a user