cloud-web-corejs 1.0.94 → 1.0.95
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 +39 -30
- package/src/components/wf/content.vue +2 -0
- package/src/components/wf/setCandidateDialog.vue +1 -0
- package/src/components/xform/form-designer/designer.js +1 -1
- package/src/components/xform/form-designer/form-widget/container-widget/data-table-mixin.js +2 -1
- package/src/components/xform/form-designer/form-widget/dialog/searchFormDialog.vue +3 -0
- package/src/components/xform/form-designer/form-widget/field-widget/checkbox-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/dropdown-item-widget.vue +77 -0
- package/src/components/xform/form-designer/form-widget/field-widget/dropdown-menu-widget.vue +106 -0
- package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +7 -2
- package/src/components/xform/form-designer/form-widget/field-widget/mixins/vabsearch-mixin.js +176 -0
- package/src/components/xform/form-designer/form-widget/field-widget/multiSearch-widget.vue +53 -0
- package/src/components/xform/form-designer/form-widget/field-widget/number-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/project-tag-widget.vue +5 -2
- package/src/components/xform/form-designer/form-widget/field-widget/radio-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/search_button-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/select-widget.vue +2 -1
- package/src/components/xform/form-designer/form-widget/field-widget/singerSearch-widget.vue +53 -0
- package/src/components/xform/form-designer/form-widget/field-widget/status-widget.vue +3 -2
- package/src/components/xform/form-designer/form-widget/field-widget/vabSearch-widget.vue +2 -170
- package/src/components/xform/form-designer/indexMixin.js +1 -1
- package/src/components/xform/form-designer/setting-panel/form-setting.vue +260 -38
- package/src/components/xform/form-designer/setting-panel/index.vue +4 -0
- package/src/components/xform/form-designer/setting-panel/indexMixin.js +1 -1
- package/src/components/xform/form-designer/setting-panel/option-items-setting.vue +8 -3
- package/src/components/xform/form-designer/setting-panel/property-editor/a-link-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/columnRenderDialog.vue +3 -2
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +0 -8
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +111 -12
- package/src/components/xform/form-designer/setting-panel/property-editor/container-list-h5/list-h5-editor.vue +0 -8
- package/src/components/xform/form-designer/setting-panel/property-editor/field-button/search-dialog-event-editor.vue +26 -8
- package/src/components/xform/form-designer/setting-panel/property-editor/field-dropdown-menu/dropdown-item-editor.vue +21 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-dropdown-menu/dropdown-menu-editor.vue +59 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import-button-editor.vue +7 -2
- package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import2-button-editor.vue +8 -2
- package/src/components/xform/form-designer/setting-panel/property-editor/field-status/field-status-editor.vue +47 -28
- package/src/components/xform/form-designer/setting-panel/property-editor/field-vabSearch/vabSearchName-editor.vue +13 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/formula-editor.vue +722 -467
- package/src/components/xform/form-designer/setting-panel/property-editor/formulaEnabled-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/multiple-editor.vue +19 -14
- package/src/components/xform/form-designer/setting-panel/property-editor/project-tag-editor.vue +159 -18
- package/src/components/xform/form-designer/setting-panel/property-editor/textFlag-editor.vue +51 -2
- package/src/components/xform/form-designer/setting-panel/property-editor/wfFlag-editor.vue +2 -30
- package/src/components/xform/form-designer/setting-panel/property-editor/widgetShowRuleFlag-editor.vue +220 -0
- package/src/components/xform/form-designer/setting-panel/propertyRegister.js +5 -0
- package/src/components/xform/form-designer/toolbar-panel/index.vue +8 -4
- package/src/components/xform/form-designer/widget-panel/index.vue +21 -1
- package/src/components/xform/form-designer/widget-panel/indexMixin.js +3 -2
- package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +489 -132
- package/src/components/xform/form-render/container-item/data-table-item.vue +7 -4
- package/src/components/xform/form-render/container-item/data-table-mixin.js +4 -1
- package/src/components/xform/form-render/container-item/data-table-mixin2.js +2169 -0
- package/src/components/xform/form-render/container-item/list-h5-item.vue +1 -9
- package/src/components/xform/form-render/container-item/list-h5-item2.vue +1 -8
- package/src/components/xform/form-render/indexMixin.js +7 -3
- package/src/components/xform/lang/zh-CN.js +13 -3
- package/src/components/xform/mixins/defaultHandle.js +1 -1
- package/src/components/xform/mixins/scriptHttp.js +1 -1
- package/src/components/xform/utils/format.js +21 -30
- package/src/components/xform/utils/formula-util.js +669 -0
- package/src/components/xform/utils/util.js +1 -1
- package/src/mixins/selectDialog/index.js +1 -1
- package/src/store/modules/permission.js +1 -1
- package/src/store/modules/settings.js +1 -1
@@ -1,27 +1,31 @@
|
|
1
1
|
<template>
|
2
|
-
<div>
|
3
|
-
<el-form-item
|
4
|
-
|
2
|
+
<div v-show="false">
|
3
|
+
<el-form-item
|
4
|
+
:label="i18nt('designer.setting.formula')"
|
5
|
+
v-if="optionModel.formulaEnabled"
|
6
|
+
>
|
7
|
+
</el-form-item>
|
8
|
+
<el-form-item label-width="0" v-if="optionModel.formulaEnabled">
|
9
|
+
<el-tooltip :content="formulaForView" effect="light" placement="top">
|
5
10
|
<el-input v-model="formulaForView" readonly>
|
6
|
-
<template
|
7
|
-
<el-button icon="el-icon-edit"
|
11
|
+
<template #append>
|
12
|
+
<el-button @click="editFormula" icon="el-icon-edit"></el-button>
|
8
13
|
</template>
|
9
14
|
</el-input>
|
10
15
|
</el-tooltip>
|
11
16
|
</el-form-item>
|
12
17
|
<el-dialog
|
18
|
+
v-if="formulaDialogVisible"
|
13
19
|
:visible.sync="formulaDialogVisible"
|
14
20
|
:title="i18nt('designer.hint.formulaSetting')"
|
21
|
+
custom-class="dialog-style list-dialog"
|
15
22
|
:close-on-click-modal="false"
|
16
23
|
:close-on-press-escape="false"
|
17
24
|
:destroy-on-close="true"
|
18
25
|
:append-to-body="true"
|
19
|
-
top="0px"
|
20
26
|
width="70%"
|
27
|
+
top="0px"
|
21
28
|
ref="colFormulaDialog"
|
22
|
-
custom-class="dialog-style list-dialog dialog-checkbox pd_0"
|
23
|
-
v-el-drag-dialog
|
24
|
-
v-el-dialog-center
|
25
29
|
>
|
26
30
|
<div class="cont">
|
27
31
|
<el-row>
|
@@ -30,75 +34,50 @@
|
|
30
34
|
<div class="editor-top">
|
31
35
|
<el-row>
|
32
36
|
<el-col :span="22">
|
33
|
-
<div style="font-weight: bold
|
37
|
+
<div style="font-weight: bold">
|
38
|
+
{{ this.optionModel.label }} =
|
39
|
+
</div>
|
34
40
|
</el-col>
|
41
|
+
<!-- el-tag 模式 按钮 end -->
|
35
42
|
<el-col :span="2">
|
36
|
-
<el-button
|
37
|
-
|
43
|
+
<el-button
|
44
|
+
size="small"
|
45
|
+
@click="clearFormula"
|
46
|
+
type="danger"
|
47
|
+
plain
|
48
|
+
>
|
49
|
+
{{ i18nt("designer.hint.formulaClear") }}
|
38
50
|
</el-button>
|
39
51
|
</el-col>
|
40
52
|
</el-row>
|
41
|
-
|
42
|
-
<div class="el-col el-col-22">
|
43
|
-
<div style="font-weight: bold;"> 年龄 =</div>
|
44
|
-
</div>
|
45
|
-
<div class="el-col el-col-2">
|
46
|
-
<button type="button"
|
47
|
-
class="el-button el-button--danger el-button--small is-plain"><!––><!––><span> 清除 </span>
|
48
|
-
</button>
|
49
|
-
</div>
|
50
|
-
</div>-->
|
51
|
-
<div ref="cmRef" style="height: 110px; width: 100%;">
|
52
|
-
<editor-content :editor="codeMirror" />
|
53
|
-
</div>
|
54
|
-
<!-- <div style="height: 110px; width: 100%;">
|
55
|
-
<codemirror
|
56
|
-
ref="codeEditor"
|
57
|
-
v-model="formulaStr"
|
58
|
-
:options="cmOptions"
|
59
|
-
@input="codeMirrorChange"
|
60
|
-
></codemirror>
|
61
|
-
</div>-->
|
53
|
+
<div ref="cmRef" style="height: 83px; width: 100%"></div>
|
62
54
|
</div>
|
55
|
+
<!-- -->
|
63
56
|
<div class="editor-bottom">
|
64
|
-
<
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
<!––><span> * </span></button>
|
73
|
-
<button type="button" class="el-button el-button--default el-button--default"><!––>
|
74
|
-
<!––><span> / </span></button>
|
75
|
-
<button type="button" class="el-button el-button--default el-button--default"><!––>
|
76
|
-
<!––><span> != </span></button>
|
77
|
-
<button type="button" class="el-button el-button--default el-button--default"><!––>
|
78
|
-
<!––><span> == </span></button>
|
79
|
-
<button type="button" class="el-button el-button--default el-button--default"><!––>
|
80
|
-
<!––><span> < </span></button>
|
81
|
-
<button type="button" class="el-button el-button--default el-button--default"><!––>
|
82
|
-
<!––><span> > </span></button>
|
83
|
-
<button type="button" class="el-button el-button--default el-button--default"><!––>
|
84
|
-
<!––><span> <= </span></button>
|
85
|
-
<button type="button" class="el-button el-button--default el-button--default"><!––>
|
86
|
-
<!––><span> >= </span></button>
|
87
|
-
<button type="button" class="el-button el-button--default el-button--default"><!––>
|
88
|
-
<!––><span> ( </span></button>
|
89
|
-
<button type="button" class="el-button el-button--default el-button--default"><!––>
|
90
|
-
<!––><span> ) </span></button>
|
91
|
-
<button type="button" class="el-button el-button--default el-button--default"><!––>
|
92
|
-
<!––><span> , </span></button>-->
|
57
|
+
<el-button
|
58
|
+
v-on:click="insertSymbol(item)"
|
59
|
+
size="default"
|
60
|
+
v-for="(item, idx) in operate"
|
61
|
+
:key="idx"
|
62
|
+
>
|
63
|
+
{{ item }}
|
64
|
+
</el-button>
|
93
65
|
</div>
|
66
|
+
<!-- -->
|
94
67
|
</div>
|
95
68
|
</el-col>
|
96
69
|
</el-row>
|
97
|
-
<el-row style="margin: 10px
|
70
|
+
<el-row style="margin: 10px">
|
98
71
|
<el-col :span="6">
|
99
72
|
<div class="group-item-left">
|
100
|
-
<div class="item-header">
|
101
|
-
|
73
|
+
<div class="item-header">
|
74
|
+
{{ i18nt("designer.hint.formulaWidgetList") }}
|
75
|
+
</div>
|
76
|
+
<el-input
|
77
|
+
:placeholder="i18nt('designer.hint.formulaSearch')"
|
78
|
+
v-model="filterText"
|
79
|
+
clearable
|
80
|
+
></el-input>
|
102
81
|
<div class="item-body-left">
|
103
82
|
<el-tree
|
104
83
|
ref="fieldTree"
|
@@ -106,22 +85,18 @@
|
|
106
85
|
:filter-node-method="filterNode"
|
107
86
|
@node-click="insertField"
|
108
87
|
>
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
88
|
+
<template #default="{ node, data }">
|
89
|
+
<span class="custom-tree-node">
|
90
|
+
<el-tooltip
|
91
|
+
effect="dark"
|
92
|
+
:content="node.label"
|
93
|
+
placement="right"
|
94
|
+
>
|
95
|
+
<span>{{ node.label }}</span>
|
96
|
+
</el-tooltip>
|
97
|
+
</span>
|
98
|
+
</template>
|
114
99
|
</el-tree>
|
115
|
-
<!-- <div role="tree" class="el-tree">
|
116
|
-
<div role="treeitem" tabindex="0" draggable="false" class="el-tree-node is-focusable">
|
117
|
-
<div class="el-tree-node__content" style="padding-left: 0px;"><span
|
118
|
-
class="is-leaf el-tree-node__expand-icon el-icon-caret-right"></span><!––><!––>
|
119
|
-
<span
|
120
|
-
class="custom-tree-node"><span class="el-tooltip"
|
121
|
-
aria-describedby="el-tooltip-4169" tabindex="0">number</span></span>
|
122
|
-
</div><!––></div><!––>
|
123
|
-
<div class="el-tree__drop-indicator" style="display: none;"></div>
|
124
|
-
</div>-->
|
125
100
|
</div>
|
126
101
|
</div>
|
127
102
|
</el-col>
|
@@ -129,77 +104,38 @@
|
|
129
104
|
<el-row>
|
130
105
|
<el-col :span="24">
|
131
106
|
<div class="group-item-right-top">
|
132
|
-
<div class="item-header">
|
107
|
+
<div class="item-header">
|
108
|
+
{{ i18nt("designer.hint.formulaFunctionList") }}
|
109
|
+
</div>
|
133
110
|
<div class="function-list">
|
134
111
|
<el-collapse v-model="funcActiveCollapseNames">
|
135
|
-
<el-collapse-item
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
class="el-tag el-tag--light">数字 </span></div>
|
161
|
-
<div class="field-item"><span>POWER</span><span
|
162
|
-
class="el-tag el-tag--light">数字 </span></div>-->
|
112
|
+
<el-collapse-item
|
113
|
+
v-for="(item, index) in funcList"
|
114
|
+
:key="index"
|
115
|
+
:title="i18nt(item.fClass)"
|
116
|
+
:name="index"
|
117
|
+
>
|
118
|
+
<div
|
119
|
+
v-for="(info, i) in item.flist"
|
120
|
+
:key="i"
|
121
|
+
class="field-item"
|
122
|
+
@click="insertFunction(info.fName + '(')"
|
123
|
+
@mouseenter="
|
124
|
+
showIntro(
|
125
|
+
i18nt(info.fName),
|
126
|
+
i18nt(item.fClass),
|
127
|
+
i18nt(info.fIntro)
|
128
|
+
)
|
129
|
+
"
|
130
|
+
v-on:mouseleave="resetIntro"
|
131
|
+
>
|
132
|
+
<span>{{ info.fName }}</span>
|
133
|
+
<el-tag :type="getClass(info.fType)"
|
134
|
+
>{{ i18nt(info.fType) }}
|
135
|
+
</el-tag>
|
136
|
+
</div>
|
163
137
|
</el-collapse-item>
|
164
138
|
</el-collapse>
|
165
|
-
<!-- <div role="tablist" aria-multiselectable="true" class="el-collapse">
|
166
|
-
<div class="el-collapse-item is-active">
|
167
|
-
<div role="tab" aria-expanded="true" aria-controls="el-collapse-content-7683"
|
168
|
-
aria-describedby="el-collapse-content-7683">
|
169
|
-
<div role="button" id="el-collapse-head-7683" tabindex="0"
|
170
|
-
class="el-collapse-item__header is-active">数学函数<i
|
171
|
-
class="el-collapse-item__arrow el-icon-arrow-right is-active"></i></div>
|
172
|
-
</div>
|
173
|
-
<div role="tabpanel" aria-labelledby="el-collapse-head-7683" id="el-collapse-content-7683"
|
174
|
-
class="el-collapse-item__wrap">
|
175
|
-
<div class="el-collapse-item__content">
|
176
|
-
<div class="field-item"><span>INT</span><span
|
177
|
-
class="el-tag el-tag--light">数字 </span></div>
|
178
|
-
<div class="field-item"><span>SUM</span><span
|
179
|
-
class="el-tag el-tag--light">数字 </span></div>
|
180
|
-
<div class="field-item"><span>AVERAGE</span><span
|
181
|
-
class="el-tag el-tag--light">数字 </span></div>
|
182
|
-
<div class="field-item"><span>MAX</span><span
|
183
|
-
class="el-tag el-tag--light">数字 </span></div>
|
184
|
-
<div class="field-item"><span>MIN</span><span
|
185
|
-
class="el-tag el-tag--light">数字 </span></div>
|
186
|
-
<div class="field-item"><span>ABS</span><span
|
187
|
-
class="el-tag el-tag--light">数字 </span></div>
|
188
|
-
<div class="field-item"><span>ROUND</span><span
|
189
|
-
class="el-tag el-tag--light">数字 </span></div>
|
190
|
-
<div class="field-item"><span>CEILING</span><span
|
191
|
-
class="el-tag el-tag--light">数字 </span></div>
|
192
|
-
<div class="field-item"><span>LOG</span><span
|
193
|
-
class="el-tag el-tag--light">数字 </span></div>
|
194
|
-
<div class="field-item"><span>MOD</span><span
|
195
|
-
class="el-tag el-tag--light">数字 </span></div>
|
196
|
-
<div class="field-item"><span>POWER</span><span
|
197
|
-
class="el-tag el-tag--light">数字 </span></div>
|
198
|
-
</div>
|
199
|
-
</div>
|
200
|
-
</div>
|
201
|
-
</div>-->
|
202
|
-
|
203
139
|
</div>
|
204
140
|
</div>
|
205
141
|
</el-col>
|
@@ -210,12 +146,17 @@
|
|
210
146
|
<div class="item-header">{{ introTitle }}</div>
|
211
147
|
<div class="item-body-right-bottom">
|
212
148
|
<ul>
|
213
|
-
<li
|
214
|
-
|
215
|
-
|
149
|
+
<li
|
150
|
+
v-if="introduction.title !== ''"
|
151
|
+
style="font-size: 16px; color: #0a5d7c"
|
152
|
+
>
|
153
|
+
{{ introduction.title }}
|
216
154
|
</li>
|
217
155
|
<li>
|
218
|
-
<div
|
156
|
+
<div
|
157
|
+
class="intro-content"
|
158
|
+
v-html="introduction.content"
|
159
|
+
></div>
|
219
160
|
</li>
|
220
161
|
</ul>
|
221
162
|
</div>
|
@@ -223,84 +164,87 @@
|
|
223
164
|
</el-col>
|
224
165
|
</el-row>
|
225
166
|
</div>
|
226
|
-
<
|
227
|
-
<el-button
|
228
|
-
|
229
|
-
|
167
|
+
<div class="dialog-footer" slot="footer">
|
168
|
+
<el-button
|
169
|
+
@click="formulaDialogVisible = false"
|
170
|
+
class="button-sty"
|
171
|
+
icon="el-icon-close"
|
172
|
+
>
|
173
|
+
{{ i18nt("designer.hint.cancel") }}
|
174
|
+
</el-button>
|
175
|
+
<el-button
|
176
|
+
type="primary"
|
177
|
+
@click="saveFormula"
|
178
|
+
class="button-sty"
|
179
|
+
icon="el-icon-check"
|
180
|
+
>
|
181
|
+
{{ i18nt("designer.hint.confirm") }}
|
182
|
+
</el-button>
|
183
|
+
</div>
|
230
184
|
</el-dialog>
|
231
185
|
</div>
|
232
186
|
</template>
|
233
187
|
|
234
188
|
<script>
|
235
|
-
import
|
236
|
-
|
237
|
-
|
238
|
-
import
|
239
|
-
import {Schema, DOMParser} from "prosemirror-model"*/
|
240
|
-
|
241
|
-
import {
|
242
|
-
formulas,
|
243
|
-
FORMULA_REG_EXP,
|
244
|
-
} from "../../../../../components/xform/utils/formula";
|
189
|
+
import {basicSetup, EditorView} from "codemirror";
|
190
|
+
import {javascript} from "@codemirror/lang-javascript";
|
191
|
+
import {EditorState} from "@codemirror/state";
|
192
|
+
import i18n from "@base/components/xform/utils/i18n";
|
245
193
|
import {
|
246
194
|
deepClone,
|
247
|
-
getAllFieldWidgets,
|
248
195
|
getAllContainerWidgets,
|
249
|
-
|
250
|
-
|
251
|
-
|
196
|
+
getAllFieldWidgets,
|
197
|
+
getFieldWidgetById,
|
198
|
+
traverseFieldWidgetsOfContainer,
|
199
|
+
loopHandleWidget
|
200
|
+
} from "@base/components/xform/utils/util";
|
201
|
+
import {
|
202
|
+
placeholders,
|
203
|
+
baseTheme,
|
204
|
+
formulas,
|
205
|
+
FORMULA_REG_EXP,
|
206
|
+
} from "@base/components/xform/utils/formula-util";
|
252
207
|
|
253
208
|
export default {
|
254
209
|
name: "formula-editor",
|
255
210
|
mixins: [i18n],
|
256
|
-
components: {
|
211
|
+
components: {},
|
257
212
|
props: {
|
258
213
|
designer: Object,
|
259
214
|
selectedWidget: Object,
|
260
215
|
optionModel: Object,
|
216
|
+
tableColumns: Array
|
261
217
|
},
|
218
|
+
inject:["columnFlag","sourceData"],
|
262
219
|
computed: {
|
263
220
|
formulaForView() {
|
264
|
-
const
|
265
|
-
if (!
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
);
|
221
|
+
const matchResult = this.optionModel.formula.match(FORMULA_REG_EXP);
|
222
|
+
if (!matchResult) {
|
223
|
+
return this.optionModel.formula;
|
224
|
+
}
|
225
|
+
|
226
|
+
let resultFormula = this.optionModel.formula;
|
227
|
+
matchResult.forEach((mi) => {
|
228
|
+
const secondPart = mi.split(".")[1];
|
229
|
+
resultFormula = resultFormula.replaceAll(mi, secondPart);
|
230
|
+
});
|
231
|
+
|
232
|
+
return resultFormula;
|
274
233
|
},
|
275
234
|
},
|
276
235
|
watch: {
|
277
|
-
filterText(
|
278
|
-
this.$refs.fieldTree.filter(
|
236
|
+
filterText(val) {
|
237
|
+
this.$refs.fieldTree.filter(val);
|
279
238
|
},
|
280
239
|
},
|
281
240
|
data() {
|
282
241
|
return {
|
283
|
-
cmOptions: {
|
284
|
-
// 语言及语法模式
|
285
|
-
mode: 'text/javascript',
|
286
|
-
// 主题
|
287
|
-
theme: "idea",
|
288
|
-
// 显示函数
|
289
|
-
line: true,
|
290
|
-
lineNumbers: false,
|
291
|
-
// 软换行
|
292
|
-
lineWrapping: true,
|
293
|
-
// tab宽度
|
294
|
-
tabSize: 4,
|
295
|
-
},
|
296
|
-
formulaStr:"",
|
297
|
-
|
298
242
|
codeMirror: null,
|
299
243
|
formula: "",
|
300
|
-
tags: [],
|
301
|
-
fieldTreeData: [],
|
244
|
+
tags: [], // 公式页签集合
|
245
|
+
fieldTreeData: [], // 设计器字段树
|
302
246
|
filterText: "",
|
303
|
-
formulaDialogVisible:
|
247
|
+
formulaDialogVisible: false,
|
304
248
|
operate: [
|
305
249
|
"+",
|
306
250
|
"-",
|
@@ -325,9 +269,7 @@ export default {
|
|
325
269
|
value: "large",
|
326
270
|
},
|
327
271
|
{
|
328
|
-
label: this.i18nt(
|
329
|
-
"designer.hint.formulaSizeMedium"
|
330
|
-
),
|
272
|
+
label: this.i18nt("designer.hint.formulaSizeMedium"),
|
331
273
|
value: "default",
|
332
274
|
},
|
333
275
|
{
|
@@ -339,19 +281,17 @@ export default {
|
|
339
281
|
value: "small",
|
340
282
|
},
|
341
283
|
],
|
342
|
-
introTitle: this.i18nt(
|
343
|
-
"designer.hint.formulaFunctionExplain"
|
344
|
-
),
|
284
|
+
introTitle: this.i18nt("designer.hint.formulaFunctionExplain"),
|
345
285
|
introduction: {
|
346
286
|
title: this.i18nt("designer.hint.formulaPleaseSelect"),
|
347
287
|
content:
|
348
|
-
'<span class="cg">'
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
288
|
+
'<span class="cg">' +
|
289
|
+
this.i18nt("designer.hint.formulaSample") +
|
290
|
+
':</span><span class="fname">SUM</span><span class="cg">(</span><span class="cs">' +
|
291
|
+
this.i18nt("designer.hint.formulaPara") +
|
292
|
+
'1</span><span class="cg">,</span><span class="cs">' +
|
293
|
+
this.i18nt("designer.hint.formulaPara") +
|
294
|
+
'2</span><span class="cg">)</span>',
|
355
295
|
},
|
356
296
|
funcList: formulas,
|
357
297
|
funcActiveCollapseNames: [0],
|
@@ -360,332 +300,561 @@ export default {
|
|
360
300
|
mounted() {
|
361
301
|
},
|
362
302
|
methods: {
|
363
|
-
clearFormula(
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
303
|
+
clearFormula(event) {
|
304
|
+
this.formula = ""; //CodeMirror 模式
|
305
|
+
this.tags = []; //el-tag模式
|
306
|
+
this.codeMirror.dispatch({
|
307
|
+
changes: {from: 0, to: this.codeMirror.state.doc.length, insert: ""},
|
308
|
+
});
|
309
|
+
},
|
310
|
+
|
311
|
+
/** 删除字符串str中的第n个subStr
|
312
|
+
* @param {Object} str
|
313
|
+
* @param {Object} subStr
|
314
|
+
* @param {Object} n
|
315
|
+
*/
|
316
|
+
deleteChar(str, subStr, n) {
|
317
|
+
let num = -1;
|
318
|
+
return str.replace(/a/g, (item) => {
|
319
|
+
num++;
|
320
|
+
return num === n ? "" : item;
|
321
|
+
});
|
322
|
+
},
|
323
|
+
|
324
|
+
filterNode(value, data) {
|
325
|
+
if (!value) return true;
|
326
|
+
return data.label.indexOf(value) !== -1;
|
327
|
+
},
|
328
|
+
|
329
|
+
traverseFieldWidgetsOfTableDataWidget(widget, callback) {
|
330
|
+
if (widget.type == "data-table") {
|
331
|
+
let loopDo = (t) => {
|
332
|
+
if (t.children && t.children.length) {
|
333
|
+
t.children.forEach((item) => {
|
334
|
+
loopDo(item);
|
335
|
+
});
|
336
|
+
} else {
|
337
|
+
if (t.widget) {
|
338
|
+
if (t.formatS == "editNumber") {
|
339
|
+
t.widget.options.label = t.label;
|
340
|
+
this.handleTableConfigData(t.widget, callback);
|
341
|
+
}
|
342
|
+
}
|
343
|
+
}
|
344
|
+
};
|
345
|
+
|
346
|
+
let tableColumns = this.tableColumns;
|
347
|
+
let columns = tableColumns ? tableColumns : widget.options.tableColumns
|
348
|
+
columns.forEach((item) => {
|
349
|
+
loopDo(item);
|
350
|
+
loopHandleWidget(item.widgetList, (item1) => {
|
351
|
+
if (item1.type == "number") {
|
352
|
+
this.handleTableConfigData(item1, callback);
|
353
|
+
}
|
354
|
+
});
|
372
355
|
});
|
356
|
+
}
|
373
357
|
},
|
374
|
-
|
375
|
-
|
376
|
-
return o.replace(/a/g, (s) => (l++, l === n ? "" : s));
|
358
|
+
handleTableConfigData(widget, callback) {
|
359
|
+
callback(widget);
|
377
360
|
},
|
378
|
-
|
379
|
-
|
361
|
+
getTargetWidgetList(){
|
362
|
+
let widgetList = this.designer.widgetList;
|
363
|
+
if(this.columnFlag){
|
364
|
+
let sourceData = this.sourceData;
|
365
|
+
let formWidgetList = sourceData.getWidgetList(widgetList)
|
366
|
+
widgetList = formWidgetList;
|
367
|
+
}
|
368
|
+
return widgetList;
|
380
369
|
},
|
381
370
|
loadFieldListToTree() {
|
382
|
-
this.fieldTreeData.length = 0;
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
const
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
371
|
+
this.fieldTreeData.length = 0; //先清空
|
372
|
+
|
373
|
+
let widgetList = this.getTargetWidgetList();
|
374
|
+
|
375
|
+
const allFields = getAllFieldWidgets(widgetList);
|
376
|
+
const allContainers = getAllContainerWidgets(widgetList);
|
377
|
+
|
378
|
+
const subFormArray = [];
|
379
|
+
let sfFieldArray = [];
|
380
|
+
const subFormFieldMap = {};
|
381
|
+
|
382
|
+
//获取子表单容器内部的字段
|
383
|
+
allContainers.forEach((con) => {
|
384
|
+
if (con.type === "sub-form" || con.type === "grid-sub-form") {
|
385
|
+
subFormArray.push(con.container);
|
386
|
+
|
387
|
+
const tmpFieldArray = [];
|
388
|
+
const fwHandler = (fw) => {
|
389
|
+
if (!!fw.formItemFlag && fw.type === "number") {
|
390
|
+
tmpFieldArray.push(fw);
|
391
|
+
}
|
392
|
+
};
|
393
|
+
traverseFieldWidgetsOfContainer(con.container, fwHandler);
|
394
|
+
subFormFieldMap[con.container.options.name] = tmpFieldArray;
|
395
|
+
sfFieldArray = sfFieldArray.concat(tmpFieldArray);
|
396
|
+
} else if (con.type === "data-table") {
|
397
|
+
subFormArray.push(con.container);
|
398
|
+
|
399
|
+
const tmpFieldArray = [];
|
400
|
+
const fwHandler = (fw) => {
|
401
|
+
if (!!fw.formItemFlag && fw.type === "number") {
|
402
|
+
tmpFieldArray.push(fw);
|
403
|
+
}
|
404
|
+
};
|
405
|
+
|
406
|
+
// this.traverseFieldWidgetsOfTableDataWidget(con.container, fwHandler);
|
407
|
+
traverseFieldWidgetsOfContainer(con.container, fwHandler);
|
408
|
+
subFormFieldMap[con.container.options.name] = tmpFieldArray;
|
409
|
+
sfFieldArray = sfFieldArray.concat(tmpFieldArray);
|
403
410
|
}
|
404
|
-
})
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
411
|
+
});
|
412
|
+
|
413
|
+
//加载到树形组件数据对象
|
414
|
+
allFields.forEach((fld) => {
|
415
|
+
if (!sfFieldArray.find((item) => item.id === fld.field.id)) {
|
416
|
+
//排除子表单字段
|
417
|
+
const fieldNode = {
|
418
|
+
id: fld.field.id,
|
419
|
+
name: fld.field.options.name,
|
420
|
+
label: fld.field.options.label,
|
421
|
+
type: fld.field.type,
|
422
|
+
formItemFlag: true,
|
423
|
+
};
|
424
|
+
|
425
|
+
if (
|
426
|
+
fieldNode.name !== this.optionModel.name &&
|
427
|
+
fieldNode.type === "number"
|
428
|
+
) {
|
429
|
+
//排除当前设置公式字段
|
430
|
+
this.fieldTreeData.push(fieldNode);
|
417
431
|
}
|
418
|
-
}
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
432
|
+
}
|
433
|
+
});
|
434
|
+
|
435
|
+
subFormArray.forEach((sf) => {
|
436
|
+
const subFormNode = {
|
437
|
+
id: sf.id,
|
438
|
+
name: sf.options.name,
|
439
|
+
label: sf.options.label || sf.options.name,
|
440
|
+
type: sf.type,
|
441
|
+
formItemFlag: false,
|
442
|
+
children: [],
|
443
|
+
};
|
444
|
+
|
445
|
+
subFormFieldMap[sf.options.name].forEach((fld) => {
|
446
|
+
const fieldNode = {
|
447
|
+
id: fld.id,
|
448
|
+
name: fld.options.name,
|
449
|
+
label: fld.options.label,
|
450
|
+
type: fld.type,
|
451
|
+
formItemFlag: true,
|
427
452
|
};
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
type: $.type,
|
434
|
-
formItemFlag: !0,
|
435
|
-
};
|
436
|
-
g.name !== this.optionModel.name
|
437
|
-
&& u.children.push(g);
|
438
|
-
}),
|
439
|
-
this.fieldTreeData.push(u);
|
453
|
+
|
454
|
+
if (fieldNode.name !== this.optionModel.name) {
|
455
|
+
//排除当前设置公式字段
|
456
|
+
subFormNode.children.push(fieldNode);
|
457
|
+
}
|
440
458
|
});
|
459
|
+
|
460
|
+
this.fieldTreeData.push(subFormNode);
|
461
|
+
});
|
441
462
|
},
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
463
|
+
|
464
|
+
// 插入字段
|
465
|
+
insertField(obj, node, self) {
|
466
|
+
if (!!obj.formItemFlag) {
|
467
|
+
let fieldId = obj.id + "";
|
468
|
+
let fieldLabel = "[" + obj.label + "]";
|
469
|
+
this.updateCodeMirror(fieldId, fieldLabel, "field");
|
447
470
|
}
|
448
471
|
},
|
449
|
-
|
450
|
-
|
472
|
+
|
473
|
+
// 插入符号
|
474
|
+
insertSymbol(opt) {
|
475
|
+
this.updateCodeMirror(opt, opt, null);
|
451
476
|
},
|
452
|
-
|
453
|
-
|
454
|
-
|
477
|
+
|
478
|
+
// 插入函数
|
479
|
+
insertFunction(opt) {
|
480
|
+
const val = opt.substring(0, opt.length - 1);
|
481
|
+
this.updateCodeMirror(val, val, "func");
|
455
482
|
},
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
483
|
+
|
484
|
+
updateCodeMirror(field, text, type = null) {
|
485
|
+
if (type) {
|
486
|
+
let obj = {
|
487
|
+
field: field,
|
488
|
+
text: text,
|
489
|
+
type: type,
|
490
|
+
};
|
491
|
+
let selectionLet = obj.field.length + obj.text.length + obj.type.length; //光标位置;
|
492
|
+
let code = `{{${obj.field}.${obj.text}.${obj.type}}}`;
|
493
|
+
if (type === "func") {
|
494
|
+
code += "()";
|
495
|
+
selectionLet = selectionLet + 7;
|
496
|
+
} else {
|
497
|
+
selectionLet = selectionLet + 6;
|
498
|
+
}
|
499
|
+
|
500
|
+
if (code) {
|
501
|
+
this.codeMirror.dispatch({
|
502
|
+
changes: {
|
503
|
+
from: this.codeMirror.state.selection.main.head,
|
504
|
+
to: this.codeMirror.state.selection.main.head,
|
505
|
+
insert: code,
|
506
|
+
},
|
507
|
+
selection: {
|
508
|
+
anchor: this.codeMirror.state.selection.main.head + selectionLet,
|
509
|
+
},
|
510
|
+
});
|
511
|
+
}
|
512
|
+
} else {
|
513
|
+
this.codeMirror.dispatch({
|
478
514
|
changes: {
|
479
|
-
from: this.codeMirror.
|
480
|
-
to: this.codeMirror.
|
481
|
-
insert:
|
515
|
+
from: this.codeMirror.state.selection.main.head,
|
516
|
+
to: this.codeMirror.state.selection.main.head,
|
517
|
+
insert: text,
|
482
518
|
},
|
483
519
|
selection: {
|
484
|
-
anchor:
|
485
|
-
this.codeMirror.view.state.selection.head
|
486
|
-
+ e.length,
|
520
|
+
anchor: this.codeMirror.state.selection.main.head + text.length,
|
487
521
|
},
|
488
522
|
});
|
523
|
+
}
|
489
524
|
},
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
let
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
525
|
+
|
526
|
+
// 在字符串中查找[开始]结尾的字符串,并删除
|
527
|
+
removeStr(str) {
|
528
|
+
let a = str.indexOf("[");
|
529
|
+
if (a === -1) {
|
530
|
+
return str;
|
531
|
+
}
|
532
|
+
let b = str.indexOf("]", a) + 1;
|
533
|
+
let c = str.substring(a, b);
|
534
|
+
let strArr = str.split(c);
|
535
|
+
let newStr = "";
|
536
|
+
for (let i = 0; i < strArr.length; i++) {
|
537
|
+
newStr += strArr[i];
|
538
|
+
}
|
539
|
+
return this.removeStr(newStr);
|
499
540
|
},
|
541
|
+
|
542
|
+
/**
|
543
|
+
* 字段label可能在公式保存后再次被修改,当编辑公式时需要再次刷新公式中的字段label(不刷新也不会影响公式计算结果)
|
544
|
+
*/
|
500
545
|
refreshFormula() {
|
501
|
-
const
|
502
|
-
if (!
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
const
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
546
|
+
const matchResult = this.optionModel.formula.match(FORMULA_REG_EXP);
|
547
|
+
if (!matchResult) {
|
548
|
+
return this.optionModel.formula;
|
549
|
+
}
|
550
|
+
|
551
|
+
matchResult.forEach((mi) => {
|
552
|
+
const firstPart = mi.split(".")[0];
|
553
|
+
const secondPart = mi.split(".")[1];
|
554
|
+
const thirdPart = mi.split(".")[2];
|
555
|
+
const nodeType = thirdPart.substring(0, thirdPart.length - 2);
|
556
|
+
if (nodeType === "func") {
|
557
|
+
return;
|
558
|
+
}
|
559
|
+
|
560
|
+
const fieldId = firstPart.substring(2, firstPart.length);
|
561
|
+
const fieldSchema = getFieldWidgetById(
|
562
|
+
// this.designer.widgetList,
|
563
|
+
this.getTargetWidgetList(),
|
564
|
+
fieldId,
|
565
|
+
false
|
518
566
|
);
|
567
|
+
if (!!fieldSchema) {
|
568
|
+
const newLabel =
|
569
|
+
fieldSchema.options.label || fieldSchema.options.name;
|
570
|
+
this.optionModel.formula = this.optionModel.formula.replace(
|
571
|
+
mi,
|
572
|
+
firstPart + ".[" + newLabel + "]." + thirdPart
|
573
|
+
);
|
574
|
+
} else {
|
575
|
+
this.$message.error(
|
576
|
+
this.i18nt("designer.hint.deletedFieldInFormula") + secondPart
|
577
|
+
);
|
578
|
+
}
|
519
579
|
});
|
520
580
|
},
|
581
|
+
|
582
|
+
// 打开编辑公式弹窗
|
521
583
|
editFormula() {
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
584
|
+
this.fieldTreeData.length = 0;
|
585
|
+
// 初始化字段树
|
586
|
+
if(this.columnFlag){
|
587
|
+
this.loadFieldListToTree();
|
588
|
+
}else{
|
589
|
+
this.designer.widgetList.forEach((wItem) => {
|
590
|
+
if (this.optionModel.name !== wItem.id) {
|
591
|
+
//this.buildTreeNodeOfWidget(wItem, this.fieldTreeData);
|
592
|
+
this.loadFieldListToTree();
|
593
|
+
}
|
594
|
+
});
|
595
|
+
}
|
596
|
+
|
597
|
+
console.log("设计器字段===>", this.fieldTreeData);
|
598
|
+
|
599
|
+
// 加载当前字段计算公式tags
|
600
|
+
this.tags = deepClone(this.optionModel.formulaTags);
|
601
|
+
// this.formula = deepClone(this.optionModel.formula);
|
602
|
+
|
603
|
+
//const code = this.optionModel.formulaShow;
|
604
|
+
this.refreshFormula();
|
605
|
+
const code = this.optionModel.formula;
|
606
|
+
this.formulaDialogVisible = true;
|
607
|
+
|
608
|
+
//==== codeMirror 挂载视图 ====
|
609
|
+
this.$nextTick(() => {
|
610
|
+
this.codeMirror = new EditorView({
|
611
|
+
state: EditorState.create({
|
612
|
+
doc: code,
|
539
613
|
extensions: [
|
540
|
-
|
614
|
+
basicSetup,
|
615
|
+
javascript(),
|
616
|
+
[baseTheme, [], placeholders],
|
541
617
|
],
|
542
|
-
})
|
543
|
-
|
544
|
-
/*(this.codeMirror = new EditorView({
|
545
|
-
state: EditorState.create({
|
546
|
-
doc: o,
|
547
|
-
/!*extensions: [
|
548
|
-
basicSetup,
|
549
|
-
javascript(),
|
550
|
-
[baseTheme, [], placeholders],
|
551
|
-
],*!/
|
552
|
-
}),
|
553
|
-
parent: this.$refs.cmRef,
|
554
|
-
})),
|
555
|
-
console.log(
|
556
|
-
"编辑器实例==>",
|
557
|
-
this.codeMirror
|
558
|
-
);*/
|
618
|
+
}),
|
619
|
+
parent: this.$refs.cmRef,
|
559
620
|
});
|
621
|
+
console.log("编辑器实例==>", this.codeMirror);
|
622
|
+
});
|
560
623
|
},
|
624
|
+
|
625
|
+
// 保存计算公式
|
561
626
|
saveFormula() {
|
562
|
-
|
563
|
-
|
564
|
-
(this.formulaDialogVisible = !1);
|
627
|
+
this.optionModel.formula = this.codeMirror.state.doc.text.join("");
|
628
|
+
this.formulaDialogVisible = false;
|
565
629
|
},
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
let
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
)
|
578
|
-
|
630
|
+
|
631
|
+
// 解析计算公式 STEP1:将公式中的字段转换为【英文表名.英文字段名】
|
632
|
+
analysisFormula(formula) {
|
633
|
+
let a = formula.indexOf("[");
|
634
|
+
if (a === -1) {
|
635
|
+
return formula;
|
636
|
+
}
|
637
|
+
let b = formula.indexOf("]", a) + 1;
|
638
|
+
let cnField = formula.substring(a, b);
|
639
|
+
let enFieldName = this.findTreeNodeByCnName(cnField);
|
640
|
+
if (!!enFieldName) {
|
641
|
+
formula = formula.replace(cnField, "{" + enFieldName + "}");
|
642
|
+
return this.analysisFormula(formula);
|
643
|
+
} else {
|
644
|
+
this.$message.error(cnField + " 字段无法识别");
|
645
|
+
return false;
|
646
|
+
}
|
579
647
|
},
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
648
|
+
|
649
|
+
// 根据树节点中文名查找树节点
|
650
|
+
findTreeNodeByCnName(nodeCnName) {
|
651
|
+
let enTableName = "",
|
652
|
+
enFieldName = "";
|
653
|
+
let tableFieldName = nodeCnName.split("[")[1].split("]")[0];
|
654
|
+
let tableName = tableFieldName.split("-")[0];
|
655
|
+
let fieldName = tableFieldName.split("-")[1];
|
656
|
+
let moduleList = this.fieldTreeData;
|
657
|
+
for (let i = 0; i < moduleList.length; i++) {
|
658
|
+
let tableList = moduleList[i].children;
|
659
|
+
for (let j = 0; j < tableList.length; j++) {
|
660
|
+
if (tableList[j].cnTitle === tableName) {
|
661
|
+
enTableName = tableList[j].enTitle;
|
662
|
+
let fieldList = tableList[j].children;
|
663
|
+
for (let k = 0; k < fieldList.length; k++) {
|
664
|
+
if (fieldList[k].cnTitle === fieldName) {
|
665
|
+
enFieldName = fieldList[k].enTitle;
|
666
|
+
return enTableName + "-" + enFieldName;
|
667
|
+
}
|
668
|
+
}
|
596
669
|
}
|
670
|
+
}
|
597
671
|
}
|
672
|
+
// 没找到节点返回NULL
|
598
673
|
return null;
|
599
674
|
},
|
600
|
-
|
601
|
-
|
675
|
+
|
676
|
+
getClass(type) {
|
677
|
+
if (type === this.i18nt("designer.hint.formulaNumber")) {
|
602
678
|
return "warning";
|
603
|
-
|
679
|
+
}
|
680
|
+
if (type === this.i18nt("designer.hint.formulaChar")) {
|
604
681
|
return "";
|
605
|
-
|
682
|
+
}
|
683
|
+
if (type === this.i18nt("designer.hint.formulaObject")) {
|
606
684
|
return "danger";
|
685
|
+
}
|
607
686
|
},
|
687
|
+
|
608
688
|
resetIntro() {
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
),
|
616
|
-
|
617
|
-
'<span class="cg">'
|
618
|
-
+ this.i18nt("designer.hint.formulaSample")
|
619
|
-
+ ':</span><span class="fname">SUM</span><span class="cg">(</span><span class="cs">参数1</span><span class="cg">,</span><span class="cs">参数2</span><span class="cg">)</span>',
|
620
|
-
});
|
689
|
+
this.introTitle = this.i18nt("designer.hint.formulaFunctionExplain");
|
690
|
+
this.introduction = {
|
691
|
+
title: this.i18nt("designer.hint.formulaPleaseSelect"),
|
692
|
+
content:
|
693
|
+
'<span class="cg">' +
|
694
|
+
this.i18nt("designer.hint.formulaSample") +
|
695
|
+
':</span><span class="fname">SUM</span><span class="cg">(</span><span class="cs">参数1</span><span class="cg">,</span><span class="cs">参数2</span><span class="cg">)</span>',
|
696
|
+
};
|
621
697
|
},
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
698
|
+
|
699
|
+
showIntro(name, title, content) {
|
700
|
+
content = '<span class="cg">' + content + "</span>";
|
701
|
+
this.introduction = {
|
702
|
+
title: title,
|
703
|
+
content: content,
|
704
|
+
};
|
705
|
+
this.introTitle = name;
|
626
706
|
},
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
707
|
+
|
708
|
+
/**
|
709
|
+
* 校验计算公式是否正确
|
710
|
+
* @param s
|
711
|
+
* @returns {boolean}
|
712
|
+
*/
|
713
|
+
isValid(s) {
|
714
|
+
let a = []; //存储左括号出现的地方
|
715
|
+
let l = s.length;
|
716
|
+
let k = 0;
|
717
|
+
let flag = 1;
|
718
|
+
let j;
|
719
|
+
for (let i = 0; i < l && flag; i++) {
|
720
|
+
switch (s[i]) {
|
635
721
|
case "(":
|
636
|
-
|
722
|
+
a[k] = i;
|
723
|
+
k++;
|
637
724
|
break;
|
638
725
|
case ")":
|
639
|
-
|
640
|
-
|
726
|
+
j = a[k - 1];
|
727
|
+
if (s[j] === "(") {
|
728
|
+
a[k] = 0;
|
729
|
+
k--;
|
730
|
+
} else {
|
731
|
+
flag = 0;
|
732
|
+
}
|
641
733
|
break;
|
642
734
|
case "{":
|
643
|
-
|
735
|
+
a[k] = i;
|
736
|
+
k++;
|
644
737
|
break;
|
645
738
|
case "}":
|
646
|
-
|
647
|
-
|
739
|
+
j = a[k - 1];
|
740
|
+
if (s[j] === "{") {
|
741
|
+
a[k] = 0;
|
742
|
+
k--;
|
743
|
+
} else {
|
744
|
+
flag = 0;
|
745
|
+
}
|
648
746
|
break;
|
649
747
|
case "[":
|
650
|
-
|
748
|
+
a[k] = i;
|
749
|
+
k++;
|
651
750
|
break;
|
652
751
|
case "]":
|
653
|
-
|
654
|
-
|
752
|
+
j = a[k - 1];
|
753
|
+
if (s[j] === "[") {
|
754
|
+
a[k] = 0;
|
755
|
+
k--;
|
756
|
+
} else {
|
757
|
+
flag = 0;
|
758
|
+
}
|
655
759
|
break;
|
656
760
|
}
|
657
|
-
|
761
|
+
}
|
762
|
+
if (k !== 0) {
|
763
|
+
flag = 0;
|
764
|
+
}
|
765
|
+
return flag !== 0;
|
658
766
|
},
|
659
767
|
},
|
660
|
-
}
|
768
|
+
};
|
661
769
|
</script>
|
662
770
|
|
663
|
-
<style scoped>
|
771
|
+
<style lang="scss" scoped>
|
772
|
+
:deep(.cm-editor) {
|
773
|
+
height: 100%;
|
774
|
+
}
|
775
|
+
|
776
|
+
li {
|
777
|
+
list-style: none;
|
778
|
+
}
|
779
|
+
|
780
|
+
/*去掉li前面的点*/
|
781
|
+
.el-input-group {
|
782
|
+
cursor: pointer;
|
783
|
+
}
|
784
|
+
|
785
|
+
.header {
|
786
|
+
width: 97%;
|
787
|
+
border: 1px solid #ccc;
|
788
|
+
border-top-left-radius: 10px;
|
789
|
+
border-top-right-radius: 10px;
|
790
|
+
height: 31px;
|
791
|
+
line-height: 31px;
|
792
|
+
padding-left: 15px;
|
793
|
+
}
|
794
|
+
|
795
|
+
.editor {
|
796
|
+
margin-left: 10px;
|
797
|
+
margin-right: 10px;
|
798
|
+
height: 200px;
|
799
|
+
border: 1px solid #ccc;
|
800
|
+
border-radius: 6px;
|
801
|
+
}
|
802
|
+
|
803
|
+
.editor-top {
|
804
|
+
//margin-left: 10px;
|
805
|
+
height: 130px;
|
806
|
+
width: 100%;
|
807
|
+
padding: 8px;
|
808
|
+
position: relative;
|
809
|
+
overflow-x: hidden;
|
810
|
+
overflow-y: scroll;
|
811
|
+
}
|
812
|
+
|
813
|
+
.editor-bottom {
|
814
|
+
border-left: 1px solid #ccc;
|
815
|
+
display: flex;
|
816
|
+
flex-wrap: wrap;
|
817
|
+
padding: 5px;
|
818
|
+
align-content: flex-start;
|
819
|
+
}
|
820
|
+
|
821
|
+
.body-right-button {
|
822
|
+
width: 60px;
|
823
|
+
height: 40px;
|
824
|
+
}
|
825
|
+
|
826
|
+
.group-form {
|
827
|
+
margin-top: 15px;
|
828
|
+
display: flex;
|
829
|
+
justify-content: space-between;
|
830
|
+
height: 350px;
|
831
|
+
}
|
832
|
+
|
664
833
|
.group-item-left {
|
665
|
-
height:
|
834
|
+
height: 350px;
|
666
835
|
border: 1px solid #ccc;
|
667
836
|
border-top-left-radius: 6px;
|
668
837
|
border-bottom-left-radius: 6px;
|
669
838
|
margin-bottom: 5px;
|
670
839
|
padding: 0;
|
671
|
-
width: 100
|
840
|
+
width: 100%;
|
672
841
|
}
|
673
842
|
|
674
843
|
.group-item-right-top {
|
675
|
-
height:
|
844
|
+
height: 350px;
|
676
845
|
border: 1px solid #ccc;
|
677
846
|
border-radius: 0;
|
678
847
|
margin-bottom: 5px;
|
679
|
-
width: 100
|
848
|
+
width: 100%;
|
680
849
|
}
|
681
850
|
|
682
851
|
.group-item-right-bottom {
|
683
|
-
height:
|
852
|
+
height: 350px;
|
684
853
|
border: 1px solid #ccc;
|
685
854
|
border-top-right-radius: 6px;
|
686
855
|
border-bottom-right-radius: 6px;
|
687
856
|
margin-bottom: 5px;
|
688
|
-
width: 100
|
857
|
+
width: 100%;
|
689
858
|
}
|
690
859
|
|
691
860
|
.item-header {
|
@@ -693,25 +862,111 @@ export default {
|
|
693
862
|
height: 29px;
|
694
863
|
line-height: 29px;
|
695
864
|
padding-left: 15px;
|
696
|
-
font-weight:
|
865
|
+
font-weight: bold;
|
697
866
|
}
|
698
867
|
|
699
868
|
.item-body-left {
|
700
869
|
height: 320px;
|
701
|
-
overflow-y: auto
|
870
|
+
overflow-y: auto;
|
702
871
|
}
|
703
872
|
|
704
873
|
.function-list {
|
705
|
-
height:
|
706
|
-
overflow-y: auto
|
707
|
-
}
|
874
|
+
height: 320px;
|
875
|
+
overflow-y: auto;
|
708
876
|
|
709
|
-
.
|
710
|
-
|
877
|
+
:deep(.el-collapse-item__header) {
|
878
|
+
font-weight: normal !important;
|
879
|
+
}
|
711
880
|
}
|
712
881
|
|
713
882
|
.item-body-right-bottom {
|
714
883
|
height: 152px;
|
715
|
-
overflow-y: auto
|
884
|
+
overflow-y: auto;
|
885
|
+
}
|
886
|
+
|
887
|
+
.el-collapse {
|
888
|
+
border: none;
|
889
|
+
}
|
890
|
+
|
891
|
+
:deep(.el-dialog) {
|
892
|
+
margin-top: 10px !important;
|
893
|
+
}
|
894
|
+
|
895
|
+
:deep(.el-collapse-item__header) {
|
896
|
+
padding-left: 10px;
|
897
|
+
border: none;
|
898
|
+
}
|
899
|
+
|
900
|
+
:deep(.el-collapse-item__wrap) {
|
901
|
+
border: none;
|
902
|
+
}
|
903
|
+
|
904
|
+
:deep(.el-collapse-item__arrow) {
|
905
|
+
margin-left: 8px;
|
906
|
+
}
|
907
|
+
|
908
|
+
.field-item {
|
909
|
+
display: flex;
|
910
|
+
justify-content: space-between;
|
911
|
+
align-items: center;
|
912
|
+
height: 32px;
|
913
|
+
padding-left: 30px;
|
914
|
+
padding-right: 15px;
|
915
|
+
cursor: pointer;
|
916
|
+
}
|
917
|
+
|
918
|
+
.field-item:hover {
|
919
|
+
background-color: #f8f8f8;
|
920
|
+
}
|
921
|
+
|
922
|
+
p::before {
|
923
|
+
content: "● ";
|
924
|
+
color: #0a5d7c;
|
925
|
+
}
|
926
|
+
|
927
|
+
p {
|
928
|
+
height: 24px;
|
929
|
+
line-height: 24px;
|
930
|
+
padding: 0 15px;
|
931
|
+
font-size: 16px;
|
932
|
+
color: #0a5d7c;
|
933
|
+
}
|
934
|
+
|
935
|
+
.intro-content {
|
936
|
+
padding-left: 30px;
|
937
|
+
}
|
938
|
+
|
939
|
+
.cg {
|
940
|
+
color: #0a5d7c;
|
941
|
+
}
|
942
|
+
|
943
|
+
.fname {
|
944
|
+
display: inline-block;
|
945
|
+
border-radius: 2px;
|
946
|
+
padding: 0 5px;
|
947
|
+
margin: 1px;
|
948
|
+
font-size: 12px;
|
949
|
+
line-height: 20px;
|
950
|
+
color: #708;
|
951
|
+
background: #fff;
|
952
|
+
}
|
953
|
+
|
954
|
+
.cs {
|
955
|
+
display: inline-block;
|
956
|
+
border-radius: 2px;
|
957
|
+
padding: 0 5px;
|
958
|
+
margin: 1px;
|
959
|
+
color: #fff;
|
960
|
+
font-size: 12px;
|
961
|
+
line-height: 20px;
|
962
|
+
background: #178cdf;
|
963
|
+
}
|
964
|
+
|
965
|
+
:deep(.el-dialog__body) {
|
966
|
+
padding: 0;
|
967
|
+
}
|
968
|
+
|
969
|
+
.small-padding-dialog {
|
970
|
+
/* margin-top: 0px; */
|
716
971
|
}
|
717
972
|
</style>
|