@bytenew/bn-bus-ui 1.1.463 → 1.1.464

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 (167) hide show
  1. package/dist/assocTableSearch-Bfe96864.js +349 -0
  2. package/dist/assocTableSearch.css +1 -0
  3. package/dist/bn-bus-ui.es.js +65 -0
  4. package/dist/bn-bus-ui.umd.js +49 -0
  5. package/dist/chooseIPaasData-COrrvQKZ.js +391 -0
  6. package/dist/chooseIPaasData.css +1 -0
  7. package/dist/defaultSet-CzN1ec_d.js +297 -0
  8. package/dist/defaultSet.css +1 -0
  9. package/dist/fileFormData-D_Q1vylE.js +53 -0
  10. package/dist/formItemFooter-BvptZj_u.js +108 -0
  11. package/dist/formItemFooter.css +1 -0
  12. package/dist/funcExprDialog-BguNs9fl.js +139 -0
  13. package/dist/funcExprDialog.css +1 -0
  14. package/dist/index-0oB7QocU.js +44 -0
  15. package/dist/index-69fRP0M8.js +89 -0
  16. package/dist/index-BdklTJtF.js +66 -0
  17. package/dist/index-Bu3jHlby.js +45 -0
  18. package/dist/index-BxWx5kpG.js +89 -0
  19. package/dist/index-C5LQ0OSs.js +183 -0
  20. package/dist/index-C8YhrrUN.js +51 -0
  21. package/dist/index-COuPCIzB.js +45 -0
  22. package/dist/index-CSvVyjxx.js +178 -0
  23. package/dist/index-DCv51EXX.js +109 -0
  24. package/dist/index-DUSI6MuC.js +135 -0
  25. package/dist/index-DVzxs2vR.js +58 -0
  26. package/dist/index-Dd4b8zNb.js +746 -0
  27. package/dist/index-Md-ZlkCW.js +66 -0
  28. package/dist/index-hsSIY2FP.js +221 -0
  29. package/dist/index-n13-H3_Y.js +118 -0
  30. package/dist/index-wUl5aPUD.js +64 -0
  31. package/dist/index.css +1 -0
  32. package/dist/index2.css +1 -0
  33. package/dist/index3.css +1 -0
  34. package/dist/index4.css +1 -0
  35. package/dist/index5.css +1 -0
  36. package/dist/index6.css +1 -0
  37. package/dist/index7.css +1 -0
  38. package/dist/install-CNjs0u5x.js +23299 -0
  39. package/dist/install.css +1 -0
  40. package/dist/setOption-CXOifQcx.js +329 -0
  41. package/dist/setOption.css +1 -0
  42. package/dist/setRelationOption-C7VDhej7.js +5217 -0
  43. package/dist/setRelationOption.css +1 -0
  44. package/package.json +4 -20
  45. package/install.js +0 -134
  46. package/packages/BnAddress/index.vue +0 -141
  47. package/packages/BnAddressParse/index.vue +0 -75
  48. package/packages/BnAdvancedFilter/BnFilterView.vue +0 -145
  49. package/packages/BnAdvancedFilter/index.vue +0 -345
  50. package/packages/BnAdvancedFilter/util.js +0 -171
  51. package/packages/BnCascader/BnCascader.vue +0 -543
  52. package/packages/BnCascader/BnCascaderPanel.vue +0 -1331
  53. package/packages/BnCascader/cascaderDisplay.js +0 -102
  54. package/packages/BnCheck/BnCheck.vue +0 -253
  55. package/packages/BnColumnConfig/columnConfigDialog.vue +0 -134
  56. package/packages/BnColumnConfig/component/childrenFormSetting/assocTable.vue +0 -143
  57. package/packages/BnColumnConfig/component/childrenFormSetting/assocTableSearch.vue +0 -314
  58. package/packages/BnColumnConfig/component/childrenFormSetting/index.vue +0 -243
  59. package/packages/BnColumnConfig/component/defaultSet/defaultSet.vue +0 -114
  60. package/packages/BnColumnConfig/component/defaultSet/stringDefault.vue +0 -210
  61. package/packages/BnColumnConfig/component/funcExprDialog/funcExprDialog.vue +0 -126
  62. package/packages/BnColumnConfig/component/packageFilter/index.vue +0 -141
  63. package/packages/BnColumnConfig/component/paraExplainSet/index.vue +0 -156
  64. package/packages/BnColumnConfig/component/setOption/setOption.vue +0 -321
  65. package/packages/BnColumnConfig/component/setRelationOption/ConditionList.vue +0 -277
  66. package/packages/BnColumnConfig/component/setRelationOption/LevelHeader.vue +0 -144
  67. package/packages/BnColumnConfig/component/setRelationOption/setRelationOption.vue +0 -642
  68. package/packages/BnColumnConfig/data.js +0 -129
  69. package/packages/BnColumnConfig/index.scss +0 -23
  70. package/packages/BnColumnConfig/index.vue +0 -309
  71. package/packages/BnCondVal/BnCondVal.vue +0 -112
  72. package/packages/BnCondVal/itemVal/dateRegVal.vue +0 -39
  73. package/packages/BnCondVal/itemVal/dateVal.vue +0 -39
  74. package/packages/BnCondVal/itemVal/numRegVal.vue +0 -67
  75. package/packages/BnCondVal/itemVal/numVal.vue +0 -44
  76. package/packages/BnCondVal/itemVal/relationVal.vue +0 -73
  77. package/packages/BnCondVal/itemVal/selectColumnVal.vue +0 -58
  78. package/packages/BnCondVal/itemVal/selectVal.vue +0 -59
  79. package/packages/BnCondVal/itemVal/stringVal.vue +0 -156
  80. package/packages/BnCondition/index.vue +0 -551
  81. package/packages/BnCondition/util.js +0 -232
  82. package/packages/BnDatePicker/BnDatePicker.vue +0 -194
  83. package/packages/BnDrop/BnDrop.vue +0 -917
  84. package/packages/BnEmptyTip/BnEmptyTip.vue +0 -107
  85. package/packages/BnExportOrder/BnExportOrder.vue +0 -241
  86. package/packages/BnExportOrder/validatorCode.vue +0 -94
  87. package/packages/BnFileView/BnFileView.vue +0 -271
  88. package/packages/BnFileView/FileDetail.vue +0 -125
  89. package/packages/BnFileView/videoPreview.vue +0 -70
  90. package/packages/BnFilterOption/BnFilterOption.vue +0 -160
  91. package/packages/BnFunExpr/BnFunExpr.vue +0 -608
  92. package/packages/BnImportOrder/BnImportOrder.vue +0 -323
  93. package/packages/BnImportTemplate/BnImportTemplate.vue +0 -866
  94. package/packages/BnImportTemplate/assets/merge_tip_img.png +0 -0
  95. package/packages/BnImportTemplate/assets/sheet_tip.png +0 -0
  96. package/packages/BnImportTemplate/assets/xls.png +0 -0
  97. package/packages/BnImportTemplate/components/ImportTemplateTrigger.vue +0 -198
  98. package/packages/BnImportTemplate/components/TemplateEditDialog.vue +0 -340
  99. package/packages/BnImportTemplate/components/TemplateFieldsConfig.vue +0 -401
  100. package/packages/BnImportTemplate/components/TemplateListDialog.vue +0 -297
  101. package/packages/BnInpNum/BnInpNum.vue +0 -165
  102. package/packages/BnMenus/BnMenus.vue +0 -502
  103. package/packages/BnMenus/MenuItem.vue +0 -321
  104. package/packages/BnOrderCard/BnOrderCard.vue +0 -389
  105. package/packages/BnOrderCard/orderRemark.vue +0 -178
  106. package/packages/BnOrderCard/util.js +0 -94
  107. package/packages/BnOrderDetail/BnOrderDetail.vue +0 -338
  108. package/packages/BnOrderDetail/filterLogByUser.vue +0 -108
  109. package/packages/BnOrderDetail/orderLogs.vue +0 -53
  110. package/packages/BnOrderDetail/showSubForm/index.vue +0 -41
  111. package/packages/BnOrderDetail/showSubForm/showChildTable.vue +0 -61
  112. package/packages/BnOrderDetail/showSubForm/showTimeLine.vue +0 -131
  113. package/packages/BnOrderDetail/showSubForm/tableCellCopy.vue +0 -84
  114. package/packages/BnOrderShare/index.vue +0 -378
  115. package/packages/BnOrderShare/shareUrlInp.vue +0 -54
  116. package/packages/BnRadio/BnRadio.vue +0 -181
  117. package/packages/BnRelation/BnRelation.vue +0 -120
  118. package/packages/BnSelect/BnSelect.vue +0 -485
  119. package/packages/BnSmartForm/BnBatchForm.vue +0 -334
  120. package/packages/BnSmartForm/BnBatchFormDialog.vue +0 -423
  121. package/packages/BnSmartForm/BnSmartElf/elfLog/index.vue +0 -57
  122. package/packages/BnSmartForm/BnSmartElf/index.vue +0 -95
  123. package/packages/BnSmartForm/BnSmartFormPsychic.js +0 -629
  124. package/packages/BnSmartForm/BnSmartFormUtil.js +0 -524
  125. package/packages/BnSmartForm/addressForm/index.vue +0 -73
  126. package/packages/BnSmartForm/checkboxForm/index.vue +0 -99
  127. package/packages/BnSmartForm/childrenForm/childFormFile.vue +0 -237
  128. package/packages/BnSmartForm/childrenForm/childrenFormBody.vue +0 -260
  129. package/packages/BnSmartForm/childrenForm/index.vue +0 -110
  130. package/packages/BnSmartForm/childrenForm/searchInventory.vue +0 -115
  131. package/packages/BnSmartForm/chooseAssocTable/chooseAssocTable.vue +0 -451
  132. package/packages/BnSmartForm/chooseAssocTable/chooseChildGood.vue +0 -229
  133. package/packages/BnSmartForm/chooseAssocTable/tableCellCopy.vue +0 -84
  134. package/packages/BnSmartForm/chooseChildOrder/chooseChildOrder.vue +0 -158
  135. package/packages/BnSmartForm/chooseIPaasData/chooseIPaasData.vue +0 -307
  136. package/packages/BnSmartForm/chooseIPaasData/tableCellCopy.vue +0 -84
  137. package/packages/BnSmartForm/choosePackage/choosePackage.vue +0 -361
  138. package/packages/BnSmartForm/dateDualForm/index.vue +0 -37
  139. package/packages/BnSmartForm/dateForm/index.vue +0 -38
  140. package/packages/BnSmartForm/fileForm/fileFormData.js +0 -50
  141. package/packages/BnSmartForm/fileForm/index.vue +0 -240
  142. package/packages/BnSmartForm/formItemFooter/formItemFooter.vue +0 -38
  143. package/packages/BnSmartForm/formItemTop/formItemTop.vue +0 -42
  144. package/packages/BnSmartForm/index.vue +0 -1201
  145. package/packages/BnSmartForm/numberForm/index.vue +0 -63
  146. package/packages/BnSmartForm/radioForm/index.vue +0 -72
  147. package/packages/BnSmartForm/receiveForm/index.vue +0 -112
  148. package/packages/BnSmartForm/relationForm/index.vue +0 -82
  149. package/packages/BnSmartForm/scoreForm/index.vue +0 -39
  150. package/packages/BnSmartForm/selectForm/index.vue +0 -55
  151. package/packages/BnSmartForm/showValForm/index.vue +0 -42
  152. package/packages/BnSmartForm/showValForm/showValFormTable.vue +0 -104
  153. package/packages/BnSmartForm/smartFormsCommon.scss +0 -43
  154. package/packages/BnSmartForm/stringForm/index.vue +0 -170
  155. package/packages/BnVirtPopover/index.vue +0 -319
  156. package/packages/BnWebLog/BnWebLog.vue +0 -140
  157. package/packages/BnWorkSettingDrop/advancedOptions.js +0 -112
  158. package/packages/BnWorkSettingDrop/benBenAIUtil.js +0 -89
  159. package/packages/BnWorkSettingDrop/index.vue +0 -292
  160. package/packages/font/iconfont.css +0 -243
  161. package/packages/font/iconfont.ttf +0 -0
  162. package/packages/font/iconfont.woff +0 -0
  163. package/packages/font/iconfont.woff2 +0 -0
  164. package/utils/addressParse-old.js +0 -645
  165. package/utils/addressParse.js +0 -735
  166. package/utils/config.js +0 -68
  167. package/utils/index.js +0 -1171
