diff --git a/src/api/boe/boeAjax.js b/src/api/boe/boeAjax.js
new file mode 100644
index 00000000..03ffde99
--- /dev/null
+++ b/src/api/boe/boeAjax.js
@@ -0,0 +1,196 @@
+import axios from 'axios'
+import qs from 'qs'
+import { Notification, MessageBox, Message } from 'element-ui'
+import store from '@/store'
+import { getToken } from '@/utils/token'
+import errorCode from '@/utils/errorCode'
+/**
+ *request请求 axios.request(config)
+ *requestJson请求 axios.request(config)
+ *get请求 axios.get(url[, config])
+ *post请求 axios.post(url[, data[, config]])
+ *postJson请求 axios.post(url[, data[, config]])
+ *put请求 axios.put(url[, data[, config]])
+ *putJson请求 axios.put(url[, data[, config]])
+ *patch请求 axios.patch(url[, data[, config]])
+ *patchJson请求 axios.patch(url[, data[, config]])
+ *delete请求 axios.delete(url[, config])
+ */
+
+
+// const ReLoginUrl=process.env.VUE_APP_LOGIN_URL;
+const TokenName='token';
+/**axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded'**/
+//只是用于发送json对象数据时使用post,put,patch
+/**axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded'**/
+//只是用于发送json对象数据时使用post,put,patch
+//用于普通的发送请求
+const formRequest=axios.create({
+ // headers:{'Content-Type':'application/x-www-form-urlencoded'},
+ // axios中请求配置有baseURL选项,表示请求URL公共部分
+ // baseURL: process.env.VUE_APP_CESOURCE_BASE_API,
+ //超时
+ timeout: 10000,
+ })
+ //发送json对象的拦截器
+ formRequest.interceptors.request.use(config => {
+ //是否需要设置 token
+ const isToken = (config.headers || {}).isToken === false
+ let curToken=getToken();
+ //curToken='eyJ0eXBlIjoidG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC91LmJvZS5jb20iLCJpYXQiOjE2NjkxMDgyMDIsImV4cCI6MTY2OTExNTQwMiwiR2l2ZW5OYW1lIjoiYm9ldSIsInVzZXJJZCI6IjAxNTU1M0RELTQ0NUUtNjlENC0zNTFGLUREOUExQTU2NDIwRSIsInVJZCI6Ijk2NTM0MTk5OTY0MzIzNDMwNCIsInBlcm1pc3Npb24iOiIifQ==.152729feaf062a11e0c49dc657ca3f965e82228f818e31dfccd21abf0fb53fab'
+ if (curToken && !isToken) {
+ config.headers[TokenName] = curToken // 让每个请求携带自定义token 请根据实际情况自行修改
+ }
+ return config
+ }, error => {
+ console.log(error)
+ Promise.reject(error)
+ });
+ formRequest.interceptors.response.use(res => {
+ const code = res.data.status || 200;
+ if(code===200){
+ return res.data
+ }else{
+ if(code === 401){
+ store.dispatch('LogOut').then(() => {
+ location.href = this.webBaseUrl + ReLoginUrl;
+ })
+ }else if(code===403){
+ var msg='当前操作没有权限';
+ Message({message: msg, type: 'error'});
+ return Promise.reject(new Error(msg))
+ }else{
+ //Message({message: res.data.message, type: 'error'});
+ //console.log('err' + res.data.error);
+ return res.data
+ }
+ }
+ },
+ error => {
+ console.log('err' + error)
+ let { message } = error;
+ if (message == "Network Error") {
+ message = "网络异常,请稍后重试";
+ }
+ else if (message.includes("timeout")) {
+ message = "网络异常或接口错误,请求超时";
+ }
+ else if (message.includes("Request failed with status code")) {
+ message = "系统接口" + message.substr(message.length - 3) + "异常";
+ }
+ Message({
+ message: message,
+ type: 'error',
+ duration: 5 * 1000
+ })
+ return Promise.reject(error)
+ }
+ )
+
+/**
+ * request请求,可以自定义参数
+ */
+const request=formRequest.request;
+
+/**
+ * get请求 ,只有url
+ */
+const get = function(baseURL,url){
+ return request({
+ baseURL,
+ url: url,
+ method: 'get',
+ headers:{'Content-Type':'application/x-www-form-urlencoded'}
+ })
+}
+
+/**
+ * post请求
+ * @param {Object} url
+ * @param {Object} postData
+ */
+const post=function(baseURL,url,postData){
+ if(postData){
+ postData=qs.stringify(postData);
+ }
+ return request({
+ baseURL,
+ url: url,
+ method: 'post',
+ data:postData,
+ headers:{'Content-Type':'application/x-www-form-urlencoded'}
+ })
+}
+//post请求
+const postForm=function(baseURL,url,data){
+ return request({
+ baseURL,
+ url,
+ data,
+ method: 'post',
+ headers:{'Content-Type':'application/x-www-form-urlencoded'}
+ });
+ }
+// const postJson=jsonRequest.post;
+
+const postJson=function(baseURL,url,postData){
+ return request({
+ baseURL,
+ url: url,
+ method: 'post',
+ data:postData,
+ headers:{'Content-Type':'application/json'},
+ })
+}
+
+// 导出文件请求定义
+const postJsonToFile=function(baseURL,url,postData){
+ return request({
+ baseURL,
+ url: url,
+ method: 'post',
+ data:postData,
+ headers:{'Content-Type':'application/json;charset=utf-8'},
+ responseType: 'blob'
+ })
+}
+
+
+/**
+ * put请求
+ */
+const put=function(baseURL,url,data){
+ if(data){
+ data=qs.stringify(data);
+ }
+ return request({
+ baseURL,
+ url: url,
+ method: 'put',
+ data:data,
+ headers:{'Content-Type':'application/x-www-form-urlencoded'}
+ })
+}
+
+const putJson=function(baseURL,url,data){
+ return request({
+ baseURL,
+ url: url,
+ method: 'put',
+ data:data,
+ headers:{'Content-Type':'application/json;charset=utf-8'},
+ })
+}
+
+
+
+export default {
+ tokenName:TokenName,
+ request,
+ get,
+ post,
+ postJson,
+ postJsonToFile,
+ put,
+ putJson,
+}
diff --git a/src/api/boe/userbasic.js b/src/api/boe/userbasic.js
index 7382beb6..1bac7c30 100644
--- a/src/api/boe/userbasic.js
+++ b/src/api/boe/userbasic.js
@@ -1,7 +1,7 @@
-
-import ajax from '../ajax';
+/**对应用户中心新的接口*/
+import ajax from './boeAjax';
//const baseURL = process.env.VUE_APP_CESOURCE_BASE_API;
-const baseURL ="userbasic";
+const baseURL ="/userbasic";
/**
* 获取用户的组织机构
@@ -11,7 +11,43 @@ const userParentOrg = function() {
return ajax.post(baseURL,'/org/userParentOrg',{});
}
+//https://u-pre.boe.com/userbasic/org/list
+/**
+ * 根据关键字查询机构
+ */
+const findOrgsByKeyword = function(keyword) {
+ return ajax.postJson(baseURL,'/org/list',{keyword});
+}
+
+const findOrgTreeByOrgId = function(orgId) {
+ return ajax.postJson(baseURL,'/org/childOrgs',{orgId});
+}
+
+/**根据用户id获取用户的信息*/
+const getUserInfoById = function(id) {
+ return ajax.postJson(baseURL,'/user/list',{id});
+}
+
+/**
+ * https://u-pre.boe.com/userbasic/audience/userAudiences
+ * 获取当前用户受众信息
+ */
+const getUserCrowds = function() {
+ return ajax.postJson(baseURL,'/audience/userAudiences',{});
+}
+
+/**
+ * 获取hrbp数据
+ */
+const getOrgHrbpInfo = function(orgId) {
+ return ajax.postJson(baseURL,'/org/orgHrbpInfo',{orgId});
+}
export default {
- userParentOrg
+ userParentOrg,
+ findOrgsByKeyword,
+ findOrgTreeByOrgId,
+ getUserInfoById,
+ getUserCrowds,
+ getOrgHrbpInfo
}
diff --git a/src/components/Course/courseForm.vue b/src/components/Course/courseForm.vue
index bdadb0e7..19ca7236 100644
--- a/src/components/Course/courseForm.vue
+++ b/src/components/Course/courseForm.vue
@@ -109,8 +109,8 @@
-
-
+
+
@@ -259,8 +259,8 @@
-
-
+
+
@@ -550,10 +550,22 @@ export default {
showChooseOrg(){
this.$refs.refChooseOrg.dlgShow = true;
},
+ removeCrowd(e){
+ //console.log(e);
+ if(e.disabled){
+ this.$message.error("您不能移除创建人加的受众");
+ this.courseCrowds.push(e);
+ return false;
+ }
+ },
confirmChooseOrg(orgInfo){
- //console.log(orgInfo,'orgInfo');
+ console.log(orgInfo,'orgInfo');
+ if(!orgInfo.hrbpId || orgInfo.hrbpId=='0'){
+ this.$message.error("此机构无HRBP审核人信息,请重新选择");
+ return;
+ }
this.orgName=orgInfo.name;
- this.orgKid=orgInfo.kid;
+ this.orgKid=orgInfo.kid; //kid已不存在
this.courseInfo.orgId=orgInfo.id;
this.$refs.refChooseOrg.dlgShow = false;
},
@@ -585,11 +597,31 @@ export default {
loadSysTypes: 'sysType/loadSysTypes'
}),
loadUserGroup(){
+ let $this=this;
apiUserGroup.findByName('').then(rs=>{
if(rs.status==200){
- this.userGroupList=rs.result;
+ let crowdList=[];
+ rs.result.forEach(item=>{
+ crowdList.push({
+ id:item.key,
+ name:item.value,
+ disabled:false
+ })
+ })
+ this.userGroupList=crowdList;
}
});
+ // apiUserBasic.getUserCrowds().then(rs=>{
+ // if(rs.status==200){
+ // let crowdList=[];
+ // rs.result.forEach(item=>{
+ // crowdList.push({
+ // id:item.kid,
+ // name:item.audienceName
+ // })
+ // })
+ // }
+ // })
},
resOwnerName(code) {
if (code == '') {
@@ -780,6 +812,7 @@ export default {
},
async getDetail(id) {
this.curCourseId = id;
+ this.orgName='';
let $this = this;
try {
const { result, status } = await apiCourse.detail(id);
@@ -801,10 +834,13 @@ export default {
$this.orgName=rrs.result.name;
$this.orgKid=rrs.result.kid;
$this.orgNamePath=rrs.result.namePath;
+ }else{
+ this.courseInfo.orgId='';
+ //this.$message.error('资源归属已变更,请重新选择');
}
})
}else{
- //
+ //this.$message.error('无机构关联,不需要提示');
}
})
@@ -814,6 +850,9 @@ export default {
$this.orgName=rrs.result.name;
$this.orgKid=rrs.result.kid;
$this.orgNamePath=rrs.result.namePath;
+ }else{
+ $this.courseInfo.orgId='';
+ $this.$message.error('资源归属已变更,请重新选择');
}
})
}
@@ -844,14 +883,13 @@ export default {
if(result.crowds && result.crowds.length>0){
result.crowds.forEach(crowd=>{
let newCrowd={
- key:crowd.groupId,
- value:crowd.groupName,
- disabled:false,
- text:''
+ id:crowd.groupId,
+ name:crowd.groupName,
+ disabled:false
}
crowdList.push(newCrowd);
let hasUG=$this.userGroupList.some(ug=>{
- return ug.key==crowd.groupId;
+ return ug.id==crowd.groupId;
});
if(!hasUG){
newCrowd.disabled=true;
@@ -1088,8 +1126,8 @@ export default {
let crowds=[];
this.courseCrowds.forEach(item=>{
crowds.push({
- groupId:item.key,
- groupName:item.value
+ groupId:item.id,
+ groupName:item.name
})
});
//以下是老师内容的处理
@@ -1238,10 +1276,10 @@ export default {
this.$message.error('请选择资源归属');
return;
}
- if(!this.orgKid){
- this.$message.error('资源归属无关联HRBP信息');
- return;
- }
+ // if(!this.orgKid){
+ // this.$message.error('资源归属无关联HRBP信息');
+ // return;
+ // }
//console.log(this.resOwnerListMap[0],'this.resOwnerListMap[0]');
//return;
@@ -1327,8 +1365,8 @@ export default {
let crowds=[];
this.courseCrowds.forEach(item=>{
crowds.push({
- groupId:item.key,
- groupName:item.value
+ groupId:item.id,
+ groupName:item.name
})
});
@@ -1343,18 +1381,31 @@ export default {
};
this.btnLoading = true;
let $this = this;
- //先获取课程内容
- apiHRBP.getHRBP(this.orgKid).then(rs=>{
- if(rs.status==200 && rs.result.length>0){
- let hrbpUser=rs.result[0];
- postData.auditUser={
- email:hrbpUser.email,
- code:hrbpUser.user_no,
- name:hrbpUser.real_name,
- kid:hrbpUser.user_id,
- orgId:hrbpUser.orgnization_id
- }
- postData.course.orgName=hrbpUser.orgnization_name_path+'/'+$this.orgName;
+ console.log(this.courseInfo.orgId,'this.courseInfo.orgId')
+ //先获取HRBP审核 人员信息,姓名,机构路径,工号,用于邮件中的信息
+ apiUserBasic.getOrgHrbpInfo(this.courseInfo.orgId).then(rs=>{
+ if(rs.status==200 && rs.result){
+ postData.auditUser={
+ email:rs.result.email,
+ code:rs.result.user_no,
+ name:rs.result.name,
+ aid:rs.result.id,
+ orgId:rs.result.orgId
+ }
+ postData.course.orgName=rs.result.orgNamePath+'/'+$this.orgName;
+
+ // apiHRBP.getHRBP(this.orgKid).then(rs=>{
+ // if(rs.status==200 && rs.result.length>0){
+ // let hrbpUser=rs.result[0];
+ // postData.auditUser={
+ // email:hrbpUser.email,
+ // code:hrbpUser.user_no,
+ // name:hrbpUser.real_name,
+ // kid:hrbpUser.user_id,
+ // orgId:hrbpUser.orgnization_id
+ // }
+ // postData.course.orgName=hrbpUser.orgnization_name_path+'/'+$this.orgName;
+
apiCourse.submitCourse(postData).then(res => {
//this.btnLoading=false;
setTimeout(function() {
diff --git a/src/components/HomePage/followList.vue b/src/components/HomePage/followList.vue
index ba4c0a5a..b6b83f57 100644
--- a/src/components/HomePage/followList.vue
+++ b/src/components/HomePage/followList.vue
@@ -167,7 +167,7 @@ import apiUser from "@/api/system/user.js";
// console.log(aid,delIdx,'参数值');
// //先从我关注的人中员列表中移除
// //this.$nextTick(()=>{
- // this.follow.list.splice(delIdx,1);
+ this.follow.list.splice(delIdx,1);
// //})
// // this.follow.list.forEach(one=>{
diff --git a/src/components/System/chooseOrg.vue b/src/components/System/chooseOrg.vue
index b4b722e9..5ab6a228 100644
--- a/src/components/System/chooseOrg.vue
+++ b/src/components/System/chooseOrg.vue
@@ -33,6 +33,7 @@