vue2-client 1.11.6 → 1.12.2
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/.babelrc +3 -0
- package/babel.config.js +18 -21
- package/jest.config.js +22 -21
- package/package.json +5 -4
- package/src/base-client/components/common/XDescriptions/XDescriptionsGroup.vue +314 -314
- package/src/base-client/components/common/XDescriptions/demo.vue +51 -51
- package/src/base-client/components/common/XFormGroup/demo.vue +39 -39
- package/src/expression/ExpressionRunner.js +26 -0
- package/src/expression/TestExpression.js +509 -0
- package/src/expression/core/Delegate.js +115 -0
- package/src/expression/core/Expression.js +1358 -0
- package/src/expression/core/Program.js +932 -0
- package/src/expression/core/Token.js +27 -0
- package/src/expression/enums/ExpressionType.js +81 -0
- package/src/expression/enums/TokenType.js +11 -0
- package/src/expression/exception/ExpressionException.js +28 -0
- package/src/expression/exception/ReturnWayException.js +14 -0
- package/src/expression/exception/ServiceException.js +22 -0
- package/src/expression/instances/LogicConsole.js +44 -0
- package/src/expression/{core → ts/core}/Expression.ts +17 -3
- package/src/expression/ts/exception/BreakWayException.ts +2 -0
- package/src/expression/ts/exception/ContinueWayException.ts +2 -0
- package/src/layouts/BlankView.vue +4 -2
- package/src/logic/LogicRunner.js +62 -0
- package/src/logic/TestLogic.js +13 -0
- package/src/logic/plugins/common/DateTools.js +32 -0
- package/src/logic/plugins/index.js +5 -0
- package/src/logic/ts/LogicRunner.ts +67 -0
- package/src/logic/ts/TestLogic.ts +13 -0
- package/src/pages/LogicCallExample/index.vue +36 -0
- package/src/router/async/router.map.js +1 -0
- package/src/services/apiService.js +2 -1
- package/src/services/user.js +92 -90
- package/src/store/mutation-types.js +1 -0
- package/src/utils/EncryptUtil.js +23 -0
- package/src/utils/request.js +381 -362
- package/test/Amis.spec.js +1 -0
- package/test/Tree.spec.js +1 -0
- package/test/myDialog.spec.js +1 -0
- package/test/request.test.js +17 -0
- package/test/util.test.js +1 -0
- package/test/v3Api.test.js +2 -1
- package/tests/unit/ReportTable.spec.js +1 -0
- /package/src/expression/exception/{BreakWayException.ts → BreakWayException.js} +0 -0
- /package/src/expression/exception/{ContinueWayException.ts → ContinueWayException.js} +0 -0
- /package/src/expression/{ExpressionRunner.ts → ts/ExpressionRunner.ts} +0 -0
- /package/src/expression/{TestExpression.ts → ts/TestExpression.ts} +0 -0
- /package/src/expression/{core → ts/core}/Delegate.ts +0 -0
- /package/src/expression/{core → ts/core}/Program.ts +0 -0
- /package/src/expression/{core → ts/core}/Token.ts +0 -0
- /package/src/expression/{enums → ts/enums}/ExpressionType.ts +0 -0
- /package/src/expression/{enums → ts/enums}/TokenType.ts +0 -0
- /package/src/expression/{exception → ts/exception}/ExpressionException.ts +0 -0
- /package/src/expression/{exception → ts/exception}/ReturnWayException.ts +0 -0
- /package/src/expression/{exception → ts/exception}/ServiceException.ts +0 -0
- /package/src/expression/{instances → ts/instances}/JSONArray.ts +0 -0
- /package/src/expression/{instances → ts/instances}/JSONObject.ts +0 -0
- /package/src/expression/{instances → ts/instances}/LogicConsole.ts +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export default class Token {
|
|
2
|
+
type
|
|
3
|
+
value
|
|
4
|
+
startPos
|
|
5
|
+
|
|
6
|
+
constructor (type, value, startPos) {
|
|
7
|
+
this.type = type
|
|
8
|
+
this.value = value
|
|
9
|
+
this.startPos = startPos
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
toString () {
|
|
13
|
+
return this.type.toString() + this.value
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
getType () {
|
|
17
|
+
return this.type
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
getValue () {
|
|
21
|
+
return this.value
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
getStartPos () {
|
|
25
|
+
return this.startPos
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
const ExpressionType = {
|
|
2
|
+
// >
|
|
3
|
+
GreaterThan: 'GreaterThan',
|
|
4
|
+
// >=
|
|
5
|
+
GreaterThanOrEqual: 'GreaterThanOrEqual',
|
|
6
|
+
// <
|
|
7
|
+
LessThan: 'LessThan',
|
|
8
|
+
// <=
|
|
9
|
+
LessThanOrEqual: 'LessThanOrEqual',
|
|
10
|
+
//= =
|
|
11
|
+
Equal: 'Equal',
|
|
12
|
+
//! =
|
|
13
|
+
NotEqual: 'NotEqual',
|
|
14
|
+
// +
|
|
15
|
+
Add: 'Add',
|
|
16
|
+
// -
|
|
17
|
+
Subtract: 'Subtract',
|
|
18
|
+
//*
|
|
19
|
+
Multiply: 'Multiply',
|
|
20
|
+
// 除法
|
|
21
|
+
Divide: 'Divide',
|
|
22
|
+
// 求余
|
|
23
|
+
Modulo: 'Modulo',
|
|
24
|
+
|
|
25
|
+
// 字符串连接
|
|
26
|
+
Concat: 'Concat',
|
|
27
|
+
// 逻辑非
|
|
28
|
+
Not: 'Not',
|
|
29
|
+
// 逻辑与
|
|
30
|
+
And: 'And',
|
|
31
|
+
// 逻辑或
|
|
32
|
+
Or: 'Or',
|
|
33
|
+
|
|
34
|
+
// 常数
|
|
35
|
+
Constant: 'Constant',
|
|
36
|
+
// 标识符
|
|
37
|
+
Identity: 'Identity',
|
|
38
|
+
|
|
39
|
+
// 获取对象属性
|
|
40
|
+
Property: 'Property',
|
|
41
|
+
|
|
42
|
+
// 产生Json对象
|
|
43
|
+
Json: 'Json',
|
|
44
|
+
// 产生Json数组
|
|
45
|
+
Array: 'Array',
|
|
46
|
+
// Json对象属性值对
|
|
47
|
+
Attr: 'Attr',
|
|
48
|
+
// 数组下标,[0]
|
|
49
|
+
ArrayIndex: 'ArrayIndex',
|
|
50
|
+
// 函数调用
|
|
51
|
+
Call: 'Call',
|
|
52
|
+
// for循环
|
|
53
|
+
For: 'For',
|
|
54
|
+
// 逗号表达式
|
|
55
|
+
Comma: 'Comma',
|
|
56
|
+
// 赋值语句
|
|
57
|
+
Assign: 'Assign:',
|
|
58
|
+
// 条件语句
|
|
59
|
+
Condition: 'Condition',
|
|
60
|
+
// 参数
|
|
61
|
+
Param: 'Param',
|
|
62
|
+
// Try
|
|
63
|
+
Try: 'Try',
|
|
64
|
+
// Catch
|
|
65
|
+
Catch: 'Catch',
|
|
66
|
+
// 跳出
|
|
67
|
+
Return: 'Return',
|
|
68
|
+
// 抛出异常
|
|
69
|
+
Throw: 'Throw',
|
|
70
|
+
// 校验
|
|
71
|
+
Validate: 'Validate',
|
|
72
|
+
// 断言
|
|
73
|
+
Assert: 'Assert',
|
|
74
|
+
// 循环终止
|
|
75
|
+
Break: 'Break',
|
|
76
|
+
// 循环跳过
|
|
77
|
+
Continue: 'Continue',
|
|
78
|
+
// lambda
|
|
79
|
+
Lambda: 'Lambda'
|
|
80
|
+
}
|
|
81
|
+
export default ExpressionType
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 表达式执行异常,将显示执行异常的位置信息
|
|
3
|
+
*/
|
|
4
|
+
export default class ExpressionException extends Error {
|
|
5
|
+
constructor (source, pos, cause) {
|
|
6
|
+
let message
|
|
7
|
+
let beforeErrorContent = source.substring(0, pos).trim()
|
|
8
|
+
const length = beforeErrorContent.length
|
|
9
|
+
if (length > 1000) {
|
|
10
|
+
beforeErrorContent = '以上省略......\n' + beforeErrorContent.substring(length - 1000)
|
|
11
|
+
}
|
|
12
|
+
const afterErrorContent = source.substring(pos)
|
|
13
|
+
const afterErrorContentIndex = afterErrorContent.indexOf('\n')
|
|
14
|
+
if (afterErrorContentIndex === -1) {
|
|
15
|
+
message = beforeErrorContent.trim() + ' <- ' + afterErrorContent
|
|
16
|
+
} else {
|
|
17
|
+
message = beforeErrorContent.trim() + ' <- ' + afterErrorContent.substring(0, afterErrorContentIndex) + '\n后续省略......'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// 通过原生 Error 的 cause 参数传递原因
|
|
21
|
+
super(message, { cause })
|
|
22
|
+
this.name = this.constructor.name
|
|
23
|
+
|
|
24
|
+
if (Error.captureStackTrace) {
|
|
25
|
+
Error.captureStackTrace(this, this.constructor)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export default class ServiceException extends Error {
|
|
2
|
+
message
|
|
3
|
+
code
|
|
4
|
+
constructor (message, code) {
|
|
5
|
+
super()
|
|
6
|
+
this.message = message
|
|
7
|
+
this.code = code
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
getMessage () {
|
|
11
|
+
return this.message
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
setMessage (message) {
|
|
15
|
+
this.message = message
|
|
16
|
+
return this
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
getCode () {
|
|
20
|
+
return this.code
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// 自定义 Console 类
|
|
2
|
+
import Expression from '../core/Expression'
|
|
3
|
+
|
|
4
|
+
export default class LogicConsole {
|
|
5
|
+
constructor () {
|
|
6
|
+
if (LogicConsole.instance) {
|
|
7
|
+
return LogicConsole.instance
|
|
8
|
+
}
|
|
9
|
+
LogicConsole.instance = this
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
static getInstance () {
|
|
13
|
+
if (!LogicConsole.instance) {
|
|
14
|
+
LogicConsole.instance = new LogicConsole()
|
|
15
|
+
}
|
|
16
|
+
return LogicConsole.instance
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
debug (...args) {
|
|
20
|
+
const newArgs = this.convert(args)
|
|
21
|
+
console.debug(...newArgs)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
info (...args) {
|
|
25
|
+
const newArgs = this.convert(args)
|
|
26
|
+
console.info(...newArgs)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
warn (...args) {
|
|
30
|
+
const newArgs = this.convert(args)
|
|
31
|
+
console.warn(...newArgs)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
error (...args) {
|
|
35
|
+
const newArgs = this.convert(args)
|
|
36
|
+
console.error(...newArgs)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
convert (args) {
|
|
40
|
+
return args.map(obj => {
|
|
41
|
+
return Expression.toJSONString(obj)
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1245,7 +1245,11 @@ export default class Expression {
|
|
|
1245
1245
|
|
|
1246
1246
|
// 调用方法并处理返回值
|
|
1247
1247
|
const oCall = method.apply(obj, params);
|
|
1248
|
-
|
|
1248
|
+
if (oCall instanceof Promise) {
|
|
1249
|
+
return oCall.then(result => this.convert(result));
|
|
1250
|
+
} else {
|
|
1251
|
+
return this.convert(oCall);
|
|
1252
|
+
}
|
|
1249
1253
|
}
|
|
1250
1254
|
|
|
1251
1255
|
/**
|
|
@@ -1260,8 +1264,18 @@ export default class Expression {
|
|
|
1260
1264
|
|
|
1261
1265
|
// 递归获取原型链上的所有方法
|
|
1262
1266
|
while (proto !== null) {
|
|
1263
|
-
methods = methods.concat(
|
|
1264
|
-
|
|
1267
|
+
methods = methods.concat(
|
|
1268
|
+
Object.getOwnPropertyNames(proto)
|
|
1269
|
+
.filter(prop => !['caller', 'callee', 'arguments'].includes(prop)) // 先排除
|
|
1270
|
+
.filter(prop => {
|
|
1271
|
+
try {
|
|
1272
|
+
return typeof proto[prop] === 'function' // 再判断是否为函数
|
|
1273
|
+
} catch (e) {
|
|
1274
|
+
return false // 避免 TypeError
|
|
1275
|
+
}
|
|
1276
|
+
})
|
|
1277
|
+
)
|
|
1278
|
+
proto = Object.getPrototypeOf(proto)
|
|
1265
1279
|
}
|
|
1266
1280
|
|
|
1267
1281
|
// 去重
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<page-toggle-transition :disabled="animate.disabled" :animate="animate.name" :direction="animate.direction">
|
|
3
|
-
<a-keep-alive :exclude-keys="excludeKeys" v-if="cachePage" v-model="clearCaches">
|
|
3
|
+
<a-keep-alive :exclude-keys="excludeKeys" v-if="cachePage && isMicroAppEnv" v-model="clearCaches">
|
|
4
4
|
<router-view v-if="!refreshing" :key="$route.path" />
|
|
5
5
|
</a-keep-alive>
|
|
6
6
|
<router-view v-else-if="!refreshing" />
|
|
@@ -19,7 +19,8 @@ export default {
|
|
|
19
19
|
return {
|
|
20
20
|
clearCaches: [],
|
|
21
21
|
excludeKeys: [],
|
|
22
|
-
refreshing: false
|
|
22
|
+
refreshing: false,
|
|
23
|
+
isMicroAppEnv: false
|
|
23
24
|
}
|
|
24
25
|
},
|
|
25
26
|
computed: {
|
|
@@ -30,6 +31,7 @@ export default {
|
|
|
30
31
|
},
|
|
31
32
|
mounted () {
|
|
32
33
|
if (window.__MICRO_APP_ENVIRONMENT__) {
|
|
34
|
+
this.isMicroAppEnv = true
|
|
33
35
|
window.microApp.addDataListener((data) => {
|
|
34
36
|
if (data.type === 'refresh') {
|
|
35
37
|
this.refresh()
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import ServiceException from '../expression/exception/ServiceException'
|
|
2
|
+
import LogicConsole from '../expression/instances/LogicConsole'
|
|
3
|
+
import ExpressionRunner from '../expression/ExpressionRunner'
|
|
4
|
+
import { getConfigByNameAsync } from '@vue2-client/services/api/common'
|
|
5
|
+
import * as Plugins from './plugins/index'
|
|
6
|
+
import Expression from '../expression/core/Expression'
|
|
7
|
+
|
|
8
|
+
export default class LogicRunner {
|
|
9
|
+
static logicConsoleInstance = new LogicConsole()
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 是否存在指定名称的Logic资源
|
|
13
|
+
*
|
|
14
|
+
* @param logicName Logic名称
|
|
15
|
+
* @return 是否存在
|
|
16
|
+
*/
|
|
17
|
+
static async has (logicName) {
|
|
18
|
+
return await LogicRunner.getLogic(logicName, false, (result) => {
|
|
19
|
+
return result != null
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 执行Logic
|
|
25
|
+
*
|
|
26
|
+
* @param logicName Logic名称
|
|
27
|
+
* @param param 参数
|
|
28
|
+
* @return 执行结果
|
|
29
|
+
*/
|
|
30
|
+
static async run (logicName, param) {
|
|
31
|
+
// 获取Logic资源
|
|
32
|
+
const result = await LogicRunner.getLogic(logicName, false)
|
|
33
|
+
if (!result || !result.source) {
|
|
34
|
+
throw new ServiceException('Logic资源' + logicName + '未找到', 400)
|
|
35
|
+
}
|
|
36
|
+
const paramStr = Expression.toJSONString(param)
|
|
37
|
+
LogicRunner.logicConsoleInstance.info(`执行Logic[${logicName}],params: ${paramStr}`)
|
|
38
|
+
// 附加用户注册的对象到业务逻辑中
|
|
39
|
+
const plugins = {}
|
|
40
|
+
plugins.data = param
|
|
41
|
+
plugins.log = LogicRunner.logicConsoleInstance
|
|
42
|
+
plugins.ENV = result.$globalProp
|
|
43
|
+
plugins.logic = this
|
|
44
|
+
Object.assign(plugins, Plugins.default)
|
|
45
|
+
return LogicRunner.runExpression(result.source, plugins)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 执行原生表达式
|
|
50
|
+
*
|
|
51
|
+
* @param source 表达式内容
|
|
52
|
+
* @param params 参数
|
|
53
|
+
* @return 执行结果
|
|
54
|
+
*/
|
|
55
|
+
static async runExpression (source, params) {
|
|
56
|
+
return await ExpressionRunner.run(source, params)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
static async getLogic (logicName, isDev) {
|
|
60
|
+
return await getConfigByNameAsync(logicName, undefined, isDev)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export default class DateTools {
|
|
2
|
+
static instance = new DateTools()
|
|
3
|
+
|
|
4
|
+
constructor () {
|
|
5
|
+
if (DateTools.instance) {
|
|
6
|
+
return DateTools.instance
|
|
7
|
+
}
|
|
8
|
+
DateTools.instance = this
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
static getInstance () {
|
|
12
|
+
if (!DateTools.instance) {
|
|
13
|
+
DateTools.instance = new DateTools()
|
|
14
|
+
}
|
|
15
|
+
return DateTools.instance
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 获取当前时间
|
|
20
|
+
* @returns {string} yyyy-MM-dd HH:mm:ss
|
|
21
|
+
*/
|
|
22
|
+
getNow2 () {
|
|
23
|
+
const now = new Date()
|
|
24
|
+
const year = now.getFullYear()
|
|
25
|
+
const month = String(now.getMonth() + 1).padStart(2, '0') // 月份从 0 开始,所以要 +1
|
|
26
|
+
const day = String(now.getDate()).padStart(2, '0')
|
|
27
|
+
const hours = String(now.getHours()).padStart(2, '0')
|
|
28
|
+
const minutes = String(now.getMinutes()).padStart(2, '0')
|
|
29
|
+
const seconds = String(now.getSeconds()).padStart(2, '0')
|
|
30
|
+
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import JSONObject from "../../expression/instances/JSONObject";
|
|
2
|
+
import ServiceException from "../../expression/exception/ServiceException";
|
|
3
|
+
import LogicConsole from "../../expression/instances/LogicConsole";
|
|
4
|
+
import ExpressionRunner from "../../expression/ExpressionRunner";
|
|
5
|
+
import { indexedDB } from '../../utils/indexedDB'
|
|
6
|
+
|
|
7
|
+
export default class LogicRunner {
|
|
8
|
+
|
|
9
|
+
private static logicConsoleInstance: LogicConsole = new LogicConsole();
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 是否存在指定名称的Logic资源
|
|
13
|
+
*
|
|
14
|
+
* @param logicName Logic名称
|
|
15
|
+
* @return 是否存在
|
|
16
|
+
*/
|
|
17
|
+
public static has(logicName: string): boolean {
|
|
18
|
+
return LogicRunner.getLogic(logicName, false, (result: any) => {
|
|
19
|
+
return result != null;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 执行Logic
|
|
25
|
+
*
|
|
26
|
+
* @param logicName Logic名称
|
|
27
|
+
* @param param 参数
|
|
28
|
+
* @return 执行结果
|
|
29
|
+
*/
|
|
30
|
+
public static run(logicName: string, param: JSONObject | Object) : any {
|
|
31
|
+
// 获取Logic资源
|
|
32
|
+
const source = LogicRunner.getLogic(logicName, false, (result: any) => {
|
|
33
|
+
return result;
|
|
34
|
+
});
|
|
35
|
+
if (source == null) {
|
|
36
|
+
throw new ServiceException("Logic资源" + logicName + "未找到", 400)
|
|
37
|
+
}
|
|
38
|
+
LogicRunner.logicConsoleInstance.info("执行Logic[{}],params: {}", logicName, param)
|
|
39
|
+
// 附加用户注册的对象到业务逻辑中
|
|
40
|
+
const plugins = new JSONObject();
|
|
41
|
+
plugins.put("data", param);
|
|
42
|
+
plugins.put("log", LogicRunner.logicConsoleInstance);
|
|
43
|
+
plugins.put("logic", LogicRunner.prototype);
|
|
44
|
+
return LogicRunner.runExpression(source, plugins);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 执行原生表达式
|
|
49
|
+
*
|
|
50
|
+
* @param source 表达式内容
|
|
51
|
+
* @param params 参数
|
|
52
|
+
* @return 执行结果
|
|
53
|
+
*/
|
|
54
|
+
private static runExpression(source: string, params: JSONObject) : any {
|
|
55
|
+
return ExpressionRunner.run(source, params)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
private static getLogic(logicName: string, isDev: boolean, callback: Function) : any {
|
|
59
|
+
let apiPre = '/api/'
|
|
60
|
+
if (isDev) {
|
|
61
|
+
apiPre = '/devApi/'
|
|
62
|
+
}
|
|
63
|
+
const serviceName = process.env.VUE_APP_SYSTEM_NAME
|
|
64
|
+
const getConfigUrl = apiPre + serviceName + '/logic/openapi/getLiuliConfiguration'
|
|
65
|
+
indexedDB.getByWeb(logicName, getConfigUrl, {configName: logicName}, callback)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
|
|
3
|
+
import LogicRunner from '@vue2-client/logic/LogicRunner'
|
|
4
|
+
import { getCurrentInstance, ref } from 'vue'
|
|
5
|
+
|
|
6
|
+
const { proxy } = getCurrentInstance()
|
|
7
|
+
|
|
8
|
+
const metaData = ref({
|
|
9
|
+
test: {},
|
|
10
|
+
test2: [],
|
|
11
|
+
inputValue: '',
|
|
12
|
+
displayValue: 'default'
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
async function testLogic () {
|
|
16
|
+
const result = await LogicRunner.run('testVueLogic', {
|
|
17
|
+
metaData: metaData,
|
|
18
|
+
proxy: proxy
|
|
19
|
+
})
|
|
20
|
+
console.warn(metaData)
|
|
21
|
+
console.info('pageTest:' + result)
|
|
22
|
+
}
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<div>
|
|
27
|
+
录入值:<a-input v-model="metaData.inputValue" />
|
|
28
|
+
显示值:<span ref="displaySpan">{{ metaData.displayValue }}</span>
|
|
29
|
+
<br/>
|
|
30
|
+
<a-button @click="testLogic">修改</a-button>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<style scoped lang="less">
|
|
35
|
+
|
|
36
|
+
</style>
|
|
@@ -68,6 +68,7 @@ routerResource.example = {
|
|
|
68
68
|
// component: () => import('@vue2-client/base-client/components/common/XPrint/Demo.vue'),
|
|
69
69
|
// component: () => import('@vue2-client/base-client/components/AI/demo.vue'),
|
|
70
70
|
// component: () => import('@vue2-client/components/g2Charts/demo.vue'),
|
|
71
|
+
// component: () => import('@vue2-client/pages/LogicCallExample/index.vue'),
|
|
71
72
|
}
|
|
72
73
|
// routerResource.example = () =>
|
|
73
74
|
// import('@vue2-client/pages/Example')
|