前后端全面升级

This commit is contained in:
pycook
2023-07-10 17:42:15 +08:00
parent f57ff80099
commit 98cc853dbc
641 changed files with 97789 additions and 23995 deletions

View File

@@ -1,34 +0,0 @@
import { axios } from '@/utils/request'
const urlPrefix = '/v1/acl'
export function searchRole (params) {
return axios({
url: urlPrefix + `/roles`,
method: 'GET',
params: params
})
}
export function addRole (params) {
return axios({
url: urlPrefix + '/roles',
method: 'POST',
data: params
})
}
export function updateRoleById (id, params) {
return axios({
url: urlPrefix + `/roles/${id}`,
method: 'PUT',
data: params
})
}
export function deleteRoleById (id) {
return axios({
url: urlPrefix + `/roles/${id}`,
method: 'DELETE'
})
}

View File

@@ -1,56 +0,0 @@
import { axios } from '@/utils/request'
const urlPrefix = '/v1/acl'
export function getResourcePerms (resourceID) {
return axios({
url: urlPrefix + `/resources/${resourceID}/permissions`,
method: 'GET'
})
}
export function getResourceTypePerms (typeID) {
return axios({
url: urlPrefix + `/resource_types/${typeID}/perms`,
method: 'GET'
})
}
export function getResourceGroupPerms (resourceGroupID) {
return axios({
url: urlPrefix + `/resource_groups/${resourceGroupID}/permissions`,
method: 'GET'
})
}
export function setRoleResourcePerm (rid, resourceID, params) {
return axios({
url: urlPrefix + `/roles/${rid}/resources/${resourceID}/grant`,
method: 'POST',
data: params
})
}
export function setRoleResourceGroupPerm (rid, resourceGroupID, params) {
return axios({
url: urlPrefix + `/roles/${rid}/resource_groups/${resourceGroupID}/grant`,
method: 'POST',
data: params
})
}
export function deleteRoleResourcePerm (rid, resourceID, params) {
return axios({
url: urlPrefix + `/roles/${rid}/resources/${resourceID}/revoke`,
method: 'POST',
data: params
})
}
export function deleteRoleResourceGroupPerm (rid, resourceGroupID, params) {
return axios({
url: urlPrefix + `/roles/${rid}/resource_groups/${resourceGroupID}/revoke`,
method: 'POST',
data: params
})
}

View File

@@ -1,65 +0,0 @@
import { axios } from '@/utils/request'
const urlPrefix = '/v1/acl'
export function searchResource (params) {
return axios({
url: urlPrefix + `/resources`,
method: 'GET',
params: params
})
}
export function addResource (params) {
return axios({
url: urlPrefix + '/resources',
method: 'POST',
data: params
})
}
export function updateResourceById (id, params) {
return axios({
url: urlPrefix + `/resources/${id}`,
method: 'PUT',
data: params
})
}
export function deleteResourceById (id) {
return axios({
url: urlPrefix + `/resources/${id}`,
method: 'DELETE'
})
}
export function searchResourceType (params) {
return axios({
url: urlPrefix + `/resource_types`,
method: 'GET',
params: params
})
}
export function addResourceType (params) {
return axios({
url: urlPrefix + '/resource_types',
method: 'POST',
data: params
})
}
export function updateResourceTypeById (id, params) {
return axios({
url: urlPrefix + `/resource_types/${id}`,
method: 'PUT',
data: params
})
}
export function deleteResourceTypeById (id) {
return axios({
url: urlPrefix + `/resource_types/${id}`,
method: 'DELETE'
})
}

View File

@@ -1,66 +0,0 @@
import { axios } from '@/utils/request'
const urlPrefix = '/v1/acl'
export function searchRole (params) {
return axios({
url: urlPrefix + `/roles`,
method: 'GET',
params: params
})
}
export function addRole (params) {
return axios({
url: urlPrefix + '/roles',
method: 'POST',
data: params
})
}
export function updateRoleById (id, params) {
return axios({
url: urlPrefix + `/roles/${id}`,
method: 'PUT',
data: params
})
}
export function deleteRoleById (id) {
return axios({
url: urlPrefix + `/roles/${id}`,
method: 'DELETE'
})
}
export function addParentRole (id, otherID) {
return axios({
url: urlPrefix + `/roles/${id}/parents`,
method: 'POST',
data: { parent_id: otherID }
})
}
export function addChildRole (id, otherID) {
return axios({
url: urlPrefix + `/roles/${otherID}/parents`,
method: 'POST',
data: { parent_id: id }
})
}
export function delParentRole (cid, pid) {
return axios({
url: urlPrefix + `/roles/${cid}/parents`,
method: 'DELETE',
data: { parent_id: pid }
})
}
export function delChildRole (pid, cid) {
return axios({
url: urlPrefix + `/roles/${cid}/parents`,
method: 'DELETE',
data: { parent_id: pid }
})
}

