Browse Source

代码规范性调整

main
蒋吉兆 3 years ago
parent
commit
a073ac4b2d
  1. 2
      web/src/permission.js
  2. 2
      web/src/store/module/dictionary.js
  3. 2
      web/src/store/module/router.js
  4. 7
      web/src/store/module/user.js
  5. 2
      web/src/utils/asyncRouter.js
  6. 2
      web/src/view/example/breakpoint/breakpoint.vue
  7. 4
      web/src/view/example/customer/customer.vue
  8. 2
      web/src/view/layout/aside/index.vue
  9. 2
      web/src/view/superAdmin/api/api.vue
  10. 2
      web/src/view/superAdmin/authority/authority.vue
  11. 6
      web/src/view/superAdmin/authority/components/apis.vue
  12. 6
      web/src/view/superAdmin/authority/components/datas.vue
  13. 2
      web/src/view/superAdmin/authority/components/menus.vue
  14. 2
      web/src/view/superAdmin/dictionary/sysDictionary.vue
  15. 2
      web/src/view/superAdmin/dictionary/sysDictionaryDetail.vue
  16. 2
      web/src/view/superAdmin/menu/menu.vue
  17. 4
      web/src/view/superAdmin/operation/sysOperationRecord.vue
  18. 6
      web/src/view/superAdmin/user/user.vue
  19. 8
      web/src/view/systemTools/autoCode/index.vue

2
web/src/permission.js

@ -9,7 +9,7 @@ const getRouter = async() => {
await store.dispatch('router/SetAsyncRouter') await store.dispatch('router/SetAsyncRouter')
await store.dispatch('user/GetUserInfo') await store.dispatch('user/GetUserInfo')
const asyncRouters = store.getters['router/asyncRouters'] const asyncRouters = store.getters['router/asyncRouters']
asyncRouters.map(asyncRouter => {
asyncRouters.forEach(asyncRouter => {
router.addRoute(asyncRouter) router.addRoute(asyncRouter)
}) })
} }

2
web/src/store/module/dictionary.js

