Commit 7fede577 authored by wends's avatar wends

init

parents
**/node_modules
**/.idea
**/dist
# https://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
insert_final_newline = false
trim_trailing_whitespace = false
# just a flag
ENV = 'development'
# base api
#VUE_APP_BASE_API = 'http://localhost:8082'
VUE_APP_BASE_API = 'http://192.168.31.248:8082'
# VUE_APP_BASE_API = 'http://esvsy.wicp.vip:28080'
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
# to control whether the babel-plugin-dynamic-import-node plugin is enabled.
# It only does one thing by converting all import() to require().
# This configuration can significantly increase the speed of hot updates,
# when you have a large number of pages.
# Detail: https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/babel-preset-app/index.js
# VUE_CLI_BABEL_TRANSPILE_MODULES = true
# just a flag
ENV = 'development'
Mock = true
# base api
VUE_APP_BASE_API = '/dev-api'
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
# to control whether the babel-plugin-dynamic-import-node plugin is enabled.
# It only does one thing by converting all import() to require().
# This configuration can significantly increase the speed of hot updates,
# when you have a large number of pages.
# Detail: https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/babel-preset-app/index.js
VUE_CLI_BABEL_TRANSPILE_MODULES = true
# just a flag
ENV = 'production'
# base api
VUE_APP_BASE_API = 'http://esvsy.wicp.vip:8082'
# VUE_APP_BASE_API = 'http://192.168.31.248:8080'
NODE_ENV = production
# just a flag
ENV = 'staging'
# base api
VUE_APP_BASE_API = '/stage-api'
build/*.js
src/assets
tests
public
dist
src/components/G6Editor
mock
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module'
},
env: {
browser: true,
node: true,
es6: true,
},
extends: ['plugin:vue/recommended', 'eslint:recommended'],
// add your custom rules here
//it is base on https://github.com/vuejs/eslint-config-vue
rules: {
"vue/max-attributes-per-line": [2, {
"singleline": 10,
"multiline": {
"max": 1,
"allowFirstLine": false
}
}],
"vue/singleline-html-element-content-newline": "off",
"vue/multiline-html-element-content-newline":"off",
"vue/name-property-casing": ["error", "PascalCase"],
"vue/no-v-html": "off",
'accessor-pairs': 2,
'arrow-spacing': [2, {
'before': true,
'after': true
}],
'block-spacing': [2, 'always'],
'brace-style': [2, '1tbs', {
'allowSingleLine': true
}],
'camelcase': [0, {
'properties': 'always'
}],
'comma-dangle': [2, 'never'],
'comma-spacing': [2, {
'before': false,
'after': true
}],
'comma-style': [2, 'last'],
'constructor-super': 2,
'curly': [2, 'multi-line'],
'dot-location': [2, 'property'],
'eol-last': 2,
'eqeqeq': ["error", "always", {"null": "ignore"}],
'generator-star-spacing': [2, {
'before': true,
'after': true
}],
'handle-callback-err': [2, '^(err|error)$'],
'indent': [2, 2, {
'SwitchCase': 1
}],
'jsx-quotes': [2, 'prefer-single'],
'key-spacing': [2, {
'beforeColon': false,
'afterColon': true
}],
'keyword-spacing': [2, {
'before': true,
'after': true
}],
'new-cap': [2, {
'newIsCap': true,
'capIsNew': false
}],
'new-parens': 2,
'no-array-constructor': 2,
'no-caller': 2,
'no-console': 'off',
'no-class-assign': 2,
'no-cond-assign': 2,
'no-const-assign': 2,
'no-control-regex': 0,
'no-delete-var': 2,
'no-dupe-args': 2,
'no-dupe-class-members': 2,
'no-dupe-keys': 2,
'no-duplicate-case': 2,
'no-empty-character-class': 2,
'no-empty-pattern': 2,
'no-eval': 2,
'no-ex-assign': 2,
'no-extend-native': 2,
'no-extra-bind': 2,
'no-extra-boolean-cast': 2,
'no-extra-parens': [2, 'functions'],
'no-fallthrough': 2,
'no-floating-decimal': 2,
'no-func-assign': 2,
'no-implied-eval': 2,
'no-inner-declarations': [2, 'functions'],
'no-invalid-regexp': 2,
'no-irregular-whitespace': 2,
'no-iterator': 2,
'no-label-var': 2,
'no-labels': [2, {
'allowLoop': false,
'allowSwitch': false
}],
'no-lone-blocks': 2,
'no-mixed-spaces-and-tabs': 2,
'no-multi-spaces': 2,
'no-multi-str': 2,
'no-multiple-empty-lines': [2, {
'max': 1
}],
'no-native-reassign': 2,
'no-negated-in-lhs': 2,
'no-new-object': 2,
'no-new-require': 2,
'no-new-symbol': 2,
'no-new-wrappers': 2,
'no-obj-calls': 2,
'no-octal': 2,
'no-octal-escape': 2,
'no-path-concat': 2,
'no-proto': 2,
'no-redeclare': 2,
'no-regex-spaces': 2,
'no-return-assign': [2, 'except-parens'],
'no-self-assign': 2,
'no-self-compare': 2,
'no-sequences': 2,
'no-shadow-restricted-names': 2,
'no-spaced-func': 2,
'no-sparse-arrays': 2,
'no-this-before-super': 2,
'no-throw-literal': 2,
'no-trailing-spaces': 2,
'no-undef': 2,
'no-undef-init': 2,
'no-unexpected-multiline': 2,
'no-unmodified-loop-condition': 2,
'no-unneeded-ternary': [2, {
'defaultAssignment': false
}],
'no-unreachable': 2,
'no-unsafe-finally': 2,
'no-unused-vars': [2, {
'vars': 'all',
'args': 'none'
}],
'no-useless-call': 2,
'no-useless-computed-key': 2,
'no-useless-constructor': 2,
'no-useless-escape': 0,
'no-whitespace-before-property': 2,
'no-with': 2,
'one-var': [2, {
'initialized': 'never'
}],
'operator-linebreak': [2, 'after', {
'overrides': {
'?': 'before',
':': 'before'
}
}],
'padded-blocks': [2, 'never'],
'quotes': [2, 'single', {
'avoidEscape': true,
'allowTemplateLiterals': true
}],
'semi': [2, 'never'],
'semi-spacing': [2, {
'before': false,
'after': true
}],
'space-before-blocks': [2, 'always'],
'space-before-function-paren': [2, 'never'],
'space-in-parens': [2, 'never'],
'space-infix-ops': 2,
'space-unary-ops': [2, {
'words': true,
'nonwords': false
}],
'spaced-comment': [2, 'always', {
'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ',']
}],
'template-curly-spacing': [2, 'never'],
'use-isnan': 2,
'valid-typeof': 2,
'wrap-iife': [2, 'any'],
'yield-star-spacing': [2, 'both'],
'yoda': [2, 'never'],
'prefer-const': 2,
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'object-curly-spacing': [2, 'always', {
objectsInObjects: false
}],
'array-bracket-spacing': [2, 'never']
}
}
.DS_Store
node_modules/
tests_output/
dist/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
**/*.log
tests/**/coverage/
tests/e2e/reports
selenium-debug.log
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.local
package-lock.json
yarn.lock
registry="https://registry.npm.taobao.org"
disturl="https://npm.taobao.org/dist"
chromedriver_force_download=true
FROM 192.168.31.249:5000/front-end/node:12.13.0
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY ./ .
RUN npm run build:prod
FROM 192.168.31.249:5000/front-end/nginx:latest
RUN mkdir /app
COPY --from=0 /app/dist /app
COPY nginx.conf /etc/nginx/nginx.conf
## 说明
本项目为 英思唯 数据中台 前端工程,简称 data-center-web
### 技术栈
- [Vue.js](https://cn.vuejs.org/)
- [Vue Router](https://router.vuejs.org/zh/)
- [Vuex](https://vuex.vuejs.org/zh/)
- [Vue-CLI 3](https://cli.vuejs.org/zh/)
- [Element-ui](https://element.eleme.cn/#/zh-CN)
- [ES6](http://es6.ruanyifeng.com/)
## 准备
### 安装 Node.js 并配置 Npm
安装 [Node.js](https://nodejs.org/zh-cn/) 后检查版本
```bash
node --version
```
npm 会随着 node 一起安装,检查版本
```bash
npm --version
```
修改 npm 为淘宝源
```bash
npm config set registry https://registry.npm.taobao.org
```
### 推荐使用 Webstorm
在设置中的 Languages& Frameworks | JavaScript | Webpack 中选用webpack.config.js 文件来配置 webpack 的全局 allies
### 必须开启 ESLint 语法检查
在设置中的 Languages& Frameworks | JavaScript | Code Quality Tools | ESLint 中选择 Automatic ESLint configuration 启用 ESLint 语法检查
## 安装
打开项目工程
```bash
cd esv-iot-web
```
安装依赖
```bash
npm i
```
## 运行
在 .env.development 文件中设置开发时 baseUrl
```bash
VUE_APP_BASE_API = 'XXXXXX'
```
### 使用后台
```bash
# 使用 baseUrl 地址
npm run dev
```
### 本地 Mock
使用 `npm run dev:mock` 开发会在本地启动一个 `mock-server` 来 mock 网络请求的返回值。
mock-server 会拦截 network 中的 request 来达到 mock 数据的效果。
需要提前在 mock 目录下设置 mock 数据。
```bash
# 使用本地 mock 接口
npm run dev:mock
```
## 构建
在 .env.production 文件中设置开发时 baseUrl
```bash
VUE_APP_BASE_API = 'XXXXXXXXX'
```
开始构建
```bash
# 为生产环境构建
npm run build:prod
```
## 更多
```bash
# 本地预览为生产环境构建文件
npm run preview
# 本地预览为生产环境构建文件+分析构建文件依赖关系
npm run preview -- --report
# 代码风格检查
npm run lint
# 代码风格检查并修正
npm run lint -- --fix
```
## 权限控制
### 动态生成侧边栏
在 router/index.js 中可以配置两种路由记录
* constantRoutes:不受权限控制
* asyncRoutes:收权限控制
在用户登录之后会请求该用户可访问的菜单列表和可允许使用的按键列表,根据返回的 menuList 与 asyncRoutes 对比生成 accessRoutes ,使用accessRoutes 生成侧边栏,达到菜单/页面权限控制的目的;
### 可访问按键列表
在页面开发时对 button 埋点关键词,通过 v-permission 自定义指令对比可允许使用的按键列表,不在表中则设置 disabled 状态,达到按键级别权限控制的目的
## 单元测试
### 前端测试框架
采用Vue 官方提供的 Vue Test Utils 单元测试实用工具库,使用Jest 测试运行器。
### 测试策略
* Vue 组件
* 组件分支渲染逻辑
* 事件调用和参数传递
* 基础方法、类
* Vuex actions、mutations
### 示例
* 组件:tests\unit\components
* Vuex:tests\unit\store
* 工具:tests\unit\utils
* 页面:tests\unit\views
## 端对端测试
因为本项目是采用 Vue Cli 构建的,所以选择采用官方推荐的 NightWatch 插件来执行E2E测试。
### 示例
- 用例: tests\e2e\specs\test-with-pageobject.js
登录成功页面跳转首页用例
### 参考
[Nightwatch.js]: https://nightwatchjs.org/
## 代码风格检查
## ESLint
ESLint 是一个代码语法和风格的检查工具,本项目内置ESLint,必须开启。
开启 ESLint 之后会在本地开发时实时对js\vue\scss文件进行语法和风格检查,并且给出强烈提示。
## 图标
如果你没有在本项目 [Icon](https://github.com/PanJiaChen/vue-element-admin/tree/master/src/icons/svg) 中找到需要的图标,可以到 [iconfont.cn](http://iconfont.cn/) 上选择并生成自己的业务图标库,再进行使用。或者其它 svg 图标网站,下载 svg 并放到文件夹之中就可以了。
## 模版
平时日常工作中,做最多的就是写业务模块和组件。当每次新开一个`view`或者`component`的时候都需要手动创建一个新`.vue`,然后创建一个页面,还是有些麻烦的。
执行以下命令:
```bash
npm run new
```
按照提示选择`views``components`
按照提示输入页面名称和路径,即可在指定路径下生成文件
## 部署
在 Docker 容器中使用 Nginx 部署应用。
1. 在项目根目录处有一个 Dockerfile 文件
2. 在项目根目录处有一个 .dockerignore 文件
防止 node_modules 和其他中间构建产物被复制到镜像中导致构建问题
3. 在项目根目录有一个 nginx.conf 文件
在80端口上对外提供 Vue 构建后的静态文件
4. 在 Jenkins 上构建 Docker 镜像和 运行 Docker 镜像
## 全局过滤器 Filter
在 src/filters/index.js 中管理着全局过滤器,通过 main.js 为 Vue 全局注册,全局的过滤器没加私有前缀
```javascript
// global filters
import * as filters from './filters'
// register global utility filters
Object.keys(filters).forEach(key => {
Vue.filter(key, filters[key])
})
```
### moment
moment 时间格式化工具
```javascript
export function momentFilter(value, formatString) {
formatString = formatString || 'YYYY-MM-DD HH:mm:ss'
if (value === undefined) {
return null
}
return moment(value).format(formatString)
}
```
用在展示数据时把时间戳转换为带有固定格式的日期
```javascript
{{ 1587712722637 | momentFilter }}
```
除了 moment 之外还有 pluralize、timeAgo这些可以全局使用的过滤器
## 全局方法
在 main.js 中 Mixin 全局方法,全局混入的方法名加 $前缀,以便与实例内方法区分开
### $moment
在 main.js 中全局混入 $moment 时间格式化工具
```javascript
Vue.mixin({
methods: {
$moment(row, column, cellValue) {
const m = moment(cellValue, 'x')
return m.isValid() ? moment(cellValue).format('YYYY-MM-DD HH:mm:ss') : null
}
}
})
```
在 table 中对 el-table-column 中的时间戳进行时间格式化使用的
```javascript
<el-table-column
prop="createTime"
label="运单生成时间"
min-width="155"
:formatter="$moment"
/>
```
module.exports = {
presets: [
['@vue/app', { useBuiltIns: 'entry' }]
],
env: {
development: {
plugins: ['dynamic-import-node']
}
}
}
const { run } = require('runjs')
const chalk = require('chalk')
const config = require('../vue.config.js')
const rawArgv = process.argv.slice(2)
const args = rawArgv.join(' ')
if (process.env.npm_config_preview || rawArgv.includes('--preview')) {
const report = rawArgv.includes('--report')
run(`vue-cli-service build ${args}`)
const port = 9526
const publicPath = config.publicPath
var connect = require('connect')
var serveStatic = require('serve-static')
const app = connect()
app.use(
publicPath,
serveStatic('./dist', {
index: ['index.html', '/']
})
)
app.listen(port, function () {
console.log(chalk.green(`> Preview at http://localhost:${port}${publicPath}`))
if (report) {
console.log(chalk.green(`> Report at http://localhost:${port}${publicPath}report.html`))
}
})
} else {
run(`vue-cli-service build ${args}`)
}
module.exports = {
moduleFileExtensions: ['js', 'jsx', 'json', 'vue'],
transform: {
'^.+\\.vue$': 'vue-jest',
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$':
'jest-transform-stub',
'^.+\\.jsx?$': 'babel-jest'
},
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1'
},
snapshotSerializers: ['jest-serializer-vue'],
testMatch: [
'**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)'
],
collectCoverageFrom: ['src/utils/**/*.{js,vue}', '!src/utils/tenant-tenant-auth.js', '!src/utils/request.js', 'src/components/**/*.{js,vue}'],
coverageDirectory: '<rootDir>/tests/unit/coverage',
collectCoverage: true,
coverageReporters: [
'html',
'json-summary',
'text-summary'
],
testURL: 'http://localhost/'
}
{
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@/*": ["src/*"]
}
},
"exclude": ["node_modules", "dist"]
}
\ No newline at end of file
export default [
// 获取图片验证码
{
url: '/base/captcha/get',
type: 'post',
response: _ => {
return {
"code": 200,
"message": "success",
"responseTime": 1593324859063,
"data": {
"captcha": "data:image/png;base64,/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAeAFADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD0CiiiokeTjbqfLTlLml0vogriJ/EeoNcSGG4KxFiUUxrkLngdK7C+keGwuZYzh0iZlPoQDXFadZLdadqUvHmRRqV3dAM5P44XH41E7qyTOXGqvTUKMJvmd29X0W34HbxXEclqlznZGyCTLcYBGea50a7dXWoTeQ4W2QYXCjnng8jPPNZsWpzyaTFpUAIkaQrkHG5Sfu/iSfTj6mrl0LfSI4rUy7nCBpFU5+c9T7cY69gK5cbUqexfs738jeOO9u4yT5Yx1k/Psa0UmqTRJLGco6hlPy8g1ftjNHbs926ggkknA2j37VlyR3unqh807B8q7Wyo9sGjWL5zoAcDa07CM7TjHXP54xj3rlw1VQlLmc+aKvaTuj1JT5IOUuhWn1u9v7w2+lJ8o5D7RlgOp54A/wA98UyLWtRsL5YdSAKsRu3KAVHqCvX9emKu+GLYRaa05A3TMTkHsOB+ufzrL8Qk3WtrBEpMiqseDxkk5H/oQq5urGkq7k+Zvbp9xxTdSNNVXJ3fTodfRRRXqcr7hDA1YTc1U1fkZHiWVY9FkQg5lZUGPXOf6Go/C0bppBZhgPKzL7jAH8wa26KfL71zaOEft1XlK7StsY+laBHpty07Tec+3C/Jjb6nqef/AK9ZU8Ql1n7aX/eRzAumQeVI+XI+ldbRXPXoTml7OfLbyuP6lRUFTS91O/XcxZZrnUiqJFtj3dewOO5p2sac8uirDACzQkOFA5brn+ZNbFFZ08ElzOpLmlLS/wDkdE4KUXF9TkLLX5dOsvsZtQXjLAFmIwc9x9c+lW9F0meS7OoXylW3FlRlwS394jt7f5z0lFOGEaa55XUdkYQwzTXPK6Wx/9k=",
"id": "3DEA7799DF24125E2F05D769196FCF8C8B3B7A8B78F4384A8DBDFC3F63890EA0"
}
}
}
}
]
export default [
// 上传单个文件
{
url: '/file/upload/single',
type: 'post',
response: _ => {
return {
code: 200,
responseTime: 1579403560634,
message: 'success',
data: {
id: '',
url: 'http://ppe.oss-cn-shenzhen.aliyuncs.com/collections/182/7/thumb.jpg'
}
}
}
}
]
const data = [
{
id: 1,
datasetName: '金融风控_1',
type: 1,
status: 1,
amount: 10,
createTime: 1593321093655,
updateTime: 1593321093655
},
{
id: 2,
datasetName: '金融风控_2',
type: 1,
status: 2,
amount: 0,
createTime: 1593321093655,
updateTime: 1593321093655
}
]
export default [
// 获取数据集列表
{
url: '/cc/linque/getDatasetList',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {
pageNum: 1,
pageSize: 10,
totalSize: data.length,
records: data
}
}
}
},
// 获取数据集详情
{
url: '/cc/linque/getDatasetDetail',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {
pageNum: 1,
pageSize: 10,
totalSize: 1,
records: [
{
id: 1,
name: 'Tom Hanks',
birthday: '1968-06-9',
gender: 1,
education: 1,
telephone: '18790908766',
address: 'St1. Ca. USA'
}
]
}
}
}
},
// 创建数据集
{
url: '/cc/linque/addDataset',
type: 'post',
response: (req, res) => {
data.push({
id: 3,
datasetName: req.body.datasetName,
type: 1,
status: 2,
amount: 0,
createTime: 1593321093655,
updateTime: 1593321093655
})
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
}
]
import Mock from 'mockjs'
import { param2Obj } from '../src/utils'
import login from './login/login'
import file from './components/file'
import baseService from './components/basic-services'
import authManagement from './system-management/auth-management'
import menuManagement from './system-management/menu-management'
import systemManagement from './system-management/system-management'
import organizationManagement from './system-management/organization-management'
import userManagement from './system-management/user-management'
import roleManagement from './system-management/role-management'
import tenantManagement from './tenant-management/tenant-management'
import tenantAuth from './tenant-management/tenant-auth'
import tenantAccount from './tenant-management/tenant-account'
import mineDataset from './dataset-management/mine-dateset'
import mineService from './online-service/mine-service'
import serviceMonitor from './online-service/service-monitor'
import mineModel from './model-warehouse/mine-model'
import modelVersion from './model-warehouse/model-version'
import visualization from './model-training/visualization'
import overview from './overview/overview'
const mocks = [
...login,
...file,
...baseService,
...authManagement,
...menuManagement,
...systemManagement,
...organizationManagement,
...userManagement,
...roleManagement,
...tenantManagement,
...tenantAuth,
...tenantAccount,
...mineDataset,
...mineService,
...serviceMonitor,
...mineModel,
...modelVersion,
...visualization,
...overview
]
// for front mock
// please use it cautiously, it will redefine XMLHttpRequest,
// which will cause many of your third-party libraries to be invalidated(like progress event).
export function mockXHR() {
// mock patch
// https://github.com/nuysoft/Mock/issues/300
Mock.XHR.prototype.proxy_send = Mock.XHR.prototype.send
Mock.XHR.prototype.send = function() {
if (this.custom.xhr) {
this.custom.xhr.withCredentials = this.withCredentials || false
if (this.responseType) {
this.custom.xhr.responseType = this.responseType
}
}
this.proxy_send(...arguments)
}
function XHR2ExpressReqWrap(respond) {
return function(options) {
let result = null
if (respond instanceof Function) {
const { body, type, url } = options
// https://expressjs.com/en/4x/api.html#req
result = respond({
method: type,
body: JSON.parse(body),
query: param2Obj(url)
})
} else {
result = respond
}
return Mock.mock(result)
}
}
for (const i of mocks) {
Mock.mock(new RegExp(i.url), i.type || 'get', XHR2ExpressReqWrap(i.response))
}
}
// for mock server
const responseFake = (url, type, respond) => {
return {
url: new RegExp(`${process.env.VUE_APP_BASE_API}${url}`),
type: type || 'get',
response(req, res) {
res.json(Mock.mock(respond instanceof Function ? respond(req, res) : respond))
}
}
}
export default mocks.map(route => {
return responseFake(route.url, route.type, route.response)
})
// eslint-disable-next-line no-unused-vars
const adminMenu = [
{
'menuCode': 'SystemMgr',
'name': '资源管理',
'children': [
{
'menuCode': 'SysMgr',
'name': '系统管理'
},
{
'menuCode': 'MenuMgr',
'name': '菜单管理'
},
{
'menuCode': 'OrgMgr',
'name': '组织管理'
},
{
'menuCode': 'UserMgr',
'name': '人员管理'
},
{
'menuCode': 'RoleMgr',
'name': '角色管理'
},
{
'menuCode': 'AuthMgr',
'name': '权限管理'
}
]
},
{
'menuCode': 'TenantMgr',
'name': '租户管理',
'children': [
{
'menuCode': 'TenantMgrTenant',
'name': '租户列表'
},
{
'menuCode': 'TenantAuth',
'name': '租户权限'
},
{
'menuCode': 'TenantAccount',
'name': '管理员账号'
}
]
}
]
export default [
// 登录
{
url: '/cc/account/loginByAccountPwd',
type: 'post',
response: _ => {
return {
code: 200,
data: {
token: '00273486A8DBEEA016205E6E65CAE2F18A341D2847ED53676E2D9FE3B64271251F42821B5B79B28501B934623D20272600F6C0C0996A53CF2893ACD5B65110B129AF58B6B9835B0BE50B5FBD91AA7F11FB43EA9DA729ADBA47DE590369CB20A92E6915CCB8587EDCDC418435323E92CD92653F42E389E7E04044BC45B68F1FC80AE9A0CD7656A083F0E30BB33E408326CE329A81CC80F5D54F3887B7EC454A30C881CFFB853721D6C4112123DCC548D67280D7F23EA91CA7C5037022FBB6726FBE8ED7FE12ECB0549C84862D3265F19B3D83F50CCADEE830F854FC8410C524F65ACC23AEE09AFEE088B1861C59CD828F9AA2DB79B8FC3A2028A6B39AF6F927740FC9E5488765038FCCB32935081A974F'
},
responseTime: 1579403560634,
message: 'success'
}
}
},
// 登出
{
url: '/cc/account/logout',
type: 'post',
response: _ => {
return {
code: 200,
responseTime: 1579403560634,
message: 'success'
}
}
},
// 获取用户菜单列表
{
url: '/cc/index/userMenuTree',
type: 'get',
response: _ => {
return {
code: 200,
data: [
{
id: 1,
systemCode: 'cc',
systemName: 'cc',
url: 'http://192.168.31.248',
devUrl: '9528',
status: 0,
menuList: [
{
'menuCode': 'DatasetMgr',
'name': '数据管理',
'children': [
{
'menuCode': 'DatasetMgrMine',
'name': '我的数据'
},
{
'menuCode': 'DatasetMgrDetail',
'name': '数据详情'
},
{
'menuCode': 'DatasetMgrUpload',
'name': '上传数据'
}
]
},
{
'menuCode': 'ModelTraining',
'name': '模型训练',
'children': [
{
'menuCode': 'Visualization',
'name': '可视化模型'
},
{
'menuCode': 'EditModel',
'name': '编辑画布'
}
]
},
{
'menuCode': 'ModelWarehouse',
'name': '模型仓库',
'children': [
{
'menuCode': 'ModelWarehouseMine',
'name': '我的模型'
},
{
'menuCode': 'ModelWarehouseVersion',
'name': '模型版本'
},
{
'menuCode': 'ModelWarehouseDetail',
'name': '版本详情'
}
]
},
{
'menuCode': 'OnlineService',
'name': '在线服务',
'children': [
{
'menuCode': 'OnlineServiceMine',
'name': '我的服务'
},
{
'menuCode': 'OnlineServiceMonitor',
'name': '我的服务'
}
]
}
]
}
],
responseTime: 1579403560634,
message: 'success'
}
}
},
// 获取用户按键列表
{
url: '/cc/index/userMenuCodeList',
type: 'get',
response: _ => {
return {
code: 200,
data: ['OrgMgr_add', 'UserMgr_add', 'SysMgr_add', 'SysMgr_info', 'MenuMgr_delete', 'OrgMgr_update', 'MenuMgr_add', 'UserMgr_delete', 'SysMgr_delete', 'AuthMgr_Go', 'RoleMgr_info', 'MenuMgr_update', 'OrgMgr_info', 'UserMgr_update', 'SysMgr_update', 'AuthMgr_setting', 'MenuMgr_info', 'OrgMgr_delete', 'UserMgr_info'],
responseTime: 1579403560634,
message: 'success'
}
}
},
// Token校验有效性,在request.js有用到
{
url: '/cc/account/checkToken',
type: 'get',
response: _ => {
return {
code: 200,
responseTime: 1579403560634,
message: 'success'
}
}
},
// 获取帐号登录信息
{
url: '/cc/account/getUserLoginInfo',
type: 'get',
response: _ => {
return {
code: 200,
data: {
userId: 1,
account: 'admin',
realName: '超级管理员',
email: 'root@renren.io',
mobile: '13612345678',
departmentName: '阳煤集团',
roleName: '系统管理员',
status: '0',
lastLoginIp: '',
lastLoginTime: 0,
logoutTime: 0,
loginTime: 1580974698000,
loginIp: '39.154.199.53',
userSystemList:
[
{
id: 1,
systemName: 'cc',
systemCode: 'cc',
icon: '',
url: 'http://www.baidu.com',
status: 0,
userSystemRoleList: [
{
'roleName': '系统管理员',
'id': 1
}]
}]
},
responseTime: 1579403560634,
message: 'success'
}
}
}
]
const chokidar = require('chokidar')
const bodyParser = require('body-parser')
const chalk = require('chalk')
const path = require('path')
const mockDir = path.join(process.cwd(), 'mock')
function registerRoutes(app) {
let mockLastIndex
const { default: mocks } = require('./index.js')
for (const mock of mocks) {
app[mock.type](mock.url, mock.response)
mockLastIndex = app._router.stack.length
}
const mockRoutesLength = Object.keys(mocks).length
return {
mockRoutesLength: mockRoutesLength,
mockStartIndex: mockLastIndex - mockRoutesLength
}
}
function unregisterRoutes() {
Object.keys(require.cache).forEach(i => {
if (i.includes(mockDir)) {
delete require.cache[require.resolve(i)]
}
})
}
module.exports = app => {
// es6 polyfill
require('@babel/register')
// parse app.body
// https://expressjs.com/en/4x/api.html#req.body
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({
extended: true
}))
const mockRoutes = registerRoutes(app)
var mockRoutesLength = mockRoutes.mockRoutesLength
var mockStartIndex = mockRoutes.mockStartIndex
// watch files, hot reload mock server
chokidar.watch(mockDir, {
ignored: /mock-server/,
ignoreInitial: true
}).on('all', (event, path) => {
if (event === 'change' || event === 'add') {
try {
// remove mock routes stack
app._router.stack.splice(mockStartIndex, mockRoutesLength)
// clear routes cache
unregisterRoutes()
const mockRoutes = registerRoutes(app)
mockRoutesLength = mockRoutes.mockRoutesLength
mockStartIndex = mockRoutes.mockStartIndex
console.log(chalk.magentaBright(`\n > Mock Server hot reload success! changed ${path}`))
} catch (error) {
console.log(chalk.redBright(error))
}
}
})
}
const data = [
{
id: 1,
taskName: '设备故障诊断',
status: 0,
updateTime: 1593321093655
},
{
id: 2,
taskName: '个人信用贷款',
status: 1,
updateTime: 1593321093655
},
{
id: 3,
taskName: '物流最优路径',
status: 2,
updateTime: 1593321093655
}
]
const modelDetail = {
'nodes': [
{
'name': '线性回归',
'groupName': '机器学习',
'label': '线性回归',
'size': [
'170',
'34'
],
'type': 'node',
'x': 406,
'y': 395,
'shape': 'customNode',
'color': '#1890ff',
'image': '/static/img/tezhenggongcheng.d621fe0d.svg',
'stateImage': '',
'inPoints': [
[
0,
0.5
]
],
'outPoints': [
[
1,
0.5
]
],
'paramType': 'g',
'params': {
'alpha': 0,
'lambda': '1',
'randomSeed': '2',
'maxIterations': '1',
'targetConvergenceThreshold': '1',
'crossValidation': 1
},
'fieldType': 'd',
'fields': {
'featureId': [
1,
2
],
'labelId': 1
},
'offsetX': 80,
'offsetY': 34,
'id': 'node1291',
'style': {}
},
{
'name': '数据集',
'groupName': '数据集组件',
'label': '数据集',
'size': [
'170',
'34'
],
'type': 'node',
'x': 426,
'y': 102,
'shape': 'customNode',
'color': '#1890ff',
'image': '/static/img/dataset.5b96d2e4.svg',
'stateImage': '/static/img/ok.463ab0e4.svg',
'inPoints': [
[
0,
0.5
]
],
'outPoints': [
[
1,
0.5
]
],
'fieldType': 'a',
'fields': {
'datasetId': 1
},
'offsetX': 77,
'offsetY': 19,
'id': 'node1298',
'style': {}
},
{
'name': '数据类型转换',
'groupName': '数据处理组件',
'label': '数据类型转换',
'size': [
'170',
'34'
],
'type': 'node',
'x': 415,
'y': 183,
'shape': 'customNode',
'color': '#1890ff',
'image': '/static/img/dataChange.ad51f236.svg',
'stateImage': '',
'inPoints': [
[
0,
0.5
]
],
'outPoints': [
[
1,
0.5
]
],
'paramType': 'c',
'params': {
'exportType': 1
},
'fieldType': 'c',
'fields': {
'columnId': [
1,
2
]
},
'offsetX': 83,
'offsetY': 21,
'id': 'node1305',
'style': {}
},
{
'name': '异常值处理',
'groupName': '数据预处理',
'label': '异常值处理',
'size': [
'170',
'34'
],
'type': 'node',
'x': 411,
'y': 289,
'shape': 'customNode',
'color': '#1890ff',
'image': '/static/img/tezhenggongcheng.d621fe0d.svg',
'stateImage': '',
'inPoints': [
[
0,
0.5
]
],
'outPoints': [
[
1,
0.5
]
],
'paramType': 'f',
'params': {
'outlierType': 1,
'fillingType': 1,
'customValue': '1',
'fillingValue': '1',
'quantile': 0,
'rule': null
},
'fieldType': 'c',
'fields': {
'columnId': [
1
]
},
'offsetX': 97,
'offsetY': 28,
'id': 'node1312',
'style': {}
}
],
'edges': [
{
'id': 'edge1405',
'source': 'node1298',
'target': 'node1305',
'sourceId': 'node1298',
'targetId': 'node1305',
'start': {
'x': 0,
'y': 17
},
'end': {
'x': 0,
'y': -17
},
'shape': 'customEdge',
'type': 'edge',
'style': {},
'startPoint': {
'x': 423.62345679012344,
'y': 119.5
},
'endPoint': {
'x': 417.37654320987656,
'y': 165.5
}
},
{
'id': 'edge1479',
'source': 'node1305',
'target': 'node1312',
'sourceId': 'node1305',
'targetId': 'node1312',
'start': {
'x': 0,
'y': 17
},
'end': {
'x': 0,
'y': -17
},
'shape': 'customEdge',
'type': 'edge',
'style': {},
'startPoint': {
'x': 414.33962264150944,
'y': 200.5
},
'endPoint': {
'x': 411.66037735849056,
'y': 271.5
}
},
{
'id': 'edge1569',
'source': 'node1312',
'target': 'node1291',
'sourceId': 'node1312',
'targetId': 'node1291',
'start': {
'x': 0,
'y': 17
},
'end': {
'x': 0,
'y': -17
},
'shape': 'customEdge',
'type': 'edge',
'style': {},
'startPoint': {
'x': 410.17452830188677,
'y': 306.5
},
'endPoint': {
'x': 406.82547169811323,
'y': 377.5
}
}
],
'combos': [],
'groups': []
}
export default [
// 获取任务列表
{
url: '/cc/linque/getTaskList',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {
pageNum: 1,
pageSize: 10,
totalSize: data.length,
records: data
}
}
}
},
// 创建实验
{
url: '/cc/linque/createTask',
type: 'post',
response: (req, res) => {
const { taskName } = req.body
const date = new Date()
const task = {
taskName,
id: data.length + 1,
status: 2,
updateTime: date.getTime()
}
data.push(task)
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
},
// 删除实验
{
url: '/cc/linque/deleteTask',
type: 'post',
response: (req, res) => {
const { id } = req.body
const index = data.findIndex(item => item.id === id)
data.splice(index, 1)
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
},
// 创建模型
{
url: '/cc/linque/createModel',
type: 'post',
response: (req, res) => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
},
// 获取模型数据
{
url: '/cc/linque/getModelVisualization',
type: 'post',
response: (req, res) => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: modelDetail
}
}
}
]
const data = [
{
id: 1,
modelName: '金融风控_1',
versionCount: 2,
info: '',
createTime: 1593321093655,
updateTime: 1593321093655
},
{
id: 2,
modelName: '金融风控_2',
versionCount: 1,
info: '',
createTime: 1593321093655,
updateTime: 1593321093655
}
]
export default [
// 获取模型列表
{
url: '/cc/linque/getModelList',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {
pageNum: 1,
pageSize: 10,
totalSize: data.length,
records: data
}
}
}
},
// 获取模型详情
{
url: '/cc/linque/getModelDetail',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {
id: 1,
modelName: '金融风控_1',
version: '0.0.1',
info: '',
createTime: 1593321093655,
updateTime: 1593321093655
}
}
}
},
// 获取模型列表
{
url: '/cc/linque/getAllModelList',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: data
}
}
}
]
const data = [
{
id: 1,
versionNumber: '0.0.1',
createTime: 1593321093655,
updateTime: 1593321093655
},
{
id: 2,
versionNumber: '0.0.2',
createTime: 1593321093655,
updateTime: 1593321093655
}
]
export default [
// 获取模型列表
{
url: '/cc/linque/getModelVersionList',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {
pageNum: 1,
pageSize: 10,
totalSize: data.length,
records: data
}
}
}
},
// 删除模型版本
{
url: '/cc/linque/deleteModelVersion',
type: 'post',
response: (req, res) => {
const { id } = req.body
const index = data.findIndex(item => item.id === id)
data.splice(index, 1)
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
},
// 获取模型版本详情
{
url: '/cc/linque/getModelVersionDetail',
type: 'post',
response: (req, res) => {
// const { id } = req.body
// const model = data.find(item => item.id === id)
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {
modelName: '金融'
}
}
}
}
]
const services = [
{
id: 1,
serviceName: '金融风控_1',
version: '0.0.1',
modelName: '金融风控_1',
modelVersionId: 1,
status: 1,
createTime: 1593321093655,
updateTime: 1593321093655
},
{
id: 2,
serviceName: '金融风控_2',
version: '0.0.2',
modelName: '金融风控_2',
modelVersionId: 2,
status: 2,
createTime: 1593321093655,
updateTime: 1593321093655
}
]
export default [
// 获取服务列表
{
url: '/cc/linque/getServiceListByModelVersion',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: services
}
}
},
// 获取服务列表-分页
{
url: '/cc/linque/getServiceList',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {
pageNum: 1,
pageSize: 10,
totalSize: services.length,
records: services
}
}
}
},
// 删除服务
{
url: '/cc/linque/deleteService',
type: 'post',
response: (req, res) => {
const index = services.findIndex(item => req.body.id === item.id)
services.splice(index, 1)
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
},
// 创建服务
{
url: '/cc/linque/createService',
type: 'post',
response: (req, res) => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
}
]
const data = [
{
id: 1,
date: '2020/7/1',
pv: 250,
timeConsuming: 0.005,
bytes: 159,
successCount: 200,
failCount: 25,
totalCount: 225,
statusCode: {
twoHundred: 150,
threeHundred: 30,
fourHundred: 10,
fiveHundred: 5,
other: 5
}
},
{
id: 2,
date: '2020/7/2',
pv: 250,
timeConsuming: 0.005,
bytes: 159,
successCount: 210,
failCount: 30,
totalCount: 240,
statusCode: {
twoHundred: 150,
threeHundred: 30,
fourHundred: 10,
fiveHundred: 5,
other: 5
}
},
{
id: 3,
date: '2020/7/3',
pv: 250,
timeConsuming: 0.005,
bytes: 159,
successCount: 270,
failCount: 30,
totalCount: 300,
statusCode: {
twoHundred: 150,
threeHundred: 30,
fourHundred: 10,
fiveHundred: 5,
other: 5
}
},
{
id: 4,
date: '2020/7/4',
pv: 250,
timeConsuming: 0.005,
bytes: 159,
successCount: 200,
failCount: 15,
totalCount: 215,
statusCode: {
twoHundred: 150,
threeHundred: 30,
fourHundred: 10,
fiveHundred: 5,
other: 5
}
},
{
id: 5,
date: '2020/7/5',
pv: 250,
timeConsuming: 0.005,
bytes: 159,
successCount: 120,
failCount: 9,
totalCount: 129,
statusCode: {
twoHundred: 150,
threeHundred: 30,
fourHundred: 10,
fiveHundred: 5,
other: 5
}
},
{
id: 6,
date: '2020/7/6',
pv: 250,
timeConsuming: 0.005,
bytes: 159,
successCount: 310,
failCount: 27,
totalCount: 337,
statusCode: {
twoHundred: 150,
threeHundred: 30,
fourHundred: 10,
fiveHundred: 5,
other: 5
}
},
{
id: 7,
date: '2020/7/7',
pv: 250,
timeConsuming: 0.005,
bytes: 159,
successCount: 330,
failCount: 33,
totalCount: 363,
statusCode: {
twoHundred: 150,
threeHundred: 30,
fourHundred: 10,
fiveHundred: 5,
other: 5
}
}
]
export default [
// 获取数据集列表
{
url: '/cc/linque/getMonitorData',
type: 'post',
response: (req, res) => {
const { startTime, endTime } = req.body
const arr = []
if (startTime === endTime) {
const item = data.find(v => v.date === startTime)
arr.push(item)
} else {
let startIndex = data.findIndex(v => v.date === startTime)
let endIndex = data.findIndex(v => v.date === endTime)
startIndex = startIndex === -1 ? 0 : startIndex
endIndex = endIndex === -1 ? data.length : endIndex
for (let i = 0; i < data.length; i++) {
if (i >= startIndex && i <= endIndex) arr.push(data[i])
}
}
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: arr
}
}
}
]
let lineData = []
function random(m,n) {
return Math.round(Math.random()*(m-n)+n)
}
export default [
{
url: '/cc/g2plot/getLineData',
type: 'get',
response: (req, res) => {
const time = new Date().getTime()
const data = [
...lineData,
{ time: time, value: random(20,6) }
]
lineData = [...data]
return {
"code": 200,
"message": "success",
"responseTime": 1593321094037,
"data": lineData
}
}
},
{
url: '/cc/g2plot/getOverviewData',
type: 'get',
response: (req, res) => {
return {
"code": 200,
"message": "success",
"responseTime": 1593321094037,
"data": {
temperature: random(70,55),
pressure: random(80,40),
power: random(90,75)
}
}
}
}
]
export default [
// 所有角色分类列表
{
url: '/cc/role/all',
type: 'get',
response: _ => {
return {
"code": 200,
"message": "success",
"responseTime": 1593321094037,
"data": [
{
"tenantId": 2,
"tenantName": "英思唯网络货运平台",
"roles": [
{
"id": 5,
"roleName": "运营角色"
}
]
}
]
}
}
},
// 角色权限列表
{
url: '/cc/rolemenu/list',
type: 'get',
response: _ => {
return {
"code": 200,
"message": "success",
"responseTime": 1593321094319,
"data": {
"rowKeyList": [
{
"rowKey": "31_0",
"dataPerm": null
},
{
"rowKey": "53_0",
"dataPerm": null
},
{
"rowKey": "54_1",
"dataPerm": 1
},
{
"rowKey": "55_1",
"dataPerm": 1
},
{
"rowKey": "63_1",
"dataPerm": 1
},
{
"rowKey": "64_1",
"dataPerm": 1
},
{
"rowKey": "59_0",
"dataPerm": null
},
{
"rowKey": "60_1",
"dataPerm": 1
},
{
"rowKey": "61_1",
"dataPerm": 1
},
{
"rowKey": "62_1",
"dataPerm": 1
},
{
"rowKey": "56_0",
"dataPerm": null
},
{
"rowKey": "78_1",
"dataPerm": 1
},
{
"rowKey": "57_1",
"dataPerm": 1
},
{
"rowKey": "58_1",
"dataPerm": 1
},
{
"rowKey": "65_1",
"dataPerm": 1
},
{
"rowKey": "66_1",
"dataPerm": 1
},
{
"rowKey": "67_1",
"dataPerm": 1
},
{
"rowKey": "77_1",
"dataPerm": 1
},
{
"rowKey": "36_0",
"dataPerm": null
},
{
"rowKey": "37_1",
"dataPerm": 1
},
{
"rowKey": "38_2",
"dataPerm": null
},
{
"rowKey": "39_2",
"dataPerm": null
},
{
"rowKey": "40_1",
"dataPerm": 1
},
{
"rowKey": "41_1",
"dataPerm": 1
},
{
"rowKey": "42_1",
"dataPerm": 1
},
{
"rowKey": "43_1",
"dataPerm": 1
},
{
"rowKey": "44_1",
"dataPerm": 1
},
{
"rowKey": "45_1",
"dataPerm": 1
},
{
"rowKey": "68_0",
"dataPerm": null
},
{
"rowKey": "69_1",
"dataPerm": 1
},
{
"rowKey": "72_1",
"dataPerm": 1
},
{
"rowKey": "73_1",
"dataPerm": 1
},
{
"rowKey": "46_0",
"dataPerm": null
},
{
"rowKey": "47_1",
"dataPerm": 1
},
{
"rowKey": "51_1",
"dataPerm": 1
},
{
"rowKey": "48_1",
"dataPerm": 1
},
{
"rowKey": "49_1",
"dataPerm": 1
},
{
"rowKey": "52_1",
"dataPerm": 1
},
{
"rowKey": "74_0",
"dataPerm": null
},
{
"rowKey": "75_1",
"dataPerm": 1
},
{
"rowKey": "76_1",
"dataPerm": 1
}
],
"canEdited": true
}
}
}
},
// 角色权限设置
{
url: '/cc/rolemenu/setRoleMenu',
type: 'post',
response: _ => {
return {
code: 200,
responseTime: 1579403560634,
message: 'success',
data: {}
}
}
}
]
This diff is collapsed.
export default [
// 组织树列表
{
url: '/cc/department/listTree',
type: 'get',
response: _ => {
return {
"code": 200,
"message": "success",
"responseTime": 1593322102878,
"data": [
{
"id": "t_0",
"departmentName": "管理平台",
"parentId": "0",
"tenantId": 0,
"category": "0",
"orderNum": 0,
"userCount": 0,
"children": []
},
{
"id": "t_2",
"departmentName": "英思唯网络货运平台",
"parentId": "0",
"tenantId": 2,
"category": "0",
"principal": "黄朝斌",
"orderNum": 0,
"userCount": 0,
"children": [
{
"id": "1",
"departmentName": "运营部",
"parentId": "t_2",
"tenantId": 2,
"orderNum": 1,
"userCount": 0,
"children": []
}
]
}
]
}
}
},
// 新增组织
{
url: '/cc/department/add',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
},
// 删除组织
{
url: '/cc/department/delete',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
},
// 组织详情
{
url: '/cc/department/info',
type: 'get',
response: _ => {
return {
"code": 200,
"message": "success",
"responseTime": 1593322411649,
"data": {
"id": "1",
"departmentName": "运营部",
"parentId": "t_2",
"tenantId": 2,
"orderNum": 1
}
}
}
},
// 修改组织信息
{
url: '/cc/department/update',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
},
// 查询可修改上级组织
{
url: '/cc/department/chooseList',
type: 'get',
response: _ => {
return {
"code": 200,
"message": "success",
"responseTime": 1593322411305,
"data": [
{
"id": "t_2",
"departmentName": "英思唯网络货运平台"
}
]
}
}
}
]
export default [
// 角色分类列表
{
url: '/cc/roleCategory/list',
type: 'get',
response: _ => {
return {
"code": 200,
"message": "success",
"responseTime": 1593322102878,
"data": [
{
"id": "t_0",
"departmentName": "管理平台",
"parentId": "0",
"tenantId": 0,
"category": "0",
"orderNum": 0,
"userCount": 0,
"children": []
},
{
"id": "t_2",
"departmentName": "英思唯网络货运平台",
"parentId": "0",
"tenantId": 2,
"category": "0",
"principal": "黄朝斌",
"orderNum": 0,
"userCount": 0,
"children": [
{
"id": "1",
"departmentName": "运营部",
"parentId": "t_2",
"tenantId": 2,
"orderNum": 1,
"userCount": 0,
"children": []
}
]
}
]
}
}
},
// 增加角色分类
{
url: '/cc/roleCategory/add',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
},
// 修改角色分类
{
url: '/cc/roleCategory/update',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
},
// 删除角色分类
{
url: '/cc/roleCategory/delete',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
},
// 角色列表
{
url: '/cc/role/list',
type: 'get',
response: _ => {
return {
"code": 200,
"message": "success",
"responseTime": 1593323774003,
"data": {
"records": [],
"total": 0,
"size": 10,
"current": 1,
"orders": [],
"hitCount": false,
"searchCount": true,
"pages": 0
}
}
}
},
// 增加角色
{
url: '/cc/role/add',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
},
// 修改角色
{
url: '/cc/role/update',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
},
// 删除角色
{
url: '/cc/role/delete',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
}
]
export default [
// 获取系统列表
{
url: '/cc/system/list',
type: 'get',
response: _ => {
return {
"code": 200,
"message": "success",
"responseTime": 1593321873814,
"data": {
"records": [
{
"id": 1,
"systemCode": "freight",
"systemName": "网络货运平台",
"icon": null,
"url": "http://192.168.31.248",
"devUrl": "9527",
"status": 0,
"deleted": false
}
],
"total": 1,
"size": 10,
"current": 1,
"orders": [],
"hitCount": false,
"searchCount": true,
"pages": 1
}
}
}
},
// 创建系统
{
url: '/cc/system/create',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
},
// 修改系统信息
{
url: '/cc/system/update',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
},
// 删除系统
{
url: '/cc/system/delete',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
}
]
export default [
// 查询用户列表
{
url: '/cc/user/list',
type: 'post',
response: _ => {
return {
"code": 200,
"message": "success",
"responseTime": 1593322600465,
"data": {
"records": [],
"total": 0,
"size": 10,
"current": 1,
"orders": [],
"hitCount": false,
"searchCount": true,
"pages": 0
}
}
}
},
// 新增用户
{
url: '/cc/user/add',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
},
// 更新用户信息
{
url: '/cc/user/update',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
},
// 获取用户信息
{
url: '/cc/user/get',
type: 'get',
response: _ => {
return {
"code": 200,
"message": "success",
"responseTime": 1593322411649,
"data": {
"id": "1",
"departmentName": "运营部",
"parentId": "t_2",
"tenantId": 2,
"orderNum": 1
}
}
}
},
// 修改组织信息
{
url: '/cc/department/update',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
},
// 查询可修改上级组织
{
url: '/cc/department/chooseList',
type: 'get',
response: _ => {
return {
"code": 200,
"message": "success",
"responseTime": 1593322411305,
"data": [
{
"id": "t_2",
"departmentName": "英思唯网络货运平台"
}
]
}
}
}
]
export default [
// 获取租户管理员列表
{
url: '/cc/tenantAdmin/list',
type: 'get',
response: _ => {
return {
"code": 200,
"message": "success",
"responseTime": 1593325192747,
"data": {
"records": [
{
"id": 5,
"account": "admin001",
"realName": "黄朝斌",
"status": 1,
"tenantId": 2,
"tenantName": "英思唯网络货运平台",
"canEdited": true
}
],
"total": 1,
"size": 10,
"current": 1,
"orders": [],
"hitCount": false,
"searchCount": true,
"pages": 1
}
}
}
},
// 增加租户管理员
{
url: '/cc/tenantAdmin/add',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
},
// 更新租户管理员
{
url: '/cc/tenantAdmin/update',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
},
// 删除租户管理员
{
url: '/cc/tenantAdmin/delete',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
}
]
export default [
// 获取租户权限列表
{
url: '/cc/tenantMenu/list',
type: 'get',
response: _ => {
return {
"code": 200,
"message": "success",
"responseTime": 1593325414667,
"data": {
"rowKeyList": [
{
"rowKey": "31_0",
"dataPerm": null
},
{
"rowKey": "53_0",
"dataPerm": null
},
{
"rowKey": "54_1",
"dataPerm": 1
},
{
"rowKey": "55_1",
"dataPerm": 1
},
{
"rowKey": "63_1",
"dataPerm": 1
},
{
"rowKey": "64_1",
"dataPerm": 1
},
{
"rowKey": "59_0",
"dataPerm": null
},
{
"rowKey": "60_1",
"dataPerm": 1
},
{
"rowKey": "61_1",
"dataPerm": 1
},
{
"rowKey": "62_1",
"dataPerm": 1
},
{
"rowKey": "56_0",
"dataPerm": null
},
{
"rowKey": "57_1",
"dataPerm": 1
},
{
"rowKey": "78_1",
"dataPerm": 1
},
{
"rowKey": "58_1",
"dataPerm": 1
},
{
"rowKey": "65_1",
"dataPerm": 1
},
{
"rowKey": "66_1",
"dataPerm": 1
},
{
"rowKey": "67_1",
"dataPerm": 1
},
{
"rowKey": "77_1",
"dataPerm": 1
},
{
"rowKey": "36_0",
"dataPerm": null
},
{
"rowKey": "37_1",
"dataPerm": 1
},
{
"rowKey": "38_2",
"dataPerm": null
},
{
"rowKey": "39_2",
"dataPerm": null
},
{
"rowKey": "40_1",
"dataPerm": 1
},
{
"rowKey": "41_1",
"dataPerm": 1
},
{
"rowKey": "42_1",
"dataPerm": 1
},
{
"rowKey": "43_1",
"dataPerm": 1
},
{
"rowKey": "44_1",
"dataPerm": 1
},
{
"rowKey": "45_1",
"dataPerm": 1
},
{
"rowKey": "68_0",
"dataPerm": null
},
{
"rowKey": "69_1",
"dataPerm": 1
},
{
"rowKey": "72_1",
"dataPerm": 1
},
{
"rowKey": "73_1",
"dataPerm": 1
},
{
"rowKey": "46_0",
"dataPerm": null
},
{
"rowKey": "47_1",
"dataPerm": 1
},
{
"rowKey": "51_1",
"dataPerm": 1
},
{
"rowKey": "48_1",
"dataPerm": 1
},
{
"rowKey": "49_1",
"dataPerm": 1
},
{
"rowKey": "52_1",
"dataPerm": 1
},
{
"rowKey": "74_0",
"dataPerm": null
},
{
"rowKey": "75_1",
"dataPerm": 1
},
{
"rowKey": "76_1",
"dataPerm": 1
},
{
"rowKey": "12_1",
"dataPerm": 1
},
{
"rowKey": "13_2",
"dataPerm": null
},
{
"rowKey": "14_2",
"dataPerm": null
},
{
"rowKey": "15_2",
"dataPerm": null
},
{
"rowKey": "16_2",
"dataPerm": null
},
{
"rowKey": "17_1",
"dataPerm": 1
},
{
"rowKey": "18_2",
"dataPerm": null
},
{
"rowKey": "19_2",
"dataPerm": null
},
{
"rowKey": "20_2",
"dataPerm": null
},
{
"rowKey": "21_2",
"dataPerm": null
},
{
"rowKey": "22_1",
"dataPerm": 1
},
{
"rowKey": "23_2",
"dataPerm": null
},
{
"rowKey": "24_2",
"dataPerm": null
},
{
"rowKey": "25_2",
"dataPerm": null
},
{
"rowKey": "26_2",
"dataPerm": null
},
{
"rowKey": "30_2",
"dataPerm": null
},
{
"rowKey": "27_1",
"dataPerm": 1
},
{
"rowKey": "28_2",
"dataPerm": null
}
],
"canEdited": true
}
}
}
},
// 设置租户权限
{
url: '/cc/tenantMenu/setTenantMenu',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
}
]
export default [
// 获取租户列表-不分页
{
url: '/cc/tenant/all',
type: 'get',
response: _ => {
return {
"code": 200,
"message": "success",
"responseTime": 1593323774667,
"data": [
{
"id": 0,
"tenantName": "管理平台",
"adminRoleId": 1
},
{
"id": 2,
"tenantName": "英思唯网络货运平台",
"adminRoleId": 2
}
]
}
}
},
// 获取租户列表
{
url: '/cc/tenant/list',
type: 'get',
response: _ => {
return {
"code": 200,
"message": "success",
"responseTime": 1593324145480,
"data": {
"records": [
{
"id": 0,
"tenantName": "管理平台",
"tenantCode": "platform",
"contact": null,
"contactPhone": null,
"status": 0,
"orderNum": 1,
"adminRoleId": 1,
"createUser": "admin",
"createTime": "2020-04-14 08:35:44",
"updateUser": null,
"updateTime": "2020-06-22 09:31:00",
"deleted": false,
"canEdited": false
},
{
"id": 2,
"tenantName": "英思唯网络货运平台",
"tenantCode": "esvFreight",
"contact": "黄朝斌",
"contactPhone": null,
"status": 0,
"orderNum": 2,
"adminRoleId": 2,
"createUser": "admin",
"createTime": "2020-06-15 11:00:00",
"updateUser": null,
"updateTime": "2020-06-15 12:15:12",
"deleted": false,
"canEdited": true
}
],
"total": 2,
"size": 10,
"current": 1,
"orders": [],
"hitCount": false,
"searchCount": true,
"pages": 1
}
}
}
},
// 增加租户
{
url: '/cc/tenant/add',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
},
// 更新租户
{
url: '/cc/tenant/update',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
},
// 删除租户
{
url: '/cc/tenant/delete',
type: 'post',
response: _ => {
return {
code: 200,
message: 'success',
responseTime: 1593321093655,
data: {}
}
}
}
]
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root /app;
index index.html;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
{
"name": "data-center-web",
"version": "0.0.1",
"description": "",
"author": "Dusu Wen <wendusu@esvtek.com>",
"scripts": {
"test:unit": "jest --clearCache && vue-cli-service test:unit",
"lint": "eslint --ext .js,.vue src",
"build:prod": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging",
"dev": "vue-cli-service serve",
"dev:mock": "vue-cli-service serve --mode mock",
"new": "plop",
"preview": "node build/index.js --preview",
"svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml",
"test:ci": "npm run lint && npm run test:unit",
"test:unit-reporter": "node src/utils/readJson.js"
},
"dependencies": {
"@antv/g2plot": "^1.1.15",
"@antv/g6": "^3.5.12",
"@antv/util": "^2.0.9",
"@shopify/draggable": "^1.0.0-beta.8",
"axios": "0.18.1",
"babel-polyfill": "^6.26.0",
"core-js": "^3.6.5",
"driver.js": "0.9.5",
"echarts": "4.2.1",
"element-ui": "2.13.0",
"fuse.js": "^3.6.1",
"js-cookie": "2.2.0",
"jsoneditor": "^9.0.3",
"jsonlint": "1.6.3",
"lodash": "^4.17.19",
"md5": "^2.2.1",
"moment": "^2.27.0",
"normalize.css": "7.0.0",
"nprogress": "0.2.0",
"path-to-regexp": "2.4.0",
"print-js": "^1.0.63",
"screenfull": "^5.0.2",
"vue": "2.6.10",
"vue-clipboard2": "^0.3.1",
"vue-count-to": "1.0.13",
"vue-json-pretty": "^1.6.5",
"vue-router": "3.0.2",
"vue-splitpane": "1.0.4",
"vuedraggable": "2.20.0",
"vuex": "3.1.0",
"xlsx": "0.14.1"
},
"devDependencies": {
"@babel/core": "7.0.0",
"@babel/register": "7.0.0",
"@vue/cli-plugin-babel": "^4.4.6",
"@vue/cli-plugin-eslint": "^4.4.6",
"@vue/cli-plugin-unit-jest": "^4.4.6",
"@vue/cli-service": "^4.4.6",
"@vue/test-utils": "1.0.0-beta.29",
"autoprefixer": "^9.8.5",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "^10.1.0",
"babel-jest": "23.6.0",
"babel-plugin-dynamic-import-node": "^2.3.3",
"chalk": "2.4.2",
"chokidar": "2.1.5",
"connect": "3.6.6",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"html-webpack-plugin": "3.2.0",
"husky": "1.3.1",
"less-loader": "^6.2.0",
"lint-staged": "8.1.5",
"mockjs": "1.0.1-beta3",
"plop": "2.3.0",
"runjs": "^4.3.2",
"sass": "^1.26.10",
"sass-loader": "^9.0.2",
"script-ext-html-webpack-plugin": "2.1.3",
"script-loader": "0.7.2",
"serve-static": "^1.13.2",
"svg-sprite-loader": "4.1.3",
"svgo": "1.2.0",
"vue-template-compiler": "2.6.10",
"webpack": "^4.44.0",
"webpack-dev-server": "^3.11.0"
},
"browserslist": [
"> 1%",
"last 2 versions"
],
"engines": {
"node": ">=8.9",
"npm": ">= 3.0.0"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"keywords": [],
"license": "",
"lint-staged": {
"src/**/*.{js,vue}": [
"eslint --fix",
"git add"
]
}
}
{{#if template}}
<template>
<div />
</template>
{{/if}}
{{#if script}}
<script>
export default {
name: '{{ properCase name }}',
props: {},
data() {
return {}
},
created() {},
mounted() {},
methods: {}
}
</script>
{{/if}}
{{#if style}}
<style lang="scss" scoped>
</style>
{{/if}}
const { notEmpty } = require('../utils.js')
module.exports = {
description: 'generate vue component',
prompts: [{
type: 'input',
name: 'name',
message: 'component name please',
validate: notEmpty('name')
},
{
type: 'checkbox',
name: 'blocks',
message: 'Blocks:',
choices: [{
name: '<template>',
value: 'template',
checked: true
},
{
name: '<script>',
value: 'script',
checked: true
},
{
name: 'style',
value: 'style',
checked: true
}
],
validate(value) {
if (value.indexOf('script') === -1 && value.indexOf('template') === -1) {
return 'Components require at least a <script> or <template> tag.'
}
return true
}
}
],
actions: data => {
const name = '{{properCase name}}'
const actions = [{
type: 'add',
path: `src/components/${name}/index.vue`,
templateFile: 'plop-templates/component/index.hbs',
data: {
name: name,
template: data.blocks.includes('template'),
script: data.blocks.includes('script'),
style: data.blocks.includes('style')
}
}]
return actions
}
}
exports.notEmpty = name => {
return v => {
if (!v || v.trim === '') {
return `${name} is required`
} else {
return true
}
}
}
{{#if template}}
<template>
<div>
<el-card class="no-bottom">
<el-form
ref="searchForm"
:model="searchForm"
label-width="80px"
inline
>
<el-form-item
label="input:"
prop="input"
>
<el-input v-model="searchForm.input" />
</el-form-item>
<el-form-item
label="status:"
prop="status"
>
<el-select v-model="searchForm.status" placeholder="请选择">
<el-option label="全部" :value="null" />
<el-option label="正常" :value="0" />
<el-option label="锁定" :value="1" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="getTableData">查询</el-button>
<el-button icon="el-icon-refresh" @click="resetForm">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="margin-top-20">
<div class="buttons-group margin-bottom-20">
<el-button type="primary" icon="el-icon-plus" @click="addRow">增加系统</el-button>
</div>
<el-table
:data="tableData"
border
>
<el-table-column
type="index"
label="序号"
width="50px"
align="center"
/>
<el-table-column
prop="a"
label="a"
/>
<el-table-column
prop="b"
label="b"
/>
<el-table-column
prop="c"
label="c"
/>
<el-table-column
prop="d"
label="d"
/>
<el-table-column
label="操作"
width="140px"
align="center"
>
<template slot-scope="props">
<el-button v-permission="'SysMgr_update'" type="text" @click="editItem(props.row)">编辑</el-button>
<el-popconfirm
title="确定要删除此条记录吗?"
@onConfirm="deleteItem(props.row.id)"
>
<el-button slot="reference" type="text">删除</el-button>
</el-popconfirm>
</template>
</el-table-column>
</el-table>
<el-pagination
class="margin-top-20 text-align-right"
:current-page="pageForm.pageNum"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageForm.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="pageForm.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</el-card>
<el-dialog
:title="add ? '增加系统' : '编辑系统'"
:visible.sync="dialogVisible"
width="700px"
>
<el-form
:model="addForm"
label-width="90px"
>
<el-form-item
label="input:"
>
<el-input v-model="addForm.input" />
</el-form-item>
<el-form-item
label="status:"
>
<el-input v-model="addForm.status" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="saveSystem">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
{{/if}}
{{#if script}}
<script>
export default {
name: '{{ properCase name }}',
props: {},
data() {
return {
searchForm: {
input: null,
status: null
},
add: true,
dialogVisible: false,
tableData: [],
addForm: {
input: null,
status: null
},
pageForm: {
pageSize: 10,
pageNum: 1,
total: 0
}
}
},
created() {},
mounted() {},
methods: {
getTableData(pageNum) {},
resetForm() {
this.$refs.searchForm.resetFields()
},
addRow() {
this.add = true
this.dialogVisible = true
},
editItem() {
this.add = false
this.dialogVisible = true
},
deleteItem(id) {},
saveSystem() {},
handleSizeChange(val) {
this.pageForm.pageSize = val
this.getTableData(1)
},
handleCurrentChange(val) {
this.pageForm.pageNum = val
this.getTableData(val)
}
}
}
</script>
{{/if}}
{{#if style}}
<style lang="scss" scoped>
</style>
{{/if}}
const { notEmpty } = require('../utils.js')
module.exports = {
description: 'generate a view',
prompts: [{
type: 'input',
name: 'name',
message: 'view name please',
validate: notEmpty('name')
},
{
type: 'input',
name: 'path',
message: 'view path please',
validate: notEmpty('path')
},
{
type: 'checkbox',
name: 'blocks',
message: 'Blocks:',
choices: [{
name: '<template>',
value: 'template',
checked: true
},
{
name: '<script>',
value: 'script',
checked: true
},
{
name: 'style',
value: 'style',
checked: true
}
],
validate(value) {
if (value.indexOf('script') === -1 && value.indexOf('template') === -1) {
return 'View require at least a <script> or <template> tag.'
}
return true
}
}
],
actions: data => {
const name = '{{name}}'
const path = '{{path}}'
const actions = [{
type: 'add',
path: `src/views/${path}/index.vue`,
templateFile: 'plop-templates/view/index.hbs',
data: {
name: name,
template: data.blocks.includes('template'),
script: data.blocks.includes('script'),
style: data.blocks.includes('style')
}
}]
return actions
}
}
const viewGenerator = require('./plop-templates/view/prompt')
const componentGenerator = require('./plop-templates/component/prompt')
module.exports = function(plop) {
plop.setGenerator('view', viewGenerator)
plop.setGenerator('component', componentGenerator)
}
module.exports = {
plugins: {
autoprefixer: {}
}
}
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= webpackConfig.name %></title>
</head>
<body>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
<template>
<div id="app">
<router-view />
</div>
</template>
<script>
export default {
name: 'App'
}
</script>
import request from '@/utils/request'
// const baseURL = process.env.VUE_APP_BASE_API
const baseURL = ''
// 获取图片验证码
export function getCaptcha(data) {
return request({
url: `${baseURL}/base/captcha/get`,
method: 'post',
data
})
}
// 校验图片验证码
export function verifyCaptcha(data) {
return request({
url: `${baseURL}/base/captcha/verify`,
method: 'post',
data
})
}
import request from '@/utils/request'
// const baseURL = process.env.VUE_APP_BASE_API
const baseURL = ''
// 上传单个文件
export function uploadSingle(data) {
return request({
url: `${baseURL}/file/upload/single`,
method: 'post',
data
})
}
// 上传水印文件
export function imageWithWatermark(data) {
return request({
url: `${baseURL}/file/upload/imageWithWatermark`,
method: 'post',
data
})
}
// 获取单个文件数据
export function downloadSingle(data) {
return request({
url: `${baseURL}/file/download/single`,
method: 'post',
data
})
}
// 删除单个文件
export function deleteSingle(data) {
return request({
url: `${baseURL}/file/delete/single`,
method: 'post',
data
})
}
// 身份证正面识别
export function ocrIdCardFront(data) {
return request({
url: `${baseURL}/file/ocr/idcard/front`,
method: 'post',
data
})
}
import request from '@/utils/request'
// const baseURL = process.env.VUE_APP_BASE_API
const baseURL = ''
// 获取数据集列表-分页
export function getDatasetList(data) {
return request({
url: `${baseURL}/cc/linque/getDatasetList`,
method: 'post',
data
})
}
// 获取数据集详情
export function getDatasetDetail(data) {
return request({
url: `${baseURL}/cc/linque/getDatasetDetail`,
method: 'post',
data
})
}
// 创建数据集
export function addDataset(data) {
return request({
url: `${baseURL}/cc/linque/addDataset`,
method: 'post',
data
})
}
// 这个文件是为登录页面插件化准备的文件
import request from '@/utils/request'
// import { AccountApi } from 'cc-component-login'
import { AccountApi } from '@/components/cc-login/index'
const account = new AccountApi(request)
export {
account
}
import request from '@/utils/request'
// const baseURL = process.env.VUE_APP_BASE_API
const baseURL = ''
// 登录
export function login(data) {
return request({
url: `${baseURL}/cc/account/loginByAccountPwd`,
method: 'post',
data
})
}
// 登出
export function logout(data) {
return request({
url: `${baseURL}/cc/account/logout`,
method: 'post',
data
})
}
// 获取用户菜单列表
export function getMenuList() {
return request({
url: `${baseURL}/cc/index/userMenuTree`,
method: 'get'
})
}
// 获取用户按键列表
export function getPermissionList() {
return request({
url: `${baseURL}/cc/index/userMenuCodeList`,
method: 'get'
})
}
// Token校验有效性,在request.js有用到
export function checkToken() {
return request({
url: `${baseURL}/cc/account/checkToken`,
method: 'get'
})
}
// 获取帐号登录信息
export function getUserInfo() {
return request({
url: `${baseURL}/cc/account/getUserLoginInfo`,
method: 'get'
})
}
import request from '@/utils/request'
// const baseURL = process.env.VUE_APP_BASE_API
const baseURL = ''
// 获取任务列表-分页
export function getTaskList(data) {
return request({
url: `${baseURL}/cc/linque/getTaskList`,
method: 'post',
data
})
}
// 创建实验
export function createTask(data) {
return request({
url: `${baseURL}/cc/linque/createTask`,
method: 'post',
data
})
}
// 删除实验
export function deleteTask(data) {
return request({
url: `${baseURL}/cc/linque/deleteTask`,
method: 'post',
data
})
}
// 发布模型
export function createModel(data) {
return request({
url: `${baseURL}/cc/linque/createModel`,
method: 'post',
data
})
}
// 获取模型数据
export function getModelVisualization(data) {
return request({
url: `${baseURL}/cc/linque/getModelVisualization`,
method: 'post',
data
})
}
import request from '@/utils/request'
// const baseURL = process.env.VUE_APP_BASE_API
const baseURL = ''
// 获取模型列表-分页
export function getModelList(data) {
return request({
url: `${baseURL}/cc/linque/getModelList`,
method: 'post',
data
})
}
// 获取模型详情
export function getModelDetail(data) {
return request({
url: `${baseURL}/cc/linque/getModelDetail`,
method: 'post',
data
})
}
// 获取模型列表
export function getAllModelList(data) {
return request({
url: `${baseURL}/cc/linque/getAllModelList`,
method: 'post',
data
})
}
import request from '@/utils/request'
// const baseURL = process.env.VUE_APP_BASE_API
const baseURL = ''
// 获取模型版本列表-分页
export function getModelVersionList(data) {
return request({
url: `${baseURL}/cc/linque/getModelVersionList`,
method: 'post',
data
})
}
// 删除模型版本
export function deleteModelVersion(data) {
return request({
url: `${baseURL}/cc/linque/deleteModelVersion`,
method: 'post',
data
})
}
// 获取模型版本详情
export function getModelVersionDetail(data) {
return request({
url: `${baseURL}/cc/linque/getModelVersionDetail`,
method: 'post',
data
})
}
import request from '@/utils/request'
// const baseURL = process.env.VUE_APP_BASE_API
const baseURL = ''
// 获取服务列表-分页
export function getServiceList(data) {
return request({
url: `${baseURL}/cc/linque/getServiceList`,
method: 'post',
data
})
}
// 获取服务列表
export function getServiceListByModelVersion(data) {
return request({
url: `${baseURL}/cc/linque/getServiceListByModelVersion`,
method: 'post',
data
})
}
// 删除服务
export function deleteService(data) {
return request({
url: `${baseURL}/cc/linque/deleteService`,
method: 'post',
data
})
}
// 创建服务
export function createService(data) {
return request({
url: `${baseURL}/cc/linque/createService`,
method: 'post',
data
})
}
import request from '@/utils/request'
// const baseURL = process.env.VUE_APP_BASE_API
const baseURL = ''
// 获取数据
export function getMonitorData(data) {
return request({
url: `${baseURL}/cc/linque/getMonitorData`,
method: 'post',
data
})
}
import request from '@/utils/request'
// const baseURL = process.env.VUE_APP_BASE_API
const baseURL = ''
export function getLineData(params) {
return request({
url: `${baseURL}/cc/g2plot/getLineData`,
method: 'get',
params: params
})
}
export function getOverviewData(params) {
return request({
url: `${baseURL}/cc/g2plot/getOverviewData`,
method: 'get',
params: params
})
}
import request from '@/utils/request'
// const baseURL = process.env.VUE_APP_BASE_API
const baseURL = ''
export function apiList(params) {
return request({
url: `${baseURL}/cc/apiauth/list`,
method: 'get',
params: params
})
}
export function apiAdd(data) {
return request({
url: `${baseURL}/cc/apiauth/add`,
method: 'post',
data
})
}
export function apiUpdate(data) {
return request({
url: `${baseURL}/cc/apiauth/update`,
method: 'post',
data
})
}
export function apiDelete(data) {
return request({
url: `${baseURL}/cc/apiauth/delete`,
method: 'post',
data
})
}
export function apiRefresh() {
return request({
url: `${baseURL}/cc/apiauth/refresh`,
method: 'get'
})
}
import request from '@/utils/request'
// const baseURL = process.env.VUE_APP_BASE_API
const baseURL = ''
// 所有角色分类列表
export function getAllRoleCategoryList(params) {
return request({
url: `${baseURL}/cc/role/all`,
method: 'get',
params: params
})
}
// 角色权限列表
export function getRoleAuth(params) {
return request({
url: `${baseURL}/cc/rolemenu/list`,
method: 'get',
params: params
})
}
// 角色权限设置
export function setRoleAuth(data) {
return request({
url: `${baseURL}/cc/rolemenu/setRoleMenu`,
method: 'post',
data
})
}
import request from '@/utils/request'
// const baseURL = process.env.VUE_APP_BASE_API
const baseURL = ''
// 菜单数列表
export function getMenuList(params) {
return request({
url: `${baseURL}/cc/menu/listTree`,
method: 'get',
params: params
})
}
// 菜单添加
export function addMenu(data) {
return request({
url: `${baseURL}/cc/menu/add`,
method: 'post',
data
})
}
// 菜单修改
export function updateMenu(data) {
return request({
url: `${baseURL}/cc/menu/update`,
method: 'post',
data
})
}
// 菜单删除
export function deleteMenu(data) {
return request({
url: `${baseURL}/cc/menu/delete`,
method: 'post',
data
})
}
import request from '@/utils/request'
// const baseURL = process.env.VUE_APP_BASE_API
const baseURL = ''
// 组织树列表
export function listTree(params) {
return request({
url: `${baseURL}/cc/department/listTree`,
method: 'get',
params: params
})
}
// 新增组织
export function save(data) {
return request({
url: `${baseURL}/cc/department/add`,
method: 'post',
data
})
}
// 删除组织
export function deleteRow(data) {
return request({
url: `${baseURL}/cc/department/delete`,
method: 'post',
data
})
}
// 组织详情
export function info(params) {
return request({
url: `${baseURL}/cc/department/info`,
method: 'get',
params: params
})
}
// 修改组织信息
export function update(data) {
return request({
url: `${baseURL}/cc/department/update`,
method: 'post',
data
})
}
// 查询可修改上级组织
export function chooseList(params) {
return request({
url: `${baseURL}/cc/department/chooseList`,
method: 'get',
params: params
})
}
import request from '@/utils/request'
// const baseURL = process.env.VUE_APP_BASE_API
const baseURL = ''
// 角色分类列表
export function getRoleCategoryList(params) {
return request({
url: `${baseURL}/cc/roleCategory/list`,
method: 'get',
params: params
})
}
// 角色分类增加
export function addRoleCategory(data) {
return request({
url: `${baseURL}/cc/roleCategory/add`,
method: 'post',
data
})
}
// 角色分类修改
export function updateRoleCategory(data) {
return request({
url: `${baseURL}/cc/roleCategory/update`,
method: 'post',
data
})
}
// 角色分类删除
export function deleteRoleCategory(data) {
return request({
url: `${baseURL}/cc/roleCategory/delete`,
method: 'post',
data
})
}
// 角色列表
export function getRoleList(params) {
return request({
url: `${baseURL}/cc/role/list`,
method: 'get',
params: params
})
}
// 角色添加
export function addRole(data) {
return request({
url: `${baseURL}/cc/role/add`,
method: 'post',
data
})
}
// 角色修改
export function updateRole(data) {
return request({
url: `${baseURL}/cc/role/update`,
method: 'post',
data
})
}
// 角色删除
export function deleteRole(data) {
return request({
url: `${baseURL}/cc/role/delete`,
method: 'post',
data
})
}
import request from '@/utils/request'
// const baseURL = process.env.VUE_APP_BASE_API
const baseURL = ''
// 获取系统列表
export function getSystemList(params) {
return request({
url: `${baseURL}/cc/system/list`,
method: 'get',
params: params
})
}
// 创建系统
export function addSystem(data) {
return request({
url: `${baseURL}/cc/system/create`,
method: 'post',
data
})
}
// 修改系统信息
export function updateSystem(data) {
return request({
url: `${baseURL}/cc/system/update`,
method: 'post',
data
})
}
// 删除系统
export function deleteSystem(data) {
return request({
url: `${baseURL}/cc/system/delete`,
method: 'post',
data
})
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment