课程绑定

This commit is contained in:
2024-05-11 11:21:06 +08:00
parent d30e19e446
commit 515817103b
5 changed files with 494 additions and 176 deletions

View File

@@ -1,6 +1,8 @@
<template> <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 <!-- <el-form
:inline="true" :inline="true"
:model="dataForm" :model="dataForm"
@@ -29,9 +31,14 @@
<div class="search_form"> <div class="search_form">
<div class="addFormBox shopFormBox"> <div class="addFormBox shopFormBox">
<el-form ref="addForm" label-width="80px" :model="dataForm"> <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="" label=""
class="form_item" class="form_item"
label-width="20px" label-width="20px"
@@ -159,7 +166,7 @@ export default {
"isEdit", "isEdit",
"currentId", "currentId",
"currentType", "currentType",
"isNoSearch", "isNoSearch"
], ],
data() { data() {
return { return {
@@ -306,29 +313,50 @@ export default {
}, },
// 获取关联数据列表 // 获取关联数据列表
async getAssociatedGoodsList() { async getAssociatedGoodsList() {
console.log("🚀 ~ getAssociatedGoodsList ~ form:", form); console.log("🚀 ~ getAssociatedGoodsList ~ form:11111", form);
var form = { ...this.defaultForm, ...this.dataForm }; var form = { ...this.defaultForm, ...this.dataForm };
this.dataListLoading = true; this.dataListLoading = true;
await this.$http({
url: this.$http.adornUrl(`${this.urlList.getAssociatedGoodsList}`),
method: "post",
data: this.$http.adornData({
current: 1,
limit: 99999999,
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]];
...form 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) { }).then(async ({ data }) => {
this.associatedGoodsList = [...data.result.records]; if (data && data.code === 0) {
this.associatedGoodsList = [...data.result.records];
this.dataListLoading = false; this.dataListLoading = false;
} }
}); });
}
}, },
// 每页数 // 每页数
sizeChangeHandle(val) { sizeChangeHandle(val) {

View File

@@ -39,6 +39,8 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<!-- @selection-change="handleSelectionChange" -->
<!-- @current-change="handleCurrentChange" -->
<el-table <el-table
ref="table" ref="table"
height="calc(100% - 120px)" height="calc(100% - 120px)"
@@ -48,26 +50,38 @@
size="mini" size="mini"
highlight-current-row highlight-current-row
v-loading="dataListLoading" v-loading="dataListLoading"
@selection-change="handleSelectionChange"
@current-change="handleCurrentChange"
style="width: 100%" style="width: 100%"
> >
<el-table-column align="center" width="40px"> <!-- <el-table-column align="center" width="40px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-radio v-model="currentRow" :label="scope.row" <el-radio v-model="currentRow" :label="scope.row"
>&nbsp;</el-radio >&nbsp;</el-radio
> >
<!-- //或者是<el-radio v-model="currentRow" :label="scope.row"><i></i></el-radio> --> </template>
</template> </el-table-column> -->
</el-table-column>
<!-- <el-table-column :reserve-selection="true" type="selection" header-align="center" align="center" width="50"> <!-- <el-table-column :reserve-selection="true" type="selection" header-align="center" align="center" width="50">
</el-table-column> --> </el-table-column> -->
<slot name="tableItem"></slot> <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-table>
<el-pagination <el-pagination
style="float: right;margin-top: 20px;" style="float: right;margin-top: 20px;"
@size-change="sizeChangeHandle" @size-change="sizeChangeHandle"
@current-change="currentChangeHandle" @current-change="currentChangeHandle"
:current-page="pageIndex" :current-page="pageIndex"
@@ -173,7 +187,7 @@ export default {
handleCurrentChange(val) { handleCurrentChange(val) {
console.log("🚀 ~ handleSelectionChange ~ val:", val); console.log("🚀 ~ handleSelectionChange ~ val:", val);
this.$emit("submit", val.id); this.$emit("submit", val.id,val);
// table组件选中事件,记得加上@selection-change="handleSelectionChange" // table组件选中事件,记得加上@selection-change="handleSelectionChange"
// this.multipleSelection = val; // this.multipleSelection = val;
@@ -216,7 +230,7 @@ export default {
var form = { var form = {
...this.defaultForm, ...this.defaultForm,
...this.dataForm, ...this.dataForm,
current: this.pageIndex,
limit: this.pageSize limit: this.pageSize
}; };
// form["marketId"] = this.currentId.toString(); // form["marketId"] = this.currentId.toString();
@@ -231,24 +245,53 @@ export default {
// } // }
this.dataListLoading = true; this.dataListLoading = true;
this.clear(); this.clear();
if (this.defaultForm.httpType == "raw") {
await this.$http({ form.page = this.pageIndex;
url: this.$http.adornUrl(this.urlList.getNotToLabelList), this.$http
method: "post", .request({
data: this.$http.adornData(form) url: this.$http.adornUrl(`${this.urlList.CanBindProductList}`),
}).then(({ data }) => { method: "POST",
if (data && data.code === 0) { data: {
this.dataList = data.result.records; ...form
this.totalPage = data.result.total; },
} else { header: {
this.dataList = []; //默认 无 说明:请求头
this.totalPage = 0; "Content-Type": "application/json"
} }
// setTimeout(async () => { })
// await this.setSelectRow(); .then(({ data }) => {
// }, 200); if (data && data.code === 0) {
this.dataListLoading = false; 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() { clear() {
// this.$refs.table.clearSelection(); // this.$refs.table.clearSelection();

View File

@@ -21,29 +21,37 @@
> >
<i class="el-dialog__close el-icon el-icon-close"></i> <i class="el-dialog__close el-icon el-icon-close"></i>
</button> </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="item-box" style="">
<!-- <div class="title_box" slot="center"> <!-- <div class="title_box" slot="center">
<div class="title"><span class="line"></span></div> <div class="title"><span class="line"></span></div>
</div> --> </div> -->
<div class="item-content"> <div class="item-content">
<el-collapse v-model="activeNames" @change="handleChange"> <p class="item-content-title" style=" ">
<el-collapse-item title="已关联图书列表" name="1"> 已关联图书列表
<commonOperationsList </p>
ref="commonOperationsBook" <commonOperationsList
title="图书" :urlList="urlBookList"
source="book" :productId="productId"
> ref="commonOperationsBook"
</commonOperationsList> title="图书"
</el-collapse-item> source="book"
<el-collapse-item title="已关联课程列表" name="2"> >
<commonOperationsList </commonOperationsList>
ref="commonOperationsCurriculum" </div>
title="课程" </div>
source="curriculum" <div class="item-box" style="">
></commonOperationsList> <div class="item-content">
</el-collapse-item> <p class="item-content-title" style=" ">
</el-collapse> 已关联课程列表
</p>
<commonOperationsList
:urlList="urlCurriculumList"
:productId="productId"
ref="commonOperationsCurriculum"
title="课程"
source="curriculum"
></commonOperationsList>
</div> </div>
</div> </div>
</div> </div>
@@ -129,15 +137,19 @@ export default {
chooseBookVisible: false, chooseBookVisible: false,
bookIds: [], bookIds: [],
goodsTypeList: [], goodsTypeList: [],
urlList: { urlBookList: {
treeList: "/master/shopProduct/getProductToLabel", deleteShop: "/master/shopProduct/unbindProductAndBook",
treeMarketList: "/book/labelAndMarket/marketTree", saveShop: "/master/shopProduct/bindProductAndBook",
deleteBookShop: "/book/labelAndMarket/delToLable",
deleteBookShopMarket: "/book/labelAndMarket/delToMarket", hasBindProductList: "/master/shopProduct/getHasBindProductAndBook", //已绑定
saveBookShop: "/book/labelAndMarket/saveToLabel", CanBindProductList: "/master/shopProduct/getCanBindProductAndBook" //未绑定
saveBookShopMarket: "/book/labelAndMarket/saveToMarket", },
getToLabelList: "/book/labelAndMarket/getToLabelList", urlCurriculumList: {
getToMarketList: "/book/labelAndMarket/getToMarketList" 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); this.activeNames.push(e.collapseMarketKey);
}); });
setTimeout(async () => { setTimeout(async () => {
await this.getDataList(id); // await this.getDataList(id);
await this.$refs.commonOperationsBook.open(id);
await this.$refs.commonOperationsCurriculum.open(id);
}, 200); }, 200);
// this.pageIndex = 1; // this.pageIndex = 1;
@@ -626,10 +640,10 @@ export default {
// border: 1px solid #ebeef5 !important; // border: 1px solid #ebeef5 !important;
} }
.item-content { .item-content {
padding: 20px; padding: 10px 10px 0;
padding-top: 0; padding-top: 0;
overflow-y: auto; overflow-y: auto;
height: calc(100% - 80px); height: calc(100% );
} }
/deep/.el-collapse-item { /deep/.el-collapse-item {
margin-bottom: 20px; margin-bottom: 20px;
@@ -652,4 +666,12 @@ export default {
/deep/.el-collapse { /deep/.el-collapse {
border-bottom: none !important; 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> </style>

View File

@@ -1,11 +1,11 @@
<template> <template>
<div class="mod-config" style="height: auto;margin-top: 20px;"> <div class="mod-config" style="margin-top: 20px;">
<!-- v-if="isFresh" <!-- v-if="isFresh"
v-loading="!isFresh" --> v-loading="!isFresh" -->
<div <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_box" style="margin-bottom: 10px; height: 40px">
<div class="title" style="width: 100%;display: block;"> <div class="title" style="width: 100%;display: block;">
<!-- <span class="line"></span>已关联{{ title }}列表 --> <!-- <span class="line"></span>已关联{{ title }}列表 -->
@@ -19,10 +19,13 @@
</div> </div>
</div> </div>
<commonShop <commonShop
:isNoSearch="true" :isNoSearch="true"
:defaultForm="{ :defaultForm="{
title: '', title: '',
marketId: addForm.id productId: this.productId,
httpType: 'raw',
httpDataValueName: this.source == 'book' ? 'books' : 'course'
// marketId: addForm.id
}" }"
getAssociatedGoodsListKey="marketId" getAssociatedGoodsListKey="marketId"
getAssociatedGoodsListValue="result" getAssociatedGoodsListValue="result"
@@ -44,14 +47,19 @@
class="form_item" class="form_item"
style="width: 240px;" style="width: 240px;"
> >
<el-input <el-input
size="small" size="small"
placeholder="请输入课程名称" placeholder="请输入课程名称"
style="width: 100%" style="width: 100%"
v-model="slotProps.dataForm.title" v-model="slotProps.dataForm.keywords"
clearable clearable
> >
</el-input> </el-form-item </el-input>
</el-form-item
></template> ></template>
<!-- <template v-if="source == 'book'"> <!-- <template v-if="source == 'book'">
<el-form-item <el-form-item
@@ -128,22 +136,29 @@
label="课程ID" label="课程ID"
width="70" width="70"
align="center" align="center"
prop="id" prop="catalogueId"
> >
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="title" prop="courseTitle"
header-align="center" header-align="center"
align="center" align="center"
label="课程名称" label="课程名称"
> >
</el-table-column> </el-table-column>
<el-table-column
prop="courseCatalogueTitle"
header-align="center"
align="center"
label="目录名称"
>
</el-table-column>
<el-table-column <el-table-column
header-align="center" header-align="center"
align="center" align="center"
label="课程图" label="课程图"
width="140" width="120"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<img <img
@@ -171,19 +186,19 @@
label="书名" label="书名"
> >
</el-table-column> </el-table-column>
<el-table-column <!-- <el-table-column
prop="authorName" prop="authorName"
header-align="center" header-align="center"
align="center" align="center"
label="作者名称" label="作者名称"
> >
</el-table-column> </el-table-column> -->
<el-table-column <el-table-column
header-align="center" header-align="center"
align="center" align="center"
label="插图" label="插图"
width="180" width="120"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<img <img
@@ -195,7 +210,7 @@
/> />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <!-- <el-table-column
width="180px width="180px
" "
prop="state" prop="state"
@@ -217,7 +232,7 @@
> >
</el-switch> </el-switch>
</template> </template>
</el-table-column> </el-table-column> -->
</template> </template>
</template> </template>
</commonShop> </commonShop>
@@ -235,8 +250,11 @@
<commonShopTable <commonShopTable
:title="title" :title="title"
:defaultForm="{ :defaultForm="{
title: '', keywords: '',
marketId: addForm.id id: productId,
httpType: 'raw',
httpDataValueName: this.source == 'book' ? 'records' : 'data',
httpDataTotalName: this.source == 'book' ? 'total' : 'count'
}" }"
:urlList="urlList" :urlList="urlList"
:tableColumnList="tableColumnList" :tableColumnList="tableColumnList"
@@ -245,16 +263,16 @@
ref="commonShopTable" ref="commonShopTable"
:currentId="addForm.id" :currentId="addForm.id"
currentType="bookMarketId" currentType="bookMarketId"
@submit="handleSubmitShopTable" @submit="handleSubmit"
> >
<template slot="searchFormItem" slot-scope="slotProps"> <template slot="searchFormItem" slot-scope="slotProps">
<template v-if="source == 'curriculum'"> <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 <el-input
size="small" size="small"
placeholder="请输入课程名称" placeholder="请输入课程名称"
style="width: 100%" style="width: 100%"
v-model="slotProps.dataForm.title" v-model="slotProps.dataForm.keyWords"
clearable clearable
> >
</el-input> </el-form-item </el-input> </el-form-item
@@ -262,7 +280,7 @@
<template v-if="source == 'book'"> <template v-if="source == 'book'">
<el-form-item <el-form-item
label="图书名称" label="图书名称"
prop="bookName" prop="keywords"
class="form_item" class="form_item"
style="width: 280px;" style="width: 280px;"
> >
@@ -270,12 +288,13 @@
size="small" size="small"
placeholder="请输入图书名称" placeholder="请输入图书名称"
style="width: 100%" style="width: 100%"
v-model="slotProps.dataForm.bookName" v-model="slotProps.dataForm.keywords"
clearable clearable
> >
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item
<!-- <el-form-item
label="出版社名称" label="出版社名称"
prop="publisherName" prop="publisherName"
label-width="100px" label-width="100px"
@@ -290,9 +309,9 @@
clearable clearable
> >
</el-input> </el-input>
</el-form-item> </el-form-item> -->
<el-form-item <!-- <el-form-item
label="作者姓名" label="作者姓名"
prop="authorName" prop="authorName"
class="form_item" class="form_item"
@@ -306,26 +325,36 @@
clearable clearable
> >
</el-input> </el-input>
</el-form-item> </el-form-item> -->
</template> </template>
</template> </template>
<template slot="tableItem" slot-scope="slotProps"> <template slot="tableItem" slot-scope="slotProps">
<template v-if="source == 'curriculum'" <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"> <!-- <template slot-scope="scope">
{{ (pageIndex - 1) * pageSize + scope.$index + 1 }} {{ (pageIndex - 1) * pageSize + scope.$index + 1 }}
</template> --> </template> -->
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="title" prop="courseTitle"
header-align="center" header-align="center"
align="center" align="center"
label="课程名称" label="课程名称"
> >
</el-table-column> </el-table-column>
<el-table-column
prop="courseCatalogueTitle"
header-align="center"
align="center"
label="目录名称"
>
</el-table-column>
<el-table-column <el-table-column
header-align="center" header-align="center"
@@ -353,13 +382,13 @@
label="书名" label="书名"
> >
</el-table-column> </el-table-column>
<el-table-column <!-- <el-table-column
prop="authorName" prop="authorName"
header-align="center" header-align="center"
align="center" align="center"
label="作者名称" label="作者名称"
> >
</el-table-column> </el-table-column> -->
<el-table-column <el-table-column
header-align="center" header-align="center"
@@ -377,7 +406,29 @@
/> />
</template> </template>
</el-table-column> </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 width="180px
" "
prop="state" prop="state"
@@ -399,10 +450,95 @@
> >
</el-switch> </el-switch>
</template> </template>
</el-table-column> </el-table-column> -->
</template> </template>
</template> </template> </commonShopTable
</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> </div>
</template> </template>
@@ -414,21 +550,31 @@ import commonShopTable from "@/views/components/commonBookTags/shopproductTable.
import commonTree from "@/views/components/commonBookTags/tags.vue"; import commonTree from "@/views/components/commonBookTags/tags.vue";
// import dialogComponent from './seckillprodrelation' // import dialogComponent from './seckillprodrelation'
export default { export default {
props: ["title", "source"], props: ["title", "source", "urlList", "productId"],
data() { data() {
return { return {
selectCourseId: null,
selectCourse: {
courseTitle: "",
courseCatalogueTitle: ""
},
validityPeriodList: [
{
value: 180,
label: "半年(180)"
},
{
value: 365,
label: "一年(365)"
}
],
validityPeriod: 180,
isEdit: false, isEdit: false,
dialogVisible: false,
checkAll: false, checkAll: false,
isIndeterminate: true, 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: {}, addForm: {},
isFresh: false, isFresh: false,
dataRule: { dataRule: {
@@ -520,6 +666,9 @@ export default {
this.getDataList(); this.getDataList();
}, },
methods: { methods: {
handleChangeValidityPeriod(val) {
console.log("val at line 584:", val);
},
UpNumber(e) { UpNumber(e) {
e.target.value = e.target.value.replace(/[^\d]/g, ""); e.target.value = e.target.value.replace(/[^\d]/g, "");
}, },
@@ -532,33 +681,74 @@ export default {
this.$refs.commonShop.handleCheckAllChange(val); 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) { handleSubmitShopTable: debounce(async function(ids) {
await this.$http({ var data = {
url: this.$http.adornUrl(`${this.urlList.saveShop}`), productId: this.productId
method: "post", };
data: this.$http.adornData({ if (this.source == "curriculum") {
courseId: ids, data.days = this.validityPeriod;
marketId: this.addForm.id 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) { .then(async ({ data }) => {
// this.$refs.commonShop.getAssociatedGoodsList.dataForm={ if (data && data.code === 0) {
// ...this.$refs.commonShop.getAssociatedGoodsList.dataForm, this.$message.success(data.msg);
// id:this.addForm.id ? this.addForm.id : null
// }
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), }, 100),
openTable() { openTable() {
this.isEdit = false; this.isEdit = false;
@@ -652,7 +842,7 @@ export default {
dataFormDelete: debounce(async function(row, deleteType) { dataFormDelete: debounce(async function(row, deleteType) {
console.log("row at line 515:", row); console.log("row at line 515:", row);
this.$confirm( this.$confirm(
`确定要删除${deleteType != "all" ? "该" : "所有"}关联课程嘛?`, `确定要删除${deleteType != "all" ? "" : "所有"}关联${this.title}嘛?`,
"提示", "提示",
{ {
confirmButtonText: "确定", confirmButtonText: "确定",
@@ -663,7 +853,12 @@ export default {
.then(async () => { .then(async () => {
// var lableIds = row[0].bookLabelId; // var lableIds = row[0].bookLabelId;
var productIds = row[0].id; 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 // // return false
// var selectShopArr = this.$refs.commonShop.selectShopArr; // var selectShopArr = this.$refs.commonShop.selectShopArr;
// console.log(selectShopArr, "1111"); // console.log(selectShopArr, "1111");
@@ -673,31 +868,42 @@ export default {
// return false; // return false;
// } // }
this.$refs.commonShop.dataListLoading = true; this.$refs.commonShop.dataListLoading = true;
this.$http
await this.$http({ .request({
url: this.$http.adornUrl( url: this.$http.adornUrl(`${this.urlList.deleteShop}`),
`${this.urlList.deleteShop}?marketId=${ method: "POST",
this.addForm.id data: data,
}&courseId=${productIds}` header: {
), //默认 无 说明:请求头
method: "post" "Content-Type": "application/json"
}).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();
} }
})
// 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(() => {}); .catch(() => {});
}, 200), }, 200),
@@ -1129,7 +1335,7 @@ export default {
.mod-config { .mod-config {
width: 100%; width: 100%;
height: 82vh; height: calc(100% - 80px);
overflow: hidden; overflow: hidden;
} }
@@ -1249,4 +1455,23 @@ p {
margin-top: -10px !important; margin-top: -10px !important;
// float: right !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> </style>

View File

@@ -133,7 +133,7 @@
<el-dropdown-item <el-dropdown-item
@click.native="handleEditCorrelation(scope.row.productId)" @click.native="handleEditCorrelation(scope.row.productId)"
>关联绑定</el-dropdown-item >图书与课程</el-dropdown-item
> >
<el-dropdown-item <el-dropdown-item
@click.native="handleEditTags(scope.row.productId)" @click.native="handleEditTags(scope.row.productId)"