View File

@@ -1,41 +0,0 @@
import { axios } from '@/utils/request'
const urlPrefix = '/v1/acl'
export function currentUser () {
return axios({
url: urlPrefix + `/users/info`,
method: 'GET'
})
}
export function searchUser (params) {
return axios({
url: urlPrefix + `/users`,
method: 'GET',
params: params
})
}
export function addUser (params) {
return axios({
url: urlPrefix + '/users',
method: 'POST',
data: params
})
}
export function updateUserById (id, params) {
return axios({
url: urlPrefix + `/users/${id}`,
method: 'PUT',
data: params
})
}
export function deleteUserById (id) {
return axios({
url: urlPrefix + `/users/${id}`,
method: 'DELETE'
})
}

View File

@@ -1,38 +0,0 @@
import { axios } from '@/utils/request'
export function getFirstCIs (ciId) {
return axios({
url: '/v0.1/ci_relations/' + ciId + '/first_cis',
method: 'GET'
})
}
export function getSecondCIs (ciId) {
return axios({
url: '/v0.1/ci_relations/' + ciId + '/second_cis',
method: 'GET'
})
}
export function searchCIRelation (params) {
return axios({
url: `/v0.1/ci_relations/s?${params}`,
method: 'GET'
})
}
export function statisticsCIRelation (params) {
return axios({
url: '/v0.1/ci_relations/statistics',
method: 'GET',
params: params
})
}
export function batchUpdateCIRelation (ciIds, parents) {
return axios({
url: '/v0.1/ci_relations/batch',
method: 'POST',
data: { ci_ids: ciIds, parents: parents }
})
}

View File

@@ -1,123 +0,0 @@
import { axios } from '@/utils/request'
/**
* get all CI Type
* @param parameter
* @returns {AxiosPromise}
*/
export function getCITypes (parameter) {
return axios({
url: '/v0.1/ci_types',
method: 'GET',
params: parameter
})
}
/**
* get a CI Type
* @param CITypeName
* @param parameter
* @returns {AxiosPromise}
*/
export function getCIType (CITypeName, parameter) {
return axios({
url: `/v0.1/ci_types/${CITypeName}`,
method: 'GET',
params: parameter
})
}
/**
* Create CI Type
* @param data
* @returns {AxiosPromise}
*/
export function createCIType (data) {
return axios({
url: '/v0.1/ci_types',
method: 'POST',
data: data
})
}
/**
* Update CI Type
* @param CITypeId
* @param data
* @returns {AxiosPromise}
*/
export function updateCIType (CITypeId, data) {
return axios({
url: `/v0.1/ci_types/${CITypeId}`,
method: 'PUT',
data: data
})
}
/**
* Delete CI Type
* @param CITypeId
* @returns {AxiosPromise}
*/
export function deleteCIType (CITypeId) {
return axios({
url: `/v0.1/ci_types/${CITypeId}`,
method: 'DELETE'
})
}
/**
* Gets a grouping of a CI Type
* @param CITypeId
* @param data
* @returns {AxiosPromise}
*/
export function getCITypeGroupById (CITypeId, data) {
return axios({
url: `/v0.1/ci_types/${CITypeId}/attribute_groups`,
method: 'GET',
params: data
})
}
/**
* Save a group of CI Type
* @param CITypeId
* @param data
* @returns {AxiosPromise}
*/
export function createCITypeGroupById (CITypeId, data) {
return axios({
url: `/v0.1/ci_types/${CITypeId}/attribute_groups`,
method: 'POST',
data: data
})
}
/**
* Changes the grouping of a CI Type
* @param groupId
* @param data
* @returns {AxiosPromise}
*/
export function updateCITypeGroupById (groupId, data) {
return axios({
url: `/v0.1/ci_types/attribute_groups/${groupId}`,
method: 'PUT',
data: data
})
}
/**
* Removes a group for a CI Type
* @param groupId
* @param data
* @returns {AxiosPromise}
*/
export function deleteCITypeGroupById (groupId, data) {
return axios({
url: `/v0.1/ci_types/attribute_groups/${groupId}`,
method: 'delete',
data: data
})
}

