diff --git a/cmdb-ui/src/api/cmdb/CIType.js b/cmdb-ui/src/api/cmdb/CIType.js index ebf826e..ea8c8d2 100644 --- a/cmdb-ui/src/api/cmdb/CIType.js +++ b/cmdb-ui/src/api/cmdb/CIType.js @@ -1,7 +1,7 @@ import { axios } from '@/utils/request' /** - * 获取 所有的 ci_types + * get all CI Type * @param parameter * @returns {AxiosPromise} */ @@ -14,7 +14,7 @@ export function getCITypes (parameter) { } /** - * 获取 某个 ci_types + * get a CI Type * @param CITypeName * @param parameter * @returns {AxiosPromise} @@ -28,7 +28,7 @@ export function getCIType (CITypeName, parameter) { } /** - * 创建 ci_type + * Create CI Type * @param data * @returns {AxiosPromise} */ @@ -41,7 +41,7 @@ export function createCIType (data) { } /** - * 更新 ci_type + * Update CI Type * @param CITypeId * @param data * @returns {AxiosPromise} @@ -55,7 +55,7 @@ export function updateCIType (CITypeId, data) { } /** - * 删除 ci_type + * Delete CI Type * @param CITypeId * @returns {AxiosPromise} */ @@ -67,7 +67,7 @@ export function deleteCIType (CITypeId) { } /** - * 获取 某个 ci_type 的分组 + * Gets a grouping of a CI Type * @param CITypeId * @param data * @returns {AxiosPromise} @@ -81,7 +81,7 @@ export function getCITypeGroupById (CITypeId, data) { } /** - * 保存 某个 ci_type 的分组 + * Save a group of CI Type * @param CITypeId * @param data * @returns {AxiosPromise} @@ -95,7 +95,7 @@ export function createCITypeGroupById (CITypeId, data) { } /** - * 修改 某个 ci_type 的分组 + * Changes the grouping of a CI Type * @param groupId * @param data * @returns {AxiosPromise} @@ -109,7 +109,7 @@ export function updateCITypeGroupById (groupId, data) { } /** - * 删除 某个 ci_type 的分组 + * Removes a group for a CI Type * @param groupId * @param data * @returns {AxiosPromise} diff --git a/cmdb-ui/src/api/cmdb/CITypeAttr.js b/cmdb-ui/src/api/cmdb/CITypeAttr.js index 596e47b..2d08039 100644 --- a/cmdb-ui/src/api/cmdb/CITypeAttr.js +++ b/cmdb-ui/src/api/cmdb/CITypeAttr.js @@ -30,7 +30,7 @@ export function getCITypeAttributesById (CITypeId, parameter) { } /** - * update attribute + * Update attribute * @param attrId * @param data * @returns {AxiosPromise} @@ -44,7 +44,7 @@ export function updateAttributeById (attrId, data) { } /** - * add attribute + * Add attribute * @param data * @returns {AxiosPromise} */ @@ -57,7 +57,7 @@ export function createAttribute (data) { } /** - * search attributes or get all attributes + * Search attributes or get all attributes * @param data * @returns {AxiosPromise} */ @@ -70,7 +70,7 @@ export function searchAttributes (params) { } /** - * delete attribute + * Delete attribute * @param attrId * @returns {AxiosPromise} */ @@ -82,7 +82,7 @@ export function deleteAttributesById (attrId) { } /** - * bind attribute + * Bind attribute * @param CITypeId * @param data * @returns {AxiosPromise} @@ -96,7 +96,7 @@ export function createCITypeAttributes (CITypeId, data) { } /** - * update CI Type attribute + * Update CI Type attribute * @param CITypeId * @param data * @returns {AxiosPromise} @@ -110,7 +110,7 @@ export function updateCITypeAttributesById (CITypeId, data) { } /** - * delete CI Type attribute + * Delete CI Type attribute * @param CITypeId * @param data * @returns {AxiosPromise} diff --git a/cmdb-ui/src/api/cmdb/batch.js b/cmdb-ui/src/api/cmdb/batch.js index 3a88e13..6c1f369 100644 --- a/cmdb-ui/src/api/cmdb/batch.js +++ b/cmdb-ui/src/api/cmdb/batch.js @@ -42,26 +42,25 @@ export function writeExcel (columns, name) { return s } -// 判断一个数组元素是否都为空的 +// Determines whether an array element is empty export function any (ArrayList) { let flag = false - for (let i = 0; i < ArrayList.length; i++) { - if (ArrayList[i]) { + ArrayList.forEach(item => { + if (item) { flag = true return flag } - } + }) return false } -// 去除一个二维数组 底下为空的部分 export function filterNull (twoDimArray) { console.log(twoDimArray) const newArray = [] - for (let i = 0; i < twoDimArray.length; i++) { - if (any(twoDimArray[i])) { - newArray.push(twoDimArray[i]) + twoDimArray.forEach(item => { + if (any(item)) { + newArray.push(item) } - } + }) return newArray } diff --git a/cmdb-ui/src/api/cmdb/ci.js b/cmdb-ui/src/api/cmdb/ci.js index f06ee48..9d7eb64 100644 --- a/cmdb-ui/src/api/cmdb/ci.js +++ b/cmdb-ui/src/api/cmdb/ci.js @@ -32,7 +32,7 @@ export function deleteCI (ciId) { }) } -// 获取单个ci实例 +// Get a single CI instance export function getCIById (ciId) { return axios({ url: urlPrefix + `/ci/${ciId}`, diff --git a/cmdb-ui/src/config/defaultSettings.js b/cmdb-ui/src/config/defaultSettings.js index 3658d94..b9486e0 100644 --- a/cmdb-ui/src/config/defaultSettings.js +++ b/cmdb-ui/src/config/defaultSettings.js @@ -1,15 +1,18 @@ /** - * 项目默认配置项 - * primaryColor - 默认主题色, 如果修改颜色不生效,请清理 localStorage - * navTheme - sidebar theme ['dark', 'light'] 两种主题 - * colorWeak - 色盲模式 - * layout - 整体布局方式 ['sidemenu', 'topmenu'] 两种布局 - * fixedHeader - 固定 Header : boolean - * fixSiderbar - 固定左侧菜单栏 : boolean - * autoHideHeader - 向下滚动时,隐藏 Header : boolean - * contentWidth - 内容区布局: 流式 | 固定 + * Project default configuration items + * showLocale - Whether to display the Chinese and English switch buttons: boolean + * defaultLang - Default display language: zh-CN | en-US + * useSSO - Whether to use single sign-on: boolean + * primaryColor - Default theme color, clean up localStorage if changing color does not take effect + * navTheme - sidebar theme ['dark', 'light'] + * colorWeak - Color blindness mode + * layout - Overall layout ['sidemenu', 'topmenu'] + * fixedHeader - Fix Header: boolean + * fixSiderbar - Fix the left menu bar: boolean + * autoHideHeader - Hide header as you scroll down: boolean + * contentWidth - Content area layout: streaming | fixed * - * storageOptions: {} - Vue-ls 插件配置项 (localStorage/sessionStorage) + * storageOptions: {} - Vue-ls Plug-in configuration item (localStorage/sessionStorage) * */ diff --git a/cmdb-ui/src/router/README.md b/cmdb-ui/src/router/README.md deleted file mode 100644 index 6618270..0000000 --- a/cmdb-ui/src/router/README.md +++ /dev/null @@ -1,145 +0,0 @@ -路由/菜单说明 -==== - - - -配置文件路径 ----- - -`@/config/router.config.js` - - - -格式和说明 ----- - -```javascript -/** - * 路由配置说明: - * 建议:sider menu 请不要超过三级菜单,若超过三级菜单,则应该设计为顶部主菜单 配合左侧次级菜单 - * - **/ - { - redirect: noredirect, - name: 'router-name', - hidden: true, - meta: { - title: 'title', - icon: 'a-icon', - keepAlive: true, - hiddenHeaderContent: true, - } -} -``` - - - -`{ Route }` 对象 - -| 参数 | 说明 | 类型 | 默认值 | -| -------- | ----------------------------------------- | ------- | ------ | -| hidden | 控制路由是否显示在 sidebar | boolean | false | -| redirect | 重定向地址, 访问这个路由时,自定进行重定向 | string | - | -| name | 路由名称, 必须设置,且不能重名 | string | - | -| meta | 路由元信息(路由附带扩展信息) | object | {} | -| hideChildrenInMenu | 强制菜单显示为Item而不是SubItem(配合 meta.hidden) | boolean | - | - - -`{ Meta }` 路由元信息对象 - -| 参数 | 说明 | 类型 | 默认值 | -| ------------------- | ------------------------------------------------------------ | ------- | ------ | -| title | 路由标题, 用于显示面包屑, 页面标题 *推荐设置 | string | - | -| icon | 路由在 menu 上显示的图标 | [string,svg] | - | -| keepAlive | 缓存该路由 | boolean | false | -| hidden | 配合`hideChildrenInMenu`使用,用于隐藏菜单时,提供递归到父菜单显示 选中菜单项_(可参考 个人页 配置方式)_ | boolean | false | -| hiddenHeaderContent | *特殊 隐藏 [PageHeader](https://github.com/sendya/ant-design-pro-vue/blob/master/src/components/layout/PageHeader.vue#L14) 组件中的页面带的 面包屑和页面标题栏 | boolean | false | -| permission | 与项目提供的权限拦截匹配的权限,如果不匹配,则会被禁止访问该路由页面 | array | [] | - -> 路由自定义 `Icon` 请引入自定义 `svg` Icon 文件,然后传递给路由的 `meta.icon` 参数即可 - -路由例子 ----- - -```ecmascript 6 -const asyncRouterMap = [ - { - path: '/', - name: 'index', - component: BasicLayout, - meta: { title: '首页' }, - redirect: '/dashboard/analysis', - children: [ - { - path: '/dashboard', - component: RouteView, - name: 'dashboard', - redirect: '/dashboard/workplace', - meta: {title: '仪表盘', icon: 'dashboard', permission: ['dashboard']}, - children: [ - { - path: '/dashboard/analysis', - name: 'Analysis', - component: () => import('@/views/dashboard/Analysis'), - meta: {title: '分析页', permission: ['dashboard']} - }, - { - path: '/dashboard/monitor', - name: 'Monitor', - hidden: true, - component: () => import('@/views/dashboard/Monitor'), - meta: {title: '监控页', permission: ['dashboard']} - }, - { - path: '/dashboard/workplace', - name: 'Workplace', - component: () => import('@/views/dashboard/Workplace'), - meta: {title: '工作台', permission: ['dashboard']} - } - ] - }, - - // result - { - path: '/result', - name: 'result', - component: PageView, - redirect: '/result/success', - meta: { title: '结果页', icon: 'check-circle-o', permission: [ 'result' ] }, - children: [ - { - path: '/result/success', - name: 'ResultSuccess', - component: () => import(/* webpackChunkName: "result" */ '@/views/result/Success'), - // 该页面隐藏面包屑和页面标题栏 - meta: { title: '成功', hiddenHeaderContent: true, permission: [ 'result' ] } - }, - { - path: '/result/fail', - name: 'ResultFail', - component: () => import(/* webpackChunkName: "result" */ '@/views/result/Error'), - // 该页面隐藏面包屑和页面标题栏 - meta: { title: '失败', hiddenHeaderContent: true, permission: [ 'result' ] } - } - ] - }, - ... - ] - }, -] -``` - -> 1. 请注意 `component: () => import('..') ` 方式引入路由的页面组件为 懒加载模式。具体可以看 [Vue 官方文档](https://router.vuejs.org/zh/guide/advanced/lazy-loading.html) -> 2. 增加新的路由应该增加在 '/' (index) 路由的 `children` 内 -> 3. 子路由的父级路由必须有 `router-view` 才能让子路由渲染出来,请仔细查阅 vue-router 文档 -> 4. `permission` 可以进行自定义修改,只需要对这个模块进行自定义修改即可 [src/store/modules/permission.js#L10](https://github.com/sendya/ant-design-pro-vue/blob/master/src/store/modules/permission.js#L10) - - - -附权限路由结构: - -![权限结构](https://static-2.loacg.com/open/static/github/permissions.png) - - - -第二种前端路由由后端动态生成的设计,可以前往官网文档 https://pro.loacg.com/docs/authority-management 参考 \ No newline at end of file diff --git a/cmdb-ui/src/store/modules/i18n.js b/cmdb-ui/src/store/modules/i18n.js index 5de4daf..2e50a94 100644 --- a/cmdb-ui/src/store/modules/i18n.js +++ b/cmdb-ui/src/store/modules/i18n.js @@ -10,7 +10,7 @@ const i18n = { } }, actions: { - // 设置界面语言 + // Setting language SetLang ({ commit }, lang) { return new Promise(resolve => { commit('SET_LANG', lang) diff --git a/cmdb-ui/src/store/modules/permission.js b/cmdb-ui/src/store/modules/permission.js index 5139d27..774d136 100644 --- a/cmdb-ui/src/store/modules/permission.js +++ b/cmdb-ui/src/store/modules/permission.js @@ -1,7 +1,7 @@ import { generatorDynamicRouter, constantRouterMap } from '@/config/router.config' /** - * 过滤账户是否拥有某一个权限,并将菜单从加载列表移除 + * Filters if the account has a permission and removes the menu from the load list * * @param permission * @param route diff --git a/cmdb-ui/src/store/modules/user.js b/cmdb-ui/src/store/modules/user.js index 746c6ef..66ad92f 100644 --- a/cmdb-ui/src/store/modules/user.js +++ b/cmdb-ui/src/store/modules/user.js @@ -33,7 +33,7 @@ const user = { }, actions: { - // 登录 + // login Login ({ commit }, userInfo) { return new Promise((resolve, reject) => { login(userInfo).then(response => { @@ -46,7 +46,7 @@ const user = { }) }, - // 获取用户信息 + // get user info GetInfo ({ commit }) { return new Promise((resolve, reject) => { getInfo().then(response => { @@ -73,7 +73,7 @@ const user = { }) }, - // 登出 + // logout Logout ({ commit, state }) { return new Promise((resolve) => { commit('SET_TOKEN', '') diff --git a/cmdb-ui/src/views/account/center/Index.vue b/cmdb-ui/src/views/account/center/Index.vue deleted file mode 100644 index afa4fe2..0000000 --- a/cmdb-ui/src/views/account/center/Index.vue +++ /dev/null @@ -1,288 +0,0 @@ - - - - - diff --git a/cmdb-ui/src/views/account/center/page/App.vue b/cmdb-ui/src/views/account/center/page/App.vue deleted file mode 100644 index 853aeab..0000000 --- a/cmdb-ui/src/views/account/center/page/App.vue +++ /dev/null @@ -1,113 +0,0 @@ - - - - - diff --git a/cmdb-ui/src/views/account/center/page/Article.vue b/cmdb-ui/src/views/account/center/page/Article.vue deleted file mode 100644 index 724c07c..0000000 --- a/cmdb-ui/src/views/account/center/page/Article.vue +++ /dev/null @@ -1,75 +0,0 @@ - - - - - diff --git a/cmdb-ui/src/views/account/center/page/Project.vue b/cmdb-ui/src/views/account/center/page/Project.vue deleted file mode 100644 index 145232f..0000000 --- a/cmdb-ui/src/views/account/center/page/Project.vue +++ /dev/null @@ -1,109 +0,0 @@ - - - - - diff --git a/cmdb-ui/src/views/account/center/page/index.js b/cmdb-ui/src/views/account/center/page/index.js deleted file mode 100644 index b579b6a..0000000 --- a/cmdb-ui/src/views/account/center/page/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import AppPage from './App' -import ArticlePage from './Article' -import ProjectPage from './Project' - -export { AppPage, ArticlePage, ProjectPage } diff --git a/cmdb-ui/src/views/account/settings/AvatarModal.vue b/cmdb-ui/src/views/account/settings/AvatarModal.vue deleted file mode 100644 index 7d72791..0000000 --- a/cmdb-ui/src/views/account/settings/AvatarModal.vue +++ /dev/null @@ -1,109 +0,0 @@ - - - - diff --git a/cmdb-ui/src/views/account/settings/BaseSetting.vue b/cmdb-ui/src/views/account/settings/BaseSetting.vue deleted file mode 100644 index 6278aa1..0000000 --- a/cmdb-ui/src/views/account/settings/BaseSetting.vue +++ /dev/null @@ -1,161 +0,0 @@ - - - - - diff --git a/cmdb-ui/src/views/account/settings/Binding.vue b/cmdb-ui/src/views/account/settings/Binding.vue deleted file mode 100644 index cbea7fc..0000000 --- a/cmdb-ui/src/views/account/settings/Binding.vue +++ /dev/null @@ -1,25 +0,0 @@ - - - - - diff --git a/cmdb-ui/src/views/account/settings/Custom.vue b/cmdb-ui/src/views/account/settings/Custom.vue deleted file mode 100644 index 02c3bc1..0000000 --- a/cmdb-ui/src/views/account/settings/Custom.vue +++ /dev/null @@ -1,75 +0,0 @@ - - - diff --git a/cmdb-ui/src/views/account/settings/Index.vue b/cmdb-ui/src/views/account/settings/Index.vue deleted file mode 100644 index dd17a81..0000000 --- a/cmdb-ui/src/views/account/settings/Index.vue +++ /dev/null @@ -1,155 +0,0 @@ - - - - - diff --git a/cmdb-ui/src/views/account/settings/Notification.vue b/cmdb-ui/src/views/account/settings/Notification.vue deleted file mode 100644 index cbea7fc..0000000 --- a/cmdb-ui/src/views/account/settings/Notification.vue +++ /dev/null @@ -1,25 +0,0 @@ - - - - - diff --git a/cmdb-ui/src/views/account/settings/Security.vue b/cmdb-ui/src/views/account/settings/Security.vue deleted file mode 100644 index e806918..0000000 --- a/cmdb-ui/src/views/account/settings/Security.vue +++ /dev/null @@ -1,41 +0,0 @@ - - - - - diff --git a/cmdb-ui/src/views/cmdb/batch/index.vue b/cmdb-ui/src/views/cmdb/batch/index.vue index 2f3278b..a661618 100644 --- a/cmdb-ui/src/views/cmdb/batch/index.vue +++ b/cmdb-ui/src/views/cmdb/batch/index.vue @@ -64,7 +64,7 @@ export default { }, uploadData () { if (this.ciType < 0) { - alert('尚未选择模板类型!') + alert('CI Type not yet selected!') return } this.beginLoad = false diff --git a/cmdb-ui/src/views/cmdb/batch/modules/CiTable.vue b/cmdb-ui/src/views/cmdb/batch/modules/CiTable.vue index ba51fc2..2fcee63 100644 --- a/cmdb-ui/src/views/cmdb/batch/modules/CiTable.vue +++ b/cmdb-ui/src/views/cmdb/batch/modules/CiTable.vue @@ -36,42 +36,35 @@ export default { maxRows: 90, maxCols: 90, rowHeaders: true, - // minSpareCols: 2, //列留白 + // minSpareCols: 2, colHeaders: aliasList, - minSpareRows: 2, // 行留白 - // autoWrapRow: true, // 自动换行 - // 自定义右键菜单,可汉化,默认布尔值 + minSpareRows: 2, + // autoWrapRow: true, contextMenu: { items: { row_above: { - name: '上方插入一行' + name: 'insert a line at the top' }, row_below: { - name: '下方插入一行' + name: 'insert a line at the bottom' }, moverow: { - name: '删除行' + name: 'Delete rows' }, unfreeze_column: { - name: '取消列固定' + name: 'Uncolumn fixation' }, - hsep1: '---------', // 提供分隔线 + hsep1: '---------', hsep2: '---------' } }, - // width: '100%', - // fillHandle: true, // 选中拖拽复制 possible values: true, false, "horizontal", "vertical" - fixedColumnsLeft: 0, // 固定左边列数 - fixedRowsTop: 0, // 固定上边列数 - manualColumnFreeze: true, // 手动固定列 - // manualColumnMove: true, // 手动移动列 - // manualRowMove: true, // 手动移动行 - // manualColumnResize: true, // 手工更改列距 - // manualRowResize: true, // 手动更改行距 - comments: true, // 添加注释 - customBorders: [], // 添加边框 - columnSorting: true, // 排序 - stretchH: 'all', // 根据宽度横向扩展,last:只扩展最后一列,none:默认不扩展 + fixedColumnsLeft: 0, + fixedRowsTop: 0, + manualColumnFreeze: true, + comments: true, + customBorders: [], + columnSorting: true, + stretchH: 'all', afterChange: function (changes, source) { if (changes !== null) { document.getElementById('upload-button').disabled = false diff --git a/cmdb-ui/src/views/cmdb/batch/modules/CiTypeChoice.vue b/cmdb-ui/src/views/cmdb/batch/modules/CiTypeChoice.vue index b602c9d..714b4a0 100644 --- a/cmdb-ui/src/views/cmdb/batch/modules/CiTypeChoice.vue +++ b/cmdb-ui/src/views/cmdb/batch/modules/CiTypeChoice.vue @@ -6,7 +6,7 @@ {{ ciType.alias }} @@ -54,7 +54,6 @@ export default { }, methods: { selectCiType (el) { - // 当选择好模板类型时的回调函数 this.downLoadButtonDis = false this.selectNum = el getCITypeAttributesById(el).then(res => { diff --git a/cmdb-ui/src/views/cmdb/batch/modules/UploadResult.vue b/cmdb-ui/src/views/cmdb/batch/modules/UploadResult.vue index 64df7e0..aa8919c 100644 --- a/cmdb-ui/src/views/cmdb/batch/modules/UploadResult.vue +++ b/cmdb-ui/src/views/cmdb/batch/modules/UploadResult.vue @@ -1,11 +1,10 @@