@ -21,7 +21,7 @@ export const dictionary = {
if (res.code === 0) { if (res.code === 0) {
const dictionaryMap = {} const dictionaryMap = {}
const dict = [] const dict = []
res.data.resysDictionary.sysDictionaryDetails && res.data.resysDictionary.sysDictionaryDetails.map(item => {
res.data.resysDictionary.sysDictionaryDetails && res.data.resysDictionary.sysDictionaryDetails.forEach(item => {
dict.push({ dict.push({
label: item.label, label: item.label,
value: item.value value: item.value

2
web/src/store/module/router.js

@ -5,7 +5,7 @@ import { asyncMenu } from '@/api/menu'
const routerList = [] const routerList = []
const formatRouter = (routes) => { const formatRouter = (routes) => {
routes && routes.map(item => {
routes && routes.forEach(item => {
if ((!item.children || item.children.every(ch => ch.hidden)) && item.name !== '404' && !item.hidden) { if ((!item.children || item.children.every(ch => ch.hidden)) && item.name !== '404' && !item.hidden) {
routerList.push({ label: item.meta.title, value: item.name }) routerList.push({ label: item.meta.title, value: item.name })
} }

7
web/src/store/module/user.js

@ -1,7 +1,6 @@
import { login, getUserInfo } from '@/api/user'
import { login, getUserInfo, setUserInfo } from '@/api/user'
import { jsonInBlacklist } from '@/api/jwt' import { jsonInBlacklist } from '@/api/jwt'
import router from '@/router/index' import router from '@/router/index'
import { setUserInfo } from '@/api/user'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
export const user = { export const user = {
@ -45,7 +44,7 @@ export const user = {
...userInfo ...userInfo
} }
}, },
ChangeSideMode: async(state, val) => {
ChangeSideMode: (state, val) => {
state.userInfo.sideMode = val state.userInfo.sideMode = val
}, },
}, },
@ -64,7 +63,7 @@ export const user = {
commit('setToken', res.data.token) commit('setToken', res.data.token)
await dispatch('router/SetAsyncRouter', {}, { root: true }) await dispatch('router/SetAsyncRouter', {}, { root: true })
const asyncRouters = rootGetters['router/asyncRouters'] const asyncRouters = rootGetters['router/asyncRouters']
asyncRouters.map(asyncRouter => {
asyncRouters.forEach(asyncRouter => {
router.addRoute(asyncRouter) router.addRoute(asyncRouter)
}) })
// const redirect = router.history.current.query.redirect // const redirect = router.history.current.query.redirect

2
web/src/utils/asyncRouter.js

@ -1,7 +1,7 @@
const modules = import.meta.glob('../view/**/*.vue') const modules = import.meta.glob('../view/**/*.vue')
export const asyncRouterHandle = (asyncRouter) => { export const asyncRouterHandle = (asyncRouter) => {
asyncRouter.map(item => {
asyncRouter.forEach(item => {
if (item.component) { if (item.component) {
item.component = dynamicImport(modules, item.component) item.component = dynamicImport(modules, item.component)
} else { } else {

2
web/src/view/example/breakpoint/breakpoint.vue

@ -127,7 +127,7 @@ export default {
}, },
sliceFile() { sliceFile() {
this.waitUpLoad && this.waitUpLoad &&
this.waitUpLoad.map(item => {
this.waitUpLoad.forEach(item => {
// //
item.formData.append('chunkTotal', this.formDataList.length) // item.formData.append('chunkTotal', this.formDataList.length) //
const fileR = new FileReader() // const fileR = new FileReader() //

4
web/src/view/example/customer/customer.vue

@ -23,7 +23,7 @@
<el-table-column align="center" label="按钮组" min-width="160"> <el-table-column align="center" label="按钮组" min-width="160">
<template #default="scope"> <template #default="scope">
<el-button size="small" type="text" icon="el-icon-edit" @click="updateCustomer(scope.row)">变更</el-button> <el-button size="small" type="text" icon="el-icon-edit" @click="updateCustomer(scope.row)">变更</el-button>
<el-popover v-model:visible="scope.row.visible" placement="top" width="160">
<el-popover :visible="scope.row.visible" placement="top" width="160">
<p>确定要删除吗</p> <p>确定要删除吗</p>
<div style="text-align: right; margin-top: 8px;"> <div style="text-align: right; margin-top: 8px;">
<el-button size="mini" type="text" @click="scope.row.visible = false">取消</el-button> <el-button size="mini" type="text" @click="scope.row.visible = false">取消</el-button>
@ -119,7 +119,7 @@ export default {
if (res.code === 0) { if (res.code === 0) {
this.$message({ this.$message({
type: 'success', type: 'success',
message: ''
message: '删除成功'
}) })
if (this.tableData.length === 1 && this.page > 1) { if (this.tableData.length === 1 && this.page > 1) {
this.page-- this.page--

2
web/src/view/layout/aside/index.vue

@ -67,7 +67,7 @@ export default {
const query = {} const query = {}
const params = {} const params = {}
ele.route.parameters && ele.route.parameters &&
ele.route.parameters.map(item => {
ele.route.parameters.forEach(item => {
if (item.type === 'query') { if (item.type === 'query') {
query[item.key] = item.value query[item.key] = item.value
} else { } else {

2
web/src/view/superAdmin/api/api.vue

@ -212,7 +212,7 @@ export default {
this.apis = val this.apis = val
}, },
async onDelete() { async onDelete() {
const ids = this.apis.map(item => item.ID)
const ids = this.apis.forEach(item => item.ID)
const res = await deleteApisByIds({ ids }) const res = await deleteApisByIds({ ids })
if (res.code === 0) { if (res.code === 0) {
this.$message({ this.$message({

2
web/src/view/superAdmin/authority/authority.vue

@ -321,7 +321,7 @@ export default {
setAuthorityOptions(AuthorityData, optionsData, disabled) { setAuthorityOptions(AuthorityData, optionsData, disabled) {
this.form.authorityId = String(this.form.authorityId) this.form.authorityId = String(this.form.authorityId)
AuthorityData && AuthorityData &&
AuthorityData.map(item => {
AuthorityData.forEach(item => {
if (item.children && item.children.length) { if (item.children && item.children.length) {
const option = { const option = {
authorityId: item.authorityId, authorityId: item.authorityId,

6
web/src/view/superAdmin/authority/components/apis.vue

@ -52,7 +52,7 @@ export default {
}) })
this.activeUserId = this.row.authorityId this.activeUserId = this.row.authorityId
this.apiTreeIds = [] this.apiTreeIds = []
res.data.paths && res.data.paths.map(item => {
res.data.paths && res.data.paths.forEach(item => {
this.apiTreeIds.push('p:' + item.path + 'm:' + item.method) this.apiTreeIds.push('p:' + item.path + 'm:' + item.method)
}) })
}, },
@ -68,7 +68,7 @@ export default {
buildApiTree(apis) { buildApiTree(apis) {
const apiObj = {} const apiObj = {}
apis && apis &&
apis.map(item => {
apis.forEach(item => {
item.onlyId = 'p:' + item.path + 'm:' + item.method item.onlyId = 'p:' + item.path + 'm:' + item.method
if (Object.prototype.hasOwnProperty.call(apiObj, item.apiGroup)) { if (Object.prototype.hasOwnProperty.call(apiObj, item.apiGroup)) {
apiObj[item.apiGroup].push(item) apiObj[item.apiGroup].push(item)
@ -91,7 +91,7 @@ export default {
async authApiEnter() { async authApiEnter() {
const checkArr = this.$refs.apiTree.getCheckedNodes(true) const checkArr = this.$refs.apiTree.getCheckedNodes(true)
var casbinInfos = [] var casbinInfos = []
checkArr && checkArr.map(item => {
checkArr && checkArr.forEach(item => {
var casbinInfo = { var casbinInfo = {
path: item.path, path: item.path,
method: item.method method: item.method

6
web/src/view/superAdmin/authority/components/datas.vue

@ -45,7 +45,7 @@ export default {
this.authoritys = [] this.authoritys = []
this.dataAuthorityId = [] this.dataAuthorityId = []
this.roundAuthority(this.authority) this.roundAuthority(this.authority)
this.row.dataAuthorityId && this.row.dataAuthorityId.map(item => {
this.row.dataAuthorityId && this.row.dataAuthorityId.forEach(item => {
const obj = this.authoritys && this.authoritys.filter(au => au.authorityId === item.authorityId) && this.authoritys.filter(au => au.authorityId === item.authorityId)[0] const obj = this.authoritys && this.authoritys.filter(au => au.authorityId === item.authorityId) && this.authoritys.filter(au => au.authorityId === item.authorityId)[0]
this.dataAuthorityId.push(obj) this.dataAuthorityId.push(obj)
}) })
@ -74,7 +74,7 @@ export default {
}, },
getChildrenId(row, arrBox) { getChildrenId(row, arrBox) {
arrBox.push(row.authorityId) arrBox.push(row.authorityId)
row.children && row.children.map(item => {
row.children && row.children.forEach(item => {
this.getChildrenId(item, arrBox) this.getChildrenId(item, arrBox)
}) })
}, },
@ -87,7 +87,7 @@ export default {
}, },
// //
roundAuthority(authoritys) { roundAuthority(authoritys) {
authoritys && authoritys.map(item => {
authoritys && authoritys.forEach(item => {
const obj = {} const obj = {}
obj.authorityId = item.authorityId obj.authorityId = item.authorityId
obj.authorityName = item.authorityName obj.authorityName = item.authorityName

2
web/src/view/superAdmin/authority/components/menus.vue

@ -70,7 +70,7 @@ export default {
const res1 = await getMenuAuthority({ authorityId: this.row.authorityId }) const res1 = await getMenuAuthority({ authorityId: this.row.authorityId })
const menus = res1.data.menus const menus = res1.data.menus
const arr = [] const arr = []
menus.map(item => {
menus.forEach(item => {
// //
if (!menus.some(same => same.parentId === item.menuId)) { if (!menus.some(same => same.parentId === item.menuId)) {
arr.push(Number(item.menuId)) arr.push(Number(item.menuId))

2
web/src/view/superAdmin/dictionary/sysDictionary.vue

@ -53,7 +53,7 @@
<template #default="scope"> <template #default="scope">
<el-button size="mini" icon="el-icon-document" type="text" @click="toDetile(scope.row)">详情</el-button> <el-button size="mini" icon="el-icon-document" type="text" @click="toDetile(scope.row)">详情</el-button>
<el-button size="mini" icon="el-icon-edit" type="text" @click="updateSysDictionary(scope.row)">变更</el-button> <el-button size="mini" icon="el-icon-edit" type="text" @click="updateSysDictionary(scope.row)">变更</el-button>
<el-popover v-model:visible="scope.row.visible" placement="top" width="160">
<el-popover :visible="scope.row.visible" placement="top" width="160">
<p>确定要删除吗</p> <p>确定要删除吗</p>
<div style="text-align: right; margin-top: 8px;"> <div style="text-align: right; margin-top: 8px;">
<el-button size="mini" type="text" @click="scope.row.visible = false">取消</el-button> <el-button size="mini" type="text" @click="scope.row.visible = false">取消</el-button>

2
web/src/view/superAdmin/dictionary/sysDictionaryDetail.vue

@ -49,7 +49,7 @@
<el-table-column align="center" label="按钮组"> <el-table-column align="center" label="按钮组">
<template #default="scope"> <template #default="scope">
<el-button size="small" type="text" icon="el-icon-edit" @click="updateSysDictionaryDetail(scope.row)">变更</el-button> <el-button size="small" type="text" icon="el-icon-edit" @click="updateSysDictionaryDetail(scope.row)">变更</el-button>
<el-popover v-model:visible="scope.row.visible" placement="top" width="160">
<el-popover :visible="scope.row.visible" placement="top" width="160">
<p>确定要删除吗</p> <p>确定要删除吗</p>
<div style="text-align: right; margin-top: 8px;"> <div style="text-align: right; margin-top: 8px;">
<el-button size="mini" type="text" @click="scope.row.visible = false">取消</el-button> <el-button size="mini" type="text" @click="scope.row.visible = false">取消</el-button>

2
web/src/view/superAdmin/menu/menu.vue

@ -277,7 +277,7 @@ export default {
}, },
setMenuOptions(menuData, optionsData, disabled) { setMenuOptions(menuData, optionsData, disabled) {
menuData && menuData &&
menuData.map(item => {
menuData.forEach(item => {
if (item.children && item.children.length) { if (item.children && item.children.length) {
const option = { const option = {
title: item.meta.title, title: item.meta.title,

4
web/src/view/superAdmin/operation/sysOperationRecord.vue

@ -91,7 +91,7 @@
</el-table-column> </el-table-column>
<el-table-column align="center" label="按钮组"> <el-table-column align="center" label="按钮组">
<template #default="scope"> <template #default="scope">
<el-popover v-model:visible="scope.row.visible" placement="top" width="160">
<el-popover :visible="scope.row.visible" placement="top" width="160">
<p>确定要删除吗</p> <p>确定要删除吗</p>
<div style="text-align: right; margin-top: 8px;"> <div style="text-align: right; margin-top: 8px;">
<el-button size="mini" type="text" @click="scope.row.visible = false">取消</el-button> <el-button size="mini" type="text" @click="scope.row.visible = false">取消</el-button>
@ -168,7 +168,7 @@ export default {
async onDelete() { async onDelete() {
const ids = [] const ids = []
this.multipleSelection && this.multipleSelection &&
this.multipleSelection.map(item => {
this.multipleSelection.forEach(item => {
ids.push(item.ID) ids.push(item.ID)
}) })
const res = await deleteSysOperationRecordByIds({ ids }) const res = await deleteSysOperationRecordByIds({ ids })

6
web/src/view/superAdmin/user/user.vue

@ -29,7 +29,7 @@
</el-table-column> </el-table-column>
<el-table-column align="center" label="操作" min-width="150"> <el-table-column align="center" label="操作" min-width="150">
<template #default="scope"> <template #default="scope">
<el-popover v-model:visible="scope.row.visible" placement="top" width="160">
<el-popover :visible="scope.row.visible" placement="top" width="160">
<p>确定要删除此用户吗</p> <p>确定要删除此用户吗</p>
<div style="text-align: right; margin-top: 8px;"> <div style="text-align: right; margin-top: 8px;">
<el-button size="mini" type="text" @click="scope.row.visible = false">取消</el-button> <el-button size="mini" type="text" @click="scope.row.visible = false">取消</el-button>
@ -162,7 +162,7 @@ export default {
methods: { methods: {
setAuthorityIds() { setAuthorityIds() {
this.tableData && this.tableData.forEach((user) => { this.tableData && this.tableData.forEach((user) => {
const authorityIds = user.authorities && user.authorities.map(i => {
const authorityIds = user.authorities && user.authorities.forEach(i => {
return i.authorityId return i.authorityId
}) })
user.authorityIds = authorityIds user.authorityIds = authorityIds
@ -177,7 +177,7 @@ export default {
}, },
setAuthorityOptions(AuthorityData, optionsData) { setAuthorityOptions(AuthorityData, optionsData) {
AuthorityData && AuthorityData &&
AuthorityData.map(item => {
AuthorityData.forEach(item => {
if (item.children && item.children.length) { if (item.children && item.children.length) {
const option = { const option = {
authorityId: item.authorityId, authorityId: item.authorityId,

8
web/src/view/systemTools/autoCode/index.vue

@ -116,7 +116,7 @@
:disabled="(scope.$index + 1) === form.fields.length" :disabled="(scope.$index + 1) === form.fields.length"
@click="moveDownField(scope.$index)" @click="moveDownField(scope.$index)"
>下移</el-button> >下移</el-button>
<el-popover v-model:visible="scope.row.visible" placement="top">
<el-popover :visible="scope.row.visible" placement="top">
<p>确定删除吗</p> <p>确定删除吗</p>
<div style="text-align: right; margin-top: 8px;"> <div style="text-align: right; margin-top: 8px;">
<el-button size="mini" type="text" @click="scope.row.visible = false">取消</el-button> <el-button size="mini" type="text" @click="scope.row.visible = false">取消</el-button>
@ -397,7 +397,7 @@ export default {
this.form.autoCreateApiToSql = true this.form.autoCreateApiToSql = true
this.form.fields = [] this.form.fields = []
res.data.columns && res.data.columns &&
res.data.columns.map(item => {
res.data.columns.forEach(item => {
if (!gormModelList.some(gormfd => gormfd === item.columnName)) { if (!gormModelList.some(gormfd => gormfd === item.columnName)) {
const fbHump = toHump(item.columnName) const fbHump = toHump(item.columnName)
this.form.fields.push({ this.form.fields.push({
@ -418,9 +418,9 @@ export default {
}, },
async setFdMap() { async setFdMap() {
const fdTypes = ['string', 'int', 'bool', 'float64', 'time.Time'] const fdTypes = ['string', 'int', 'bool', 'float64', 'time.Time']
fdTypes.map(async fdtype => {
fdTypes.forEach(async fdtype => {
const res = await getDict(fdtype) const res = await getDict(fdtype)
res && res.map(item => {
res && res.forEach(item => {
this.fdMap[item.label] = fdtype this.fdMap[item.label] = fdtype
}) })
}) })

Loading…
Cancel
Save