refactor(api): 重构系统模块API函数命名规范

This commit is contained in:
2025-12-31 14:36:34 +08:00
parent 373a23159d
commit cddb0cff08
20 changed files with 59 additions and 59 deletions
@@ -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(() => {
})