cloud-web-corejs 1.0.258 → 1.0.259
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 +32 -25
- package/src/components/VabUpload/fileLibraryDialog.vue +296 -0
- package/src/components/VabUpload/index.js +22 -2
- package/src/components/VabUpload/index.vue +242 -231
- package/src/components/VabUpload/mixins/fileLibraryDialog.js +1112 -0
- package/src/components/VabUpload/mixins.js +1971 -1829
- package/src/components/VabUpload/privateProfileDialog.vue +2 -2
- package/src/components/baseArea/index.vue +1628 -0
- package/src/components/baseInputExport/mixins.js +48 -31
- package/src/components/baseInputNumber/index.vue +9 -9
- package/src/components/baseTabs/index.vue +16 -8
- package/src/components/code-editor/async.js +29 -0
- package/src/components/code-editor/index.vue +93 -4
- package/src/components/errorMsg/index.js +10 -9
- package/src/components/errorMsg/mixins.js +25 -23
- package/src/components/excelExport/exportFieldDialog.vue +40 -18
- package/src/components/excelExport/index.js +62 -3
- package/src/components/excelExport/index.vue +2 -1
- package/src/components/excelExport/mixins.js +496 -340
- package/src/components/excelImport/index.js +69 -7
- package/src/components/excelImport/mixins.js +841 -9
- package/src/components/fileLibrary/categoryMoveDialog.vue +109 -109
- package/src/components/fileLibrary/fileHistoryDialog.vue +1 -1
- package/src/components/fileLibrary/fileObjAuthDialog.vue +297 -298
- package/src/components/fileLibrary/fileObjAuthEdit.vue +1 -1
- package/src/components/fileLibrary/filterDialog.vue +1 -1
- package/src/components/fileLibrary/index.vue +1109 -1110
- package/src/components/fileLibrary/mixins/indexMixins.js +10 -0
- package/src/components/fileLibrary/propertiesDialog.vue +190 -190
- package/src/components/fileLibrary/recycleBinDialog.vue +237 -236
- package/src/components/formOplog/mixins.js +85 -80
- package/src/components/hiprint/view/design/index.vue +7 -2
- package/src/components/jsonImport/exportUtil.js +106 -0
- package/src/components/jsonImport/index.js +75 -50
- package/src/components/jsonImport/mixins.js +350 -348
- package/src/components/langImport/mixins.js +502 -500
- package/src/components/micro-view-host/contract.js +66 -0
- package/src/components/micro-view-host/index.vue +148 -0
- package/src/components/mobile/file/index.vue +10 -0
- package/src/components/mobile/wf/mixins/wfModifyDialogMixin.js +51 -47
- package/src/components/obsUpload/index.vue +234 -231
- package/src/components/obsUpload/mixins.js +1542 -1476
- package/src/components/onlineTalk/talkUserDialog.vue +1 -1
- package/src/components/table/CellSlot.vue +12 -10
- package/src/components/table/config.js +74 -1
- package/src/components/table/index.js +1208 -1
- package/src/components/table/tableFormMixin.js +285 -1
- package/src/components/table/util/index.js +38 -40
- package/src/components/table/vxeFilter/index.js +153 -2
- package/src/components/table/vxeFilter/mixin.js +305 -3
- package/src/components/tempStorage/tempStorageDialog.vue +1 -1
- package/src/components/vb-tabs/x-tabs.vue +10 -5
- package/src/components/wf/addTaskUserdialog.vue +1 -1
- package/src/components/wf/mixins/setCandidateDialog.js +217 -217
- package/src/components/wf/mixins/setCandidateDialog2.js +252 -252
- package/src/components/wf/wf.js +2224 -2203
- package/src/components/wf/wfUtil.js +2 -1
- package/src/components/xform/docs/2026-08 /345/210/227/350/241/250/345/257/274/345/207/272/350/204/261/346/225/217/345/210/227/345/211/224/351/231/244/350/220/275/345/234/260/346/226/207/346/241/243.md" +173 -0
- package/src/components/xform/form-designer/designer.js +1 -0
- package/src/components/xform/form-designer/form-widget/container-widget/containerMixin.js +110 -1
- package/src/components/xform/form-designer/form-widget/container-widget/data-table-mixin.js +282 -1
- package/src/components/xform/form-designer/form-widget/field-widget/area-select-widget.vue +272 -0
- package/src/components/xform/form-designer/form-widget/field-widget/autocomplete-widget.vue +119 -0
- package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +14 -0
- package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +18 -73
- package/src/components/xform/form-designer/form-widget/field-widget/mixins/autocomplete-mixin.js +451 -0
- package/src/components/xform/form-designer/form-widget/field-widget/mixins/date-limit-mixin.js +157 -0
- package/src/components/xform/form-designer/form-widget/field-widget/mixins/utc-transform-mixin.js +75 -0
- package/src/components/xform/form-designer/form-widget/field-widget/save_submit_wf_button-widget.vue +112 -0
- package/src/components/xform/form-designer/form-widget/field-widget/script-input-widget.vue +149 -0
- package/src/components/xform/form-designer/form-widget/indexMixin.js +179 -1
- package/src/components/xform/form-designer/indexMixin.js +823 -1
- package/src/components/xform/form-designer/refMixinDesign.js +27 -1
- package/src/components/xform/form-designer/setting-panel/action-button-config-dialog.vue +241 -0
- package/src/components/xform/form-designer/setting-panel/form-dynamicField-setting.vue +601 -0
- package/src/components/xform/form-designer/setting-panel/form-setting.vue +6 -0
- package/src/components/xform/form-designer/setting-panel/index.vue +314 -309
- package/src/components/xform/form-designer/setting-panel/indexMixin.js +324 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +8 -7
- package/src/components/xform/form-designer/setting-panel/property-editor/container-list-h5/list-h5-editor.vue +8 -7
- package/src/components/xform/form-designer/setting-panel/property-editor/container-table/table-dynamicField-editor.vue +344 -0
- 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/field-area-select/areaDataType-editor.vue +25 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-area-select/areaMinLevel-editor.vue +50 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-area-select/areaName-editor.vue +20 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-autocomplete/autocomplete-vabSearchName-editor.vue +199 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-baseAttachment/baseAttachment-fileTypes-editor.vue +23 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-cascader/showAllLevels-editor.vue +21 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-dateLimit-editor.vue +157 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-script-input/script-input-editor.vue +55 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-vabUpload/vabUpload-fileTypes-editor.vue +23 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/fileTypesEditorMixin.js +116 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/fileTypesSelect.vue +176 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/textFlag-editor.vue +3 -3
- package/src/components/xform/form-designer/setting-panel/property-editor/utcTransformEnabled-editor.vue +19 -0
- package/src/components/xform/form-designer/setting-panel/widgetPropertyDialogMixin.js +186 -0
- package/src/components/xform/form-designer/toolbar-panel/indexMixin.js +566 -1
- package/src/components/xform/form-designer/widget-panel/indexMixin.js +290 -1
- package/src/components/xform/form-render/compareDelList.vue +83 -0
- package/src/components/xform/form-render/compareView.vue +76 -0
- package/src/components/xform/form-render/container-item/containerItemMixin.js +378 -1
- package/src/components/xform/form-render/container-item/data-table-mixin.js +35 -0
- package/src/components/xform/form-render/container-item/detail-item.vue +41 -0
- package/src/components/xform/form-render/container-item/dynamicFieldEngine.js +285 -0
- package/src/components/xform/form-render/container-item/dynamicFieldMixin.js +416 -0
- package/src/components/xform/form-render/container-item/list-h5-item.vue +12 -0
- package/src/components/xform/form-render/dynamicDialogRender.js +195 -1
- package/src/components/xform/form-render/dynamicDrawerRender.js +229 -0
- package/src/components/xform/form-render/formDynamicFieldMixin.js +131 -0
- package/src/components/xform/form-render/refMixin.js +29 -1
- package/src/components/xform/mixins/scriptHttp.js +172 -1
- package/src/components/xform/utils/dynamicSchemaUtil.js +361 -0
- package/src/components/xform/utils/tableCellValidateUtil.js +148 -0
- package/src/components/xform/utils/textMaskUtil.js +179 -0
- package/src/components/xform/utils/treeTableUtil.js +1265 -0
- package/src/components/xform/utils/util.js +1 -0
- package/src/components/xform/utils/validators.js +133 -1
- package/src/directive/LimitNumber/index.js +143 -124
- package/src/microRouter/index.js +447 -0
- package/src/mixins/tableTree/index.js +77 -14
- package/src/permission.js +132 -107
- package/src/public-path.js +38 -0
- package/src/router/index.js +3 -3
- package/src/store/modules/micro.js +57 -0
- package/src/store/modules/permission.js +535 -371
- package/src/store/modules/tagsView.js +38 -21
- package/src/store/modules/user.js +409 -370
- package/src/utils/aes.js +9 -3
- package/src/utils/auth.js +1 -1
- package/src/utils/componentDialog.js +162 -40
- package/src/utils/global.js +35 -34
- package/src/utils/index.js +579 -579
- package/src/utils/keepAlive.js +8 -4
- package/src/utils/lazyPlugin.js +66 -0
- package/src/utils/menuAdapter.js +277 -0
- package/src/utils/repeatOpen.js +48 -0
- package/src/utils/request.js +417 -395
- package/src/utils/resolveViewComponent.js +203 -0
- package/src/utils/vab.js +14 -3
- package/src/utils/validate.js +104 -106
- package/src/views/bd/setting/bd_attach_setting/dialog.vue +1 -1
- package/src/views/bd/setting/bd_attach_setting/list.vue +1 -1
- package/src/views/bd/setting/bd_company_env/dialog.vue +1 -1
- package/src/views/bd/setting/bd_company_env/list.vue +1 -1
- package/src/views/bd/setting/formVersion/ftHistoryDialog.vue +488 -489
- package/src/views/bd/setting/form_import_log/list.vue +1 -1
- package/src/views/bd/setting/form_script/dialog.vue +1 -1
- package/src/views/bd/setting/form_script/form_list.vue +174 -166
- package/src/views/bd/setting/form_script/list.vue +1 -1
- package/src/views/bd/setting/form_script/list1.vue +1 -1
- package/src/views/bd/setting/form_script/mixins/form_list.js +330 -322
- package/src/views/bd/setting/form_template/dialog.vue +1 -1
- package/src/views/bd/setting/form_template/formDesignerDialog.vue +172 -171
- package/src/views/bd/setting/form_template/ftHistoryDialog.vue +1 -1
- package/src/views/bd/setting/form_template/itemList.vue +1 -1
- package/src/views/bd/setting/form_template/list.vue +3 -3
- package/src/views/bd/setting/form_template/mixins/edit.js +3 -3
- package/src/views/bd/setting/form_template/mixins/list.js +3 -3
- package/src/views/bd/setting/form_template/mixins/list2.js +3 -3
- package/src/views/bd/setting/form_template/mixins/wf_list.js +3 -3
- package/src/views/bd/setting/form_template/wfObjConfigDialog.vue +253 -254
- package/src/views/bd/setting/form_template/wf_list.vue +3 -3
- package/src/views/bd/setting/logic_param/edit.vue +20 -20
- package/src/views/bd/setting/logic_param/list.vue +1 -1
- package/src/views/bd/setting/menu_kind/dialog.vue +1 -1
- package/src/views/bd/setting/menu_kind/list.vue +1 -1
- package/src/views/bd/setting/push_data/list.vue +1 -1
- package/src/views/bd/setting/push_data_h/list.vue +1 -1
- package/src/views/bd/setting/request_async_setting/list.vue +1 -1
- package/src/views/bd/setting/request_setting/list.vue +1 -1
- package/src/views/bd/setting/table_model/dialog.vue +1 -1
- package/src/views/bd/setting/table_model/list.vue +1 -1
- package/src/views/bd/setting/table_model/zdDialog.vue +1 -1
- package/src/views/user/access_log/list.vue +1 -1
- package/src/views/user/access_log/list2.vue +1 -1
- package/src/views/user/api_request/list.vue +1 -1
- package/src/views/user/area/dialog.vue +1 -1
- package/src/views/user/area/list.vue +1 -1
- package/src/views/user/bill_setting/list.vue +1 -1
- package/src/views/user/bill_setting/userDialog.vue +1 -1
- package/src/views/user/code_rules/list.vue +1 -1
- package/src/views/user/commMenu/index.vue +2 -2
- package/src/views/user/common_attribute/list.vue +2 -2
- package/src/views/user/common_script/list.vue +1 -1
- package/src/views/user/company_info/dialog.vue +1 -1
- package/src/views/user/country/dialog.vue +1 -1
- package/src/views/user/country/list.vue +1 -1
- package/src/views/user/data_type_setting/dialog.vue +1 -1
- package/src/views/user/extend_datasource/dialog.vue +4 -1
- package/src/views/user/extend_datasource/edit.vue +2 -1
- package/src/views/user/extend_datasource/list.vue +4 -1
- package/src/views/user/fieldTranslation/list.vue +1 -1
- package/src/views/user/field_values_invisible/list.vue +1 -1
- package/src/views/user/file_type/list.vue +1 -1
- package/src/views/user/file_view_area/list.vue +1 -1
- package/src/views/user/file_view_ins/list.vue +22 -1
- package/src/views/user/form/view/list.vue +64 -1
- package/src/views/user/groups/dialog.vue +1 -1
- package/src/views/user/groups/list.vue +1 -1
- package/src/views/user/home/default.vue +2 -2
- package/src/views/user/home/default2.vue +1158 -1148
- package/src/views/user/home/index.vue +3 -10
- package/src/views/user/lang_tag/dialog.vue +1 -1
- package/src/views/user/lang_tag/list.vue +1 -1
- package/src/views/user/language_setting/list.vue +1 -1
- package/src/views/user/login/default.vue +0 -8
- package/src/views/user/login/indexMixin.js +547 -556
- package/src/views/user/menu/list.vue +25 -2
- package/src/views/user/menuFallback/index.vue +123 -0
- package/src/views/user/mobile_menu/list.vue +1 -1
- package/src/views/user/notify_message/dialog.vue +22 -1
- package/src/views/user/notify_message/list.vue +1 -1
- package/src/views/user/notify_template/list.vue +1 -1
- package/src/views/user/notify_template/list2.vue +1 -1
- package/src/views/user/oplog/list.vue +1 -1
- package/src/views/user/outLink/form_view.vue +5 -14
- package/src/views/user/outLink/index.vue +6 -1
- package/src/views/user/outLink/view.vue +5 -13
- package/src/views/user/position/dialog.vue +1 -1
- package/src/views/user/position/list.vue +1 -1
- package/src/views/user/project_tag/dialog.vue +1 -1
- package/src/views/user/project_tag/list.vue +1 -1
- package/src/views/user/push_setting/list.vue +1 -1
- package/src/views/user/request_setting/list.vue +1 -1
- package/src/views/user/role/dialog.vue +1 -1
- package/src/views/user/role/list.vue +1 -1
- package/src/views/user/sale_org/dialog.vue +1 -1
- package/src/views/user/sale_org/list.vue +1 -1
- package/src/views/user/system_notice/list.vue +1 -1
- package/src/views/user/system_parameter/list.vue +1 -1
- package/src/views/user/user/dialog.vue +1 -1
- package/src/views/user/user/edit.vue +306 -159
- package/src/views/user/user/form_dialog.vue +1 -1
- package/src/views/user/user/form_list.vue +1 -1
- package/src/views/user/user/list.vue +2 -2
- package/src/views/user/user_log_classify/list.vue +1 -1
- package/src/views/user/wf/iframe/index.vue +6 -1
- package/src/views/user/wf/iframe/index2.vue +6 -1
- package/src/views/user/wf/wfReport/index.vue +12 -6
- package/src/views/user/wf/wf_auto_submit_data/list.vue +2 -2
- package/src/views/user/wf/wf_manage/list.vue +97 -24
- package/src/views/user/wf/wf_manage/list2.vue +875 -0
- package/src/views/user/wf/wf_manage/wfContentDialog.vue +23 -1
- package/src/views/user/wf/wf_obj_config/dialog.vue +1 -1
- package/src/views/user/wf/wf_obj_config/list.vue +1 -1
- package/src/views/user/wf/wf_obj_config/list_form.vue +1 -1
- package/src/views/user/wf/wf_transfer_setting/list.vue +1 -1
- package/src/views/user/workbench_menu/list.vue +1 -1
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<form-item-wrapper :designer="designer" :field="field" :rules="rules" :design-state="designState"
|
|
3
|
+
:parent-widget="parentWidget" :parent-list="parentList" :index-of-parent-list="indexOfParentList"
|
|
4
|
+
:sub-form-row-index="subFormRowIndex" :sub-form-col-index="subFormColIndex"
|
|
5
|
+
:sub-form-row-id="subFormRowId">
|
|
6
|
+
<el-autocomplete
|
|
7
|
+
ref="fieldEditor"
|
|
8
|
+
v-model="displayValue"
|
|
9
|
+
v-show="!isReadMode"
|
|
10
|
+
class="full-width-input"
|
|
11
|
+
:disabled="field.options.disabled"
|
|
12
|
+
:readonly="field.options.readonly"
|
|
13
|
+
:size="field.options.size"
|
|
14
|
+
:placeholder="getI18nLabel(field.options.placeholder || '请输入关键词搜索')"
|
|
15
|
+
:clearable="field.options.clearable"
|
|
16
|
+
:fetch-suggestions="querySearchAsync"
|
|
17
|
+
:trigger-on-focus="false"
|
|
18
|
+
:debounce="field.options.debounce || 300"
|
|
19
|
+
:value-key="valueKey"
|
|
20
|
+
:prefix-icon="field.options.prefixIcon"
|
|
21
|
+
:suffix-icon="field.options.suffixIcon || 'el-icon-tickets'"
|
|
22
|
+
:popper-class="
|
|
23
|
+
'autocomplete-popper' +
|
|
24
|
+
(field.options.customClass ? ' ' + field.options.customClass.join(' ') : '')
|
|
25
|
+
"
|
|
26
|
+
@select="handleSelect"
|
|
27
|
+
@clear="handleClear"
|
|
28
|
+
@focus="handleFocusCustomEvent"
|
|
29
|
+
@blur="handleBlur"
|
|
30
|
+
@input="handleInputChange"
|
|
31
|
+
:style="'width:' + field.options.widgetWidth + ' !important;'"
|
|
32
|
+
:class="{'custom-width': field.options.widgetWidth != null}">
|
|
33
|
+
<template slot-scope="{ item }">
|
|
34
|
+
<template v-if="field.options.autocompleteItemTemplate">
|
|
35
|
+
<!-- 支持自定义下拉项模板脚本(返回 HTML 字符串) -->
|
|
36
|
+
<span v-html="renderItemTemplate(item)"></span>
|
|
37
|
+
</template>
|
|
38
|
+
<template v-else>
|
|
39
|
+
<span v-html="highlightKeyword(item[valueKey])"></span>
|
|
40
|
+
</template>
|
|
41
|
+
</template>
|
|
42
|
+
</el-autocomplete>
|
|
43
|
+
<template v-if="isReadMode">
|
|
44
|
+
<span class="readonly-mode-field">{{ displayValue }}</span>
|
|
45
|
+
</template>
|
|
46
|
+
</form-item-wrapper>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<script>
|
|
50
|
+
import mixins from "@base/components/xform/form-designer/form-widget/field-widget/mixins/autocomplete-mixin";
|
|
51
|
+
|
|
52
|
+
export default {
|
|
53
|
+
name: "autocomplete-widget",
|
|
54
|
+
componentName: 'FieldWidget', //必须固定为FieldWidget,用于接收父级组件的broadcast事件
|
|
55
|
+
mixins: [mixins],
|
|
56
|
+
methods: {
|
|
57
|
+
/**
|
|
58
|
+
* 渲染自定义下拉项模板(可选)。
|
|
59
|
+
* autocompleteItemTemplate 为一段返回 HTML 字符串的脚本,入参为 item
|
|
60
|
+
*/
|
|
61
|
+
renderItemTemplate(item) {
|
|
62
|
+
if (!this.field.options.autocompleteItemTemplate) return "";
|
|
63
|
+
try {
|
|
64
|
+
let fn = new Function("item", this.field.options.autocompleteItemTemplate);
|
|
65
|
+
return fn.call(this, item) || "";
|
|
66
|
+
} catch (e) {
|
|
67
|
+
return "";
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
/** HTML 转义,防止下拉项内容注入 */
|
|
71
|
+
escapeHtml(str) {
|
|
72
|
+
let map = {
|
|
73
|
+
"&": "&",
|
|
74
|
+
"<": "<",
|
|
75
|
+
">": ">",
|
|
76
|
+
'"': """,
|
|
77
|
+
"'": "'",
|
|
78
|
+
};
|
|
79
|
+
return String(str == null ? "" : str).replace(/[&<>"']/g, (c) => map[c]);
|
|
80
|
+
},
|
|
81
|
+
/** 高亮下拉项中与当前搜索关键词匹配的部分 */
|
|
82
|
+
highlightKeyword(text) {
|
|
83
|
+
let escaped = this.escapeHtml(text);
|
|
84
|
+
let keyword = this.lastQueryKeyword;
|
|
85
|
+
if (!keyword) return escaped;
|
|
86
|
+
let kw = this.escapeHtml(keyword).replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
87
|
+
if (!kw) return escaped;
|
|
88
|
+
let re = new RegExp("(" + kw + ")", "gi");
|
|
89
|
+
return escaped.replace(
|
|
90
|
+
re,
|
|
91
|
+
'<span class="autocomplete-highlight">$1</span>'
|
|
92
|
+
);
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
}
|
|
96
|
+
</script>
|
|
97
|
+
|
|
98
|
+
<style lang="scss" scoped>
|
|
99
|
+
@import "~@/styles/global.scss";
|
|
100
|
+
|
|
101
|
+
.full-width-input {
|
|
102
|
+
width: 100% !important;
|
|
103
|
+
}
|
|
104
|
+
</style>
|
|
105
|
+
|
|
106
|
+
<!-- 非 scoped:el-autocomplete 下拉浮层挂在 body 下,scoped 样式无法命中 -->
|
|
107
|
+
<style lang="scss">
|
|
108
|
+
.autocomplete-popper {
|
|
109
|
+
.el-autocomplete-suggestion__list li {
|
|
110
|
+
font-size: 13px;
|
|
111
|
+
line-height: 1.6;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.autocomplete-highlight {
|
|
116
|
+
color: #409eff;
|
|
117
|
+
font-weight: bold;
|
|
118
|
+
}
|
|
119
|
+
</style>
|
|
@@ -663,6 +663,20 @@ modules = {
|
|
|
663
663
|
return;
|
|
664
664
|
}
|
|
665
665
|
},
|
|
666
|
+
/**
|
|
667
|
+
* 构造表单脚本请求的 data 参数(通用)。
|
|
668
|
+
* 勾选"请求去掉data层"(removeDataLevel)时,内层参数平铺到外层,不再包一层 data。
|
|
669
|
+
*/
|
|
670
|
+
buildFormScriptData: function (reportTemplate, innerData, taBm) {
|
|
671
|
+
let base = {
|
|
672
|
+
formCode: reportTemplate.formCode,
|
|
673
|
+
formVersion: reportTemplate.formVersion,
|
|
674
|
+
taBm: taBm || this.fieldKeyName,
|
|
675
|
+
};
|
|
676
|
+
return this.field.options.removeDataLevel
|
|
677
|
+
? { ...base, ...(innerData || {}) }
|
|
678
|
+
: { ...base, data: innerData || {} };
|
|
679
|
+
},
|
|
666
680
|
loadGloatOptions: function (e, initFlag) {
|
|
667
681
|
let optionItems = baseRefUtil.translateOptionItems(
|
|
668
682
|
e,
|
|
@@ -216,6 +216,10 @@ import {
|
|
|
216
216
|
getSubFormNameByFieldId,
|
|
217
217
|
isVabsearchMultiWidget,
|
|
218
218
|
} from "../../../../../components/xform/utils/util";
|
|
219
|
+
import {
|
|
220
|
+
compareToList,
|
|
221
|
+
resolveTextMaskFlag,
|
|
222
|
+
} from "../../../../../components/xform/utils/textMaskUtil";
|
|
219
223
|
|
|
220
224
|
export default {
|
|
221
225
|
name: "form-item-wrapper",
|
|
@@ -570,81 +574,22 @@ export default {
|
|
|
570
574
|
let formConfig = fJson.formConfig;
|
|
571
575
|
if (formConfig.isLoadEntity && !formRef.dataId) return;
|
|
572
576
|
|
|
573
|
-
let
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
let flag = 0; //0 原本组件,1明文文本,2密文文本
|
|
586
|
-
/*if (optionModel.showTextEnabled) {
|
|
587
|
-
flag = 1;
|
|
588
|
-
} else if (optionModel.showEncryptTextEnabled) {
|
|
589
|
-
flag = 2;
|
|
590
|
-
} else if (optionModel.showLinkTextEnabled) {
|
|
591
|
-
flag = 3;
|
|
592
|
-
}*/
|
|
593
|
-
if (optionModel.userTextRuleEnabled) {
|
|
594
|
-
let userTextRuleConfig = optionModel.userTextRuleConfig || [];
|
|
595
|
-
userTextRuleConfig.forEach((item) => {
|
|
596
|
-
let type = item.type ?? null;
|
|
597
|
-
if (type !== null && type !== "") {
|
|
598
|
-
let companyCodeStr = item.companyCodes;
|
|
599
|
-
let companyCodes = companyCodeStr
|
|
600
|
-
? companyCodeStr.split(",").filter((item) => !!item)
|
|
601
|
-
: [];
|
|
602
|
-
/*
|
|
603
|
-
|
|
604
|
-
let loginAccountStr = item.loginAccounts;
|
|
605
|
-
let loginAccounts = loginAccountStr ? loginAccountStr.split(",").filter(item => !!item) : [];
|
|
606
|
-
|
|
607
|
-
let saleOrgCodeStr = item.saleOrgCodes;
|
|
608
|
-
let saleOrgCodes = saleOrgCodeStr ? saleOrgCodeStr.split(",").filter(item => !!item) : [];
|
|
609
|
-
*/
|
|
610
|
-
|
|
611
|
-
let roleCodeStr = item.roleCodes;
|
|
612
|
-
let roleCodes = roleCodeStr
|
|
613
|
-
? roleCodeStr.split(",").filter((item) => !!item)
|
|
614
|
-
: [];
|
|
615
|
-
|
|
616
|
-
let flag1 = !item.serveName || item.serveName == bdService;
|
|
617
|
-
let flag2 =
|
|
618
|
-
!companyCodes.length || companyCodes.includes(companyCode);
|
|
619
|
-
// let flag3 = !loginAccounts.length || loginAccounts.includes(loginAccount)
|
|
620
|
-
// let flag4 = this.compareToList(saleOrgCodes, saleOrgCodeList)
|
|
621
|
-
if (flag1 && flag2) {
|
|
622
|
-
this.encryptFormula = item.encryptFormula;
|
|
623
|
-
let flag5 = this.compareToList(roleCodes, roleCodeList);
|
|
624
|
-
if (flag5) {
|
|
625
|
-
//匹配角色
|
|
626
|
-
if (type == 2) flag = 2; //type=2时加密
|
|
627
|
-
} else {
|
|
628
|
-
//角色不匹配
|
|
629
|
-
if (type == 1) flag = 2;
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
});
|
|
634
|
-
}
|
|
635
|
-
this.field.options.widgetTextFlag = flag;
|
|
636
|
-
// this.showType = flag;
|
|
577
|
+
let userRoleDTOs = formRef.userRoleDTOs || [];
|
|
578
|
+
// 判定逻辑与导出侧(数据表格按列剔除)共用 textMaskUtil,
|
|
579
|
+
// 否则会出现界面打码、导出放行两套结论
|
|
580
|
+
let { masked, encryptFormula } = resolveTextMaskFlag(this.field.options, {
|
|
581
|
+
bdService: formRef.bdService,
|
|
582
|
+
companyCode: this.$store.getters.companyCode,
|
|
583
|
+
roleCodeList: userRoleDTOs.map((item) => item.roleCode),
|
|
584
|
+
});
|
|
585
|
+
|
|
586
|
+
this.encryptFormula = encryptFormula;
|
|
587
|
+
//0 原本组件,1明文文本,2密文文本
|
|
588
|
+
this.field.options.widgetTextFlag = masked ? 2 : 0;
|
|
637
589
|
},
|
|
590
|
+
/* 实现已移入 textMaskUtil,此处保留方法名供下游调用(同名的是导入的模块函数) */
|
|
638
591
|
compareToList(list1, list2) {
|
|
639
|
-
|
|
640
|
-
return true;
|
|
641
|
-
}
|
|
642
|
-
if (!list2.length) {
|
|
643
|
-
return false;
|
|
644
|
-
}
|
|
645
|
-
return list1.some((item) => {
|
|
646
|
-
return list2.some((item2) => item == item2);
|
|
647
|
-
});
|
|
592
|
+
return compareToList(list1, list2);
|
|
648
593
|
},
|
|
649
594
|
isShowWidget() {
|
|
650
595
|
let widgetTextFlag = this.field.options.widgetTextFlag;
|
package/src/components/xform/form-designer/form-widget/field-widget/mixins/autocomplete-mixin.js
ADDED
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import FormItemWrapper from "@base/components/xform/form-designer/form-widget/field-widget/form-item-wrapper";
|
|
2
|
+
import emitter from "@base/components/xform/utils/emitter";
|
|
3
|
+
import i18n from "@base/components/xform/utils/i18n";
|
|
4
|
+
import { deepClone, trim } from "@base/components/xform/utils/util";
|
|
5
|
+
import fieldMixin from "@base/components/xform/form-designer/form-widget/field-widget/fieldMixin";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
mixins: [emitter, fieldMixin, i18n],
|
|
9
|
+
props: {
|
|
10
|
+
field: Object,
|
|
11
|
+
parentWidget: Object,
|
|
12
|
+
parentList: Array,
|
|
13
|
+
indexOfParentList: Number,
|
|
14
|
+
designer: Object,
|
|
15
|
+
|
|
16
|
+
designState: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
default: false,
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
columnConfig: {
|
|
22
|
+
type: Object,
|
|
23
|
+
default: null,
|
|
24
|
+
},
|
|
25
|
+
subFormRowIndex: {
|
|
26
|
+
/* 子表单组件行索引,从0开始计数 */
|
|
27
|
+
type: Number,
|
|
28
|
+
default: -1,
|
|
29
|
+
},
|
|
30
|
+
subFormColIndex: {
|
|
31
|
+
/* 子表单组件列索引,从0开始计数 */
|
|
32
|
+
type: Number,
|
|
33
|
+
default: -1,
|
|
34
|
+
},
|
|
35
|
+
subFormRowId: {
|
|
36
|
+
/* 子表单组件行Id,唯一id且不可变 */
|
|
37
|
+
type: String,
|
|
38
|
+
default: "",
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
components: {
|
|
42
|
+
FormItemWrapper,
|
|
43
|
+
},
|
|
44
|
+
data() {
|
|
45
|
+
return {
|
|
46
|
+
oldFieldValue: null, //field组件change之前的值
|
|
47
|
+
fieldModel: null, //存储 ID 值(提交字段)
|
|
48
|
+
displayValue: null, //el-autocomplete 的 v-model,存储展示名称(仅用于输入框显示)
|
|
49
|
+
rules: [],
|
|
50
|
+
isSelecting: false, //标记当前是否由"选择某一项"触发的输入变化
|
|
51
|
+
lastQueryKeyword: null, //最近一次查询关键词,避免重复查询
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
watch: {
|
|
55
|
+
fieldModel(val) {
|
|
56
|
+
//同步 ID 到当前数据行/表单模型
|
|
57
|
+
let currentData = this.currentData;
|
|
58
|
+
let fieldKeyName = this.fieldKeyName;
|
|
59
|
+
currentData[fieldKeyName] = val;
|
|
60
|
+
},
|
|
61
|
+
showValue(val) {
|
|
62
|
+
//外部回显:当 currentData[displayField] 变化时,同步到输入框
|
|
63
|
+
this.displayValue = val;
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
computed: {
|
|
67
|
+
/**
|
|
68
|
+
* 关联来源字段:候选数据中"ID/值"对应的字段名
|
|
69
|
+
*/
|
|
70
|
+
valueField() {
|
|
71
|
+
return trim(this.field.options.valueField) || this.fieldKeyName;
|
|
72
|
+
},
|
|
73
|
+
/**
|
|
74
|
+
* 展示来源字段:候选数据中"名称"对应的字段名
|
|
75
|
+
* (为空时回退展示字段 vabSearchName,再回退字段本身,保证旧表单兼容)
|
|
76
|
+
*/
|
|
77
|
+
sourceLabelField() {
|
|
78
|
+
return (
|
|
79
|
+
trim(this.field.options.labelSourceField) ||
|
|
80
|
+
trim(this.field.options.vabSearchName) ||
|
|
81
|
+
this.fieldKeyName
|
|
82
|
+
);
|
|
83
|
+
},
|
|
84
|
+
/**
|
|
85
|
+
* 展示字段:表单数据中持久化"名称"的字段(用于存储与回显)
|
|
86
|
+
*/
|
|
87
|
+
displayField() {
|
|
88
|
+
return trim(this.field.options.vabSearchName) || this.fieldKeyName;
|
|
89
|
+
},
|
|
90
|
+
/**
|
|
91
|
+
* el-autocomplete 下拉项展示用的 value-key(取自候选数据的展示来源字段)
|
|
92
|
+
*/
|
|
93
|
+
valueKey() {
|
|
94
|
+
return this.sourceLabelField;
|
|
95
|
+
},
|
|
96
|
+
/**
|
|
97
|
+
* 查询字段:远程搜索时关键词传给后台的参数名(默认 keyword)
|
|
98
|
+
*/
|
|
99
|
+
queryField() {
|
|
100
|
+
return trim(this.field.options.queryField) || "keyword";
|
|
101
|
+
},
|
|
102
|
+
/**
|
|
103
|
+
* condition格式下查询的数据表 taBm(留空取字段本身 keyName)
|
|
104
|
+
*/
|
|
105
|
+
conditionTaBm() {
|
|
106
|
+
return trim(this.field.options.conditionTaBm) || this.fieldKeyName;
|
|
107
|
+
},
|
|
108
|
+
tableRow() {
|
|
109
|
+
let tableParam = this.tableParam;
|
|
110
|
+
return tableParam && tableParam.row ? tableParam.row : null;
|
|
111
|
+
},
|
|
112
|
+
currentData() {
|
|
113
|
+
let tableParam = this.tableParam;
|
|
114
|
+
return tableParam && tableParam.row ? tableParam.row : this.formModel;
|
|
115
|
+
},
|
|
116
|
+
/**
|
|
117
|
+
* 表单数据中持久化的展示名称,用于回显
|
|
118
|
+
*/
|
|
119
|
+
showValue() {
|
|
120
|
+
let currentData = this.currentData;
|
|
121
|
+
let displayField = this.displayField;
|
|
122
|
+
let value = currentData[displayField] ?? null;
|
|
123
|
+
this.displayValue = value;
|
|
124
|
+
return value;
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
beforeCreate() {
|
|
128
|
+
/* 这里不能访问方法和属性!! */
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
created() {
|
|
132
|
+
/* 注意:子组件mounted在父组件created之后、父组件mounted之前触发,故子组件mounted需要用到的prop
|
|
133
|
+
需要在父组件created中初始化!! */
|
|
134
|
+
this.initFieldModel();
|
|
135
|
+
this.registerToRefList();
|
|
136
|
+
this.initEventHandler();
|
|
137
|
+
this.buildFieldRules();
|
|
138
|
+
|
|
139
|
+
this.handleOnCreated();
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
mounted() {
|
|
143
|
+
this.handleOnMounted();
|
|
144
|
+
//编辑态回显:若有 ID 但无名称,且配置了反查脚本,则自动反查
|
|
145
|
+
this.$nextTick(() => {
|
|
146
|
+
if (this.designState) return;
|
|
147
|
+
let id = this.fieldModel;
|
|
148
|
+
let label = this.currentData[this.displayField];
|
|
149
|
+
if (this.isNotNullVal(id) && !this.isNotNullVal(label)) {
|
|
150
|
+
this.fetchLabelById(id);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
beforeDestroy() {
|
|
156
|
+
this.unregisterFromRefList();
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
methods: {
|
|
160
|
+
/**
|
|
161
|
+
* 设置展示名称到当前数据行/表单模型,并同步到输入框
|
|
162
|
+
*/
|
|
163
|
+
setShowValue(val = null) {
|
|
164
|
+
let displayField = this.displayField;
|
|
165
|
+
this.currentData[displayField] = val;
|
|
166
|
+
this.displayValue = val;
|
|
167
|
+
},
|
|
168
|
+
setValue: function (e) {
|
|
169
|
+
if (this.field.formItemFlag) {
|
|
170
|
+
let value = e ?? null;
|
|
171
|
+
let currentData = this.currentData;
|
|
172
|
+
if (void 0 === currentData[this.fieldKeyName]) {
|
|
173
|
+
this.$set(currentData, this.fieldKeyName, null);
|
|
174
|
+
}
|
|
175
|
+
let t = deepClone(this.fieldModel);
|
|
176
|
+
this.fieldModel = value;
|
|
177
|
+
this.initFileList();
|
|
178
|
+
this.syncUpdateFormModel(value);
|
|
179
|
+
this.emitFieldDataChange(value, t);
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
fieldModelLabel() {
|
|
183
|
+
return this.displayValue;
|
|
184
|
+
},
|
|
185
|
+
// 对比旧值:label 存在原单同行的伴随字段(displayField),从 oldRow 取
|
|
186
|
+
resolveCompareOldDisplay(oldRow) {
|
|
187
|
+
if (!oldRow) return null;
|
|
188
|
+
return oldRow[this.displayField] ?? null;
|
|
189
|
+
},
|
|
190
|
+
/**
|
|
191
|
+
* 远程搜索:调用后台逻辑脚本,返回建议列表
|
|
192
|
+
* el-autocomplete 的 fetch-suggestions 回调签名 (queryString, callback)
|
|
193
|
+
*/
|
|
194
|
+
querySearchAsync(queryString, cb) {
|
|
195
|
+
if (this.designState) {
|
|
196
|
+
cb([]);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
let formScriptEnabled = this.field.options.formScriptEnabled || false;
|
|
200
|
+
let scriptCode = this.field.options.formScriptCode;
|
|
201
|
+
if (!formScriptEnabled || !scriptCode) {
|
|
202
|
+
cb([]);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
//需要有内容才执行搜索:关键词为空(含聚焦触发的空串)时不查询
|
|
206
|
+
let keyword = queryString == null ? "" : String(queryString);
|
|
207
|
+
if (!trim(keyword)) {
|
|
208
|
+
this.lastQueryKeyword = null;
|
|
209
|
+
this._lastSuggestions = null;
|
|
210
|
+
cb([]);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
//避免对相同关键词重复查询(el-autocomplete focus/input 都会触发)
|
|
214
|
+
if (
|
|
215
|
+
keyword === this.lastQueryKeyword
|
|
216
|
+
&& this._lastSuggestions
|
|
217
|
+
&& this._lastSuggestions.length
|
|
218
|
+
) {
|
|
219
|
+
cb(this._lastSuggestions);
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
this.lastQueryKeyword = keyword;
|
|
223
|
+
|
|
224
|
+
let reportTemplate = this.getFormRef().reportTemplate;
|
|
225
|
+
let accessParam = this.handleCustomEvent(
|
|
226
|
+
this.field.options.formScriptParam
|
|
227
|
+
);
|
|
228
|
+
let innerData;
|
|
229
|
+
if (this.field.options.conditionFormat) {
|
|
230
|
+
//condition 传值格式:关键词以 { field, value, filter:'like' } 追加到 condition 数组
|
|
231
|
+
let extra = accessParam || {};
|
|
232
|
+
let conditions = Array.isArray(extra.condition)
|
|
233
|
+
? extra.condition.slice()
|
|
234
|
+
: [];
|
|
235
|
+
conditions.push({
|
|
236
|
+
value: keyword,
|
|
237
|
+
field: this.queryField,
|
|
238
|
+
filter: "like",
|
|
239
|
+
});
|
|
240
|
+
innerData = {
|
|
241
|
+
current: 1,
|
|
242
|
+
size: this.field.options.conditionSize || 100,
|
|
243
|
+
searchCount: true,
|
|
244
|
+
...extra,
|
|
245
|
+
condition: conditions,
|
|
246
|
+
};
|
|
247
|
+
} else {
|
|
248
|
+
innerData = {
|
|
249
|
+
...accessParam,
|
|
250
|
+
[this.queryField]: keyword,
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
let taBm = this.field.options.conditionFormat
|
|
254
|
+
? this.conditionTaBm
|
|
255
|
+
: undefined;
|
|
256
|
+
let data = this.buildFormScriptData(reportTemplate, innerData, taBm);
|
|
257
|
+
return this.formHttp({
|
|
258
|
+
scriptCode: scriptCode,
|
|
259
|
+
isLoading: false,
|
|
260
|
+
data: data,
|
|
261
|
+
callback: (res) => {
|
|
262
|
+
let rows = res.objx?.records || res.objx || [];
|
|
263
|
+
//允许通过 formScriptSuccess 对结果进行二次处理
|
|
264
|
+
let handled = this.handleCustomEvent(
|
|
265
|
+
this.field.options.formScriptSuccess,
|
|
266
|
+
["res", "rows"],
|
|
267
|
+
[res, rows]
|
|
268
|
+
);
|
|
269
|
+
if (Array.isArray(handled)) {
|
|
270
|
+
rows = handled;
|
|
271
|
+
}
|
|
272
|
+
this._lastSuggestions = rows;
|
|
273
|
+
cb(rows);
|
|
274
|
+
},
|
|
275
|
+
fail: () => {
|
|
276
|
+
cb([]);
|
|
277
|
+
},
|
|
278
|
+
error: () => {
|
|
279
|
+
cb([]);
|
|
280
|
+
},
|
|
281
|
+
});
|
|
282
|
+
},
|
|
283
|
+
/**
|
|
284
|
+
* 选中某一项:存储 ID 与名称,并回填配置的其他字段
|
|
285
|
+
*/
|
|
286
|
+
handleSelect(item) {
|
|
287
|
+
this.isSelecting = true;
|
|
288
|
+
try {
|
|
289
|
+
let valueField = this.valueField;
|
|
290
|
+
let sourceLabelField = this.sourceLabelField;
|
|
291
|
+
let id = item[valueField] ?? null;
|
|
292
|
+
let label = item[sourceLabelField] ?? null;
|
|
293
|
+
|
|
294
|
+
//存储 ID(提交字段)
|
|
295
|
+
this.setValue(id);
|
|
296
|
+
//存储展示名称(持久化到表单数据 + 输入框)
|
|
297
|
+
this.setShowValue(label);
|
|
298
|
+
|
|
299
|
+
//回填其他字段
|
|
300
|
+
this.fillBackFields(item);
|
|
301
|
+
|
|
302
|
+
//触发 onChange 自定义事件
|
|
303
|
+
if (this.field.options.onChange) {
|
|
304
|
+
let fn = new Function(
|
|
305
|
+
"value",
|
|
306
|
+
"oldValue",
|
|
307
|
+
"item",
|
|
308
|
+
this.field.options.onChange
|
|
309
|
+
);
|
|
310
|
+
fn.call(this, id, this.oldFieldValue, item);
|
|
311
|
+
}
|
|
312
|
+
} finally {
|
|
313
|
+
this.$nextTick(() => {
|
|
314
|
+
this.isSelecting = false;
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
/**
|
|
319
|
+
* 清空:同时清除 ID 与名称
|
|
320
|
+
*/
|
|
321
|
+
handleClear() {
|
|
322
|
+
this.setValue(null);
|
|
323
|
+
this.setShowValue(null);
|
|
324
|
+
this.lastQueryKeyword = null;
|
|
325
|
+
this._lastSuggestions = null;
|
|
326
|
+
if (this.field.options.onSearchClear) {
|
|
327
|
+
let tableParam = this.tableParam;
|
|
328
|
+
let eventParamNames = [];
|
|
329
|
+
let eventParamValues = [];
|
|
330
|
+
if (tableParam) {
|
|
331
|
+
eventParamNames = ["rowData", "rowIndex"];
|
|
332
|
+
eventParamValues = [tableParam.row, tableParam.rowIndex];
|
|
333
|
+
}
|
|
334
|
+
this.handleCustomEvent(
|
|
335
|
+
this.field.options.onSearchClear,
|
|
336
|
+
eventParamNames,
|
|
337
|
+
eventParamValues
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
/**
|
|
342
|
+
* 输入框内容变化:仅派发校验与自定义 onInput,不清除已存储的 ID/名称。
|
|
343
|
+
* 用户输入但未选择、直接失焦时,由 handleBlur 还原为已存储的展示名称。
|
|
344
|
+
*/
|
|
345
|
+
handleInputChange(text) {
|
|
346
|
+
if (this.isSelecting) return;
|
|
347
|
+
this.dispatch("VFormRender", "fieldValidation", [this.getPropName()]);
|
|
348
|
+
if (this.field.options.onInput) {
|
|
349
|
+
let fn = new Function("value", this.field.options.onInput);
|
|
350
|
+
fn.call(this, text);
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
/**
|
|
354
|
+
* 失焦:若未通过"选择"确认新值,则把输入框内容还原为已存储的展示名称
|
|
355
|
+
* (已存储 ID 保持不变;从未选择过则清空输入框)。
|
|
356
|
+
*/
|
|
357
|
+
handleBlur(e) {
|
|
358
|
+
if (!this.designState) {
|
|
359
|
+
//延迟到"选择"事件之后再还原,避免点击下拉项时被误还原
|
|
360
|
+
setTimeout(() => {
|
|
361
|
+
if (this.isSelecting) return;
|
|
362
|
+
let storedLabel = this.currentData[this.displayField] ?? null;
|
|
363
|
+
if (this.displayValue !== storedLabel) {
|
|
364
|
+
this.displayValue = storedLabel;
|
|
365
|
+
}
|
|
366
|
+
}, 150);
|
|
367
|
+
}
|
|
368
|
+
this.handleBlurCustomEvent(e);
|
|
369
|
+
},
|
|
370
|
+
/**
|
|
371
|
+
* 根据回填配置把选中项的其他字段值写入表单
|
|
372
|
+
*/
|
|
373
|
+
fillBackFields(item) {
|
|
374
|
+
let fillConfig = this.field.options.autocompleteFillConfig || [];
|
|
375
|
+
if (!fillConfig.length) return;
|
|
376
|
+
let formModel = this.formModel;
|
|
377
|
+
fillConfig.forEach((cfg) => {
|
|
378
|
+
let targetField = trim(cfg.targetField);
|
|
379
|
+
let targetFormField = trim(cfg.targetFormField);
|
|
380
|
+
let sourceField = trim(cfg.sourceField);
|
|
381
|
+
let value = sourceField ? item[sourceField] ?? null : null;
|
|
382
|
+
if (targetField) {
|
|
383
|
+
let ref = this.getWidgetRef(targetField);
|
|
384
|
+
if (ref && ref.setValue) {
|
|
385
|
+
ref.setValue(value);
|
|
386
|
+
}
|
|
387
|
+
} else if (targetFormField) {
|
|
388
|
+
formModel[targetFormField] = value;
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
},
|
|
392
|
+
/**
|
|
393
|
+
* 通过 ID 反查名称(编辑态回显场景)。
|
|
394
|
+
* 当 fieldModel 有值但 currentData[displayField] 为空时调用。
|
|
395
|
+
*/
|
|
396
|
+
fetchLabelById(id) {
|
|
397
|
+
let formScriptEnabled = this.field.options.formScriptEnabled || false;
|
|
398
|
+
let scriptCode = this.field.options.formScriptCode;
|
|
399
|
+
let getByIdScriptCode = this.field.options.getByIdScriptCode;
|
|
400
|
+
if (!formScriptEnabled || !id) return;
|
|
401
|
+
//优先使用专用的 getById 脚本;否则不自动反查
|
|
402
|
+
if (!getByIdScriptCode) return;
|
|
403
|
+
let reportTemplate = this.getFormRef().reportTemplate;
|
|
404
|
+
let accessParam = this.handleCustomEvent(
|
|
405
|
+
this.field.options.formScriptParam
|
|
406
|
+
);
|
|
407
|
+
let innerData;
|
|
408
|
+
if (this.field.options.conditionFormat) {
|
|
409
|
+
//condition 传值格式:按 关联来源字段 eq id 反查
|
|
410
|
+
let extra = accessParam || {};
|
|
411
|
+
let conditions = Array.isArray(extra.condition)
|
|
412
|
+
? extra.condition.slice()
|
|
413
|
+
: [];
|
|
414
|
+
conditions.push({
|
|
415
|
+
value: id,
|
|
416
|
+
field: this.valueField,
|
|
417
|
+
filter: "eq",
|
|
418
|
+
});
|
|
419
|
+
innerData = {
|
|
420
|
+
current: 1,
|
|
421
|
+
size: this.field.options.conditionSize || 100,
|
|
422
|
+
searchCount: true,
|
|
423
|
+
...extra,
|
|
424
|
+
condition: conditions,
|
|
425
|
+
};
|
|
426
|
+
} else {
|
|
427
|
+
innerData = {
|
|
428
|
+
...accessParam,
|
|
429
|
+
id: id,
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
let taBm = this.field.options.conditionFormat
|
|
433
|
+
? this.conditionTaBm
|
|
434
|
+
: undefined;
|
|
435
|
+
let data = this.buildFormScriptData(reportTemplate, innerData, taBm);
|
|
436
|
+
return this.formHttp({
|
|
437
|
+
scriptCode: getByIdScriptCode,
|
|
438
|
+
isLoading: false,
|
|
439
|
+
data: data,
|
|
440
|
+
callback: (res) => {
|
|
441
|
+
let rows = res.objx?.records || res.objx || [];
|
|
442
|
+
let row = Array.isArray(rows) ? rows[0] : rows;
|
|
443
|
+
if (row) {
|
|
444
|
+
let label = row[this.sourceLabelField] ?? null;
|
|
445
|
+
this.setShowValue(label);
|
|
446
|
+
}
|
|
447
|
+
},
|
|
448
|
+
});
|
|
449
|
+
},
|
|
450
|
+
},
|
|
451
|
+
};
|