cloud-web-corejs 1.0.54-dev.72 → 1.0.54-dev.721
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 +23 -14
- package/src/App.vue +30 -34
- package/src/api/user.js +85 -40
- package/src/components/Qrcode/fileParse.vue +0 -1
- package/src/components/Tinymce/index.vue +112 -71
- package/src/components/VabUpload/fileLibraryDialog.vue +296 -0
- package/src/components/VabUpload/image-viewer.vue +2 -2
- package/src/components/VabUpload/index.js +69 -1
- package/src/components/VabUpload/index.vue +9 -1
- package/src/components/VabUpload/mixins/fileLibraryDialog.js +1112 -0
- package/src/components/VabUpload/mixins.js +1881 -2
- package/src/components/VabUpload/propertiesDialog.vue +3 -3
- package/src/components/VabUpload/view.vue +209 -120
- package/src/components/advancedSearchDialog/mixins.js +28 -1
- package/src/components/base-textarea/index.vue +104 -0
- package/src/components/baseAlert/index.js +44 -1
- package/src/components/baseAlert/index.vue +24 -20
- package/src/components/baseAlert/mixins.js +61 -1
- package/src/components/baseArea/index.vue +1543 -0
- package/src/components/baseAttachment/index.vue +49 -40
- package/src/components/baseAttachment/install.js +21 -5
- package/src/components/baseAttachment/mixins.js +310 -1
- package/src/components/baseInputBatch/mixins.js +58 -1
- package/src/components/baseInputExport/index.vue +21 -14
- package/src/components/baseInputExport/mixins.js +391 -1
- package/src/components/baseTabs/index.vue +16 -8
- package/src/components/baseTabs/mixins.js +166 -1
- package/src/components/cnPrint/index.js +44 -1
- package/src/components/cnPrint/mixins.js +189 -1
- package/src/components/code-editor/index.vue +131 -62
- package/src/components/confirmDialog/index.js +41 -1
- package/src/components/confirmDialog/index.vue +24 -17
- package/src/components/confirmDialog/mixins.js +31 -1
- package/src/components/errorMsg/index.js +1 -1
- package/src/components/errorMsg/index.vue +78 -70
- package/src/components/errorMsg/mixins.js +6 -5
- package/src/components/excelExport/button.vue +86 -24
- package/src/components/excelExport/exportFieldDialog.vue +215 -81
- package/src/components/excelExport/index.js +51 -6
- package/src/components/excelExport/index.vue +108 -26
- package/src/components/excelExport/mixins.js +1051 -8
- package/src/components/excelImport/index.js +13 -13
- package/src/components/excelImport/mixins.js +2 -1
- package/src/components/fileLibrary/fileObjAuthDialog.vue +179 -89
- package/src/components/fileLibrary/fileObjAuthEditDialog.vue +6 -0
- package/src/components/fileLibrary/filterDialog.vue +454 -0
- package/src/components/fileLibrary/index.vue +692 -269
- package/src/components/fileLibrary/mixins/categoryMoveDialogMixins.js +1 -1
- package/src/components/fileLibrary/mixins/fileCategoryDialogMixins.js +1 -1
- package/src/components/fileLibrary/mixins/fileHistoryDialogMixins.js +2 -2
- package/src/components/fileLibrary/mixins/fileObjAuthDialogMixin.js +339 -211
- package/src/components/fileLibrary/mixins/fileObjAuthEditDialogMixin.js +31 -27
- package/src/components/fileLibrary/mixins/fileObjAuthEditMixin.js +4 -4
- package/src/components/fileLibrary/mixins/indexMixins.js +220 -101
- package/src/components/fileLibrary/mixins/propertiesDialogMixins.js +62 -3
- package/src/components/fileLibrary/mixins/recycleBinDialogMixins.js +3 -3
- package/src/components/fileLibrary/propertiesDialog.vue +119 -74
- package/src/components/fileLibrary/shareDialog.vue +1 -1
- package/src/components/formOplog/mixins.js +85 -4
- package/src/components/hiprint/css/bootstrap.min.css +6 -0
- package/src/components/hiprint/fonts/glyphicons-halflings-regular.eot +0 -0
- package/src/components/hiprint/fonts/glyphicons-halflings-regular.svg +288 -0
- package/src/components/hiprint/fonts/glyphicons-halflings-regular.ttf +0 -0
- package/src/components/hiprint/fonts/glyphicons-halflings-regular.woff +0 -0
- package/src/components/hiprint/fonts/glyphicons-halflings-regular.woff2 +0 -0
- package/src/components/hiprint/hiprint.bundle.js +15 -3
- package/src/components/hiprint/view/design/index.vue +140 -47
- package/src/components/hiprint/view/design/mixins.js +611 -1
- package/src/components/hiprint/view/design/preview.vue +75 -52
- package/src/components/hiprint/view/json-view.vue +31 -31
- package/src/components/jdPrint/index.js +44 -1
- package/src/components/jdPrint/mixins.js +208 -1
- package/src/components/jsonImport/exportUtil.js +106 -0
- package/src/components/jsonImport/index.js +212 -17
- package/src/components/jsonImport/mixins.js +333 -1
- package/src/components/langImport/index.js +80 -1
- package/src/components/langImport/mixins.js +500 -16
- package/src/components/langTag/mixins/addButton.js +51 -5
- package/src/components/langTag/mixins/deleteButton.js +55 -5
- package/src/components/langTag/mixins/view.js +47 -5
- package/src/components/luckysheet/dialog.vue +159 -0
- package/src/components/luckysheet/export.js +595 -0
- package/src/components/luckysheet/fileUtils.js +147 -0
- package/src/components/luckysheet/index.js +72 -0
- package/src/components/luckysheet/templateJson.js +12078 -0
- package/src/components/luckysheet/view.vue +210 -0
- package/src/components/obsUpload/index.js +34 -0
- package/src/components/obsUpload/index.vue +231 -0
- package/src/components/obsUpload/mixins.js +1476 -0
- package/src/components/onlineTalk/index.vue +1 -1
- package/src/components/onlineTalk/mixins.js +852 -1
- package/src/components/onlineTalk/talkUserDialog.vue +280 -0
- package/src/components/oplogTable/mixins.js +83 -4
- package/src/components/pddPrint/index.js +44 -1
- package/src/components/pddPrint/mixins.js +252 -1
- package/src/components/projectTag/mixins/addButton.js +52 -1
- package/src/components/projectTag/mixins/deleteButton.js +52 -1
- package/src/components/projectTag/mixins/view.js +43 -1
- package/src/components/scriptDescription/button.vue +12 -4
- package/src/components/scriptDescription/mixins.js +30 -1
- package/src/components/scriptTest/mixins.js +90 -1
- package/src/components/statusTag/mixins.js +66 -1
- package/src/components/table/CellSlot.vue +12 -9
- package/src/components/table/config.js +1 -1
- package/src/components/table/index.js +1191 -11
- package/src/components/table/plugins/extend-cell-area/vxe-table-extend-cell-area.es6.min.js +11028 -0
- package/src/components/table/plugins/extend-cell-area/vxe-table-extend-cell-area.min.css +200 -0
- package/src/components/table/tableForm.vue +99 -63
- package/src/components/table/tableFormMixin.js +1 -1
- package/src/components/table/util/index.js +339 -0
- package/src/components/table/vxeFilter/index.js +2 -1
- package/src/components/table/vxeFilter/mixin.js +8 -6
- package/src/components/tempStorage/index.vue +76 -55
- package/src/components/tempStorage/tempStorageDialog.vue +179 -54
- package/src/components/vb-tabs/x-tabs.vue +56 -30
- package/src/components/vipPrint/index.js +44 -1
- package/src/components/vipPrint/mixins.js +268 -1
- package/src/components/wf/addOpinionButton.vue +57 -0
- package/src/components/wf/content.vue +834 -362
- package/src/components/wf/mixins/addOpinionButton.js +53 -0
- package/src/components/wf/mixins/setCandidateButton.js +161 -0
- package/src/components/wf/mixins/setCandidateDialog.js +213 -1
- package/src/components/wf/mixins/setCandidateDialog2.js +252 -0
- package/src/components/wf/mixins/wfFlowEleScriptDialog.js +131 -0
- package/src/components/wf/mixins/wfTaskUserRangeDialog.js +69 -0
- package/src/components/wf/setCandidateButton.vue +40 -0
- package/src/components/wf/setCandidateDialog.vue +10 -0
- package/src/components/wf/setCandidateDialog2.vue +105 -0
- package/src/components/wf/wf.js +2159 -1
- package/src/components/wf/wfFlowEleScriptDialog.vue +89 -0
- package/src/components/wf/wfStartDialog.vue +66 -42
- package/src/components/wf/wfTaskUserRangeDialog.vue +65 -0
- package/src/components/wf/wfUtil.js +280 -1
- package/src/components/xform/XFormTabContainer/IMPLEMENTATION_PLAN.md +1079 -0
- package/src/components/xform/XFormTabContainer//346/226/260/345/242/236/351/241/265/347/255/276/346/250/241/345/274/217-/350/220/275/345/234/260/345/256/236/346/226/275/346/226/207/346/241/243.md +232 -0
- package/src/components/xform/XFormTabContainer//346/226/260/345/242/236/351/241/265/347/255/276/346/250/241/345/274/217/345/256/236/347/216/260/346/226/271/346/241/210.md +511 -0
- package/src/components/xform/docs/autocomplete /350/207/252/345/212/250/345/256/214/346/210/220/347/273/204/344/273/266/350/257/264/346/230/216.md" +126 -0
- package/src/components/xform/docs//345/220/216/345/217/260/345/255/227/346/256/265/357/274/210/345/212/250/346/200/201/347/224/237/346/210/220/357/274/211JSON /350/257/264/346/230/216.md" +1286 -0
- package/src/components/xform/docs//345/257/271/346/257/224/345/212/237/350/203/275/350/220/275/345/234/260/346/226/271/346/241/210.md +569 -0
- package/src/components/xform/docs//346/225/260/346/215/256/350/241/250/346/240/274/345/212/250/346/200/201/345/210/227 JSON /350/257/264/346/230/216.md" +657 -0
- package/src/components/xform/form-designer/designer.js +2003 -9
- package/src/components/xform/form-designer/form-widget/components/gantt/index.vue +434 -0
- package/src/components/xform/form-designer/form-widget/container-widget/containerMixin.js +1 -1
- package/src/components/xform/form-designer/form-widget/container-widget/data-table-mixin.js +9 -8
- package/src/components/xform/form-designer/form-widget/container-widget/data-table-widget.vue +14 -1
- package/src/components/xform/form-designer/form-widget/container-widget/detail-pane-widget.vue +3 -2
- package/src/components/xform/form-designer/form-widget/container-widget/detail-widget.vue +3 -3
- package/src/components/xform/form-designer/form-widget/dialog/baseFormulaDialog copy.vue +971 -0
- package/src/components/xform/form-designer/form-widget/dialog/baseFormulaDialog.vue +971 -0
- package/src/components/xform/form-designer/form-widget/dialog/exportDialog.vue +13 -0
- package/src/components/xform/form-designer/form-widget/dialog/fileReferenceDialog.vue +301 -0
- package/src/components/xform/form-designer/form-widget/dialog/formDialog.vue +85 -48
- package/src/components/xform/form-designer/form-widget/dialog/formDrawer.vue +5 -1
- package/src/components/xform/form-designer/form-widget/dialog/formulaDialog.vue +799 -0
- package/src/components/xform/form-designer/form-widget/dialog/importDialog.vue +30 -8
- package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin.js +1762 -9
- package/src/components/xform/form-designer/form-widget/dialog/searchFormDialog.vue +222 -75
- package/src/components/xform/form-designer/form-widget/field-widget/a-link-widget.vue +67 -54
- package/src/components/xform/form-designer/form-widget/field-widget/a-text-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/area-select-widget.vue +260 -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/baseAttachment-widget.vue +32 -13
- package/src/components/xform/form-designer/form-widget/field-widget/button-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/cascader-widget.vue +209 -90
- package/src/components/xform/form-designer/form-widget/field-widget/census-widget.vue +41 -35
- package/src/components/xform/form-designer/form-widget/field-widget/checkbox-widget.vue +18 -7
- package/src/components/xform/form-designer/form-widget/field-widget/color-widget.vue +4 -1
- package/src/components/xform/form-designer/form-widget/field-widget/copy_button-widget.vue +95 -0
- package/src/components/xform/form-designer/form-widget/field-widget/date-range-widget.vue +14 -3
- package/src/components/xform/form-designer/form-widget/field-widget/date-widget.vue +48 -5
- package/src/components/xform/form-designer/form-widget/field-widget/download-button-widget.vue +133 -0
- package/src/components/xform/form-designer/form-widget/field-widget/dropdown-item-widget.vue +86 -0
- package/src/components/xform/form-designer/form-widget/field-widget/dropdown-widget.vue +170 -0
- package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +1940 -16
- package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +921 -379
- package/src/components/xform/form-designer/form-widget/field-widget/gantt-widget.vue +964 -0
- package/src/components/xform/form-designer/form-widget/field-widget/html-text-widget.vue +6 -2
- package/src/components/xform/form-designer/form-widget/field-widget/import-button-widget.vue +22 -11
- package/src/components/xform/form-designer/form-widget/field-widget/import2-button-widget.vue +90 -0
- package/src/components/xform/form-designer/form-widget/field-widget/input-widget.vue +7 -2
- 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/echart-bar-mixin.js +3 -9
- package/src/components/xform/form-designer/form-widget/field-widget/mixins/echart-category-mixin.js +3 -9
- package/src/components/xform/form-designer/form-widget/field-widget/mixins/echart-pie-mixin.js +3 -9
- 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/mixins/vabsearch-mixin.js +192 -0
- package/src/components/xform/form-designer/form-widget/field-widget/multiSearch-widget.vue +53 -0
- package/src/components/xform/form-designer/form-widget/field-widget/number-widget.vue +117 -81
- package/src/components/xform/form-designer/form-widget/field-widget/oplog-widget.vue +186 -0
- package/src/components/xform/form-designer/form-widget/field-widget/print-button-widget.vue +55 -28
- package/src/components/xform/form-designer/form-widget/field-widget/print-detail-button-widget.vue +119 -0
- package/src/components/xform/form-designer/form-widget/field-widget/project-tag-widget.vue +156 -54
- package/src/components/xform/form-designer/form-widget/field-widget/radio-widget.vue +26 -6
- 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 +146 -0
- package/src/components/xform/form-designer/form-widget/field-widget/search_button-widget.vue +2 -2
- package/src/components/xform/form-designer/form-widget/field-widget/select-export-button-widget.vue +86 -0
- package/src/components/xform/form-designer/form-widget/field-widget/select-export-item-button-widget.vue +92 -0
- package/src/components/xform/form-designer/form-widget/field-widget/select-widget.vue +24 -9
- package/src/components/xform/form-designer/form-widget/field-widget/singerSearch-widget.vue +53 -0
- package/src/components/xform/form-designer/form-widget/field-widget/singleUpload-widget.vue +145 -0
- package/src/components/xform/form-designer/form-widget/field-widget/static-content-wrapper.vue +16 -1
- package/src/components/xform/form-designer/form-widget/field-widget/static-text-widget.vue +8 -3
- package/src/components/xform/form-designer/form-widget/field-widget/status-widget.vue +93 -49
- package/src/components/xform/form-designer/form-widget/field-widget/switch-widget.vue +9 -1
- package/src/components/xform/form-designer/form-widget/field-widget/table-export-button-widget.vue +38 -38
- package/src/components/xform/form-designer/form-widget/field-widget/tableexportbuttonwidget.vue +99 -0
- package/src/components/xform/form-designer/form-widget/field-widget/tempStorage-widget.vue +147 -0
- package/src/components/xform/form-designer/form-widget/field-widget/text-widget.vue +111 -34
- package/src/components/xform/form-designer/form-widget/field-widget/time-range-widget.vue +4 -3
- package/src/components/xform/form-designer/form-widget/field-widget/time-widget.vue +2 -1
- package/src/components/xform/form-designer/form-widget/field-widget/vabSearch-widget.vue +3 -171
- package/src/components/xform/form-designer/form-widget/field-widget/vabUpload-widget.vue +187 -70
- package/src/components/xform/form-designer/form-widget/field-widget/vabUpload2-widget.vue +753 -0
- package/src/components/xform/form-designer/form-widget/field-widget/vue-page-widget.vue +231 -0
- package/src/components/xform/form-designer/form-widget/indexMixin.js +1 -1
- package/src/components/xform/form-designer/indexMixin.js +838 -13
- package/src/components/xform/form-designer/refMixinDesign.js +1 -28
- 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 +993 -172
- package/src/components/xform/form-designer/setting-panel/index.vue +41 -32
- package/src/components/xform/form-designer/setting-panel/indexMixin.js +1 -1
- package/src/components/xform/form-designer/setting-panel/option-items-setting.vue +585 -302
- package/src/components/xform/form-designer/setting-panel/property-editor/a-link-editor.vue +4 -4
- package/src/components/xform/form-designer/setting-panel/property-editor/a-text-editor.vue +3 -3
- package/src/components/xform/form-designer/setting-panel/property-editor/autoValueEnabled-editor.vue +38 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/buttonIcon-editor.vue +14 -15
- package/src/components/xform/form-designer/setting-panel/property-editor/censusClass-editor.vue +6 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/colorClass-editor.vue +28 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/commonAttributeEnabled-editor.vue +41 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/columnRenderDialog.vue +125 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +1154 -1048
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/edit-tree-button-group-config-dialog.vue +281 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/exportItemColumns-dialog.vue +432 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/onCheckboxChange-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +1632 -592
- package/src/components/xform/form-designer/setting-panel/property-editor/container-detail/detail-editor.vue +3 -3
- package/src/components/xform/form-designer/setting-panel/property-editor/container-detail-pane/detail-pane-editor.vue +3 -3
- 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-list-h5/list-h5-editor.vue +34 -46
- 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/container-tree/tree-customClass-editor.vue +31 -2
- package/src/components/xform/form-designer/setting-panel/property-editor/copyButton-editor.vue +36 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/downloadButtonFlag-editor.vue +32 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/dropdownFlag-editor.vue +133 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/eventMixin.js +2 -2
- package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/onClick-editor.vue +23 -8
- 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/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-button/clickBindEvent-editor.vue +35 -20
- package/src/components/xform/form-designer/setting-panel/property-editor/field-button/icon-editor.vue +14 -15
- package/src/components/xform/form-designer/setting-panel/property-editor/field-button/search-dialog-event-editor.vue +64 -5
- package/src/components/xform/form-designer/setting-panel/property-editor/field-cascader/cascader-multiple-editor.vue +8 -3
- package/src/components/xform/form-designer/setting-panel/property-editor/field-cascader/checkStrictly-editor.vue +11 -13
- 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-dropdown-menu/dropdown-item-editor.vue +21 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-dropdown-menu/dropdown-menu-editor.vue +59 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-gantt/gantt-editor.vue +36 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import-button-editor.vue +75 -21
- package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import2-button-editor.vue +96 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-print-button/print-button-editor.vue +44 -15
- package/src/components/xform/form-designer/setting-panel/property-editor/field-print-button/print-detail-button-editor.vue +115 -0
- 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-script-input/script-input-editor.vue +55 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-static-text/preWrap-editor.vue +23 -0
- 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 +67 -41
- package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/select-export-button-editor.vue +56 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/select-export-item-button-editor.vue +71 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-vabSearch/vabSearchName-editor.vue +13 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-vabUpload/field-vabUpload-editor.vue +33 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-vabUpload2/field-vabUpload2-editor.vue +66 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-vue-page/vue-page-editor.vue +48 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/formScriptEnabled-editor.vue +107 -19
- package/src/components/xform/form-designer/setting-panel/property-editor/formatType-editor.vue +137 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/formula-editor.vue +721 -466
- package/src/components/xform/form-designer/setting-panel/property-editor/labelColor-editor.vue +20 -11
- package/src/components/xform/form-designer/setting-panel/property-editor/labelIconClass-editor.vue +17 -16
- package/src/components/xform/form-designer/setting-panel/property-editor/labelIconPosition-editor.vue +25 -25
- package/src/components/xform/form-designer/setting-panel/property-editor/labelTooltip-editor.vue +67 -13
- 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/multiple-editor.vue +19 -14
- 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 +127 -50
- package/src/components/xform/form-designer/setting-panel/property-editor/oplog-editor.vue +31 -0
- 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/prefixIcon-editor.vue +14 -15
- package/src/components/xform/form-designer/setting-panel/property-editor/project-tag-editor.vue +349 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/required-editor.vue +10 -6
- package/src/components/xform/form-designer/setting-panel/property-editor/requiredHint-editor.vue +3 -3
- package/src/components/xform/form-designer/setting-panel/property-editor/suffixIcon-editor.vue +14 -15
- package/src/components/xform/form-designer/setting-panel/property-editor/tempStorage-editor.vue +42 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/textFlag-editor.vue +304 -19
- package/src/components/xform/form-designer/setting-panel/property-editor/utcTransformEnabled-editor.vue +19 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/validation-editor.vue +2 -2
- package/src/components/xform/form-designer/setting-panel/property-editor/validationHint-editor.vue +2 -2
- package/src/components/xform/form-designer/setting-panel/property-editor/wfFlag-editor.vue +372 -50
- package/src/components/xform/form-designer/setting-panel/property-editor/widgetShowRuleFlag-editor.vue +263 -0
- package/src/components/xform/form-designer/setting-panel/propertyRegister.js +230 -187
- package/src/components/xform/form-designer/setting-panel/widgetPropertyDialogMixin.js +186 -0
- package/src/components/xform/form-designer/toolbar-panel/index.vue +267 -103
- package/src/components/xform/form-designer/toolbar-panel/indexMixin.js +1 -1
- package/src/components/xform/form-designer/widget-panel/index.vue +50 -1
- package/src/components/xform/form-designer/widget-panel/indexMixin.js +19 -18
- package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +2264 -974
- 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 +1237 -11
- package/src/components/xform/form-render/container-item/data-table-item.vue +221 -203
- package/src/components/xform/form-render/container-item/data-table-mixin.js +4508 -1890
- package/src/components/xform/form-render/container-item/detail-item.vue +72 -48
- package/src/components/xform/form-render/container-item/detail-pane-item.vue +17 -3
- 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/grid-col-item.vue +10 -3
- package/src/components/xform/form-render/container-item/grid-item.vue +1 -1
- package/src/components/xform/form-render/container-item/list-h5-item.vue +1184 -419
- package/src/components/xform/form-render/container-item/sub-form-item.vue +10 -2
- package/src/components/xform/form-render/container-item/tab-item.vue +62 -25
- package/src/components/xform/form-render/container-item/table-cell-item.vue +38 -32
- package/src/components/xform/form-render/container-item/table-item.vue +7 -7
- package/src/components/xform/form-render/container-item/table2-cell-item.vue +53 -34
- package/src/components/xform/form-render/container-item/table2-item.vue +198 -99
- package/src/components/xform/form-render/container-item/tree-item.vue +32 -11
- package/src/components/xform/form-render/dynamicDialogRender.js +1 -1
- package/src/components/xform/form-render/formDynamicFieldMixin.js +131 -0
- package/src/components/xform/form-render/index.vue +86 -21
- package/src/components/xform/form-render/indexMixin.js +4781 -12
- package/src/components/xform/form-render/refMixin.js +3 -3
- package/src/components/xform/icon-picker/icons.json +284 -0
- package/src/components/xform/icon-picker/index.vue +145 -0
- package/src/components/xform/lang/en-US.js +12 -1
- package/src/components/xform/lang/en-US_extension.js +4 -0
- package/src/components/xform/lang/zh-CN.js +117 -90
- package/src/components/xform/mixins/defaultHandle.js +458 -2
- package/src/components/xform/mixins/scriptHttp.js +176 -3
- package/src/components/xform/utils/dynamicSchemaUtil.js +315 -0
- package/src/components/xform/utils/emitter.js +4 -4
- package/src/components/xform/utils/formHttp.js +162 -0
- package/src/components/xform/utils/format.js +205 -172
- package/src/components/xform/utils/formula-util.js +969 -0
- package/src/components/xform/utils/sfc-generator.js +2 -2
- package/src/components/xform/utils/smart-vue-i18n/index.js +2 -1
- package/src/components/xform/utils/tableCellValidateUtil.js +148 -0
- package/src/components/xform/utils/tableColumnHelper.js +155 -0
- package/src/components/xform/utils/util.js +1551 -1
- package/src/components/xform/utils/validators.js +2 -5
- package/src/components/xform/utils/vue2js-generator.js +2 -2
- package/src/components/xhsPrint/index.js +44 -1
- package/src/components/xhsPrint/mixins.js +269 -1
- package/src/directive/LimitNumber/index.js +125 -1
- package/src/directive/el-dialog-center/index.js +34 -1
- package/src/directive/el-drag-dialog/drag.js +86 -1
- package/src/directive/el-readonly/index.js +15 -1
- package/src/directive/permission/hasPermi.js +34 -1
- package/src/index.js +230 -190
- package/src/lang/index.js +56 -51
- package/src/lang/locale/en/login.js +27 -0
- package/src/lang/locale/zh/login.js +26 -0
- package/src/layout/components/AppMain.vue +13 -3
- package/src/layout/components/Sidebar/default.vue +1654 -1222
- package/src/layout/components/Sidebar/index.vue +6 -1
- package/src/layout/components/TagsView/index.vue +57 -15
- package/src/layout/components/createCompany/createCompanyDialog.vue +157 -0
- package/src/layout/components/extractedCode/createDialog.vue +92 -0
- package/src/layout/components/extractedCode/queryDialog.vue +103 -0
- package/src/layout/components/extractedCode/viewDialog.vue +207 -0
- package/src/layout/components/langTool.vue +33 -30
- package/src/layout/components/watermark/index.vue +83 -0
- package/src/layout/defaultLayout.vue +17 -9
- package/src/mixins/selectDialog/index.js +266 -1
- package/src/mixins/tableTree/index.js +199 -4
- package/src/mixins/wf/index.js +33 -1
- package/src/permission.js +135 -18
- package/src/resources/js/base/common.js +109 -109
- package/src/router/index.js +4 -7
- package/src/router/modules/customer.js +12 -18
- package/src/router/modules/system.js +4 -0
- package/src/store/config/index.js +83 -14
- package/src/store/getters.js +4 -1
- package/src/store/modules/permission.js +46 -41
- package/src/store/modules/settings.js +26 -1
- package/src/store/modules/tagsView.js +206 -5
- package/src/store/modules/user.js +367 -16
- package/src/utils/aes.js +2 -1
- package/src/utils/auth.js +1 -1
- package/src/utils/global.js +1 -1
- package/src/utils/index.js +2 -3
- package/src/utils/keepAlive.js +185 -1
- package/src/utils/pddLog.js +92 -0
- package/src/utils/pdfUtil.js +71 -0
- package/src/utils/repeatOpen.js +52 -0
- package/src/utils/request.js +1 -1
- package/src/utils/vab.js +1275 -27
- package/src/utils/validate.js +1 -1
- package/src/utils/wf.js +4 -4
- package/src/views/bd/setting/bd_attach_setting/edit.vue +5 -5
- package/src/views/bd/setting/bd_attach_setting/list.vue +28 -55
- package/src/views/bd/setting/bd_attach_setting/mixins/dialog.js +84 -1
- package/src/views/bd/setting/bd_attach_setting/mixins/edit.js +116 -5
- package/src/views/bd/setting/bd_attach_setting/mixins/list.js +239 -1
- package/src/views/bd/setting/bd_company_env/dialog.vue +174 -0
- package/src/views/bd/setting/bd_company_env/edit.vue +193 -0
- package/src/views/bd/setting/bd_company_env/list.vue +175 -0
- package/src/views/bd/setting/config_manage/list.vue +83 -0
- package/src/views/bd/setting/formVersion/button.vue +55 -0
- package/src/views/bd/setting/formVersion/compareBasicSection.vue +125 -0
- package/src/views/bd/setting/formVersion/compareCodeSection.vue +539 -0
- package/src/views/bd/setting/formVersion/compareContMixin.scss +65 -0
- package/src/views/bd/setting/formVersion/compareContent.vue +63 -0
- package/src/views/bd/setting/formVersion/compareDialog.vue +88 -0
- package/src/views/bd/setting/formVersion/compareMixin.js +93 -0
- package/src/views/bd/setting/formVersion/fieldCompare.vue +54 -0
- package/src/views/bd/setting/formVersion/formScriptCompareView.vue +94 -0
- package/src/views/bd/setting/formVersion/formTemplateCompareView.vue +74 -0
- package/src/views/bd/setting/formVersion/ftHistoryDialog.vue +489 -0
- package/src/views/bd/setting/formVersion/link.vue +58 -0
- package/src/views/bd/setting/formVersion/preformDialog.vue +87 -0
- package/src/views/bd/setting/formVersion/reverButton.vue +82 -0
- package/src/views/bd/setting/formVersion/tableDetailDiff.js +99 -0
- package/src/views/bd/setting/formVersion/tableModelCompareView.vue +514 -0
- package/src/views/bd/setting/formVersion/textDiff.js +102 -0
- package/src/views/bd/setting/form_import_log/edit.vue +130 -0
- package/src/views/bd/setting/form_import_log/list.vue +211 -0
- package/src/views/bd/setting/form_script/edit.vue +196 -74
- package/src/views/bd/setting/form_script/edit1.vue +410 -187
- package/src/views/bd/setting/form_script/form_list.vue +118 -37
- package/src/views/bd/setting/form_script/list.vue +95 -21
- package/src/views/bd/setting/form_script/list1.vue +205 -118
- package/src/views/bd/setting/form_script/mixins/dialog.js +130 -1
- package/src/views/bd/setting/form_script/mixins/edit.js +265 -7
- package/src/views/bd/setting/form_script/mixins/edit1.js +259 -9
- package/src/views/bd/setting/form_script/mixins/form_list.js +322 -14
- package/src/views/bd/setting/form_script/mixins/list.js +307 -4
- package/src/views/bd/setting/form_script/mixins/list1.js +512 -14
- package/src/views/bd/setting/form_script/mixins/list2.js +10 -1
- package/src/views/bd/setting/form_script/mixins/otherAuthDialog.js +194 -0
- package/src/views/bd/setting/form_script/mixins/preformDialog.js +34 -1
- package/src/views/bd/setting/form_script/otherAuthDialog.vue +83 -0
- package/src/views/bd/setting/form_template/batchWfObjConfigDialog.vue +3 -3
- package/src/views/bd/setting/form_template/edit.vue +355 -184
- package/src/views/bd/setting/form_template/formDesignerDialog.vue +171 -0
- package/src/views/bd/setting/form_template/list.vue +301 -214
- package/src/views/bd/setting/form_template/mixins/batchWfObjConfigDialog.js +279 -1
- package/src/views/bd/setting/form_template/mixins/dialog.js +103 -1
- package/src/views/bd/setting/form_template/mixins/edit.js +277 -9
- package/src/views/bd/setting/form_template/mixins/editWfObjConfigDialog.js +92 -1
- package/src/views/bd/setting/form_template/mixins/ftHistoryDialog.js +91 -1
- package/src/views/bd/setting/form_template/mixins/itemEdit.js +104 -1
- package/src/views/bd/setting/form_template/mixins/itemList.js +234 -1
- package/src/views/bd/setting/form_template/mixins/list.js +721 -22
- package/src/views/bd/setting/form_template/mixins/list2.js +411 -0
- package/src/views/bd/setting/form_template/mixins/otherAuthDialog.js +193 -0
- package/src/views/bd/setting/form_template/mixins/preformDialog.js +28 -3
- package/src/views/bd/setting/form_template/mixins/wf_list.js +421 -3
- package/src/views/bd/setting/form_template/otherAuthDialog.vue +83 -0
- package/src/views/bd/setting/form_template/wfObjConfigDialog.vue +2 -2
- package/src/views/bd/setting/form_template/wf_list.vue +161 -127
- package/src/views/bd/setting/logic_param/edit.vue +146 -0
- package/src/views/bd/setting/logic_param/edit1.vue +106 -0
- package/src/views/bd/setting/logic_param/edit2.vue +139 -0
- package/src/views/bd/setting/logic_param/list.vue +74 -0
- package/src/views/bd/setting/logic_param/list1.vue +12 -0
- package/src/views/bd/setting/logic_param/list2.vue +12 -0
- package/src/views/bd/setting/logic_param/mixins/edit.js +93 -0
- package/src/views/bd/setting/logic_param/mixins/list.js +376 -0
- package/src/views/bd/setting/menu_kind/list.vue +172 -83
- package/src/views/bd/setting/menu_kind/mixins/authDialog.js +300 -7
- package/src/views/bd/setting/menu_kind/mixins/dialog.js +139 -1
- package/src/views/bd/setting/menu_kind/mixins/list.js +201 -1
- package/src/views/bd/setting/push_data/edit.vue +139 -0
- package/src/views/bd/setting/push_data/list.vue +283 -0
- package/src/views/bd/setting/push_data_h/edit.vue +153 -0
- package/src/views/bd/setting/push_data_h/list.vue +293 -0
- package/src/views/bd/setting/request_async_setting/edit.vue +320 -0
- package/src/views/bd/setting/request_async_setting/list.vue +372 -0
- package/src/views/bd/setting/request_setting/edit.vue +300 -0
- package/src/views/bd/setting/request_setting/list.vue +301 -0
- package/src/views/bd/setting/table_model/edit.vue +1079 -426
- package/src/views/bd/setting/table_model/list.vue +218 -128
- package/src/views/bd/setting/table_model/mixins/dialog.js +71 -1
- package/src/views/bd/setting/table_model/mixins/edit.js +1309 -13
- package/src/views/bd/setting/table_model/mixins/list.js +463 -2
- package/src/views/bd/setting/table_model/mixins/otherAuthDialog.js +201 -0
- package/src/views/bd/setting/table_model/mixins/zdDialog.js +114 -3
- package/src/views/bd/setting/table_model/otherAuthDialog.vue +83 -0
- package/src/views/bd/setting/utils/index.js +75 -1
- package/src/views/user/access_log/list.vue +418 -349
- package/src/views/user/area/dialog.vue +223 -117
- package/src/views/user/area/list.vue +318 -0
- package/src/views/user/commMenu/index.vue +2 -2
- package/src/views/user/common_attribute/list.vue +4 -1
- package/src/views/user/company_info/dialog.vue +195 -163
- package/src/views/user/extend_datasource/dialog.vue +3 -0
- package/src/views/user/extend_datasource/edit.vue +2 -1
- package/src/views/user/extend_datasource/list.vue +3 -0
- package/src/views/user/fieldTranslation/editDialog.vue +8 -8
- package/src/views/user/fieldTranslation/list.vue +33 -33
- package/src/views/user/form/vform/designer.vue +792 -749
- package/src/views/user/form/vform/formFieldMapping.js +2 -3
- package/src/views/user/form/vform/out_render.vue +1 -1
- package/src/views/user/form/vform/render.vue +67 -37
- package/src/views/user/form/view/edit.vue +56 -37
- package/src/views/user/form/view/list.vue +316 -53
- package/src/views/user/home/default.vue +1117 -979
- package/src/views/user/home/default2.vue +1151 -0
- package/src/views/user/home/dev.vue +29 -0
- package/src/views/user/home/index.vue +18 -7
- package/src/views/user/login/default.vue +165 -36
- package/src/views/user/login/index.vue +4 -6
- package/src/views/user/login/indexMixin.js +329 -118
- package/src/views/user/menu/list.vue +27 -1
- package/src/views/user/notify_message/dialog.vue +44 -22
- package/src/views/user/notify_template/edit.vue +188 -187
- package/src/views/user/notify_template/edit2.vue +176 -0
- package/src/views/user/notify_template/list.vue +4 -1
- package/src/views/user/notify_template/list2.vue +190 -0
- package/src/views/user/outLink/form_view.vue +211 -211
- package/src/views/user/outLink/index.vue +67 -11
- package/src/views/user/position/list.vue +112 -72
- package/src/views/user/project_tag/dialog.vue +9 -4
- package/src/views/user/project_tag/edit.vue +2 -2
- package/src/views/user/project_tag/list.vue +9 -4
- package/src/views/user/request_setting/edit.vue +258 -0
- package/src/views/user/request_setting/list.vue +248 -0
- package/src/views/user/role/authConfig.vue +89 -0
- package/src/views/user/role/dialog.vue +70 -48
- package/src/views/user/role/edit.vue +609 -429
- package/src/views/user/role/list.vue +4 -4
- package/src/views/user/sale_org/dialog.vue +1 -1
- package/src/views/user/sale_org/list.vue +4 -1
- package/src/views/user/system_notice/infoDialog.vue +2 -1
- package/src/views/user/user/dialog.vue +46 -23
- package/src/views/user/user/edit.vue +1391 -1021
- package/src/views/user/user/form_dialog.vue +158 -0
- package/src/views/user/user/form_info.vue +210 -0
- package/src/views/user/user/info.vue +253 -140
- package/src/views/user/user/list.vue +652 -563
- package/src/views/user/user/modifyPasswordDialog.vue +64 -53
- package/src/views/user/wf/wfReport/index.vue +619 -0
- package/src/views/user/wf/wf_auto_submit_data/list.vue +2 -0
- package/src/views/user/wf/wf_manage/list.vue +379 -250
- package/src/views/user/wf/wf_manage/list2.vue +854 -0
- package/src/views/user/wf/wf_manage/wfContentDialog.vue +25 -22
- package/src/views/user/wf/wf_obj_config/importItemDialog.vue +109 -0
- package/src/views/user/wf/wf_obj_config/itemEdit.vue +25 -1
- package/src/views/user/wf/wf_obj_config/list.vue +114 -9
- package/src/views/user/wf/wf_transfer_setting/edit.vue +282 -0
- package/src/views/user/wf/wf_transfer_setting/list.vue +319 -0
- package/src/views/user/workbench_menu/list.vue +555 -0
- package/src/components/xform/form-render/container-item/list-h5-item2.vue +0 -1347
|
@@ -0,0 +1,1079 @@
|
|
|
1
|
+
# XForm 多页签业务交互实现方案
|
|
2
|
+
|
|
3
|
+
> 基于 `src/components/xform` 现有组件体系,实现「列表+新增/编辑/查看」多 Tab 页签交互模式。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 一、需求摘要(来自需求图)
|
|
8
|
+
|
|
9
|
+
| # | 需求项 | 详细说明 |
|
|
10
|
+
|---|--------|----------|
|
|
11
|
+
| 1 | **页面样式** | 列表与详情合并,隐藏独立详情页,仅展示列表页签 |
|
|
12
|
+
| 2 | **新增交互** | 点击「新增」→ 新增【**新增**】页签(带关闭符) → 暂存(刷当前页签) / 提交(回列表并刷新) |
|
|
13
|
+
| 3 | **编辑交互** | 点击某行「编辑」→ 新增【**单号**】页签(带关闭符) → 暂存(刷当前页签) / 提交(回列表并刷新) |
|
|
14
|
+
| 4 | **查看交互** | 点击某行「查看」→ 新增【**单号**】页签(带关闭符) → 支持同时打开多个 |
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 二、技术方案选型
|
|
19
|
+
|
|
20
|
+
### 方案:封装 XFormTabContainer 容器组件
|
|
21
|
+
|
|
22
|
+
在 xform 组件库之上封装一个**业务级 Tab 容器组件**,内部使用 Element UI 的 `el-tabs`(type="card", closable)管理页签生命周期。
|
|
23
|
+
|
|
24
|
+
**核心思路:**
|
|
25
|
+
- 不修改 xform 内部源码,而是通过**组合方式**在其外层包一层容器
|
|
26
|
+
- 利用 xform 已有的 `VFormRender` 渲染表单,`VFormDesigner` 做设计态(如需要)
|
|
27
|
+
- 页签状态由容器组件统一管理
|
|
28
|
+
|
|
29
|
+
### 与现有 xform Tab 组件的关系
|
|
30
|
+
|
|
31
|
+
xform 内部已有 `tab-widget.vue`(设计态)和 `tab-item.vue**(运行态)—— 这些是**表单内部的标签页容器组件**,用于在一个表单内分页展示不同字段组。本方案要实现的**不是这个**,而是**更高层的业务页面级别多页签**,两者互不冲突、可以共存。
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
业务层级: XFormTabContainer (本方案新建)
|
|
35
|
+
└─ el-tabs > el-tab-pane
|
|
36
|
+
├─ [列表] → xform-table 列表组件
|
|
37
|
+
├─ [新增] → VFormRender 表单渲染器
|
|
38
|
+
└─ [BH001] → VFormRender 表单渲染器 (编辑/查看)
|
|
39
|
+
|
|
40
|
+
表单内部层级: tab-item (已有)
|
|
41
|
+
└─ el-tabs > el-tab-pane
|
|
42
|
+
├─ [基础信息] → 字段组1
|
|
43
|
+
└─ [详细信息] → 字段组2
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## 三、组件架构设计
|
|
49
|
+
|
|
50
|
+
### 3.1 文件结构(建议位置)
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
src/components/xform/
|
|
54
|
+
├── XFormTabContainer/
|
|
55
|
+
│ ├── index.vue # 主容器组件 (核心)
|
|
56
|
+
│ ├── useTabManager.js # Composable: 页签状态管理
|
|
57
|
+
│ └── XFormTabPane.vue # 单个页签内容包装器
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 3.2 核心数据模型
|
|
61
|
+
|
|
62
|
+
```js
|
|
63
|
+
// tabsData 数据结构
|
|
64
|
+
const tabsData = ref([
|
|
65
|
+
{
|
|
66
|
+
name: 'list', // 唯一标识
|
|
67
|
+
title: '列表', // 页签标题
|
|
68
|
+
closable: false, // 是否可关闭
|
|
69
|
+
fixed: true, // 是否固定页签
|
|
70
|
+
component: 'list', // 组件类型: list | form | detail
|
|
71
|
+
formType: null, // 表单类型: add | edit | view | null
|
|
72
|
+
formData: null, // 表单数据/表单JSON
|
|
73
|
+
rowId: null, // 编辑/查看时的行数据ID
|
|
74
|
+
billNo: null, // 单号(用于显示标题)
|
|
75
|
+
key: 0 // 强制刷新key
|
|
76
|
+
},
|
|
77
|
+
// 动态页签举例:
|
|
78
|
+
{
|
|
79
|
+
name: 'add_1687563200',
|
|
80
|
+
title: '新增',
|
|
81
|
+
closable: true,
|
|
82
|
+
fixed: false,
|
|
83
|
+
component: 'form',
|
|
84
|
+
formType: 'add',
|
|
85
|
+
formData: { ... }, // 新增表单的formJson
|
|
86
|
+
rowId: null,
|
|
87
|
+
billNo: null,
|
|
88
|
+
key: 0
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'edit_BH001',
|
|
92
|
+
title: 'BH001',
|
|
93
|
+
closable: true,
|
|
94
|
+
fixed: false,
|
|
95
|
+
component: 'form',
|
|
96
|
+
formType: 'edit',
|
|
97
|
+
formData: { ... },
|
|
98
|
+
rowId: 'BH001',
|
|
99
|
+
billNo: 'BH001',
|
|
100
|
+
key: 0
|
|
101
|
+
}
|
|
102
|
+
])
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### 3.3 组件接口定义
|
|
106
|
+
|
|
107
|
+
#### XFormTabContainer Props
|
|
108
|
+
|
|
109
|
+
```js
|
|
110
|
+
props: {
|
|
111
|
+
// ========== 列表相关 ==========
|
|
112
|
+
listConfig: {
|
|
113
|
+
type: Object,
|
|
114
|
+
required: true,
|
|
115
|
+
default: () => ({})
|
|
116
|
+
// 列表配置: apiUrl, columns, searchForm, rowKey 等
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
// ========== 表单相关 ==========
|
|
120
|
+
formConfig: {
|
|
121
|
+
type: Object,
|
|
122
|
+
default: () => ({})
|
|
123
|
+
// 表单配置:
|
|
124
|
+
// - addFormJson: 新增表单JSON
|
|
125
|
+
// - editFormJson: 编辑表单JSON
|
|
126
|
+
// - viewFormJson: 查看表单JSON (可选,不传则用editFormJson只读模式)
|
|
127
|
+
// - saveApi: 暂存接口
|
|
128
|
+
// - submitApi: 提交接口
|
|
129
|
+
// - detailApi: 详情数据获取接口
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
// ========== 全局配置 ==========
|
|
133
|
+
options: {
|
|
134
|
+
type: Object,
|
|
135
|
+
default: () => ({
|
|
136
|
+
maxTabs: 10, // 最大打开页签数
|
|
137
|
+
defaultActive: 'list', // 默认激活页签
|
|
138
|
+
showListTab: true, // 是否显示列表页签
|
|
139
|
+
confirmOnClose: true, // 关闭有未保存数据时是否确认
|
|
140
|
+
})
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
#### XFormTabContainer Events
|
|
146
|
+
|
|
147
|
+
```js
|
|
148
|
+
emits: [
|
|
149
|
+
'tab-change', // 页签切换 (name)
|
|
150
|
+
'tab-open', // 页签打开 (tabData)
|
|
151
|
+
'tab-close', // 页签关闭 (tabData)
|
|
152
|
+
'before-close', // 关闭前拦截 (tabData, done/cancel)
|
|
153
|
+
'save-success', // 暂存成功 (data)
|
|
154
|
+
'submit-success', // 提交成功 (data)
|
|
155
|
+
'list-refresh', // 列表刷新触发
|
|
156
|
+
]
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
#### XFormTabContainer Slots
|
|
160
|
+
|
|
161
|
+
```html
|
|
162
|
+
<!-- 列表区域插槽 -->
|
|
163
|
+
<template #list="{ refresh, getSelection }">
|
|
164
|
+
<your-table-component @add="onAdd" @edit="onEdit" @view="onView" />
|
|
165
|
+
</template>
|
|
166
|
+
|
|
167
|
+
<!-- 表单区域插槽 -->
|
|
168
|
+
<template #form="{ tabData, save, submit, loading }">
|
|
169
|
+
<v-form-render :form-json="tabData.formData" ... />
|
|
170
|
+
</template>
|
|
171
|
+
|
|
172
|
+
<!-- 工具栏扩展插槽 -->
|
|
173
|
+
<template #toolbar="{ currentTab }">
|
|
174
|
+
<el-button>导出</el-button>
|
|
175
|
+
</template>
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## 四、核心逻辑 — useTabManager.js
|
|
181
|
+
|
|
182
|
+
这是整个方案的**核心状态管理 Hook**,负责所有页签的增删改查:
|
|
183
|
+
|
|
184
|
+
```js
|
|
185
|
+
// src/components/xform/XFormTabContainer/useTabManager.js
|
|
186
|
+
|
|
187
|
+
import { ref, computed } from 'vue'
|
|
188
|
+
|
|
189
|
+
export function useTabManager(options = {}) {
|
|
190
|
+
const {
|
|
191
|
+
maxTabs = 10,
|
|
192
|
+
defaultActive = 'list',
|
|
193
|
+
confirmOnClose = true
|
|
194
|
+
} = options
|
|
195
|
+
|
|
196
|
+
// ====== 状态 ======
|
|
197
|
+
const activeTabName = ref(defaultActive)
|
|
198
|
+
const tabsData = ref([
|
|
199
|
+
createListTab()
|
|
200
|
+
])
|
|
201
|
+
|
|
202
|
+
// ====== 计算属性 ======
|
|
203
|
+
const activeTab = computed(() =>
|
|
204
|
+
tabsData.value.find(t => t.name === activeTabName.value)
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
const dynamicTabs = computed(() =>
|
|
208
|
+
tabsData.value.filter(t => !t.fixed)
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
// ====== 工厂函数 ======
|
|
212
|
+
function createListTab() {
|
|
213
|
+
return {
|
|
214
|
+
name: 'list',
|
|
215
|
+
title: '列表',
|
|
216
|
+
closable: false,
|
|
217
|
+
fixed: true,
|
|
218
|
+
component: 'list',
|
|
219
|
+
formType: null,
|
|
220
|
+
formData: null,
|
|
221
|
+
rowId: null,
|
|
222
|
+
billNo: null,
|
|
223
|
+
key: Date.now(),
|
|
224
|
+
dirty: false // 是否有未保存的修改
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function createAddTab(formJson) {
|
|
229
|
+
return {
|
|
230
|
+
name: `add_${Date.now()}`,
|
|
231
|
+
title: '新增',
|
|
232
|
+
closable: true,
|
|
233
|
+
fixed: false,
|
|
234
|
+
component: 'form',
|
|
235
|
+
formType: 'add',
|
|
236
|
+
formData: formJson,
|
|
237
|
+
rowId: null,
|
|
238
|
+
billNo: null,
|
|
239
|
+
key: Date.now(),
|
|
240
|
+
dirty: false
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function createEditTab(billNo, formJson) {
|
|
245
|
+
return {
|
|
246
|
+
name: `edit_${billNo}`,
|
|
247
|
+
title: billNo,
|
|
248
|
+
closable: true,
|
|
249
|
+
fixed: false,
|
|
250
|
+
component: 'form',
|
|
251
|
+
formType: 'edit',
|
|
252
|
+
formData: formJson,
|
|
253
|
+
rowId: billNo,
|
|
254
|
+
billNo: billNo,
|
|
255
|
+
key: Date.now(),
|
|
256
|
+
dirty: false
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function createViewTab(billNo, formJson) {
|
|
261
|
+
return {
|
|
262
|
+
name: `view_${billNo}_${Date.now()}`,
|
|
263
|
+
title: billNo,
|
|
264
|
+
closable: true,
|
|
265
|
+
fixed: false,
|
|
266
|
+
component: 'form',
|
|
267
|
+
formType: 'view',
|
|
268
|
+
formData: formJson,
|
|
269
|
+
rowId: billNo,
|
|
270
|
+
billNo: billNo,
|
|
271
|
+
key: Date.now(),
|
|
272
|
+
dirty: false
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// ====== 核心操作 ======
|
|
277
|
+
|
|
278
|
+
/** 打开新增页签 */
|
|
279
|
+
function openAddTab(formJson) {
|
|
280
|
+
// 检查是否已存在未关闭的新增页签 (可选策略)
|
|
281
|
+
const existingAdd = tabsData.value.find(
|
|
282
|
+
t => !t.fixed && t.formType === 'add'
|
|
283
|
+
)
|
|
284
|
+
if (existingAdd) {
|
|
285
|
+
// 策略A: 直接切换到已有的新增页签
|
|
286
|
+
activeTabName.value = existingAdd.name
|
|
287
|
+
refreshTab(existingAdd.name)
|
|
288
|
+
return existingAdd
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// 策略B: 总是创建新的新增页签 (推荐,符合需求图描述)
|
|
292
|
+
const newTab = createAddTab(formJson)
|
|
293
|
+
tabsData.value.push(newTab)
|
|
294
|
+
activeTabName.value = newTab.name
|
|
295
|
+
return newTab
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/** 打开编辑页签 */
|
|
299
|
+
function openEditTab(billNo, formJson) {
|
|
300
|
+
// 检查是否已打开该单据的编辑页签
|
|
301
|
+
const existing = tabsData.value.find(
|
|
302
|
+
t => t.rowId === billNo && t.formType === 'edit'
|
|
303
|
+
)
|
|
304
|
+
if (existing) {
|
|
305
|
+
activeTabName.value = existing.name
|
|
306
|
+
refreshTab(existing.name)
|
|
307
|
+
return existing
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
const newTab = createEditTab(billNo, formJson)
|
|
311
|
+
tabsData.value.push(newTab)
|
|
312
|
+
activeTabName.value = newTab.name
|
|
313
|
+
return newTab
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/** 打开查看页签 (允许同时打开多个) */
|
|
317
|
+
function openViewTab(billNo, formJson) {
|
|
318
|
+
// 查看页签允许重复打开同一单据 (每次打开新页签)
|
|
319
|
+
const newTab = createViewTab(billNo, formJson)
|
|
320
|
+
tabsData.value.push(newTab)
|
|
321
|
+
activeTabName.value = newTab.name
|
|
322
|
+
return newTab
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/** 关闭页签 */
|
|
326
|
+
async function closeTab(targetName) {
|
|
327
|
+
const targetIdx = tabsData.value.findIndex(t => t.name === targetName)
|
|
328
|
+
if (targetIdx === -1) return
|
|
329
|
+
|
|
330
|
+
const target = tabsData.value[targetIdx]
|
|
331
|
+
|
|
332
|
+
// 固定页签不可关闭
|
|
333
|
+
if (target.fixed) return
|
|
334
|
+
|
|
335
|
+
// 未保存数据确认
|
|
336
|
+
if (confirmOnClose && target.dirty) {
|
|
337
|
+
// 触发 before-close 事件, 由外部处理确认弹窗
|
|
338
|
+
// 返回 false 可取消关闭
|
|
339
|
+
return { cancelled: true }
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// 执行关闭
|
|
343
|
+
tabsData.value.splice(targetIdx, 1)
|
|
344
|
+
|
|
345
|
+
// 如果关闭的是当前活动页签, 切换到相邻页签
|
|
346
|
+
if (activeTabName.value === targetName) {
|
|
347
|
+
const nextIdx = Math.min(targetIdx, tabsData.value.length - 1)
|
|
348
|
+
activeTabName.value = tabsData.value[nextIdx]?.name || 'list'
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
return { closed: true, target }
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/** 刷新指定页签内容 (用于暂存后刷新) */
|
|
355
|
+
function refreshTab(tabName) {
|
|
356
|
+
const tab = tabsData.value.find(t => t.name === tabName)
|
|
357
|
+
if (tab) {
|
|
358
|
+
tab.key = Date.now() // 通过改变key强制重新渲染
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/** 刷新当前页签 */
|
|
363
|
+
function refreshCurrentTab() {
|
|
364
|
+
refreshTab(activeTabName.value)
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/** 标记当前页签为脏数据(有修改) */
|
|
368
|
+
function markDirty(tabName) {
|
|
369
|
+
const tab = tabsData.value.find(t => t.name === tabName)
|
|
370
|
+
if (tab) tab.dirty = true
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/** 清除脏标记 (暂存/提交后) */
|
|
374
|
+
function clearDirty(tabName) {
|
|
375
|
+
const tab = tabsData.value.find(t => t.name === tabName)
|
|
376
|
+
if (tab) tab.dirty = false
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/** 提交后返回列表并刷新 */
|
|
380
|
+
function submitAndBackToList() {
|
|
381
|
+
// 关闭当前非固定页签
|
|
382
|
+
const current = activeTab.value
|
|
383
|
+
if (current && !current.fixed) {
|
|
384
|
+
closeTab(current.name)
|
|
385
|
+
}
|
|
386
|
+
// 切换到列表
|
|
387
|
+
activeTabName.value = 'list'
|
|
388
|
+
// 列表刷新通过事件通知外部
|
|
389
|
+
return { needRefreshList: true }
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/** 暂存后停留在当前页签 */
|
|
393
|
+
function saveAndStay() {
|
|
394
|
+
refreshCurrentTab()
|
|
395
|
+
clearDirty(activeTabName.value)
|
|
396
|
+
return { refreshed: true }
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/** 切换页签 */
|
|
400
|
+
function switchTab(tabName) {
|
|
401
|
+
activeTabName.value = tabName
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
return {
|
|
405
|
+
// 状态
|
|
406
|
+
activeTabName,
|
|
407
|
+
tabsData,
|
|
408
|
+
activeTab,
|
|
409
|
+
dynamicTabs,
|
|
410
|
+
|
|
411
|
+
// 操作
|
|
412
|
+
openAddTab,
|
|
413
|
+
openEditTab,
|
|
414
|
+
openViewTab,
|
|
415
|
+
closeTab,
|
|
416
|
+
refreshTab,
|
|
417
|
+
refreshCurrentTab,
|
|
418
|
+
markDirty,
|
|
419
|
+
clearDirty,
|
|
420
|
+
submitAndBackToList,
|
|
421
|
+
saveAndStay,
|
|
422
|
+
switchTab
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
---
|
|
428
|
+
|
|
429
|
+
## 五、主组件骨架 — index.vue
|
|
430
|
+
|
|
431
|
+
```vue
|
|
432
|
+
<template>
|
|
433
|
+
<div class="xform-tab-container">
|
|
434
|
+
<!-- Tabs 页签栏 -->
|
|
435
|
+
<el-tabs
|
|
436
|
+
v-model="activeTabName"
|
|
437
|
+
type="card"
|
|
438
|
+
closable
|
|
439
|
+
@tab-click="handleTabClick"
|
|
440
|
+
@tab-remove="handleTabRemove"
|
|
441
|
+
>
|
|
442
|
+
<!-- 列表页签 -->
|
|
443
|
+
<el-tab-pane
|
|
444
|
+
v-for="tab in tabsData"
|
|
445
|
+
:key="tab.name + '_' + tab.key"
|
|
446
|
+
:label="renderTabLabel(tab)"
|
|
447
|
+
:name="tab.name"
|
|
448
|
+
:closable="tab.closable"
|
|
449
|
+
>
|
|
450
|
+
<!-- 列表内容 -->
|
|
451
|
+
<template v-if="tab.component === 'list'">
|
|
452
|
+
<slot name="list" :refresh="handleListRefresh" :tab-data="tab">
|
|
453
|
+
<div class="tab-content-list">
|
|
454
|
+
<!-- 默认或自定义列表组件 -->
|
|
455
|
+
<slot />
|
|
456
|
+
</div>
|
|
457
|
+
</slot>
|
|
458
|
+
</template>
|
|
459
|
+
|
|
460
|
+
<!-- 表单/详情内容 -->
|
|
461
|
+
<template v-else-if="tab.component === 'form'">
|
|
462
|
+
<slot name="form" :tab-data="tab" :save="handleSave" :submit="handleSubmit" :loading="loading">
|
|
463
|
+
<XFormTabPane
|
|
464
|
+
:key="tab.key"
|
|
465
|
+
:tab-data="tab"
|
|
466
|
+
:form-config="mergedFormConfig"
|
|
467
|
+
@save="handleSave"
|
|
468
|
+
@submit="handleSubmit"
|
|
469
|
+
@dirty-change="(val) => markDirty(tab.name)"
|
|
470
|
+
/>
|
|
471
|
+
</slot>
|
|
472
|
+
</template>
|
|
473
|
+
</el-tab-pane>
|
|
474
|
+
</el-tabs>
|
|
475
|
+
</div>
|
|
476
|
+
</template>
|
|
477
|
+
|
|
478
|
+
<script>
|
|
479
|
+
import { defineComponent } from 'vue'
|
|
480
|
+
import { useTabManager } from './useTabManager'
|
|
481
|
+
import XFormTabPane from './XFormTabPane.vue'
|
|
482
|
+
|
|
483
|
+
export default defineComponent({
|
|
484
|
+
name: 'XFormTabContainer',
|
|
485
|
+
|
|
486
|
+
components: { XFormTabPane },
|
|
487
|
+
|
|
488
|
+
props: {
|
|
489
|
+
listConfig: { type: Object, required: true },
|
|
490
|
+
formConfig: { type: Object, default: () => ({}) },
|
|
491
|
+
options: { type: Object, default: () => ({}) }
|
|
492
|
+
},
|
|
493
|
+
|
|
494
|
+
emits: ['tab-change', 'tab-open', 'tab-close', 'before-close',
|
|
495
|
+
'save-success', 'submit-success', 'list-refresh'],
|
|
496
|
+
|
|
497
|
+
setup(props, { emit, slots }) {
|
|
498
|
+
const manager = useTabManager(props.options)
|
|
499
|
+
const { activeTabName, tabsData, activeTab, /* ... */ } = manager
|
|
500
|
+
|
|
501
|
+
const loading = ref(false)
|
|
502
|
+
|
|
503
|
+
// 合并表单配置
|
|
504
|
+
const mergedFormConfig = computed(() => ({
|
|
505
|
+
...defaultFormConfig,
|
|
506
|
+
...props.formConfig
|
|
507
|
+
}))
|
|
508
|
+
|
|
509
|
+
// ====== 事件处理 ======
|
|
510
|
+
|
|
511
|
+
/** 渲染页签 label (支持脏数据标识) */
|
|
512
|
+
function renderTabLabel(tab) {
|
|
513
|
+
const prefix = tab.dirty ? '● ' : ''
|
|
514
|
+
return `${prefix}${tab.title}`
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/** 页签点击 */
|
|
518
|
+
function handleTabClick(tab) {
|
|
519
|
+
emit('tab-change', tab.paneName || tab.name)
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/** 页签关闭按钮点击 */
|
|
523
|
+
async function handleTabRemove(targetName) {
|
|
524
|
+
const result = await manager.closeTab(targetName)
|
|
525
|
+
if (result?.closed) {
|
|
526
|
+
emit('tab-close', result.target)
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/** 暂存操作 */
|
|
531
|
+
async function handleSave(formData) {
|
|
532
|
+
loading.value = true
|
|
533
|
+
try {
|
|
534
|
+
await callSaveApi(formData) // 调用暂存接口
|
|
535
|
+
manager.saveAndStay() // 刷新当前页签
|
|
536
|
+
emit('save-success', formData)
|
|
537
|
+
} finally {
|
|
538
|
+
loading.value = false
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
/** 提交操作 */
|
|
543
|
+
async function handleSubmit(formData) {
|
|
544
|
+
loading.value = true
|
|
545
|
+
try {
|
|
546
|
+
await callSubmitApi(formData) // 调用提交接口
|
|
547
|
+
const result = manager.submitAndBackToList()
|
|
548
|
+
if (result.needRefreshList) {
|
|
549
|
+
emit('list-refresh')
|
|
550
|
+
}
|
|
551
|
+
emit('submit-success', formData)
|
|
552
|
+
} finally {
|
|
553
|
+
loading.value = false
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
/** 列表刷新 */
|
|
558
|
+
function handleListRefresh() {
|
|
559
|
+
emit('list-refresh')
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
// ====== 对外暴露方法 (供父组件调用) ======
|
|
563
|
+
expose({
|
|
564
|
+
openAddTab: manager.openAddTab,
|
|
565
|
+
openEditTab: manager.openEditTab,
|
|
566
|
+
openViewTab: manager.openViewTab,
|
|
567
|
+
closeTab: manager.closeTab,
|
|
568
|
+
refreshList: handleListRefresh,
|
|
569
|
+
// 允许父组件直接操作页签
|
|
570
|
+
...manager
|
|
571
|
+
})
|
|
572
|
+
|
|
573
|
+
return {
|
|
574
|
+
activeTabName,
|
|
575
|
+
tabsData,
|
|
576
|
+
activeTab,
|
|
577
|
+
mergedFormConfig,
|
|
578
|
+
loading,
|
|
579
|
+
renderTabLabel,
|
|
580
|
+
handleTabClick,
|
|
581
|
+
handleTabRemove,
|
|
582
|
+
handleSave,
|
|
583
|
+
handleSubmit,
|
|
584
|
+
handleListRefresh,
|
|
585
|
+
// 将 manager 方法暴露到模板
|
|
586
|
+
...manager
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
})
|
|
590
|
+
</script>
|
|
591
|
+
|
|
592
|
+
<style scoped>
|
|
593
|
+
.xform-tab-container {
|
|
594
|
+
width: 100%;
|
|
595
|
+
height: 100%;
|
|
596
|
+
display: flex;
|
|
597
|
+
flex-direction: column;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
.xform-tab-container :deep(.el-tabs__header) {
|
|
601
|
+
margin-bottom: 0;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
.xform-tab-container :deep(.el-tabs__content) {
|
|
605
|
+
flex: 1;
|
|
606
|
+
overflow: auto;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
.tab-content-list {
|
|
610
|
+
padding: 16px;
|
|
611
|
+
}
|
|
612
|
+
</style>
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
---
|
|
616
|
+
|
|
617
|
+
## 六、页签内容组件 — XFormTabPane.vue
|
|
618
|
+
|
|
619
|
+
```vue
|
|
620
|
+
<template>
|
|
621
|
+
<div class="xform-tab-pane" v-loading="pageLoading">
|
|
622
|
+
<!-- 使用 xform 的 VFormRender 渲染表单 -->
|
|
623
|
+
<v-form-render
|
|
624
|
+
ref="vFormRef"
|
|
625
|
+
:form-json="currentFormJson"
|
|
626
|
+
:form-data="formDataModel"
|
|
627
|
+
:option-data="optionData"
|
|
628
|
+
@form-mounted="onFormMounted"
|
|
629
|
+
/>
|
|
630
|
+
|
|
631
|
+
<!-- 底部操作栏 -->
|
|
632
|
+
<div class="pane-footer" v-if="showActions">
|
|
633
|
+
<el-button @click="handleDraft" :loading="saving">暂存</el-button>
|
|
634
|
+
<el-button type="primary" @click="handleSubmit" :loading="submitting">提交</el-button>
|
|
635
|
+
</div>
|
|
636
|
+
</div>
|
|
637
|
+
</template>
|
|
638
|
+
|
|
639
|
+
<script>
|
|
640
|
+
import { defineComponent, ref, computed, watch, onMounted } from 'vue'
|
|
641
|
+
|
|
642
|
+
export default defineComponent({
|
|
643
|
+
name: 'XFormTabPane',
|
|
644
|
+
|
|
645
|
+
props: {
|
|
646
|
+
tabData: { type: Object, required: true },
|
|
647
|
+
formConfig: { type: Object, default: () => ({}) }
|
|
648
|
+
},
|
|
649
|
+
|
|
650
|
+
emits: ['save', 'submit', 'dirty-change'],
|
|
651
|
+
|
|
652
|
+
setup(props, { emit }) {
|
|
653
|
+
const vFormRef = ref(null)
|
|
654
|
+
const pageLoading = ref(false)
|
|
655
|
+
const saving = ref(false)
|
|
656
|
+
const submitting = ref(false)
|
|
657
|
+
const formDataModel = ref({})
|
|
658
|
+
const optionData = ref({})
|
|
659
|
+
|
|
660
|
+
// 根据 formType 决定用哪个 formJson
|
|
661
|
+
const currentFormJson = computed(() => {
|
|
662
|
+
const cfg = props.formConfig
|
|
663
|
+
const type = props.tabData.formType
|
|
664
|
+
if (type === 'add') return cfg.addFormJson
|
|
665
|
+
if (type === 'view' && cfg.viewFormJson) return cfg.viewFormJson
|
|
666
|
+
return cfg.editFormJson // edit 或默认
|
|
667
|
+
})
|
|
668
|
+
|
|
669
|
+
// 查看模式下隐藏操作按钮
|
|
670
|
+
const showActions = computed(() => props.tabData.formType !== 'view')
|
|
671
|
+
|
|
672
|
+
// 加载编辑/查看时的初始数据
|
|
673
|
+
onMounted(async () => {
|
|
674
|
+
const { formType, rowId } = props.tabData
|
|
675
|
+
if ((formType === 'edit' || formType === 'view') && rowId) {
|
|
676
|
+
await loadDetailData(rowId)
|
|
677
|
+
}
|
|
678
|
+
})
|
|
679
|
+
|
|
680
|
+
/** 加载详情数据 */
|
|
681
|
+
async function loadDetailData(id) {
|
|
682
|
+
pageLoading.value = true
|
|
683
|
+
try {
|
|
684
|
+
const api = props.formConfig.detailApi
|
|
685
|
+
const res = await fetch(`${api}/${id}`)
|
|
686
|
+
formDataModel.value = res.data
|
|
687
|
+
} finally {
|
|
688
|
+
pageLoading.value = false
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
/** 获取表单数据 */
|
|
693
|
+
function getFormData() {
|
|
694
|
+
return vFormRef.value?.getFormData()
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
/** 校验表单 */
|
|
698
|
+
async function validateForm() {
|
|
699
|
+
return vFormRef.value?.validateForm()
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
/** 暂存 */
|
|
703
|
+
async function handleDraft() {
|
|
704
|
+
try {
|
|
705
|
+
await validateForm()
|
|
706
|
+
const data = getFormData()
|
|
707
|
+
saving.value = true
|
|
708
|
+
emit('save', data) // 由父组件调接口
|
|
709
|
+
} catch (e) {
|
|
710
|
+
console.warn('表单校验未通过:', e)
|
|
711
|
+
} finally {
|
|
712
|
+
saving.value = false
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
/** 提交 */
|
|
717
|
+
async function handleSubmit() {
|
|
718
|
+
try {
|
|
719
|
+
await validateForm()
|
|
720
|
+
const data = getFormData()
|
|
721
|
+
submitting.value = true
|
|
722
|
+
emit('submit', data) // 由父组件调接口
|
|
723
|
+
} catch (e) {
|
|
724
|
+
console.warn('表单校验未通过:', e)
|
|
725
|
+
} finally {
|
|
726
|
+
submitting.value = false
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
/** 表单数据变化 -> 标记脏数据 */
|
|
731
|
+
function onFormMounted() {
|
|
732
|
+
// 监听表单内部数据变化
|
|
733
|
+
if (vFormRef.value) {
|
|
734
|
+
vFormRef.value.$watch?.(() => {
|
|
735
|
+
emit('dirty-change', true)
|
|
736
|
+
})
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
return {
|
|
741
|
+
vFormRef, pageLoading, saving, submitting,
|
|
742
|
+
formDataModel, optionData,
|
|
743
|
+
currentFormJson, showActions,
|
|
744
|
+
handleDraft, handleSubmit, onFormMounted
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
})
|
|
748
|
+
</script>
|
|
749
|
+
|
|
750
|
+
<style scoped>
|
|
751
|
+
.xform-tab-pane {
|
|
752
|
+
height: 100%;
|
|
753
|
+
padding: 16px;
|
|
754
|
+
}
|
|
755
|
+
.pane-footer {
|
|
756
|
+
text-align: right;
|
|
757
|
+
padding-top: 16px;
|
|
758
|
+
border-top: 1px solid #eee;
|
|
759
|
+
margin-top: 16px;
|
|
760
|
+
}
|
|
761
|
+
</style>
|
|
762
|
+
```
|
|
763
|
+
|
|
764
|
+
---
|
|
765
|
+
|
|
766
|
+
## 七、使用示例
|
|
767
|
+
|
|
768
|
+
```vue
|
|
769
|
+
<template>
|
|
770
|
+
<XFormTabContainer
|
|
771
|
+
ref="containerRef"
|
|
772
|
+
:list-config="listConfig"
|
|
773
|
+
:form-config="formConfig"
|
|
774
|
+
:options="{ maxTabs: 10, confirmOnClose: true }"
|
|
775
|
+
@tab-open="onTabOpen"
|
|
776
|
+
@tab-close="onTabClose"
|
|
777
|
+
@submit-success="onSubmitSuccess"
|
|
778
|
+
@list-refresh="fetchListData"
|
|
779
|
+
>
|
|
780
|
+
<!-- 自定义列表内容 -->
|
|
781
|
+
<template #list="{ refresh }">
|
|
782
|
+
<XFormTable
|
|
783
|
+
:columns="tableColumns"
|
|
784
|
+
:data="tableData"
|
|
785
|
+
:loading="tableLoading"
|
|
786
|
+
@row-add="handleAdd"
|
|
787
|
+
@row-edit="handleEdit"
|
|
788
|
+
@row-view="handleView"
|
|
789
|
+
>
|
|
790
|
+
<template #toolbar>
|
|
791
|
+
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">
|
|
792
|
+
新增
|
|
793
|
+
</el-button>
|
|
794
|
+
</template>
|
|
795
|
+
</XFormTable>
|
|
796
|
+
</template>
|
|
797
|
+
|
|
798
|
+
<!-- 自定义表单内容 (可选,默认用内置的 XFormTabPane) -->
|
|
799
|
+
<!-- <template #form="{ tabData, save, submit, loading }"> -->
|
|
800
|
+
<!-- 自定义表单UI... -->
|
|
801
|
+
<!-- </template> -->
|
|
802
|
+
|
|
803
|
+
<!-- 工具栏扩展 -->
|
|
804
|
+
<template #toolbar="{ currentTab }">
|
|
805
|
+
<el-button v-if="currentTab?.name !== 'list'" @click="exportData">
|
|
806
|
+
导出
|
|
807
|
+
</el-button>
|
|
808
|
+
</template>
|
|
809
|
+
</XFormTabContainer>
|
|
810
|
+
</template>
|
|
811
|
+
|
|
812
|
+
<script>
|
|
813
|
+
import { defineComponent, ref, onMounted } from 'vue'
|
|
814
|
+
import XFormTabContainer from '@/components/xform/XFormTabContainer/index.vue'
|
|
815
|
+
|
|
816
|
+
export default defineComponent({
|
|
817
|
+
components: { XFormTabContainer },
|
|
818
|
+
|
|
819
|
+
setup() {
|
|
820
|
+
const containerRef = ref(null)
|
|
821
|
+
const tableData = ref([])
|
|
822
|
+
const tableLoading = ref(false)
|
|
823
|
+
|
|
824
|
+
const listConfig = ref({
|
|
825
|
+
apiUrl: '/api/orders/list',
|
|
826
|
+
rowKey: 'billNo'
|
|
827
|
+
})
|
|
828
|
+
|
|
829
|
+
const formConfig = ref({
|
|
830
|
+
addFormJson: require('./forms/order-add.json'),
|
|
831
|
+
editFormJson: require('./forms/order-edit.json'),
|
|
832
|
+
viewFormJson: require('./forms/order-view.json'),
|
|
833
|
+
saveApi: '/api/orders/draft',
|
|
834
|
+
submitApi: '/api/orders/submit',
|
|
835
|
+
detailApi: '/api/orders/detail'
|
|
836
|
+
})
|
|
837
|
+
|
|
838
|
+
// ====== 操作方法 ======
|
|
839
|
+
|
|
840
|
+
function handleAdd() {
|
|
841
|
+
containerRef.value.openAddTab(formConfig.value.addFormJson)
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
function handleEdit(row) {
|
|
845
|
+
containerRef.value.openEditTab(row.billNo, formConfig.value.editFormJson)
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
function handleView(row) {
|
|
849
|
+
containerRef.value.openViewTab(row.billNo, formConfig.value.viewFormJson)
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
function onSubmitSuccess(data) {
|
|
853
|
+
Message.success('提交成功')
|
|
854
|
+
// submitAndBackToList 已经自动处理了页签关闭和切换
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
function fetchListData() {
|
|
858
|
+
tableLoading.value = true
|
|
859
|
+
fetchList().then(res => {
|
|
860
|
+
tableData.value = res.data
|
|
861
|
+
}).finally(() => {
|
|
862
|
+
tableLoading.value = false
|
|
863
|
+
})
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
onMounted(() => {
|
|
867
|
+
fetchListData()
|
|
868
|
+
})
|
|
869
|
+
|
|
870
|
+
return {
|
|
871
|
+
containerRef, listConfig, formConfig,
|
|
872
|
+
tableData, tableLoading,
|
|
873
|
+
handleAdd, handleEdit, handleView,
|
|
874
|
+
onSubmitSuccess, fetchListData
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
})
|
|
878
|
+
</script>
|
|
879
|
+
```
|
|
880
|
+
|
|
881
|
+
---
|
|
882
|
+
|
|
883
|
+
## 八、交互流程详解
|
|
884
|
+
|
|
885
|
+
### 8.1 新增流程
|
|
886
|
+
|
|
887
|
+
```
|
|
888
|
+
用户点击[新增]按钮
|
|
889
|
+
│
|
|
890
|
+
▼
|
|
891
|
+
handleAdd()
|
|
892
|
+
│
|
|
893
|
+
▼
|
|
894
|
+
containerRef.openAddTab(addFormJson)
|
|
895
|
+
│ ← useTabManager.createAddTab() → push 到 tabsData
|
|
896
|
+
│ ← activeTabName 切换到新页签
|
|
897
|
+
▼
|
|
898
|
+
el-tabs 自动渲染新页签
|
|
899
|
+
│
|
|
900
|
+
▼
|
|
901
|
+
XFormTabPane 加载 addFormJson → VFormRender 渲染空表单
|
|
902
|
+
│
|
|
903
|
+
▼
|
|
904
|
+
用户填写表单...
|
|
905
|
+
│
|
|
906
|
+
├──► 点击[暂存]
|
|
907
|
+
│ │
|
|
908
|
+
│ ▼
|
|
909
|
+
│ handleSave(formData) → API调用
|
|
910
|
+
│ │
|
|
911
|
+
│ ▼
|
|
912
|
+
│ saveAndStay() → refreshCurrentTab() → key++ → 强制刷新当前页签
|
|
913
|
+
│ (用户留在当前页签,看到更新后的数据)
|
|
914
|
+
│
|
|
915
|
+
└──► 点击[提交]
|
|
916
|
+
│
|
|
917
|
+
▼
|
|
918
|
+
handleSubmit(formData) → API调用
|
|
919
|
+
│
|
|
920
|
+
▼
|
|
921
|
+
submitAndBackToList() → closeTab(current) + activeTab='list'
|
|
922
|
+
emit('list-refresh') → 外部重新请求列表数据
|
|
923
|
+
(用户回到列表页签,看到最新列表)
|
|
924
|
+
```
|
|
925
|
+
|
|
926
|
+
### 8.2 编辑流程
|
|
927
|
+
|
|
928
|
+
```
|
|
929
|
+
用户点击某行的[编辑]按钮
|
|
930
|
+
│
|
|
931
|
+
▼
|
|
932
|
+
handleEdit(row)
|
|
933
|
+
│
|
|
934
|
+
▼
|
|
935
|
+
containerRef.openEditTab(row.billNo, editFormJson)
|
|
936
|
+
│ ← 检查是否已打开该单据的编辑页签
|
|
937
|
+
│ ├─ 已打开 → 切换过去 + refresh
|
|
938
|
+
│ └─ 未打开 → 创建新页签
|
|
939
|
+
▼
|
|
940
|
+
XFormTabPane 加载 editFormJson → VFormRender 渲染
|
|
941
|
+
│ → 同时加载详情数据 (loadDetailData/billNo) 填充表单
|
|
942
|
+
│
|
|
943
|
+
▼
|
|
944
|
+
用户修改表单... (后续同新增: 暂存/提交)
|
|
945
|
+
```
|
|
946
|
+
|
|
947
|
+
### 8.3 查看流程
|
|
948
|
+
|
|
949
|
+
```
|
|
950
|
+
用户点击某行的[查看]按钮
|
|
951
|
+
│
|
|
952
|
+
▼
|
|
953
|
+
handleView(row)
|
|
954
|
+
│
|
|
955
|
+
▼
|
|
956
|
+
containerRef.openViewTab(row.billNo, viewFormJson)
|
|
957
|
+
│ ← 注意: 查看**每次都创建新页签**, 不做去重
|
|
958
|
+
│ → 允许同时打开多个查看页签
|
|
959
|
+
▼
|
|
960
|
+
XFormTabPane 以只读/禁用模式渲染 (showActions=false)
|
|
961
|
+
│
|
|
962
|
+
▼
|
|
963
|
+
用户点击页签右上角 ✕ → closeTab() → 关闭该页签
|
|
964
|
+
```
|
|
965
|
+
|
|
966
|
+
### 8.4 页签关闭流程
|
|
967
|
+
|
|
968
|
+
```
|
|
969
|
+
用户点击页签 ✕ 按钮
|
|
970
|
+
│
|
|
971
|
+
▼
|
|
972
|
+
handleTabRemove(targetName)
|
|
973
|
+
│
|
|
974
|
+
▼
|
|
975
|
+
closeTab(targetName)
|
|
976
|
+
│
|
|
977
|
+
├──► 该页签有未保存修改 (dirty=true)?
|
|
978
|
+
│ │
|
|
979
|
+
│ ├── 是 → 触发 before-close → 弹窗确认 → 取消/确定
|
|
980
|
+
│ │
|
|
981
|
+
│ └── 否 / 用户确认 → splice 从 tabsData 移除
|
|
982
|
+
│
|
|
983
|
+
└──► 当前活动页签就是被关的那个?
|
|
984
|
+
│
|
|
985
|
+
└── 是 → activeTabName = 相邻页签 or 'list'
|
|
986
|
+
```
|
|
987
|
+
|
|
988
|
+
---
|
|
989
|
+
|
|
990
|
+
## 九、关键实现细节
|
|
991
|
+
|
|
992
|
+
### 9.1 页签唯一性命名规则
|
|
993
|
+
|
|
994
|
+
| 场景 | name 格式 | 示例 | 去重策略 |
|
|
995
|
+
|------|-----------|------|----------|
|
|
996
|
+
| 列表 | `'list'` | `'list'` | 固定,不可删除 |
|
|
997
|
+
| 新增 | `'add_' + timestamp` | `'add_1687563200'` | 可选:复用已有新增页签 |
|
|
998
|
+
| 编辑 | `'edit_' + billNo` | `'edit_BH001'` | **按 billNo 去重**,已打开则切换 |
|
|
999
|
+
| 查看 | `'view_' + billNo + '_' + timestamp` | `'view_BH001_1687563300'` | **不去重**,每次新建 |
|
|
1000
|
+
|
|
1001
|
+
### 9.2 强制刷新机制
|
|
1002
|
+
|
|
1003
|
+
通过 Vue 的 `:key` 属性实现页签内容强制重新渲染:
|
|
1004
|
+
- 每次 `refreshTab()` 时将 `tab.key = Date.now()`
|
|
1005
|
+
- Vue 检测 key 变化会销毁旧组件、创建新组件
|
|
1006
|
+
- 配合 `el-tab-pane` 的 `:key="tab.name + '_' + tab.key"` 绑定
|
|
1007
|
+
|
|
1008
|
+
### 9.3 脏数据检测与防丢失
|
|
1009
|
+
|
|
1010
|
+
```
|
|
1011
|
+
用户在表单中输入 → VFormRender 内部数据变化
|
|
1012
|
+
│
|
|
1013
|
+
▼
|
|
1014
|
+
emit('dirty-change', true) → markDirty(tabName) → tab.dirty = true
|
|
1015
|
+
│
|
|
1016
|
+
▼
|
|
1017
|
+
页签标题前显示 ● 标识 (renderTabLabel 中处理)
|
|
1018
|
+
│
|
|
1019
|
+
▼
|
|
1020
|
+
尝试关闭时 → confirmOnClose && dirty → 弹出确认对话框
|
|
1021
|
+
```
|
|
1022
|
+
|
|
1023
|
+
### 9.4 与现有 xform 组件的关系
|
|
1024
|
+
|
|
1025
|
+
| 现有 xform 组件 | 本方案中的角色 |
|
|
1026
|
+
|-----------------|---------------|
|
|
1027
|
+
| `VFormRender` (`form-render/index.vue`) | 在每个表单页签中渲染表单 JSON |
|
|
1028
|
+
| `tab-item.vue` (运行态 Tab) | **不受影响** — 这是表单内部容器组件,与本方案的业务层 Tab 是不同维度 |
|
|
1029
|
+
| `tab-widget.vue` (设计态 Tab) | **不受影响** — 设计器内部使用 |
|
|
1030
|
+
| `widgetsConfig.js` (组件注册) | **不需要修改** — 本方案在外部组合 |
|
|
1031
|
+
|
|
1032
|
+
### 9.5 样式适配要点
|
|
1033
|
+
|
|
1034
|
+
- 使用 `el-tabs` 的 `type="card"` 样式,自带关闭按钮和圆角卡片风格
|
|
1035
|
+
- 页签栏高度约 40px, 内容区 `flex: 1` 占满剩余空间
|
|
1036
|
+
- 切换动画使用 Element UI 内置的 `fade-in-linear` transition
|
|
1037
|
+
- 多页签时自动出现左右滚动箭头 (el-tabs 内置行为)
|
|
1038
|
+
|
|
1039
|
+
---
|
|
1040
|
+
|
|
1041
|
+
## 十、实施步骤建议
|
|
1042
|
+
|
|
1043
|
+
### Phase 1:基础框架 (预计 2-3 天)
|
|
1044
|
+
1. 创建 `XFormTabContainer/` 目录结构
|
|
1045
|
+
2. 实现 `useTabManager.js` — 页签状态管理
|
|
1046
|
+
3. 实现 `index.vue` — 主容器骨架
|
|
1047
|
+
4. 实现 `XFormTabPane.vue` — 页签内容包装
|
|
1048
|
+
5. **验证**: 手动添加/关闭页签, 切换正常
|
|
1049
|
+
|
|
1050
|
+
### Phase 2:集成 xform (预计 2 天)
|
|
1051
|
+
1. 在 `XFormTabPane` 中集成 `VFormRender` 组件
|
|
1052
|
+
2. 实现表单 JSON 加载和数据回填
|
|
1053
|
+
3. 接入暂存/提交 API 调用
|
|
1054
|
+
4. **验证**: 新增页签能正常渲染表单, 暂存和提交流程跑通
|
|
1055
|
+
|
|
1056
|
+
### Phase 3:列表集成 (预计 1-2 天)
|
|
1057
|
+
1. 在列表页签中接入实际的列表组件
|
|
1058
|
+
2. 实现列表的新增/编辑/查看按钮回调
|
|
1059
|
+
3. 实现提交后的列表自动刷新
|
|
1060
|
+
4. **验证**: 完整 CRUD 流程走通
|
|
1061
|
+
|
|
1062
|
+
### Phase 4:体验优化 (预计 1-2 天)
|
|
1063
|
+
1. 脏数据检测与关闭确认
|
|
1064
|
+
2. 页签最大数量限制
|
|
1065
|
+
3. 页签标题脏数据标识 (●)
|
|
1066
|
+
4. 键盘快捷键支持 (Ctrl+S 暂存, Ctrl+W 关闭等)
|
|
1067
|
+
5. **验收**: 符合需求图中全部 4 条交互要求
|
|
1068
|
+
|
|
1069
|
+
---
|
|
1070
|
+
|
|
1071
|
+
## 十一、风险与注意事项
|
|
1072
|
+
|
|
1073
|
+
| 风险点 | 影响 | 应对措施 |
|
|
1074
|
+
|--------|------|----------|
|
|
1075
|
+
| 大量页签导致内存占用过高 | 页面卡顿 | 设置 `maxTabs` 上限; 关闭时彻底销毁组件实例 |
|
|
1076
|
+
| 表单 JSON 过大导致切换卡顿 | 用户体验差 | 按需加载(懒渲染); 使用 `keepAlive` 缓存最近 N 个 |
|
|
1077
|
+
| 并发编辑冲突 | 数据覆盖 | 提交前校验版本号; 乐观锁机制 |
|
|
1078
|
+
| 浏览器后退按钮 | 意外离开 | 监听 `beforeunload` 事件提示保存 |
|
|
1079
|
+
| 与路由系统配合 | URL 不同步 | 可选: 将当前活跃页签同步到 query 参数 |
|