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,397 +1,397 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="ds-list">
|
|
3
|
-
<template v-if="formConfig.dataSources && formConfig.dataSources.length">
|
|
4
|
-
<el-descriptions :column="1" size="small" border="" v-for="(dataSource, index) in formConfig.dataSources" :key="index">
|
|
5
|
-
<template slot="title">
|
|
6
|
-
<span title="">{{ dataSource.uniqueName }}</span>
|
|
7
|
-
</template>
|
|
8
|
-
<template slot="extra">
|
|
9
|
-
<el-button type="primary" icon="el-icon-edit" plain="" circle="" size="mini" @click="editDataSource(index)"></el-button>
|
|
10
|
-
<el-button type="danger" icon="el-icon-delete" plian="" circle="" size="mini" @click="deleteDataSource(index)"></el-button>
|
|
11
|
-
</template>
|
|
12
|
-
<el-descriptions-item>
|
|
13
|
-
<template slot="title">
|
|
14
|
-
<i title="a" class="el-icon-s-platform"></i>
|
|
15
|
-
</template>
|
|
16
|
-
{{ dataSource.requestURL }}
|
|
17
|
-
</el-descriptions-item>
|
|
18
|
-
</el-descriptions>
|
|
19
|
-
</template>
|
|
20
|
-
<template v-else>
|
|
21
|
-
<el-empty description="暂无数据源"></el-empty>
|
|
22
|
-
</template>
|
|
23
|
-
<div class="ds-button-wrapper"><el-button type="primary" icon="el-icon-plus" plain="" round="" @click="addDataSource">新增数据源</el-button></div>
|
|
24
|
-
<el-drawer
|
|
25
|
-
direction="rtl"
|
|
26
|
-
:modal="!0"
|
|
27
|
-
size="820"
|
|
28
|
-
:show-close="!1"
|
|
29
|
-
:visible.sync="showDataSourceDialogFlag"
|
|
30
|
-
:destroy-on-close="!0"
|
|
31
|
-
:append-to-body="!0"
|
|
32
|
-
:wrapperClosable="!1"
|
|
33
|
-
:close-on-press-escape="!1"
|
|
34
|
-
custom-class="ds-setting-drawer header-small-mb"
|
|
35
|
-
>
|
|
36
|
-
<template slot="title">
|
|
37
|
-
<span>数据源设置</span>
|
|
38
|
-
<div style="float: right;">
|
|
39
|
-
<el-button type="primary" @click="testDataSource" class="button-sty">测试数据源</el-button>
|
|
40
|
-
<el-button type="primary" @click="saveDataSource" class="button-sty" icon="el-icon-check">保存数据源</el-button>
|
|
41
|
-
<el-button type="primary" plain="" @click="showDataSourceDialogFlag = !1" class="button-sty" icon="el-icon-close">取消</el-button>
|
|
42
|
-
</div>
|
|
43
|
-
<!---->
|
|
44
|
-
</template>
|
|
45
|
-
<template slot="default">
|
|
46
|
-
<el-form ref="dsForm" class="ds-form" :model="dsModel" :rules="formRules" label-width="140px" label-position="right">
|
|
47
|
-
<el-form-item label="唯一名称" prop="uniqueName"><el-input v-model="dsModel.uniqueName"></el-input></el-form-item>
|
|
48
|
-
<el-row style="width: 100%;">
|
|
49
|
-
<el-col :span="20">
|
|
50
|
-
<el-form-item label="请求地址" prop="requestURL"><el-input v-model="dsModel.requestURL"></el-input></el-form-item>
|
|
51
|
-
</el-col>
|
|
52
|
-
<el-col :span="4">
|
|
53
|
-
<el-form-item class="no-left-margin" label-width="0" prop="requestaccessType">
|
|
54
|
-
<el-select v-model="dsModel.requestaccessType" placeholder="请求URL类型">
|
|
55
|
-
<el-option label="固定字符串" :value="'String'"></el-option>
|
|
56
|
-
<!-- <el-option label="变量或表达式" :value="'Variable'"></el-option> -->
|
|
57
|
-
<el-option label="SQL查询" :value="'SQL'"></el-option>
|
|
58
|
-
</el-select>
|
|
59
|
-
</el-form-item>
|
|
60
|
-
</el-col>
|
|
61
|
-
</el-row>
|
|
62
|
-
<el-form-item label="描述信息" prop="description"><el-input type="textarea" :row="2" v-model="dsModel.description"></el-input></el-form-item>
|
|
63
|
-
<el-form-item label="请求方法" prop="requestMethod" style="margin-top:6px">
|
|
64
|
-
<el-radio-group v-model="dsModel.requestMethod" size="small">
|
|
65
|
-
<el-radio-button label="get"></el-radio-button>
|
|
66
|
-
<el-radio-button label="post"></el-radio-button>
|
|
67
|
-
<el-radio-button label="put"></el-radio-button>
|
|
68
|
-
<el-radio-button label="delete"></el-radio-button>
|
|
69
|
-
</el-radio-group>
|
|
70
|
-
</el-form-item>
|
|
71
|
-
<el-form-item label="请求头(headers)">
|
|
72
|
-
<el-row v-for="(t, n) in dsModel.headers" :key="n" class="rh-row" :gutter="8">
|
|
73
|
-
<el-col :span="7">
|
|
74
|
-
<el-form-item :prop="'headers.' + n +'.name'" :rules="nameRules" label-width="0">
|
|
75
|
-
<el-input placeholder="名称" v-model="t.name"></el-input>
|
|
76
|
-
</el-form-item>
|
|
77
|
-
</el-col>
|
|
78
|
-
<el-col :span="5">
|
|
79
|
-
<el-form-item :prop="'headers.' + n +'.type'" label-width="0">
|
|
80
|
-
<el-select placeholder="类型" v-model="t.type">
|
|
81
|
-
<el-option label="字符串类型" :value="'String'"></el-option>
|
|
82
|
-
<el-option label="数值类型" :value="'Number'"></el-option>
|
|
83
|
-
<el-option label="布尔类型" :value="'Boolean'"></el-option>
|
|
84
|
-
<el-option label="变量或表达式" :value="'Variable'"></el-option>
|
|
85
|
-
<el-option label="表单数据" :value="'FormData'"></el-option>
|
|
86
|
-
</el-select>
|
|
87
|
-
</el-form-item>
|
|
88
|
-
</el-col>
|
|
89
|
-
<el-col :span="8">
|
|
90
|
-
<el-form-item :prop="'headers.' + n +'.value'" :rules="valueRules" label-width="0">
|
|
91
|
-
<el-input placeholder="值" v-model="t.value"></el-input>
|
|
92
|
-
</el-form-item>
|
|
93
|
-
</el-col>
|
|
94
|
-
<el-col :span="3"><el-button icon="el-icon-delete" plain="" circle="" @click="deleteRequestHeader(n)" size="mini"></el-button></el-col>
|
|
95
|
-
</el-row>
|
|
96
|
-
<el-row :span="6"><el-button type="text" icon="el-icon-plus" @click="addRequestHeader" class="button-sty">新增请求头</el-button></el-row>
|
|
97
|
-
</el-form-item>
|
|
98
|
-
<el-form-item label="参数(params)">
|
|
99
|
-
<el-row v-for="(t, n) in dsModel.params" :key="n" class="rh-row" :gutter="8">
|
|
100
|
-
<el-col :span="7">
|
|
101
|
-
<el-form-item :prop="'params.' + n +'.name'" :rules="nameRules" label-width="0">
|
|
102
|
-
<el-input placeholder="名称" v-model="t.name"></el-input>
|
|
103
|
-
</el-form-item>
|
|
104
|
-
</el-col>
|
|
105
|
-
<el-col :span="5">
|
|
106
|
-
<el-form-item :prop="'params.' + n +'.type'" label-width="0">
|
|
107
|
-
<el-select placeholder="类型" v-model="t.type">
|
|
108
|
-
<el-option label="字符串类型" :value="'String'"></el-option>
|
|
109
|
-
<el-option label="数值类型" :value="'Number'"></el-option>
|
|
110
|
-
<el-option label="布尔类型" :value="'Boolean'"></el-option>
|
|
111
|
-
<el-option label="变量或表达式" :value="'Variable'"></el-option>
|
|
112
|
-
<el-option label="表单数据" :value="'FormData'"></el-option>
|
|
113
|
-
</el-select>
|
|
114
|
-
</el-form-item>
|
|
115
|
-
</el-col>
|
|
116
|
-
<el-col :span="8">
|
|
117
|
-
<el-form-item :prop="'params.' + n +'.value'" :rules="valueRules" label-width="0">
|
|
118
|
-
<el-input placeholder="值" v-model="t.value"></el-input>
|
|
119
|
-
</el-form-item>
|
|
120
|
-
</el-col>
|
|
121
|
-
<el-col :span="3"><el-button icon="el-icon-delete" plain="" circle="" @click="deleteRequestParam(n)" size="mini"></el-button></el-col>
|
|
122
|
-
</el-row>
|
|
123
|
-
<el-row :span="6"><el-button type="text" icon="el-icon-plus" @click="addRequestParam" class="button-sty">新增请求参数</el-button></el-row>
|
|
124
|
-
</el-form-item>
|
|
125
|
-
<el-form-item label="发送数据(data)">
|
|
126
|
-
<el-row v-for="(t, n) in dsModel.data" :key="n" class="rh-row" :gutter="8">
|
|
127
|
-
<el-col :span="7">
|
|
128
|
-
<el-form-item :prop="'data.' + n +'.name'" :rules="nameRules" label-width="0">
|
|
129
|
-
<el-input placeholder="名称" v-model="t.name"></el-input>
|
|
130
|
-
</el-form-item>
|
|
131
|
-
</el-col>
|
|
132
|
-
<el-col :span="5">
|
|
133
|
-
<el-form-item :prop="'data.' + n +'.type'" label-width="0">
|
|
134
|
-
<el-select placeholder="类型" v-model="t.type">
|
|
135
|
-
<el-option label="字符串类型" :value="'String'"></el-option>
|
|
136
|
-
<el-option label="数值类型" :value="'Number'"></el-option>
|
|
137
|
-
<el-option label="布尔类型" :value="'Boolean'"></el-option>
|
|
138
|
-
<el-option label="变量或表达式" :value="'Variable'"></el-option>
|
|
139
|
-
<el-option label="表单数据" :value="'FormData'"></el-option>
|
|
140
|
-
</el-select>
|
|
141
|
-
</el-form-item>
|
|
142
|
-
</el-col>
|
|
143
|
-
<el-col :span="8">
|
|
144
|
-
<el-form-item :prop="'data.' + n +'.value'" :rules="valueRules" label-width="0">
|
|
145
|
-
<el-input placeholder="值" v-model="t.value"></el-input>
|
|
146
|
-
</el-form-item>
|
|
147
|
-
</el-col>
|
|
148
|
-
<el-col :span="3"><el-button icon="el-icon-delete" plain="" circle="" @click="deleteRequestData(n)" size="mini"></el-button></el-col>
|
|
149
|
-
</el-row>
|
|
150
|
-
<el-row :span="6"><el-button type="text" icon="el-icon-plus" @click="addRequestData" class="button-sty">新增发送数据</el-button></el-row>
|
|
151
|
-
</el-form-item>
|
|
152
|
-
<el-collapse v-model="activeNames">
|
|
153
|
-
<el-collapse-item class="ch-collapse" title="请求配置" name="1">
|
|
154
|
-
<el-alert type="info" :closable="!1" title="(config, isSandbox, DSV, VFR) => {"></el-alert>
|
|
155
|
-
<code-editor ref="chEditor" mode="javascript" :readonly="!1" v-model="dsModel.configHandlerCode"></code-editor>
|
|
156
|
-
<el-alert type="info" :closable="!1" title="}"></el-alert>
|
|
157
|
-
</el-collapse-item>
|
|
158
|
-
<el-collapse-item class="ch-collapse" title="数据处理" name="2">
|
|
159
|
-
<el-alert type="info" :closable="!1" title="(result, isSandbox, DSV, VFR) => {"></el-alert>
|
|
160
|
-
<code-editor ref="dhEditor" mode="javascript" :readonly="!1" v-model="dsModel.dataHandlerCode"></code-editor>
|
|
161
|
-
<el-alert type="info" :closable="!1" title="}"></el-alert>
|
|
162
|
-
</el-collapse-item>
|
|
163
|
-
<el-collapse-item class="ch-collapse" title="错误处理" name="3">
|
|
164
|
-
<el-alert type="info" :closable="!1" title="(error, isSandbox, DSV, $message, VFR) => {"></el-alert>
|
|
165
|
-
<code-editor ref="ehEditor" mode="javascript" :readonly="!1" v-model="dsModel.errorHandlerCode"></code-editor>
|
|
166
|
-
<el-alert type="info" :closable="!1" title="}"></el-alert>
|
|
167
|
-
</el-collapse-item>
|
|
168
|
-
<!-- <el-collapse-item class="ch-collapse" title="执行SQL" name="4">
|
|
169
|
-
<code-editor ref="sqlEditor" mode="javascript" :readonly="!4" v-model="dsModel.sqlHandlerCode"></code-editor>
|
|
170
|
-
</el-collapse-item> -->
|
|
171
|
-
</el-collapse>
|
|
172
|
-
<!-- <el-form-item label="唯一名称" prop="uniqueName">
|
|
173
|
-
|
|
174
|
-
</el-form-item>
|
|
175
|
-
<el-form-item label="唯一名称" prop="uniqueName">
|
|
176
|
-
|
|
177
|
-
</el-form-item> -->
|
|
178
|
-
</el-form>
|
|
179
|
-
</template>
|
|
180
|
-
</el-drawer>
|
|
181
|
-
</div>
|
|
182
|
-
</template>
|
|
183
|
-
|
|
184
|
-
<script>
|
|
185
|
-
import i18n from '../../../../components/xform/utils/i18n';
|
|
186
|
-
import { deepClone, generateId,runDataSourceRequest } from '../../../../components/xform/utils/util';
|
|
187
|
-
import regeneratorRuntime from "regenerator-runtime";
|
|
188
|
-
|
|
189
|
-
export default {
|
|
190
|
-
name: 'data-source-setting',
|
|
191
|
-
mixins: [i18n],
|
|
192
|
-
inject: ['getGlobalDsv'],
|
|
193
|
-
components: { },
|
|
194
|
-
props: {
|
|
195
|
-
designer: Object,
|
|
196
|
-
formConfig: Object
|
|
197
|
-
},
|
|
198
|
-
data: function() {
|
|
199
|
-
return {
|
|
200
|
-
activeNames: ['2'],
|
|
201
|
-
dsModel: {
|
|
202
|
-
dataSourceId: null,
|
|
203
|
-
uniqueName: '',
|
|
204
|
-
requestURL: '',
|
|
205
|
-
requestaccessType: 'String',
|
|
206
|
-
description: '',
|
|
207
|
-
headers: [],
|
|
208
|
-
params: [],
|
|
209
|
-
data: [],
|
|
210
|
-
requestMethod: 'get',
|
|
211
|
-
configHandlerCode: ' return config',
|
|
212
|
-
dataHandlerCode: ' return result.data.data;',
|
|
213
|
-
// errorHandlerCode: ' $message.error(error.message);',
|
|
214
|
-
errorHandlerCode: ''
|
|
215
|
-
},
|
|
216
|
-
curEditDSIdx: -1,
|
|
217
|
-
formRules: {
|
|
218
|
-
uniqueName: [
|
|
219
|
-
{
|
|
220
|
-
required: !0,
|
|
221
|
-
trigger: ['blur', 'change'],
|
|
222
|
-
message: this.i18nt('designer.setting.fieldValueRequired')
|
|
223
|
-
}
|
|
224
|
-
],
|
|
225
|
-
requestURL: [
|
|
226
|
-
{
|
|
227
|
-
required: !0,
|
|
228
|
-
trigger: ['blur', 'change'],
|
|
229
|
-
message: this.i18nt('designer.setting.fieldValueRequired')
|
|
230
|
-
}
|
|
231
|
-
],
|
|
232
|
-
requestMethod: [
|
|
233
|
-
{
|
|
234
|
-
required: !0,
|
|
235
|
-
trigger: ['blur', 'change'],
|
|
236
|
-
message: this.i18nt('designer.setting.fieldValueRequired')
|
|
237
|
-
}
|
|
238
|
-
]
|
|
239
|
-
},
|
|
240
|
-
nameRules: [
|
|
241
|
-
{
|
|
242
|
-
required: !0,
|
|
243
|
-
trigger: ['blur', 'change'],
|
|
244
|
-
message: this.i18nt('designer.setting.fieldValueRequired')
|
|
245
|
-
}
|
|
246
|
-
],
|
|
247
|
-
valueRules: [
|
|
248
|
-
{
|
|
249
|
-
required: !0,
|
|
250
|
-
trigger: ['blur', 'change'],
|
|
251
|
-
message: this.i18nt('designer.setting.fieldValueRequired')
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
validator: this.validateValueInput,
|
|
255
|
-
trigger: ['blur', 'change']
|
|
256
|
-
}
|
|
257
|
-
],
|
|
258
|
-
showDataSourceDialogFlag: !1,
|
|
259
|
-
dsvJson: '{\n \n}',
|
|
260
|
-
dsResultJson: '',
|
|
261
|
-
showTestDataSourceDialogFlag: !1
|
|
262
|
-
};
|
|
263
|
-
},
|
|
264
|
-
methods: {
|
|
265
|
-
validateValueInput: function(e, t, i) {
|
|
266
|
-
var n = e.field,
|
|
267
|
-
o = n.substring(0, n.indexOf('.')),
|
|
268
|
-
a = Number(n.substring(n.indexOf('.') + 1, n.lastIndexOf('.'))),
|
|
269
|
-
l = this.dsModel[o][a].type;
|
|
270
|
-
'Number' === l
|
|
271
|
-
? isNaN(t)
|
|
272
|
-
? i(new Error(this.i18nt('designer.setting.dsRequestNumberTypeError')))
|
|
273
|
-
: i()
|
|
274
|
-
: 'Boolean' === l
|
|
275
|
-
? 'true' === t.toLowerCase() || 'false' === t.toLowerCase() || 'null' === t.toLowerCase() || '1' === t || '0' === t
|
|
276
|
-
? i()
|
|
277
|
-
: i(new Error(this.i18nt('designer.setting.dsRequestBooleanTypeError')))
|
|
278
|
-
: i();
|
|
279
|
-
},
|
|
280
|
-
addDataSource: function() {
|
|
281
|
-
(this.curEditDSIdx = -1),
|
|
282
|
-
// (this.dsModel = deepClone(this.dsModel)),
|
|
283
|
-
(this.dsModel = deepClone(this.dsModel)),
|
|
284
|
-
(this.dsModel.dataSourceId = null),
|
|
285
|
-
(this.dsModel.uniqueName = ''),
|
|
286
|
-
(this.dsModel.requestURL = ''),
|
|
287
|
-
(this.dsModel.requestaccessType = 'String'),
|
|
288
|
-
(this.dsModel.requestMethod = 'get'),
|
|
289
|
-
(this.dsModel.description = ''),
|
|
290
|
-
this.dsModel.headers.splice(0, this.dsModel.headers.length),
|
|
291
|
-
this.dsModel.params.splice(0, this.dsModel.params.length),
|
|
292
|
-
this.dsModel.data.splice(0, this.dsModel.data.length),
|
|
293
|
-
(this.dsModel.configHandlerCode = ' return config'),
|
|
294
|
-
(this.dsModel.dataHandlerCode = ' return result.data.data;'),
|
|
295
|
-
// (this.dsModel.errorHandlerCode = ' $message.error(error.message);'),
|
|
296
|
-
(this.dsModel.errorHandlerCode = ''),
|
|
297
|
-
(this.showDataSourceDialogFlag = !0);
|
|
298
|
-
},
|
|
299
|
-
editDataSource: function(e) {
|
|
300
|
-
(this.dsModel = deepClone(this.formConfig.dataSources[e])), (this.curEditDSIdx = e), (this.showDataSourceDialogFlag = !0);
|
|
301
|
-
},
|
|
302
|
-
saveDataSource: function() {
|
|
303
|
-
var e = this;
|
|
304
|
-
console.log('dsModel is: ', this.dsModel),
|
|
305
|
-
this.$refs['dsForm'].validate(function(t, i) {
|
|
306
|
-
if (t) {
|
|
307
|
-
e.dsModel.dataSourceId = e.dsModel.dataSourceId || 'ds' + generateId();
|
|
308
|
-
|
|
309
|
-
var n = e.dsModel.dataSourceId,
|
|
310
|
-
o = e.dsModel.uniqueName,
|
|
311
|
-
a = !1;
|
|
312
|
-
e.formConfig.dataSources.map(function(e) {
|
|
313
|
-
e.uniqueName === o && e.dataSourceId !== n && (a = !0);
|
|
314
|
-
}),
|
|
315
|
-
a
|
|
316
|
-
? e.$message.error(e.i18nt('designer.setting.dsDuplicatedNameError'))
|
|
317
|
-
: e.curEditDSIdx >= 0
|
|
318
|
-
? (e.formConfig.dataSources.splice(e.curEditDSIdx, 1, deepClone(e.dsModel)), (e.showDataSourceDialogFlag = !1))
|
|
319
|
-
: (e.formConfig.dataSources.push(e.dsModel), (e.showDataSourceDialogFlag = !1));
|
|
320
|
-
} else e.$message.error(e.i18nt('designer.setting.dsValidationError'));
|
|
321
|
-
});
|
|
322
|
-
},
|
|
323
|
-
deleteDataSource: function(e) {
|
|
324
|
-
var t = this;
|
|
325
|
-
this.$confirm(this.i18nt('designer.setting.deleteDataSourceHint'), this.i18nt('render.hint.prompt'), {
|
|
326
|
-
confirmButtonText: this.i18nt('render.hint.confirm'),
|
|
327
|
-
cancelButtonText: this.i18nt('render.hint.cancel')
|
|
328
|
-
})
|
|
329
|
-
.then(function() {
|
|
330
|
-
t.formConfig.dataSources.splice(e, 1);
|
|
331
|
-
})
|
|
332
|
-
.catch(function(e) {
|
|
333
|
-
console.error(e);
|
|
334
|
-
});
|
|
335
|
-
},
|
|
336
|
-
addRequestHeader: function() {
|
|
337
|
-
this.dsModel.headers.push({
|
|
338
|
-
name: '',
|
|
339
|
-
type: 'String',
|
|
340
|
-
value: ''
|
|
341
|
-
});
|
|
342
|
-
},
|
|
343
|
-
deleteRequestHeader: function(e) {
|
|
344
|
-
this.dsModel.headers.splice(e, 1);
|
|
345
|
-
},
|
|
346
|
-
addRequestParam: function() {
|
|
347
|
-
this.dsModel.params.push({
|
|
348
|
-
name: '',
|
|
349
|
-
type: 'String',
|
|
350
|
-
value: ''
|
|
351
|
-
});
|
|
352
|
-
},
|
|
353
|
-
deleteRequestParam: function(e) {
|
|
354
|
-
this.dsModel.params.splice(e, 1);
|
|
355
|
-
},
|
|
356
|
-
addRequestData: function() {
|
|
357
|
-
this.dsModel.data.push({
|
|
358
|
-
name: '',
|
|
359
|
-
type: 'String',
|
|
360
|
-
value: ''
|
|
361
|
-
});
|
|
362
|
-
},
|
|
363
|
-
deleteRequestData: function(e) {
|
|
364
|
-
this.dsModel.data.splice(e, 1);
|
|
365
|
-
},
|
|
366
|
-
testDataSource: function() {
|
|
367
|
-
var e = this.getGlobalDsv() || {};
|
|
368
|
-
(this.dsvJson = JSON.stringify(e, null, ' ')), (this.showTestDataSourceDialogFlag = !0);
|
|
369
|
-
},
|
|
370
|
-
doDataSourceRequest: function() {
|
|
371
|
-
var e = this;
|
|
372
|
-
return Object(ie['a'])(
|
|
373
|
-
regeneratorRuntime.mark(function t() {
|
|
374
|
-
var i, n;
|
|
375
|
-
return regeneratorRuntime.wrap(function(t) {
|
|
376
|
-
while (1)
|
|
377
|
-
switch ((t.prev = t.next)) {
|
|
378
|
-
case 0:
|
|
379
|
-
return (i = JSON.parse(e.dsvJson)), (t.next = 3), runDataSourceRequest(e.dsModel, i, null, !0, e.$message);
|
|
380
|
-
case 3:
|
|
381
|
-
(n = t.sent), e.$refs.dsResultEditor.setValue(JSON.stringify(n, null, ' '));
|
|
382
|
-
case 5:
|
|
383
|
-
case 'end':
|
|
384
|
-
return t.stop();
|
|
385
|
-
}
|
|
386
|
-
}, t);
|
|
387
|
-
})
|
|
388
|
-
)();
|
|
389
|
-
},
|
|
390
|
-
clearRequestResult: function() {
|
|
391
|
-
this.$refs.dsResultEditor.setValue('');
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
};
|
|
395
|
-
</script>
|
|
396
|
-
|
|
397
|
-
<style></style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ds-list">
|
|
3
|
+
<template v-if="formConfig.dataSources && formConfig.dataSources.length">
|
|
4
|
+
<el-descriptions :column="1" size="small" border="" v-for="(dataSource, index) in formConfig.dataSources" :key="index">
|
|
5
|
+
<template slot="title">
|
|
6
|
+
<span title="">{{ dataSource.uniqueName }}</span>
|
|
7
|
+
</template>
|
|
8
|
+
<template slot="extra">
|
|
9
|
+
<el-button type="primary" icon="el-icon-edit" plain="" circle="" size="mini" @click="editDataSource(index)"></el-button>
|
|
10
|
+
<el-button type="danger" icon="el-icon-delete" plian="" circle="" size="mini" @click="deleteDataSource(index)"></el-button>
|
|
11
|
+
</template>
|
|
12
|
+
<el-descriptions-item>
|
|
13
|
+
<template slot="title">
|
|
14
|
+
<i title="a" class="el-icon-s-platform"></i>
|
|
15
|
+
</template>
|
|
16
|
+
{{ dataSource.requestURL }}
|
|
17
|
+
</el-descriptions-item>
|
|
18
|
+
</el-descriptions>
|
|
19
|
+
</template>
|
|
20
|
+
<template v-else>
|
|
21
|
+
<el-empty description="暂无数据源"></el-empty>
|
|
22
|
+
</template>
|
|
23
|
+
<div class="ds-button-wrapper"><el-button type="primary" icon="el-icon-plus" plain="" round="" @click="addDataSource">新增数据源</el-button></div>
|
|
24
|
+
<el-drawer
|
|
25
|
+
direction="rtl"
|
|
26
|
+
:modal="!0"
|
|
27
|
+
size="820"
|
|
28
|
+
:show-close="!1"
|
|
29
|
+
:visible.sync="showDataSourceDialogFlag"
|
|
30
|
+
:destroy-on-close="!0"
|
|
31
|
+
:append-to-body="!0"
|
|
32
|
+
:wrapperClosable="!1"
|
|
33
|
+
:close-on-press-escape="!1"
|
|
34
|
+
custom-class="ds-setting-drawer header-small-mb"
|
|
35
|
+
>
|
|
36
|
+
<template slot="title">
|
|
37
|
+
<span>数据源设置</span>
|
|
38
|
+
<div style="float: right;">
|
|
39
|
+
<el-button type="primary" @click="testDataSource" class="button-sty">测试数据源</el-button>
|
|
40
|
+
<el-button type="primary" @click="saveDataSource" class="button-sty" icon="el-icon-check">保存数据源</el-button>
|
|
41
|
+
<el-button type="primary" plain="" @click="showDataSourceDialogFlag = !1" class="button-sty" icon="el-icon-close">取消</el-button>
|
|
42
|
+
</div>
|
|
43
|
+
<!---->
|
|
44
|
+
</template>
|
|
45
|
+
<template slot="default">
|
|
46
|
+
<el-form ref="dsForm" class="ds-form" :model="dsModel" :rules="formRules" label-width="140px" label-position="right">
|
|
47
|
+
<el-form-item class="form-item-label-top" label="唯一名称" prop="uniqueName"><el-input v-model="dsModel.uniqueName"></el-input></el-form-item>
|
|
48
|
+
<el-row style="width: 100%;">
|
|
49
|
+
<el-col :span="20">
|
|
50
|
+
<el-form-item class="form-item-label-top" label="请求地址" prop="requestURL"><el-input v-model="dsModel.requestURL"></el-input></el-form-item>
|
|
51
|
+
</el-col>
|
|
52
|
+
<el-col :span="4">
|
|
53
|
+
<el-form-item class="no-left-margin form-item-label-top" label-width="0" prop="requestaccessType">
|
|
54
|
+
<el-select v-model="dsModel.requestaccessType" placeholder="请求URL类型">
|
|
55
|
+
<el-option label="固定字符串" :value="'String'"></el-option>
|
|
56
|
+
<!-- <el-option label="变量或表达式" :value="'Variable'"></el-option> -->
|
|
57
|
+
<el-option label="SQL查询" :value="'SQL'"></el-option>
|
|
58
|
+
</el-select>
|
|
59
|
+
</el-form-item>
|
|
60
|
+
</el-col>
|
|
61
|
+
</el-row>
|
|
62
|
+
<el-form-item class="form-item-label-top" label="描述信息" prop="description"><el-input type="textarea" :row="2" v-model="dsModel.description"></el-input></el-form-item>
|
|
63
|
+
<el-form-item label="请求方法" prop="requestMethod" style="margin-top:6px">
|
|
64
|
+
<el-radio-group v-model="dsModel.requestMethod" size="small">
|
|
65
|
+
<el-radio-button label="get"></el-radio-button>
|
|
66
|
+
<el-radio-button label="post"></el-radio-button>
|
|
67
|
+
<el-radio-button label="put"></el-radio-button>
|
|
68
|
+
<el-radio-button label="delete"></el-radio-button>
|
|
69
|
+
</el-radio-group>
|
|
70
|
+
</el-form-item>
|
|
71
|
+
<el-form-item class="form-item-label-top" label="请求头(headers)">
|
|
72
|
+
<el-row v-for="(t, n) in dsModel.headers" :key="n" class="rh-row" :gutter="8">
|
|
73
|
+
<el-col :span="7">
|
|
74
|
+
<el-form-item class="form-item-label-top" :prop="'headers.' + n +'.name'" :rules="nameRules" label-width="0">
|
|
75
|
+
<el-input placeholder="名称" v-model="t.name"></el-input>
|
|
76
|
+
</el-form-item>
|
|
77
|
+
</el-col>
|
|
78
|
+
<el-col :span="5">
|
|
79
|
+
<el-form-item class="form-item-label-top" :prop="'headers.' + n +'.type'" label-width="0">
|
|
80
|
+
<el-select placeholder="类型" v-model="t.type">
|
|
81
|
+
<el-option label="字符串类型" :value="'String'"></el-option>
|
|
82
|
+
<el-option label="数值类型" :value="'Number'"></el-option>
|
|
83
|
+
<el-option label="布尔类型" :value="'Boolean'"></el-option>
|
|
84
|
+
<el-option label="变量或表达式" :value="'Variable'"></el-option>
|
|
85
|
+
<el-option label="表单数据" :value="'FormData'"></el-option>
|
|
86
|
+
</el-select>
|
|
87
|
+
</el-form-item>
|
|
88
|
+
</el-col>
|
|
89
|
+
<el-col :span="8">
|
|
90
|
+
<el-form-item class="form-item-label-top" :prop="'headers.' + n +'.value'" :rules="valueRules" label-width="0">
|
|
91
|
+
<el-input placeholder="值" v-model="t.value"></el-input>
|
|
92
|
+
</el-form-item>
|
|
93
|
+
</el-col>
|
|
94
|
+
<el-col :span="3"><el-button icon="el-icon-delete" plain="" circle="" @click="deleteRequestHeader(n)" size="mini"></el-button></el-col>
|
|
95
|
+
</el-row>
|
|
96
|
+
<el-row :span="6"><el-button type="text" icon="el-icon-plus" @click="addRequestHeader" class="button-sty">新增请求头</el-button></el-row>
|
|
97
|
+
</el-form-item>
|
|
98
|
+
<el-form-item class="form-item-label-top" label="参数(params)">
|
|
99
|
+
<el-row v-for="(t, n) in dsModel.params" :key="n" class="rh-row" :gutter="8">
|
|
100
|
+
<el-col :span="7">
|
|
101
|
+
<el-form-item class="form-item-label-top" :prop="'params.' + n +'.name'" :rules="nameRules" label-width="0">
|
|
102
|
+
<el-input placeholder="名称" v-model="t.name"></el-input>
|
|
103
|
+
</el-form-item>
|
|
104
|
+
</el-col>
|
|
105
|
+
<el-col :span="5">
|
|
106
|
+
<el-form-item class="form-item-label-top" :prop="'params.' + n +'.type'" label-width="0">
|
|
107
|
+
<el-select placeholder="类型" v-model="t.type">
|
|
108
|
+
<el-option label="字符串类型" :value="'String'"></el-option>
|
|
109
|
+
<el-option label="数值类型" :value="'Number'"></el-option>
|
|
110
|
+
<el-option label="布尔类型" :value="'Boolean'"></el-option>
|
|
111
|
+
<el-option label="变量或表达式" :value="'Variable'"></el-option>
|
|
112
|
+
<el-option label="表单数据" :value="'FormData'"></el-option>
|
|
113
|
+
</el-select>
|
|
114
|
+
</el-form-item>
|
|
115
|
+
</el-col>
|
|
116
|
+
<el-col :span="8">
|
|
117
|
+
<el-form-item class="form-item-label-top" :prop="'params.' + n +'.value'" :rules="valueRules" label-width="0">
|
|
118
|
+
<el-input placeholder="值" v-model="t.value"></el-input>
|
|
119
|
+
</el-form-item>
|
|
120
|
+
</el-col>
|
|
121
|
+
<el-col :span="3"><el-button icon="el-icon-delete" plain="" circle="" @click="deleteRequestParam(n)" size="mini"></el-button></el-col>
|
|
122
|
+
</el-row>
|
|
123
|
+
<el-row :span="6"><el-button type="text" icon="el-icon-plus" @click="addRequestParam" class="button-sty">新增请求参数</el-button></el-row>
|
|
124
|
+
</el-form-item>
|
|
125
|
+
<el-form-item class="form-item-label-top" label="发送数据(data)">
|
|
126
|
+
<el-row v-for="(t, n) in dsModel.data" :key="n" class="rh-row" :gutter="8">
|
|
127
|
+
<el-col :span="7">
|
|
128
|
+
<el-form-item class="form-item-label-top" :prop="'data.' + n +'.name'" :rules="nameRules" label-width="0">
|
|
129
|
+
<el-input placeholder="名称" v-model="t.name"></el-input>
|
|
130
|
+
</el-form-item>
|
|
131
|
+
</el-col>
|
|
132
|
+
<el-col :span="5">
|
|
133
|
+
<el-form-item class="form-item-label-top" :prop="'data.' + n +'.type'" label-width="0">
|
|
134
|
+
<el-select placeholder="类型" v-model="t.type">
|
|
135
|
+
<el-option label="字符串类型" :value="'String'"></el-option>
|
|
136
|
+
<el-option label="数值类型" :value="'Number'"></el-option>
|
|
137
|
+
<el-option label="布尔类型" :value="'Boolean'"></el-option>
|
|
138
|
+
<el-option label="变量或表达式" :value="'Variable'"></el-option>
|
|
139
|
+
<el-option label="表单数据" :value="'FormData'"></el-option>
|
|
140
|
+
</el-select>
|
|
141
|
+
</el-form-item>
|
|
142
|
+
</el-col>
|
|
143
|
+
<el-col :span="8">
|
|
144
|
+
<el-form-item class="form-item-label-top" :prop="'data.' + n +'.value'" :rules="valueRules" label-width="0">
|
|
145
|
+
<el-input placeholder="值" v-model="t.value"></el-input>
|
|
146
|
+
</el-form-item>
|
|
147
|
+
</el-col>
|
|
148
|
+
<el-col :span="3"><el-button icon="el-icon-delete" plain="" circle="" @click="deleteRequestData(n)" size="mini"></el-button></el-col>
|
|
149
|
+
</el-row>
|
|
150
|
+
<el-row :span="6"><el-button type="text" icon="el-icon-plus" @click="addRequestData" class="button-sty">新增发送数据</el-button></el-row>
|
|
151
|
+
</el-form-item>
|
|
152
|
+
<el-collapse v-model="activeNames">
|
|
153
|
+
<el-collapse-item class="ch-collapse" title="请求配置" name="1">
|
|
154
|
+
<el-alert type="info" :closable="!1" title="(config, isSandbox, DSV, VFR) => {"></el-alert>
|
|
155
|
+
<code-editor ref="chEditor" mode="javascript" :readonly="!1" v-model="dsModel.configHandlerCode"></code-editor>
|
|
156
|
+
<el-alert type="info" :closable="!1" title="}"></el-alert>
|
|
157
|
+
</el-collapse-item>
|
|
158
|
+
<el-collapse-item class="ch-collapse" title="数据处理" name="2">
|
|
159
|
+
<el-alert type="info" :closable="!1" title="(result, isSandbox, DSV, VFR) => {"></el-alert>
|
|
160
|
+
<code-editor ref="dhEditor" mode="javascript" :readonly="!1" v-model="dsModel.dataHandlerCode"></code-editor>
|
|
161
|
+
<el-alert type="info" :closable="!1" title="}"></el-alert>
|
|
162
|
+
</el-collapse-item>
|
|
163
|
+
<el-collapse-item class="ch-collapse" title="错误处理" name="3">
|
|
164
|
+
<el-alert type="info" :closable="!1" title="(error, isSandbox, DSV, $message, VFR) => {"></el-alert>
|
|
165
|
+
<code-editor ref="ehEditor" mode="javascript" :readonly="!1" v-model="dsModel.errorHandlerCode"></code-editor>
|
|
166
|
+
<el-alert type="info" :closable="!1" title="}"></el-alert>
|
|
167
|
+
</el-collapse-item>
|
|
168
|
+
<!-- <el-collapse-item class="ch-collapse" title="执行SQL" name="4">
|
|
169
|
+
<code-editor ref="sqlEditor" mode="javascript" :readonly="!4" v-model="dsModel.sqlHandlerCode"></code-editor>
|
|
170
|
+
</el-collapse-item> -->
|
|
171
|
+
</el-collapse>
|
|
172
|
+
<!-- <el-form-item label="唯一名称" prop="uniqueName">
|
|
173
|
+
|
|
174
|
+
</el-form-item>
|
|
175
|
+
<el-form-item label="唯一名称" prop="uniqueName">
|
|
176
|
+
|
|
177
|
+
</el-form-item> -->
|
|
178
|
+
</el-form>
|
|
179
|
+
</template>
|
|
180
|
+
</el-drawer>
|
|
181
|
+
</div>
|
|
182
|
+
</template>
|
|
183
|
+
|
|
184
|
+
<script>
|
|
185
|
+
import i18n from '../../../../components/xform/utils/i18n';
|
|
186
|
+
import { deepClone, generateId,runDataSourceRequest } from '../../../../components/xform/utils/util';
|
|
187
|
+
import regeneratorRuntime from "regenerator-runtime";
|
|
188
|
+
|
|
189
|
+
export default {
|
|
190
|
+
name: 'data-source-setting',
|
|
191
|
+
mixins: [i18n],
|
|
192
|
+
inject: ['getGlobalDsv'],
|
|
193
|
+
components: { },
|
|
194
|
+
props: {
|
|
195
|
+
designer: Object,
|
|
196
|
+
formConfig: Object
|
|
197
|
+
},
|
|
198
|
+
data: function() {
|
|
199
|
+
return {
|
|
200
|
+
activeNames: ['2'],
|
|
201
|
+
dsModel: {
|
|
202
|
+
dataSourceId: null,
|
|
203
|
+
uniqueName: '',
|
|
204
|
+
requestURL: '',
|
|
205
|
+
requestaccessType: 'String',
|
|
206
|
+
description: '',
|
|
207
|
+
headers: [],
|
|
208
|
+
params: [],
|
|
209
|
+
data: [],
|
|
210
|
+
requestMethod: 'get',
|
|
211
|
+
configHandlerCode: ' return config',
|
|
212
|
+
dataHandlerCode: ' return result.data.data;',
|
|
213
|
+
// errorHandlerCode: ' $message.error(error.message);',
|
|
214
|
+
errorHandlerCode: ''
|
|
215
|
+
},
|
|
216
|
+
curEditDSIdx: -1,
|
|
217
|
+
formRules: {
|
|
218
|
+
uniqueName: [
|
|
219
|
+
{
|
|
220
|
+
required: !0,
|
|
221
|
+
trigger: ['blur', 'change'],
|
|
222
|
+
message: this.i18nt('designer.setting.fieldValueRequired')
|
|
223
|
+
}
|
|
224
|
+
],
|
|
225
|
+
requestURL: [
|
|
226
|
+
{
|
|
227
|
+
required: !0,
|
|
228
|
+
trigger: ['blur', 'change'],
|
|
229
|
+
message: this.i18nt('designer.setting.fieldValueRequired')
|
|
230
|
+
}
|
|
231
|
+
],
|
|
232
|
+
requestMethod: [
|
|
233
|
+
{
|
|
234
|
+
required: !0,
|
|
235
|
+
trigger: ['blur', 'change'],
|
|
236
|
+
message: this.i18nt('designer.setting.fieldValueRequired')
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
},
|
|
240
|
+
nameRules: [
|
|
241
|
+
{
|
|
242
|
+
required: !0,
|
|
243
|
+
trigger: ['blur', 'change'],
|
|
244
|
+
message: this.i18nt('designer.setting.fieldValueRequired')
|
|
245
|
+
}
|
|
246
|
+
],
|
|
247
|
+
valueRules: [
|
|
248
|
+
{
|
|
249
|
+
required: !0,
|
|
250
|
+
trigger: ['blur', 'change'],
|
|
251
|
+
message: this.i18nt('designer.setting.fieldValueRequired')
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
validator: this.validateValueInput,
|
|
255
|
+
trigger: ['blur', 'change']
|
|
256
|
+
}
|
|
257
|
+
],
|
|
258
|
+
showDataSourceDialogFlag: !1,
|
|
259
|
+
dsvJson: '{\n \n}',
|
|
260
|
+
dsResultJson: '',
|
|
261
|
+
showTestDataSourceDialogFlag: !1
|
|
262
|
+
};
|
|
263
|
+
},
|
|
264
|
+
methods: {
|
|
265
|
+
validateValueInput: function(e, t, i) {
|
|
266
|
+
var n = e.field,
|
|
267
|
+
o = n.substring(0, n.indexOf('.')),
|
|
268
|
+
a = Number(n.substring(n.indexOf('.') + 1, n.lastIndexOf('.'))),
|
|
269
|
+
l = this.dsModel[o][a].type;
|
|
270
|
+
'Number' === l
|
|
271
|
+
? isNaN(t)
|
|
272
|
+
? i(new Error(this.i18nt('designer.setting.dsRequestNumberTypeError')))
|
|
273
|
+
: i()
|
|
274
|
+
: 'Boolean' === l
|
|
275
|
+
? 'true' === t.toLowerCase() || 'false' === t.toLowerCase() || 'null' === t.toLowerCase() || '1' === t || '0' === t
|
|
276
|
+
? i()
|
|
277
|
+
: i(new Error(this.i18nt('designer.setting.dsRequestBooleanTypeError')))
|
|
278
|
+
: i();
|
|
279
|
+
},
|
|
280
|
+
addDataSource: function() {
|
|
281
|
+
(this.curEditDSIdx = -1),
|
|
282
|
+
// (this.dsModel = deepClone(this.dsModel)),
|
|
283
|
+
(this.dsModel = deepClone(this.dsModel)),
|
|
284
|
+
(this.dsModel.dataSourceId = null),
|
|
285
|
+
(this.dsModel.uniqueName = ''),
|
|
286
|
+
(this.dsModel.requestURL = ''),
|
|
287
|
+
(this.dsModel.requestaccessType = 'String'),
|
|
288
|
+
(this.dsModel.requestMethod = 'get'),
|
|
289
|
+
(this.dsModel.description = ''),
|
|
290
|
+
this.dsModel.headers.splice(0, this.dsModel.headers.length),
|
|
291
|
+
this.dsModel.params.splice(0, this.dsModel.params.length),
|
|
292
|
+
this.dsModel.data.splice(0, this.dsModel.data.length),
|
|
293
|
+
(this.dsModel.configHandlerCode = ' return config'),
|
|
294
|
+
(this.dsModel.dataHandlerCode = ' return result.data.data;'),
|
|
295
|
+
// (this.dsModel.errorHandlerCode = ' $message.error(error.message);'),
|
|
296
|
+
(this.dsModel.errorHandlerCode = ''),
|
|
297
|
+
(this.showDataSourceDialogFlag = !0);
|
|
298
|
+
},
|
|
299
|
+
editDataSource: function(e) {
|
|
300
|
+
(this.dsModel = deepClone(this.formConfig.dataSources[e])), (this.curEditDSIdx = e), (this.showDataSourceDialogFlag = !0);
|
|
301
|
+
},
|
|
302
|
+
saveDataSource: function() {
|
|
303
|
+
var e = this;
|
|
304
|
+
console.log('dsModel is: ', this.dsModel),
|
|
305
|
+
this.$refs['dsForm'].validate(function(t, i) {
|
|
306
|
+
if (t) {
|
|
307
|
+
e.dsModel.dataSourceId = e.dsModel.dataSourceId || 'ds' + generateId();
|
|
308
|
+
|
|
309
|
+
var n = e.dsModel.dataSourceId,
|
|
310
|
+
o = e.dsModel.uniqueName,
|
|
311
|
+
a = !1;
|
|
312
|
+
e.formConfig.dataSources.map(function(e) {
|
|
313
|
+
e.uniqueName === o && e.dataSourceId !== n && (a = !0);
|
|
314
|
+
}),
|
|
315
|
+
a
|
|
316
|
+
? e.$message.error(e.i18nt('designer.setting.dsDuplicatedNameError'))
|
|
317
|
+
: e.curEditDSIdx >= 0
|
|
318
|
+
? (e.formConfig.dataSources.splice(e.curEditDSIdx, 1, deepClone(e.dsModel)), (e.showDataSourceDialogFlag = !1))
|
|
319
|
+
: (e.formConfig.dataSources.push(e.dsModel), (e.showDataSourceDialogFlag = !1));
|
|
320
|
+
} else e.$message.error(e.i18nt('designer.setting.dsValidationError'));
|
|
321
|
+
});
|
|
322
|
+
},
|
|
323
|
+
deleteDataSource: function(e) {
|
|
324
|
+
var t = this;
|
|
325
|
+
this.$confirm(this.i18nt('designer.setting.deleteDataSourceHint'), this.i18nt('render.hint.prompt'), {
|
|
326
|
+
confirmButtonText: this.i18nt('render.hint.confirm'),
|
|
327
|
+
cancelButtonText: this.i18nt('render.hint.cancel')
|
|
328
|
+
})
|
|
329
|
+
.then(function() {
|
|
330
|
+
t.formConfig.dataSources.splice(e, 1);
|
|
331
|
+
})
|
|
332
|
+
.catch(function(e) {
|
|
333
|
+
console.error(e);
|
|
334
|
+
});
|
|
335
|
+
},
|
|
336
|
+
addRequestHeader: function() {
|
|
337
|
+
this.dsModel.headers.push({
|
|
338
|
+
name: '',
|
|
339
|
+
type: 'String',
|
|
340
|
+
value: ''
|
|
341
|
+
});
|
|
342
|
+
},
|
|
343
|
+
deleteRequestHeader: function(e) {
|
|
344
|
+
this.dsModel.headers.splice(e, 1);
|
|
345
|
+
},
|
|
346
|
+
addRequestParam: function() {
|
|
347
|
+
this.dsModel.params.push({
|
|
348
|
+
name: '',
|
|
349
|
+
type: 'String',
|
|
350
|
+
value: ''
|
|
351
|
+
});
|
|
352
|
+
},
|
|
353
|
+
deleteRequestParam: function(e) {
|
|
354
|
+
this.dsModel.params.splice(e, 1);
|
|
355
|
+
},
|
|
356
|
+
addRequestData: function() {
|
|
357
|
+
this.dsModel.data.push({
|
|
358
|
+
name: '',
|
|
359
|
+
type: 'String',
|
|
360
|
+
value: ''
|
|
361
|
+
});
|
|
362
|
+
},
|
|
363
|
+
deleteRequestData: function(e) {
|
|
364
|
+
this.dsModel.data.splice(e, 1);
|
|
365
|
+
},
|
|
366
|
+
testDataSource: function() {
|
|
367
|
+
var e = this.getGlobalDsv() || {};
|
|
368
|
+
(this.dsvJson = JSON.stringify(e, null, ' ')), (this.showTestDataSourceDialogFlag = !0);
|
|
369
|
+
},
|
|
370
|
+
doDataSourceRequest: function() {
|
|
371
|
+
var e = this;
|
|
372
|
+
return Object(ie['a'])(
|
|
373
|
+
regeneratorRuntime.mark(function t() {
|
|
374
|
+
var i, n;
|
|
375
|
+
return regeneratorRuntime.wrap(function(t) {
|
|
376
|
+
while (1)
|
|
377
|
+
switch ((t.prev = t.next)) {
|
|
378
|
+
case 0:
|
|
379
|
+
return (i = JSON.parse(e.dsvJson)), (t.next = 3), runDataSourceRequest(e.dsModel, i, null, !0, e.$message);
|
|
380
|
+
case 3:
|
|
381
|
+
(n = t.sent), e.$refs.dsResultEditor.setValue(JSON.stringify(n, null, ' '));
|
|
382
|
+
case 5:
|
|
383
|
+
case 'end':
|
|
384
|
+
return t.stop();
|
|
385
|
+
}
|
|
386
|
+
}, t);
|
|
387
|
+
})
|
|
388
|
+
)();
|
|
389
|
+
},
|
|
390
|
+
clearRequestResult: function() {
|
|
391
|
+
this.$refs.dsResultEditor.setValue('');
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
</script>
|
|
396
|
+
|
|
397
|
+
<style></style>
|