cloud-web-corejs 1.0.54-dev.507 → 1.0.54-dev.509
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/package.json +1 -1
- package/src/components/code-editor/index.vue +102 -63
- package/src/components/errorMsg/index.vue +42 -34
- package/src/components/xform/form-designer/designer.js +2 -1
- package/src/components/xform/form-designer/setting-panel/form-setting.vue +13 -0
- package/src/components/xform/form-render/indexMixin.js +9 -0
- package/src/components/xform/mixins/defaultHandle.js +334 -1
- package/src/components/xform/utils/util.js +1 -0
package/package.json
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="ace-container">
|
|
3
3
|
<!-- 官方文档中使用id,这里禁止使用,在后期打包后容易出现问题,使用 ref 或者 DOM 就行 -->
|
|
4
|
-
<div class="ace-editor" ref="ace" :style="editorStyle">
|
|
5
|
-
|
|
6
|
-
</div>
|
|
4
|
+
<div class="ace-editor" ref="ace" :style="editorStyle"></div>
|
|
7
5
|
<template v-if="resize">
|
|
8
6
|
<div id="editor-resize-bar" @mousedown="btnMouseDown"></div>
|
|
9
7
|
<div class="icon-drag" @mousedown="btnMouseDown"></div>
|
|
@@ -12,84 +10,116 @@
|
|
|
12
10
|
</template>
|
|
13
11
|
|
|
14
12
|
<script>
|
|
15
|
-
import ace from
|
|
13
|
+
import ace from "ace-builds";
|
|
16
14
|
/* 启用此行后webpack打包回生成很多动态加载的js文件,不便于部署,故禁用!!
|
|
17
15
|
特别提示:禁用此行后,需要调用ace.config.set('basePath', 'path...')指定动态js加载URL!!
|
|
18
16
|
*/
|
|
19
17
|
//import 'ace-builds/webpack-resolver'
|
|
20
18
|
|
|
21
19
|
//import 'ace-builds/src-min-noconflict/theme-monokai' // 默认设置的主题
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
const ACE_BASE_PATH = window.WEB_PREFIX +
|
|
29
|
-
import indexUtil from "../../utils/index.js"
|
|
20
|
+
import "ace-builds/src-min-noconflict/theme-sqlserver"; // 新设主题
|
|
21
|
+
import "ace-builds/src-min-noconflict/mode-javascript"; // 默认设置的语言模式
|
|
22
|
+
import "ace-builds/src-min-noconflict/mode-json"; //
|
|
23
|
+
import "ace-builds/src-min-noconflict/mode-css"; //
|
|
24
|
+
import "ace-builds/src-min-noconflict/mode-java"; //
|
|
25
|
+
import "ace-builds/src-min-noconflict/ext-language_tools";
|
|
26
|
+
const ACE_BASE_PATH = window.WEB_PREFIX + "/base/ace/src-min-noconflict";
|
|
27
|
+
import indexUtil from "../../utils/index.js";
|
|
30
28
|
export default {
|
|
31
|
-
name:
|
|
29
|
+
name: "CodeEditor",
|
|
32
30
|
props: {
|
|
33
31
|
value: {
|
|
34
32
|
type: String,
|
|
35
|
-
default:
|
|
33
|
+
default: "",
|
|
36
34
|
},
|
|
37
35
|
readonly: {
|
|
38
36
|
type: Boolean,
|
|
39
|
-
default: false
|
|
37
|
+
default: false,
|
|
40
38
|
},
|
|
41
39
|
mode: {
|
|
42
40
|
type: String,
|
|
43
|
-
default:
|
|
41
|
+
default: "javascript",
|
|
44
42
|
},
|
|
45
43
|
userWorker: {
|
|
46
44
|
//是否开启语法检查,默认开启
|
|
47
45
|
type: Boolean,
|
|
48
|
-
default: true
|
|
46
|
+
default: true,
|
|
49
47
|
},
|
|
50
48
|
maxLines: {
|
|
51
49
|
type: Number,
|
|
52
|
-
default: 20
|
|
50
|
+
default: 20,
|
|
53
51
|
},
|
|
54
52
|
minLines: {
|
|
55
53
|
type: Number,
|
|
56
|
-
default: 20
|
|
54
|
+
default: 20,
|
|
57
55
|
},
|
|
58
56
|
height: {
|
|
59
57
|
type: String,
|
|
60
|
-
default:
|
|
58
|
+
default: "450px;",
|
|
61
59
|
},
|
|
62
60
|
resize: {
|
|
63
61
|
//是否开启语法检查,默认开启
|
|
64
62
|
type: Boolean,
|
|
65
|
-
default: true
|
|
63
|
+
default: true,
|
|
66
64
|
},
|
|
67
65
|
},
|
|
68
66
|
computed: {
|
|
69
|
-
editorStyle:function(){
|
|
70
|
-
return
|
|
67
|
+
editorStyle: function () {
|
|
68
|
+
return "height:" + this.height;
|
|
71
69
|
},
|
|
72
|
-
modePath: function() {
|
|
73
|
-
return
|
|
70
|
+
modePath: function () {
|
|
71
|
+
return "ace/mode/" + this.mode;
|
|
74
72
|
},
|
|
75
|
-
acData: function() {
|
|
73
|
+
acData: function () {
|
|
76
74
|
let acData = [];
|
|
77
|
-
if (this.mode ==
|
|
75
|
+
if (this.mode == "javascript") {
|
|
78
76
|
acData = [
|
|
79
|
-
{
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
77
|
+
{
|
|
78
|
+
meta: "VForm API",
|
|
79
|
+
caption: "getWidgetRef",
|
|
80
|
+
value: "getWidgetRef()",
|
|
81
|
+
score: 1,
|
|
82
|
+
},
|
|
83
|
+
{ meta: "VForm API", caption: "getFormRef", value: "getFormRef()", score: 1 },
|
|
84
|
+
{
|
|
85
|
+
meta: "VForm API",
|
|
86
|
+
caption: "addExtraAccessData",
|
|
87
|
+
value: "addExtraAccessData()",
|
|
88
|
+
score: 1,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
meta: "VForm API",
|
|
92
|
+
caption: "clearExtraAccessData",
|
|
93
|
+
value: "clearExtraAccessData()",
|
|
94
|
+
score: 1,
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
meta: "VForm API",
|
|
98
|
+
caption: "getFormParam",
|
|
99
|
+
value: "getFormParam()",
|
|
100
|
+
score: 1,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
meta: "VForm API",
|
|
104
|
+
caption: "getGlobalConfig",
|
|
105
|
+
value: "getGlobalConfig()",
|
|
106
|
+
score: 1,
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
meta: "snippet",
|
|
110
|
+
caption: "setInterval",
|
|
111
|
+
value: "setInterval(function() {}, 5000);",
|
|
112
|
+
score: 1,
|
|
113
|
+
},
|
|
84
114
|
//TODO: 待补充!!
|
|
85
115
|
];
|
|
86
116
|
}
|
|
87
117
|
return acData;
|
|
88
|
-
}
|
|
118
|
+
},
|
|
89
119
|
},
|
|
90
120
|
mounted() {
|
|
91
121
|
//ace.config.set('basePath', 'https://ks3-cn-beijing.ksyun.com/vform2021/ace')
|
|
92
|
-
ace.config.set(
|
|
122
|
+
ace.config.set("basePath", ACE_BASE_PATH);
|
|
93
123
|
|
|
94
124
|
this.addAutoCompletion(ace); //添加自定义代码提示!!
|
|
95
125
|
|
|
@@ -102,18 +132,18 @@ export default {
|
|
|
102
132
|
tabSize: 2, // 制表符设置为2个空格大小
|
|
103
133
|
readOnly: this.readonly,
|
|
104
134
|
highlightActiveLine: true,
|
|
105
|
-
value: this.codeValue
|
|
135
|
+
value: this.codeValue,
|
|
106
136
|
});
|
|
107
137
|
|
|
108
138
|
this.aceEditor.setOptions({
|
|
109
139
|
enableBasicAutocompletion: true,
|
|
110
140
|
enableSnippets: true, // 设置代码片段提示
|
|
111
|
-
enableLiveAutocompletion: true // 设置自动提示
|
|
141
|
+
enableLiveAutocompletion: true, // 设置自动提示
|
|
112
142
|
});
|
|
113
143
|
|
|
114
|
-
if (this.mode ===
|
|
144
|
+
if (this.mode === "json") {
|
|
115
145
|
this.setJsonMode();
|
|
116
|
-
} else if (this.mode ===
|
|
146
|
+
} else if (this.mode === "css") {
|
|
117
147
|
this.setCssMode();
|
|
118
148
|
}
|
|
119
149
|
|
|
@@ -122,75 +152,73 @@ export default {
|
|
|
122
152
|
}
|
|
123
153
|
|
|
124
154
|
//编辑时同步数据
|
|
125
|
-
this.aceEditor.getSession().on(
|
|
155
|
+
this.aceEditor.getSession().on("change", (ev) => {
|
|
126
156
|
//this.$emit('update:value', this.aceEditor.getValue()) // 触发更新事件, 实现.sync双向绑定!!
|
|
127
|
-
this.$emit(
|
|
157
|
+
this.$emit("input", this.aceEditor.getValue());
|
|
128
158
|
});
|
|
129
159
|
},
|
|
130
160
|
data() {
|
|
131
161
|
return {
|
|
132
162
|
aceEditor: null,
|
|
133
|
-
themePath:
|
|
163
|
+
themePath: "ace/theme/sqlserver", // 不导入 webpack-resolver,该模块路径会报错
|
|
134
164
|
// modePath: 'ace/mode/javascript', // 同上
|
|
135
|
-
codeValue: this.value ||
|
|
165
|
+
codeValue: this.value || "",
|
|
136
166
|
};
|
|
137
167
|
},
|
|
138
|
-
watch: {
|
|
139
|
-
|
|
140
|
-
},
|
|
168
|
+
watch: {},
|
|
141
169
|
methods: {
|
|
142
170
|
addAutoCompletion(ace) {
|
|
143
171
|
let acData = this.acData;
|
|
144
|
-
let langTools = ace.require(
|
|
172
|
+
let langTools = ace.require("ace/ext/language_tools");
|
|
145
173
|
langTools.addCompleter({
|
|
146
|
-
getCompletions: function(editor, session, pos, prefix, callback) {
|
|
174
|
+
getCompletions: function (editor, session, pos, prefix, callback) {
|
|
147
175
|
if (prefix.length === 0) {
|
|
148
176
|
return callback(null, []);
|
|
149
177
|
} else {
|
|
150
178
|
return callback(null, acData);
|
|
151
179
|
}
|
|
152
|
-
}
|
|
180
|
+
},
|
|
153
181
|
});
|
|
154
182
|
},
|
|
155
183
|
|
|
156
184
|
setJsonMode() {
|
|
157
|
-
this.aceEditor.getSession().setMode(
|
|
185
|
+
this.aceEditor.getSession().setMode("ace/mode/json");
|
|
158
186
|
},
|
|
159
187
|
|
|
160
188
|
setCssMode() {
|
|
161
|
-
this.aceEditor.getSession().setMode(
|
|
189
|
+
this.aceEditor.getSession().setMode("ace/mode/css");
|
|
162
190
|
},
|
|
163
191
|
|
|
164
192
|
getEditorAnnotations() {
|
|
165
193
|
return this.aceEditor.getSession().getAnnotations();
|
|
166
194
|
},
|
|
167
|
-
setValue(val){
|
|
195
|
+
setValue(val) {
|
|
168
196
|
this.aceEditor.setValue(val);
|
|
169
197
|
},
|
|
170
|
-
btnMouseDown(event){
|
|
198
|
+
btnMouseDown(event) {
|
|
171
199
|
let rootDom = document.body.querySelector("#app");
|
|
172
200
|
indexUtil.addClass(rootDom, "ns-resize-ing");
|
|
173
|
-
const editor = this.aceEditor
|
|
201
|
+
const editor = this.aceEditor;
|
|
174
202
|
const startY = event.clientY;
|
|
175
203
|
const startHeight = editor.container.clientHeight;
|
|
176
204
|
|
|
177
205
|
const onMouseMove = (moveEvent) => {
|
|
178
206
|
const deltaY = moveEvent.clientY - startY;
|
|
179
|
-
editor.container.style.height = startHeight + deltaY +
|
|
207
|
+
editor.container.style.height = startHeight + deltaY + "px";
|
|
180
208
|
};
|
|
181
209
|
|
|
182
210
|
const onMouseUp = () => {
|
|
183
211
|
indexUtil.removeClass(rootDom, "ns-resize-ing");
|
|
184
|
-
document.removeEventListener(
|
|
185
|
-
document.removeEventListener(
|
|
212
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
213
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
186
214
|
editor.resize();
|
|
187
215
|
editor.focus();
|
|
188
216
|
};
|
|
189
217
|
|
|
190
|
-
document.addEventListener(
|
|
191
|
-
document.addEventListener(
|
|
192
|
-
}
|
|
193
|
-
}
|
|
218
|
+
document.addEventListener("mousemove", onMouseMove);
|
|
219
|
+
document.addEventListener("mouseup", onMouseUp);
|
|
220
|
+
},
|
|
221
|
+
},
|
|
194
222
|
};
|
|
195
223
|
</script>
|
|
196
224
|
|
|
@@ -204,9 +232,20 @@ export default {
|
|
|
204
232
|
left: 0;
|
|
205
233
|
}
|
|
206
234
|
.ace-container {
|
|
207
|
-
position:relative;
|
|
208
|
-
.icon-drag{
|
|
209
|
-
|
|
235
|
+
position: relative;
|
|
236
|
+
.icon-drag {
|
|
237
|
+
position: absolute;
|
|
238
|
+
right: 3px;
|
|
239
|
+
bottom: 3px;
|
|
240
|
+
font-family: "iconfont";
|
|
241
|
+
font-size: 10px;
|
|
242
|
+
cursor: n-resize;
|
|
243
|
+
width: 12px;
|
|
244
|
+
height: 12px;
|
|
245
|
+
line-height: 12px;
|
|
246
|
+
&:before {
|
|
247
|
+
content: "\e61e";
|
|
248
|
+
}
|
|
210
249
|
}
|
|
211
250
|
}
|
|
212
251
|
</style>
|
|
@@ -16,55 +16,63 @@
|
|
|
16
16
|
<p v-if="!rmid">Error:</p>
|
|
17
17
|
<p v-if="rmid">Error({{ rmid }}):</p>
|
|
18
18
|
<template v-if="!showTextFlag">
|
|
19
|
-
<p
|
|
19
|
+
<p v-html="text1"></p>
|
|
20
20
|
</template>
|
|
21
21
|
<p v-if="showTextFlag" v-html="text2"></p>
|
|
22
|
-
<a href="javascript:void(0);" @click="showTextFlag
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
<a href="javascript:void(0);" @click="showTextFlag = !showTextFlag">{{
|
|
23
|
+
!showTextFlag
|
|
24
|
+
? $t2("详情", "components.errorMsg.detail")
|
|
25
|
+
: $t2("收起", "components.errorMsg.collapse")
|
|
26
|
+
}}</a>
|
|
25
27
|
</div>
|
|
26
28
|
<span slot="footer" class="dialog-footer">
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
<input
|
|
30
|
+
type="text"
|
|
31
|
+
ref="hbtn"
|
|
32
|
+
style="position: absolute; left: -999px; top: -999px"
|
|
33
|
+
/>
|
|
34
|
+
<el-button type="primary" @click="claoseDialog" class="button-sty"
|
|
35
|
+
><i class="el-icon-check el-icon"></i
|
|
36
|
+
>{{ $t2("确 定", "system.button.confirm2") }}</el-button
|
|
37
|
+
>
|
|
38
|
+
</span>
|
|
31
39
|
</el-dialog>
|
|
32
40
|
</div>
|
|
33
41
|
<div v-else-if="showWrap">
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
</
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
42
|
+
<div class="pop-tipsBox error" :style="'display: block;z-index:' + zIndex">
|
|
43
|
+
<div>
|
|
44
|
+
<i class="icon"></i>
|
|
45
|
+
<div class="cont">
|
|
46
|
+
<p class="name">{{ title }}</p>
|
|
47
|
+
<p class="txt" v-if="!rmid">Error:</p>
|
|
48
|
+
<p class="txt" v-if="rmid">Error({{ rmid }}):</p>
|
|
49
|
+
<template v-if="!showTextFlag">
|
|
50
|
+
<p class="txt">{{ text1 }}</p>
|
|
51
|
+
</template>
|
|
52
|
+
<p class="txt" v-if="showTextFlag" v-html="text2"></p>
|
|
53
|
+
<a href="javascript:void(0);" @click="showTextFlag = !showTextFlag">{{
|
|
54
|
+
!showTextFlag
|
|
55
|
+
? $t2("详情", "components.errorMsg.detail")
|
|
56
|
+
: $t2("收起", "components.errorMsg.collapse")
|
|
57
|
+
}}</a>
|
|
58
|
+
</div>
|
|
59
|
+
<div class="btns">
|
|
60
|
+
<el-button type="primary" class="btn" @click="claoseDialog">{{
|
|
61
|
+
$t2("确 定", "system.button.confirm2")
|
|
62
|
+
}}</el-button>
|
|
53
63
|
</div>
|
|
54
64
|
</div>
|
|
65
|
+
</div>
|
|
55
66
|
</div>
|
|
56
67
|
</template>
|
|
57
68
|
|
|
58
69
|
<script>
|
|
59
|
-
import {
|
|
60
|
-
mixins
|
|
61
|
-
} from './mixins'
|
|
70
|
+
import { mixins } from "./mixins";
|
|
62
71
|
|
|
63
72
|
export default {
|
|
64
73
|
// name: 'errorMsg',
|
|
65
|
-
mixins: [mixins]
|
|
66
|
-
}
|
|
74
|
+
mixins: [mixins],
|
|
75
|
+
};
|
|
67
76
|
</script>
|
|
68
77
|
|
|
69
|
-
<style>
|
|
70
|
-
</style>
|
|
78
|
+
<style></style>
|
|
@@ -20,6 +20,16 @@
|
|
|
20
20
|
placeholder="默认saveUpdatge"
|
|
21
21
|
></el-input>
|
|
22
22
|
</el-form-item>
|
|
23
|
+
<el-form-item label="全局参数配置">
|
|
24
|
+
<a
|
|
25
|
+
href="javascript:void(0);"
|
|
26
|
+
class="a-link link-oneLind"
|
|
27
|
+
@click="editFormEventHandler('globalConfig')"
|
|
28
|
+
>
|
|
29
|
+
<span>{{ formConfig.globalConfig }}</span>
|
|
30
|
+
<i class="el-icon-edit"></i>
|
|
31
|
+
</a>
|
|
32
|
+
</el-form-item>
|
|
23
33
|
<el-form-item :label="i18nt('designer.setting.globalFunctions')">
|
|
24
34
|
<a
|
|
25
35
|
href="javascript:void(0);"
|
|
@@ -911,6 +921,7 @@ export default {
|
|
|
911
921
|
onFormDataChange:
|
|
912
922
|
"onFormDataChange(fieldName, newValue, oldValue, formModel, subFormName, subFormRowIndex) {",
|
|
913
923
|
wfConfig: "wfConfig(dataId, formCode, formData) {",
|
|
924
|
+
globalConfig: "globalConfig(dataId, formCode) {",
|
|
914
925
|
//'onFormValidate': 'onFormValidate() {',
|
|
915
926
|
},
|
|
916
927
|
showVabsearchConfigDialog: false,
|
|
@@ -933,6 +944,8 @@ export default {
|
|
|
933
944
|
showBdCompanyEnvDialog1: false,
|
|
934
945
|
showBdCompanyEnvDialog2: false,
|
|
935
946
|
|
|
947
|
+
globalConfigParams: ["dataId", "formCode"],
|
|
948
|
+
|
|
936
949
|
tip1: `流程主题表达式设置说明。
|
|
937
950
|
|
|
938
951
|
1、可使用参数:
|
|
@@ -212,6 +212,7 @@ modules = {
|
|
|
212
212
|
formulaDialogVisible: false,
|
|
213
213
|
baseFormulaDialogOption: null,
|
|
214
214
|
baseFormulaDialogVisible: false,
|
|
215
|
+
globalConfig: {}
|
|
215
216
|
};
|
|
216
217
|
},
|
|
217
218
|
computed: {
|
|
@@ -265,6 +266,7 @@ modules = {
|
|
|
265
266
|
await this.initUserRoleData();
|
|
266
267
|
await this.initBdService();
|
|
267
268
|
// this.handleAllTableColumnWidget();
|
|
269
|
+
this.initGlobalConfig();//初始化全局配置
|
|
268
270
|
this.buildFormModel(!this.formJsonObj ? null : this.formJsonObj.widgetList);
|
|
269
271
|
// this.hanldeCommonWidget();//处理组件显隐规则
|
|
270
272
|
if (formConfig.isLoadEntity) {
|
|
@@ -284,6 +286,13 @@ modules = {
|
|
|
284
286
|
this.handleOnMounted();
|
|
285
287
|
},
|
|
286
288
|
methods: {
|
|
289
|
+
initGlobalConfig(){
|
|
290
|
+
//初始化全局配置
|
|
291
|
+
this.globalConfig = this.handleCustomEvent(
|
|
292
|
+
this.formConfig.globalConfig
|
|
293
|
+
) || {};
|
|
294
|
+
|
|
295
|
+
},
|
|
287
296
|
/**
|
|
288
297
|
* 数据对象key 驼峰下划线相互转化
|
|
289
298
|
* @param {Object} data - 原始对象 支持-数组、key-value对象、字符串
|