mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-mobile.git
synced 2025-12-06 17:36:45 +08:00
添加usergroup
This commit is contained in:
149
api/modules/usergroup.js
Normal file
149
api/modules/usergroup.js
Normal file
@@ -0,0 +1,149 @@
|
||||
import ajax from '@/utils/xajax.js'
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param {
|
||||
* pageIndex 起始页
|
||||
* pageSize 每页条数
|
||||
* name 名称
|
||||
* gtype 类型 1表普通受众,2表自动受众
|
||||
* status 状态 1表发布,0表未发布
|
||||
* } query
|
||||
* @returns
|
||||
*/
|
||||
const list=function(query) {
|
||||
return ajax.get('/xboe/usergroup/page',{params:query});
|
||||
}
|
||||
|
||||
/**
|
||||
* 按父节点ID查询机构列表,适合构建动态机构树
|
||||
* @param parentId 父节点ID 根目录为 -1
|
||||
* @returns
|
||||
*/
|
||||
const userOrgs=function(parentId) {
|
||||
return ajax.get('/xboe/sys/user/org/list-by-parent?parentId='+parentId);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} name
|
||||
*/
|
||||
const findByName=function(name) {
|
||||
return ajax.get('/xboe/usergroup/find',{name});
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
* @param {受众ID} id
|
||||
* @returns
|
||||
*/
|
||||
const detail=function(id) {
|
||||
return ajax.get('/xboe/usergroup/detail?id='+id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
* @param {
|
||||
* name:'';//名称 长50
|
||||
* gtype:1;//类型 1表普通受众,2表自动受众
|
||||
* description:''; // 描述 长200
|
||||
* filterJson:''; //过滤条件
|
||||
* status:1; //状态 是否发布 1表发布,0表未发布
|
||||
* userGroupItems[
|
||||
* {
|
||||
* aid:'',//人员ID
|
||||
* }
|
||||
* ];// 受众人员信息
|
||||
* } data
|
||||
* @returns
|
||||
*/
|
||||
const save=function(data) {
|
||||
return ajax.postJson('/xboe/usergroup/save',data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param {
|
||||
* id:'',//受众ID
|
||||
* name:'';//名称 长50
|
||||
* gtype:1;//类型 1表普通受众,2表自动受众
|
||||
* description:''; // 描述 长200
|
||||
* filterJson:''; //过滤条件
|
||||
* status:1; //状态 是否发布 1表发布,0表未发布
|
||||
* userGroupItems[
|
||||
* {
|
||||
* aid:'',//人员ID
|
||||
* }
|
||||
* ];// 受众人员信息
|
||||
* } data
|
||||
* @returns
|
||||
*/
|
||||
const update=function(data) {
|
||||
return ajax.postJson('/xboe/usergroup/update',data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制
|
||||
* @param {
|
||||
* name 复制后的名称
|
||||
* id 需要复制的受众ID
|
||||
* } data
|
||||
* @returns
|
||||
*/
|
||||
const copy=function(data) {
|
||||
return ajax.post('/xboe/usergroup/copy',data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布
|
||||
* @param {
|
||||
* 1表发布,0表未发布
|
||||
* } status
|
||||
* @param {
|
||||
* 受众ID
|
||||
* } id
|
||||
* @returns
|
||||
*/
|
||||
const publish=function(status,id) {
|
||||
let data = {};
|
||||
data.status = status;
|
||||
data.id = id;
|
||||
return ajax.post('/xboe/usergroup/publish',data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param {受众ID} id
|
||||
* @returns
|
||||
*/
|
||||
const del=function(id) {
|
||||
return ajax.post('/xboe/usergroup/delete?id='+id);
|
||||
}
|
||||
|
||||
const downloadTemplate=function(){
|
||||
let requestParam ={
|
||||
url: '/xboe/usergroup/download',
|
||||
timeout: 0, // 下载不设置超时
|
||||
responseType: 'blob', // 表明返回服务器返回的数据类型
|
||||
}
|
||||
return ajax.get(requestParam);
|
||||
}
|
||||
|
||||
const userGroupIds=function() {
|
||||
return ajax.get('/xboe/usergroup/user-group-ids');
|
||||
}
|
||||
|
||||
|
||||
export default{
|
||||
list,
|
||||
findByName,
|
||||
detail,
|
||||
save,
|
||||
update,
|
||||
copy,
|
||||
publish,
|
||||
del,
|
||||
downloadTemplate,
|
||||
userOrgs,
|
||||
userGroupIds
|
||||
}
|
||||
Reference in New Issue
Block a user