View File

@@ -1,140 +0,0 @@
import { axios } from '@/utils/request'
/**
* Get CI Type attributes
* @param CITypeName
* @param parameter
* @returns {AxiosPromise}
*/
export function getCITypeAttributesByName (CITypeName, parameter) {
return axios({
url: `/v0.1/ci_types/${CITypeName}/attributes`,
method: 'get',
params: parameter
})
}
/**
* Get CI Type attributes
* @param CITypeId
* @param parameter
* @returns {AxiosPromise}
*/
export function getCITypeAttributesById (CITypeId, parameter) {
return axios({
url: `/v0.1/ci_types/${CITypeId}/attributes`,
method: 'get',
params: parameter
})
}
/**
* Update attribute
* @param attrId
* @param data
* @returns {AxiosPromise}
*/
export function updateAttributeById (attrId, data) {
return axios({
url: `/v0.1/attributes/${attrId}`,
method: 'put',
data: data
})
}
/**
* Add attribute
* @param data
* @returns {AxiosPromise}
*/
export function createAttribute (data) {
return axios({
url: `/v0.1/attributes`,
method: 'post',
data: data
})
}
/**
* Search attributes or get all attributes
* @param data
* @returns {AxiosPromise}
*/
export function searchAttributes (params) {
return axios({
url: `/v0.1/attributes/s`,
method: 'get',
params: params
})
}
/**
* Delete attribute
* @param attrId
* @returns {AxiosPromise}
*/
export function deleteAttributesById (attrId) {
return axios({
url: `/v0.1/attributes/${attrId}`,
method: 'delete'
})
}
/**
* Bind attribute
* @param CITypeId
* @param data
* @returns {AxiosPromise}
*/
export function createCITypeAttributes (CITypeId, data) {
return axios({
url: `/v0.1/ci_types/${CITypeId}/attributes`,
method: 'post',
data: data
})
}
/**
* Update CI Type attribute
* @param CITypeId
* @param data
* @returns {AxiosPromise}
*/
export function updateCITypeAttributesById (CITypeId, data) {
return axios({
url: `/v0.1/ci_types/${CITypeId}/attributes`,
method: 'put',
data: data
})
}
/**
* Delete CI Type attribute
* @param CITypeId
* @param data
* @returns {AxiosPromise}
*/
export function deleteCITypeAttributesById (CITypeId, data) {
return axios({
url: `/v0.1/ci_types/${CITypeId}/attributes`,
method: 'delete',
data: data
})
}
export function transferCITypeAttrIndex (CITypeId, data) {
return axios({
url: `/v0.1/ci_types/${CITypeId}/attributes/transfer`,
method: 'POST',
data: data
})
}
export function transferCITypeGroupIndex (CITypeId, data) {
return axios({
url: `/v0.1/ci_types/${CITypeId}/attribute_groups/transfer`,
method: 'POST',
data: data
})
}

View File

@@ -1,39 +0,0 @@
import { axios } from '@/utils/request'
export function getCITypeChildren (CITypeID, parameter) {
return axios({
url: '/v0.1/ci_type_relations/' + CITypeID + '/children',
method: 'GET',
params: parameter
})
}
export function getCITypeParent (CITypeID) {
return axios({
url: '/v0.1/ci_type_relations/' + CITypeID + '/parents',
method: 'GET'
})
}
export function getCITypeRelations () {
return axios({
url: '/v0.1/ci_type_relations',
method: 'GET'
})
}
export function createRelation (parentId, childrenId, relationTypeId) {
return axios({
url: `/v0.1/ci_type_relations/${parentId}/${childrenId}`,
method: 'POST',
data: { relation_type_id: relationTypeId }
})
}
export function deleteRelation (parentId, childrenId) {
return axios({
url: `/v0.1/ci_type_relations/${parentId}/${childrenId}`,
method: 'DELETE'
})
}

View File

