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
|
@@ -50,6 +50,12 @@ import FormItemWrapper from "./form-item-wrapper";
|
|
|
50
50
|
import emitter from "../../../../../components/xform/utils/emitter";
|
|
51
51
|
import i18n from "../../../../../components/xform/utils/i18n";
|
|
52
52
|
import fieldMixin from "../../../../../components/xform/form-designer/form-widget/field-widget/fieldMixin";
|
|
53
|
+
import {
|
|
54
|
+
normalizeAttachmentValue,
|
|
55
|
+
isSameAttachmentRows,
|
|
56
|
+
isSameModelValue,
|
|
57
|
+
toModelValue,
|
|
58
|
+
} from "../../../../../components/xform/utils/attachmentValueUtil";
|
|
53
59
|
|
|
54
60
|
export default {
|
|
55
61
|
name: "vabUpload-widget",
|
|
@@ -94,7 +100,20 @@ export default {
|
|
|
94
100
|
},
|
|
95
101
|
watch: {
|
|
96
102
|
fieldModel(val) {
|
|
97
|
-
|
|
103
|
+
/* fieldMixin.initValueWatchEvent 监听模型值,一变就 initFieldModel(true) 把
|
|
104
|
+
模型值原样灌回 fieldModel——URL 模式下灌回来的是字符串/字符串数组,会打破
|
|
105
|
+
「fieldModel 恒为附件对象数组」这个内部约定,所以这里兜底归一。 */
|
|
106
|
+
let rows = normalizeAttachmentValue(val);
|
|
107
|
+
if (!isSameAttachmentRows(rows, val)) {
|
|
108
|
+
this.fieldModel = rows;
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
/* 落到表单模型的值由 urlValueEnabled 决定是对象数组还是 URL 字符串。
|
|
112
|
+
默认模式下 rows 就是 val 本身(归一未改动任何东西),写回模型的是同一个
|
|
113
|
+
引用,模型值身份不变,不会触发 initValueWatchEvent 回灌。 */
|
|
114
|
+
let modelValue = this.toModelValue(rows);
|
|
115
|
+
if (this.isSameFieldModelValue(modelValue)) return;
|
|
116
|
+
this.handleChangeEvent(modelValue);
|
|
98
117
|
},
|
|
99
118
|
},
|
|
100
119
|
computed: {
|
|
@@ -114,6 +133,7 @@ export default {
|
|
|
114
133
|
this.isH5 = this.getFormConfig().layoutType === "H5";
|
|
115
134
|
|
|
116
135
|
this.initFieldModel();
|
|
136
|
+
this.initAttachmentValue();
|
|
117
137
|
this.registerToRefList();
|
|
118
138
|
this.initEventHandler();
|
|
119
139
|
this.buildFieldRules();
|
|
@@ -129,12 +149,49 @@ export default {
|
|
|
129
149
|
this.unregisterFromRefList();
|
|
130
150
|
},
|
|
131
151
|
methods: {
|
|
152
|
+
/* 模型里存的可能是 URL 字符串/数组(urlValueEnabled)或外部塞进来的 URL,
|
|
153
|
+
统一归一成附件对象数组,组件内部只处理这一种形态 */
|
|
154
|
+
initAttachmentValue() {
|
|
155
|
+
let rows = normalizeAttachmentValue(this.fieldModel);
|
|
156
|
+
/* 归一前后等价就不重新赋值,换新数组会让 watcher 白触发一次 onChange */
|
|
157
|
+
if (!isSameAttachmentRows(rows, this.fieldModel)) {
|
|
158
|
+
this.fieldModel = rows;
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
toModelValue(rows) {
|
|
162
|
+
return toModelValue(rows, this.field.options);
|
|
163
|
+
},
|
|
164
|
+
/* URL 模式下 toModelValue 每次都产出新数组,值没变也回写模型的话,会和
|
|
165
|
+
initValueWatchEvent 形成「写模型 → 灌回 fieldModel → 又写模型」的死循环
|
|
166
|
+
(多值模式页面直接卡死)。默认模式模型值就是 fieldModel 本身、身份不变,
|
|
167
|
+
不存在这个问题,行为保持原样。 */
|
|
168
|
+
isSameFieldModelValue(modelValue) {
|
|
169
|
+
if (!this.field.options.urlValueEnabled) return false;
|
|
170
|
+
let currentData = this.tableRow ? this.tableRow : this.formModel;
|
|
171
|
+
let current = currentData ? currentData[this.fieldKeyName] : undefined;
|
|
172
|
+
return isSameModelValue(current, modelValue);
|
|
173
|
+
},
|
|
132
174
|
setValue(val) {
|
|
133
|
-
let data = val
|
|
175
|
+
let data = normalizeAttachmentValue(val);
|
|
176
|
+
let modelValue = this.toModelValue(data);
|
|
177
|
+
// 按 tableParam 决定落点:行内附件写回当前行对象,主表写回表单模型。
|
|
178
|
+
// 旧实现固定写 getFormRef().formDataModel(顶层),明细行/子表单里的附件
|
|
179
|
+
// 会写错位置并丢失联动,且多行会互相覆盖同一个顶层字段。
|
|
180
|
+
let currentData = this.tableRow ? this.tableRow : this.formModel;
|
|
181
|
+
if (currentData[this.fieldKeyName] === undefined) {
|
|
182
|
+
this.$set(currentData, this.fieldKeyName, modelValue);
|
|
183
|
+
}
|
|
184
|
+
// 赋值 fieldModel 会触发 watch.fieldModel -> handleChangeEvent(内部再走
|
|
185
|
+
// syncUpdateFormModel + emitFieldDataChange,异步一次)。这里再同步写一次模型,
|
|
186
|
+
// 保证 setValue 返回后立即可读到最新值,且落点与 watcher 一致。
|
|
134
187
|
this.fieldModel = data;
|
|
135
|
-
this.
|
|
188
|
+
this.syncUpdateFormModel(modelValue);
|
|
136
189
|
},
|
|
137
190
|
loadDataDefaultHandle() {
|
|
191
|
+
/* URL 模式下值就存在主表列上、随表单 getOne 一起回来,不存在独立附件记录。
|
|
192
|
+
再发这一包不仅多余,查不到还会 setValue([]) 把主表带回来的 URL 清掉。
|
|
193
|
+
在这里拦截而不是改 onCreated 脚本,已有表单不用逐个改配置。 */
|
|
194
|
+
if (this.field.options.urlValueEnabled) return;
|
|
138
195
|
let dataId = this.formDataId;
|
|
139
196
|
if (!dataId) return;
|
|
140
197
|
let reportTemplate = this.getFormRef().reportTemplate;
|
|
@@ -174,98 +231,10 @@ export default {
|
|
|
174
231
|
eventParamValues
|
|
175
232
|
);
|
|
176
233
|
},
|
|
234
|
+
/* 脚本 API:直接用 URL 赋值,支持单个 URL、逗号/换行分隔的多个 URL、URL 数组。
|
|
235
|
+
非法输入不再抛异常,会被忽略并在控制台告警。 */
|
|
177
236
|
setValueByUrl(fileUrl) {
|
|
178
|
-
|
|
179
|
-
if (fileUrl) {
|
|
180
|
-
let row = this.parseFileUrl(fileUrl);
|
|
181
|
-
if (row) {
|
|
182
|
-
value.push(row);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
this.setValue(value);
|
|
186
|
-
},
|
|
187
|
-
parseFileUrl(fileUrl) {
|
|
188
|
-
if (!fileUrl) return null;
|
|
189
|
-
let result = null;
|
|
190
|
-
|
|
191
|
-
// 输入校验
|
|
192
|
-
if (typeof fileUrl !== "string") {
|
|
193
|
-
throw new TypeError("输入必须是字符串格式");
|
|
194
|
-
}
|
|
195
|
-
if (!fileUrl.trim()) {
|
|
196
|
-
throw new Error("URL不能为空");
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// 基本URL格式验证
|
|
200
|
-
const urlRegex =
|
|
201
|
-
/^(https?:\/\/)?([\w.-]+)(:\d+)?(\/[^?#]*)?(\?[^#]*)?(#.*)?$/i;
|
|
202
|
-
if (!urlRegex.test(fileUrl)) {
|
|
203
|
-
throw new Error("无效的URL格式");
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
// 提取域名部分
|
|
207
|
-
const domainRegex = /^(https?:\/\/[^\/]+)/i;
|
|
208
|
-
const domainMatch = fileUrl.match(domainRegex);
|
|
209
|
-
if (!domainMatch) {
|
|
210
|
-
throw new Error("URL缺少协议或域名部分");
|
|
211
|
-
}
|
|
212
|
-
const domain = domainMatch[0];
|
|
213
|
-
|
|
214
|
-
// 提取完整路径
|
|
215
|
-
const url = fileUrl.substring(domain.length);
|
|
216
|
-
if (!url || url === "/") {
|
|
217
|
-
throw new Error("URL缺少文件路径部分");
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// 提取带扩展名的文件名
|
|
221
|
-
const filenameRegex = /[^\/]+$/;
|
|
222
|
-
const filenameMatch = url.match(filenameRegex);
|
|
223
|
-
if (!filenameMatch) {
|
|
224
|
-
throw new Error("无法从路径中提取文件名");
|
|
225
|
-
}
|
|
226
|
-
const fullFilename = filenameMatch[0];
|
|
227
|
-
|
|
228
|
-
// 验证文件名格式(至少1字符+扩展名)
|
|
229
|
-
const nameFormat = /^.+\..+$/;
|
|
230
|
-
if (!nameFormat.test(fullFilename)) {
|
|
231
|
-
throw new Error(`无效的文件名格式: ${fullFilename}`);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
// 修复点:更可靠的文件名和扩展名分离
|
|
235
|
-
const lastDotIndex = fullFilename.lastIndexOf(".");
|
|
236
|
-
const filenameBase = fullFilename.substring(0, lastDotIndex); // 点之前部分
|
|
237
|
-
const extension = fullFilename.substring(lastDotIndex + 1).toLowerCase(); // 点之后部分
|
|
238
|
-
|
|
239
|
-
// 扩展名验证
|
|
240
|
-
/* const validExtensions = ['jpg', 'jpeg', 'png', 'gif', 'webp', 'svg', 'bmp'];
|
|
241
|
-
if (!validExtensions.includes(extension)) {
|
|
242
|
-
throw new Error(`不支持的扩展名类型: ${extension}`);
|
|
243
|
-
} */
|
|
244
|
-
|
|
245
|
-
let thumbnail = null,
|
|
246
|
-
large = null,
|
|
247
|
-
medium = null,
|
|
248
|
-
source = null;
|
|
249
|
-
if (this.$commonFileUtil.isPicture(extension)) {
|
|
250
|
-
thumbnail = url;
|
|
251
|
-
large = url;
|
|
252
|
-
medium = url;
|
|
253
|
-
source = url;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
result = {
|
|
257
|
-
extension,
|
|
258
|
-
domain,
|
|
259
|
-
url,
|
|
260
|
-
thumbnail,
|
|
261
|
-
large,
|
|
262
|
-
medium,
|
|
263
|
-
source,
|
|
264
|
-
name: fullFilename,
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
// 返回结构化对象
|
|
268
|
-
return result;
|
|
237
|
+
this.setValue(normalizeAttachmentValue(fileUrl));
|
|
269
238
|
},
|
|
270
239
|
/*handlLineCode(fileInfos) {
|
|
271
240
|
let allPromise = [];
|