refactor(api): 重构系统模块API函数命名规范
This commit is contained in:
@@ -35,7 +35,7 @@ export function searchDept(params) {
|
||||
})
|
||||
}
|
||||
|
||||
export function queryDeptSuperiorTree(ids, exclude) {
|
||||
export function searchDeptTree(ids, exclude) {
|
||||
exclude = exclude !== undefined ? exclude : false
|
||||
const data = Array.isArray(ids) ? ids : [ids]
|
||||
return request({
|
||||
@@ -45,4 +45,4 @@ export function queryDeptSuperiorTree(ids, exclude) {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, searchDept, queryDeptSuperiorTree }
|
||||
export default { add, edit, del, searchDept, searchDeptTree }
|
||||
|
||||
@@ -26,12 +26,12 @@ export function edit(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function queryPageDict(data) {
|
||||
export function searchDict(data) {
|
||||
return request({
|
||||
url: 'api/dict',
|
||||
url: 'api/dict/searchDict',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, queryPageDict }
|
||||
export default { add, edit, del, searchDict }
|
||||
|
||||
@@ -7,7 +7,7 @@ export function getLastEmailConfig() {
|
||||
})
|
||||
}
|
||||
|
||||
export function modifyEmailConfig(data) {
|
||||
export function updateEmailConfigById(data) {
|
||||
return request({
|
||||
url: 'api/email/updateEmailConfigById',
|
||||
method: 'post',
|
||||
@@ -15,7 +15,7 @@ export function modifyEmailConfig(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function sendEmail(data) {
|
||||
export function send(data) {
|
||||
return request({
|
||||
url: 'api/email/send',
|
||||
method: 'post',
|
||||
|
||||
@@ -25,7 +25,7 @@ export function edit(data) {
|
||||
data: data
|
||||
})
|
||||
}
|
||||
export function queryAllEnableJob() {
|
||||
export function searchJob() {
|
||||
const params = {
|
||||
page: 1,
|
||||
size: 9999999,
|
||||
|
||||
@@ -27,14 +27,14 @@ export function edit(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function queryMenuListByPid(pid) {
|
||||
export function listMenuByPid(pid) {
|
||||
return request({
|
||||
url: 'api/menu/listMenuByPid?pid=' + pid,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
export function queryMenuByArgs(params) {
|
||||
export function searchMenu(params) {
|
||||
return request({
|
||||
url: 'api/menu/searchMenu',
|
||||
method: 'post',
|
||||
@@ -51,7 +51,7 @@ export function queryMenuSuperior(ids) {
|
||||
})
|
||||
}
|
||||
|
||||
export function queryChildMenuSet(id) {
|
||||
export function listChildMenuSetByMenuId(id) {
|
||||
return request({
|
||||
url: 'api/menu/listChildMenuSetByMenuId?id=' + id,
|
||||
method: 'post'
|
||||
@@ -65,4 +65,4 @@ export function buildMenus() {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, queryMenuListByPid, queryMenuSuperior, queryMenuByArgs, queryChildMenuSet }
|
||||
export default { add, edit, del, listMenuByPid, queryMenuSuperior, searchMenu, listChildMenuSetByMenuId }
|
||||
|
||||
@@ -35,14 +35,14 @@ export function edit(data) {
|
||||
}
|
||||
|
||||
// 获取所有的Role
|
||||
export function queryRoleList() {
|
||||
export function listAllRole() {
|
||||
return request({
|
||||
url: 'api/role/listAllRole',
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
export function getLevel() {
|
||||
export function getCurrentUserRoleLevel() {
|
||||
return request({
|
||||
url: 'api/role/getCurrentUserRoleLevel',
|
||||
method: 'post'
|
||||
@@ -57,4 +57,4 @@ export function editMenu(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, get, editMenu, getLevel }
|
||||
export default { add, edit, del, get, editMenu, getCurrentUserRoleLevel }
|
||||
|
||||
@@ -28,7 +28,7 @@ export function edit(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function resetPwd(ids) {
|
||||
export function resetUserPasswordByIds(ids) {
|
||||
return request({
|
||||
url: 'api/user/resetUserPasswordByIds',
|
||||
method: 'post',
|
||||
@@ -36,7 +36,7 @@ export function resetPwd(ids) {
|
||||
})
|
||||
}
|
||||
|
||||
export function editUser(data) {
|
||||
export function updateUserCenterInfoById(data) {
|
||||
return request({
|
||||
url: 'api/user/updateUserCenterInfoById',
|
||||
method: 'post',
|
||||
@@ -44,7 +44,7 @@ export function editUser(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function updatePass(user) {
|
||||
export function updateUserPasswordByUsername(user) {
|
||||
const data = {
|
||||
oldPass: encrypt(user.oldPass),
|
||||
newPass: encrypt(user.newPass)
|
||||
@@ -56,7 +56,7 @@ export function updatePass(user) {
|
||||
})
|
||||
}
|
||||
|
||||
export function updateEmail(form) {
|
||||
export function updateUserEmailByUsername(form) {
|
||||
const data = {
|
||||
password: encrypt(form.pass),
|
||||
email: form.email
|
||||
@@ -68,7 +68,7 @@ export function updateEmail(form) {
|
||||
})
|
||||
}
|
||||
|
||||
export function queryUserMetaPage(query) {
|
||||
export function queryUserMetadataOptions(query) {
|
||||
const params = {
|
||||
page: 1,
|
||||
size: 50,
|
||||
@@ -83,5 +83,5 @@ export function queryUserMetaPage(query) {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, resetPwd, queryUserMetaPage }
|
||||
export default { add, edit, del, resetUserPasswordByIds, queryUserMetadataOptions }
|
||||
|
||||
|
||||
@@ -57,15 +57,15 @@ export default {
|
||||
this.loading = true
|
||||
setTimeout(() => {
|
||||
this.loading = false
|
||||
this.queryUserMetaPage(query)
|
||||
this.queryUserMetadataOptions(query)
|
||||
}, 200)
|
||||
} else {
|
||||
this.options = []
|
||||
}
|
||||
},
|
||||
queryUserMetaPage(query, options) {
|
||||
queryUserMetadataOptions(query, options) {
|
||||
const that = this
|
||||
UserService.queryUserMetaPage(query).then(res => {
|
||||
UserService.queryUserMetadataOptions(query).then(res => {
|
||||
that.options = res
|
||||
})
|
||||
},
|
||||
|
||||
@@ -67,15 +67,15 @@ export default {
|
||||
this.loading = true
|
||||
setTimeout(() => {
|
||||
this.loading = false
|
||||
this.queryUserMetaPage(query)
|
||||
this.queryUserMetadataOptions(query)
|
||||
}, 200)
|
||||
} else {
|
||||
this.options = []
|
||||
}
|
||||
},
|
||||
queryUserMetaPage(query, options) {
|
||||
queryUserMetadataOptions(query, options) {
|
||||
const that = this
|
||||
UserService.queryUserMetaPage(query).then(res => {
|
||||
UserService.queryUserMetadataOptions(query).then(res => {
|
||||
that.options = res
|
||||
})
|
||||
},
|
||||
|
||||
@@ -78,7 +78,7 @@ export default {
|
||||
}
|
||||
},
|
||||
fetch: async(queryParams) => {
|
||||
return DictService.queryPageDict(queryParams)
|
||||
return DictService.searchDict(queryParams)
|
||||
},
|
||||
pageProps: {
|
||||
current: 1,
|
||||
|
||||
@@ -105,7 +105,7 @@ export default {
|
||||
}
|
||||
},
|
||||
fetch: async(queryParams) => {
|
||||
return DictService.queryPageDict(queryParams)
|
||||
return DictService.searchDict(queryParams)
|
||||
},
|
||||
columns: [
|
||||
{ prop: 'name', label: '名称' },
|
||||
|
||||
@@ -195,7 +195,7 @@ export default {
|
||||
}
|
||||
},
|
||||
getSupDepts(id) {
|
||||
crudDept.queryDeptSuperiorTree(id, true).then(res => {
|
||||
crudDept.searchDeptTree(id, true).then(res => {
|
||||
const data = res.content
|
||||
this.buildDepts(data)
|
||||
this.depts = data
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getLastEmailConfig, modifyEmailConfig } from '@/api/system/email'
|
||||
import { getLastEmailConfig, updateEmailConfigById } from '@/api/system/email'
|
||||
|
||||
export default {
|
||||
name: 'Config',
|
||||
@@ -67,7 +67,7 @@ export default {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.loading = true
|
||||
modifyEmailConfig(this.form).then(res => {
|
||||
updateEmailConfigById(this.form).then(res => {
|
||||
this.$notify({
|
||||
title: '修改成功',
|
||||
type: 'success',
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { sendEmail } from '@/api/system/email'
|
||||
import { send } from '@/api/system/email'
|
||||
import { mapGetters } from 'vuex'
|
||||
import E from 'wangeditor'
|
||||
import { UploadFile } from '@/utils/CsDomUtil'
|
||||
@@ -74,7 +74,7 @@ export default {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.loading = true
|
||||
sendEmail(this.form).then(res => {
|
||||
send(this.form).then(res => {
|
||||
this.$notify({
|
||||
title: '发送成功',
|
||||
type: 'success',
|
||||
|
||||
@@ -137,7 +137,7 @@
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
lazy
|
||||
:load="queryMenuByArgs"
|
||||
:load="searchMenu"
|
||||
:data="crud.data"
|
||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||
row-key="id"
|
||||
@@ -273,14 +273,14 @@ export default {
|
||||
this.menus.push({ id: 0, label: '顶级类目', children: null })
|
||||
}
|
||||
},
|
||||
queryMenuByArgs(tree, treeNode, resolve) {
|
||||
searchMenu(tree, treeNode, resolve) {
|
||||
const params = {
|
||||
page: 1,
|
||||
size: 9999999,
|
||||
args: { pid: tree.id }
|
||||
}
|
||||
setTimeout(() => {
|
||||
crudMenu.queryMenuByArgs(params).then(res => {
|
||||
crudMenu.searchMenu(params).then(res => {
|
||||
resolve(res.content)
|
||||
})
|
||||
}, 100)
|
||||
@@ -298,7 +298,7 @@ export default {
|
||||
},
|
||||
loadMenus({ action, parentNode, callback }) {
|
||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||
crudMenu.queryMenuListByPid(parentNode.id).then(res => {
|
||||
crudMenu.listMenuByPid(parentNode.id).then(res => {
|
||||
parentNode.children = res.map(function(obj) {
|
||||
if (!obj.leaf) {
|
||||
obj.children = null
|
||||
|
||||
@@ -151,9 +151,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudRoles from '@/api/system/role'
|
||||
import { searchDept, queryDeptSuperiorTree } from '@/api/system/dept'
|
||||
import { queryChildMenuSet, queryMenuListByPid } from '@/api/system/menu'
|
||||
import crudRoles, {getCurrentUserRoleLevel} from '@/api/system/role'
|
||||
import { searchDept, searchDeptTree } from '@/api/system/dept'
|
||||
import { listChildMenuSetByMenuId, listMenuByPid } from '@/api/system/menu'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
@@ -190,14 +190,14 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
crudRoles.getLevel().then(data => {
|
||||
crudRoles.getCurrentUserRoleLevel().then(data => {
|
||||
this.level = data.level
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
getMenuDatas(node, resolve) {
|
||||
setTimeout(() => {
|
||||
queryMenuListByPid(node.data.id ? node.data.id : 0).then(res => {
|
||||
listMenuByPid(node.data.id ? node.data.id : 0).then(res => {
|
||||
resolve(res)
|
||||
})
|
||||
}, 100)
|
||||
@@ -261,7 +261,7 @@ export default {
|
||||
},
|
||||
menuChange(menu) {
|
||||
// 获取该节点的所有子节点,id 包含自身
|
||||
queryChildMenuSet(menu.id).then(childIds => {
|
||||
listChildMenuSetByMenuId(menu.id).then(childIds => {
|
||||
// 判断是否在 menuIds 中,如果存在则删除,否则添加
|
||||
if (this.menuIds.indexOf(menu.id) !== -1) {
|
||||
for (let i = 0; i < childIds.length; i++) {
|
||||
@@ -331,7 +331,7 @@ export default {
|
||||
depts.forEach(dept => {
|
||||
ids.push(dept.id)
|
||||
})
|
||||
queryDeptSuperiorTree(ids).then(res => {
|
||||
searchDeptTree(ids).then(res => {
|
||||
const date = res.content
|
||||
this.buildDepts(date)
|
||||
this.depts = date
|
||||
|
||||
@@ -151,7 +151,7 @@ import { getToken } from '@/utils/auth'
|
||||
import store from '@/store'
|
||||
import { IsValidPhone } from '@/utils/CsValidateUtil'
|
||||
import crud from '@/mixins/crud'
|
||||
import { editUser } from '@/api/system/user'
|
||||
import { updateUserCenterInfoById } from '@/api/system/user'
|
||||
import Avatar from '@/assets/images/avatar.png'
|
||||
|
||||
export default {
|
||||
@@ -223,7 +223,7 @@ export default {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.saveLoading = true
|
||||
editUser(this.form).then(() => {
|
||||
updateUserCenterInfoById(this.form).then(() => {
|
||||
this.editSuccessNotify()
|
||||
store.dispatch('GetInfo').then(() => {
|
||||
})
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<script>
|
||||
import store from '@/store'
|
||||
import { IsValidEmail } from '@/utils/CsValidateUtil'
|
||||
import { updateEmail } from '@/api/system/user'
|
||||
import { updateUserEmailByUsername } from '@/api/system/user'
|
||||
import { sendResetEmailCode } from '@/api/system/code'
|
||||
|
||||
export default {
|
||||
@@ -113,7 +113,7 @@ export default {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.loading = true
|
||||
updateEmail(this.form).then(res => {
|
||||
updateUserEmailByUsername(this.form).then(res => {
|
||||
this.loading = false
|
||||
this.resetForm()
|
||||
this.$notify({
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
<script>
|
||||
import store from '@/store'
|
||||
import { updatePass } from '@/api/system/user'
|
||||
import { updateUserPasswordByUsername } from '@/api/system/user'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -69,7 +69,7 @@ export default {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.loading = true
|
||||
updatePass(this.form).then(res => {
|
||||
updateUserPasswordByUsername(this.form).then(res => {
|
||||
this.resetForm()
|
||||
this.$notify({
|
||||
title: '密码修改成功,请重新登录',
|
||||
|
||||
@@ -196,9 +196,9 @@
|
||||
<script>
|
||||
import crudUser from '@/api/system/user'
|
||||
import { IsValidPhone } from '@/utils/CsValidateUtil'
|
||||
import { searchDept, queryDeptSuperiorTree } from '@/api/system/dept'
|
||||
import { getLevel, queryRoleList } from '@/api/system/role'
|
||||
import { queryAllEnableJob } from '@/api/system/job'
|
||||
import { searchDept, searchDeptTree } from '@/api/system/dept'
|
||||
import { getCurrentUserRoleLevel, listAllRole } from '@/api/system/role'
|
||||
import { searchJob } from '@/api/system/job'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
@@ -415,7 +415,7 @@ export default {
|
||||
})
|
||||
},
|
||||
getSupDepts(deptId) {
|
||||
queryDeptSuperiorTree(deptId).then(res => {
|
||||
searchDeptTree(deptId).then(res => {
|
||||
const date = res.content
|
||||
this.buildDepts(date)
|
||||
this.depts = date
|
||||
@@ -469,21 +469,21 @@ export default {
|
||||
},
|
||||
// 获取弹窗内角色数据
|
||||
getRoles() {
|
||||
queryRoleList().then(res => {
|
||||
listAllRole().then(res => {
|
||||
this.roles = res
|
||||
}).catch(() => {
|
||||
})
|
||||
},
|
||||
// 获取弹窗内岗位数据
|
||||
getJobs() {
|
||||
queryAllEnableJob().then(res => {
|
||||
searchJob().then(res => {
|
||||
this.jobs = res.content
|
||||
}).catch(() => {
|
||||
})
|
||||
},
|
||||
// 获取权限级别
|
||||
getRoleLevel() {
|
||||
getLevel().then(res => {
|
||||
getCurrentUserRoleLevel().then(res => {
|
||||
this.level = res.level
|
||||
}).catch(() => {
|
||||
})
|
||||
@@ -502,7 +502,7 @@ export default {
|
||||
ids.push(val.id)
|
||||
})
|
||||
console.log(ids)
|
||||
crudUser.resetPwd(ids).then(() => {
|
||||
crudUser.resetUserPasswordByIds(ids).then(() => {
|
||||
this.crud.notify('重置成功, 用户新密码:123456', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
}).catch(() => {
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user