vue2-client 1.8.3 → 1.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +1 -0
- package/docs/index.md +2 -1
- package/package.json +5 -4
- package/src/App.vue +3 -89
- package/src/base-client/components/common/AMisRender/index.vue +42 -6
- package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +3 -3
- package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +1 -1
- package/src/base-client/components/common/JSONToTree/jsontotree.vue +4 -8
- package/src/base-client/components/common/Tree/Tree.vue +149 -0
- package/src/base-client/components/common/Tree/index.js +2 -0
- package/src/base-client/components/common/XCard/XCard.vue +1 -1
- package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +2 -2
- package/src/base-client/components/common/XFormTable/XFormTable.vue +2 -2
- package/src/base-client/components/common/XStepView/XStepView.vue +492 -0
- package/src/base-client/components/common/XStepView/index.js +3 -0
- package/src/base-client/components/common/XStepView/index.md +31 -0
- package/src/base-client/components/index.js +45 -41
- package/src/bootstrap.js +2 -2
- package/src/config/default/setting.config.js +2 -2
- package/src/main.js +40 -12
- package/src/pages/AMisDemo/AMisDemo.vue +41 -140
- package/src/pages/CreateQueryPage.vue +6 -0
- package/src/pages/resourceManage/orgListManage.vue +2 -2
- package/src/react-client/amis-react-starter/.prettierrc +12 -0
- package/src/react-client/amis-react-starter/LICENSE +201 -0
- package/src/react-client/amis-react-starter/README.md +16 -0
- package/src/react-client/amis-react-starter/index.html +13 -0
- package/src/react-client/amis-react-starter/package.json +63 -0
- package/src/react-client/amis-react-starter/server.js +23 -0
- package/src/react-client/amis-react-starter/snowpack/favicon.ico +0 -0
- package/src/react-client/amis-react-starter/snowpack/index.html +25 -0
- package/src/react-client/amis-react-starter/snowpack.config.js +30 -0
- package/src/react-client/amis-react-starter/src/AMISComponent.tsx +79 -0
- package/src/react-client/amis-react-starter/src/App.tsx +154 -0
- package/src/react-client/amis-react-starter/src/index.html +13 -0
- package/src/react-client/amis-react-starter/src/index.tsx +7 -0
- package/src/react-client/amis-react-starter/src/react-app-env.d.ts +74 -0
- package/src/react-client/amis-react-starter/tsconfig.json +19 -0
- package/src/react-client/amis-react-starter/vite.config.ts +7 -0
- package/src/react-client/amis-react-starter/webpack.config.js +76 -0
- package/src/router/async/router.map.js +1 -1
- package/src/router.js +13 -0
- package/src/services/api/common.js +10 -2
- package/test/Amis.spec.js +163 -0
- package/test/Tree.spec.js +167 -0
- package/vue.config.js +21 -5
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** @type {import("snowpack").SnowpackUserConfig } */
|
|
2
|
+
module.exports = {
|
|
3
|
+
mount: {
|
|
4
|
+
snowpack: '/',
|
|
5
|
+
src: '/_dist_'
|
|
6
|
+
},
|
|
7
|
+
plugins: [
|
|
8
|
+
'@snowpack/plugin-react-refresh',
|
|
9
|
+
'@snowpack/plugin-dotenv',
|
|
10
|
+
'@snowpack/plugin-typescript'
|
|
11
|
+
],
|
|
12
|
+
install: [
|
|
13
|
+
/* ... */
|
|
14
|
+
],
|
|
15
|
+
installOptions: {
|
|
16
|
+
/* ... */
|
|
17
|
+
},
|
|
18
|
+
devOptions: {
|
|
19
|
+
/* ... */
|
|
20
|
+
},
|
|
21
|
+
buildOptions: {
|
|
22
|
+
/* ... */
|
|
23
|
+
},
|
|
24
|
+
proxy: {
|
|
25
|
+
/* ... */
|
|
26
|
+
},
|
|
27
|
+
alias: {
|
|
28
|
+
/* ... */
|
|
29
|
+
}
|
|
30
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render as renderAmis } from "amis-core";
|
|
3
|
+
import axios from "axios";
|
|
4
|
+
import copy from "copy-to-clipboard";
|
|
5
|
+
import { toast } from "amis-ui";
|
|
6
|
+
import { Schema } from "amis";
|
|
7
|
+
|
|
8
|
+
class AMISComponent extends React.Component {
|
|
9
|
+
schema: {}
|
|
10
|
+
constructor(props:any) {
|
|
11
|
+
super(props);
|
|
12
|
+
this.schema = props || {}; // 传入的Amis配置
|
|
13
|
+
console.log('props',props)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// 在组件内部定义的fetcher函数
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
fetcher = ({ url, method, data, responseType, config, headers }): any => {
|
|
19
|
+
// ...(fetcher的代码,与你的代码相同)
|
|
20
|
+
config = config || {};
|
|
21
|
+
config.withCredentials = true;
|
|
22
|
+
responseType && (config.responseType = responseType);
|
|
23
|
+
|
|
24
|
+
if (config.cancelExecutor) {
|
|
25
|
+
config.cancelToken = new (axios as any).CancelToken(
|
|
26
|
+
config.cancelExecutor
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
config.headers = headers || {};
|
|
31
|
+
|
|
32
|
+
if (method !== 'post' && method !== 'put' && method !== 'patch') {
|
|
33
|
+
if (data) {
|
|
34
|
+
config.params = data;
|
|
35
|
+
}
|
|
36
|
+
return (axios as any)[method](url, config);
|
|
37
|
+
} else if (data && data instanceof FormData) {
|
|
38
|
+
config.headers = config.headers || {};
|
|
39
|
+
config.headers['Content-Type'] = 'multipart/form-data';
|
|
40
|
+
} else if (
|
|
41
|
+
data &&
|
|
42
|
+
typeof data !== 'string' &&
|
|
43
|
+
!(data instanceof Blob) &&
|
|
44
|
+
!(data instanceof ArrayBuffer)
|
|
45
|
+
) {
|
|
46
|
+
data = JSON.stringify(data);
|
|
47
|
+
config.headers = config.headers || {};
|
|
48
|
+
config.headers['Content-Type'] = 'application/json';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return (axios as any)[method](url, data, config);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// 在组件内部定义的isCancel函数
|
|
55
|
+
isCancel = (value: any) => {
|
|
56
|
+
return axios.isCancel(value);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// 在组件内部定义的copy函数
|
|
60
|
+
copyToClipboard = (content: string) => {
|
|
61
|
+
copy(content);
|
|
62
|
+
toast.success('内容已复制到粘贴板');
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// 渲染函数
|
|
66
|
+
render() {
|
|
67
|
+
|
|
68
|
+
const amisEnv = {
|
|
69
|
+
fetcher: this.fetcher,
|
|
70
|
+
isCancel: this.isCancel,
|
|
71
|
+
copy: this.copyToClipboard,
|
|
72
|
+
};
|
|
73
|
+
console.log('this.schema',this.schema)
|
|
74
|
+
// @ts-ignore
|
|
75
|
+
return renderAmis(this.schema, {}, amisEnv);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export default AMISComponent;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import '@fortawesome/fontawesome-free/css/all.css';
|
|
4
|
+
import '@fortawesome/fontawesome-free/css/v4-shims.css';
|
|
5
|
+
|
|
6
|
+
import 'amis/lib/themes/cxd.css';
|
|
7
|
+
import 'amis/lib/helper.css';
|
|
8
|
+
import 'amis/sdk/iconfont.css';
|
|
9
|
+
|
|
10
|
+
import axios from 'axios';
|
|
11
|
+
import copy from 'copy-to-clipboard';
|
|
12
|
+
|
|
13
|
+
import {render as renderAmis, ToastComponent, AlertComponent} from 'amis';
|
|
14
|
+
import {alert, confirm, toast} from 'amis-ui';
|
|
15
|
+
|
|
16
|
+
// amis 环境配置
|
|
17
|
+
const env = {
|
|
18
|
+
// 下面三个接口必须实现
|
|
19
|
+
fetcher: ({
|
|
20
|
+
url, // 接口地址
|
|
21
|
+
method, // 请求方法 get、post、put、delete
|
|
22
|
+
data, // 请求数据
|
|
23
|
+
responseType,
|
|
24
|
+
config, // 其他配置
|
|
25
|
+
headers // 请求头
|
|
26
|
+
}: any) => {
|
|
27
|
+
config = config || {};
|
|
28
|
+
config.withCredentials = true;
|
|
29
|
+
responseType && (config.responseType = responseType);
|
|
30
|
+
|
|
31
|
+
if (config.cancelExecutor) {
|
|
32
|
+
config.cancelToken = new (axios as any).CancelToken(
|
|
33
|
+
config.cancelExecutor
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
config.headers = headers || {};
|
|
38
|
+
|
|
39
|
+
if (method !== 'post' && method !== 'put' && method !== 'patch') {
|
|
40
|
+
if (data) {
|
|
41
|
+
config.params = data;
|
|
42
|
+
}
|
|
43
|
+
return (axios as any)[method](url, config);
|
|
44
|
+
} else if (data && data instanceof FormData) {
|
|
45
|
+
config.headers = config.headers || {};
|
|
46
|
+
config.headers['Content-Type'] = 'multipart/form-data';
|
|
47
|
+
} else if (
|
|
48
|
+
data &&
|
|
49
|
+
typeof data !== 'string' &&
|
|
50
|
+
!(data instanceof Blob) &&
|
|
51
|
+
!(data instanceof ArrayBuffer)
|
|
52
|
+
) {
|
|
53
|
+
data = JSON.stringify(data);
|
|
54
|
+
config.headers = config.headers || {};
|
|
55
|
+
config.headers['Content-Type'] = 'application/json';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return (axios as any)[method](url, data, config);
|
|
59
|
+
},
|
|
60
|
+
isCancel: (value: any) => (axios as any).isCancel(value),
|
|
61
|
+
copy: (content: string) => {
|
|
62
|
+
copy(content);
|
|
63
|
+
toast.success('内容已复制到粘贴板');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// 后面这些接口可以不用实现
|
|
67
|
+
|
|
68
|
+
// 默认是地址跳转
|
|
69
|
+
// jumpTo: (
|
|
70
|
+
// location: string /*目标地址*/,
|
|
71
|
+
// action: any /* action对象*/
|
|
72
|
+
// ) => {
|
|
73
|
+
// // 用来实现页面跳转, actionType:link、url 都会进来。
|
|
74
|
+
// },
|
|
75
|
+
|
|
76
|
+
// updateLocation: (
|
|
77
|
+
// location: string /*目标地址*/,
|
|
78
|
+
// replace: boolean /*是replace,还是push?*/
|
|
79
|
+
// ) => {
|
|
80
|
+
// // 地址替换,跟 jumpTo 类似
|
|
81
|
+
// },
|
|
82
|
+
|
|
83
|
+
// isCurrentUrl: (
|
|
84
|
+
// url: string /*url地址*/,
|
|
85
|
+
// ) => {
|
|
86
|
+
// // 用来判断是否目标地址当前地址
|
|
87
|
+
// },
|
|
88
|
+
|
|
89
|
+
// notify: (
|
|
90
|
+
// type: 'error' | 'success' /**/,
|
|
91
|
+
// msg: string /*提示内容*/
|
|
92
|
+
// ) => {
|
|
93
|
+
// toast[type]
|
|
94
|
+
// ? toast[type](msg, type === 'error' ? '系统错误' : '系统消息')
|
|
95
|
+
// : console.warn('[Notify]', type, msg);
|
|
96
|
+
// },
|
|
97
|
+
// alert,
|
|
98
|
+
// confirm,
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
class AMISComponent extends React.Component<any, any> {
|
|
102
|
+
render() {
|
|
103
|
+
return renderAmis(
|
|
104
|
+
// 这里是 amis 的 Json 配置。
|
|
105
|
+
{
|
|
106
|
+
type: 'page',
|
|
107
|
+
body: {
|
|
108
|
+
type: 'form',
|
|
109
|
+
api: '/api/form',
|
|
110
|
+
body: [
|
|
111
|
+
{
|
|
112
|
+
type: 'input-text',
|
|
113
|
+
name: 'name',
|
|
114
|
+
label: '姓名'
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: 'email',
|
|
118
|
+
type: 'input-email',
|
|
119
|
+
label: '邮箱'
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: 'color',
|
|
123
|
+
type: 'input-color',
|
|
124
|
+
label: 'color'
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
type: 'editor',
|
|
128
|
+
name: 'editor',
|
|
129
|
+
label: '编辑器'
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
// props...
|
|
136
|
+
},
|
|
137
|
+
env
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
class APP extends React.Component<any, any> {
|
|
143
|
+
render() {
|
|
144
|
+
return (
|
|
145
|
+
<>
|
|
146
|
+
<ToastComponent key="toast" position={'top-right'} />
|
|
147
|
+
<AlertComponent key="alert" />
|
|
148
|
+
<AMISComponent />
|
|
149
|
+
</>
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export default APP;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<meta name="theme-color" content="#000000" />
|
|
7
|
+
<title>amis starter</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
11
|
+
<div id="root"></div>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
/// <reference types="react-dom" />
|
|
4
|
+
|
|
5
|
+
declare namespace NodeJS {
|
|
6
|
+
interface Process{
|
|
7
|
+
env: ProcessEnv
|
|
8
|
+
}
|
|
9
|
+
interface ProcessEnv {
|
|
10
|
+
/**
|
|
11
|
+
* By default, there are two modes in Vite:
|
|
12
|
+
*
|
|
13
|
+
* * `development` is used by vite and vite serve
|
|
14
|
+
* * `production` is used by vite build
|
|
15
|
+
*
|
|
16
|
+
* You can overwrite the default mode used for a command by passing the --mode option flag.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
readonly NODE_ENV: 'development' | 'production'
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
declare var process: NodeJS.Process
|
|
24
|
+
|
|
25
|
+
declare module '*.gif' {
|
|
26
|
+
const src: string
|
|
27
|
+
export default src
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
declare module '*.jpg' {
|
|
31
|
+
const src: string
|
|
32
|
+
export default src
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare module '*.jpeg' {
|
|
36
|
+
const src: string
|
|
37
|
+
export default src
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
declare module '*.png' {
|
|
41
|
+
const src: string
|
|
42
|
+
export default src
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
declare module '*.webp' {
|
|
46
|
+
const src: string
|
|
47
|
+
export default src
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
declare module '*.svg' {
|
|
51
|
+
import * as React from 'react'
|
|
52
|
+
|
|
53
|
+
export const ReactComponent: React.FunctionComponent<React.SVGProps<
|
|
54
|
+
SVGSVGElement
|
|
55
|
+
> & { title?: string }>
|
|
56
|
+
|
|
57
|
+
const src: string;
|
|
58
|
+
export default src
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
declare module '*.module.css' {
|
|
62
|
+
const classes: { readonly [key: string]: string }
|
|
63
|
+
export default classes
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
declare module '*.module.scss' {
|
|
67
|
+
const classes: { readonly [key: string]: string }
|
|
68
|
+
export default classes
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
declare module '*.module.sass' {
|
|
72
|
+
const classes: { readonly [key: string]: string }
|
|
73
|
+
export default classes
|
|
74
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es6",
|
|
4
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"allowSyntheticDefaultImports": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"noFallthroughCasesInSwitch": true,
|
|
12
|
+
"module": "esnext",
|
|
13
|
+
"moduleResolution": "node",
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"isolatedModules": true,
|
|
16
|
+
"jsx": "react"
|
|
17
|
+
},
|
|
18
|
+
"include": ["src"]
|
|
19
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
|
|
3
|
+
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
4
|
+
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
|
|
5
|
+
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
mode: 'development',
|
|
9
|
+
entry: {
|
|
10
|
+
index: [
|
|
11
|
+
'./src/index.tsx',
|
|
12
|
+
],
|
|
13
|
+
},
|
|
14
|
+
output: {
|
|
15
|
+
path: path.resolve(__dirname, 'dist'),
|
|
16
|
+
filename: 'MyReactApp.js',
|
|
17
|
+
library: 'MyReactApp', // 被其他项目 引用时的名字
|
|
18
|
+
libraryTarget: 'umd',
|
|
19
|
+
umdNamedDefine: true
|
|
20
|
+
},
|
|
21
|
+
module: {
|
|
22
|
+
rules: [
|
|
23
|
+
{
|
|
24
|
+
test: /\.tsx?$/,
|
|
25
|
+
use: [
|
|
26
|
+
{
|
|
27
|
+
loader: 'ts-loader',
|
|
28
|
+
options: {
|
|
29
|
+
transpileOnly: true
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
exclude: /node_modules/
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
test: /\.woff2?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
|
|
37
|
+
use: 'url-loader?limit=10000'
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
test: /\.(ttf|eot|svg)(\?[\s\S]+)?$/,
|
|
41
|
+
use: 'file-loader'
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
test: /\.css$/,
|
|
45
|
+
use: ['style-loader', 'css-loader']
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
test: /\.ttf$/,
|
|
49
|
+
use: ['file-loader']
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
plugins: [
|
|
54
|
+
new CleanWebpackPlugin({cleanStaleWebpackAssets: false}),
|
|
55
|
+
new HtmlWebpackPlugin({
|
|
56
|
+
template: 'src/index.html'
|
|
57
|
+
}),
|
|
58
|
+
new MonacoWebpackPlugin(),
|
|
59
|
+
new ForkTsCheckerWebpackPlugin()
|
|
60
|
+
],
|
|
61
|
+
resolve: {
|
|
62
|
+
extensions: ['.tsx', '.ts', '.js', '.html'],
|
|
63
|
+
modules: [path.resolve(__dirname, 'src'), 'node_modules'],
|
|
64
|
+
},
|
|
65
|
+
devtool: 'inline-source-map',
|
|
66
|
+
devServer: {
|
|
67
|
+
contentBase: path.join(__dirname, 'dist'),
|
|
68
|
+
publicPath: path.join(__dirname, 'dist'),
|
|
69
|
+
compress: true,
|
|
70
|
+
port: 9000,
|
|
71
|
+
hot: true,
|
|
72
|
+
proxy: {
|
|
73
|
+
'/api': 'http://localhost:3000'
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
@@ -34,7 +34,7 @@ routerResource.settings = () => import('@vue2-client/pages/system/settings')
|
|
|
34
34
|
// 查询配置生成工具
|
|
35
35
|
routerResource.createQuery = () => import('@vue2-client/pages/CreateQueryPage')
|
|
36
36
|
// AMIS示例页面
|
|
37
|
-
routerResource.amisDemo = () => import('@vue2-client/pages/AMisDemo/AMisDemo
|
|
37
|
+
routerResource.amisDemo = () => import('@vue2-client/pages/AMisDemo/AMisDemo')
|
|
38
38
|
|
|
39
39
|
// 基础路由组件注册
|
|
40
40
|
const routerMap = {
|
package/src/router.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// 动态导入你的组件
|
|
2
|
+
function loadView (view) {
|
|
3
|
+
console.log('view', view)
|
|
4
|
+
return () => import(/* webpackChunkName: "view-[request]" */ `@vue2-client/base-client/components/common/${view}`)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const routes = [
|
|
8
|
+
// 对于每个路由,你都可以使用 'loadView' 方法动态加载对应的组件
|
|
9
|
+
{ path: '/Tree', component: loadView('Tree') },
|
|
10
|
+
{ path: '/Amis', component: () => import('@vue2-client/pages/AMisDemo/AMisDemo') },
|
|
11
|
+
// ... 其他路由
|
|
12
|
+
]
|
|
13
|
+
export default routes
|
|
@@ -44,7 +44,7 @@ export function getNativeConfigUrl (serviceName = process.env.VUE_APP_SYSTEM_NAM
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
export function parseConfigUrl (serviceName = process.env.VUE_APP_SYSTEM_NAME) {
|
|
47
|
-
return '/api/
|
|
47
|
+
return '/api/af-liuli/' + commonApi.parseConfig
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/**
|
|
@@ -56,14 +56,22 @@ export function getDictionaryParam () {
|
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
58
|
* 根据配置名获取配置内容
|
|
59
|
+
* @param content 已有的配置内容
|
|
59
60
|
* @param configName 配置名称
|
|
60
61
|
* @param serviceName 命名空间名称
|
|
61
62
|
* @param callback 回调函数
|
|
62
63
|
*/
|
|
63
|
-
export function getConfig (configName, serviceName = process.env.VUE_APP_SYSTEM_NAME, callback) {
|
|
64
|
+
export function getConfig (content, configName, serviceName = process.env.VUE_APP_SYSTEM_NAME, callback) {
|
|
65
|
+
if (content) {
|
|
66
|
+
return content
|
|
67
|
+
}
|
|
64
68
|
indexedDB.getByWeb(configName, getConfigUrl(serviceName), { configName: configName }, callback)
|
|
65
69
|
}
|
|
66
70
|
|
|
71
|
+
export function getConfigByName (configName, serviceName = process.env.VUE_APP_SYSTEM_NAME, callback) {
|
|
72
|
+
return getConfig(undefined, configName, serviceName, callback)
|
|
73
|
+
}
|
|
74
|
+
|
|
67
75
|
export function getNativeConfig (configName, serviceName = process.env.VUE_APP_SYSTEM_NAME) {
|
|
68
76
|
return post(getNativeConfigUrl(serviceName), { configName: configName })
|
|
69
77
|
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils'
|
|
2
|
+
import AMisRender from '@vue2-client/base-client/components/common/AMisRender/index.vue'
|
|
3
|
+
|
|
4
|
+
describe('AmisRender', () => {
|
|
5
|
+
// 测试用例:正确渲染组件
|
|
6
|
+
it('renders correctly', () => {
|
|
7
|
+
const wrapper = mount(AMisRender, {
|
|
8
|
+
// 组件必要的传参
|
|
9
|
+
propsData: {
|
|
10
|
+
schema: {
|
|
11
|
+
title: '${siteName}:这是 AMIS 表格页面示例',
|
|
12
|
+
remark: '嘿,不保证数据准确性',
|
|
13
|
+
type: 'page',
|
|
14
|
+
body: {
|
|
15
|
+
type: 'crud',
|
|
16
|
+
draggable: true,
|
|
17
|
+
api: 'https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/sample',
|
|
18
|
+
keepItemSelectionOnPageChange: true,
|
|
19
|
+
autoGenerateFilter: true,
|
|
20
|
+
bulkActions: [
|
|
21
|
+
{
|
|
22
|
+
type: 'button',
|
|
23
|
+
label: '批量删除',
|
|
24
|
+
actionType: 'ajax',
|
|
25
|
+
api: 'delete:https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/sample/${ids|raw}',
|
|
26
|
+
confirmText: '确定要批量删除?',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
type: 'button',
|
|
30
|
+
label: '批量修改',
|
|
31
|
+
actionType: 'dialog',
|
|
32
|
+
dialog: {
|
|
33
|
+
title: '批量编辑',
|
|
34
|
+
name: 'sample-bulk-edit',
|
|
35
|
+
body: {
|
|
36
|
+
type: 'form',
|
|
37
|
+
api: 'https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/sample/bulkUpdate2',
|
|
38
|
+
body: [
|
|
39
|
+
{
|
|
40
|
+
type: 'hidden',
|
|
41
|
+
name: 'ids',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: 'input-text',
|
|
45
|
+
name: 'engine',
|
|
46
|
+
label: 'Engine',
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
quickSaveApi:
|
|
54
|
+
'https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/sample/bulkUpdate',
|
|
55
|
+
quickSaveItemApi:
|
|
56
|
+
'https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/sample/$id',
|
|
57
|
+
headerToolbar: [
|
|
58
|
+
'bulkActions',
|
|
59
|
+
{
|
|
60
|
+
type: 'button',
|
|
61
|
+
label: '重置测试数据',
|
|
62
|
+
actionType: 'ajax',
|
|
63
|
+
size: 'sm',
|
|
64
|
+
api: 'https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/sample/reset',
|
|
65
|
+
},
|
|
66
|
+
'export-excel',
|
|
67
|
+
{
|
|
68
|
+
type: 'tpl',
|
|
69
|
+
tpl: '一共有 ${count} 行数据。',
|
|
70
|
+
className: 'v-middle',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
type: 'columns-toggler',
|
|
74
|
+
align: 'right',
|
|
75
|
+
draggable: true,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
type: 'drag-toggler',
|
|
79
|
+
align: 'right',
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
footerToolbar: ['statistics', 'switch-per-page', 'pagination'],
|
|
83
|
+
columns: [
|
|
84
|
+
{
|
|
85
|
+
name: 'id',
|
|
86
|
+
label: 'ID',
|
|
87
|
+
width: 20,
|
|
88
|
+
sortable: true,
|
|
89
|
+
type: 'text',
|
|
90
|
+
searchable: {
|
|
91
|
+
type: 'input-text',
|
|
92
|
+
name: 'id',
|
|
93
|
+
label: '主键',
|
|
94
|
+
placeholder: '输入id',
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: 'browser',
|
|
99
|
+
label: 'Browser',
|
|
100
|
+
searchable: {
|
|
101
|
+
type: 'select',
|
|
102
|
+
name: 'browser',
|
|
103
|
+
label: '浏览器',
|
|
104
|
+
placeholder: '选择浏览器',
|
|
105
|
+
options: [
|
|
106
|
+
{
|
|
107
|
+
label: 'Internet Explorer ',
|
|
108
|
+
value: 'ie',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
label: 'AOL browser',
|
|
112
|
+
value: 'aol',
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
label: 'Firefox',
|
|
116
|
+
value: 'firefox',
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: 'platform',
|
|
123
|
+
label: '平台',
|
|
124
|
+
popOver: {
|
|
125
|
+
trigger: 'hover',
|
|
126
|
+
body: {
|
|
127
|
+
type: 'tpl',
|
|
128
|
+
tpl: '就是为了演示有个叫 popOver 的功能',
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
sortable: true,
|
|
132
|
+
type: 'text',
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: 'grade',
|
|
136
|
+
label: 'CSS 等级',
|
|
137
|
+
type: 'select',
|
|
138
|
+
options: ['A', 'B', 'C', 'D', 'X'],
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
type: 'operation',
|
|
142
|
+
label: '操作',
|
|
143
|
+
width: 100,
|
|
144
|
+
buttons: [
|
|
145
|
+
{
|
|
146
|
+
type: 'button',
|
|
147
|
+
actionType: 'ajax',
|
|
148
|
+
label: '删除',
|
|
149
|
+
confirmText: '您确认要删除?',
|
|
150
|
+
api: 'delete:https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/sample/$id',
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
locals: {}
|
|
158
|
+
}
|
|
159
|
+
})
|
|
160
|
+
console.debug('返回的组件html:' + wrapper.html())
|
|
161
|
+
expect(wrapper.exists()).toBe(true)
|
|
162
|
+
})
|
|
163
|
+
})
|