Merge branch 'pre-master' into 'master'

Pre master

See merge request !9
This commit is contained in:
huangshengfa
2023-03-09 20:09:30 +08:00
20 changed files with 1570 additions and 343 deletions

View File

@@ -54,13 +54,18 @@ const courseList = function(data) {
}
/**
* 删除课程
* 删除学习的课程,已经不再使用,换成新的
* @param {Object} ms_timeline_kid
*/
const delLearning = function(ms_timeline_kid) {
return ajax.post('/b1/system/user/ms-timeline-delete',{ms_timeline_kid});
}
/**新的删除学习的课程的接口,参数courseRegId 对应的课程的id */
const newDelLearning = function(courseRegId) {
return ajax.post('/b1/system/user/delete-course-reg',{courseRegId});
}
/**
* 根据用户的kid获取用户的受众权限
*
@@ -76,5 +81,6 @@ export default {
reportList,
courseList,
delLearning,
newDelLearning,
audience
}

View File

@@ -1,6 +1,6 @@
/** 管理端接口 **/
import ajax from '../unionAjax.js';
const baseURL ="/manageApi";
const baseURL = process.env.VUE_APP_MANAGER_API_PATH;
/**用户的待办任务数量*/
const getTaskNum = function(){
@@ -21,7 +21,13 @@ const userTaskList = function(data){
return ajax.postJson(baseURL,'/todoTask/queryTodoTaskDetail',data);
}
/**删除学习,取消报名*/
const userDeleteStudy = function(data){
return ajax.postJson(baseURL,'/stu/project/stuCancelEnrollment',data);
}
export default {
getTaskNum,
userTaskList
userTaskList,
userDeleteStudy
}

View File

@@ -68,10 +68,10 @@ const revokeSubmit = function(id) {
/**
* 复制课程
* @param {Object} id
* @param {Object}
*/
const copyCourse = function(id) {
return ajax.post('/xboe/m/course/manage/copy', {id});
const copyCourse = function(data) {
return ajax.post('/xboe/m/course/manage/copy',data);
}
/*
查询课程是否有重复名称

View File

@@ -370,6 +370,12 @@ const ids=function (data){
const followIds=function (data){
return ajax.postJson('/xboe/school/study/course/follow-ids',data);
}
/**从ES中查询我学习的课程数据*/
const myStudysFromES=function (data){
return ajax.post('/xboe/school/study/es/search',data);
}
export default {
hasSignup,
signup,
@@ -399,6 +405,7 @@ export default {
myAssessList,
myExamList2,
myCourseStudy,
myStudysFromES,
deleteSignUp,
ids,
followIds

View File

@@ -183,6 +183,9 @@
<div v-if="coursewareInfo.content.contentType == 41">
<div class="picture-text" v-html="coursewareInfo.content.content"></div>
</div>
<div v-if="coursewareInfo.content.contentType == 50">
<iframe v-if="scormUrl" :src="scormUrl" frameborder="0" border="0px" style="width:100%;height:510px;border:0px;"></iframe>
</div>
<div v-if="coursewareInfo.content.contentType == 52">
<div v-if="coursewareInfo.content.content!=''">
<!-- <hyper-link :content="coursewareInfo.content"></hyper-link> -->
@@ -269,7 +272,7 @@ export default {
pdfPreview,
videoPlayer,
audioPlayer,
chooseOrg
chooseOrg,
// hyperLink
},
computed: {
@@ -303,6 +306,7 @@ export default {
converStatus:4,
courseType: courseType,
isEdit: true,
scormUrl:'',
homeworkInfo: {},
examInfo: {},
assessInfo: {},
@@ -703,6 +707,35 @@ export default {
$this.$message.error('加载pdf课件文件失败');
}
});
}
if($this.coursewareInfo.content.contentType == 50){
apiCourseFile.detail(con.contentRefId).then(scormFile => {
if (!scormFile.status == 200) {
$this.$message.error('加载SCORM课件失败');
}else{
var curContent=scormFile.result;
//console.log(curContent,'curContent')
if(!curContent.content){
this.$message({type: 'error',message: '无SCORM内容SCORM包解析失败'});
return;
}
//scorm课件的内容取第一个sco
var scorm=JSON.parse(curContent.content);
//console.log(scorm,'scorm')
if(scorm){
let urlPre=window.location.protocol;
let configUrl=process.env.VUE_APP_SCORM_URL;
configUrl=urlPre+configUrl.substring(configUrl.indexOf(':')+1);
//这里需要提取的到配置文件中,实际中只需要传 rowId就可以了
this.scormUrl=configUrl+'?mode=preview&scormId='+curContent.id;//播放的首页
}else{
this.$message({type: 'error',message: 'SCORM包解析失败'});
}
}
});
}
} else if (con.sortIndex == 2) {
$this.homeworkInfo = con;

View File

@@ -202,6 +202,9 @@
<!-- <iframe :src="contentData.content" style="width: 100%;border:0px;min-height: 473px;" frameborder="0"></iframe> -->
</div>
</div>
<div v-if="contentData.contentType == 50">
<iframe v-if="scormUrl" :src="scormUrl" frameborder="0" border="0px" style="width:100%;height:510px;border:0px;"></iframe>
</div>
<div v-if="contentData.contentType == 60">
<homework :showTest="showTest" :showRecord="isDetails" :showSubmit="false" :content="contentData" ></homework>
</div>
@@ -346,6 +349,7 @@ export default {
isEdit: true,
fileBaseUrl: this.$xpage.constants.fileBaseUrl,
contentData: {},
scormUrl:'',
curCFile:{},//课件内容
getType: getType,
btnLoading: false,
@@ -763,6 +767,31 @@ export default {
}
});
}else if(r.contentType == 50){
apiCourseFile.detail(r.contentRefId).then(scormFile => {
if (!scormFile.status == 200) {
$this.$message.error('加载SCORM课件失败');
}else{
var curContent=scormFile.result;
//console.log(curContent,'curContent')
if(!curContent.content){
this.$message({type: 'error',message: '无SCORM内容SCORM包解析失败'});
return;
}
//scorm课件的内容取第一个sco
var scorm=JSON.parse(curContent.content);
//console.log(scorm,'scorm')
if(scorm){
let urlPre=window.location.protocol;
let configUrl=process.env.VUE_APP_SCORM_URL;
configUrl=urlPre+configUrl.substring(configUrl.indexOf(':')+1);
//这里需要提取的到配置文件中,实际中只需要传 rowId就可以了
this.scormUrl=configUrl+'?mode=preview&scormId='+curContent.id;//播放的首页
}else{
this.$message({type: 'error',message: 'SCORM包解析失败'});
}
}
});
}
this.type = 0;
},

View File

@@ -42,7 +42,7 @@
</span> -->
</el-dialog>
<!--微课-->
<el-dialog width="980px" :title="curCourseId == '' ? '新建课程' : '编辑课程'" :visible.sync="weike.dlgShow" :close-on-click-modal="false" custom-class="g-dialog" top="8vh">
<el-dialog v-if="weike.dlgShow" width="980px" :title="curCourseId == '' ? '新建课程' : '编辑课程'" :visible.sync="weike.dlgShow" :close-on-click-modal="false" custom-class="g-dialog" top="8vh">
<el-form label-width="100px" size="small" class="wei-from" style="min-height: 600px;">
<el-row :gutter="10">
<el-col :span="10">
@@ -108,6 +108,9 @@
<el-form-item label="目标人群" required>
<el-input maxlength="50" v-model="courseInfo.forUsers" show-word-limit placeholder="目标人群(限50字以内)"></el-input>
</el-form-item>
<el-form-item v-if="visibleShow" label="学员可见">
<el-checkbox v-model="courseInfo.visible"></el-checkbox>
</el-form-item>
<el-form-item label="受众" v-if="!weike.onlyRequired">
<el-select value-key="id" style="width: 100%;" v-model="courseCrowds" filterable multiple :clearable="false" @remove-tag="removeCrowd" placeholder="请选择">
<el-option v-for="item in userGroupList" :key="item.id" :disabled="item.disabled" :label="item.name" :value="item"></el-option>
@@ -188,7 +191,7 @@
</span>
</el-dialog>
<!--录播课-->
<el-dialog width="980px" :title="curCourseId == '' ? '新建课程' : '编辑课程'" :visible.sync="biaoke.dlgShow" :close-on-click-modal="false" custom-class="g-dialog" top="8vh">
<el-dialog v-if="biaoke.dlgShow" width="980px" :title="curCourseId == '' ? '新建课程' : '编辑课程'" :visible.sync="biaoke.dlgShow" :close-on-click-modal="false" custom-class="g-dialog" top="8vh">
<el-tabs v-model="biaoke.tabIndex" @tab-click="changeBiaokeTab" style="min-height: 600px;">
<el-tab-pane label="课程信息" name="base" style="width: 90%;">
<!-- :rules="rulesTwo" -->
@@ -256,7 +259,14 @@
</el-input>
</el-form-item>
<el-form-item label="目标人群" required>
<el-col :span="14">
<el-input maxlength="50" v-model="courseInfo.forUsers" show-word-limit placeholder="目标人群(限50字以内)"></el-input>
</el-col>
<el-col :span="10">
<el-form-item v-if="visibleShow" label="学员可见">
<el-checkbox v-model="courseInfo.visible"></el-checkbox>
</el-form-item>
</el-col>
</el-form-item>
<el-form-item label="受众"><!--:disabled="item.disabled"-->
<el-select value-key="id" style="width: 100%;" v-model="courseCrowds" filterable multiple :clearable="false" @remove-tag="removeCrowd" placeholder="请选择">
@@ -463,7 +473,13 @@ export default {
status: 1,
summary: '',
overview: '',
visible:true,
refId:'',
refType:''
},
visibleShow:false,
extendRefId:'',
extendRefType:'',
courseTeachers: [], //课程的老师
courseCrowds:[],//课程的用户受众
curContent: { id: '', contentType: 0, csectionId: '', contentName: '', contentRefId: '' }, //当前编辑的内容
@@ -534,6 +550,13 @@ export default {
}
},
mounted() {
let extendFlag=this.$route.query.f; //是否是管理端过来的
this.extendRefId=this.$route.query.refId;
this.extendRefType=this.$route.query.refType;
if(extendFlag && extendFlag=='choose'){
this.visibleShow=true;
}
//console.log("url参数",extendFlag,this.extendRefId,this.extendRefType)
this.curStepIndex = 1; //回到第一步
this.btnLoading = false;
this.getResOwnerTree().then(rs => {
@@ -705,8 +728,13 @@ export default {
status: 1,
summary: '',
overview: '',
// checked:false,
visible:true,
refId:this.extendRefId,
refType:this.extendRefType
};
if(this.extendRefId){
this.courseInfo.visible=false;
}
this.contentInfo.list = [];
this.sectionInfo.list = [];
this.courseTeachers = [];
@@ -842,6 +870,9 @@ export default {
const { result, status } = await apiCourse.detail(id);
if (status === 200) {
//把数据附给三个对象
if(result.course.visible==''){
result.course.visible=true;
}
this.courseInfo = result.course;
this.checked = false;
this.contentInfo.list = result.contents;

View File

@@ -162,7 +162,10 @@ import {userAvatarText,cutFullName} from "@/utils/tools.js";
setCurIdentity(iden){
this.$store.dispatch('SetCurIdentity',iden);
if(iden>2){
this.$router.push('/manager/index');
}
//
// if(this.isTest){
// //this.$router.push('/manage/learningpath');
// location.href='/manage/learningpath';

View File

@@ -258,14 +258,13 @@
<!-- <i class="el-icon-menu"></i> -->
<span slot="title" class="textl">我的考试</span>
</el-menu-item>
<el-menu-item index="/uc/study/path" v-show="isTest">
<!-- <i class="el-icon-menu"></i> -->
<!---去掉->
<!-- <el-menu-item index="/uc/study/path" v-show="isTest">
<span slot="title" class="textl">学习路径图</span>
</el-menu-item>
<el-menu-item index="/uc/study/project" v-show="isTest">
<!-- <i class="el-icon-menu"></i> -->
<span slot="title" class="textl">学习项目</span>
</el-menu-item>
</el-menu-item> -->
<!-- <el-menu-item index="/uc/study/history"> -->
<!-- <i class="el-icon-menu"></i> -->
<!-- <span slot="title" class="textl">历史记录</span>

View File

@@ -109,10 +109,13 @@ export const iframes=[
{title:'考试管理', path:'/iframe/exam/tests',hidden:false,component:'exam/ExamList'},
{title:'案例管理', path:'/iframe/cases/manages',hidden:false,component:'case/ManageList'},
{title:'文章管理', path:'/iframe/article/manages',hidden:false,component:'article/ManageList'},
{title:'受众管理', path:'/iframe/ugroup/manages',hidden:false,component:'manage/UserGroupList'},
{title:'受众管理', path:'/iframe/ugroup/manages',hidden:false,component:'manage/AudienceList'},
{title:'受众编辑', path:'/iframe/ugroup/add',hidden:false,component:'manage/AudienceForm'},
{title:'查看受众', path:'/iframe/ugroup/view',hidden:false,component:'manage/AudienceView'},
{title:'问答管理', path:'/iframe/qa/manages',hidden:false,component:'qa/ManageList'},
{title:'待审核课程', path:'/iframe/course/noapproved',hidden:false,component:'examine/NotApproved'},
{title:'已审核课程', path:'/iframe/course/reviewed',hidden:false,component:'examine/Reviewed'}
]
export function routers(){

View File

@@ -80,24 +80,24 @@ const user = {
})
},
refrashStudyTaskCount({ commit }) {
// apiManage.getTaskNum().then(res=>{
// if(res.code==200){
// commit('SET_StudyTaskCount',res.data.todoTaskCounts);
// }else{
// console.log("获取学习任务数失败:"+res.msg);
// }
// })
apiBoeCourse.cmtaskList({page:1,size:1,get_count:1}).then(res=>{
if(res.status==200){
let count = 0;
if(res.result.count > 0){
count = res.result.count;
}
commit('SET_StudyTaskCount',count);
apiManage.getTaskNum().then(res=>{
if(res.code==200){
commit('SET_StudyTaskCount',res.data.todoTaskCounts);
}else{
console.log("取学习任务数失败:"+res.message);
console.log("取学习任务数失败:"+res.msg);
}
})
// apiBoeCourse.cmtaskList({page:1,size:1,get_count:1}).then(res=>{
// if(res.status==200){
// let count = 0;
// if(res.result.count > 0){
// count = res.result.count;
// }
// commit('SET_StudyTaskCount',count);
// }else{
// console.log("读取学习任务数失败:"+res.message);
// }
// })
},
//设置用户身份
SetIdentity({ commit }, iden) {

View File

@@ -197,7 +197,7 @@
<el-button type="primary" @click="saveUpload()">保存</el-button>
</span>
</el-dialog>
<el-dialog title="预览课件" :close-on-click-modal="false" width="800px" :visible.sync="coursewareShow" custom-class="g-dialog">
<el-dialog v-if="coursewareShow" title="预览课件" :close-on-click-modal="false" width="800px" :visible.sync="coursewareShow" custom-class="g-dialog">
<div>
<div class="courseware-title">{{ fileInfo.name }}</div>
<div class="courseware-icon">
@@ -233,7 +233,7 @@
</div>
<span slot="footer"><el-button type="primary" @click="coursewareShow = false">关闭</el-button></span>
</el-dialog>
<el-dialog title="编辑课件" :close-on-click-modal="false" :visible.sync="editCoursewareShow" custom-class="g-dialog">
<el-dialog v-if="editCoursewareShow" title="编辑课件" :close-on-click-modal="false" :visible.sync="editCoursewareShow" custom-class="g-dialog">
<div>
<el-form ref="form" :model="form" label-width="80px">
<!-- <el-form-item label="资源归属">

View File

@@ -262,7 +262,7 @@
<el-button type="primary" @click="examineData()">提交</el-button>
</span>
</el-dialog>
<el-dialog title="课程详情" :visible.sync="showDetails" @close="examin = {};" width="900px" custom-class="g-dialog">
<el-dialog v-if="showDetails" title="课程详情" :visible.sync="showDetails" @close="examin = {};" width="900px" custom-class="g-dialog">
<div v-show="expandDetails">
<div v-if="examin.detailType == 10"><auditCourse1 :showTest="true" :isDetails="false" :isShow="false" :id="examin.examineId"></auditCourse1></div>
<div v-if="examin.detailType == 20"><auditCourse2 :showTest="true" :isDetails="false" :isShow="false" :id="examin.examineId"></auditCourse2></div>
@@ -374,14 +374,19 @@ export default {
catalogs: {
addNewZhang: false,
addNewCell: false,
}
},
extendRefId:'',
extendRefType:'',
};
},
mounted() {
let chooseFlag=this.$route.query.f;
this.extendRefId=this.$route.query.refId;
this.extendRefType=this.$route.query.refType;
if(chooseFlag && chooseFlag=='choose'){
this.forChoose=true;
}
if(this.$route.query && this.$route.query.page && this.$route.query.page == 'manage') {
this.pageManage=true;
}
@@ -484,12 +489,18 @@ export default {
},
// 复制
copyCourse(item) {
let $this=this;
this.$confirm('您确定要复制此课程吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
apiCourse.copyCourse(item.id).then(rs=>{
let reqdata={
id:item.id,
refId:$this.extendRefId,
refType:$this.extendRefType,
}
apiCourse.copyCourse(reqdata).then(rs=>{
if(rs.status==200){
this.$message.success("复制课程成功");
this.searchData();
@@ -614,6 +625,12 @@ export default {
if(pageReset){
this.page.pageIndex=1;
}
// if(this.extendRefId){
// this.params.refId=this.extendRefId;
// }
// if(this.extendRefType){
// this.params.refType=this.extendRefType;
// }
this.params.resOwner1 = this.resOwner[0];
this.params.resOwner2 = this.resOwner[1];
this.params.resOwner3 = this.resOwner[2];

View File

@@ -197,6 +197,9 @@ export default {
};
},
mounted() {
//为管理端,直接调用此页面时,设置当前人的身份
this.$store.dispatch('SetCurIdentity',2);
this.searchData();
this.getResOwnerTree().then(rs=>{
this.resOwnerListMap=rs;

View File

@@ -0,0 +1,635 @@
<template>
<div class="addAudiences">
<p class="basicInformation">基本信息</p>
<el-form label-position="right" label-width="80px" ref="form" :model="form" :rules="rules">
<el-form-item label="名称:" prop="name">
<el-input placeholder="请填写名称" v-model="form.name" maxlength="50"></el-input>
</el-form-item>
<el-form-item label="描述:">
<el-input placeholder="请填写描述" type="textarea" :autosize="{ minRows: 4, maxRows: 4 }" v-model="form.description" maxlength="200"></el-input>
</el-form-item>
</el-form>
<p class="basicInformation">人员信息</p>
<div class="action">
<el-input style="width: 20%" clearable placeholder="请输入姓名或工号" v-model="searchValue"></el-input>
<el-button type="primary" class="findBtn" size="medium" @click="queryTableData">搜索</el-button>
<el-button type="primary" size="medium" @click="tableDataReset">重置</el-button>
<el-button type="primary" size="medium" @click="openDialog">添加</el-button>
<el-button type="primary" size="medium" @click="openImportDialog">导入</el-button>
<el-button type="primary" size="medium" @click="deleteTableData">批量删除</el-button>
</div>
<el-table ref="multipleTable" :data="tableDataShow" tooltip-effect="dark" style="width: 100%" @selection-change="handleSelectionChange">
<el-table-column type="selection" align="center" width="55"> </el-table-column>
<el-table-column label="姓名" prop="realName" align="center" ></el-table-column>
<el-table-column prop="userNo" label="工号" align="center"></el-table-column>
<el-table-column prop="departName" label="部门" align="center"></el-table-column>
<!-- <el-table-column prop="position" label="岗位" align="center"></el-table-column> -->
</el-table>
<div class="publish">
<el-button @click="saveBack" type="primary" size="large">取消</el-button>
<el-button @click="saveBack(0)" type="primary" size="large">保存</el-button>
<el-button @click="saveBack(1)" type="primary" size="large">保存并发布</el-button>
</div>
<el-dialog title="添加人员" :visible.sync="addUserShow" :close-on-click-modal="false" width="800px" custom-class="g-dialog">
<el-row style="height: 400px;">
<el-col :span="6" style="height: 380px;display: block;overflow-y: scroll;">
<el-tree
ref="treeRef"
node-key="id"
:lazy="true"
:props="departProps"
:load="loadNode"
@node-click="handleDepartNodeClick"
:expand-on-click-node="false"
:default-expanded-keys="['-1']">
</el-tree>
</el-col>
<el-col :span="18">
<div class="action">
<el-input clearable style="width: 30%;margin-left: 10px;" v-model="userQueryForm.keyword" placeholder="请输入姓名或工号"></el-input>
<el-button type="primary" size="medium" @click="queryUserData">搜索</el-button>
<el-button type="primary" class="findBtn" size="medium" @click="reset">重置</el-button>
</div>
<el-table ref="groupUserTable" :data="userData" v-loading="userDataLoading" tooltip-effect="dark" @selection-change="userSelectionChange">
<el-table-column type="selection" align="center" width="55"></el-table-column>
<el-table-column label="姓名" prop="realName" align="center"></el-table-column>
<el-table-column prop="userNo" label="工号" align="center"></el-table-column>
<el-table-column prop="departName" label="部门" align="center"></el-table-column>
<!-- <el-table-column prop="duty" label="岗位" align="center"></el-table-column> -->
</el-table>
<div style="text-align: center;margin-top: 20px;">
<el-pagination layout="prev, pager, next" background :total="userDataPage.total" :current-page.sync="userDataPage.pageIndex"
:page-size="userDataPage.pageSize" @current-change="userDataCurrentChange"></el-pagination>
</div>
</el-col>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="addUserShow= false"> </el-button>
<el-button type="primary" @click="addUserToForm">添加人员</el-button>
</span>
</el-dialog>
<el-dialog center custom-class="g-dialog" title="导入人员数据" :close-on-click-modal="false" :visible.sync="importUserShow">
<div style="padding: 10px 0px;color: #009ae7; ">单个导入文件受众成员请勿超过5000条记录以员工号为准必须是本系统人员</div>
<el-row type="flex" align="middle" justify="start" style="margin-bottom: 10px;">
文件名称<el-input style="width: 200px;" disabled v-model="selectFile"></el-input>
<!-- <el-upload
class="upload-demo"
ref="upload"
action="/systemapi/xboe/usergroup/import"
:headers="{'XBOE-Access-Token':token}"
accept=".xlsx"
name="file"
:on-change="selectFileFun"
:limit="1"
:on-exceed="uploadExceed"
:on-success="uploadSuccess"
:file-list="fileList"
:show-file-list="false"
:auto-upload="false"
> -->
<el-upload
class="upload-demo"
ref="upload"
:action="importUrl"
:headers="{'token':token}"
accept=".xlsx"
name="userExcel"
:on-change="selectFileFun"
:limit="1"
:on-exceed="uploadExceed"
:on-success="uploadSuccess"
:file-list="fileList"
:show-file-list="false"
:auto-upload="false"
>
<el-button slot="trigger" style="margin-left: 10px;" size="small" type="primary">选择</el-button>
<el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">{{uploadBtnValue}}</el-button>
</el-upload>
<el-link style="margin-left:auto" @click="downloadTemplate">下载模板文件</el-link>
</el-row>
<el-row>
<el-table ref="userTable" :max-height="500" :min-height="200" :data="importUserData" tooltip-effect="dark" style="width: 100%;">
<el-table-column label="姓名" prop="realName" align="center" ></el-table-column>
<el-table-column prop="userNo" label="工号" align="center" ></el-table-column>
<el-table-column label="检查结果" align="center" >
<template slot-scope="scope">
<span v-if="scope.row.isSuccess" style="color: green;">正确</span>
<span v-else style="color: red;">错误</span>
</template>
</el-table-column>
<el-table-column label="说明" prop="exception" align="center" ></el-table-column>
<!-- <el-table-column prop="departName" label="部门" align="center" ></el-table-column>
<el-table-column prop="duty" label="岗位" align="center"></el-table-column> -->
</el-table>
<div v-if="importResultStatus == false" style="color: red;padding: 10px 0px;">{{importRepeatUsers}}</div>
<div v-if="importResultStatus" style="color: green;padding: 10px 0px;">{{importRepeatUsers}}</div>
</el-row>
<template #footer>
<el-button @click="importUserShow = false"> </el-button>
<el-button type="primary" @click="addImportUserToForm">确认</el-button>
</template>
</el-dialog>
</div>
</template>
<script>
import { getToken } from '@/utils/token'
import usergroupApi from "@/api/modules/usergroup";
import userApi from "@/api/system/user";
import orgApi from "@/api/system/organiza";
import apiUserBasic from "@/api/boe/userbasic";
import apiAudience from "@/api/boe/audience.js";
export default{
data(){
return{
token:getToken(),
form:{
id:'',
name: '',
gtype: 1,
description:'',
userGroupItems:[]
},
uploadBtnValue:'上传',
isUpdate:false,
importUrl:process.env.VUE_APP_AUDIENCE_IMPORT_URL,
searchValue:'',
tableData:[],
tableDataShow:[],
oldUserGroupItems:[],
rules: {
name: [{ required: true, message: "请输入名称", trigger: "blur" }]
},
multipleSelection:[],
userSelection:[],
addUserShow:false,
departData:[],
departProps: {
children: 'children',
label: 'name'
},
userData:[],
userQueryForm:{keyword:'',departId:''},
userDataLoading:false,
userDataPage:{
total:0,
pageSize:5,
pageIndex:1
},
importUserShow:false,
importUserData:[],
importRepeatUsers:'',
importResultStatus: false, // false: 导入失败true: 导入成功
selectFile:'',
fileList:[],
}
},
mounted() {
let that = this;
if (that.$route.query.id) {
let req = {audienceId:that.$route.query.id}
this.isUpdate = true;
apiAudience.detail(req).then((res) => {
if (res.status == 200) {
that.form = res.result;
that.tableData = res.result.memberList;
that.queryTableData();
}
});
// usergroupApi.detail(that.$route.query.id).then((res) => {
// if (res.status == 200) {
// that.form = res.result;
// // that.oldUserGroupItems = JSON.parse(JSON.stringify( res.result.userGroupItems ));
// that.tableData = res.result.userGroupItems;
// that.queryTableData();
// }
// });
}
},
methods:{
loadNode(node, resolve) {
var parentId = null;
if (node.level === 0) {
resolve([{name:'组织机构树',id:'-1'}]);
}else{
let $this=this;
if(node.level === 1){
parentId = '-1';
apiUserBasic.findOrgsByKeyword('').then(rs=>{
let treeList=[];
rs.result.forEach(item=>{
let node={
id:item.id,
name:item.name,
hrbpId:item.hrbpId,
children:[]
}
treeList.push(node);
});
resolve(treeList);
});
}else{
parentId = node.data.id;
apiUserBasic.getOrgInfo(parentId).then(rs=>{
if(rs.status==200){
let treeList=[];
if(rs.result.directChildList){
rs.result.directChildList.forEach(item=>{
let node={
id:item.id,
name:item.name,
hrbpId:item.hrbpId,
children:[]
}
treeList.push(node);
});
}
resolve(treeList);
}else{
resolve([]);
}
});
}
}
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
openDialog(){
this.addUserShow = true;
this.userQueryForm.keyword = '';
this.userQueryForm.departId = '';
// orgApi.treeList({}).then(res => {
// if (res.status == 200) {
// this.departData = res.result;
// }
// });
//默认不查询
//this.loadUserData(this.userDataPage);
this.queryUserData();
},
reset() {
this.userQueryForm.keyword = '';
this.userQueryForm.departId = '';
this.userDataPage.pageIndex = 1;
this.loadUserData(this.userDataPage, this.userQueryForm);
},
userSelectionChange(val) {
this.userSelection = val;
},
//搜索员工事件
queryUserData(){
this.userDataPage.pageIndex = 1;
this.loadUserData(this.userDataPage, this.userQueryForm);
},
loadUserData(page, params = {}){
this.userDataLoading = true;
params.pageIndex = page.pageIndex;
params.pageSize = page.pageSize;
let req = {
page:page.pageIndex,
pageSize:page.pageSize,
keyword:this.userQueryForm.keyword,
departId:this.userQueryForm.departId
}
apiAudience.userList(req).then(res => {
if (res.status == 200) {
console.log("搜索用户信息");
console.log(res);
this.userData = res.result.userInfoList;
this.userDataPage.total = res.result.totalPage;
this.userDataLoading = false;
}
})
// userApi.list(Object.assign(params, this.userQueryForm)).then(res => {
// if (res.status == 200) {
// this.userData = res.result.list;
// this.userDataPage.total = res.result.count;
// this.userDataLoading = false;
// }
// })
},
userDataCurrentChange(pageIndex){
this.userDataPage.pageIndex = pageIndex;
this.loadUserData(this.userDataPage,this.userQueryForm);
},
handleDepartNodeClick(data){
this.userQueryForm.departId = data.id;
this.loadUserData(this.userDataPage);
},
addUserToForm(){
if(this.userSelection.length == 0){
this.$message({ type: "error", message: '请先选择人员' ,offset:50});
return;
}
for(let i = 0; i < this.userSelection.length; i++){
let isAdd = true;
for(let j = 0; j < this.tableData.length; j++){
if(this.userSelection[i].id == this.tableData[j].id){
isAdd = false;
break;
}
}
if(isAdd){
let userItem = {}
userItem.aid = this.userSelection[i].id;
userItem.id = this.userSelection[i].id;
userItem.realName = this.userSelection[i].realName;
userItem.userNo = this.userSelection[i].userNo;
userItem.departId = this.userSelection[i].departId;
userItem.departName = this.userSelection[i].departName;
userItem.position = this.userSelection[i].duty;
this.tableData.push(userItem);
console.log(111);
console.log(this.tableData);
}
}
this.queryTableData();
this.addUserShow = false;
},
tableDataReset(){
this.searchValue = '';
this.queryTableData();
// this.tableData = JSON.parse(JSON.stringify( this.oldUserGroupItems ));
// this.queryTableData();
},
queryTableData(){
if(this.searchValue){
let tableDataTemp = this.tableData;
this.tableDataShow = this.handleTableDataShow(tableDataTemp,this.searchValue);
}else{
this.tableDataShow = this.tableData;
}
},
// 表格过滤
handleTableDataShow(tableDataTemp, searchValue) {
if (!tableDataTemp || tableDataTemp.length === 0) {
return [];
}
const array = [];
for (let i = 0; i < tableDataTemp.length; i += 1) {
let match = false;
if(tableDataTemp[i]['realName'] || tableDataTemp[i]['userNo']){
match |= (tableDataTemp[i]['realName'].includes(searchValue) || tableDataTemp[i]['userNo'].includes(searchValue));
}
if ( match ) {
array.push({
...tableDataTemp[i]
});
}
}
return array;
},
deleteTableData(){
if(this.multipleSelection.length == 0){
this.$message({ type: "error", message: '请先选择要删除的数据' ,offset:50});
}
let $this=this;
//console.log(this.multipleSelection,'this.multipleSelection');
this.multipleSelection.forEach(item=>{
var delIdx=-1;
$this.tableData.forEach((row,rowIdx)=>{
if(row.id==item.id){
delIdx=rowIdx;
}
});
if(delIdx>-1){
$this.tableData.splice(delIdx, 1)
}
});
this.multipleSelection=[];
this.$refs.multipleTable.clearSelection();
this.queryTableData();
},
openImportDialog(){
this.selectFile = '';
this.importUserData = [];
this.importRepeatUsers='';
this.fileList = [];
this.importUserShow = true;
},
downloadTemplate(){
let fileName = "受众人员导入模板.xlsx";
// usergroupApi.downloadTemplate().then(
// (response) => {
// let blob = new Blob([response], {
// type: 'application/octet-stream',
// })
// if (window.navigator.msSaveOrOpenBlob) {
// navigator.msSaveBlob(blob, fileName)
// } else {
// var link = document.createElement('a')
// link.href = window.URL.createObjectURL(blob)
// link.download = fileName
// link.click()
// //释放内存
// window.URL.revokeObjectURL(link.href)
// }
// },
// (err) => {
// this.$message({
// type: 'error',
// message: '文件下载失败,请重试!',offset:50
// })
// }
// )
let link = document.createElement('a'); //创建a标签
link.style.display = 'none'; //使其隐藏
link.download = this.webBaseUrl+'/template/usergroup_template.xlsx';
link.setAttribute('target', '_blank');
link.href = this.webBaseUrl+'/template/usergroup_template.xlsx'; //赋予文件下载地址
link.setAttribute('download', fileName); //设置下载属性 以及文件名
document.body.appendChild(link); //a标签插至页面中
link.click(); //强制触发a标签事件
document.body.removeChild(link);
},
selectFileFun(file){
this.selectFile = file.name;
},
uploadExceed(files, fileList) {
this.$set(fileList[0], 'raw', files[0]);
this.$set(fileList[0], 'name', files[0].name);
this.$refs['upload'].clearFiles();//清除文件
this.$refs['upload'].handleStart(files[0]);//选择文件后的赋值方法
},
submitUpload(){
if(this.selectFile){this.uploadBtnValue = '上传中';}
this.$refs.upload.submit();
},
uploadSuccess(res){
console.log(111);
if(res.status == 200){
this.importUserData = res.result;
this.importResultStatus = true;
this.importRepeatUsers=res.message;
}else{
this.importResultStatus = false;
this.importRepeatUsers = "导入失败";
this.$message({ type: "error", message: res.message ,offset:50});
}
this.uploadBtnValue = '上传';
},
addImportUserToForm(){
if(this.importUserData.length == 0){
this.$message({ type: "error", message: '请先导入人员' ,offset:50});
return;
}
for(let i = 0; i < this.importUserData.length; i++){
let udata=this.importUserData[i];
if(!udata.isSuccess){
continue;
}
let isAdd = true;
for(let j = 0; j < this.tableData.length; j++){
if(udata.id == this.tableData[j].id){
isAdd = false;
break;
}
}
if(isAdd){
let userItem = {}
// userItem.aid = udata.id;
userItem.id = udata.id;
userItem.realName = udata.realName;
userItem.userNo = udata.userNo;
userItem.departId = udata.departId;
userItem.departName = udata.departName;
userItem.position = udata.duty;
this.tableData.push(userItem);
}
}
this.queryTableData();
this.importUserShow = false;
},
// 保存、保存并发布事件
saveBack(status){
if(status === 1 || status === 0){
this.form.status = status;
}else{
//this.$router.push('/manage/ugroups');
this.$router.push('/iframe/ugroup/manages');
return;
}
this.$refs.form.validate((valid) => {
if (valid) {
this.form.userGroupItems = [];
if(this.tableData.length > 0){
for(let i = 0; i < this.tableData.length; i++){
// this.form.userGroupItems.push({aid:this.tableData[i].aid});
this.form.userGroupItems.push(this.tableData[i].id);
}
}
if (this.form.id != null && this.form.id != "") { // 修改受众
let req = {
audienceId:this.form.id,
audienceName:this.form.name,
description:this.form.description,
type:this.form.gtype,
status:this.form.status,
memberIdList:this.form.userGroupItems
}
apiAudience.update(req).then((res) => {
if (res.status == 200) {
this.$message({ type: "success", message: "修改成功",offset:50 });
//this.$router.push('/manage/ugroups');
this.$router.push('/iframe/ugroup/manages');
}else{
console.log("更新受众异常");
}
})
// usergroupApi
// .update(this.form)
// .then((res) => {
// if (res.status == 200) {
// this.$message({ type: "success", message: "修改成功",offset:50 });
// this.$router.push('/manage/ugroups');
// }
// })
// .catch((res) => {
// this.$message({ type: "error", message: res.message ,offset:50});
// });
} else { // 新增受众
let req = {
audienceId:this.form.id,
audienceName:this.form.name,
description:this.form.description,
type:this.form.gtype,
status:this.form.status,
memberIdList:this.form.userGroupItems
}
apiAudience.update(req).then((res) => {
if (res.status == 200) {
this.$message({ type: "success", message: "新增成功",offset:50 });
//this.$router.push('/manage/ugroups');
this.$router.push('/iframe/ugroup/manages');
}else{
console.log("新增受众异常");
}
})
// usergroupApi
// .save(this.form)
// .then((res) => {
// if (res.status == 200) {
// this.$message({ type: "success", message: "新增成功" ,offset:50});
// this.$router.push('/manage/ugroups');
// }
// })
// .catch((res) => {
// this.$message({ type: "error", message: res.message ,offset:50});
// });
}
}
});
}
}
}
</script>
<style lang="scss" scoped>
::v-deep .el-tree-node:focus>.el-tree-node__content {
background-color:#cddef8;
}
.addAudiences{
.basicInformation{
margin: 0;
padding: 15px 0;
border-bottom: 1px solid rgb(219, 219, 219);
}
.el-form{
margin-top:20px;
}
.action{
margin: 20px 0;
display: flex;
justify-content: flex-end;
align-items: center;
.el-input{
margin-right: 10px;
}
.findBtn{
margin-right: auto;
}
}
.publish{
display: flex;
justify-content: center;
align-items: center;
padding: 10px 0;
}
}
</style>

View File

@@ -0,0 +1,396 @@
<template>
<el-container>
<el-header>
<div style="display: flex; padding:12px 12px 0 0px;">
<div style="display: flex;justify-content:flex-start;">
<div class="one_search">
<el-input v-model="query.name" placeholder="名称" clearable></el-input>
</div>
<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-select>
</div>
<el-button type="primary" style="margin-left: 10px;" @click="queryData()" icon="el-icon-search">搜索</el-button>
</div>
<div style="margin-left: 10px;"><el-button icon="el-icon-refresh-right" type="primary" @click="reset">重置</el-button></div>
<div>
<el-button type="primary" style="margin-left: 10px;" @click="jumpRouter(1)" icon="el-icon-plus">添加受众</el-button>
</div>
</div>
</el-header>
<el-container style="margin-left:20px">
<el-main >
<el-table :data="tableData" border v-loading="loading" style="width: 100%">
<el-table-column prop="audienceName" label="名称" show-overflow-tooltip>
<template slot-scope="scope">
<span class="previewStyle" @click="viewDetail(scope.row)">{{scope.row.audienceName}}</span>
</template>
</el-table-column>
<el-table-column prop="createAt" 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 == 0">未发布</span>
<span v-if="scope.row.status == 1">已发布</span>
<!-- <span v-if="scope.row.status == 1" style="color: #da0000;">已发布</span> -->
<span v-if="scope.row.status == 2" style="color: #da0000;">已停用</span>
</template>
</el-table-column>
<el-table-column prop="type" label="类型" width="80px" align="center">
<template slot-scope="scope">
<span v-if="scope.row.type == 1">普通受众</span>
<span v-if="scope.row.type == 2">自动受众</span>
</template>
</el-table-column>
<el-table-column label="操作" width="200px" align="center">
<template slot-scope="scope">
<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 type="text" v-if="scope.row.status == 0 || scope.row.status == 1" @click="deleteItem(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-main>
<el-dialog title="复制受众" :visible.sync="copyUserGroupShow" :close-on-click-modal="false" width="500px" custom-class="g-dialog">
<el-form ref="copyForm" :rules="copyRules" :model="copyForm" label-width="100px">
<el-form-item label="受众名称:" prop="name">
<el-input v-model="copyForm.audienceName" placeholder="请输入受众名称" maxlength="50"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="copyUserGroupShow= false"> </el-button>
<el-button type="primary" @click="copy">复制受众</el-button>
</span>
</el-dialog>
</el-container>
<div v-if="tableData.length > 0" style="text-align: center; margin-top:50px">
<!-- <el-pagination
@current-change="handleCurrentPushChange"
@size-change="handleSizePushChange"
background
:total="page.total"
:current-page.sync="page.pageIndex"
:page-size="page.pageSize"
:page-sizes="[10, 20, 30, 40]"
layout="total, prev, pager, next"
></el-pagination> -->
<el-pagination background
@size-change="handleSizePushChange"
@current-change="handleCurrentPushChange"
:current-page.sync="page.pageIndex"
:page-sizes="[10, 20, 30, 40]"
:page-size="page.pageSize"
layout="total,sizes, prev, pager, next,jumper"
:total="page.total">
</el-pagination>
</div>
</el-container>
</template>
<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() {
return {
query:{
name:'',
status:'',
},
loading:true,
page:{
total:0,
pageSize:10,
pageIndex:1
},
// 表格数据
tableData: [],
copyUserGroupShow:false,
copyRules:{ audienceName: [{ required: true, message: "请输入名称", trigger: "blur" }]},
copyForm:{audienceName:'',audienceId:''},
}
},
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){
this.page.pageSize = val
this.page.pageIndex = 1
this.loadData(this.page,this.query);
},
handleCurrentPushChange(val) {
this.page.pageIndex = val
this.loadData(this.page,this.query);
},
viewDetail(row){
//this.$router.push({path:'/manage/viewugroup', query: {id: row.id}})
this.$router.push({path:'/iframe/ugroup/view', query: {id: row.id}})
// this.$router.push({path:'/manage/addaudiences', query: {id: row.id}})
},
jumpRouter(type){
if(type==1){
this.$router.push({path:'/iframe/ugroup/add'})
//this.$router.push({path:'/manage/addaudiences'})
}
if(type==2){
this.$router.push({path:'/manage/autoaddaudiences'})
}
},
editRouter(type,row){
if(type==1){
//this.$router.push({path:'/manage/addaudiences', query: {id: row.id}})
this.$router.push({path:'/iframe/ugroup/add', query: {id: row.id}})
}
if(type==2){
this.$router.push({path:'/manage/autoaddaudiences'})
}
},
queryData(){
this.page.pageIndex = 1;
this.loadData(this.page, this.query);
},
loadData(page, params = {}){
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;
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 = 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;
}
apiDeleteCheck.queryCrowd(ids).then(rs=>{
if(rs.status==200){
this.tableData.forEach((item=>{
if(rs.result[item.id]){
item.deletable=true;
}
}))
}
})
},
currentChange(pageIndex){
this.page.pageSize = pageIndex
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: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
usergroupApi
.del(row.id)
.then((res) => {
if (res.status == 200) {
this.loadData(this.page,this.query);
this.$message({ type: "success", message: "删除受众成功",offset:50});
}
})
.catch((res) => {
this.$message({ type: "error", message: res.message,offset:50 });
});
})
},
publish(status,row){
let opt = "发布";
if(row.status == 1){opt="停用";}
if(row.status == 2){opt="启用";}
this.$confirm('您确定要'+opt+'所选受众吗?', '删除提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
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});
}else{
this.$message({ type: "error", message: res.message ,offset:50});
}
}).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;
this.copyForm.audienceId = row.id;
this.copyForm.audienceName = row.name;
},
copy(){
if(!this.copyForm.audienceName){
return;
}
this.$refs.copyForm.validate((valid) => {
if (valid) {
apiAudience.copy(this.copyForm).then((res) => {
if (res.status == 200) {
this.$message({ type: "success", message: "复制受众成功" ,offset:50});
this.loadData(this.page,this.query);
this.copyUserGroupShow = false;
}
})
.catch((res) => {
this.$message({ type: "error", message: res.message ,offset:50});
});
}
});
},
},
}
</script>
<style>
.el-aside{
padding: 0px 2px 10px 0px;
}
.el-main{
padding: 0px 0px;
}
.one_search {
display: flex;
}
.big_box_person {
display: flex;
}
.box-card {
margin-top: 20px;
;
}
.newdata_from {
margin-top: 20px;
margin-left: 50px;
}
.organization {
display: inline-block;
width: 120px;
}
.new_select {
width: 400px;
}
.content_big{
display: flex;
}
</style>

View File

@@ -0,0 +1,205 @@
<template>
<div class="addAudiences">
<p class="basicInformation">基本信息</p>
<el-form label-position="right" label-width="80px" ref="form" :model="form" :rules="rules">
<el-form-item label="名称:" prop="name">
<el-input placeholder="请填写名称" v-model="form.name" maxlength="50"></el-input>
</el-form-item>
<el-form-item label="描述:">
<el-input placeholder="请填写描述" type="textarea" :autosize="{ minRows: 4, maxRows: 4 }" v-model="form.description" maxlength="200"></el-input>
</el-form-item>
</el-form>
<p class="basicInformation">人员信息</p>
<div class="action">
<el-input style="width: 20%" placeholder="请输入姓名或工号" v-model="searchValue"></el-input>
<el-button type="primary" class="findBtn" size="medium" @click="queryTableData">搜索</el-button>
<el-button type="primary" class="findBtn" size="medium" @click="tableDataReset">重置</el-button>
</div>
<el-table ref="multipleTable" :data="tableDataShow" tooltip-effect="dark" style="width: 100%">
<el-table-column label="姓名" prop="realName" align="center" ></el-table-column>
<el-table-column prop="userNo" label="工号" align="center"></el-table-column>
<el-table-column prop="departName" label="部门" align="center"></el-table-column>
<!-- <el-table-column prop="position" label="岗位" align="center"></el-table-column> -->
</el-table>
<div class="publish">
<el-button @click="backToList()" type="primary" size="large">关闭</el-button>
</div>
</div>
</template>
<script>
import { getToken } from '@/utils/token'
import userApi from "@/api/system/user";
import orgApi from "@/api/system/organiza";
import apiAudience from "@/api/boe/audience.js";
export default{
data(){
return{
token:getToken(),
form:{
id:'',
name: '',
gtype: 1,
description:'',
userGroupItems:[]
},
searchValue:'',
tableData:[],
tableDataShow:[],
oldUserGroupItems:[],
rules: {
name: [{ required: true, message: "请输入名称", trigger: "blur" }]
},
multipleSelection:[],
userSelection:[],
addUserShow:false,
departData:[],
departProps: {
children: 'children',
label: 'name'
},
userData:[],
userQueryForm:{keyWord:'',departId:''},
userDataLoading:false,
userDataPage:{
total:0,
pageSize:5,
pageIndex:1
},
importUserShow:false,
importUserData:[],
importRepeatUsers:'',
selectFile:'',
fileList:[],
}
},
mounted() {
let that = this;
if (this.$route.query.id) {
let req = {audienceId:this.$route.query.id}
apiAudience.detail(req).then((res) => {
if (res.status == 200) {
that.form = res.result;
that.tableData = res.result.memberList;
that.queryTableData();
}
});
// usergroupApi.detail(that.$route.query.id).then((res) => {
// if (res.status == 200) {
// that.form = res.result;
// that.oldUserGroupItems = JSON.parse(JSON.stringify( res.result.userGroupItems ));
// that.tableData = res.result.userGroupItems;
// that.queryTableData();
// }
// });
}
},
methods:{
handleSelectionChange(val) {
this.multipleSelection = val;
},
reset() {
this.userQueryForm.keyWord = '';
this.userQueryForm.departId = '';
this.userDataPage.pageIndex = 1;
this.loadUserData(this.userDataPage, this.userQueryForm);
},
userSelectionChange(val) {
this.userSelection = val;
},
queryUserData(){
this.userDataPage.pageIndex = 1;
this.loadUserData(this.userDataPage, this.userQueryForm);
},
loadUserData(page, params = {}){
this.userDataLoading = true;
params.pageIndex = page.pageIndex;
params.pageSize = page.pageSize;
userApi.list(Object.assign(params, this.userQueryForm)).then(res => {
if (res.status == 200) {
this.userData = res.result.list;
this.userDataPage.total = res.result.count;
this.userDataLoading = false;
}
})
},
userDataCurrentChange(pageIndex){
this.userDataPage.pageIndex = pageIndex;
this.loadUserData(this.userDataPage,this.userQueryForm);
},
handleDepartNodeClick(data){
this.userQueryForm.departId = data.id;
this.loadUserData(this.userDataPage);
},
tableDataReset(){
this.tableData = JSON.parse(JSON.stringify( this.oldUserGroupItems ));
this.queryTableData();
},
queryTableData(){
if(this.searchValue){
let tableDataTemp = this.tableData;
this.tableDataShow = this.handleTableDataShow(tableDataTemp,this.searchValue);
}else{
this.tableDataShow = this.tableData;
}
},
// 表格过滤
handleTableDataShow(tableDataTemp, searchValue) {
if (!tableDataTemp || tableDataTemp.length === 0) {
return [];
}
const array = [];
for (let i = 0; i < tableDataTemp.length; i += 1) {
let match = false;
if(tableDataTemp[i]['name'] || tableDataTemp[i]['userNo']){
match |= (tableDataTemp[i]['name'].includes(searchValue) || tableDataTemp[i]['userNo'].includes(searchValue));
}
if ( match ) {
array.push({
...tableDataTemp[i]
});
}
}
return array;
},
backToList(){
//this.$router.push('/manage/ugroups');
this.$router.push('/iframe/ugroup/manages');
}
}
}
</script>
<style lang="scss" scoped>
::v-deep .el-tree-node:focus>.el-tree-node__content {
background-color:#cddef8;
}
.addAudiences{
.basicInformation{
margin: 0;
padding: 15px 0;
border-bottom: 1px solid rgb(219, 219, 219);
}
.el-form{
margin-top:20px;
}
.action{
margin: 20px 0;
display: flex;
.el-input{
margin-right: 10px;
}
.findBtn{
margin-right: 10px;
}
}
.publish{
display: flex;
justify-content: center;
align-items: center;
padding: 10px 0;
}
}
</style>

View File

@@ -23,12 +23,12 @@
<!-- <el-option label="已停用" :value="3"></el-option> -->
</el-select>
<div style="padding-left: 12px;"><el-input class="uc-input" v-model="params.courseName" clearable placeholder="搜索名称"></el-input></div>
<div style="padding-left: 12px;"><el-button type="primary" class="search-btn" icon="el-icon-search" @click="searchData()">搜索</el-button></div>
<div style="padding-left: 12px;"><el-button type="primary" class="search-btn" icon="el-icon-search" @click="findStudys(true)">搜索</el-button></div>
<div style="padding-left: 12px"><el-button type="primary" class="search-btn" icon="el-icon-refresh-right" @click="reset()">重置</el-button></div>
</div>
</div>
<div class="uc-list" v-loading="loading">
<div class="uc-course" v-for="(item,idx) in pageChange" :key="idx">
<div class="uc-course" v-for="(item,idx) in couresList" :key="idx">
<div class="uc-course-img" style="width: 260px;height:144px" @click="jumpRouter(item)">
<course-image :course="item"></course-image>
<div class="uc-type">
@@ -45,7 +45,7 @@
<a v-html="$keywordActiveShow(item.courseName,params.courseName)" class="uc-title two-line-ellipsis"></a>
</div>
</div>
<div style="padding-top:6px" class="uc-course-text"><i class="el-icon-time" style="margin-right:4px"></i>报名时间{{item.addTime}}</div>
<div style="padding-top:6px" class="uc-course-text"><i class="el-icon-time" style="margin-right:4px"></i>报名时间{{ formatsec(Number(item.startTime) * 1000 )}}</div>
<div style="width: 80%;margin-top: 20px;display: flex;">
<div style="color: #333333;font-size: 14px;">当前进度</div>
<div style="width:170px;padding-top: 5px;">
@@ -53,7 +53,7 @@
</div>
</div>
</div>
<div class="uc-course-btns">
<div class="uc-course-btns" style="display: none;">
<div style="text-align: right;">
<!-- <el-button class="del" @click.stop="delItem(item,idx)" type="text" icon="el-icon-delete" size="mini" title="删除"></el-button> -->
<el-dropdown trigger="click">
@@ -74,7 +74,7 @@
</span>
</div>
</div>
<div v-if="pageChange.length > 0 " style="text-align: center;margin-top:57px;">
<div v-if="couresList.length > 0 " style="text-align: center;margin-top:57px;">
<el-pagination background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
@@ -82,20 +82,21 @@
:page-sizes="[10, 20, 30, 40]"
:page-size="page.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="couresList.length">
:total="page.count">
</el-pagination>
</div>
<div class="list-wu">
<div v-if="loading">
<span v-if="dataList.length==0">正在加载数据...</span>
<span v-else>查询中...</span>
</div>
<div v-if="loading"> <span>加载中...</span> </div>
<div v-else class="home-no-list">
<!-- <span v-if="dataList.length==0">当前列表无数据</span>
<span v-else-if="couresList.length==0" >未找到您要搜索的内容</span> -->
<img v-if="dataList.length==0 || couresList.length==0" class="img" style="width:360px;height:226px" :src="`${webBaseUrl}/images/homeWu/no-madel.png`" alt="" srcset="">
<p v-if="dataList.length==0" class="text" style="color: #333333;margin-top:50px;font-size: 14px">您还没有报名课程哦</p>
<p v-else-if="couresList.length==0" class="text" style="color: #333333;margin-top:50px;font-size: 14px">未找到您要搜索的内容</p>
<div v-if="page.count==0 && !loading">
<div v-if="isSearch">
<p class="text" style="color: #333333;margin-top:50px;font-size: 14px">未找到您要搜索的内容</p>
</div>
<div v-else >
<img class="img" style="width:360px;height:226px" :src="`${webBaseUrl}/images/homeWu/no-madel.png`" alt="" srcset="">
<p class="text" style="color: #333333;margin-top:50px;font-size: 14px">您还没有报名课程哦</p>
</div>
</div>
</div>
</div>
</div>
@@ -104,10 +105,12 @@
<script>
import studyItem from '@/components/Course/studyItem.vue';
import apicourseStudy from '@/api/modules/courseStudy.js';
import apiCourseStudy from '@/api/modules/courseStudy.js';
import apiBoeCourse from '@/api/boe/course.js';
import apiManage from '@/api/manage/manage.js';
import studyImage from '@/components/Course/studyImage.vue';
import courseImage from "@/components/Course/courseImage.vue";
import {formatsec} from '@/utils/datetime.js'
export default {
name: 'ucStudyCourses',
components: { studyItem,studyImage,courseImage },
@@ -115,6 +118,8 @@ export default {
return {
courseType: '',
status: '',
formatsec:formatsec,
isSearch:false,
loading: true,
fileUrl:process.env.VUE_APP_FILE_BASE_URL,
page: {
@@ -124,42 +129,13 @@ export default {
},
dataList: [],//总数据
isNextPage: false,
pageIndex:1,
isListOne: true,
params: { courseName: '', courseType: '',status:''},
couresList: [],//显示的数据
options: [
{
value: 1,
label: '项目'
},
{
value: 2,
label: '课程',
children: [
{
value: 10,
label: '微课'
},
{
value: 21,
label: '录播课'
}
]
}
]
};
},
computed: {
pageChange() {
let list = this.couresList.slice((this.page.pageIndex -1)* this.page.pageSize,this.page.pageIndex*this.page.pageSize);
return list;
},
},
mounted() {
// this.searchData();
// this.getMyLearning()
this.getData();
this.findStudys(true);
},
methods: {
delItem(item,itemIdx){
@@ -168,187 +144,85 @@ computed: {
cancelButtonText: '取消',
type: 'warning'
}).then(() =>{
if(item.isOld){
apiBoeCourse.delLearning(item.kid).then(res=>{
if(item.source==1){ //老系统删除
//this.$message({ type: 'error', message: '此类型的报名删除还无对接接口'});
apiBoeCourse.newDelLearning(item.courseId).then(res=>{
if(res.status==200){
this.$message({ type: 'success',center: true, message: '课程删除成功!' });
this.couresList.forEach((ic,index)=>{
if(item.kid == ic.kid) {
this.couresList.splice(index,1);
}
})
this.dataList.forEach((it,i)=>{
if(item.id == it.id) {
this.dataList.splice(i,1);
}
})
this.couresList.splice(itemIdx,1);
} else {
this.$message({ type: 'error', message: res.message });
}
});
}else{
apicourseStudy.deleteSignUp(item.id,item.courseId).then(res =>{
}else if(item.source==2){ //本地删除
apiCourseStudy.deleteSignUp(item.id,item.courseId).then(res =>{
if(res.status==200){
this.$message({ type: 'success', message: '删除成功!' });
this.couresList.forEach((ic,index)=>{
if(item.id == ic.id) {
this.couresList.splice(index,1);
}
})
this.dataList.forEach((it,i)=>{
if(item.id == it.id) {
this.dataList.splice(i,1);
}
})
this.couresList.splice(itemIdx,1);
} else {
this.$message({ type: 'error', message: res.message });
}
})
}else if(item.source==3){ //管理端删除
var reqData={ pid:item.courseId, student:item.accountId }
apiManage.userDeleteStudy(reqData).then(res=>{
if(res.code==200){
this.$message({ type: 'success', message: '删除成功!' });
this.couresList.splice(itemIdx,1);
}else{
this.$message({ type: 'error', message: '删除失败!' });
}
})
}else{
this.$message({ type: 'error', message: '此报名未关联源,请与管理员联系'});
}
})
},
async getData() { //当前方案,此处只是加载一次
let type = '';
// if(this.params.courseType){
if(this.params.courseType==20){
type='online-course';
}else if(this.params.courseType==30){
type='face-course';
}else if(this.params.courseType==40){
type='project';
findStudys(flag){ //新的
if(flag){
this.page.pageIndex=1;
}
// }
// if(this.params.courseType ==20 ){
// this.params.courseType = [10,20]
// }
this.loading = true;
let data = {
type:type,
page:this.pageIndex,
size:100
this.isSearch=false;
let reqData={
courseName:this.params.courseName,
courseType:this.courseType,
status:this.status,
progress:'',
pageIndex:this.page.pageIndex,
pageSize:this.page.pageSize
}
this.isListOne = true;
this.params.pageSize = 100;
this.params.pageIndex = 1;
let list = this.dataList;
let clist = this.couresList;
// Promise.all([apiBoeCourse.myLearning(data),apicourseStudy.myStudyList(this.params)]).then(res=>{
// let list = [];
// list.push(...res[1].result.list);
// res[1].result.list.forEach(item=>{
// item.courseImage = this.fileUrl + item.courseImage;
// })
// let data = this.filterConversion(res[0].result.dataList);
// list.push(...data);
// this.couresList = list;
// this.dataList = list;
// this.loading = false;
// }).catch(err=>{
// console.log(err,'err');
// })
await apicourseStudy.myStudyList(this.params).then(res =>{
if(res.status == 200) {
res.result.list.forEach(item=>{
if(item.courseImage){
item.courseImage = this.fileUrl + item.courseImage;
if(reqData.courseName || reqData.courseType || reqData.status){
this.isSearch=true;
}
})
list.push(...res.result.list);
clist.push(...res.result.list);
this.loading=true;
apiCourseStudy.myStudysFromES(reqData).then(res=>{
if(res.status==200){
this.couresList=res.result.list;
this.page.count=res.result.count;
}else{
console.log('加载报名数据失败:'+res.message);
this.$message({ type: 'error', message: res.message });
}
this.loading = false;
})
await apiBoeCourse.myLearning(data).then(rs=>{
if(rs.status == 200) {
let data = this.filterConversion(rs.result.dataList);
list.push(...data);
clist.push(...data);
}else{
console.log('加载原报名数据失败:'+rs.message);
}
this.loading = false;
this.loading=false;
})
},
filterConversion(data){
let list = [];
data.forEach((item,index)=>{
let type = null;
if(item.type=='online-course'){
type=20;
}else if(item.type=='face-course'){
type=30;
}else if(item.type=='project'){
type=40;
}
let status = null;
if(item.status == '0') {
status = 1;
} else if(item.status == '1') {
status = 2;
}else if(item.status == '2') {
status = 9;
}
let num = item.completeProgress.replace('%',"");
item.completeProgress = Number(num);
list.push({
courseImage: item.cover[0].url,
courseName: item.title,
courseType: type,
id: item.id,
addTime:item.enrollTime,
progress: item.completeProgress,
status: status,
isOld: true,
kid:item.ms_timeline_kid
})
})
return list;
},
jumpRouter(item) {
if(item.isOld){
if(item.source==1){
location.href=`${this.webBaseUrl}/course/boeframe?id=${item.id}&type=${item.courseType}`
} else {
// if(item.courseType==10){
// this.$router.push({path:'/course/micro',query:{id:item.courseId}})
// }
// if(item.courseType==20){
// if(item.progress>0 && item.progress<100) {
}else if(item.source==2){
this.$router.push({path:'/course/studyindex',query:{id:item.courseId}})
// } else {
// this.$router.push({path:'/course/detail',query:{id:item.courseId}})
// }
// }
}else if(item.source==3){
//管理端跳转,只有30没有40了
//let params=encodeURIComponent('routerId='+courseId);
//this.$router.push('/forward?to=/fe-student/pathdetails&params='+params);
let manageApi=process.env.VUE_APP_MANAGER_API_PATH;
let uparams=encodeURIComponent('courseId='+item.courseId);
this.$router.push('/forward?to='+manageApi+'/stu/project/redirectDetail&params='+uparams);
} else {
console.log('未识别的来源 '+item.source);
}
},
// getMyLearning() {
// let params = {
// type:this.params.courseType,
// page:this.pageIndex,
// size:200
// }
// apiBoeCourse.myLearning(params).then(res=>{
// if(res.status == 200) {
// res.result.dataList.forEach(item => {
// let num = item.completeProgress.replace('%',"");
// item.completeProgress = Number(num);
// item.url = item.cover[0].url;
// });
// // if(this.page == 1) {
// this.dataList = res.result.dataList;
// // } else {
// // this.dataList.push(...res.result.dataList);
// // }
// this.isNextPage = res.result.isNextPage;
// }
// })
// },
reset(){
this.params.courseName = '',
this.params.courseType = '',
@@ -357,55 +231,16 @@ computed: {
this.couresList = this.dataList;
this.courseType = '';
this.status = '';
},
searchData() {
this.loading=false;//因为是页面搜索所以直接设置为false
this.page.pageIndex = 1;
this.isListOne = true;
let list = this.dataList;
if(this.courseType == '1') {
this.params.courseType = '';
} else {
this.params.courseType = this.courseType;
}
let type;
if(this.params.courseType == 20) {
type = 10;
}
if(this.status == '0') {
this.params.status = '';
} else {
this.params.status = this.status;
}
if(this.params.courseType != '') {
list= list.filter(item => {
if(item.courseType === this.params.courseType || item.courseType === type) {
return item;
}
});
}
if(this.params.status !== '') {
list= list.filter(item => {
if(item.status === this.params.status){
return item;
}
});
}
if(this.params.courseName !== '') {
list= list.filter(item => {
return item.courseName.toLowerCase()
.indexOf(this.params.courseName.toLowerCase()) > -1;
});
}
this.couresList = list;
this.findStudys();
},
handleSizeChange(val) {
this.page.pageSize = val;
this.page.pageIndex = 1;
this.findStudys();
},
handleCurrentChange(val) {
this.page.pageIndex = val;
this.findStudys();
},
}
};

View File

@@ -4,7 +4,7 @@
<div style="display: flex; justify-content: flex-start">
<div>
<el-select class="search-input" v-model="status" clearable placeholder="学习进度">
<el-option label="全部" value="5"></el-option>
<el-option label="全部" value=""></el-option>
<el-option label="未开始" value="0"></el-option>
<el-option label="进行中" value="1"></el-option>
<el-option label="已完成" value="2"></el-option>
@@ -18,7 +18,13 @@
<!--课程列表内容-->
<div class="uc-list" v-if="couresList.length > 0">
<div class="uc-course" v-for="(item, idx) in couresList" @click="jumpRouter(item)" :key="idx">
<div class="uc-course-img"><img :src="item.cmtask_imgurl" /></div>
<div class="uc-course-img">
<img :src="item.cmtask_imgurl" />
<span class="spanname" v-if="item.cmtask_type==1">学习路径图</span>
<span class="spanname" v-if="item.cmtask_type==2">学习项目</span>
<!-- 类型3不显示20230307 东吴说已确认的修改 -->
<!-- <span class="spanname" v-if="item.cmtask_type==3">老系统必修任务</span> -->
</div>
<div class="uc-course-info">
<!-- 任务名称 -->
<div class="uc-course-name one-line-ellipsis" style="cursor: pointer">
@@ -29,9 +35,9 @@
</div>
<!-- <div class="uc-course-source" @click="jumpRouter(item)">来源{{ item.cmtask_name }}</div> -->
<div style="padding-top: 18px; " class="uc-course-text">学习进度
<span v-if="item.cmtask_status==0">未开始</span>
<span v-if="item.cmtask_status==1">进行中</span>
<span v-if="item.cmtask_status==2">已完成</span>
<span v-if="item.cmtask_user_status==0">未开始</span>
<span v-if="item.cmtask_user_status==1">进行中</span>
<span v-if="item.cmtask_user_status==2">已完成</span>
</div>
<!-- <div class="uc-course-time">推送时间{{ formatsec(Number(item.updated_at) * 1000 )}}</div> -->
<div class="uc-course-time">推送时间{{ item.created_at}}</div>
@@ -122,17 +128,18 @@ export default {
methods: {
jumpRouter(item) {
//window.open(`${this.webBaseUrl}/course/boeframe?id=${item.cmtask_id}`,'_self')
location.href=`${this.webBaseUrl}/course/boeframe?id=${item.cmtask_id}`;
//location.href=`${this.webBaseUrl}/course/boeframe?id=${item.cmtask_id}`;
let urlPre=window.location.protocol+'//'+window.location.host;
// if(item.cmtask_type==1){ //学习路径图
// //let params=encodeURIComponent('projectId='+courseId);
// //this.$router.push('/forward?to='+studentPath+'/projectdetails&params='+params);
// location.href=urlPre+'/fe-student/pathdetails?routerId='+item.cmtask_code
// }else if(item.cmtask_type==2){ //学习项目
// location.href=urlPre+'/fe-student/projectdetails?projectId='+item.cmtask_code
// }
//let urlPre=window.location.protocol+'//'+window.location.host;
let studentPath=process.env.VUE_APP_STUDENT_PATH;
if(item.cmtask_type==1){ //学习路径图
let params=encodeURIComponent('routerId='+item.cmtask_id);
//this.$router.push('/forward?to='+studentPath+'/pathdetails&params='+params);
this.$router.push('/forward?to='+studentPath+'/pathchapterdetails&params='+params);
}else if(item.cmtask_type==2){ //学习项目
let params=encodeURIComponent('projectId='+item.cmtask_id);
this.$router.push('/forward?to='+studentPath+'/projectdetails&params='+params);
}
},
loadBoeData() {
@@ -142,33 +149,33 @@ export default {
let params={
pageNo:this.page,
pageSize:this.size,
cmtask_status:this.params.cmtask_status,
cmtask_user_status:this.params.cmtask_status,
cmtask_name:this.params.cmtask_name,
}
this.loading=true;
// apiManage.userTaskList(params).then(res=>{
// if(res.code==200){
// this.total = 10;
// this.couresList = res.data.records;
// }else{
// this.$message.error('查询数据失败:'+res.msg);
// }
// this.loading=false;
// }).catch(()=>{
// this.loading=false;
// })
apiBoeCourse.cmtaskList(params).then(res=>{
if(res.status==200){
this.total = res.result.count
this.couresList = res.result.list;
apiManage.userTaskList(params).then(res=>{
if(res.code==200){
this.total =parseInt(res.data.total);
this.couresList = res.data.records;
}else{
this.$message.error('查询数据失败:'+res.message);
this.$message.error('查询数据失败:'+res.msg);
}
this.loading=false;
}).catch(()=>{
this.loading=false;
})
// apiBoeCourse.cmtaskList(params).then(res=>{
// if(res.status==200){
// this.total = res.result.count
// this.couresList = res.result.list;
// }else{
// this.$message.error('查询数据失败:'+res.message);
// }
// this.loading=false;
// }).catch(()=>{
// this.loading=false;
// })
},
search(){
this.loadBoeData()
@@ -225,6 +232,16 @@ export default {
margin-top: 10px;
margin-right: 40px;
}
.spanname {
position: absolute;
background-color: #6a99a4;
color:#ffffff;
padding: 4px 10px;
font-size: 12px;
bottom: 0px;
z-index: 100;
left: 0px;
}
.uc-course {
cursor: pointer;
display: flex;
@@ -235,10 +252,12 @@ export default {
.uc-course-img {
width: 212px;
height: 119px;
position: relative;
img {
width: 100%;
height: 100%;
}
}
.uc-course-info {
// width: 50%;

View File

@@ -138,7 +138,7 @@ module.exports = {
},
'/uboeApi': {
// 目标代理服务器地址
target: 'https://u-pre.boe.comww',
target: 'https://u-pre.boe.com',
changeOrigin: true,
secure: false,
pathRewrite: {