@@ -1,64 +0,0 @@
import XLSX from 'xlsx'
import { axios } from '@/utils/request'
export function processFile (fileObj) {
const promise = new Promise(function (resolve) {
const reader = new FileReader()
reader.readAsBinaryString(fileObj)
reader.onload = function (e) {
const data = e.target.result
const workbook = XLSX.read(data, { type: 'binary' })
const sheet = workbook.Sheets[workbook.SheetNames[0]]
const lt = XLSX.utils.sheet_to_json(sheet, { header: 1 })
resolve(lt)
}
})
return promise
}
export function uploadData (ciId, data) {
data.ci_type = ciId
return axios({
url: '/v0.1/ci',
method: 'PUT',
data: data
})
}
export function writeCsv (columns) {
const { Parser } = require('json2csv')
const fields = columns
const opts = { fields }
const p = new Parser(opts)
return p.parse([])
}
export function writeExcel (columns, name) {
const worksheet = XLSX.utils.aoa_to_sheet([columns])
const newWorkBoot = XLSX.utils.book_new()
XLSX.utils.book_append_sheet(newWorkBoot, worksheet, name)
const s = XLSX.write(newWorkBoot, { type: 'array' })
console.log(s)
return s
}
// Determines whether an array element is empty
export function any (ArrayList) {
for (let i = 0; i < ArrayList.length; i++) {
if (ArrayList[i]) {
return true
}
}
return false
}
export function filterNull (twoDimArray) {
console.log(twoDimArray)
const newArray = []
twoDimArray.forEach(item => {
if (any(item)) {
newArray.push(item)
}
})
return newArray
}

View File

@@ -1,41 +0,0 @@
import { axios } from '@/utils/request'
const urlPrefix = '/v0.1'
export function searchCI (params) {
return axios({
url: urlPrefix + `/ci/s?${params}`,
method: 'GET'
})
}
export function addCI (params) {
return axios({
url: urlPrefix + '/ci',
method: 'POST',
data: params
})
}
export function updateCI (id, params) {
return axios({
url: urlPrefix + `/ci/${id}`,
method: 'PUT',
data: params
})
}
export function deleteCI (ciId) {
return axios({
url: urlPrefix + `/ci/${ciId}`,
method: 'DELETE'
})
}
// Get a single CI instance
export function getCIById (ciId) {
return axios({
url: urlPrefix + `/ci/${ciId}`,
method: 'GET'
})
}

View File

@@ -1,8 +0,0 @@
import { axios } from '@/utils/request'
export function getCIHistory (ciId) {
return axios({
url: `/v0.1/history/ci/${ciId}`,
method: 'GET'
})
}

View File

@@ -1,64 +0,0 @@
import { axios } from '@/utils/request'
export function getPreference (instance = true, tree = null) {
return axios({
url: '/v0.1/preference/ci_types',
method: 'GET',
params: { instance: instance, tree: tree }
})
}
export function getSubscribeAttributes (ciTypeId) {
return axios({
url: `/v0.1/preference/ci_types/${ciTypeId}/attributes`,
method: 'GET'
})
}
export function getSubscribeTreeView () {
return axios({
url: '/v0.1/preference/tree/view',
method: 'GET'
})
}
export function subscribeCIType (ciTypeId, attrs) {
return axios({
url: `/v0.1/preference/ci_types/${ciTypeId}/attributes`,
method: 'POST',
data: {
attr: attrs
}
})
}
export function subscribeTreeView (ciTypeId, levels) {
return axios({
url: `/v0.1/preference/tree/view`,
method: 'POST',
data: { type_id: ciTypeId, levels: levels }
})
}
export function getRelationView () {
return axios({
url: `/v0.1/preference/relation/view`,
method: 'GET'
})
}
export function deleteRelationView (viewName) {
return axios({
url: `/v0.1/preference/relation/view`,
method: 'DELETE',
data: { name: viewName }
})
}
export function subscribeRelationView (payload) {
return axios({
url: `/v0.1/preference/relation/view`,
method: 'POST',
data: payload
})
}

View File

@@ -1,31 +0,0 @@
import { axios } from '@/utils/request'
export function getRelationTypes () {
return axios({
url: '/v0.1/relation_types',
method: 'GET'
})
}
export function addRelationType (payload) {
return axios({
url: `/v0.1/relation_types`,
method: 'POST',
data: payload
})
}
export function updateRelationType (rtId, payload) {
return axios({
url: `/v0.1/relation_types/${rtId}`,
method: 'PUT',
data: payload
})
}
export function deleteRelationType (rtId) {
return axios({
url: `/v0.1/relation_types/${rtId}`,
method: 'DELETE'
})
}

View File

@@ -0,0 +1,97 @@
import { axios } from '@/utils/request'
export function getCompanyInfo() {
return axios({
url: '/common-setting/v1/company/info',
method: 'get',
})
}
export function postCompanyInfo(parameter) {
return axios({
url: '/common-setting/v1/company/info',
method: 'post',
data: parameter,
})
}
export function putCompanyInfo(id, parameter) {
return axios({
url: `/common-setting/v1/company/info/${id}`,
method: 'put',
data: parameter,
})
}
export function postImageFile(parameter) {
return axios({
url: '/common-setting/v1/file',
method: 'post',
data: parameter,
})
}
export function getDepartmentList(params) {
// ?department_parent_id=-1 查询第一级部门下面的id根据实际的传
return axios({
url: '/common-setting/v1/department',
method: 'get',
params: params
})
}
export function getAllDepartmentList(params) { // is_tree
return axios({
url: '/common-setting/v1/department/all',
method: 'get',
params: params
})
}
export function postDepartment(departmentData) {
// 创建部门参数
// department_name
// department_director_id 部门负责人ID, 默认 0
// department_parent_id 上级部门ID 默认0 不为0时必须是已存在的部门ID
return axios({
url: '/common-setting/v1/department',
method: 'post',
data: departmentData,
})
}
export function putDepartmentById(department_id, departmentData) {
// 修改部门参数departmentData
// department_name
// department_director_id 部门负责人ID, 默认 0
// department_parent_id 上级部门ID 默认0 不为0时必须是已存在的部门ID
return axios({
url: `/common-setting/v1/department/${department_id}`,
method: 'put',
data: departmentData,
})
}
export function deleteDepartmentById(department_id) {
return axios({
url: `/common-setting/v1/department/${department_id}`,
method: 'delete',
})
}
export function getParentDepartmentList(department_id) {
return axios({
url: '/common-setting/v1/department/allow_parent',
method: 'get',
params: department_id,
})
}
// 获取全部部门和员工的树状结构
export function getAllDepAndEmployee(params) {
return axios({
url: '/common-setting/v1/department/all_with_employee',
method: 'get',
params
})
}
// 更新部门排序
export function updateDepartmentsSort(data) {
return axios({
url: '/common-setting/v1/department/update_sort',
method: 'put',
data
})
}

119
cmdb-ui/src/api/employee.js Normal file
View File

@@ -0,0 +1,119 @@
import { axios } from '@/utils/request'
export function getEmployeeList(params) {
return axios({
url: '/common-setting/v1/employee',
method: 'get',
params: params,
})
}
// export function getEmployeeList(params, orderBy) {
// return axios({
// url: '/common-setting/v1/employee' + '/' + orderBy,
// method: 'get',
// params: params,
// })
// }
export function postEmployee(data) {
return axios({
url: '/common-setting/v1/employee',
method: 'post',
data: data,
})
}
export function getEmployeeCount(params) {
return axios({
url: '/common-setting/v1/employee/count',
method: 'get',
params: params,
})
}
export function deleteEmployee(_id) {
return axios({
url: `/common-setting/v1/employee/${_id}`,
method: 'delete',
})
}
export function putEmployee(_id, data) {
return axios({
url: `/common-setting/v1/employee/${_id}`,
method: 'put',
data: data,
})
}
export function batchEditEmployee(data) {
return axios({
url: '/common-setting/v1/employee/batch',
method: 'post',
data: data,
})
}
export function importEmployee(data) {
return axios({
url: '/common-setting/v1/employee/import',
method: 'post',
data
})
}
export function getEmployeeByUid(uid) {
return axios({
url: `/common-setting/v1/employee/by_uid/${uid}`,
method: 'get',
})
}
export function updateEmployeeByUid(uid, data) {
return axios({
url: `/common-setting/v1/employee/by_uid/${uid}`,
method: 'put',
data
})
}
export function updatePasswordByUid(uid, data) {
return axios({
url: `/common-setting/v1/employee/by_uid/change_password/${uid}`,
method: 'put',
data
})
}
export function bindWxByUid(uid) {
return axios({
url: `/common-setting/v1/employee/by_uid/bind_work_wechat/${uid}`,
method: 'put',
})
}
export function getAllPosition() {
return axios({
url: `/common-setting/v1/employee/position`,
method: 'get',
})
}
export function getEmployeeByEmployeeId(employee_id) {
return axios({
url: `/common-setting/v1/employee/${employee_id}`,
method: 'get',
})
}
// 下载员工列表
export function downloadAllEmployee(params) {
return axios({
url: `/common-setting/v1/employee/export_all`,
method: 'get',
params,
responseType: 'blob'
})
}
export function getEmployeeListByFilter(data) {
return axios({
url: '/common-setting/v1/employee/filter',
method: 'post',
data
})
}

View File