@@ -1,608 +0,0 @@
1
- <!--
2
- @Auther:辛巴
3
- @Date:2024/7/22
4
- @Description:小程序高级功能,函数组件
5
- @VERSION:1.0-->
6
- <template>
7
- <div class="BnFunExpr" v-loading="loading">
8
- <div class="BnFunExpr-left">
9
- <div class="BnFunExpr-left-top">
10
- <div class="BnFunExpr-left-top-btns">
11
- <div class="BnFunExpr-left-top-btn" :class="{'active':listType == 1}" @click="listType = 1;searchInput=''">
12
- 函数
13
- </div>
14
- <div class="BnFunExpr-left-top-btn" :class="{'active':listType == 2}" @click="listType = 2;searchInput=''">
15
- 字段
16
- </div>
17
- </div>
18
- <div class="BnFunExpr-left-top-input">
19
- <el-input placeholder="请输入关键字搜索" v-model="searchInput"></el-input>
20
- </div>
21
- </div>
22
- <div class="BnFunExpr-left-body">
23
- <div class="BnFunExpr-left-body-list" v-if="listType == 1">
24
- <div v-for="(itemClass,index) in functionList" :key="index">
25
- <div class="BnFunExpr-left-body-class" @click="changeOpenClass(itemClass)" :title="itemClass.name">
26
- <span class="bnUIcon bnUIcon-arrow"
27
- :class="{'bnUIcon-arrowDown':openFunClass.indexOf(itemClass.name)>-1}"
28
- style="color: rgba(0,0,0,.5);margin-right: 5px"></span>
29
- {{ itemClass.name }}
30
- </div>
31
- <div
32
- v-if="itemClass.children && itemClass.children.length>0 && openFunClass.indexOf(itemClass.name)>-1">
33
- <div class="BnFunExpr-left-body-item-out" v-for="(item,index) in itemClass.children" :key="index">
34
- <div class="BnFunExpr-left-body-item " @click="onSelectFun(item)" @mouseenter="checkFun = item"
35
- style="margin: 4px 0"
36
- v-show="item.name.indexOf(searchInput)>-1 || item.usage.indexOf(searchInput)>-1">
37
- <div class="BnFunExpr-left-body-item-top w-text-over" :title="item.name">{{ item.name }}</div>
38
- <div class="BnFunExpr-left-body-item-text w-text-over" :title="item.usage">{{ item.usage }}</div>
39
- </div>
40
- </div>
41
- </div>
42
- </div>
43
- </div>
44
- <div class="BnFunExpr-left-body-list" v-if="listType == 2">
45
- <div v-for="(itemClass,index) in columnList" :key="index">
46
- <div class="BnFunExpr-left-body-class" @click="changeOpenColumn(itemClass)" :title="itemClass.name">
47
- <span class="bnUIcon bnUIcon-arrow"
48
- :class="{'bnUIcon-arrowDown':openColumnClass.indexOf(itemClass.name)>-1}"
49
- style="color: rgba(0,0,0,.5);margin-right: 5px"></span>
50
- {{ itemClass.name }}
51
- </div>
52
- <div
53
- v-if="itemClass.children && itemClass.children.length>0 && openColumnClass.indexOf(itemClass.name)>-1">
54
- <div class="BnFunExpr-left-body-item-out" v-for="(item,index) in itemClass.children" :key="index">
55
- <div class="BnFunExpr-left-body-item " @click="onSelectCol(item)"
56
- v-show="item.name.indexOf(searchInput)>-1">
57
- <div class="BnFunExpr-left-body-item-title w-text-over" :title="item.name">{{ item.name }}</div>
58
- </div>
59
- </div>
60
- </div>
61
- </div>
62
- </div>
63
- </div>
64
- </div>
65
- <div class="BnFunExpr-right">
66
- <div class="BnFunExpr-right-title">结果 =</div>
67
- <div class="BnFunExpr-right-input" @click="onCodemirrorFocus">
68
- <!-- eslint-disable vue/no-v-model-argument -->
69
- <Codemirror
70
- v-if="functions.length > 0"
71
- ref="cm" height="310"
72
- placeholder="请设置计算公式"
73
- v-model:value="exprExec"
74
- :options="cmOptions"
75
- @beforeChange="handleBeforeChange"
76
- ></Codemirror>
77
- <!-- eslint-enable vue/no-v-model-argument -->
78
- </div>
79
- <div class="BnFunExpr-right-desc">
80
- <div class="BnFunExpr-right-desc-title">{{ checkFun.name }}</div>
81
- <div class="BnFunExpr-right-desc-content">{{ checkFun.desc }}</div>
82
- </div>
83
- </div>
84
- </div>
85
- </template>
86
- <script>
87
- import "codemirror/mode/javascript/javascript.js";
88
- import "codemirror/addon/display/placeholder.js";
89
-
90
- export default {
91
- name: "BnFunExpr",
92
- props: {
93
- // 组件列表:可供选择的组件列表,二维数组,【{类别,【组件、组件】},...】
94
- columnList: {
95
- type: Array,
96
- default() {
97
- return []
98
- }
99
- },
100
- // 支持外部查询的方法,使用者传进来
101
- postFunc: Function,
102
- // 函数规则id
103
- id: {},
104
- // 写入到的组件
105
- setToColumn: {}
106
- },
107
- data() {
108
- return {
109
- searchInput: "",//筛选输入框
110
- listType: 1,//左侧列表展示 1:函数 2:字段
111
- openFunClass: ["数字函数", "文本函数", "日期函数", "逻辑函数"],//已打开的函数分类
112
- openColumnClass: ["工作表组件"],//已打开的函数分类
113
- exprExec: "",//输入框内容
114
- //鼠标悬浮时,展示的函数解释实例
115
- checkFun: {},
116
- // 函数列表
117
- functionList: [],
118
- functions: [],
119
- // 代码编辑器配置
120
- cmOptions: {
121
- mode: "pseudo",
122
- lineWrapping: true,
123
- lineNumbers: false,
124
- gutters: [],
125
- height: 'atuo',
126
- },
127
- loading: false
128
- }
129
- },
130
- computed: {
131
- // 字段列表转化成schema格式
132
- schema: {
133
- get() {
134
- let list = [
135
- {
136
- "fieldCode": 'table',
137
- "fieldName": "工作表",
138
- "type": "object",
139
- "children": []
140
- },
141
- {
142
- "fieldCode": 'flow',
143
- "fieldName": "工作流",
144
- "type": "object",
145
- "children": []
146
- }
147
- ];
148
- this.columnList.map(item => {
149
- switch (item.name) {
150
- case '工作表组件': {
151
- item.children.map(column => {
152
- this.loadColumn(list[0].children, column)
153
- })
154
- break;
155
- }
156
- case '流程参数': {
157
- item.children.map(column => {
158
- this.loadColumn(list[1].children, column)
159
- })
160
- break;
161
- }
162
- }
163
- })
164
- return list;
165
- },
166
- },
167
- // 字段列表汇总
168
- columns: {
169
- get() {
170
- let list = [];
171
- this.columnList.map(item => {
172
- list = [...list, ...item.children]
173
- })
174
- return list;
175
- },
176
- },
177
-
178
- },
179
- methods: {
180
- async getFunctionList() {
181
- let res = await this.postFunc('/expr/functions', null, 'get')
182
- if (!res.code) {
183
- let arr = []
184
- this.functionList = res.data.groups || [];
185
- this.functionList.map(item => {
186
- arr = [...arr, ...item.children]
187
- })
188
- this.functions = arr;
189
- this.codeMirrorDefineMode();
190
- }
191
- },
192
- async init() {
193
- this.loading = true;
194
- await this.getFunctionList();
195
- if (this.id) {
196
- let res = await this.postFunc(`/expr/query/${this.id}`, null, 'get')
197
- if (!res.code) {
198
- this.exprExec = res.data.exprDisplay;
199
- }
200
- }
201
- this.loading = false;
202
- },
203
- handleBeforeChange(instance, changeObj) {
204
- if (changeObj.origin == '+delete') {
205
- // 判断是否为删除操作
206
- let from = changeObj.from; // 删除开始位置
207
- let to = changeObj.to; // 删除结束位置
208
- let lineText = this.$refs.cm.cminstance.getLine(from.line); // 获取当前行的文本
209
- let charBeforeCursor = lineText.charAt(from.ch); // 光标前的字符
210
- // 如果删除的是空格
211
- if (charBeforeCursor === ' ') {
212
- // 找到光标前的上一个空格的位置
213
- let lastSpaceIndex = lineText.lastIndexOf(' ', from.ch - 2);
214
- // 删除开始的位置(从上一个空格之后)
215
- let startPos = {line: from.line, ch: lastSpaceIndex};
216
- // 获取即将要删除的字段名字,判断是否是组件
217
- let delColumn = this.$refs.cm.cminstance.getRange(startPos, to);
218
- let columnNames = this.columns.map(item => `${this.specialString(item.name)}`)
219
- if (columnNames.includes(delColumn)) {
220
- // 更新删除范围
221
- changeObj.update(startPos, to, "");
222
- }
223
- }
224
- }
225
- },
226
- /**
227
- * 整理组件列表为schema
228
- *@param array 组件插入到数组
229
- *@param column 组件
230
- * */
231
- loadColumn(array, column) {
232
- let data = {
233
- fieldCode: (column.id|| '') +'',
234
- fieldName: column.name,
235
- type: 'string'
236
- }
237
- if (column.behaviorType == 2) {
238
- data.type = 'number'
239
- } else if (column.behaviorType == 7 || column.behaviorType == 8) {
240
- data.type = 'date'
241
- }
242
- if (column.parentId) {
243
- let flag = false;
244
- for (let i in array) {
245
- if (array[i].fieldCode == column.parentId) {
246
- array[i].children.push(data)
247
- flag = true;
248
- break;
249
- }
250
- }
251
- if (!flag) {
252
- let parent = {
253
- fieldCode: column.parentId.toString(),
254
- fieldName: column.parentName,
255
- type: 'array',
256
- children: [data]
257
- }
258
- array.push(parent)
259
- }
260
- } else {
261
- array.push(data)
262
- }
263
- },
264
- /**
265
- * 切换函数分类的打开挂壁
266
- * */
267
- changeOpenClass(item) {
268
- let index = this.openFunClass.indexOf(item.name);
269
- if (index == -1) {
270
- this.openFunClass.push(item.name)
271
- } else {
272
- this.openFunClass.splice(index, 1)
273
- }
274
- },
275
- /**
276
- * 切换字段分类的打开挂壁
277
- * */
278
- changeOpenColumn(item) {
279
- let index = this.openColumnClass.indexOf(item.name);
280
- if (index == -1) {
281
- this.openColumnClass.push(item.name)
282
- } else {
283
- this.openColumnClass.splice(index, 1)
284
- }
285
- },
286
- /**
287
- * 获取焦点
288
- * */
289
- onCodemirrorFocus() {
290
- this.$nextTick(() => {
291
- this.$refs.cm && this.$refs.cm.cminstance.focus();
292
- // 清空标记
293
- // if(this.errorTip.length>0){
294
- // this.errorTip.forEach(marker => marker.clear());
295
- // this.errorTip = [];
296
- // }
297
- });
298
- },
299
- /**
300
- * 高亮代码
301
- */
302
- specialString(str) {
303
- let specialRegExp = /\*|\+|\?|\||\{|\}|\[|\]|\(|\)|\^|\$|\./g;
304
- let s = str.replace(specialRegExp, item => '\\' + item) || '';
305
- if (s.indexOf('-') > -1) {
306
- s = `\`${s}\``
307
- } else {
308
- s = ` ${s} `
309
- }
310
- return s
311
- },
312
- codeMirrorDefineMode() {
313
- let funNames = this.functions.map(item => item.name).join('|') || '=-=**=-=';
314
- let columnNames = this.columns.map(item => `${this.specialString(item.name)}`).join('|') || '=-=**=-=';
315
- CodeMirror.defineMode("pseudo", (config, parserConfig) => {
316
- let funRegExp = new RegExp(`^(${funNames})\(\\b\)`, 'g');
317
- let columnRegExp = new RegExp(`^(${columnNames})`, 'g');
318
- return {
319
- startState: function () {
320
- return {
321
- inString: false,
322
- inChar: false
323
- };
324
- },
325
- token: (stream, state) => {
326
- if (state.inString) {
327
- return "string";
328
- } else if (state.inChar) {
329
- return "string";
330
- } else {
331
- if (stream.match(/^[+-\/*%<>=\(\)]+/)) {
332
- return "operator";
333
- }
334
- if (stream.match(funRegExp)) {
335
- return "keyword";
336
- } else if (stream.match(columnRegExp)) {
337
- return "bnColumn"
338
- } else if (stream.match(/^\d*\.\d+|\d+/)) {
339
- return "number";
340
- } else if (stream.match(/^[a-zA-Z_][a-zA-Z0-9_]*/)) {
341
- return "variable";
342
- } else {
343
- stream.next();
344
- return null;
345
- }
346
- }
347
- }
348
- };
349
- });
350
- },
351
- /**
352
- * 选择函数
353
- */
354
- onSelectFun(item) {
355
- this.$nextTick(() => {
356
- let cursor = this.$refs.cm && this.$refs.cm.cminstance.getCursor();
357
- this.$refs.cm && this.$refs.cm.cminstance.replaceRange(`${item.name}()`, cursor, cursor); // 在当前光标位置插入文本
358
- cursor.ch += item.name.length + 1;
359
- this.$refs.cm && this.$refs.cm.cminstance.setCursor(cursor); // 将光标移动到指定位置
360
- this.$refs.cm && this.$refs.cm.cminstance.focus(); // 确保编辑器获得焦点
361
- });
362
- },
363
- /**
364
- * 选择字段
365
- */
366
- onSelectCol(item) {
367
- this.$nextTick(() => {
368
- let cursor = this.$refs.cm && this.$refs.cm.cminstance.getCursor();
369
- // 需要判断插入时,前面是不是 ( 符号,如果不是需要在字段前加个 , 号
370
- let lastChar = this.$refs.cm.cminstance.getRange({line: 0, ch: 0}, cursor).slice(-1)
371
- // 判断插入字段后,光标需要指向的位置
372
- let addIndex = 2;
373
- let name = item.name;
374
- if (item.name.indexOf('-') > -1) {
375
- name = `\`${name}\``
376
- } else {
377
- name = ` ${name} `
378
- }
379
- if (lastChar != '(') {
380
- name = ',' + name
381
- addIndex++;
382
- }
383
- this.$refs.cm && this.$refs.cm.cminstance.replaceRange(name, cursor, cursor); // 在当前光标位置插入文本
384
- cursor.ch += item.name.length + addIndex;
385
- this.$refs.cm && this.$refs.cm.cminstance.setCursor(cursor); // 将光标移动到指定位置
386
- this.$refs.cm && this.$refs.cm.cminstance.focus(); // 确保编辑器获得焦点
387
- });
388
- },
389
- /**
390
- * 保存
391
- * */
392
- saveRule() {
393
- return {
394
- id: this.id || '',//函数规则id
395
- schema: this.schema,
396
- exprDisplay: this.exprExec
397
- };
398
- },
399
- },
400
- mounted() {
401
- this.init()
402
- },
403
- }
404
- </script>
405
-
406
- <style scoped lang="scss">
407
- @import "../font/iconfont.css";
408
-
409
- :deep(.cm-bnColumn) {
410
- color: #2DACFC;
411
- background-color: #F1F7FF; /* 你可以根据需要改变背景色 */
412
- }
413
-
414
- :deep(.cm-bnErrTip) {
415
- color: red !important;
416
- }
417
-
418
- :deep(.CodeMirror) {
419
- height: auto;
420
- font-size: 14px;
421
- }
422
-
423
- :deep(.CodeMirror-code),
424
- :deep(.CodeMirror-lines),
425
- :deep(.CodeMirror-line) {
426
- font-size: 14px;
427
- }
428
-
429
- :deep(.CodeMirror-activeline-background) {
430
- min-height: 24px;
431
- top: -3px;
432
- }
433
-
434
- .BnFunExpr {
435
- display: flex;
436
- position: relative;
437
- width: 100%;
438
-
439
- &-left {
440
- flex-grow: 0;
441
- height: 572px;
442
- width: 225px;
443
-
444
- &-top {
445
- padding: 0 16px;
446
-
447
- &-btns {
448
- display: flex;
449
- justify-content: space-around;
450
- position: relative;
451
- width: 100%;
452
- padding: 8px 16px 0 16px;
453
- height: 48px;
454
- border-bottom: 1px solid rgba(0, 0, 0, .06);
455
- }
456
-
457
- &-btn {
458
- width: 60px;
459
- height: 40px;
460
- line-height: 40px;
461
- text-align: center;
462
- font-size: 14px;
463
- color: #000;
464
- cursor: pointer;
465
-
466
- &:hover {
467
- color: #2783F2;
468
- }
469
-
470
- &.active {
471
- color: #2783F2;
472
- border-bottom: 2px solid #2783F2;
473
- }
474
- }
475
-
476
- &-input {
477
- padding: 12px 0;
478
-
479
- :deep(.el-input__wrapper) {
480
- border-radius: 0;
481
- }
482
- }
483
- }
484
-
485
- &-body {
486
- position: relative;
487
- height: calc(100% - 110px);
488
- overflow-y: auto;
489
-
490
- &-class {
491
- height: 46px;
492
- padding: 0 16px;
493
- line-height: 46px;
494
- font-size: 14px;
495
- font-weight: 600;
496
- color: rgba(0, 0, 0, .8);
497
- cursor: pointer;
498
- white-space: nowrap;
499
- overflow: hidden;
500
- text-overflow: ellipsis;
501
- }
502
-
503
- &-item-out {
504
- padding: 0 16px;
505
- }
506
-
507
- &-item {
508
- position: relative;
509
- padding: 0 8px 0 24px;
510
- cursor: pointer;
511
-
512
- &:hover {
513
- background: #F1F7FF;
514
- }
515
-
516
- &-top {
517
- height: 22px;
518
- line-height: 22px;
519
- color: rgba(0, 0, 0, .85);
520
- font-size: 13px;
521
- font-weight: 600;
522
- }
523
-
524
- &-text {
525
- height: 22px;
526
- line-height: 22px;
527
- color: rgba(0, 0, 0, .45);
528
- font-weight: 400;
529
- font-size: 12px;
530
- }
531
-
532
- &-title {
533
- height: 40px;
534
- line-height: 40px;
535
- color: rgba(0, 0, 0, .65);
536
- font-size: 14px;
537
- }
538
- }
539
- }
540
- }
541
-
542
- &-right {
543
- position: relative;
544
- flex-grow: 1;
545
- width: calc(100% - 225px);
546
- height: 572px;
547
-
548
- &-title {
549
- height: 58px;
550
- line-height: 58px;
551
- font-size: 20px;
552
- font-weight: 600;
553
- color: #000;
554
- padding: 0 24px;
555
- }
556
-
557
- &-input {
558
- position: relative;
559
- width: 100%;
560
- height: 320px;
561
- overflow-y: auto;
562
- border-bottom: 1px solid rgba(0, 0, 0, .06);
563
- padding-left: 20px;
564
- }
565
-
566
- &-desc {
567
- height: 250px;
568
- padding: 0 20px;
569
- overflow-y: auto;
570
-
571
- &-title {
572
- height: 40px;
573
- line-height: 40px;
574
- font-size: 14px;
575
- color: rgba(0, 0, 0, .85);
576
- }
577
-
578
- &-content {
579
- line-height: 24px;
580
- color: rgba(0, 0, 0, .65);
581
- font-size: 12px;
582
- white-space: break-spaces;
583
- }
584
- }
585
- }
586
-
587
- &-footer {
588
- display: flex;
589
- justify-content: space-between;
590
- padding: 12px 24px;
591
- border-top: 1px solid #eee;
592
-
593
- &-a {
594
- font-size: 12px;
595
- color: #2783F2;
596
- text-decoration: none;
597
- }
598
- }
599
- }
600
-
601
- :deep(.CodeMirror-gutters) {
602
- display: none;
603
- }
604
-
605
- :deep(.CodeMirror-sizer) {
606
- margin-left: 0;
607
- }
608
- </style>