绑定课程
This commit is contained in:
@@ -78,6 +78,9 @@ const mainRoutes = {
|
|||||||
{ path: '/training-course-list', component: _import('modules/trainingCourse/training-course-list'), name: 'training-course-list', meta: { title: '培训班管理', isTab: true } },
|
{ path: '/training-course-list', component: _import('modules/trainingCourse/training-course-list'), name: 'training-course-list', meta: { title: '培训班管理', isTab: true } },
|
||||||
{ path: '/training-course-user', component: _import('modules/trainingCourse/training-course-user'), name: 'training-course-user', meta: { title: '用户列表', isTab: true } },
|
{ path: '/training-course-user', component: _import('modules/trainingCourse/training-course-user'), name: 'training-course-user', meta: { title: '用户列表', isTab: true } },
|
||||||
{ path: '/talents-list', component: _import('modules/talents/talents-list'), name: 'talents-list', meta: { title: '太湖英才列表', isTab: true } },
|
{ path: '/talents-list', component: _import('modules/talents/talents-list'), name: 'talents-list', meta: { title: '太湖英才列表', isTab: true } },
|
||||||
|
|
||||||
|
{ path: '/course-taihumedList', component: _import('modules/course/taihumedList'), name: 'course-taihumedList', meta: { title: '太湖标签', isTab: true } },
|
||||||
|
{ path: '/courses-list', component: _import('modules/talents/courses-list'), name: 'courses-list', meta: { title: '查看课程', isTab: true } },
|
||||||
],
|
],
|
||||||
beforeEnter (to, from, next) {
|
beforeEnter (to, from, next) {
|
||||||
let token = Vue.cookie.get('token')
|
let token = Vue.cookie.get('token')
|
||||||
|
|||||||
375
src/views/components/commonBookTags/shopproductTableTaihu.vue
Normal file
375
src/views/components/commonBookTags/shopproductTableTaihu.vue
Normal file
@@ -0,0 +1,375 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-drawer
|
||||||
|
:title="`新增关联${title}`"
|
||||||
|
v-if="drawer"
|
||||||
|
:wrapperClosable="false"
|
||||||
|
:visible.sync="drawer"
|
||||||
|
destroy-on-close
|
||||||
|
direction="rtl"
|
||||||
|
:append-to-body="true"
|
||||||
|
:modal-append-to-body="false"
|
||||||
|
:modal="!isNoModal"
|
||||||
|
size="70%"
|
||||||
|
>
|
||||||
|
<div class="shop_drawer_box demo-drawer__content">
|
||||||
|
<div class="addFormBox">
|
||||||
|
<el-form ref="addForm" label-width="80px" :model="dataForm">
|
||||||
|
<slot name="searchFormItem" :dataForm="dataForm"></slot>
|
||||||
|
|
||||||
|
<el-form-item
|
||||||
|
label=""
|
||||||
|
class="form_item"
|
||||||
|
label-width="20px"
|
||||||
|
style="width: 160px !important"
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
@click="
|
||||||
|
pageIndex = 1;
|
||||||
|
getDataList(bookMarketId);
|
||||||
|
"
|
||||||
|
size="small"
|
||||||
|
>查询</el-button
|
||||||
|
>
|
||||||
|
<el-button @click="handleReset()" size="small" plain
|
||||||
|
>重置</el-button
|
||||||
|
>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<!-- @selection-change="handleSelectionChange" -->
|
||||||
|
<!-- @current-change="handleCurrentChange" -->
|
||||||
|
<el-table
|
||||||
|
ref="table"
|
||||||
|
height="calc(100% - 120px)"
|
||||||
|
:data="dataList"
|
||||||
|
:row-key="getRowKeys"
|
||||||
|
border
|
||||||
|
size="mini"
|
||||||
|
highlight-current-row
|
||||||
|
v-loading="dataListLoading"
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<!-- <el-table-column align="center" width="40px">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-radio v-model="currentRow" :label="scope.row"
|
||||||
|
> </el-radio
|
||||||
|
>
|
||||||
|
</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"
|
||||||
|
>{{CustomOperationText?CustomOperationText:'绑定'}}</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<!-- -->
|
||||||
|
</el-table>
|
||||||
|
<el-pagination
|
||||||
|
style="float: right;margin-top: 20px;"
|
||||||
|
@size-change="sizeChangeHandle"
|
||||||
|
@current-change="currentChangeHandle"
|
||||||
|
:current-page="pageIndex"
|
||||||
|
:page-sizes="[10, 20, 50, 100]"
|
||||||
|
:page-size="pageSize"
|
||||||
|
:total="totalPage"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
>
|
||||||
|
</el-pagination>
|
||||||
|
|
||||||
|
<div class="demo-drawer__footer">
|
||||||
|
<!-- <div style="float: right; margin-top: 20px">
|
||||||
|
<el-button @click="close" size="small">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="submit" :loading="loading" size="small">{{ loading ? "提交中 ..." : "确 定"
|
||||||
|
}}</el-button>
|
||||||
|
</div> -->
|
||||||
|
</div>
|
||||||
|
<!-- 弹窗, 新增 / 修改 -->
|
||||||
|
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" @showchooseBookf = "showchooseBookf"></add-or-update>
|
||||||
|
<choose-book v-if="chooseBookVisible" :bookIds = bookIds ref="chooseBook" :chooseBookVisible = chooseBookVisible @closeBookf = "closeBookf"></choose-book> -->
|
||||||
|
</div>
|
||||||
|
</el-drawer>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// import chooseBook from './chooseBook.vue'
|
||||||
|
// import AddOrUpdate from './shopproduct-add-or-update'
|
||||||
|
export default {
|
||||||
|
props: [
|
||||||
|
"defaultForm",
|
||||||
|
"otherInfo",
|
||||||
|
"marketIdKey",
|
||||||
|
"currentType",
|
||||||
|
"currentId",
|
||||||
|
"title",
|
||||||
|
"isNoModal",
|
||||||
|
"urlList",
|
||||||
|
"CustomOperationText",
|
||||||
|
],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
timer: null,
|
||||||
|
drawer: false,
|
||||||
|
loading: false,
|
||||||
|
currentRow: null,
|
||||||
|
multipleSelectionAll: [], // 所有选中的数据包含跨页数据
|
||||||
|
multipleSelection: [], // 当前页选中的数据
|
||||||
|
idKey: "productId", // 标识列表数据中每一行的唯一键的名称(需要按自己的数据改一下)
|
||||||
|
dataForm: {},
|
||||||
|
bookMarketId: null,
|
||||||
|
dataList: [],
|
||||||
|
publishStatus: false,
|
||||||
|
pageIndex: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
totalPage: 0,
|
||||||
|
dataListLoading: false,
|
||||||
|
dataListSelections: [],
|
||||||
|
addOrUpdateVisible: false,
|
||||||
|
chooseBookVisible: false,
|
||||||
|
bookIds: [],
|
||||||
|
goodsTypeList: []
|
||||||
|
};
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
// AddOrUpdate,
|
||||||
|
// chooseBook
|
||||||
|
},
|
||||||
|
activated() {
|
||||||
|
this.getDataList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleReset() {
|
||||||
|
this.dataForm = {};
|
||||||
|
this.pageIndex = 1;
|
||||||
|
this.getDataList();
|
||||||
|
},
|
||||||
|
submit() {
|
||||||
|
var ids = this.multipleSelection.map(e => e.productId).toString(",");
|
||||||
|
this.$emit("submit", ids);
|
||||||
|
console.log(
|
||||||
|
"🚀 ~ submit ~ this.multipleSelection:",
|
||||||
|
this.multipleSelection
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取商品类型
|
||||||
|
getGoodsTypeList() {
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl("/book/sysdictdata/selectByType/goodsType"),
|
||||||
|
method: "get"
|
||||||
|
}).then(({ data }) => {
|
||||||
|
this.goodsTypeList = data.dataList;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleClose(done) {
|
||||||
|
done();
|
||||||
|
},
|
||||||
|
handleCurrentChange(val) {
|
||||||
|
this.$emit("submit", val.id,val);
|
||||||
|
|
||||||
|
// table组件选中事件,记得加上@selection-change="handleSelectionChange"
|
||||||
|
// this.multipleSelection = val;
|
||||||
|
// this.changePageCoreRecordData();
|
||||||
|
},
|
||||||
|
async open() {
|
||||||
|
this.drawer = true;
|
||||||
|
this.dataForm = {};
|
||||||
|
this.pageIndex = 1;
|
||||||
|
await this.getGoodsTypeList();
|
||||||
|
await this.getDataList();
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.drawer = false;
|
||||||
|
},
|
||||||
|
getRowKeys(row) {
|
||||||
|
return row.productId;
|
||||||
|
},
|
||||||
|
handleSelectionChange(val) {
|
||||||
|
console.log("🚀 ~ handleSelectionChange ~ val:", val);
|
||||||
|
// table组件选中事件,记得加上@selection-change="handleSelectionChange"
|
||||||
|
this.multipleSelection = val;
|
||||||
|
// this.changePageCoreRecordData();
|
||||||
|
},
|
||||||
|
|
||||||
|
closeBookf() {
|
||||||
|
this.chooseBookVisible = false;
|
||||||
|
},
|
||||||
|
showchooseBookf(e) {
|
||||||
|
// 显示图书列表
|
||||||
|
this.chooseBookVisible = true;
|
||||||
|
},
|
||||||
|
// 获取数据列表
|
||||||
|
async getDataList() {
|
||||||
|
var form = {
|
||||||
|
...this.defaultForm,
|
||||||
|
current: this.pageIndex,
|
||||||
|
limit: this.pageSize
|
||||||
|
};
|
||||||
|
this.dataListLoading = true;
|
||||||
|
this.clear();
|
||||||
|
form.page = this.pageIndex;
|
||||||
|
form.current = this.pageIndex;
|
||||||
|
this.$http
|
||||||
|
.request({
|
||||||
|
url: this.$http.adornUrl(`${this.urlList.CanBindProductList}`),
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
...form
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
//默认 无 说明:请求头
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(({ data }) => {
|
||||||
|
console.log('data at line 263:', data)
|
||||||
|
if (data && data.code === 0) {
|
||||||
|
this.dataList = [...data.page[this.otherInfo.httpDataValueName]];
|
||||||
|
this.totalPage = data.page[this.otherInfo.httpDataTotalName];
|
||||||
|
} else {
|
||||||
|
this.dataList = [];
|
||||||
|
this.totalPage = 0;
|
||||||
|
}
|
||||||
|
// setTimeout(async () => {
|
||||||
|
// await this.setSelectRow();
|
||||||
|
// }, 200);
|
||||||
|
this.dataListLoading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
clear() {
|
||||||
|
// this.$refs.table.clearSelection();
|
||||||
|
this.multipleSelection = [];
|
||||||
|
},
|
||||||
|
|
||||||
|
// 每页数
|
||||||
|
sizeChangeHandle(val) {
|
||||||
|
// this.changePageCoreRecordData();
|
||||||
|
this.pageSize = val;
|
||||||
|
this.pageIndex = 1;
|
||||||
|
this.getDataList();
|
||||||
|
},
|
||||||
|
// 当前页
|
||||||
|
currentChangeHandle(val) {
|
||||||
|
// 改变页的时候调用一次
|
||||||
|
// this.changePageCoreRecordData();
|
||||||
|
this.pageIndex = val;
|
||||||
|
this.getDataList();
|
||||||
|
},
|
||||||
|
// 多选
|
||||||
|
selectionChangeHandle(val) {
|
||||||
|
this.dataListSelections = val;
|
||||||
|
},
|
||||||
|
// 新增 / 修改
|
||||||
|
addOrUpdateHandle(id) {
|
||||||
|
this.addOrUpdateVisible = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.addOrUpdate.init(id);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 删除
|
||||||
|
deleteHandle(id) {
|
||||||
|
var ids = id
|
||||||
|
? [id]
|
||||||
|
: this.dataListSelections.map(item => {
|
||||||
|
return item.productId;
|
||||||
|
});
|
||||||
|
this.$confirm(
|
||||||
|
`确定对[id=${ids.join(",")}]进行[${id ? "删除" : "批量删除"}]操作?`,
|
||||||
|
"提示",
|
||||||
|
{
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}
|
||||||
|
).then(() => {
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl("/book/shopproduct/delete"),
|
||||||
|
method: "post",
|
||||||
|
data: this.$http.adornData(ids, false)
|
||||||
|
}).then(({ data }) => {
|
||||||
|
if (data && data.code === 0) {
|
||||||
|
this.$message({
|
||||||
|
message: "操作成功",
|
||||||
|
type: "success",
|
||||||
|
duration: 1500,
|
||||||
|
onClose: () => {
|
||||||
|
this.getDataList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$message.error(data.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
SwitchChange(event) {
|
||||||
|
/*点击时他会自动把你绑定的值变更,直接去请求数据就可以了*/
|
||||||
|
var parms = {
|
||||||
|
publishStatus: event.publishStatus,
|
||||||
|
productId: event.productId
|
||||||
|
};
|
||||||
|
// console.log(parms)
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl("/book/shopproduct/update"),
|
||||||
|
method: "post",
|
||||||
|
data: parms
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
this.$message({
|
||||||
|
message: "成功",
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
|
this.loading = false;
|
||||||
|
this.getDataList();
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
this.loading = false;
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
console.log(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.shop_drawer_box {
|
||||||
|
padding: 20px !important;
|
||||||
|
padding-top: 0px !important;
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.addFormBox {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
// overflow: hidden;
|
||||||
|
.form_item {
|
||||||
|
width: 33%;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep.el-drawer__header {
|
||||||
|
margin-bottom: 10px !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
1171
src/views/modules/course/taihumedList.vue
Normal file
1171
src/views/modules/course/taihumedList.vue
Normal file
File diff suppressed because it is too large
Load Diff
311
src/views/modules/talents/courses-list.vue
Normal file
311
src/views/modules/talents/courses-list.vue
Normal file
@@ -0,0 +1,311 @@
|
|||||||
|
<template>
|
||||||
|
<div class="mod-config">
|
||||||
|
<el-form
|
||||||
|
:inline="true"
|
||||||
|
@keyup.enter.native="getDataList()"
|
||||||
|
>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="addHandle()"
|
||||||
|
>绑定课程</el-button
|
||||||
|
>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<el-table
|
||||||
|
:data="dataList"
|
||||||
|
border
|
||||||
|
v-loading="dataListLoading"
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
label="课程ID"
|
||||||
|
width="70"
|
||||||
|
align="center"
|
||||||
|
prop="id"
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="title"
|
||||||
|
header-align="center"
|
||||||
|
align="center"
|
||||||
|
label="课程名称"
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
header-align="center"
|
||||||
|
align="center"
|
||||||
|
label="课程图"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<img
|
||||||
|
v-if="scope.row.image != ''"
|
||||||
|
:src="scope.row.image"
|
||||||
|
width="25"
|
||||||
|
height="35"
|
||||||
|
class="tableImg"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="toSociologySort"
|
||||||
|
header-align="center"
|
||||||
|
align="center"
|
||||||
|
label="排序"
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
fixed="right"
|
||||||
|
header-align="center"
|
||||||
|
align="center"
|
||||||
|
label="操作"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
@click="dataFormDelete(scope.row)"
|
||||||
|
size="mini"
|
||||||
|
>解绑</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<el-pagination
|
||||||
|
@size-change="sizeChangeHandle"
|
||||||
|
@current-change="currentChangeHandle"
|
||||||
|
:current-page="pageIndex"
|
||||||
|
:page-sizes="[10, 20, 50, 100]"
|
||||||
|
:page-size="pageSize"
|
||||||
|
:total="total"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
>
|
||||||
|
</el-pagination>
|
||||||
|
|
||||||
|
|
||||||
|
<commonShopTable
|
||||||
|
title="课程"
|
||||||
|
:otherInfo="{
|
||||||
|
httpType: 'raw',
|
||||||
|
httpDataValueName: 'records',
|
||||||
|
httpDataTotalName: 'total'
|
||||||
|
}"
|
||||||
|
:defaultForm="{
|
||||||
|
title: dataForm.title
|
||||||
|
}"
|
||||||
|
:urlList="urlList"
|
||||||
|
:currentId="id"
|
||||||
|
marketIdKey="marketId"
|
||||||
|
ref="commonShopTable"
|
||||||
|
currentType="bookMarketId"
|
||||||
|
@submit="handleSubmitShopTable"
|
||||||
|
>
|
||||||
|
<template slot="searchFormItem" slot-scope="slotProps">
|
||||||
|
<el-form-item label="课程名称" prop="title" class="form_item">
|
||||||
|
<el-input
|
||||||
|
size="small"
|
||||||
|
placeholder="请输入课程名称"
|
||||||
|
style="width: 100%"
|
||||||
|
v-model="dataForm.title"
|
||||||
|
clearable
|
||||||
|
>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template slot="tableItem" slot-scope="slotProps">
|
||||||
|
<el-table-column label="课程ID" width="70" align="center" prop="id"></el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="title"
|
||||||
|
header-align="center"
|
||||||
|
align="center"
|
||||||
|
label="课程名称"
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
header-align="center"
|
||||||
|
align="center"
|
||||||
|
label="课程图"
|
||||||
|
width="120"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<img
|
||||||
|
v-if="scope.row.image != ''"
|
||||||
|
:src="scope.row.image"
|
||||||
|
width="25"
|
||||||
|
height="35"
|
||||||
|
class="tableImg"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
</commonShopTable>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import global from "../../common/common.vue"; //引入共用组间
|
||||||
|
import debounce from "lodash/debounce"; //导入lodash中的debounce
|
||||||
|
import commonShopTable from "./shopproductTable.vue";
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
baseUrl: global.baseUrl,
|
||||||
|
current: 1,
|
||||||
|
limit: 10,
|
||||||
|
dataForm: {
|
||||||
|
title: ''
|
||||||
|
},
|
||||||
|
dataListLoading: false,
|
||||||
|
// 数据存储
|
||||||
|
countries: [],
|
||||||
|
provinces: [],
|
||||||
|
cities: [],
|
||||||
|
chinaStatus: false,
|
||||||
|
selectCode: null,
|
||||||
|
selectedProvId: null,
|
||||||
|
changeStatus: false,
|
||||||
|
urlList: {
|
||||||
|
unbind: "/master/taihuTalent/unbindCourseAndTalent",
|
||||||
|
saveShop: "/master/taihuTalent/bindCourseAndTalent",
|
||||||
|
hasBindProductList: "/master/taihuTalent/getCourseListForTalent",
|
||||||
|
CanBindProductList: "/master/taihuTalent/getCourseListCanTalent",
|
||||||
|
},
|
||||||
|
|
||||||
|
title: '',
|
||||||
|
dialogVisible: false,
|
||||||
|
id: null,
|
||||||
|
dataList: [],
|
||||||
|
pageIndex: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
total: 0,
|
||||||
|
isFresh: false,
|
||||||
|
forTaihumedList: [], //课程列表数据
|
||||||
|
associatedGoodsList: [], //已关联商品列表
|
||||||
|
};
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
commonShopTable
|
||||||
|
},
|
||||||
|
activated(){
|
||||||
|
this.id = Number(this.$route.query.id);
|
||||||
|
this.getForTaihumed();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
//获取课程列表
|
||||||
|
getForTaihumed(){
|
||||||
|
this.dataListLoading = true;
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl(`${this.urlList.hasBindProductList}`),
|
||||||
|
method: "post",
|
||||||
|
data: this.$http.adornParams({
|
||||||
|
talentId: this.id,
|
||||||
|
current: this.current,
|
||||||
|
limit: this.limit,
|
||||||
|
title: this.title
|
||||||
|
})
|
||||||
|
}).then(({ data }) => {
|
||||||
|
this.dataListLoading = false;
|
||||||
|
if (data && data.code === 0) {
|
||||||
|
if(data.page.records&&data.page.records.length>0){
|
||||||
|
this.dataList = data.page.records;
|
||||||
|
}else {
|
||||||
|
this.dataList = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 每页数
|
||||||
|
sizeChangeHandle(val) {
|
||||||
|
this.pageSize = val;
|
||||||
|
this.pageIndex = 1;
|
||||||
|
this.getDataList();
|
||||||
|
},
|
||||||
|
// 当前页
|
||||||
|
currentChangeHandle(val) {
|
||||||
|
this.pageIndex = val;
|
||||||
|
this.getDataList();
|
||||||
|
},
|
||||||
|
//新增
|
||||||
|
addHandle(){
|
||||||
|
this.$refs.commonShopTable.open();
|
||||||
|
},
|
||||||
|
|
||||||
|
//点击绑定
|
||||||
|
handleSubmitShopTable: debounce(async function(ids) {
|
||||||
|
await this.$http
|
||||||
|
.request({
|
||||||
|
url: this.$http.adornUrl(`${this.urlList.saveShop}`),
|
||||||
|
method: "post",
|
||||||
|
data: {
|
||||||
|
courseId: ids,
|
||||||
|
talentId: this.id
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(async ({ data }) => {
|
||||||
|
if (data && data.code === 0) {
|
||||||
|
this.$message.success(data.msg);
|
||||||
|
|
||||||
|
if (this.$refs.commonShopTable) {
|
||||||
|
this.$refs.commonShopTable.close();
|
||||||
|
}
|
||||||
|
this.getForTaihumed();
|
||||||
|
} else {
|
||||||
|
this.$message.error(data.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, 200),
|
||||||
|
|
||||||
|
//解绑
|
||||||
|
dataFormDelete(row){
|
||||||
|
this.$confirm("确定解绑该课程?", "提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.$http
|
||||||
|
.request({
|
||||||
|
url: this.$http.adornUrl(`${this.urlList.unbind}`),
|
||||||
|
method: "POST",
|
||||||
|
data: this.$http.adornData({
|
||||||
|
courseId: row.id,
|
||||||
|
talentId: this.id
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.then(({ data }) => {
|
||||||
|
if (data && data.code === 0) {
|
||||||
|
this.$message.success("解绑成功");
|
||||||
|
} else {
|
||||||
|
this.$message.error(data.msg);
|
||||||
|
}
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.getForTaihumed();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" >
|
||||||
|
p{
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.addFormBox {
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.form_item {
|
||||||
|
width: 33%;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
365
src/views/modules/talents/shopproductTable.vue
Normal file
365
src/views/modules/talents/shopproductTable.vue
Normal file
@@ -0,0 +1,365 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-drawer
|
||||||
|
:title="`新增关联${title}`"
|
||||||
|
v-if="drawer"
|
||||||
|
:wrapperClosable="false"
|
||||||
|
:visible.sync="drawer"
|
||||||
|
destroy-on-close
|
||||||
|
direction="rtl"
|
||||||
|
:append-to-body="true"
|
||||||
|
:modal-append-to-body="false"
|
||||||
|
:modal="!isNoModal"
|
||||||
|
size="70%"
|
||||||
|
>
|
||||||
|
<div class="shop_drawer_box demo-drawer__content">
|
||||||
|
<div class="addFormBox">
|
||||||
|
<el-form ref="addForm" label-width="80px" :model="dataForm">
|
||||||
|
<slot name="searchFormItem" :dataForm="dataForm"></slot>
|
||||||
|
|
||||||
|
<el-form-item
|
||||||
|
label=""
|
||||||
|
class="form_item"
|
||||||
|
label-width="20px"
|
||||||
|
style="width: 160px !important"
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
@click="
|
||||||
|
pageIndex = 1;
|
||||||
|
getDataList(bookMarketId);
|
||||||
|
"
|
||||||
|
size="small"
|
||||||
|
>查询</el-button
|
||||||
|
>
|
||||||
|
<el-button @click="handleReset()" size="small" plain
|
||||||
|
>重置</el-button
|
||||||
|
>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<!-- @selection-change="handleSelectionChange" -->
|
||||||
|
<!-- @current-change="handleCurrentChange" -->
|
||||||
|
<el-table
|
||||||
|
ref="table"
|
||||||
|
height="calc(100% - 120px)"
|
||||||
|
:data="dataList"
|
||||||
|
:row-key="getRowKeys"
|
||||||
|
border
|
||||||
|
size="mini"
|
||||||
|
highlight-current-row
|
||||||
|
v-loading="dataListLoading"
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<!-- <el-table-column align="center" width="40px">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-radio v-model="currentRow" :label="scope.row"
|
||||||
|
> </el-radio
|
||||||
|
>
|
||||||
|
</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"
|
||||||
|
>{{CustomOperationText?CustomOperationText:'绑定'}}</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<!-- -->
|
||||||
|
</el-table>
|
||||||
|
<el-pagination
|
||||||
|
style="float: right;margin-top: 20px;"
|
||||||
|
@size-change="sizeChangeHandle"
|
||||||
|
@current-change="currentChangeHandle"
|
||||||
|
:current-page="pageIndex"
|
||||||
|
:page-sizes="[10, 20, 50, 100]"
|
||||||
|
:page-size="pageSize"
|
||||||
|
:total="totalPage"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
>
|
||||||
|
</el-pagination>
|
||||||
|
|
||||||
|
<div class="demo-drawer__footer">
|
||||||
|
<!-- <div style="float: right; margin-top: 20px">
|
||||||
|
<el-button @click="close" size="small">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="submit" :loading="loading" size="small">{{ loading ? "提交中 ..." : "确 定"
|
||||||
|
}}</el-button>
|
||||||
|
</div> -->
|
||||||
|
</div>
|
||||||
|
<!-- 弹窗, 新增 / 修改 -->
|
||||||
|
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" @showchooseBookf = "showchooseBookf"></add-or-update>
|
||||||
|
<choose-book v-if="chooseBookVisible" :bookIds = bookIds ref="chooseBook" :chooseBookVisible = chooseBookVisible @closeBookf = "closeBookf"></choose-book> -->
|
||||||
|
</div>
|
||||||
|
</el-drawer>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// import chooseBook from './chooseBook.vue'
|
||||||
|
// import AddOrUpdate from './shopproduct-add-or-update'
|
||||||
|
export default {
|
||||||
|
props: [
|
||||||
|
"defaultForm",
|
||||||
|
"otherInfo",
|
||||||
|
"marketIdKey",
|
||||||
|
"currentType",
|
||||||
|
"currentId",
|
||||||
|
"title",
|
||||||
|
"isNoModal",
|
||||||
|
"urlList",
|
||||||
|
"CustomOperationText",
|
||||||
|
],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
timer: null,
|
||||||
|
drawer: false,
|
||||||
|
loading: false,
|
||||||
|
currentRow: null,
|
||||||
|
multipleSelectionAll: [], // 所有选中的数据包含跨页数据
|
||||||
|
multipleSelection: [], // 当前页选中的数据
|
||||||
|
idKey: "productId", // 标识列表数据中每一行的唯一键的名称(需要按自己的数据改一下)
|
||||||
|
dataForm: {},
|
||||||
|
bookMarketId: null,
|
||||||
|
dataList: [],
|
||||||
|
publishStatus: false,
|
||||||
|
pageIndex: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
totalPage: 0,
|
||||||
|
dataListLoading: false,
|
||||||
|
dataListSelections: [],
|
||||||
|
addOrUpdateVisible: false,
|
||||||
|
chooseBookVisible: false,
|
||||||
|
bookIds: [],
|
||||||
|
goodsTypeList: []
|
||||||
|
};
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
|
||||||
|
},
|
||||||
|
activated() {
|
||||||
|
this.getDataList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleReset() {
|
||||||
|
this.dataForm = {};
|
||||||
|
this.pageIndex = 1;
|
||||||
|
this.getDataList();
|
||||||
|
},
|
||||||
|
submit() {
|
||||||
|
var ids = this.multipleSelection.map(e => e.productId).toString(",");
|
||||||
|
this.$emit("submit", ids);
|
||||||
|
console.log(
|
||||||
|
"🚀 ~ submit ~ this.multipleSelection:",
|
||||||
|
this.multipleSelection
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取商品类型
|
||||||
|
getGoodsTypeList() {
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl("/book/sysdictdata/selectByType/goodsType"),
|
||||||
|
method: "get"
|
||||||
|
}).then(({ data }) => {
|
||||||
|
this.goodsTypeList = data.dataList;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleClose(done) {
|
||||||
|
done();
|
||||||
|
},
|
||||||
|
handleCurrentChange(val) {
|
||||||
|
console.log("🚀 ~ handleSelectionChange ~ val:", val);
|
||||||
|
|
||||||
|
this.$emit("submit", val.id,val);
|
||||||
|
},
|
||||||
|
async open() {
|
||||||
|
this.drawer = true;
|
||||||
|
this.dataForm = {};
|
||||||
|
this.pageIndex = 1;
|
||||||
|
await this.getGoodsTypeList();
|
||||||
|
await this.getDataList();
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.drawer = false;
|
||||||
|
},
|
||||||
|
getRowKeys(row) {
|
||||||
|
return row.productId;
|
||||||
|
},
|
||||||
|
handleSelectionChange(val) {
|
||||||
|
console.log("🚀 ~ handleSelectionChange ~ val:", val);
|
||||||
|
// table组件选中事件,记得加上@selection-change="handleSelectionChange"
|
||||||
|
this.multipleSelection = val;
|
||||||
|
},
|
||||||
|
|
||||||
|
closeBookf() {
|
||||||
|
this.chooseBookVisible = false;
|
||||||
|
},
|
||||||
|
showchooseBookf(e) {
|
||||||
|
// 显示图书列表
|
||||||
|
this.chooseBookVisible = true;
|
||||||
|
},
|
||||||
|
// 获取数据列表
|
||||||
|
async getDataList() {
|
||||||
|
var form = {
|
||||||
|
...this.defaultForm,
|
||||||
|
current: this.pageIndex,
|
||||||
|
limit: this.pageSize,
|
||||||
|
talentId: this.currentId
|
||||||
|
};
|
||||||
|
this.dataListLoading = true;
|
||||||
|
this.clear();
|
||||||
|
form.page = this.pageIndex;
|
||||||
|
form.current = this.pageIndex;
|
||||||
|
this.$http
|
||||||
|
.request({
|
||||||
|
url: this.$http.adornUrl(`${this.urlList.CanBindProductList}`),
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
...form
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(({ data }) => {
|
||||||
|
console.log('data at line 263:', data)
|
||||||
|
if (data && data.code === 0) {
|
||||||
|
this.dataList = [...data.page[this.otherInfo.httpDataValueName]];
|
||||||
|
this.totalPage = data.page[this.otherInfo.httpDataTotalName];
|
||||||
|
} else {
|
||||||
|
this.dataList = [];
|
||||||
|
this.totalPage = 0;
|
||||||
|
}
|
||||||
|
this.dataListLoading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
clear() {
|
||||||
|
this.multipleSelection = [];
|
||||||
|
},
|
||||||
|
|
||||||
|
// 每页数
|
||||||
|
sizeChangeHandle(val) {
|
||||||
|
this.pageSize = val;
|
||||||
|
this.pageIndex = 1;
|
||||||
|
this.getDataList();
|
||||||
|
},
|
||||||
|
// 当前页
|
||||||
|
currentChangeHandle(val) {
|
||||||
|
// 改变页的时候调用一次
|
||||||
|
this.pageIndex = val;
|
||||||
|
this.getDataList();
|
||||||
|
},
|
||||||
|
// 多选
|
||||||
|
selectionChangeHandle(val) {
|
||||||
|
this.dataListSelections = val;
|
||||||
|
},
|
||||||
|
// 新增 / 修改
|
||||||
|
addOrUpdateHandle(id) {
|
||||||
|
this.addOrUpdateVisible = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.addOrUpdate.init(id);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 删除
|
||||||
|
deleteHandle(id) {
|
||||||
|
var ids = id
|
||||||
|
? [id]
|
||||||
|
: this.dataListSelections.map(item => {
|
||||||
|
return item.productId;
|
||||||
|
});
|
||||||
|
this.$confirm(
|
||||||
|
`确定对[id=${ids.join(",")}]进行[${id ? "删除" : "批量删除"}]操作?`,
|
||||||
|
"提示",
|
||||||
|
{
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}
|
||||||
|
).then(() => {
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl("/book/shopproduct/delete"),
|
||||||
|
method: "post",
|
||||||
|
data: this.$http.adornData(ids, false)
|
||||||
|
}).then(({ data }) => {
|
||||||
|
if (data && data.code === 0) {
|
||||||
|
this.$message({
|
||||||
|
message: "操作成功",
|
||||||
|
type: "success",
|
||||||
|
duration: 1500,
|
||||||
|
onClose: () => {
|
||||||
|
this.getDataList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$message.error(data.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
SwitchChange(event) {
|
||||||
|
/*点击时他会自动把你绑定的值变更,直接去请求数据就可以了*/
|
||||||
|
var parms = {
|
||||||
|
publishStatus: event.publishStatus,
|
||||||
|
productId: event.productId
|
||||||
|
};
|
||||||
|
// console.log(parms)
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl("/book/shopproduct/update"),
|
||||||
|
method: "post",
|
||||||
|
data: parms
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
this.$message({
|
||||||
|
message: "成功",
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
|
this.loading = false;
|
||||||
|
this.getDataList();
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
this.loading = false;
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
console.log(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.shop_drawer_box {
|
||||||
|
padding: 20px !important;
|
||||||
|
padding-top: 0px !important;
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.addFormBox {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
// overflow: hidden;
|
||||||
|
.form_item {
|
||||||
|
width: 33%;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep.el-drawer__header {
|
||||||
|
margin-bottom: 10px !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -81,6 +81,17 @@
|
|||||||
label="操作"
|
label="操作"
|
||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
<router-link
|
||||||
|
:to="{
|
||||||
|
path: '/courses-list',
|
||||||
|
query: { id: scope.row.id }
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
size="small"
|
||||||
|
>查看课程</el-button>
|
||||||
|
</router-link>
|
||||||
<el-button
|
<el-button
|
||||||
type="text"
|
type="text"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -256,6 +267,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import global from "../../common/common.vue"; //引入共用组间
|
import global from "../../common/common.vue"; //引入共用组间
|
||||||
|
import debounce from "lodash/debounce"; //导入lodash中的debounce
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -350,8 +362,16 @@ export default {
|
|||||||
chinaStatus: false,
|
chinaStatus: false,
|
||||||
selectCode: null,
|
selectCode: null,
|
||||||
selectedProvId: null,
|
selectedProvId: null,
|
||||||
changeStatus: false
|
changeStatus: false,
|
||||||
|
urlList: {
|
||||||
|
saveShop: "/master/taihuTalent/bindCourseAndTalent",
|
||||||
|
hasBindProductList: "/master/taihuTalent/getCourseListForTalent",
|
||||||
|
CanBindProductList: "/master/taihuTalent/getCourseListCanTalent"
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
|
||||||
},
|
},
|
||||||
activated(){
|
activated(){
|
||||||
this.getDataList();
|
this.getDataList();
|
||||||
@@ -378,6 +398,7 @@ export default {
|
|||||||
this.dataListLoading = false;
|
this.dataListLoading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
loadAll(queryString, cb) {
|
loadAll(queryString, cb) {
|
||||||
if (queryString == "") {
|
if (queryString == "") {
|
||||||
return false;
|
return false;
|
||||||
@@ -804,4 +825,13 @@ export default {
|
|||||||
border-color: #17B3A3;
|
border-color: #17B3A3;
|
||||||
color: #17B3A3;
|
color: #17B3A3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.addFormBox {
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.form_item {
|
||||||
|
width: 33%;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user