Files
learning-system-mobile/api/modules/usergroup.js
2022-11-03 15:05:29 +08:00

150 lines
2.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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
}