@bytenew/bn-bus-ui 1.1.461 → 1.1.463
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/install.js +134 -0
- package/package.json +20 -4
- package/packages/BnAddress/index.vue +141 -0
- package/packages/BnAddressParse/index.vue +75 -0
- package/packages/BnAdvancedFilter/BnFilterView.vue +145 -0
- package/packages/BnAdvancedFilter/index.vue +345 -0
- package/packages/BnAdvancedFilter/util.js +171 -0
- package/packages/BnCascader/BnCascader.vue +543 -0
- package/packages/BnCascader/BnCascaderPanel.vue +1331 -0
- package/packages/BnCascader/cascaderDisplay.js +102 -0
- package/packages/BnCheck/BnCheck.vue +253 -0
- package/packages/BnColumnConfig/columnConfigDialog.vue +134 -0
- package/packages/BnColumnConfig/component/childrenFormSetting/assocTable.vue +143 -0
- package/packages/BnColumnConfig/component/childrenFormSetting/assocTableSearch.vue +314 -0
- package/packages/BnColumnConfig/component/childrenFormSetting/index.vue +243 -0
- package/packages/BnColumnConfig/component/defaultSet/defaultSet.vue +114 -0
- package/packages/BnColumnConfig/component/defaultSet/stringDefault.vue +210 -0
- package/packages/BnColumnConfig/component/funcExprDialog/funcExprDialog.vue +126 -0
- package/packages/BnColumnConfig/component/packageFilter/index.vue +141 -0
- package/packages/BnColumnConfig/component/paraExplainSet/index.vue +156 -0
- package/packages/BnColumnConfig/component/setOption/setOption.vue +321 -0
- package/packages/BnColumnConfig/component/setRelationOption/ConditionList.vue +277 -0
- package/packages/BnColumnConfig/component/setRelationOption/LevelHeader.vue +144 -0
- package/packages/BnColumnConfig/component/setRelationOption/setRelationOption.vue +642 -0
- package/packages/BnColumnConfig/data.js +129 -0
- package/packages/BnColumnConfig/index.scss +23 -0
- package/packages/BnColumnConfig/index.vue +309 -0
- package/packages/BnCondVal/BnCondVal.vue +112 -0
- package/packages/BnCondVal/itemVal/dateRegVal.vue +39 -0
- package/packages/BnCondVal/itemVal/dateVal.vue +39 -0
- package/packages/BnCondVal/itemVal/numRegVal.vue +67 -0
- package/packages/BnCondVal/itemVal/numVal.vue +44 -0
- package/packages/BnCondVal/itemVal/relationVal.vue +73 -0
- package/packages/BnCondVal/itemVal/selectColumnVal.vue +58 -0
- package/packages/BnCondVal/itemVal/selectVal.vue +59 -0
- package/packages/BnCondVal/itemVal/stringVal.vue +156 -0
- package/packages/BnCondition/index.vue +551 -0
- package/packages/BnCondition/util.js +232 -0
- package/packages/BnDatePicker/BnDatePicker.vue +194 -0
- package/packages/BnDrop/BnDrop.vue +917 -0
- package/packages/BnEmptyTip/BnEmptyTip.vue +107 -0
- package/packages/BnExportOrder/BnExportOrder.vue +241 -0
- package/packages/BnExportOrder/validatorCode.vue +94 -0
- package/packages/BnFileView/BnFileView.vue +271 -0
- package/packages/BnFileView/FileDetail.vue +125 -0
- package/packages/BnFileView/videoPreview.vue +70 -0
- package/packages/BnFilterOption/BnFilterOption.vue +160 -0
- package/packages/BnFunExpr/BnFunExpr.vue +608 -0
- package/packages/BnImportOrder/BnImportOrder.vue +323 -0
- package/packages/BnImportTemplate/BnImportTemplate.vue +866 -0
- package/packages/BnImportTemplate/assets/merge_tip_img.png +0 -0
- package/packages/BnImportTemplate/assets/sheet_tip.png +0 -0
- package/packages/BnImportTemplate/assets/xls.png +0 -0
- package/packages/BnImportTemplate/components/ImportTemplateTrigger.vue +198 -0
- package/packages/BnImportTemplate/components/TemplateEditDialog.vue +340 -0
- package/packages/BnImportTemplate/components/TemplateFieldsConfig.vue +401 -0
- package/packages/BnImportTemplate/components/TemplateListDialog.vue +297 -0
- package/packages/BnInpNum/BnInpNum.vue +165 -0
- package/packages/BnMenus/BnMenus.vue +502 -0
- package/packages/BnMenus/MenuItem.vue +321 -0
- package/packages/BnOrderCard/BnOrderCard.vue +389 -0
- package/packages/BnOrderCard/orderRemark.vue +178 -0
- package/packages/BnOrderCard/util.js +94 -0
- package/packages/BnOrderDetail/BnOrderDetail.vue +338 -0
- package/packages/BnOrderDetail/filterLogByUser.vue +108 -0
- package/packages/BnOrderDetail/orderLogs.vue +53 -0
- package/packages/BnOrderDetail/showSubForm/index.vue +41 -0
- package/packages/BnOrderDetail/showSubForm/showChildTable.vue +61 -0
- package/packages/BnOrderDetail/showSubForm/showTimeLine.vue +131 -0
- package/packages/BnOrderDetail/showSubForm/tableCellCopy.vue +84 -0
- package/packages/BnOrderShare/index.vue +378 -0
- package/packages/BnOrderShare/shareUrlInp.vue +54 -0
- package/packages/BnRadio/BnRadio.vue +181 -0
- package/packages/BnRelation/BnRelation.vue +120 -0
- package/packages/BnSelect/BnSelect.vue +485 -0
- package/packages/BnSmartForm/BnBatchForm.vue +334 -0
- package/packages/BnSmartForm/BnBatchFormDialog.vue +423 -0
- package/packages/BnSmartForm/BnSmartElf/elfLog/index.vue +57 -0
- package/packages/BnSmartForm/BnSmartElf/index.vue +95 -0
- package/packages/BnSmartForm/BnSmartFormPsychic.js +629 -0
- package/packages/BnSmartForm/BnSmartFormUtil.js +524 -0
- package/packages/BnSmartForm/addressForm/index.vue +73 -0
- package/packages/BnSmartForm/checkboxForm/index.vue +99 -0
- package/packages/BnSmartForm/childrenForm/childFormFile.vue +237 -0
- package/packages/BnSmartForm/childrenForm/childrenFormBody.vue +260 -0
- package/packages/BnSmartForm/childrenForm/index.vue +110 -0
- package/packages/BnSmartForm/childrenForm/searchInventory.vue +115 -0
- package/packages/BnSmartForm/chooseAssocTable/chooseAssocTable.vue +451 -0
- package/packages/BnSmartForm/chooseAssocTable/chooseChildGood.vue +229 -0
- package/packages/BnSmartForm/chooseAssocTable/tableCellCopy.vue +84 -0
- package/packages/BnSmartForm/chooseChildOrder/chooseChildOrder.vue +158 -0
- package/packages/BnSmartForm/chooseIPaasData/chooseIPaasData.vue +307 -0
- package/packages/BnSmartForm/chooseIPaasData/tableCellCopy.vue +84 -0
- package/packages/BnSmartForm/choosePackage/choosePackage.vue +361 -0
- package/packages/BnSmartForm/dateDualForm/index.vue +37 -0
- package/packages/BnSmartForm/dateForm/index.vue +38 -0
- package/packages/BnSmartForm/fileForm/fileFormData.js +50 -0
- package/packages/BnSmartForm/fileForm/index.vue +240 -0
- package/packages/BnSmartForm/formItemFooter/formItemFooter.vue +38 -0
- package/packages/BnSmartForm/formItemTop/formItemTop.vue +42 -0
- package/packages/BnSmartForm/index.vue +1201 -0
- package/packages/BnSmartForm/numberForm/index.vue +63 -0
- package/packages/BnSmartForm/radioForm/index.vue +72 -0
- package/packages/BnSmartForm/receiveForm/index.vue +112 -0
- package/packages/BnSmartForm/relationForm/index.vue +82 -0
- package/packages/BnSmartForm/scoreForm/index.vue +39 -0
- package/packages/BnSmartForm/selectForm/index.vue +55 -0
- package/packages/BnSmartForm/showValForm/index.vue +42 -0
- package/packages/BnSmartForm/showValForm/showValFormTable.vue +104 -0
- package/packages/BnSmartForm/smartFormsCommon.scss +43 -0
- package/packages/BnSmartForm/stringForm/index.vue +170 -0
- package/packages/BnVirtPopover/index.vue +319 -0
- package/packages/BnWebLog/BnWebLog.vue +140 -0
- package/packages/BnWorkSettingDrop/advancedOptions.js +112 -0
- package/packages/BnWorkSettingDrop/benBenAIUtil.js +89 -0
- package/packages/BnWorkSettingDrop/index.vue +292 -0
- package/packages/font/iconfont.css +243 -0
- package/packages/font/iconfont.ttf +0 -0
- package/packages/font/iconfont.woff +0 -0
- package/packages/font/iconfont.woff2 +0 -0
- package/utils/addressParse-old.js +645 -0
- package/utils/addressParse.js +735 -0
- package/utils/config.js +68 -0
- package/utils/index.js +1171 -0
- package/dist/assocTableSearch-C14i_zJO.js +0 -349
- package/dist/assocTableSearch.css +0 -1
- package/dist/bn-bus-ui.es.js +0 -65
- package/dist/bn-bus-ui.umd.js +0 -49
- package/dist/chooseIPaasData-Cl_5qkFA.js +0 -391
- package/dist/chooseIPaasData.css +0 -1
- package/dist/defaultSet-I4xpf8a4.js +0 -297
- package/dist/defaultSet.css +0 -1
- package/dist/fileFormData-D_Q1vylE.js +0 -53
- package/dist/formItemFooter-CTA7rDtV.js +0 -108
- package/dist/formItemFooter.css +0 -1
- package/dist/funcExprDialog-Cm5BiRM3.js +0 -139
- package/dist/funcExprDialog.css +0 -1
- package/dist/index-B6b4uj8v.js +0 -51
- package/dist/index-BWdkDTbz.js +0 -109
- package/dist/index-BdZ1zOap.js +0 -89
- package/dist/index-BdzNjjMC.js +0 -64
- package/dist/index-BfpZqab2.js +0 -66
- package/dist/index-BmkiB4hr.js +0 -66
- package/dist/index-Br1sqCoo.js +0 -58
- package/dist/index-C9qrl-yc.js +0 -183
- package/dist/index-CXFJXCn5.js +0 -746
- package/dist/index-DF114jZq.js +0 -135
- package/dist/index-DFPfZ_Il.js +0 -178
- package/dist/index-DSEtu7TN.js +0 -44
- package/dist/index-Did0UUWV.js +0 -221
- package/dist/index-DrPj-tmI.js +0 -45
- package/dist/index-DzDf9s2W.js +0 -89
- package/dist/index-LnjudNEI.js +0 -118
- package/dist/index-ObCfCmDT.js +0 -45
- package/dist/index.css +0 -1
- package/dist/index2.css +0 -1
- package/dist/index3.css +0 -1
- package/dist/index4.css +0 -1
- package/dist/index5.css +0 -1
- package/dist/index6.css +0 -1
- package/dist/index7.css +0 -1
- package/dist/install-C-scqkds.js +0 -23103
- package/dist/install.css +0 -1
- package/dist/setOption-CSnWzOny.js +0 -329
- package/dist/setOption.css +0 -1
- package/dist/setRelationOption-CJcHdfaa.js +0 -5217
- package/dist/setRelationOption.css +0 -1
|
@@ -0,0 +1,608 @@
|
|
|
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>
|