cloud-web-corejs 1.0.94 → 1.0.96

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.
Files changed (64) hide show
  1. package/package.json +39 -30
  2. package/src/components/wf/content.vue +2 -0
  3. package/src/components/wf/setCandidateDialog.vue +1 -0
  4. package/src/components/xform/form-designer/designer.js +1 -1
  5. package/src/components/xform/form-designer/form-widget/container-widget/data-table-mixin.js +2 -1
  6. package/src/components/xform/form-designer/form-widget/dialog/searchFormDialog.vue +3 -0
  7. package/src/components/xform/form-designer/form-widget/field-widget/checkbox-widget.vue +1 -1
  8. package/src/components/xform/form-designer/form-widget/field-widget/dropdown-item-widget.vue +77 -0
  9. package/src/components/xform/form-designer/form-widget/field-widget/dropdown-menu-widget.vue +106 -0
  10. package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +7 -2
  11. package/src/components/xform/form-designer/form-widget/field-widget/mixins/vabsearch-mixin.js +176 -0
  12. package/src/components/xform/form-designer/form-widget/field-widget/multiSearch-widget.vue +53 -0
  13. package/src/components/xform/form-designer/form-widget/field-widget/number-widget.vue +1 -1
  14. package/src/components/xform/form-designer/form-widget/field-widget/project-tag-widget.vue +5 -2
  15. package/src/components/xform/form-designer/form-widget/field-widget/radio-widget.vue +1 -1
  16. package/src/components/xform/form-designer/form-widget/field-widget/search_button-widget.vue +1 -1
  17. package/src/components/xform/form-designer/form-widget/field-widget/select-widget.vue +2 -1
  18. package/src/components/xform/form-designer/form-widget/field-widget/singerSearch-widget.vue +53 -0
  19. package/src/components/xform/form-designer/form-widget/field-widget/status-widget.vue +3 -2
  20. package/src/components/xform/form-designer/form-widget/field-widget/vabSearch-widget.vue +2 -170
  21. package/src/components/xform/form-designer/indexMixin.js +1 -1
  22. package/src/components/xform/form-designer/setting-panel/form-setting.vue +260 -38
  23. package/src/components/xform/form-designer/setting-panel/index.vue +4 -0
  24. package/src/components/xform/form-designer/setting-panel/indexMixin.js +1 -1
  25. package/src/components/xform/form-designer/setting-panel/option-items-setting.vue +8 -3
  26. package/src/components/xform/form-designer/setting-panel/property-editor/a-link-editor.vue +1 -1
  27. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/columnRenderDialog.vue +3 -2
  28. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +0 -8
  29. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +183 -45
  30. package/src/components/xform/form-designer/setting-panel/property-editor/container-list-h5/list-h5-editor.vue +0 -8
  31. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/search-dialog-event-editor.vue +26 -8
  32. package/src/components/xform/form-designer/setting-panel/property-editor/field-dropdown-menu/dropdown-item-editor.vue +21 -0
  33. package/src/components/xform/form-designer/setting-panel/property-editor/field-dropdown-menu/dropdown-menu-editor.vue +59 -0
  34. package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import-button-editor.vue +7 -2
  35. package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import2-button-editor.vue +8 -2
  36. package/src/components/xform/form-designer/setting-panel/property-editor/field-status/field-status-editor.vue +47 -28
  37. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabSearch/vabSearchName-editor.vue +13 -1
  38. package/src/components/xform/form-designer/setting-panel/property-editor/formula-editor.vue +722 -467
  39. package/src/components/xform/form-designer/setting-panel/property-editor/formulaEnabled-editor.vue +1 -1
  40. package/src/components/xform/form-designer/setting-panel/property-editor/multiple-editor.vue +19 -14
  41. package/src/components/xform/form-designer/setting-panel/property-editor/project-tag-editor.vue +159 -18
  42. package/src/components/xform/form-designer/setting-panel/property-editor/textFlag-editor.vue +51 -2
  43. package/src/components/xform/form-designer/setting-panel/property-editor/wfFlag-editor.vue +2 -30
  44. package/src/components/xform/form-designer/setting-panel/property-editor/widgetShowRuleFlag-editor.vue +220 -0
  45. package/src/components/xform/form-designer/setting-panel/propertyRegister.js +5 -0
  46. package/src/components/xform/form-designer/toolbar-panel/index.vue +8 -4
  47. package/src/components/xform/form-designer/widget-panel/index.vue +21 -1
  48. package/src/components/xform/form-designer/widget-panel/indexMixin.js +3 -2
  49. package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +489 -132
  50. package/src/components/xform/form-render/container-item/data-table-item.vue +7 -4
  51. package/src/components/xform/form-render/container-item/data-table-mixin.js +4 -1
  52. package/src/components/xform/form-render/container-item/data-table-mixin2.js +2169 -0
  53. package/src/components/xform/form-render/container-item/list-h5-item.vue +1 -9
  54. package/src/components/xform/form-render/container-item/list-h5-item2.vue +1 -8
  55. package/src/components/xform/form-render/indexMixin.js +7 -3
  56. package/src/components/xform/lang/zh-CN.js +13 -3
  57. package/src/components/xform/mixins/defaultHandle.js +1 -1
  58. package/src/components/xform/mixins/scriptHttp.js +1 -1
  59. package/src/components/xform/utils/format.js +21 -30
  60. package/src/components/xform/utils/formula-util.js +669 -0
  61. package/src/components/xform/utils/util.js +1 -1
  62. package/src/mixins/selectDialog/index.js +1 -1
  63. package/src/store/modules/permission.js +1 -1
  64. package/src/store/modules/settings.js +1 -1