@@ -1,14 +1,15 @@
import config from '@/config/defaultSettings'
import config from '@/config/setting'
const api = {
Login: config.useSSO ? config.ssoLoginRedirectUrl : '/login',
Logout: config.useSSO ? config.ssoLogoutRedirectUrl : '/logout',
Login: config.useSSO ? '/api/sso/login' : '/v1/acl/login',
Logout: config.useSSO ? '/api/sso/logout' : '/v1/acl/logout',
ForgePassword: '/auth/forge-password',
Register: '/auth/register',
twoStepCode: '/auth/2step-code',
SendSms: '/account/sms',
SendSmsErr: '/account/sms_err',
// get my info
UserInfo: '/v1/acl/users/info'
// UserInfo: '/v1/perms/user/info'
UserInfo: process.env.VUE_APP_IS_OUTER === 'false' ? '/v1/perms/user/info' : '/v1/acl/users/info',
}
export default api

View File

@@ -1,6 +1,6 @@
import api from './index'
import { axios } from '@/utils/request'
import config from '@/config/defaultSettings'
import config from '@/config/setting'
/**
* login func
* parameter: {
@@ -12,15 +12,19 @@ import config from '@/config/defaultSettings'
* @param parameter
* @returns {*}
*/
export function login (parameter) {
return axios({
url: api.Login,
method: 'post',
data: parameter
})
export function login(data) {
if (config.useSSO) {
window.location.href = config.ssoLoginUrl
} else {
return axios({
url: api.Login,
method: 'POST',
data: data
})
}
}
export function getSmsCaptcha (parameter) {
export function getSmsCaptcha(parameter) {
return axios({
url: api.SendSms,
method: 'post',
@@ -28,7 +32,7 @@ export function getSmsCaptcha (parameter) {
})
}
export function getInfo () {
export function getInfo() {
return axios({
url: api.UserInfo,
method: 'get',
@@ -38,11 +42,9 @@ export function getInfo () {
})
}
export function logout () {
console.log('logout........', config.useSSO)
export function logout() {
if (config.useSSO) {
window.location.href = api.Logout
return Promise.resolve()
window.location.replace(api.Logout)
} else {
return axios({
url: api.Logout,
@@ -58,10 +60,18 @@ export function logout () {
* get user 2step code open?
* @param parameter {*}
*/
export function get2step (parameter) {
export function get2step(parameter) {
return axios({
url: api.twoStepCode,
method: 'post',
data: parameter
})
}
export function getAllUsers(params) {
return axios({
url: '/v1/acl/users',
method: 'GET',
params
})
}

View File

@@ -1,62 +0,0 @@
import { axios } from '@/utils/request'
const api = {
user: '/user',
role: '/role',
service: '/service',
permission: '/permission',
permissionNoPager: '/permission/no-pager',
orgTree: '/org/tree'
}
export default api
export function getUserList (parameter) {
return axios({
url: api.user,
method: 'get',
params: parameter
})
}
export function getRoleList (parameter) {
return axios({
url: api.role,
method: 'get',
params: parameter
})
}
export function getServiceList (parameter) {
return axios({
url: api.service,
method: 'get',
params: parameter
})
}
export function getPermissions (parameter) {
return axios({
url: api.permissionNoPager,
method: 'get',
params: parameter
})
}
export function getOrgTree (parameter) {
return axios({
url: api.orgTree,
method: 'get',
params: parameter
})
}
// id == 0 add post
// id != 0 update put
export function saveService (parameter) {
return axios({
url: api.service,
method: parameter.id === 0 ? 'post' : 'put',
data: parameter
})
}

View File

@@ -0,0 +1,55 @@
import { axios } from '@/utils/request'
export const getNoticeApps = () => {
return axios({
url: `/common-setting/v1/message/apps`,
method: 'get',
})
}
export const getNoticeCategoriesByApp = (app_name) => {
return axios({
url: `/common-setting/v1/message/${app_name}/categories`,
method: 'get',
})
}
export const getMessage = (params) => {
return axios({
url: `/common-setting/v1/message`,
method: 'get',
params
})
}
export const postMessage = (data) => {
return axios({
url: `/common-setting/v1/message`,
method: 'post',
data
})
}
export const updateMessage = (id, data) => {
return axios({
url: `/common-setting/v1/message/${id}`,
method: 'put',
data
})
}
export const getUnreadMessageCount = (params) => {
return axios({
url: `/common-setting/v1/message/unread`,
method: 'get',
params
})
}
export const batchUpdateMessage = (data) => {
return axios({
url: `/common-setting/v1/message/batch`,
method: 'post',
data
})
}