cloud-web-corejs 1.0.54-dev.798 → 1.0.54-dev.799
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -1
- package/src/components/baseTabs/mixins.js +11 -12
- package/src/components/bizTab/BizBillActions.vue +129 -0
- package/src/components/bizTab/BizTabListPage.vue +391 -0
- package/src/components/bizTab/README.md +378 -0
- package/src/components/bizTab/billTableUtil.js +48 -0
- package/src/components/bizTab/billValidators.js +136 -0
- package/src/components/bizTab/bizBillDetailMixin.js +687 -0
- package/src/components/bizTab/index.js +24 -0
- package/src/components/excelExport/exportFieldDialog.vue +373 -367
- package/src/components/excelExport/exportType.js +49 -0
- package/src/components/excelExport/mixins.js +1153 -1144
- package/src/components/vb-tabs/x-tabs.vue +167 -143
- package/src/components/wf/wfUtil.js +327 -292
- package/src/components/xform/form-designer/designer.js +56 -8
- package/src/components/xform/form-designer/form-widget/container-widget/detail-widget.vue +59 -5
- package/src/components/xform/form-designer/form-widget/field-widget/baseAttachment-widget.vue +60 -8
- package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +8 -2
- package/src/components/xform/form-designer/form-widget/field-widget/select-export-item-button-widget.vue +120 -92
- package/src/components/xform/form-designer/form-widget/field-widget/vabUpload-widget.vue +63 -94
- package/src/components/xform/form-designer/index.vue +0 -1
- package/src/components/xform/form-designer/setting-panel/dataSource-setting.vue +397 -397
- package/src/components/xform/form-designer/setting-panel/form-dynamicField-setting.vue +602 -602
- package/src/components/xform/form-designer/setting-panel/form-setting.vue +13 -13
- package/src/components/xform/form-designer/setting-panel/option-items-setting.vue +585 -585
- package/src/components/xform/form-designer/setting-panel/property-editor/a-link-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/a-text-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/alignType-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/censusClass-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/colorClass-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/commonAttributeEnabled-editor.vue +3 -3
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +1154 -1154
- package/src/components/xform/form-designer/setting-panel/property-editor/container-detail/detail-editor.vue +96 -80
- package/src/components/xform/form-designer/setting-panel/property-editor/container-detail-plain/detail-plain-editor.vue +75 -75
- package/src/components/xform/form-designer/setting-panel/property-editor/container-grid/colHeight-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/container-grid/gutter-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-height-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-offset-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-pull-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-push-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-span-editor.vue +4 -4
- package/src/components/xform/form-designer/setting-panel/property-editor/container-h5-card/h5-card-editor.vue +124 -124
- package/src/components/xform/form-designer/setting-panel/property-editor/container-panel/height-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/container-panel/width-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/container-tab/tab-customClass-editor.vue +119 -119
- package/src/components/xform/form-designer/setting-panel/property-editor/container-tab/tabClass-editor.vue +45 -45
- package/src/components/xform/form-designer/setting-panel/property-editor/container-table/table-dynamicField-editor.vue +344 -344
- package/src/components/xform/form-designer/setting-panel/property-editor/container-table-cell/cellHeight-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/container-table-cell/cellWidth-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/container-tree/tree-customClass-editor.vue +2 -2
- package/src/components/xform/form-designer/setting-panel/property-editor/container-tree-pane/tree-pane-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/container-vf-dialog/cancelButtonLabel-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/container-vf-dialog/okButtonLabel-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/container-vf-dialog/title-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/container-vf-dialog/width-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/containerClass-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/customClass-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/defaultValue-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/descriptionsItems-editor.vue +4 -4
- package/src/components/xform/form-designer/setting-panel/property-editor/downloadButtonFlag-editor.vue +3 -3
- package/src/components/xform/form-designer/setting-panel/property-editor/dropdownFlag-editor.vue +2 -2
- package/src/components/xform/form-designer/setting-panel/property-editor/dsName-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/echartHeight-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/endPlaceholder-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-accessUrl/accessUrl-editor.vue +2 -2
- package/src/components/xform/form-designer/setting-panel/property-editor/field-area-select/areaDataType-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-area-select/areaMinLevel-editor.vue +50 -50
- package/src/components/xform/form-designer/setting-panel/property-editor/field-area-select/areaName-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-autocomplete/autocomplete-vabSearchName-editor.vue +7 -7
- package/src/components/xform/form-designer/setting-panel/property-editor/field-button/addTableData-event-editor.vue +84 -84
- package/src/components/xform/form-designer/setting-panel/property-editor/field-button/button-type-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-button/clickBindEvent-editor.vue +97 -97
- package/src/components/xform/form-designer/setting-panel/property-editor/field-button/form-host-event-editor.vue +188 -188
- package/src/components/xform/form-designer/setting-panel/property-editor/field-button/search-dialog-event-editor.vue +237 -237
- package/src/components/xform/form-designer/setting-panel/property-editor/field-common/keyName-editor.vue +74 -67
- package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-dateLimit-editor.vue +4 -4
- package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-defaultValue-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-format-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-type-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-valueFormat-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-date-range/date-range-defaultTime-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-date-range/date-range-defaultValue-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-date-range/date-range-format-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-date-range/date-range-type-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-date-range/date-range-valueFormat-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-divider/contentPosition-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-dropdown-menu/dropdown-menu-editor.vue +59 -59
- package/src/components/xform/form-designer/setting-panel/property-editor/field-echart/echart-bar-editor.vue +11 -11
- package/src/components/xform/form-designer/setting-panel/property-editor/field-echart/echart-category-editor.vue +10 -10
- package/src/components/xform/form-designer/setting-panel/property-editor/field-echart/echart-pie-editor.vue +12 -12
- package/src/components/xform/form-designer/setting-panel/property-editor/field-file-upload/file-upload-fileTypes-editor.vue +44 -44
- package/src/components/xform/form-designer/setting-panel/property-editor/field-html-text/htmlContent-editor.vue +29 -29
- package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import-button-editor.vue +6 -6
- package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import2-button-editor.vue +3 -3
- package/src/components/xform/form-designer/setting-panel/property-editor/field-number/controlsPosition-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-picture-upload/picture-upload-fileTypes-editor.vue +44 -44
- package/src/components/xform/form-designer/setting-panel/property-editor/field-print-button/print-button-editor.vue +115 -115
- package/src/components/xform/form-designer/setting-panel/property-editor/field-print-button/print-detail-button-editor.vue +115 -115
- package/src/components/xform/form-designer/setting-panel/property-editor/field-rate/highThreshold-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-rate/lowThreshold-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-rate/rate-defaultValue-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-rate/rate-max-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-script/script-editor.vue +4 -4
- package/src/components/xform/form-designer/setting-panel/property-editor/field-script-input/script-input-editor.vue +4 -4
- package/src/components/xform/form-designer/setting-panel/property-editor/field-static-text/fontSize-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-static-text/textContent-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-status/field-status-editor.vue +3 -3
- package/src/components/xform/form-designer/setting-panel/property-editor/field-switch/activeText-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-switch/inactiveText-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-switch/switchWidth-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/select-export-button-editor.vue +2 -2
- package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/select-export-item-button-editor.vue +74 -71
- package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/table-export-button-editor.vue +3 -3
- package/src/components/xform/form-designer/setting-panel/property-editor/field-time/time-defaultValue-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-time/time-format-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-time/time-timeLimit-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-time-range/time-range-defaultValue-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-time-range/time-range-format-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-vabSearch/vabSearchField-editor.vue +2 -2
- package/src/components/xform/form-designer/setting-panel/property-editor/field-vabSearch/vabSearchName-editor.vue +2 -2
- package/src/components/xform/form-designer/setting-panel/property-editor/field-vabUpload/field-vabUpload-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-vabUpload2/field-vabUpload2-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-vue-page/vue-page-editor.vue +2 -2
- package/src/components/xform/form-designer/setting-panel/property-editor/fileMaxSize-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/fileTypesSelect.vue +176 -176
- package/src/components/xform/form-designer/setting-panel/property-editor/formScriptEnabled-editor.vue +2 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/formatType-editor.vue +2 -2
- package/src/components/xform/form-designer/setting-panel/property-editor/formula-editor.vue +972 -972
- package/src/components/xform/form-designer/setting-panel/property-editor/iconClass-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/label-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/labelAlign-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/labelColor-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/labelIconPosition-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/labelWidth-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/limit-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/max-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/maxLength-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/min-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/minLength-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/multipleLimit-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/name-editor.vue +178 -178
- package/src/components/xform/form-designer/setting-panel/property-editor/oplog-editor.vue +3 -3
- package/src/components/xform/form-designer/setting-panel/property-editor/placeholder-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/precision-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/project-tag-editor.vue +6 -6
- package/src/components/xform/form-designer/setting-panel/property-editor/requiredHint-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/rows-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/space-editor-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/startPlaceholder-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/step-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/styleTableClass-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/styleTitClass-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/tempStorage-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/type-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/uploadTip-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/uploadURL-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/urlValueEnabled-editor.vue +91 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/validation-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/validationHint-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/widgetWidth-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/propertyRegister.js +1 -0
- package/src/components/xform/form-designer/widget-panel/index.vue +3 -1
- package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +55 -13
- package/src/components/xform/form-render/container-item/data-table-mixin copy.js +5910 -0
- package/src/components/xform/form-render/container-item/data-table-mixin.js +59 -13
- package/src/components/xform/form-render/container-item/detail-item.vue +52 -11
- package/src/components/xform/form-render/container-item/tab-item.vue +6 -2
- package/src/components/xform/form-render/indexMixin.js +56 -16
- package/src/components/xform/lang/zh-CN.js +2 -1
- package/src/components/xform/utils/attachmentValueUtil.js +239 -0
- package/src/components/xform/utils/util.js +27 -0
- package/src/mixins/wf/index.js +40 -38
- package/src/router/modules/customer.js +50 -0
- package/src/store/config/index.js +46 -0
- package/src/utils/scrollUtil.js +25 -0
- package/src/views/demo/bizTab/bill/billConfig.js +41 -0
- package/src/views/demo/bizTab/bill/detail.vue +436 -0
- package/src/views/demo/bizTab/bill/list.vue +288 -0
- package/src/views/demo/bizTab/bill/productDialog.vue +176 -0
- package/src/views/demo/bizTab/simple/billApi.js +123 -0
- package/src/views/demo/bizTab/simple/detail.vue +407 -0
- package/src/views/demo/bizTab/simple/list.vue +217 -0
- package/src/views/demo/bizTab/standalone/index.vue +121 -0
- package/src/views/demo/bizTab/wf/billConfig.js +44 -0
- package/src/views/demo/bizTab/wf/detail.vue +661 -0
- package/src/views/demo/bizTab/wf/list.vue +242 -0
- package/src/views/user/outLink/cc_form_view.vue +185 -0
|
@@ -1,972 +1,972 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
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">
|
|
10
|
-
<el-input v-model="formulaForView" readonly>
|
|
11
|
-
<template #append>
|
|
12
|
-
<el-button @click="editFormula" icon="el-icon-edit"></el-button>
|
|
13
|
-
</template>
|
|
14
|
-
</el-input>
|
|
15
|
-
</el-tooltip>
|
|
16
|
-
</el-form-item>
|
|
17
|
-
<el-dialog
|
|
18
|
-
v-if="formulaDialogVisible"
|
|
19
|
-
:visible.sync="formulaDialogVisible"
|
|
20
|
-
:title="i18nt('designer.hint.formulaSetting')"
|
|
21
|
-
custom-class="dialog-style list-dialog"
|
|
22
|
-
:close-on-click-modal="false"
|
|
23
|
-
:close-on-press-escape="false"
|
|
24
|
-
:destroy-on-close="true"
|
|
25
|
-
:append-to-body="true"
|
|
26
|
-
width="70%"
|
|
27
|
-
top="0px"
|
|
28
|
-
ref="colFormulaDialog"
|
|
29
|
-
>
|
|
30
|
-
<div class="cont">
|
|
31
|
-
<el-row>
|
|
32
|
-
<el-col :span="24">
|
|
33
|
-
<div class="editor">
|
|
34
|
-
<div class="editor-top">
|
|
35
|
-
<el-row>
|
|
36
|
-
<el-col :span="22">
|
|
37
|
-
<div style="font-weight: bold">
|
|
38
|
-
{{ this.optionModel.label }} =
|
|
39
|
-
</div>
|
|
40
|
-
</el-col>
|
|
41
|
-
<!-- el-tag 模式 按钮 end -->
|
|
42
|
-
<el-col :span="2">
|
|
43
|
-
<el-button
|
|
44
|
-
size="small"
|
|
45
|
-
@click="clearFormula"
|
|
46
|
-
type="danger"
|
|
47
|
-
plain
|
|
48
|
-
>
|
|
49
|
-
{{ i18nt("designer.hint.formulaClear") }}
|
|
50
|
-
</el-button>
|
|
51
|
-
</el-col>
|
|
52
|
-
</el-row>
|
|
53
|
-
<div ref="cmRef" style="height: 83px; width: 100%"></div>
|
|
54
|
-
</div>
|
|
55
|
-
<!-- -->
|
|
56
|
-
<div class="editor-bottom">
|
|
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>
|
|
65
|
-
</div>
|
|
66
|
-
<!-- -->
|
|
67
|
-
</div>
|
|
68
|
-
</el-col>
|
|
69
|
-
</el-row>
|
|
70
|
-
<el-row style="margin: 10px">
|
|
71
|
-
<el-col :span="6">
|
|
72
|
-
<div class="group-item-left">
|
|
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>
|
|
81
|
-
<div class="item-body-left">
|
|
82
|
-
<el-tree
|
|
83
|
-
ref="fieldTree"
|
|
84
|
-
:data="fieldTreeData"
|
|
85
|
-
:filter-node-method="filterNode"
|
|
86
|
-
@node-click="insertField"
|
|
87
|
-
>
|
|
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>
|
|
99
|
-
</el-tree>
|
|
100
|
-
</div>
|
|
101
|
-
</div>
|
|
102
|
-
</el-col>
|
|
103
|
-
<el-col :span="6">
|
|
104
|
-
<el-row>
|
|
105
|
-
<el-col :span="24">
|
|
106
|
-
<div class="group-item-right-top">
|
|
107
|
-
<div class="item-header">
|
|
108
|
-
{{ i18nt("designer.hint.formulaFunctionList") }}
|
|
109
|
-
</div>
|
|
110
|
-
<div class="function-list">
|
|
111
|
-
<el-collapse v-model="funcActiveCollapseNames">
|
|
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>
|
|
137
|
-
</el-collapse-item>
|
|
138
|
-
</el-collapse>
|
|
139
|
-
</div>
|
|
140
|
-
</div>
|
|
141
|
-
</el-col>
|
|
142
|
-
</el-row>
|
|
143
|
-
</el-col>
|
|
144
|
-
<el-col :span="12">
|
|
145
|
-
<div class="group-item-right-bottom">
|
|
146
|
-
<div class="item-header">{{ introTitle }}</div>
|
|
147
|
-
<div class="item-body-right-bottom">
|
|
148
|
-
<ul>
|
|
149
|
-
<li
|
|
150
|
-
v-if="introduction.title !== ''"
|
|
151
|
-
style="font-size: 16px; color: #0a5d7c"
|
|
152
|
-
>
|
|
153
|
-
{{ introduction.title }}
|
|
154
|
-
</li>
|
|
155
|
-
<li>
|
|
156
|
-
<div
|
|
157
|
-
class="intro-content"
|
|
158
|
-
v-html="introduction.content"
|
|
159
|
-
></div>
|
|
160
|
-
</li>
|
|
161
|
-
</ul>
|
|
162
|
-
</div>
|
|
163
|
-
</div>
|
|
164
|
-
</el-col>
|
|
165
|
-
</el-row>
|
|
166
|
-
</div>
|
|
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>
|
|
184
|
-
</el-dialog>
|
|
185
|
-
</div>
|
|
186
|
-
</template>
|
|
187
|
-
|
|
188
|
-
<script>
|
|
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";
|
|
193
|
-
import {
|
|
194
|
-
deepClone,
|
|
195
|
-
getAllContainerWidgets,
|
|
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";
|
|
207
|
-
|
|
208
|
-
export default {
|
|
209
|
-
name: "formula-editor",
|
|
210
|
-
mixins: [i18n],
|
|
211
|
-
components: {},
|
|
212
|
-
props: {
|
|
213
|
-
designer: Object,
|
|
214
|
-
selectedWidget: Object,
|
|
215
|
-
optionModel: Object,
|
|
216
|
-
tableColumns: Array
|
|
217
|
-
},
|
|
218
|
-
inject:["columnFlag","sourceData"],
|
|
219
|
-
computed: {
|
|
220
|
-
formulaForView() {
|
|
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;
|
|
233
|
-
},
|
|
234
|
-
},
|
|
235
|
-
watch: {
|
|
236
|
-
filterText(val) {
|
|
237
|
-
this.$refs.fieldTree.filter(val);
|
|
238
|
-
},
|
|
239
|
-
},
|
|
240
|
-
data() {
|
|
241
|
-
return {
|
|
242
|
-
codeMirror: null,
|
|
243
|
-
formula: "",
|
|
244
|
-
tags: [], // 公式页签集合
|
|
245
|
-
fieldTreeData: [], // 设计器字段树
|
|
246
|
-
filterText: "",
|
|
247
|
-
formulaDialogVisible: false,
|
|
248
|
-
operate: [
|
|
249
|
-
"+",
|
|
250
|
-
"-",
|
|
251
|
-
"*",
|
|
252
|
-
"/",
|
|
253
|
-
"!=",
|
|
254
|
-
"==",
|
|
255
|
-
"<",
|
|
256
|
-
">",
|
|
257
|
-
"<=",
|
|
258
|
-
">=",
|
|
259
|
-
"(",
|
|
260
|
-
")",
|
|
261
|
-
",",
|
|
262
|
-
],
|
|
263
|
-
insertNum: 0,
|
|
264
|
-
insertStr: "",
|
|
265
|
-
activeNames: ["1"],
|
|
266
|
-
widgetSizes: [
|
|
267
|
-
{
|
|
268
|
-
label: this.i18nt("designer.hint.formulaSizeLarge"),
|
|
269
|
-
value: "large",
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
label: this.i18nt("designer.hint.formulaSizeMedium"),
|
|
273
|
-
value: "default",
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
label: this.i18nt("designer.hint.formulaSizeSmall"),
|
|
277
|
-
value: "small",
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
label: this.i18nt("designer.hint.formulaSizeMini"),
|
|
281
|
-
value: "small",
|
|
282
|
-
},
|
|
283
|
-
],
|
|
284
|
-
introTitle: this.i18nt("designer.hint.formulaFunctionExplain"),
|
|
285
|
-
introduction: {
|
|
286
|
-
title: this.i18nt("designer.hint.formulaPleaseSelect"),
|
|
287
|
-
content:
|
|
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>',
|
|
295
|
-
},
|
|
296
|
-
funcList: formulas,
|
|
297
|
-
funcActiveCollapseNames: [0],
|
|
298
|
-
};
|
|
299
|
-
},
|
|
300
|
-
mounted() {
|
|
301
|
-
},
|
|
302
|
-
methods: {
|
|
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
|
-
});
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
},
|
|
358
|
-
handleTableConfigData(widget, callback) {
|
|
359
|
-
callback(widget);
|
|
360
|
-
},
|
|
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;
|
|
369
|
-
},
|
|
370
|
-
loadFieldListToTree() {
|
|
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);
|
|
410
|
-
}
|
|
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);
|
|
431
|
-
}
|
|
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,
|
|
452
|
-
};
|
|
453
|
-
|
|
454
|
-
if (fieldNode.name !== this.optionModel.name) {
|
|
455
|
-
//排除当前设置公式字段
|
|
456
|
-
subFormNode.children.push(fieldNode);
|
|
457
|
-
}
|
|
458
|
-
});
|
|
459
|
-
|
|
460
|
-
this.fieldTreeData.push(subFormNode);
|
|
461
|
-
});
|
|
462
|
-
},
|
|
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");
|
|
470
|
-
}
|
|
471
|
-
},
|
|
472
|
-
|
|
473
|
-
// 插入符号
|
|
474
|
-
insertSymbol(opt) {
|
|
475
|
-
this.updateCodeMirror(opt, opt, null);
|
|
476
|
-
},
|
|
477
|
-
|
|
478
|
-
// 插入函数
|
|
479
|
-
insertFunction(opt) {
|
|
480
|
-
const val = opt.substring(0, opt.length - 1);
|
|
481
|
-
this.updateCodeMirror(val, val, "func");
|
|
482
|
-
},
|
|
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({
|
|
514
|
-
changes: {
|
|
515
|
-
from: this.codeMirror.state.selection.main.head,
|
|
516
|
-
to: this.codeMirror.state.selection.main.head,
|
|
517
|
-
insert: text,
|
|
518
|
-
},
|
|
519
|
-
selection: {
|
|
520
|
-
anchor: this.codeMirror.state.selection.main.head + text.length,
|
|
521
|
-
},
|
|
522
|
-
});
|
|
523
|
-
}
|
|
524
|
-
},
|
|
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);
|
|
540
|
-
},
|
|
541
|
-
|
|
542
|
-
/**
|
|
543
|
-
* 字段label可能在公式保存后再次被修改,当编辑公式时需要再次刷新公式中的字段label(不刷新也不会影响公式计算结果)
|
|
544
|
-
*/
|
|
545
|
-
refreshFormula() {
|
|
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
|
|
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
|
-
}
|
|
579
|
-
});
|
|
580
|
-
},
|
|
581
|
-
|
|
582
|
-
// 打开编辑公式弹窗
|
|
583
|
-
editFormula() {
|
|
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,
|
|
613
|
-
extensions: [
|
|
614
|
-
basicSetup,
|
|
615
|
-
javascript(),
|
|
616
|
-
[baseTheme, [], placeholders],
|
|
617
|
-
],
|
|
618
|
-
}),
|
|
619
|
-
parent: this.$refs.cmRef,
|
|
620
|
-
});
|
|
621
|
-
console.log("编辑器实例==>", this.codeMirror);
|
|
622
|
-
});
|
|
623
|
-
},
|
|
624
|
-
|
|
625
|
-
// 保存计算公式
|
|
626
|
-
saveFormula() {
|
|
627
|
-
this.optionModel.formula = this.codeMirror.state.doc.text.join("");
|
|
628
|
-
this.formulaDialogVisible = false;
|
|
629
|
-
},
|
|
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
|
-
}
|
|
647
|
-
},
|
|
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
|
-
}
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
// 没找到节点返回NULL
|
|
673
|
-
return null;
|
|
674
|
-
},
|
|
675
|
-
|
|
676
|
-
getClass(type) {
|
|
677
|
-
if (type === this.i18nt("designer.hint.formulaNumber")) {
|
|
678
|
-
return "warning";
|
|
679
|
-
}
|
|
680
|
-
if (type === this.i18nt("designer.hint.formulaChar")) {
|
|
681
|
-
return "";
|
|
682
|
-
}
|
|
683
|
-
if (type === this.i18nt("designer.hint.formulaObject")) {
|
|
684
|
-
return "danger";
|
|
685
|
-
}
|
|
686
|
-
},
|
|
687
|
-
|
|
688
|
-
resetIntro() {
|
|
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
|
-
};
|
|
697
|
-
},
|
|
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;
|
|
706
|
-
},
|
|
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]) {
|
|
721
|
-
case "(":
|
|
722
|
-
a[k] = i;
|
|
723
|
-
k++;
|
|
724
|
-
break;
|
|
725
|
-
case ")":
|
|
726
|
-
j = a[k - 1];
|
|
727
|
-
if (s[j] === "(") {
|
|
728
|
-
a[k] = 0;
|
|
729
|
-
k--;
|
|
730
|
-
} else {
|
|
731
|
-
flag = 0;
|
|
732
|
-
}
|
|
733
|
-
break;
|
|
734
|
-
case "{":
|
|
735
|
-
a[k] = i;
|
|
736
|
-
k++;
|
|
737
|
-
break;
|
|
738
|
-
case "}":
|
|
739
|
-
j = a[k - 1];
|
|
740
|
-
if (s[j] === "{") {
|
|
741
|
-
a[k] = 0;
|
|
742
|
-
k--;
|
|
743
|
-
} else {
|
|
744
|
-
flag = 0;
|
|
745
|
-
}
|
|
746
|
-
break;
|
|
747
|
-
case "[":
|
|
748
|
-
a[k] = i;
|
|
749
|
-
k++;
|
|
750
|
-
break;
|
|
751
|
-
case "]":
|
|
752
|
-
j = a[k - 1];
|
|
753
|
-
if (s[j] === "[") {
|
|
754
|
-
a[k] = 0;
|
|
755
|
-
k--;
|
|
756
|
-
} else {
|
|
757
|
-
flag = 0;
|
|
758
|
-
}
|
|
759
|
-
break;
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
if (k !== 0) {
|
|
763
|
-
flag = 0;
|
|
764
|
-
}
|
|
765
|
-
return flag !== 0;
|
|
766
|
-
},
|
|
767
|
-
},
|
|
768
|
-
};
|
|
769
|
-
</script>
|
|
770
|
-
|
|
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
|
-
|
|
833
|
-
.group-item-left {
|
|
834
|
-
height: 350px;
|
|
835
|
-
border: 1px solid #ccc;
|
|
836
|
-
border-top-left-radius: 6px;
|
|
837
|
-
border-bottom-left-radius: 6px;
|
|
838
|
-
margin-bottom: 5px;
|
|
839
|
-
padding: 0;
|
|
840
|
-
width: 100%;
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
.group-item-right-top {
|
|
844
|
-
height: 350px;
|
|
845
|
-
border: 1px solid #ccc;
|
|
846
|
-
border-radius: 0;
|
|
847
|
-
margin-bottom: 5px;
|
|
848
|
-
width: 100%;
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
.group-item-right-bottom {
|
|
852
|
-
height: 350px;
|
|
853
|
-
border: 1px solid #ccc;
|
|
854
|
-
border-top-right-radius: 6px;
|
|
855
|
-
border-bottom-right-radius: 6px;
|
|
856
|
-
margin-bottom: 5px;
|
|
857
|
-
width: 100%;
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
.item-header {
|
|
861
|
-
border-bottom: 1px solid #ccc;
|
|
862
|
-
height: 29px;
|
|
863
|
-
line-height: 29px;
|
|
864
|
-
padding-left: 15px;
|
|
865
|
-
font-weight: bold;
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
.item-body-left {
|
|
869
|
-
height: 320px;
|
|
870
|
-
overflow-y: auto;
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
.function-list {
|
|
874
|
-
height: 320px;
|
|
875
|
-
overflow-y: auto;
|
|
876
|
-
|
|
877
|
-
:deep(.el-collapse-item__header) {
|
|
878
|
-
font-weight: normal !important;
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
.item-body-right-bottom {
|
|
883
|
-
height: 152px;
|
|
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; */
|
|
971
|
-
}
|
|
972
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<el-form-item
|
|
4
|
+
:label="i18nt('designer.setting.formula')"
|
|
5
|
+
v-if="optionModel.formulaEnabled"
|
|
6
|
+
>
|
|
7
|
+
</el-form-item>
|
|
8
|
+
<el-form-item class="form-item-label-top" label-width="0" v-if="optionModel.formulaEnabled">
|
|
9
|
+
<el-tooltip :content="formulaForView" effect="light" placement="top">
|
|
10
|
+
<el-input v-model="formulaForView" readonly>
|
|
11
|
+
<template #append>
|
|
12
|
+
<el-button @click="editFormula" icon="el-icon-edit"></el-button>
|
|
13
|
+
</template>
|
|
14
|
+
</el-input>
|
|
15
|
+
</el-tooltip>
|
|
16
|
+
</el-form-item>
|
|
17
|
+
<el-dialog
|
|
18
|
+
v-if="formulaDialogVisible"
|
|
19
|
+
:visible.sync="formulaDialogVisible"
|
|
20
|
+
:title="i18nt('designer.hint.formulaSetting')"
|
|
21
|
+
custom-class="dialog-style list-dialog"
|
|
22
|
+
:close-on-click-modal="false"
|
|
23
|
+
:close-on-press-escape="false"
|
|
24
|
+
:destroy-on-close="true"
|
|
25
|
+
:append-to-body="true"
|
|
26
|
+
width="70%"
|
|
27
|
+
top="0px"
|
|
28
|
+
ref="colFormulaDialog"
|
|
29
|
+
>
|
|
30
|
+
<div class="cont">
|
|
31
|
+
<el-row>
|
|
32
|
+
<el-col :span="24">
|
|
33
|
+
<div class="editor">
|
|
34
|
+
<div class="editor-top">
|
|
35
|
+
<el-row>
|
|
36
|
+
<el-col :span="22">
|
|
37
|
+
<div style="font-weight: bold">
|
|
38
|
+
{{ this.optionModel.label }} =
|
|
39
|
+
</div>
|
|
40
|
+
</el-col>
|
|
41
|
+
<!-- el-tag 模式 按钮 end -->
|
|
42
|
+
<el-col :span="2">
|
|
43
|
+
<el-button
|
|
44
|
+
size="small"
|
|
45
|
+
@click="clearFormula"
|
|
46
|
+
type="danger"
|
|
47
|
+
plain
|
|
48
|
+
>
|
|
49
|
+
{{ i18nt("designer.hint.formulaClear") }}
|
|
50
|
+
</el-button>
|
|
51
|
+
</el-col>
|
|
52
|
+
</el-row>
|
|
53
|
+
<div ref="cmRef" style="height: 83px; width: 100%"></div>
|
|
54
|
+
</div>
|
|
55
|
+
<!-- -->
|
|
56
|
+
<div class="editor-bottom">
|
|
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>
|
|
65
|
+
</div>
|
|
66
|
+
<!-- -->
|
|
67
|
+
</div>
|
|
68
|
+
</el-col>
|
|
69
|
+
</el-row>
|
|
70
|
+
<el-row style="margin: 10px">
|
|
71
|
+
<el-col :span="6">
|
|
72
|
+
<div class="group-item-left">
|
|
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>
|
|
81
|
+
<div class="item-body-left">
|
|
82
|
+
<el-tree
|
|
83
|
+
ref="fieldTree"
|
|
84
|
+
:data="fieldTreeData"
|
|
85
|
+
:filter-node-method="filterNode"
|
|
86
|
+
@node-click="insertField"
|
|
87
|
+
>
|
|
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>
|
|
99
|
+
</el-tree>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
</el-col>
|
|
103
|
+
<el-col :span="6">
|
|
104
|
+
<el-row>
|
|
105
|
+
<el-col :span="24">
|
|
106
|
+
<div class="group-item-right-top">
|
|
107
|
+
<div class="item-header">
|
|
108
|
+
{{ i18nt("designer.hint.formulaFunctionList") }}
|
|
109
|
+
</div>
|
|
110
|
+
<div class="function-list">
|
|
111
|
+
<el-collapse v-model="funcActiveCollapseNames">
|
|
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>
|
|
137
|
+
</el-collapse-item>
|
|
138
|
+
</el-collapse>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
</el-col>
|
|
142
|
+
</el-row>
|
|
143
|
+
</el-col>
|
|
144
|
+
<el-col :span="12">
|
|
145
|
+
<div class="group-item-right-bottom">
|
|
146
|
+
<div class="item-header">{{ introTitle }}</div>
|
|
147
|
+
<div class="item-body-right-bottom">
|
|
148
|
+
<ul>
|
|
149
|
+
<li
|
|
150
|
+
v-if="introduction.title !== ''"
|
|
151
|
+
style="font-size: 16px; color: #0a5d7c"
|
|
152
|
+
>
|
|
153
|
+
{{ introduction.title }}
|
|
154
|
+
</li>
|
|
155
|
+
<li>
|
|
156
|
+
<div
|
|
157
|
+
class="intro-content"
|
|
158
|
+
v-html="introduction.content"
|
|
159
|
+
></div>
|
|
160
|
+
</li>
|
|
161
|
+
</ul>
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
164
|
+
</el-col>
|
|
165
|
+
</el-row>
|
|
166
|
+
</div>
|
|
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>
|
|
184
|
+
</el-dialog>
|
|
185
|
+
</div>
|
|
186
|
+
</template>
|
|
187
|
+
|
|
188
|
+
<script>
|
|
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";
|
|
193
|
+
import {
|
|
194
|
+
deepClone,
|
|
195
|
+
getAllContainerWidgets,
|
|
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";
|
|
207
|
+
|
|
208
|
+
export default {
|
|
209
|
+
name: "formula-editor",
|
|
210
|
+
mixins: [i18n],
|
|
211
|
+
components: {},
|
|
212
|
+
props: {
|
|
213
|
+
designer: Object,
|
|
214
|
+
selectedWidget: Object,
|
|
215
|
+
optionModel: Object,
|
|
216
|
+
tableColumns: Array
|
|
217
|
+
},
|
|
218
|
+
inject:["columnFlag","sourceData"],
|
|
219
|
+
computed: {
|
|
220
|
+
formulaForView() {
|
|
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;
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
watch: {
|
|
236
|
+
filterText(val) {
|
|
237
|
+
this.$refs.fieldTree.filter(val);
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
data() {
|
|
241
|
+
return {
|
|
242
|
+
codeMirror: null,
|
|
243
|
+
formula: "",
|
|
244
|
+
tags: [], // 公式页签集合
|
|
245
|
+
fieldTreeData: [], // 设计器字段树
|
|
246
|
+
filterText: "",
|
|
247
|
+
formulaDialogVisible: false,
|
|
248
|
+
operate: [
|
|
249
|
+
"+",
|
|
250
|
+
"-",
|
|
251
|
+
"*",
|
|
252
|
+
"/",
|
|
253
|
+
"!=",
|
|
254
|
+
"==",
|
|
255
|
+
"<",
|
|
256
|
+
">",
|
|
257
|
+
"<=",
|
|
258
|
+
">=",
|
|
259
|
+
"(",
|
|
260
|
+
")",
|
|
261
|
+
",",
|
|
262
|
+
],
|
|
263
|
+
insertNum: 0,
|
|
264
|
+
insertStr: "",
|
|
265
|
+
activeNames: ["1"],
|
|
266
|
+
widgetSizes: [
|
|
267
|
+
{
|
|
268
|
+
label: this.i18nt("designer.hint.formulaSizeLarge"),
|
|
269
|
+
value: "large",
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
label: this.i18nt("designer.hint.formulaSizeMedium"),
|
|
273
|
+
value: "default",
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
label: this.i18nt("designer.hint.formulaSizeSmall"),
|
|
277
|
+
value: "small",
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
label: this.i18nt("designer.hint.formulaSizeMini"),
|
|
281
|
+
value: "small",
|
|
282
|
+
},
|
|
283
|
+
],
|
|
284
|
+
introTitle: this.i18nt("designer.hint.formulaFunctionExplain"),
|
|
285
|
+
introduction: {
|
|
286
|
+
title: this.i18nt("designer.hint.formulaPleaseSelect"),
|
|
287
|
+
content:
|
|
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>',
|
|
295
|
+
},
|
|
296
|
+
funcList: formulas,
|
|
297
|
+
funcActiveCollapseNames: [0],
|
|
298
|
+
};
|
|
299
|
+
},
|
|
300
|
+
mounted() {
|
|
301
|
+
},
|
|
302
|
+
methods: {
|
|
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
|
+
});
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
handleTableConfigData(widget, callback) {
|
|
359
|
+
callback(widget);
|
|
360
|
+
},
|
|
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;
|
|
369
|
+
},
|
|
370
|
+
loadFieldListToTree() {
|
|
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);
|
|
410
|
+
}
|
|
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);
|
|
431
|
+
}
|
|
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,
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
if (fieldNode.name !== this.optionModel.name) {
|
|
455
|
+
//排除当前设置公式字段
|
|
456
|
+
subFormNode.children.push(fieldNode);
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
this.fieldTreeData.push(subFormNode);
|
|
461
|
+
});
|
|
462
|
+
},
|
|
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");
|
|
470
|
+
}
|
|
471
|
+
},
|
|
472
|
+
|
|
473
|
+
// 插入符号
|
|
474
|
+
insertSymbol(opt) {
|
|
475
|
+
this.updateCodeMirror(opt, opt, null);
|
|
476
|
+
},
|
|
477
|
+
|
|
478
|
+
// 插入函数
|
|
479
|
+
insertFunction(opt) {
|
|
480
|
+
const val = opt.substring(0, opt.length - 1);
|
|
481
|
+
this.updateCodeMirror(val, val, "func");
|
|
482
|
+
},
|
|
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({
|
|
514
|
+
changes: {
|
|
515
|
+
from: this.codeMirror.state.selection.main.head,
|
|
516
|
+
to: this.codeMirror.state.selection.main.head,
|
|
517
|
+
insert: text,
|
|
518
|
+
},
|
|
519
|
+
selection: {
|
|
520
|
+
anchor: this.codeMirror.state.selection.main.head + text.length,
|
|
521
|
+
},
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
},
|
|
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);
|
|
540
|
+
},
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* 字段label可能在公式保存后再次被修改,当编辑公式时需要再次刷新公式中的字段label(不刷新也不会影响公式计算结果)
|
|
544
|
+
*/
|
|
545
|
+
refreshFormula() {
|
|
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
|
|
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
|
+
}
|
|
579
|
+
});
|
|
580
|
+
},
|
|
581
|
+
|
|
582
|
+
// 打开编辑公式弹窗
|
|
583
|
+
editFormula() {
|
|
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,
|
|
613
|
+
extensions: [
|
|
614
|
+
basicSetup,
|
|
615
|
+
javascript(),
|
|
616
|
+
[baseTheme, [], placeholders],
|
|
617
|
+
],
|
|
618
|
+
}),
|
|
619
|
+
parent: this.$refs.cmRef,
|
|
620
|
+
});
|
|
621
|
+
console.log("编辑器实例==>", this.codeMirror);
|
|
622
|
+
});
|
|
623
|
+
},
|
|
624
|
+
|
|
625
|
+
// 保存计算公式
|
|
626
|
+
saveFormula() {
|
|
627
|
+
this.optionModel.formula = this.codeMirror.state.doc.text.join("");
|
|
628
|
+
this.formulaDialogVisible = false;
|
|
629
|
+
},
|
|
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
|
+
}
|
|
647
|
+
},
|
|
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
|
+
}
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
// 没找到节点返回NULL
|
|
673
|
+
return null;
|
|
674
|
+
},
|
|
675
|
+
|
|
676
|
+
getClass(type) {
|
|
677
|
+
if (type === this.i18nt("designer.hint.formulaNumber")) {
|
|
678
|
+
return "warning";
|
|
679
|
+
}
|
|
680
|
+
if (type === this.i18nt("designer.hint.formulaChar")) {
|
|
681
|
+
return "";
|
|
682
|
+
}
|
|
683
|
+
if (type === this.i18nt("designer.hint.formulaObject")) {
|
|
684
|
+
return "danger";
|
|
685
|
+
}
|
|
686
|
+
},
|
|
687
|
+
|
|
688
|
+
resetIntro() {
|
|
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
|
+
};
|
|
697
|
+
},
|
|
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;
|
|
706
|
+
},
|
|
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]) {
|
|
721
|
+
case "(":
|
|
722
|
+
a[k] = i;
|
|
723
|
+
k++;
|
|
724
|
+
break;
|
|
725
|
+
case ")":
|
|
726
|
+
j = a[k - 1];
|
|
727
|
+
if (s[j] === "(") {
|
|
728
|
+
a[k] = 0;
|
|
729
|
+
k--;
|
|
730
|
+
} else {
|
|
731
|
+
flag = 0;
|
|
732
|
+
}
|
|
733
|
+
break;
|
|
734
|
+
case "{":
|
|
735
|
+
a[k] = i;
|
|
736
|
+
k++;
|
|
737
|
+
break;
|
|
738
|
+
case "}":
|
|
739
|
+
j = a[k - 1];
|
|
740
|
+
if (s[j] === "{") {
|
|
741
|
+
a[k] = 0;
|
|
742
|
+
k--;
|
|
743
|
+
} else {
|
|
744
|
+
flag = 0;
|
|
745
|
+
}
|
|
746
|
+
break;
|
|
747
|
+
case "[":
|
|
748
|
+
a[k] = i;
|
|
749
|
+
k++;
|
|
750
|
+
break;
|
|
751
|
+
case "]":
|
|
752
|
+
j = a[k - 1];
|
|
753
|
+
if (s[j] === "[") {
|
|
754
|
+
a[k] = 0;
|
|
755
|
+
k--;
|
|
756
|
+
} else {
|
|
757
|
+
flag = 0;
|
|
758
|
+
}
|
|
759
|
+
break;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
if (k !== 0) {
|
|
763
|
+
flag = 0;
|
|
764
|
+
}
|
|
765
|
+
return flag !== 0;
|
|
766
|
+
},
|
|
767
|
+
},
|
|
768
|
+
};
|
|
769
|
+
</script>
|
|
770
|
+
|
|
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
|
+
|
|
833
|
+
.group-item-left {
|
|
834
|
+
height: 350px;
|
|
835
|
+
border: 1px solid #ccc;
|
|
836
|
+
border-top-left-radius: 6px;
|
|
837
|
+
border-bottom-left-radius: 6px;
|
|
838
|
+
margin-bottom: 5px;
|
|
839
|
+
padding: 0;
|
|
840
|
+
width: 100%;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
.group-item-right-top {
|
|
844
|
+
height: 350px;
|
|
845
|
+
border: 1px solid #ccc;
|
|
846
|
+
border-radius: 0;
|
|
847
|
+
margin-bottom: 5px;
|
|
848
|
+
width: 100%;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
.group-item-right-bottom {
|
|
852
|
+
height: 350px;
|
|
853
|
+
border: 1px solid #ccc;
|
|
854
|
+
border-top-right-radius: 6px;
|
|
855
|
+
border-bottom-right-radius: 6px;
|
|
856
|
+
margin-bottom: 5px;
|
|
857
|
+
width: 100%;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
.item-header {
|
|
861
|
+
border-bottom: 1px solid #ccc;
|
|
862
|
+
height: 29px;
|
|
863
|
+
line-height: 29px;
|
|
864
|
+
padding-left: 15px;
|
|
865
|
+
font-weight: bold;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
.item-body-left {
|
|
869
|
+
height: 320px;
|
|
870
|
+
overflow-y: auto;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
.function-list {
|
|
874
|
+
height: 320px;
|
|
875
|
+
overflow-y: auto;
|
|
876
|
+
|
|
877
|
+
:deep(.el-collapse-item__header) {
|
|
878
|
+
font-weight: normal !important;
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
.item-body-right-bottom {
|
|
883
|
+
height: 152px;
|
|
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; */
|
|
971
|
+
}
|
|
972
|
+
</style>
|