@@ -1,27 +1,31 @@
1
1
  <template>
2
- <div>
3
- <el-form-item v-if="optionModel.formulaEnabled" :label="i18nt('designer.setting.formula')">
4
- <el-tooltip effect="light" :content="formulaForView" placement="top">
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 slot="append">
7
- <el-button icon="el-icon-edit" @click="editFormula"></el-button>
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;"> {{ optionModel.label }} =</div>
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 size="small" @click="clearFormula" type="danger"
37
- plain=""> 清除
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
- <!-- <div class="el-row">
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&#45;&#45;danger el-button&#45;&#45;small is-plain">&lt;!&ndash;&ndash;&gt;&lt;!&ndash;&ndash;&gt;<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
- <template v-for="(item,index) in operate">
65
- <el-button :key="index" size="default" @click="insertSymbol(item)">{{ item }}</el-button>
66
- </template>
67
- <!-- <button type="button" class="el-button el-button&#45;&#45;default el-button&#45;&#45;default">&lt;!&ndash;&ndash;&gt;
68
- &lt;!&ndash;&ndash;&gt;<span> + </span></button>
69
- <button type="button" class="el-button el-button&#45;&#45;default el-button&#45;&#45;default">&lt;!&ndash;&ndash;&gt;
70
- &lt;!&ndash;&ndash;&gt;<span> - </span></button>
71
- <button type="button" class="el-button el-button&#45;&#45;default el-button&#45;&#45;default">&lt;!&ndash;&ndash;&gt;
72
- &lt;!&ndash;&ndash;&gt;<span> * </span></button>
73
- <button type="button" class="el-button el-button&#45;&#45;default el-button&#45;&#45;default">&lt;!&ndash;&ndash;&gt;
74
- &lt;!&ndash;&ndash;&gt;<span> / </span></button>
75
- <button type="button" class="el-button el-button&#45;&#45;default el-button&#45;&#45;default">&lt;!&ndash;&ndash;&gt;
76
- &lt;!&ndash;&ndash;&gt;<span> != </span></button>
77
- <button type="button" class="el-button el-button&#45;&#45;default el-button&#45;&#45;default">&lt;!&ndash;&ndash;&gt;
78
- &lt;!&ndash;&ndash;&gt;<span> == </span></button>
79
- <button type="button" class="el-button el-button&#45;&#45;default el-button&#45;&#45;default">&lt;!&ndash;&ndash;&gt;
80
- &lt;!&ndash;&ndash;&gt;<span> &lt; </span></button>
81
- <button type="button" class="el-button el-button&#45;&#45;default el-button&#45;&#45;default">&lt;!&ndash;&ndash;&gt;
82
- &lt;!&ndash;&ndash;&gt;<span> &gt; </span></button>
83
- <button type="button" class="el-button el-button&#45;&#45;default el-button&#45;&#45;default">&lt;!&ndash;&ndash;&gt;
84
- &lt;!&ndash;&ndash;&gt;<span> &lt;= </span></button>
85
- <button type="button" class="el-button el-button&#45;&#45;default el-button&#45;&#45;default">&lt;!&ndash;&ndash;&gt;
86
- &lt;!&ndash;&ndash;&gt;<span> &gt;= </span></button>
87
- <button type="button" class="el-button el-button&#45;&#45;default el-button&#45;&#45;default">&lt;!&ndash;&ndash;&gt;
88
- &lt;!&ndash;&ndash;&gt;<span> ( </span></button>
89
- <button type="button" class="el-button el-button&#45;&#45;default el-button&#45;&#45;default">&lt;!&ndash;&ndash;&gt;
90
- &lt;!&ndash;&ndash;&gt;<span> ) </span></button>
91
- <button type="button" class="el-button el-button&#45;&#45;default el-button&#45;&#45;default">&lt;!&ndash;&ndash;&gt;
92
- &lt;!&ndash;&ndash;&gt;<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"> 组件列表</div>
101
- <el-input v-model="filterText" :placeholder="i18nt('designer.hint.formulaSearch')" clearable></el-input>
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
- <span class="custom-tree-node" slot-scope="{ node }">
110
- <el-tooltip effect="dark" :content="node.label" placement="right">
111
- <span>{{ node.label }}</span>
112
- </el-tooltip>
113
- </span>
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>&lt;!&ndash;&ndash;&gt;&lt;!&ndash;&ndash;&gt;
119
- <span
120
- class="custom-tree-node"><span class="el-tooltip"
121
- aria-describedby="el-tooltip-4169" tabindex="0">number</span></span>
122
- </div>&lt;!&ndash;&ndash;&gt;</div>&lt;!&ndash;&ndash;&gt;
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"> 函数列表</div>
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 v-for="(item,index) in funcList" :key="index" :name="index"
136
- :title="i18nt(item.fClass)">
137
- <div v-for="(item2,index2) in item.flist" :key="index2" class="field-item"
138
- @click="insertFunction(item2.fName +'(')"
139
- @mouseenter="showIntro(i18nt(item2.fName),i18nt(item.fClass),i18nt(item2.fIntro))"
140
- @mouseleave="resetIntro">
141
- <span>{{ item2.fName }}</span><span
142
- class="el-tag el-tag--light">{{ i18nt(item2.fType) }} </span></div>
143
- <!-- <div class="field-item"><span>SUM</span><span
144
- class="el-tag el-tag&#45;&#45;light">数字 </span></div>
145
- <div class="field-item"><span>AVERAGE</span><span
146
- class="el-tag el-tag&#45;&#45;light">数字 </span></div>
147
- <div class="field-item"><span>MAX</span><span
148
- class="el-tag el-tag&#45;&#45;light">数字 </span></div>
149
- <div class="field-item"><span>MIN</span><span
150
- class="el-tag el-tag&#45;&#45;light">数字 </span></div>
151
- <div class="field-item"><span>ABS</span><span
152
- class="el-tag el-tag&#45;&#45;light">数字 </span></div>
153
- <div class="field-item"><span>ROUND</span><span
154
- class="el-tag el-tag&#45;&#45;light">数字 </span></div>
155
- <div class="field-item"><span>CEILING</span><span
156
- class="el-tag el-tag&#45;&#45;light">数字 </span></div>
157
- <div class="field-item"><span>LOG</span><span
158
- class="el-tag el-tag&#45;&#45;light">数字 </span></div>
159
- <div class="field-item"><span>MOD</span><span
160
- class="el-tag el-tag&#45;&#45;light">数字 </span></div>
161
- <div class="field-item"><span>POWER</span><span
162
- class="el-tag el-tag&#45;&#45;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&#45;&#45;light">数字 </span></div>
178
- <div class="field-item"><span>SUM</span><span
179
- class="el-tag el-tag&#45;&#45;light">数字 </span></div>
180
- <div class="field-item"><span>AVERAGE</span><span
181
- class="el-tag el-tag&#45;&#45;light">数字 </span></div>
182
- <div class="field-item"><span>MAX</span><span
183
- class="el-tag el-tag&#45;&#45;light">数字 </span></div>
184
- <div class="field-item"><span>MIN</span><span
185
- class="el-tag el-tag&#45;&#45;light">数字 </span></div>
186
- <div class="field-item"><span>ABS</span><span
187
- class="el-tag el-tag&#45;&#45;light">数字 </span></div>
188
- <div class="field-item"><span>ROUND</span><span
189
- class="el-tag el-tag&#45;&#45;light">数字 </span></div>
190
- <div class="field-item"><span>CEILING</span><span
191
- class="el-tag el-tag&#45;&#45;light">数字 </span></div>
192
- <div class="field-item"><span>LOG</span><span
193
- class="el-tag el-tag&#45;&#45;light">数字 </span></div>
194
- <div class="field-item"><span>MOD</span><span
195
- class="el-tag el-tag&#45;&#45;light">数字 </span></div>
196
- <div class="field-item"><span>POWER</span><span
197
- class="el-tag el-tag&#45;&#45;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 v-if="!!introduction.title" style="font-size: 16px; color: rgb(10, 93, 124);"> {{
214
- introduction.title
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 class="intro-content" v-html="introduction.content"></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
- <span slot="footer" class="dialog-footer">
227
- <el-button @click="formulaDialogVisible = false">{{ $t2('取 消', 'system.button.cancel2') }}</el-button>
228
- <el-button type="primary" @click="saveFormula">{{ $t2('确 定', 'system.button.confirm2') }}</el-button>
229
- </span>
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 i18n from "../../../../../components/xform/utils/i18n"
236
-
237
- /*import { Editor, EditorContent } from '@tiptap/vue-2'
238
- import StarterKit from '@tiptap/starter-kit'
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
- traverseFieldWidgetsOfContainer, getFieldWidgetById
250
- } from "../../../../../components/xform/utils/util";
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: {/*EditorContent*/},
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 o = this.optionModel.formula.match(FORMULA_REG_EXP);
265
- if (!o) return this.optionModel.formula;
266
- let e = this.optionModel.formula;
267
- return (
268
- o.forEach((n) => {
269
- const l = n.split(".")[1];
270
- e = e.replaceAll(n, l);
271
- }),
272
- e
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(o) {
278
- this.$refs.fieldTree.filter(o);
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: !1,
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
- + this.i18nt("designer.hint.formulaSample")
350
- + ':</span><span class="fname">SUM</span><span class="cg">(</span><span class="cs">'
351
- + this.i18nt("designer.hint.formulaPara")
352
- + '1</span><span class="cg">,</span><span class="cs">'
353
- + this.i18nt("designer.hint.formulaPara")
354
- + '2</span><span class="cg">)</span>',
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(o) {
364
- (this.formula = ""),
365
- (this.tags = []),
366
- this.codeMirror.view.dispatch({
367
- changes: {
368
- from: 0,
369
- to: this.codeMirror.view.state.doc.length,
370
- insert: "",
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
- deleteChar(o, e, n) {
375
- let l = -1;
376
- return o.replace(/a/g, (s) => (l++, l === n ? "" : s));
358
+ handleTableConfigData(widget, callback) {
359
+ callback(widget);
377
360
  },
378
- filterNode(o, e) {
379
- return o ? e.label.indexOf(o) !== -1 : !0;
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
- const o = getAllFieldWidgets(this.designer.widgetList),
384
- e = getAllContainerWidgets(this.designer.widgetList),
385
- n = [];
386
- let l = [];
387
- const s = {};
388
- e.forEach((c) => {
389
- if (
390
- c.type === "sub-form"
391
- || c.type === "grid-sub-form"
392
- ) {
393
- n.push(c.container);
394
- const u = [],
395
- $ = (g) => {
396
- !!g.formItemFlag
397
- && g.type === "number"
398
- && u.push(g);
399
- };
400
- traverseFieldWidgetsOfContainer(c.container, $),
401
- (s[c.container.options.name] = u),
402
- (l = l.concat(u));
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
- o.forEach((c) => {
406
- if (!l.find((u) => u.id === c.field.id)) {
407
- const u = {
408
- id: c.field.id,
409
- name: c.field.options.name,
410
- label: c.field.options.label,
411
- type: c.field.type,
412
- formItemFlag: !0,
413
- };
414
- u.name !== this.optionModel.name
415
- && u.type === "number"
416
- && this.fieldTreeData.push(u);
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
- n.forEach((c) => {
420
- const u = {
421
- id: c.id,
422
- name: c.options.name,
423
- label: c.options.label || c.options.name,
424
- type: c.type,
425
- formItemFlag: !1,
426
- children: [],
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
- s[c.options.name].forEach(($) => {
429
- const g = {
430
- id: $.id,
431
- name: $.options.name,
432
- label: $.options.label,
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
- insertField(o, e, n) {
443
- if (o.formItemFlag) {
444
- let l = o.id,
445
- s = "[" + o.label + "]";
446
- this.updateCodeMirror(l, s, "field");
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
- insertSymbol(o) {
450
- this.updateCodeMirror(o, o, null);
472
+
473
+ // 插入符号
474
+ insertSymbol(opt) {
475
+ this.updateCodeMirror(opt, opt, null);
451
476
  },
452
- insertFunction(o) {
453
- const e = o.substring(0, o.length - 1);
454
- this.updateCodeMirror(e, e, "func");
477
+
478
+ // 插入函数
479
+ insertFunction(opt) {
480
+ const val = opt.substring(0, opt.length - 1);
481
+ this.updateCodeMirror(val, val, "func");
455
482
  },
456
- updateCodeMirror(o, e, n = null) {
457
- if (n) {
458
- let l = {field: o, text: e, type: n},
459
- s = l.field.length + l.text.length + l.type.length,
460
- c = `{{${l.field}.${l.text}.${l.type}}}`;
461
- n === "func" ? ((c += "()"), (s = s + 7)) : (s = s + 6),
462
- c
463
- && this.codeMirror.view.dispatch({
464
- changes: {
465
- from: this.codeMirror.view.state.selection.head,
466
- to: this.codeMirror.view.state.selection
467
- .head,
468
- insert: c,
469
- },
470
- selection: {
471
- anchor:
472
- this.codeMirror.view.state.selection
473
- .head + s,
474
- },
475
- });
476
- } else
477
- this.codeMirror.view.dispatch({
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.view.state.selection.head,
480
- to: this.codeMirror.view.state.selection.head,
481
- insert: e,
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
- removeStr(o) {
491
- let e = o.indexOf("[");
492
- if (e === -1) return o;
493
- let n = o.indexOf("]", e) + 1,
494
- l = o.substring(e, n),
495
- s = o.split(l),
496
- c = "";
497
- for (let u = 0; u < s.length; u++) c += s[u];
498
- return this.removeStr(c);
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 o = this.optionModel.formula.match(FORMULA_REG_EXP);
502
- if (!o) return this.optionModel.formula;
503
- o.forEach((e) => {
504
- const n = e.split(".")[0],
505
- l = e.split(".")[2];
506
- if (l.substring(0, l.length - 2) === "func") return;
507
- const c = n.substring(2, n.length),
508
- u = getFieldWidgetById(
509
- this.designer.widgetList,
510
- c,
511
- !1
512
- ),
513
- $ = u.options.label || u.options.name;
514
- this.optionModel.formula
515
- = this.optionModel.formula.replace(
516
- e,
517
- n + ".[" + $ + "]." + l
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
- (this.fieldTreeData.length = 0),
523
- this.designer.widgetList.forEach((e) => {
524
- this.optionModel.name !== e.id
525
- && this.loadFieldListToTree();
526
- }),
527
- console.log(
528
- "设计器字段===>",
529
- this.fieldTreeData
530
- ),
531
- (this.tags = deepClone(this.optionModel.formulaTags)),
532
- this.refreshFormula();
533
- const o = this.optionModel.formula || "";
534
- (this.formulaDialogVisible = !0),
535
- this.$nextTick(() => {
536
-
537
- this.codeMirror = new Editor({
538
- content: o,
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
- StarterKit,
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
- (this.optionModel.formula
563
- = this.codeMirror.view.state.doc.text.join("")),
564
- (this.formulaDialogVisible = !1);
627
+ this.optionModel.formula = this.codeMirror.state.doc.text.join("");
628
+ this.formulaDialogVisible = false;
565
629
  },
566
- analysisFormula(o) {
567
- let e = o.indexOf("[");
568
- if (e === -1) return o;
569
- let n = o.indexOf("]", e) + 1,
570
- l = o.substring(e, n),
571
- s = this.findTreeNodeByCnName(l);
572
- return s
573
- ? ((o = o.replace(l, "{" + s + "}")),
574
- this.analysisFormula(o))
575
- : (this.$message.error(
576
- l + " 字段无法识别"
577
- ),
578
- !1);
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
- findTreeNodeByCnName(o) {
581
- let e = "",
582
- n = "",
583
- l = o.split("[")[1].split("]")[0],
584
- s = l.split("-")[0],
585
- c = l.split("-")[1],
586
- u = this.fieldTreeData;
587
- for (let $ = 0; $ < u.length; $++) {
588
- let g = u[$].children;
589
- for (let y = 0; y < g.length; y++)
590
- if (g[y].cnTitle === s) {
591
- e = g[y].enTitle;
592
- let f = g[y].children;
593
- for (let v = 0; v < f.length; v++)
594
- if (f[v].cnTitle === c)
595
- return (n = f[v].enTitle), e + "-" + n;
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
- getClass(o) {
601
- if (o === this.i18nt("designer.hint.formulaNumber"))
675
+
676
+ getClass(type) {
677
+ if (type === this.i18nt("designer.hint.formulaNumber")) {
602
678
  return "warning";
603
- if (o === this.i18nt("designer.hint.formulaChar"))
679
+ }
680
+ if (type === this.i18nt("designer.hint.formulaChar")) {
604
681
  return "";
605
- if (o === this.i18nt("designer.hint.formulaObject"))
682
+ }
683
+ if (type === this.i18nt("designer.hint.formulaObject")) {
606
684
  return "danger";
685
+ }
607
686
  },
687
+
608
688
  resetIntro() {
609
- (this.introTitle = this.i18nt(
610
- "designer.hint.formulaFunctionExplain"
611
- )),
612
- (this.introduction = {
613
- title: this.i18nt(
614
- "designer.hint.formulaPleaseSelect"
615
- ),
616
- content:
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
- showIntro(o, e, n) {
623
- (n = '<span class="cg">' + n + "</span>"),
624
- (this.introduction = {title: e, content: n}),
625
- (this.introTitle = o);
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
- isValid(o) {
628
- let e = [],
629
- n = o.length,
630
- l = 0,
631
- s = 1,
632
- c;
633
- for (let u = 0; u < n && s; u++)
634
- switch (o[u]) {
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
- (e[l] = u), l++;
722
+ a[k] = i;
723
+ k++;
637
724
  break;
638
725
  case ")":
639
- (c = e[l - 1]),
640
- o[c] === "(" ? ((e[l] = 0), l--) : (s = 0);
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
- (e[l] = u), l++;
735
+ a[k] = i;
736
+ k++;
644
737
  break;
645
738
  case "}":
646
- (c = e[l - 1]),
647
- o[c] === "{" ? ((e[l] = 0), l--) : (s = 0);
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
- (e[l] = u), l++;
748
+ a[k] = i;
749
+ k++;
651
750
  break;
652
751
  case "]":
653
- (c = e[l - 1]),
654
- o[c] === "[" ? ((e[l] = 0), l--) : (s = 0);
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
- return l !== 0 && (s = 0), s !== 0;
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: 400px;
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: 400px;
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: 400px;
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: 700
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: 360px;
706
- overflow-y: auto
707
- }
874
+ height: 320px;
875
+ overflow-y: auto;
708
876
 
709
- .function-list .el-collapse-item__header {
710
- font-weight: 400 !important
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>