mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-10 03:16:42 +08:00
提交至本地分支
This commit is contained in:
@@ -9,8 +9,8 @@
|
||||
<div class="two_search">
|
||||
<el-select v-model="query.status" clearable placeholder="全部" style="margin-left: 10px;">
|
||||
<el-option label="未发布" value="0"></el-option>
|
||||
<el-option label="已发布" value="1"></el-option>
|
||||
<el-option label="已停用" value="2"></el-option>
|
||||
<el-option label="已停用" value="1"></el-option>
|
||||
<el-option label="已发布" value="2"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<el-button type="primary" style="margin-left: 10px;" @click="queryData()" icon="el-icon-search">搜索</el-button>
|
||||
@@ -24,21 +24,21 @@
|
||||
<el-container style="margin-left:20px">
|
||||
<el-main >
|
||||
<el-table :data="tableData" border v-loading="loading" style="width: 100%">
|
||||
<el-table-column prop="name" label="名称" show-overflow-tooltip>
|
||||
<el-table-column prop="audienceName" label="名称" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
<span class="previewStyle" @click="viewDetail(scope.row)">{{scope.row.name}}</span>
|
||||
<span class="previewStyle" @click="viewDetail(scope.row)">{{scope.row.audienceName}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="sysCreateTime" label="创建日期" align="center" width="160px"></el-table-column>
|
||||
<el-table-column prop="users" label="人数" width="50px" align="center"></el-table-column>
|
||||
<el-table-column prop="creatAt" label="创建日期" align="center" width="160px"></el-table-column>
|
||||
<el-table-column prop="totalMember" label="人数" width="50px" align="center"></el-table-column>
|
||||
<el-table-column prop="status" label="状态" width="80px" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.status == 1">已发布</span>
|
||||
<span v-if="scope.row.status == 2">已发布</span>
|
||||
<span v-if="scope.row.status == 0">未发布</span>
|
||||
<span v-if="scope.row.status == 2" style="color: #da0000;">已停用</span>
|
||||
<span v-if="scope.row.status == 1" style="color: #da0000;">已停用</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="gtype" label="类型" width="80px" align="center">
|
||||
<el-table-column prop="audienceType" label="类型" width="80px" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.gtype == 1">普通受众</span>
|
||||
<span v-if="scope.row.gtype == 2">自动受众</span>
|
||||
@@ -49,9 +49,9 @@
|
||||
<el-button type="text" @click="editRouter(1,scope.row)">修改</el-button>
|
||||
<el-button type="text" @click="copyDialog(scope.row)">复制</el-button>
|
||||
<el-button type="text" v-if="scope.row.status == 0" @click="publish(1,scope.row)">发布</el-button>
|
||||
<el-button type="text" v-if="scope.row.status == 1" @click="publish(2,scope.row)">停用</el-button>
|
||||
<el-button type="text" v-if="scope.row.status == 2" @click="publish(1,scope.row)">启用</el-button>
|
||||
<el-button v-if="scope.row.deletable" type="text" @click="del(scope.row)">删除</el-button>
|
||||
<el-button type="text" v-if="scope.row.status == 1" @click="publish(2,scope.row)">启用</el-button>
|
||||
<el-button type="text" v-if="scope.row.status == 2" @click="publish(1,scope.row)">停用</el-button>
|
||||
<el-button type="text" v-if="scope.row.status == 0 || scope.row.status == 1" @click="deleteItem(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -102,6 +102,8 @@
|
||||
<script>
|
||||
import usergroupApi from "@/api/modules/usergroup";
|
||||
import apiDeleteCheck from "@/api/modules/course";
|
||||
import apiAudience from "@/api/boe/audience.js";
|
||||
import { mapGetters } from 'vuex';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -126,16 +128,18 @@
|
||||
mounted() {
|
||||
this.loadData(this.page,this.query);
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['userInfo'])
|
||||
},
|
||||
methods: {
|
||||
reset(){
|
||||
this.page.pageIndex = 1;
|
||||
this.query.name = ''
|
||||
this.query.status = ''
|
||||
|
||||
this.loadData(this.page,this.query);
|
||||
},
|
||||
handleSizePushChange(val){
|
||||
|
||||
handleSizePushChange(val){
|
||||
this.page.pageSize = val
|
||||
this.page.pageIndex = 1
|
||||
this.loadData(this.page,this.query);
|
||||
@@ -169,28 +173,53 @@
|
||||
this.loadData(this.page, this.query);
|
||||
},
|
||||
loadData(page, params = {}){
|
||||
this.loading = true;
|
||||
|
||||
if(this.query.status == ''){this.query.status = null;}
|
||||
let req = {
|
||||
// ownerId:'965342027497607168', // 开发测试时使用
|
||||
ownerId:this.userInfo.aid, // 正式环境使用
|
||||
status:this.query.status,
|
||||
audienceName:params.name,
|
||||
page:page.pageIndex,
|
||||
pageSize:page.pageSize
|
||||
}
|
||||
params.pageIndex = page.pageIndex;
|
||||
params.pageSize = page.pageSize;
|
||||
usergroupApi.list(Object.assign(params, this.query)).then((res) => {
|
||||
if (res.status == 200) {
|
||||
const result = res.result;
|
||||
let ids=[];
|
||||
result.list.forEach(item=>{
|
||||
item.deletable=false;
|
||||
ids.push(item.id);
|
||||
})
|
||||
this.tableData = result.list;
|
||||
this.page.total = result.count;
|
||||
if(ids.length>0){
|
||||
this.checkAllowDelete(ids);
|
||||
this.loading = true;
|
||||
apiAudience.list(req).then(res => {
|
||||
if (res.status == 200) {
|
||||
this.tableData = res.result.audienceList;
|
||||
this.page.total = res.result.totalElement;
|
||||
this.loading = false;
|
||||
} else {
|
||||
this.$message({ type: "error", message: "查询失败:"+res.message,offset:50});
|
||||
}
|
||||
this.loading = false;
|
||||
}else{
|
||||
this.$message({ type: "error", message: "查询失败:"+res.message,offset:50});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// this.loading = true;
|
||||
// params.pageIndex = page.pageIndex;
|
||||
// params.pageSize = page.pageSize;
|
||||
// usergroupApi.list(Object.assign(params, this.query)).then((res) => {
|
||||
// if (res.status == 200) {
|
||||
// const result = res.result;
|
||||
// let ids=[];
|
||||
// result.list.forEach(item=>{
|
||||
// item.deletable=false;
|
||||
// ids.push(item.id);
|
||||
// })
|
||||
// this.tableData = result.list;
|
||||
// this.page.total = result.count;
|
||||
// if(ids.length>0){
|
||||
// this.checkAllowDelete(ids);
|
||||
// }
|
||||
// this.loading = false;
|
||||
// }else{
|
||||
// this.$message({ type: "error", message: "查询失败:"+res.message,offset:50});
|
||||
// }
|
||||
// });
|
||||
},
|
||||
|
||||
checkAllowDelete(ids){
|
||||
if(ids.length==0){
|
||||
return;
|
||||
@@ -210,6 +239,24 @@
|
||||
this.page.pageIndex = pageIndex;
|
||||
this.loadData(this.page,this.query);
|
||||
},
|
||||
|
||||
// 删除受众
|
||||
deleteItem(row){
|
||||
this.$confirm('您确定要删除所选受众吗?', '删除提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
let req = {audienceId:row.id}
|
||||
apiAudience.delAudience(req).then((res) => {
|
||||
if (res.status == 200) {
|
||||
this.loadData(this.page,this.query);
|
||||
this.$message({ type: "success", message: "删除受众成功",offset:50});
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
del(row){
|
||||
this.$confirm('您确定要删除所选受众吗?', '删除提示', {
|
||||
confirmButtonText: '确定',
|
||||
@@ -231,19 +278,18 @@
|
||||
},
|
||||
publish(status,row){
|
||||
let opt = "发布";
|
||||
if(status === 0){
|
||||
opt = "取消发布";
|
||||
}else if(status === 1){
|
||||
opt="启用";
|
||||
}else if(status === 2){
|
||||
opt="停用";
|
||||
}
|
||||
if(row.status == 1){opt="启用";}
|
||||
if(row.status == 2){opt="停用";}
|
||||
this.$confirm('您确定要'+opt+'所选受众吗?', '删除提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
usergroupApi.publish(status,row.id).then((res) => {
|
||||
let req = {
|
||||
audienceId:row.id,
|
||||
status:status
|
||||
}
|
||||
apiAudience.changeStatus(req).then((res) => {
|
||||
if (res.status == 200) {
|
||||
row.status=status;
|
||||
this.$message({ type: "success", message: opt+"受众成功",offset:50});
|
||||
@@ -253,7 +299,34 @@
|
||||
}).catch((res) => {
|
||||
this.$message({ type: "error", message: res.message ,offset:50});
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
|
||||
// let opt = "发布";
|
||||
// if(status === 0){
|
||||
// opt = "取消发布";
|
||||
// }else if(status === 1){
|
||||
// opt="启用";
|
||||
// }else if(status === 2){
|
||||
// opt="停用";
|
||||
// }
|
||||
// this.$confirm('您确定要'+opt+'所选受众吗?', '删除提示', {
|
||||
// confirmButtonText: '确定',
|
||||
// cancelButtonText: '取消',
|
||||
// type: 'warning'
|
||||
// }).then(() => {
|
||||
// usergroupApi.publish(status,row.id).then((res) => {
|
||||
// if (res.status == 200) {
|
||||
// row.status=status;
|
||||
// this.$message({ type: "success", message: opt+"受众成功",offset:50});
|
||||
// }else{
|
||||
// this.$message({ type: "error", message: res.message ,offset:50});
|
||||
// }
|
||||
// }).catch((res) => {
|
||||
// this.$message({ type: "error", message: res.message ,offset:50});
|
||||
// });
|
||||
// })
|
||||
},
|
||||
copyDialog(row){
|
||||
this.copyUserGroupShow = true;
|
||||
|
||||
Reference in New Issue
Block a user