agilebuilder-ui 1.0.0
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/README.md +7 -0
- package/index.html +13 -0
- package/package.json +36 -0
- package/packages/IntervalSelection/index.js +6 -0
- package/packages/IntervalSelection/src/quarterScope.vue +405 -0
- package/packages/IntervalSelection/src/sectionDate.vue +475 -0
- package/packages/breadcrumb/index.js +6 -0
- package/packages/breadcrumb/src/breadcrumb.vue +81 -0
- package/packages/department-tree/index.js +6 -0
- package/packages/department-tree/src/department-tree.vue +114 -0
- package/packages/department-tree-inline/index.js +6 -0
- package/packages/department-tree-inline/src/department-multi-tree-inline.vue +494 -0
- package/packages/department-tree-inline/src/department-single-tree-inline.vue +367 -0
- package/packages/department-tree-inline/src/department-tree-inline.vue +86 -0
- package/packages/department-tree-inline/src/department-tree-service.js +344 -0
- package/packages/department-tree-inline/src/search-result.vue +238 -0
- package/packages/department-user-tree/index.js +6 -0
- package/packages/department-user-tree/src/department-user-multiple-tree.vue +133 -0
- package/packages/department-user-tree/src/department-user-single-tree.vue +96 -0
- package/packages/department-user-tree/src/department-user-tree.vue +115 -0
- package/packages/department-user-tree-inline/index.js +9 -0
- package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +758 -0
- package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +358 -0
- package/packages/department-user-tree-inline/src/department-user-tree-inline.vue +87 -0
- package/packages/department-user-tree-inline/src/department-user-tree-multi-service.js +309 -0
- package/packages/department-user-tree-inline/src/department-user-tree-single-service.js +180 -0
- package/packages/department-user-tree-inline/src/search-result.vue +286 -0
- package/packages/directives/prevent-reclick.js +22 -0
- package/packages/dynamic-source-select/index.js +6 -0
- package/packages/dynamic-source-select/src/dynamic-source-select-service.js +124 -0
- package/packages/dynamic-source-select/src/dynamic-source-select.vue +857 -0
- package/packages/dynamic-source-select/src/events.js +77 -0
- package/packages/fs-preview/index.js +6 -0
- package/packages/fs-preview/src/fs-preview.vue +303 -0
- package/packages/fs-upload/index.js +6 -0
- package/packages/fs-upload/src/fs-upload-multi.vue +458 -0
- package/packages/fs-upload/src/fs-upload-single.vue +365 -0
- package/packages/fs-upload/src/fs-upload.vue +191 -0
- package/packages/fs-upload/src/see-big-picture.vue +67 -0
- package/packages/fs-upload-list/index.js +6 -0
- package/packages/fs-upload-list/src/fs-upload-list.vue +387 -0
- package/packages/hamburger/index.js +6 -0
- package/packages/hamburger/src/hamburger.vue +50 -0
- package/packages/index.js +124 -0
- package/packages/multipart-upload/index.js +6 -0
- package/packages/multipart-upload/src/index.vue +66 -0
- package/packages/multipart-upload/src/multipart-upload-form.vue +395 -0
- package/packages/multipart-upload/src/multipart-upload-list.vue +539 -0
- package/packages/organization-input/index.js +6 -0
- package/packages/organization-input/src/organization-input.vue +579 -0
- package/packages/plugins/export-data-new.js +630 -0
- package/packages/plugins/export-data.js +431 -0
- package/packages/plugins/index.js +15 -0
- package/packages/plugins/public-method.js +47 -0
- package/packages/remove-department/index.js +6 -0
- package/packages/remove-department/src/remove-department.vue +201 -0
- package/packages/remove-department/src/remove-dept-service.js +31 -0
- package/packages/remove-user/index.js +6 -0
- package/packages/remove-user/src/remove-user-service.js +31 -0
- package/packages/remove-user/src/remove-user.vue +227 -0
- package/packages/remove-workgroup/index.js +6 -0
- package/packages/remove-workgroup/src/remove-workgroup-service.js +31 -0
- package/packages/remove-workgroup/src/remove-workgroup.vue +184 -0
- package/packages/rich-editor/index.js +7 -0
- package/packages/rich-editor/index.vue +314 -0
- package/packages/rich-editor/tinymce/icons/default/icons.min.js +1 -0
- package/packages/rich-editor/tinymce/langs/README.md +3 -0
- package/packages/rich-editor/tinymce/langs/zh-Hans.js +1 -0
- package/packages/rich-editor/tinymce/license.txt +21 -0
- package/packages/rich-editor/tinymce/models/dom/model.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/accordion/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/advlist/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/anchor/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/autolink/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/autoresize/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/autosave/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/charmap/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/code/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/codesample/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/directionality/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/emoticons/js/emojiimages.js +1 -0
- package/packages/rich-editor/tinymce/plugins/emoticons/js/emojiimages.min.js +3 -0
- package/packages/rich-editor/tinymce/plugins/emoticons/js/emojis.js +1 -0
- package/packages/rich-editor/tinymce/plugins/emoticons/js/emojis.min.js +2 -0
- package/packages/rich-editor/tinymce/plugins/emoticons/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/fullscreen/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/ar.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/bg_BG.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/ca.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/cs.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/da.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/de.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/el.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/en.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/es.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/eu.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/fa.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/fi.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/fr_FR.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/he_IL.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/hi.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/hr.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/hu_HU.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/id.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/it.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/ja.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/kk.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/ko_KR.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/ms.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/nb_NO.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/nl.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/pl.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/pt_BR.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/pt_PT.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/ro.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/ru.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/sk.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/sl_SI.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/sv_SE.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/th_TH.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/tr.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/uk.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/vi.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/zh_CN.js +84 -0
- package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/zh_TW.js +90 -0
- package/packages/rich-editor/tinymce/plugins/help/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/image/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/importcss/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/insertdatetime/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/link/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/lists/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/media/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/nonbreaking/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/pagebreak/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/preview/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/quickbars/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/save/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/searchreplace/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/table/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/template/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/visualblocks/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/visualchars/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/plugins/wordcount/plugin.min.js +4 -0
- package/packages/rich-editor/tinymce/skins/content/dark/content.js +2 -0
- package/packages/rich-editor/tinymce/skins/content/dark/content.min.css +1 -0
- package/packages/rich-editor/tinymce/skins/content/default/content.js +2 -0
- package/packages/rich-editor/tinymce/skins/content/default/content.min.css +1 -0
- package/packages/rich-editor/tinymce/skins/content/document/content.js +2 -0
- package/packages/rich-editor/tinymce/skins/content/document/content.min.css +1 -0
- package/packages/rich-editor/tinymce/skins/content/tinymce-5/content.js +2 -0
- package/packages/rich-editor/tinymce/skins/content/tinymce-5/content.min.css +1 -0
- package/packages/rich-editor/tinymce/skins/content/tinymce-5-dark/content.js +2 -0
- package/packages/rich-editor/tinymce/skins/content/tinymce-5-dark/content.min.css +1 -0
- package/packages/rich-editor/tinymce/skins/content/writer/content.js +2 -0
- package/packages/rich-editor/tinymce/skins/content/writer/content.min.css +1 -0
- package/packages/rich-editor/tinymce/skins/ui/oxide/content.inline.js +2 -0
- package/packages/rich-editor/tinymce/skins/ui/oxide/content.inline.min.css +1 -0
- package/packages/rich-editor/tinymce/skins/ui/oxide/content.js +2 -0
- package/packages/rich-editor/tinymce/skins/ui/oxide/content.min.css +1 -0
- package/packages/rich-editor/tinymce/skins/ui/oxide/skin.js +2 -0
- package/packages/rich-editor/tinymce/skins/ui/oxide/skin.min.css +1 -0
- package/packages/rich-editor/tinymce/skins/ui/oxide/skin.shadowdom.js +2 -0
- package/packages/rich-editor/tinymce/skins/ui/oxide/skin.shadowdom.min.css +1 -0
- package/packages/rich-editor/tinymce/skins/ui/oxide-dark/content.inline.js +2 -0
- package/packages/rich-editor/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -0
- package/packages/rich-editor/tinymce/skins/ui/oxide-dark/content.js +2 -0
- package/packages/rich-editor/tinymce/skins/ui/oxide-dark/content.min.css +1 -0
- package/packages/rich-editor/tinymce/skins/ui/oxide-dark/skin.js +2 -0
- package/packages/rich-editor/tinymce/skins/ui/oxide-dark/skin.min.css +1 -0
- package/packages/rich-editor/tinymce/skins/ui/oxide-dark/skin.shadowdom.js +2 -0
- package/packages/rich-editor/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css +1 -0
- package/packages/rich-editor/tinymce/skins/ui/tinymce-5/content.inline.js +2 -0
- package/packages/rich-editor/tinymce/skins/ui/tinymce-5/content.inline.min.css +1 -0
- package/packages/rich-editor/tinymce/skins/ui/tinymce-5/content.js +2 -0
- package/packages/rich-editor/tinymce/skins/ui/tinymce-5/content.min.css +1 -0
- package/packages/rich-editor/tinymce/skins/ui/tinymce-5/skin.js +2 -0
- package/packages/rich-editor/tinymce/skins/ui/tinymce-5/skin.min.css +1 -0
- package/packages/rich-editor/tinymce/skins/ui/tinymce-5/skin.shadowdom.js +2 -0
- package/packages/rich-editor/tinymce/skins/ui/tinymce-5/skin.shadowdom.min.css +1 -0
- package/packages/rich-editor/tinymce/skins/ui/tinymce-5-dark/content.inline.js +2 -0
- package/packages/rich-editor/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +1 -0
- package/packages/rich-editor/tinymce/skins/ui/tinymce-5-dark/content.js +2 -0
- package/packages/rich-editor/tinymce/skins/ui/tinymce-5-dark/content.min.css +1 -0
- package/packages/rich-editor/tinymce/skins/ui/tinymce-5-dark/skin.js +2 -0
- package/packages/rich-editor/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -0
- package/packages/rich-editor/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.js +2 -0
- package/packages/rich-editor/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.min.css +1 -0
- package/packages/rich-editor/tinymce/themes/silver/theme.min.js +4 -0
- package/packages/rich-editor/tinymce/tinymce.d.ts +3238 -0
- package/packages/rich-editor/tinymce/tinymce.min.js +4 -0
- package/packages/rich-editor/tinymce/zh_CN.js +418 -0
- package/packages/rich-editor/viewer.vue +105 -0
- package/packages/scan-code-input/index.js +6 -0
- package/packages/scan-code-input/src/events.js +34 -0
- package/packages/scan-code-input/src/scan-code-input-colse.vue +140 -0
- package/packages/scan-code-input/src/scan-code-input.vue +132 -0
- package/packages/secret-info/index.js +7 -0
- package/packages/secret-info/index.vue +100 -0
- package/packages/super-grid/index.js +7 -0
- package/packages/super-grid/src/apis.js +1193 -0
- package/packages/super-grid/src/columns-config.vue +429 -0
- package/packages/super-grid/src/components/grid-icon.vue +162 -0
- package/packages/super-grid/src/components/hyperlinks.vue +114 -0
- package/packages/super-grid/src/custom-formatter.js +430 -0
- package/packages/super-grid/src/dynamic-input.vue +1473 -0
- package/packages/super-grid/src/eventBus.js +10 -0
- package/packages/super-grid/src/events.js +56 -0
- package/packages/super-grid/src/formValidatorUtil.js +300 -0
- package/packages/super-grid/src/formatter.js +196 -0
- package/packages/super-grid/src/group-column.vue +99 -0
- package/packages/super-grid/src/header-context-menu.vue +82 -0
- package/packages/super-grid/src/index-column.vue +69 -0
- package/packages/super-grid/src/normal-column.vue +1239 -0
- package/packages/super-grid/src/public-methods.js +30 -0
- package/packages/super-grid/src/row-operation.vue +193 -0
- package/packages/super-grid/src/search-button.vue +79 -0
- package/packages/super-grid/src/search-condition-input.vue +74 -0
- package/packages/super-grid/src/search-condition-list.vue +70 -0
- package/packages/super-grid/src/search-form-advancedQuery.vue +833 -0
- package/packages/super-grid/src/search-form-dialog.vue +77 -0
- package/packages/super-grid/src/search-form-item.vue +496 -0
- package/packages/super-grid/src/search-form-number.vue +111 -0
- package/packages/super-grid/src/search-form-open.vue +178 -0
- package/packages/super-grid/src/search-form-ordinarySearch.vue +248 -0
- package/packages/super-grid/src/search-form.vue +767 -0
- package/packages/super-grid/src/search-methods.js +591 -0
- package/packages/super-grid/src/selection-column.vue +46 -0
- package/packages/super-grid/src/store.js +3 -0
- package/packages/super-grid/src/super-grid-service.js +729 -0
- package/packages/super-grid/src/super-grid.vue +3025 -0
- package/packages/super-grid/src/utils.js +880 -0
- package/packages/super-grid/src/view-image-dialog.vue +190 -0
- package/packages/super-nine-grid/index.js +7 -0
- package/packages/super-nine-grid/src/apis.js +108 -0
- package/packages/super-nine-grid/src/custom-formatter.js +73 -0
- package/packages/super-nine-grid/src/formatter.js +134 -0
- package/packages/super-nine-grid/src/search-form-number.vue +35 -0
- package/packages/super-nine-grid/src/search-form.vue +704 -0
- package/packages/super-nine-grid/src/search-methods.js +151 -0
- package/packages/super-nine-grid/src/store.js +3 -0
- package/packages/super-nine-grid/src/super-grid-service.js +108 -0
- package/packages/super-nine-grid/src/super-nine-grid.vue +1211 -0
- package/packages/super-nine-grid/src/utils.js +264 -0
- package/packages/svg-icon/index.js +6 -0
- package/packages/svg-icon/src/svg-icon.vue +43 -0
- package/packages/utils/date-util.js +292 -0
- package/packages/utils/dom.js +227 -0
- package/packages/utils/gogocodeTransfer.js +59 -0
- package/packages/utils/memory-cache-utils.js +117 -0
- package/packages/utils/utils.js +180 -0
- package/packages/utils/value-set.js +97 -0
- package/packages/valid-code/index.js +7 -0
- package/packages/valid-code/src/valid-code.vue +104 -0
- package/packages/workflow-button/index.js +6 -0
- package/packages/workflow-button/src/workflow-button.vue +569 -0
- package/packages/workflow-history-list/index.js +6 -0
- package/packages/workflow-history-list/src/api.js +7 -0
- package/packages/workflow-history-list/src/workflow-history-list.vue +302 -0
- package/packages/workgroup-tree/index.js +6 -0
- package/packages/workgroup-tree/src/workgroup-tree.vue +87 -0
- package/packages/workgroup-tree-inline/index.js +6 -0
- package/packages/workgroup-tree-inline/src/search-result.vue +226 -0
- package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +539 -0
- package/packages/workgroup-tree-inline/src/workgroup-tree-service.js +93 -0
- package/packages/workgroup-user-tree/index.js +6 -0
- package/packages/workgroup-user-tree/src/workgroup-user-tree.vue +104 -0
- package/packages/workgroup-user-tree-inline/index.js +9 -0
- package/packages/workgroup-user-tree-inline/src/search-result.vue +270 -0
- package/packages/workgroup-user-tree-inline/src/workgroup-tree-inline-service.js +239 -0
- package/packages/workgroup-user-tree-inline/src/workgroup-user-tree-inline.vue +681 -0
- package/packages/year-range-picker/index.js +6 -0
- package/packages/year-range-picker/src/year-range-picker.vue +53 -0
- package/public/vite.svg +1 -0
- package/src/api/sso-service.js +193 -0
- package/src/api/tab.js +36 -0
- package/src/api/user-service.js +11 -0
- package/src/assets/401/401.gif +0 -0
- package/src/assets/404/404-cloud.png +0 -0
- package/src/assets/404/404.png +0 -0
- package/src/assets/cloud.png +0 -0
- package/src/assets/nonemessage.png +0 -0
- package/src/directives/permission/index.js +13 -0
- package/src/directives/permission/permission.js +20 -0
- package/src/i18n/i18n.js +16 -0
- package/src/i18n/langs/cn.js +266 -0
- package/src/i18n/langs/en.js +276 -0
- package/src/index.js +93 -0
- package/src/permission.js +242 -0
- package/src/plugins.js +18 -0
- package/src/router/index.js +92 -0
- package/src/store/getters.js +15 -0
- package/src/store/index.js +19 -0
- package/src/store/modules/app.js +54 -0
- package/src/store/modules/permission.js +143 -0
- package/src/store/modules/tab-content.js +36 -0
- package/src/store/modules/user.js +365 -0
- package/src/styles/display-layout.scss +34 -0
- package/src/styles/element-ui.scss +29 -0
- package/src/styles/index.scss +157 -0
- package/src/styles/mixin.scss +27 -0
- package/src/styles/theme/black/font-style.scss +70 -0
- package/src/styles/theme/black/index.scss +306 -0
- package/src/styles/theme/black/sidebar.scss +189 -0
- package/src/styles/theme/blue/font-style.scss +46 -0
- package/src/styles/theme/blue/index.scss +172 -0
- package/src/styles/theme/blue/sidebar.scss +171 -0
- package/src/styles/theme/blue2/font-style.scss +70 -0
- package/src/styles/theme/blue2/index.scss +188 -0
- package/src/styles/theme/blue2/sidebar.scss +201 -0
- package/src/styles/theme/dark-blue/button.scss +78 -0
- package/src/styles/theme/dark-blue/card.scss +63 -0
- package/src/styles/theme/dark-blue/checkbox.scss +10 -0
- package/src/styles/theme/dark-blue/dark-blue-var.scss +9 -0
- package/src/styles/theme/dark-blue/dialog.scss +17 -0
- package/src/styles/theme/dark-blue/element-variables.scss +7 -0
- package/src/styles/theme/dark-blue/font.scss +71 -0
- package/src/styles/theme/dark-blue/form.scss +51 -0
- package/src/styles/theme/dark-blue/index.scss +277 -0
- package/src/styles/theme/dark-blue/input.scss +15 -0
- package/src/styles/theme/dark-blue/message.scss +8 -0
- package/src/styles/theme/dark-blue/pagination.scss +18 -0
- package/src/styles/theme/dark-blue/radio.scss +13 -0
- package/src/styles/theme/dark-blue/scrollbar-style.scss +32 -0
- package/src/styles/theme/dark-blue/sidebar.scss +268 -0
- package/src/styles/theme/dark-blue/tab.scss +83 -0
- package/src/styles/theme/dark-blue/table.scss +60 -0
- package/src/styles/theme/dark-blue/tree.scss +57 -0
- package/src/styles/theme/dark-blue/var.scss +1028 -0
- package/src/styles/theme/gray/card-style.scss +54 -0
- package/src/styles/theme/gray/font-style.scss +70 -0
- package/src/styles/theme/gray/index.scss +172 -0
- package/src/styles/theme/gray/input-style.scss +19 -0
- package/src/styles/theme/gray/scrollbar-style.scss +32 -0
- package/src/styles/theme/gray/sidebar.scss +243 -0
- package/src/styles/theme/gray/tab-style.scss +81 -0
- package/src/styles/transition.scss +47 -0
- package/src/utils/auth-api.js +259 -0
- package/src/utils/auth.js +98 -0
- package/src/utils/calculator/calculator-factory-wf.js +558 -0
- package/src/utils/calculator/calculator-factory.js +145 -0
- package/src/utils/calculator/calculator-util.js +166 -0
- package/src/utils/common-util.js +474 -0
- package/src/utils/eventBus.js +10 -0
- package/src/utils/iconUtils.js +37 -0
- package/src/utils/index.js +102 -0
- package/src/utils/jump-page-utils.js +824 -0
- package/src/utils/local-storage.js +33 -0
- package/src/utils/menu.js +19 -0
- package/src/utils/permission.js +31 -0
- package/src/utils/permissionAuth.js +121 -0
- package/src/utils/range-selector.js +204 -0
- package/src/utils/request.js +280 -0
- package/src/utils/restful-interface-utils.js +57 -0
- package/src/utils/util.js +910 -0
- package/src/utils/validate.js +34 -0
- package/src/utils/watermark.js +108 -0
- package/src/utils/workflow-util.js +104 -0
- package/src/views/404.vue +248 -0
- package/src/views/dsc-component/Sidebar/Item.vue +81 -0
- package/src/views/dsc-component/Sidebar/Link.vue +38 -0
- package/src/views/dsc-component/Sidebar/SidebarItem.vue +197 -0
- package/src/views/dsc-component/Sidebar/index.vue +229 -0
- package/src/views/dsc-component/tabs/tab-content.vue +215 -0
- package/src/views/error-page/401.vue +106 -0
- package/src/views/error-page/404.vue +248 -0
- package/src/views/layout/EmptyLayout.vue +3 -0
- package/src/views/layout/Layout.vue +81 -0
- package/src/views/layout/NewLayout.vue +18 -0
- package/src/views/layout/components/AppMain.vue +39 -0
- package/src/views/layout/components/Breadcrumb/index.vue +158 -0
- package/src/views/layout/components/Menubar/Item.vue +79 -0
- package/src/views/layout/components/Menubar/Link.vue +38 -0
- package/src/views/layout/components/Menubar/SidebarItem.vue +261 -0
- package/src/views/layout/components/Menubar/index.vue +210 -0
- package/src/views/layout/components/Sidebar/Item.vue +53 -0
- package/src/views/layout/components/Sidebar/Link.vue +38 -0
- package/src/views/layout/components/Sidebar/SidebarItem.vue +135 -0
- package/src/views/layout/components/Sidebar/index.vue +141 -0
- package/src/views/layout/components/iframe-page.vue +38 -0
- package/src/views/layout/components/index.js +4 -0
- package/src/views/layout/components/tabs/tab-content.vue +214 -0
- package/src/views/layout/mixin/ResizeHandler.js +41 -0
- package/src/views/layout/tab-content-iframe-index.vue +38 -0
- package/src/views/layout/tab-content-index.vue +92 -0
- package/src/views/login/authredirect.vue +10 -0
- package/src/views/login/index.vue +296 -0
- package/src/views/login/update-password.vue +243 -0
- package/src/views/redirect/index.vue +14 -0
- package/src/views/svg-icon/index.js +6 -0
- package/src/views/svg-icon/src/svg-icon.vue +46 -0
- package/src/views/wf-history/tache-subprocess-history.vue +45 -0
- package/vite.config.js +37 -0
|
@@ -0,0 +1,3025 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<search-form
|
|
4
|
+
v-if="
|
|
5
|
+
!isFormSubTable &&
|
|
6
|
+
hasLoadedColumns &&
|
|
7
|
+
query &&
|
|
8
|
+
query.showType === 'embedded'
|
|
9
|
+
"
|
|
10
|
+
ref="sf"
|
|
11
|
+
:columns="columns"
|
|
12
|
+
:code="code"
|
|
13
|
+
:url="url"
|
|
14
|
+
:pagination="pagination"
|
|
15
|
+
:query="query"
|
|
16
|
+
:search-form-info="searchFormInfo"
|
|
17
|
+
:search-param="searchFormContent"
|
|
18
|
+
:init-search-props="initSearchProps"
|
|
19
|
+
:list-toolbar-form-data="listToolbarFormData"
|
|
20
|
+
:load-complete-query="loadCompleteQuery"
|
|
21
|
+
@search="doSearch"
|
|
22
|
+
@reset="resetSearch"
|
|
23
|
+
@open-fold="openFold"
|
|
24
|
+
/>
|
|
25
|
+
<search-form-dialog
|
|
26
|
+
v-if="hasLoadedColumns && query && query.showType === 'popup'"
|
|
27
|
+
ref="sfDialog"
|
|
28
|
+
:columns="columns"
|
|
29
|
+
:code="code"
|
|
30
|
+
:url="url"
|
|
31
|
+
:pagination="pagination"
|
|
32
|
+
:query="query"
|
|
33
|
+
:search-param="searchFormContent"
|
|
34
|
+
:init-search-props="initSearchProps"
|
|
35
|
+
@search="doSearchDialog"
|
|
36
|
+
@reset="resetSearch"
|
|
37
|
+
@close="closeSearchFormDialog"
|
|
38
|
+
/>
|
|
39
|
+
<div :class="'grid-area ' + code">
|
|
40
|
+
<el-table
|
|
41
|
+
v-if="refreshGrid && hasLoadedColumns"
|
|
42
|
+
ref="superGrid"
|
|
43
|
+
:data="gridData"
|
|
44
|
+
:row-key="getRowKeyProp"
|
|
45
|
+
:show-summary="showSummary"
|
|
46
|
+
:summary-method="getSummaries"
|
|
47
|
+
style="width: 100%"
|
|
48
|
+
:stripe="stripe"
|
|
49
|
+
:border="true"
|
|
50
|
+
:default-expand-all="defaultExpandAll"
|
|
51
|
+
:lazy="isLazy"
|
|
52
|
+
:load="loadChildren"
|
|
53
|
+
:row-style="changeRowStyle"
|
|
54
|
+
:cell-style="changeCellStyle"
|
|
55
|
+
:header-cell-style="changeHeaderStyle"
|
|
56
|
+
:highlight-current-row="true"
|
|
57
|
+
:span-method="rowSpan"
|
|
58
|
+
:max-height="maxHeight"
|
|
59
|
+
:height="height"
|
|
60
|
+
class="elTable"
|
|
61
|
+
:tree-props="getTreeProps(parentProp, isSql, isLazy, dataSourceType)"
|
|
62
|
+
@sort-change="handleSortChange"
|
|
63
|
+
@select="selectRecord"
|
|
64
|
+
@select-all="selectAllRecord"
|
|
65
|
+
@selection-change="selectionChangeEvent"
|
|
66
|
+
@row-click="rowClickEvent"
|
|
67
|
+
@row-dblclick="rowDblclickEvent"
|
|
68
|
+
@expand-change="expandChange"
|
|
69
|
+
@header-click="headerClick"
|
|
70
|
+
@header-dragend="changeHederWidth"
|
|
71
|
+
@header-contextmenu="headerContextmenu"
|
|
72
|
+
@cell-click="selectCell"
|
|
73
|
+
>
|
|
74
|
+
<template v-if="myCustomFormatter">
|
|
75
|
+
<component
|
|
76
|
+
:is="getComponentType(column.prop)"
|
|
77
|
+
v-for="(column, index) in visibleColumns"
|
|
78
|
+
:ref="column.prop"
|
|
79
|
+
:key="column.label + index"
|
|
80
|
+
:column="column"
|
|
81
|
+
:is-sql="isSql"
|
|
82
|
+
:list-code="code"
|
|
83
|
+
:custom-format="
|
|
84
|
+
getComponentType(column.prop) === 'GroupColumn'
|
|
85
|
+
? myCustomFormatter
|
|
86
|
+
: myCustomFormatter[column.prop]
|
|
87
|
+
"
|
|
88
|
+
:new-width="newWidth"
|
|
89
|
+
:drag-column-prop="dragColumnProp"
|
|
90
|
+
:right-click-menu-arr="options.rightClickMenuArr"
|
|
91
|
+
:table-name="tableName"
|
|
92
|
+
:page-code="pageCode"
|
|
93
|
+
:list-name="listName"
|
|
94
|
+
:options="options"
|
|
95
|
+
:pagination="pagination"
|
|
96
|
+
:current-page="currentPage"
|
|
97
|
+
:grid-data="isSubTableShowPage ? subTableData : gridData"
|
|
98
|
+
:page-grid-data="
|
|
99
|
+
isSubTableShowPage ? getSubTableGridData(subTableData) : gridData
|
|
100
|
+
"
|
|
101
|
+
@open-page="openPageDialog"
|
|
102
|
+
@refresPortData="refresPortData"
|
|
103
|
+
@refresPortsData="refresPortsData"
|
|
104
|
+
@refresMainTableFields="refresMainTableFields"
|
|
105
|
+
@prohibitToEdit="prohibitToEdit"
|
|
106
|
+
/>
|
|
107
|
+
</template>
|
|
108
|
+
<template v-else>
|
|
109
|
+
<component
|
|
110
|
+
:is="getComponentType(column.prop)"
|
|
111
|
+
v-for="(column, index) in visibleColumns"
|
|
112
|
+
:ref="column.prop"
|
|
113
|
+
:key="column.label + index"
|
|
114
|
+
:is-sql="isSql"
|
|
115
|
+
:column="column"
|
|
116
|
+
:list-code="code"
|
|
117
|
+
:is-line-edit="lineEdit !== null && lineEdit.editable"
|
|
118
|
+
:new-width="newWidth"
|
|
119
|
+
:drag-column-prop="dragColumnProp"
|
|
120
|
+
:right-click-menu-arr="options.rightClickMenuArr"
|
|
121
|
+
:table-name="tableName"
|
|
122
|
+
:page-code="pageCode"
|
|
123
|
+
:list-toolbar-form-data="listToolbarFormData"
|
|
124
|
+
:list-name="listName"
|
|
125
|
+
:options="options"
|
|
126
|
+
:current-page="currentPage"
|
|
127
|
+
:pagination="pagination"
|
|
128
|
+
:grid-data="isSubTableShowPage ? subTableData : gridData"
|
|
129
|
+
:page-grid-data="
|
|
130
|
+
isSubTableShowPage ? getSubTableGridData(subTableData) : gridData
|
|
131
|
+
"
|
|
132
|
+
@open-page="openPageDialog"
|
|
133
|
+
@refresData="refresData"
|
|
134
|
+
@refresPortData="refresPortData"
|
|
135
|
+
@refresPortsData="refresPortsData"
|
|
136
|
+
@refresMainTableFields="refresMainTableFields"
|
|
137
|
+
@prohibitToEdit="prohibitToEdit"
|
|
138
|
+
/>
|
|
139
|
+
</template>
|
|
140
|
+
</el-table>
|
|
141
|
+
<div v-if="showPagination" style="position: relative; margin-top: 5px">
|
|
142
|
+
<el-row>
|
|
143
|
+
<!-- <el-col
|
|
144
|
+
v-if="
|
|
145
|
+
!(
|
|
146
|
+
typeof options.isAdministerListView !== 'undefined' &&
|
|
147
|
+
options.isAdministerListView != null &&
|
|
148
|
+
options.isAdministerListView === true
|
|
149
|
+
)
|
|
150
|
+
"
|
|
151
|
+
:span="2"
|
|
152
|
+
> -->
|
|
153
|
+
<el-icon v-if="basicInfo.customConfig && !isFormSubTable" class="el-icon-setting" :title="$t('superGrid.columnConfig')" @click="configColumns" style="float: left; padding: 10px 0px; color: #777"
|
|
154
|
+
><el-icon-setting
|
|
155
|
+
/></el-icon>
|
|
156
|
+
<el-icon v-if="!isFormSubTable" class="el-icon-refresh" :title="$t('superGrid.refresh')" @click="refreshGridData" style="float: left; padding: 10px 0px; color: #777"
|
|
157
|
+
><el-icon-refresh
|
|
158
|
+
/></el-icon>
|
|
159
|
+
<!-- </el-col> -->
|
|
160
|
+
<el-col
|
|
161
|
+
:span="
|
|
162
|
+
!(
|
|
163
|
+
typeof options.isAdministerListView !== 'undefined' &&
|
|
164
|
+
options.isAdministerListView != null &&
|
|
165
|
+
options.isAdministerListView === true
|
|
166
|
+
)
|
|
167
|
+
? 22
|
|
168
|
+
: 24
|
|
169
|
+
"
|
|
170
|
+
>
|
|
171
|
+
<el-pagination
|
|
172
|
+
v-if="pagination && isShowPage"
|
|
173
|
+
v-model:current-page="currentPage"
|
|
174
|
+
v-model:page-size="pagination.pageSize"
|
|
175
|
+
background
|
|
176
|
+
:page-sizes="pagination.pageSizes"
|
|
177
|
+
:layout="pagination.layout"
|
|
178
|
+
:total="pagination.showTotal?(pagination.total!==undefined&&pagination.total!==''&&pagination.total!==null?pagination.total:0):100000000000"
|
|
179
|
+
@size-change="handleSizeChange"
|
|
180
|
+
@current-change="handleCurrentChange"
|
|
181
|
+
/>
|
|
182
|
+
</el-col>
|
|
183
|
+
</el-row>
|
|
184
|
+
</div>
|
|
185
|
+
</div>
|
|
186
|
+
|
|
187
|
+
<columns-config
|
|
188
|
+
v-if="showColumnConfig"
|
|
189
|
+
:columns="columns"
|
|
190
|
+
:list-code="code"
|
|
191
|
+
:is-sql="isSql"
|
|
192
|
+
@close="closeCustomConfig($event)"
|
|
193
|
+
@reset="resetCustomConfig($event)"
|
|
194
|
+
/>
|
|
195
|
+
<header-context-menu
|
|
196
|
+
v-if="showHeaderContextmenu"
|
|
197
|
+
ref="headerMenu"
|
|
198
|
+
:buttom-arr="options.rightClickMenuArr"
|
|
199
|
+
:column="rightClickColumn"
|
|
200
|
+
@clearHeaderContextmenu="clearHeaderContextmenu"
|
|
201
|
+
/>
|
|
202
|
+
<!-- <super-page-dialog
|
|
203
|
+
v-if="isShowPageDialog"
|
|
204
|
+
:dev-mode="pageDevMode"
|
|
205
|
+
:jump-page-setting="jumpPageSetting"
|
|
206
|
+
:source-page-code="pageCode"
|
|
207
|
+
@close="closePageDialog"
|
|
208
|
+
@update-value="updateValues"
|
|
209
|
+
/> -->
|
|
210
|
+
</div>
|
|
211
|
+
</template>
|
|
212
|
+
|
|
213
|
+
<script>
|
|
214
|
+
import {Refresh as ElIconRefresh, Setting as ElIconSetting,} from '@element-plus/icons-vue'
|
|
215
|
+
import {$emit} from '../../utils/gogocodeTransfer'
|
|
216
|
+
import IndexColumn from './index-column.vue'
|
|
217
|
+
import SelectionColumn from './selection-column.vue'
|
|
218
|
+
import NormalColumn from './normal-column.vue'
|
|
219
|
+
import GroupColumn from './group-column.vue'
|
|
220
|
+
import ColumnsConfig from './columns-config.vue'
|
|
221
|
+
import SearchForm from './search-form.vue'
|
|
222
|
+
import searchFormDialog from './search-form-dialog.vue'
|
|
223
|
+
import {getEntityFieldValueWithOutCase, setEntityFieldValue} from '../../../src/utils/util'
|
|
224
|
+
import eventBus from './eventBus'
|
|
225
|
+
import {
|
|
226
|
+
addDynamicProp,
|
|
227
|
+
getExtraParam,
|
|
228
|
+
getFirstEditableColumn,
|
|
229
|
+
getGridParams,
|
|
230
|
+
getLastPageNum,
|
|
231
|
+
getSpanValuesForColumn,
|
|
232
|
+
getTableHeight,
|
|
233
|
+
isCanRefreshGrid,
|
|
234
|
+
isEditOptionFunction,
|
|
235
|
+
isHasEditOption,
|
|
236
|
+
isHasOptionFunction,
|
|
237
|
+
isObjectValueEqual,
|
|
238
|
+
} from './utils'
|
|
239
|
+
import Sortable from 'sortablejs'
|
|
240
|
+
import store from './store'
|
|
241
|
+
import events from './events'
|
|
242
|
+
import publicMethods from './public-methods'
|
|
243
|
+
import superGridService from './super-grid-service'
|
|
244
|
+
import formValidatorService from './formValidatorUtil'
|
|
245
|
+
import {getSystemCode} from '../../../src/utils/permissionAuth'
|
|
246
|
+
import apis from './apis'
|
|
247
|
+
import headerContextMenu from './header-context-menu.vue'
|
|
248
|
+
import {isPromise} from '../../../src/utils/common-util'
|
|
249
|
+
import {checkPermission} from '../../../src/utils/permission'
|
|
250
|
+
|
|
251
|
+
export default {
|
|
252
|
+
components: {
|
|
253
|
+
IndexColumn,
|
|
254
|
+
SelectionColumn,
|
|
255
|
+
NormalColumn,
|
|
256
|
+
GroupColumn,
|
|
257
|
+
ColumnsConfig,
|
|
258
|
+
SearchForm,
|
|
259
|
+
headerContextMenu,
|
|
260
|
+
searchFormDialog,
|
|
261
|
+
ElIconSetting,
|
|
262
|
+
ElIconRefresh,
|
|
263
|
+
},
|
|
264
|
+
name: 'SuperGrid',
|
|
265
|
+
props: {
|
|
266
|
+
code: {
|
|
267
|
+
type: String,
|
|
268
|
+
default: '',
|
|
269
|
+
},
|
|
270
|
+
url: {
|
|
271
|
+
type: String,
|
|
272
|
+
default: '',
|
|
273
|
+
},
|
|
274
|
+
options: {
|
|
275
|
+
type: Object,
|
|
276
|
+
default: function () {
|
|
277
|
+
return {}
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
publishVersion: {
|
|
281
|
+
type: Number,
|
|
282
|
+
default: 0
|
|
283
|
+
},
|
|
284
|
+
// 为了兼容平台的旧写法,暂不删除以下属性
|
|
285
|
+
// 操作列、占位符列内容显示的函数,格式为:{'属性名':方法},例如:{'name':viewUser,'operation':showOperation}
|
|
286
|
+
customFormatter: {
|
|
287
|
+
type: Object,
|
|
288
|
+
default: null,
|
|
289
|
+
},
|
|
290
|
+
searchFormInfo: {
|
|
291
|
+
type: Object,
|
|
292
|
+
default: () => {
|
|
293
|
+
return {}
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
// 是否显示分页器
|
|
297
|
+
showPagination: {
|
|
298
|
+
type: Boolean,
|
|
299
|
+
default: true,
|
|
300
|
+
},
|
|
301
|
+
listToolbarFormData: {
|
|
302
|
+
type: Object,
|
|
303
|
+
default: null,
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
data() {
|
|
307
|
+
let parentProp
|
|
308
|
+
const parentPropSetting = this.options.parentProp
|
|
309
|
+
if (
|
|
310
|
+
typeof parentPropSetting !== 'undefined' &&
|
|
311
|
+
parentPropSetting !== '' &&
|
|
312
|
+
parentPropSetting !== null
|
|
313
|
+
) {
|
|
314
|
+
parentProp = parentPropSetting
|
|
315
|
+
}
|
|
316
|
+
let mergeFields = []
|
|
317
|
+
if (
|
|
318
|
+
this.options &&
|
|
319
|
+
this.options.mergeFields &&
|
|
320
|
+
this.options.mergeFields !== ''
|
|
321
|
+
) {
|
|
322
|
+
mergeFields = this.options.mergeFields.split(',')
|
|
323
|
+
}
|
|
324
|
+
let optionTableHeight
|
|
325
|
+
if (
|
|
326
|
+
this.options &&
|
|
327
|
+
this.options.optionTableHeight &&
|
|
328
|
+
this.options.optionTableHeight !== ''
|
|
329
|
+
) {
|
|
330
|
+
optionTableHeight = this.options.optionTableHeight
|
|
331
|
+
}
|
|
332
|
+
let pageCode
|
|
333
|
+
if (this.options && this.options.pageCode) {
|
|
334
|
+
pageCode = this.options.pageCode
|
|
335
|
+
}
|
|
336
|
+
let pageHeight
|
|
337
|
+
if (this.options && this.options.pageHeight) {
|
|
338
|
+
pageHeight = this.options.pageHeight
|
|
339
|
+
}
|
|
340
|
+
let isLazy = true
|
|
341
|
+
if (this.options && this.options.lazy !== undefined) {
|
|
342
|
+
isLazy = this.options.lazy
|
|
343
|
+
}
|
|
344
|
+
let defaultExpandAll = true
|
|
345
|
+
if (this.options && this.options.defaultExpandAll !== undefined) {
|
|
346
|
+
defaultExpandAll = this.options.defaultExpandAll
|
|
347
|
+
}
|
|
348
|
+
// 数据库类型,值为mysql、oracle、sqlserver,默认是mysql,树形表格时需要使用
|
|
349
|
+
let dataSourceType = 'mysql'
|
|
350
|
+
if (window.$vueApp.config.globalProperties.dataSourceType) {
|
|
351
|
+
dataSourceType =
|
|
352
|
+
window.$vueApp.config.globalProperties.dataSourceType.toLowerCase()
|
|
353
|
+
}
|
|
354
|
+
let pageDevMode = this.options.pageDevMode
|
|
355
|
+
if (pageDevMode === undefined) {
|
|
356
|
+
pageDevMode = false
|
|
357
|
+
}
|
|
358
|
+
return {
|
|
359
|
+
isLoading: false,
|
|
360
|
+
currentPage: 1,
|
|
361
|
+
showColumnConfig: false,
|
|
362
|
+
basicInfo: {
|
|
363
|
+
summary: 'no',
|
|
364
|
+
},
|
|
365
|
+
columns: [],
|
|
366
|
+
loadCompleteQuery: false,
|
|
367
|
+
pagination: null,
|
|
368
|
+
query: null,
|
|
369
|
+
lineEdit: null,
|
|
370
|
+
gridData: [],
|
|
371
|
+
summaries: null,
|
|
372
|
+
sortInfo: null,
|
|
373
|
+
pageSize: null,
|
|
374
|
+
showSearch: false,
|
|
375
|
+
myCustomFormatter: null,
|
|
376
|
+
height: null,
|
|
377
|
+
timer: null,
|
|
378
|
+
timer2: null,
|
|
379
|
+
isSql: false, // 是否是sql查询
|
|
380
|
+
parentProp, // 树状结构数据时,父字段名,默认是id
|
|
381
|
+
hasLoadData: false,
|
|
382
|
+
mergeFields,
|
|
383
|
+
newWidth: null,
|
|
384
|
+
dragColumnProp: null,
|
|
385
|
+
hasLoadedColumns: false, // 是否已经加载了列配置
|
|
386
|
+
backgroundColorMap: {},
|
|
387
|
+
showHeaderContextmenu: false,
|
|
388
|
+
rightClickColumn: null,
|
|
389
|
+
externalClickFlag: false, // 是否是外部点击
|
|
390
|
+
dataTableCode: null,
|
|
391
|
+
dynamicColumnInfo: null, // 列表管理/字段配置/动态列配置中解析的动态列集合,在获得列表数据和行编辑保存动态列时使用
|
|
392
|
+
mainDefaultValueColumns: null, // 当前列表对应的数据表的字段配置有默认值的字段集合,动态列insert插入主表记录时使用
|
|
393
|
+
dynamicServiceName: null, // 动态列展示及行编辑时数据保存的service处理类,可以不填,使用平台默认的处理类
|
|
394
|
+
searchFormContent: null,
|
|
395
|
+
initSearchProps: [], // 初始查询的字段属性名集合
|
|
396
|
+
refreshGrid: true, // 字段配置刷新列表时用于重新渲染列表的状态位
|
|
397
|
+
optionTableHeight, // option传递的table高度
|
|
398
|
+
isFormSubTable: false,
|
|
399
|
+
isShowPageDialog: false, // 是否显示弹框
|
|
400
|
+
jumpPageSetting: null,
|
|
401
|
+
pageCode,
|
|
402
|
+
maxHeight: null,
|
|
403
|
+
pageHeight, // 页面高度
|
|
404
|
+
currentSelectCell: null,
|
|
405
|
+
isLazy, // 树形结构时是否懒加载,默认是懒加载的
|
|
406
|
+
defaultExpandAll, // 树形结构是否默认展开所有节点
|
|
407
|
+
parentFormData: null, // 父表单实体信息
|
|
408
|
+
stripe: true,
|
|
409
|
+
dataSourceType,
|
|
410
|
+
pageDevMode,
|
|
411
|
+
toolbarFieldParam: [],
|
|
412
|
+
tableName: null,
|
|
413
|
+
listName: null,
|
|
414
|
+
subTableData: [],
|
|
415
|
+
isShowPage: false, // 子表或普通列表是否显示分页
|
|
416
|
+
isSubTableShowPage: false, // 子表是否显示分页
|
|
417
|
+
isDelete: false, // 获取请求参数是否删除后
|
|
418
|
+
}
|
|
419
|
+
},
|
|
420
|
+
computed: {
|
|
421
|
+
visibleColumns() {
|
|
422
|
+
const gridParams = store.get(this.code)
|
|
423
|
+
const operations = this.getOptionOperations()
|
|
424
|
+
gridParams.canntEdit = false
|
|
425
|
+
if (
|
|
426
|
+
operations &&
|
|
427
|
+
operations.operation &&
|
|
428
|
+
operations.operation.length > 0
|
|
429
|
+
) {
|
|
430
|
+
operations.operation.forEach((buttonInfo) => {
|
|
431
|
+
if (buttonInfo.props.code === 'lineEditUpdate') {
|
|
432
|
+
if (checkPermission(buttonInfo.props.functionCode)) {
|
|
433
|
+
gridParams.canntEdit = true
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
})
|
|
437
|
+
}
|
|
438
|
+
if (
|
|
439
|
+
typeof this.options.isAdministerListView !== 'undefined' &&
|
|
440
|
+
this.options.isAdministerListView != null &&
|
|
441
|
+
this.options.isAdministerListView === true
|
|
442
|
+
) {
|
|
443
|
+
return this.columns
|
|
444
|
+
} else {
|
|
445
|
+
return this.columns.filter((column) => {
|
|
446
|
+
if (
|
|
447
|
+
typeof this.options.multiple !== 'undefined' &&
|
|
448
|
+
this.options.multiple === false &&
|
|
449
|
+
column.prop === '$selection'
|
|
450
|
+
) {
|
|
451
|
+
// 表示不显示“多选”列
|
|
452
|
+
return false
|
|
453
|
+
}
|
|
454
|
+
if (
|
|
455
|
+
typeof this.options.showIndex !== 'undefined' &&
|
|
456
|
+
this.options.showIndex === false &&
|
|
457
|
+
column.prop === '$index'
|
|
458
|
+
) {
|
|
459
|
+
// 表示不显示“序号”列
|
|
460
|
+
return false
|
|
461
|
+
}
|
|
462
|
+
let isVisible
|
|
463
|
+
if (column.show === undefined || column.show) {
|
|
464
|
+
isVisible = true
|
|
465
|
+
const hiddenColumns = this.options.hiddenColumns
|
|
466
|
+
if (
|
|
467
|
+
hiddenColumns &&
|
|
468
|
+
hiddenColumns.length > 0 &&
|
|
469
|
+
hiddenColumns.indexOf(column.prop) !== -1
|
|
470
|
+
) {
|
|
471
|
+
// 如果当前字段包含在隐藏字段集合中,则不显示该字段
|
|
472
|
+
isVisible = false
|
|
473
|
+
return isVisible
|
|
474
|
+
}
|
|
475
|
+
// 给列配置操作属性
|
|
476
|
+
this.initColumnOperation(column, operations)
|
|
477
|
+
if (!gridParams.$dataTypeMap) {
|
|
478
|
+
gridParams.$dataTypeMap = {}
|
|
479
|
+
}
|
|
480
|
+
// sql时行编辑保存后台代码需要
|
|
481
|
+
gridParams.$dataTypeMap[column.prop] = column.dataType
|
|
482
|
+
} else {
|
|
483
|
+
isVisible = false
|
|
484
|
+
}
|
|
485
|
+
// 存储有默认值的字段集合
|
|
486
|
+
this.storeHasDefaultValueColumns(column, gridParams)
|
|
487
|
+
return isVisible
|
|
488
|
+
})
|
|
489
|
+
}
|
|
490
|
+
},
|
|
491
|
+
spanArr() {
|
|
492
|
+
const spanArr = []
|
|
493
|
+
for (const column of this.columns) {
|
|
494
|
+
if (
|
|
495
|
+
column.span ||
|
|
496
|
+
(this.mergeFields && this.mergeFields.indexOf(column.prop) !== -1)
|
|
497
|
+
) {
|
|
498
|
+
spanArr[column.prop] = getSpanValuesForColumn(
|
|
499
|
+
this.gridData,
|
|
500
|
+
column.prop,
|
|
501
|
+
column.mergerCellBasis
|
|
502
|
+
)
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
return spanArr
|
|
506
|
+
},
|
|
507
|
+
showSummary() {
|
|
508
|
+
return (
|
|
509
|
+
this.basicInfo.summary !== undefined && this.basicInfo.summary !== 'no'
|
|
510
|
+
)
|
|
511
|
+
},
|
|
512
|
+
// 返回table用来确定唯一的字段。必须配置,否则树形结构时无法显示子集合。
|
|
513
|
+
getRowKeyProp() {
|
|
514
|
+
const gridParams = store.get(this.code)
|
|
515
|
+
if (gridParams && gridParams.options && gridParams.options.rowKeyProp) {
|
|
516
|
+
return gridParams.options.rowKeyProp
|
|
517
|
+
} else {
|
|
518
|
+
if (this.dataSourceType === 'oracle') {
|
|
519
|
+
return 'ID'
|
|
520
|
+
} else {
|
|
521
|
+
return 'id'
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
},
|
|
525
|
+
// ,
|
|
526
|
+
// hasLoadMainTable() {
|
|
527
|
+
// const hasLoadMainTable = store.get('hasLoadMainTable')
|
|
528
|
+
// if (typeof (hasLoadMainTable) === 'undefined') {
|
|
529
|
+
// return false
|
|
530
|
+
// }
|
|
531
|
+
// return hasLoadMainTable
|
|
532
|
+
// }
|
|
533
|
+
},
|
|
534
|
+
watch: {
|
|
535
|
+
'options.SuperGrid': {
|
|
536
|
+
deep: true,
|
|
537
|
+
handler: function () {
|
|
538
|
+
this.externalClickFlag = true
|
|
539
|
+
console.log('监听到数据改变')
|
|
540
|
+
this.initSetting()
|
|
541
|
+
this.initialize()
|
|
542
|
+
},
|
|
543
|
+
},
|
|
544
|
+
// 监控列表数据修改,列表作为表单编辑器中子表时使用
|
|
545
|
+
gridData: {
|
|
546
|
+
deep: true,
|
|
547
|
+
immediate: true,
|
|
548
|
+
handler: function (Val) {
|
|
549
|
+
if (!this.isSubTableShowPage) {
|
|
550
|
+
// 列表子表不分页时使用
|
|
551
|
+
$emit(this, 'change-grid-data', this.gridData)
|
|
552
|
+
}
|
|
553
|
+
},
|
|
554
|
+
},
|
|
555
|
+
// 监控列表数据修改,列表作为表单编辑器中子表时使用
|
|
556
|
+
subTableData: {
|
|
557
|
+
deep: true,
|
|
558
|
+
immediate: true,
|
|
559
|
+
handler: function () {
|
|
560
|
+
if (this.isSubTableShowPage) {
|
|
561
|
+
// 列表子表分页时使用
|
|
562
|
+
const gridParams = store.get(this.code)
|
|
563
|
+
$emit(this, 'change-grid-data', this.subTableData)
|
|
564
|
+
if (
|
|
565
|
+
gridParams.isChangePage !== undefined &&
|
|
566
|
+
gridParams.isChangePage
|
|
567
|
+
) {
|
|
568
|
+
// 表示新建记录时
|
|
569
|
+
// 新建记录时跳转到最后一页
|
|
570
|
+
const lastPageNum = getLastPageNum(
|
|
571
|
+
this.subTableData.length,
|
|
572
|
+
this.pageSize
|
|
573
|
+
)
|
|
574
|
+
// 表示最后一页页码和当前页不同时需要切换页码
|
|
575
|
+
if (lastPageNum !== this.currentPage) {
|
|
576
|
+
// 切换当前页码为最后一页
|
|
577
|
+
this.currentPage = lastPageNum
|
|
578
|
+
// 切换当前页码到最后一页的数据
|
|
579
|
+
this.changePage()
|
|
580
|
+
} else {
|
|
581
|
+
// 表示不需要切换页码
|
|
582
|
+
this.gridData = this.getSubTableGridData(this.subTableData)
|
|
583
|
+
gridParams.gridData = this.gridData // 完成深拷贝,复制一份对象,行编辑时使用
|
|
584
|
+
gridParams.orgGridData = [].concat(
|
|
585
|
+
JSON.parse(JSON.stringify(this.gridData))
|
|
586
|
+
)
|
|
587
|
+
}
|
|
588
|
+
if (gridParams.lineEdit.editingCell) {
|
|
589
|
+
gridParams.lineEdit.editingCell.row = this.gridData.length
|
|
590
|
+
}
|
|
591
|
+
// 使用完状态还原
|
|
592
|
+
gridParams.isChangePage = false
|
|
593
|
+
} else {
|
|
594
|
+
// 表示不是子表新建记录
|
|
595
|
+
this.gridData = this.getSubTableGridData(this.subTableData)
|
|
596
|
+
gridParams.gridData = this.gridData
|
|
597
|
+
// 完成深拷贝,复制一份对象,行编辑时使用
|
|
598
|
+
gridParams.orgGridData = [].concat(
|
|
599
|
+
JSON.parse(JSON.stringify(this.gridData))
|
|
600
|
+
)
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
},
|
|
604
|
+
},
|
|
605
|
+
currentSelectCell: {
|
|
606
|
+
deep: true,
|
|
607
|
+
handler: function (newVal, oldVal) {
|
|
608
|
+
this.$nextTick(() => {
|
|
609
|
+
if (newVal) {
|
|
610
|
+
// 手动触发新单元格的点击事件
|
|
611
|
+
newVal.click()
|
|
612
|
+
}
|
|
613
|
+
if (oldVal) {
|
|
614
|
+
// 清空上一个单元格的选中样式
|
|
615
|
+
oldVal.style.border = ''
|
|
616
|
+
}
|
|
617
|
+
})
|
|
618
|
+
},
|
|
619
|
+
},
|
|
620
|
+
'options.validateRules': {
|
|
621
|
+
deep: true,
|
|
622
|
+
handler: function () {
|
|
623
|
+
this.externalClickFlag = true
|
|
624
|
+
console.log(
|
|
625
|
+
'监听到数据改变================',
|
|
626
|
+
this.options.validateRules
|
|
627
|
+
)
|
|
628
|
+
const gridParams = store.get(this.code)
|
|
629
|
+
if (gridParams && gridParams.options) {
|
|
630
|
+
gridParams.options.validateRules = this.options.validateRules
|
|
631
|
+
store.set(this.code, gridParams)
|
|
632
|
+
}
|
|
633
|
+
// this.initSetting()
|
|
634
|
+
// this.initialize()
|
|
635
|
+
},
|
|
636
|
+
},
|
|
637
|
+
'options.subTableCanAdd': {
|
|
638
|
+
deep: true,
|
|
639
|
+
handler: function () {
|
|
640
|
+
const gridParams = store.get(this.code)
|
|
641
|
+
if (gridParams && gridParams.options) {
|
|
642
|
+
gridParams.options.subTableCanAdd = this.options.subTableCanAdd
|
|
643
|
+
store.set(this.code, gridParams)
|
|
644
|
+
}
|
|
645
|
+
},
|
|
646
|
+
},
|
|
647
|
+
// pageSize每页显示多少条,改变时抛出事件,配置出来的流程表单子表验证提示信息时使用,例如:“第x页第x条记录,xxx必填”,获得页数时需要使用
|
|
648
|
+
pageSize: {
|
|
649
|
+
deep: true,
|
|
650
|
+
|
|
651
|
+
handler(newValue, oldValue) {
|
|
652
|
+
$emit(this, 'change-rows-per-page', this.pageSize)
|
|
653
|
+
},
|
|
654
|
+
},
|
|
655
|
+
// 更新parent值
|
|
656
|
+
'options.extraParam.entityMap': {
|
|
657
|
+
deep: true,
|
|
658
|
+
handler(newValue, oldValue) {
|
|
659
|
+
console.log('watch====options.extraParam.entityMap===改变==', newValue)
|
|
660
|
+
this.parentFormData = newValue
|
|
661
|
+
this.$emit('change-form-data', this.parentFormData)
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
provide() {
|
|
666
|
+
return {}
|
|
667
|
+
},
|
|
668
|
+
created() {
|
|
669
|
+
store.set(this.code, getGridParams())
|
|
670
|
+
store.set('_list_code', this.code)
|
|
671
|
+
this.initSetting()
|
|
672
|
+
this.judgeIsFormSubTable()
|
|
673
|
+
let stripe = true
|
|
674
|
+
if (isHasOptionFunction('rowStyleRender', this.code)) {
|
|
675
|
+
// 当行需要自定义样式时,斑马线样式会影响效果,所以需要去掉斑马线配置
|
|
676
|
+
stripe = false
|
|
677
|
+
}
|
|
678
|
+
this.stripe = stripe
|
|
679
|
+
|
|
680
|
+
// if (this.parentProp) {
|
|
681
|
+
// // 表示配置了树形配置
|
|
682
|
+
// this.treeProps = this.getTreeProps()
|
|
683
|
+
// }
|
|
684
|
+
// this.showDemo()
|
|
685
|
+
},
|
|
686
|
+
mounted() {
|
|
687
|
+
this.initialize().then(() => {
|
|
688
|
+
const gridParams = store.get(this.code)
|
|
689
|
+
if (
|
|
690
|
+
gridParams &&
|
|
691
|
+
gridParams.basicInfo &&
|
|
692
|
+
gridParams.basicInfo.tableName
|
|
693
|
+
) {
|
|
694
|
+
this.tableName = gridParams.basicInfo.tableName
|
|
695
|
+
}
|
|
696
|
+
if (gridParams && gridParams.basicInfo && gridParams.basicInfo.name) {
|
|
697
|
+
this.listName = gridParams.basicInfo.name
|
|
698
|
+
}
|
|
699
|
+
this.$nextTick(() => {
|
|
700
|
+
// 将子表选项组值传递super-pages中,解决到处报告时子表选项组赋值问题
|
|
701
|
+
this.columns.forEach((column) => {
|
|
702
|
+
if (column.valueSet) {
|
|
703
|
+
$emit(this, 'set-select-options', {
|
|
704
|
+
prop: this.code + '.' + column.prop,
|
|
705
|
+
valueSet: column.valueSet,
|
|
706
|
+
})
|
|
707
|
+
}
|
|
708
|
+
})
|
|
709
|
+
this.rowDrop()
|
|
710
|
+
this.columnDrop()
|
|
711
|
+
store.get(this.code).superGrid = this.$refs.superGrid
|
|
712
|
+
if (this.query && this.query.showType === 'embedded') {
|
|
713
|
+
// 嵌入查询时,刚进台账要计算一次列表高度
|
|
714
|
+
this.resizeTableHeight()
|
|
715
|
+
} else {
|
|
716
|
+
this.$watch(
|
|
717
|
+
'showSearch',
|
|
718
|
+
function (newVal, oldVal) {
|
|
719
|
+
this.resizeTableHeight()
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
immediate: true,
|
|
723
|
+
deep: true,
|
|
724
|
+
}
|
|
725
|
+
)
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
this.$watch(
|
|
729
|
+
'hasLoadData',
|
|
730
|
+
function (newVal, oldVal) {
|
|
731
|
+
if (newVal === true) {
|
|
732
|
+
this.$nextTick(() => {
|
|
733
|
+
const gridParams = store.get(this.code)
|
|
734
|
+
if (isHasOptionFunction('gridComplete', this.code)) {
|
|
735
|
+
gridParams.options.gridComplete.call(this, {
|
|
736
|
+
gridData: this.isSubTableShowPage
|
|
737
|
+
? this.subTableData
|
|
738
|
+
: this.gridData,
|
|
739
|
+
columns: gridParams.columns,
|
|
740
|
+
superGrid: this.$refs.superGrid,
|
|
741
|
+
pageGridData: this.isSubTableShowPage
|
|
742
|
+
? this.gridData
|
|
743
|
+
: null,
|
|
744
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
745
|
+
})
|
|
746
|
+
}
|
|
747
|
+
})
|
|
748
|
+
}
|
|
749
|
+
},
|
|
750
|
+
{
|
|
751
|
+
immediate: true,
|
|
752
|
+
deep: true,
|
|
753
|
+
}
|
|
754
|
+
)
|
|
755
|
+
|
|
756
|
+
const that = this
|
|
757
|
+
const isShowUserTreeDialog =
|
|
758
|
+
document.querySelector('.user-tree') !== null
|
|
759
|
+
// 当前页面监视键盘输入
|
|
760
|
+
document.querySelector('.' + this.code).onkeydown = function (e) {
|
|
761
|
+
if (!that.isShowPageDialog && !isShowUserTreeDialog) {
|
|
762
|
+
// 当前列表页面没有弹框或选人弹框,才走键盘监视事件
|
|
763
|
+
// 事件对象兼容
|
|
764
|
+
// eslint-disable-next-line no-caller
|
|
765
|
+
const e1 =
|
|
766
|
+
e || event || window.event || arguments.callee.caller.arguments[0]
|
|
767
|
+
// 处于行编辑状态时,左右上下箭头事件不需要生效
|
|
768
|
+
const isEdit = that.isEditRow(that)
|
|
769
|
+
// 键盘按键判断:左箭头-37;上箭头-38;右箭头-39;下箭头-40
|
|
770
|
+
// 左
|
|
771
|
+
if (e1 && e1.keyCode === 37) {
|
|
772
|
+
// 左箭头
|
|
773
|
+
if (!isEdit) {
|
|
774
|
+
that.selectLeftCell(that)
|
|
775
|
+
}
|
|
776
|
+
} else if (e1 && e1.keyCode === 38) {
|
|
777
|
+
// 上箭头
|
|
778
|
+
if (!isEdit) {
|
|
779
|
+
that.selectUpCell(that)
|
|
780
|
+
}
|
|
781
|
+
} else if (e1 && e1.keyCode === 39) {
|
|
782
|
+
// 右箭头
|
|
783
|
+
if (!isEdit) {
|
|
784
|
+
that.selectRightCell(that)
|
|
785
|
+
}
|
|
786
|
+
} else if (e1 && e1.keyCode === 40) {
|
|
787
|
+
// 下箭头
|
|
788
|
+
if (!isEdit) {
|
|
789
|
+
that.selectDownCell(that)
|
|
790
|
+
}
|
|
791
|
+
} else if (e1 && e1.keyCode === 13) {
|
|
792
|
+
// 回车
|
|
793
|
+
if (that.isCallEnterEvent(that)) {
|
|
794
|
+
// 不是子表时,才需要回车事件,子表时不处理回车事件,扫码枪回车事件和平台的回车事件冲突了。子表时用户一般不会主动回车取消行编辑。
|
|
795
|
+
that.enterOperation(that)
|
|
796
|
+
}
|
|
797
|
+
} else if (e1 && e1.keyCode === 27) {
|
|
798
|
+
// ESC
|
|
799
|
+
that.escOperation(that)
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
})
|
|
804
|
+
if (this.query && this.query.showType === 'popup') {
|
|
805
|
+
$emit(this, 'setSearchType', true)
|
|
806
|
+
}
|
|
807
|
+
this.$watch(
|
|
808
|
+
'options.extraParam',
|
|
809
|
+
function (newValue, oldVal) {
|
|
810
|
+
this.options['extraParam'] = newValue
|
|
811
|
+
const gridParams = store.get(this.code)
|
|
812
|
+
gridParams.options.extraParam = newValue
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
deep: true,
|
|
816
|
+
}
|
|
817
|
+
)
|
|
818
|
+
})
|
|
819
|
+
},
|
|
820
|
+
methods: {
|
|
821
|
+
...events,
|
|
822
|
+
...publicMethods,
|
|
823
|
+
...superGridService,
|
|
824
|
+
...apis,
|
|
825
|
+
isDeleteChange(boole) {
|
|
826
|
+
this.isDelete = boole
|
|
827
|
+
},
|
|
828
|
+
// 是否触发回车事件
|
|
829
|
+
isCallEnterEvent(that) {
|
|
830
|
+
let canCall = true
|
|
831
|
+
if (
|
|
832
|
+
that.options.isEnableEnterEvent !== undefined &&
|
|
833
|
+
that.options.isEnableEnterEvent === false
|
|
834
|
+
) {
|
|
835
|
+
canCall = false
|
|
836
|
+
}
|
|
837
|
+
console.log(
|
|
838
|
+
'super-grid-----isEnableEnterEvent=',
|
|
839
|
+
that.options.isEnableEnterEvent,
|
|
840
|
+
'canCall=',
|
|
841
|
+
canCall
|
|
842
|
+
)
|
|
843
|
+
const gridParams = store.get(that.code)
|
|
844
|
+
if (canCall && gridParams.options && gridParams.options.isFormSubTable) {
|
|
845
|
+
canCall = false
|
|
846
|
+
}
|
|
847
|
+
return canCall
|
|
848
|
+
},
|
|
849
|
+
isShowPageArea() {
|
|
850
|
+
if (this.isFormSubTable) {
|
|
851
|
+
return (
|
|
852
|
+
this.options.showPageArea !== undefined &&
|
|
853
|
+
this.options.showPageArea === true
|
|
854
|
+
)
|
|
855
|
+
} else {
|
|
856
|
+
return true
|
|
857
|
+
}
|
|
858
|
+
},
|
|
859
|
+
resizeTableHeight() {
|
|
860
|
+
this.$nextTick(() => {
|
|
861
|
+
let tableHeight = getTableHeight(
|
|
862
|
+
this.$refs.superGrid,
|
|
863
|
+
this.code,
|
|
864
|
+
this.pageHeight
|
|
865
|
+
)
|
|
866
|
+
const gridParams = store.get(this.code)
|
|
867
|
+
if (isHasOptionFunction('resizeHeight', this.code)) {
|
|
868
|
+
let searchHeight = 0
|
|
869
|
+
if (this.$refs.sf) {
|
|
870
|
+
// 获得查询区高度
|
|
871
|
+
searchHeight = this.$refs.sf.$el.offsetHeight
|
|
872
|
+
}
|
|
873
|
+
const newHeight = gridParams.options.resizeHeight.call(this, {
|
|
874
|
+
code: this.code,
|
|
875
|
+
height: tableHeight,
|
|
876
|
+
searchHeight: searchHeight,
|
|
877
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
878
|
+
})
|
|
879
|
+
if (newHeight) {
|
|
880
|
+
tableHeight = newHeight
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
let tempHeight = tableHeight
|
|
884
|
+
if (this.optionTableHeight) {
|
|
885
|
+
tempHeight = this.optionTableHeight
|
|
886
|
+
} else if (
|
|
887
|
+
gridParams.options &&
|
|
888
|
+
gridParams.options.isFormSubTable &&
|
|
889
|
+
gridParams.options.isPdfEditor
|
|
890
|
+
) {
|
|
891
|
+
tempHeight = null
|
|
892
|
+
} else if (
|
|
893
|
+
gridParams.options &&
|
|
894
|
+
gridParams.options.isFormSubTable &&
|
|
895
|
+
gridParams.options.formSetHeight
|
|
896
|
+
) {
|
|
897
|
+
tempHeight = gridParams.options.formSetHeight
|
|
898
|
+
} else if (
|
|
899
|
+
!this.basicInfo.displayEffect ||
|
|
900
|
+
this.basicInfo.displayEffect === '' ||
|
|
901
|
+
this.basicInfo.displayEffect === 'default'
|
|
902
|
+
) {
|
|
903
|
+
tempHeight = null
|
|
904
|
+
}
|
|
905
|
+
this.tableHeight = tempHeight
|
|
906
|
+
let tempMaxHeight = tableHeight
|
|
907
|
+
tempMaxHeight = tableHeight
|
|
908
|
+
if (
|
|
909
|
+
gridParams.options &&
|
|
910
|
+
gridParams.options.isFormSubTable &&
|
|
911
|
+
gridParams.options.isPdfEditor
|
|
912
|
+
) {
|
|
913
|
+
tempMaxHeight = null
|
|
914
|
+
} else if (
|
|
915
|
+
gridParams.options &&
|
|
916
|
+
gridParams.options.isFormSubTable &&
|
|
917
|
+
gridParams.options.formSetMaxHeight
|
|
918
|
+
) {
|
|
919
|
+
tempMaxHeight = gridParams.options.formSetMaxHeight
|
|
920
|
+
}
|
|
921
|
+
if(tempHeight === undefined || tempHeight === null){
|
|
922
|
+
// el-table的height和maxHeight不能同时设值,会导致列表渲染失败,报脚本错
|
|
923
|
+
this.maxHeight = tempMaxHeight
|
|
924
|
+
}
|
|
925
|
+
})
|
|
926
|
+
},
|
|
927
|
+
// 回车键
|
|
928
|
+
enterOperation(that) {
|
|
929
|
+
const gridParams = store.get(that.code)
|
|
930
|
+
if (gridParams.options && gridParams.options.isFormSubTable) {
|
|
931
|
+
// 如果是子表,只是取消行编辑状态
|
|
932
|
+
const editRow = gridParams.$editRow
|
|
933
|
+
if (editRow) {
|
|
934
|
+
setEntityFieldValue(editRow, '$editing', false)
|
|
935
|
+
gridParams.$editRow = null
|
|
936
|
+
}
|
|
937
|
+
} else {
|
|
938
|
+
// 不是子表
|
|
939
|
+
if (gridParams.options && !gridParams.options.isFormSubTable) {
|
|
940
|
+
const currentSelectCell = that.currentSelectCell
|
|
941
|
+
if (currentSelectCell) {
|
|
942
|
+
const textAreaCell = currentSelectCell.querySelector('.el-textarea')
|
|
943
|
+
if (textAreaCell) {
|
|
944
|
+
return
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
// 表示不是表单子表时,才需要回车保存
|
|
948
|
+
const rowIndex = gridParams.$rowIndex
|
|
949
|
+
if (rowIndex !== undefined && rowIndex !== null) {
|
|
950
|
+
const row = gridParams.gridData[rowIndex]
|
|
951
|
+
if (isEditOptionFunction('enter', that.listCode)) {
|
|
952
|
+
gridParams.options.lineEditOptions.enter.call(
|
|
953
|
+
that,
|
|
954
|
+
rowIndex,
|
|
955
|
+
that.column,
|
|
956
|
+
row,
|
|
957
|
+
gridParams.orgGridData[rowIndex],
|
|
958
|
+
gridParams.additionalParamMap
|
|
959
|
+
)
|
|
960
|
+
} else {
|
|
961
|
+
that.saveRow(rowIndex, that.code)
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
},
|
|
967
|
+
// ESC键取消行编辑
|
|
968
|
+
escOperation(that) {
|
|
969
|
+
const gridParams = store.get(that.code)
|
|
970
|
+
if (gridParams.options && !gridParams.options.isFormSubTable) {
|
|
971
|
+
// 表示不是表单子表时,才需要处理ESC取消操作
|
|
972
|
+
const rowIndex = gridParams.$rowIndex
|
|
973
|
+
if (rowIndex !== undefined && rowIndex !== null) {
|
|
974
|
+
that.restoreRow(rowIndex, that.code)
|
|
975
|
+
const row = gridParams.gridData[rowIndex]
|
|
976
|
+
if (isEditOptionFunction('esc', that.listCode)) {
|
|
977
|
+
gridParams.options.lineEditOptions.esc.call(
|
|
978
|
+
that,
|
|
979
|
+
rowIndex,
|
|
980
|
+
that.column,
|
|
981
|
+
row,
|
|
982
|
+
gridParams.orgGridData[rowIndex],
|
|
983
|
+
gridParams.additionalParamMap
|
|
984
|
+
)
|
|
985
|
+
} else {
|
|
986
|
+
that.restoreRow(rowIndex, that.code)
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
},
|
|
991
|
+
// 是否正在编辑行,如果正在编辑左右上下箭头事件不需要生效
|
|
992
|
+
isEditRow(that) {
|
|
993
|
+
const currentSelectCell = that.currentSelectCell
|
|
994
|
+
if (currentSelectCell) {
|
|
995
|
+
const inputInner = currentSelectCell.querySelector('.el-input__inner')
|
|
996
|
+
if (inputInner) {
|
|
997
|
+
return true
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
return false
|
|
1001
|
+
},
|
|
1002
|
+
// 选中上方单元格
|
|
1003
|
+
selectUpCell(that) {
|
|
1004
|
+
const currentSelectCell = that.currentSelectCell
|
|
1005
|
+
if (currentSelectCell) {
|
|
1006
|
+
const trDom = currentSelectCell.parentNode
|
|
1007
|
+
if (trDom) {
|
|
1008
|
+
let tdClass = null
|
|
1009
|
+
let classes = null
|
|
1010
|
+
const classObj = currentSelectCell.attributes['class']
|
|
1011
|
+
if (classObj) {
|
|
1012
|
+
classes = classObj['nodeValue']
|
|
1013
|
+
}
|
|
1014
|
+
if (classes && classes.indexOf(' ') > 0) {
|
|
1015
|
+
const classArr = classes.split(' ')
|
|
1016
|
+
tdClass = classArr[0]
|
|
1017
|
+
}
|
|
1018
|
+
const preTr = trDom['previousSibling']
|
|
1019
|
+
if (preTr) {
|
|
1020
|
+
const targetCell = preTr.querySelector('.' + tdClass)
|
|
1021
|
+
that.currentSelectCell = targetCell
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
},
|
|
1026
|
+
// 选中下方单元格
|
|
1027
|
+
selectDownCell(that) {
|
|
1028
|
+
const currentSelectCell = that.currentSelectCell
|
|
1029
|
+
if (currentSelectCell) {
|
|
1030
|
+
const trDom = currentSelectCell.parentNode
|
|
1031
|
+
if (trDom) {
|
|
1032
|
+
let tdClass = null
|
|
1033
|
+
let classes = null
|
|
1034
|
+
const classObj = currentSelectCell.attributes['class']
|
|
1035
|
+
if (classObj) {
|
|
1036
|
+
classes = classObj['nodeValue']
|
|
1037
|
+
}
|
|
1038
|
+
if (classes && classes.indexOf(' ') > 0) {
|
|
1039
|
+
const classArr = classes.split(' ')
|
|
1040
|
+
tdClass = classArr[0]
|
|
1041
|
+
}
|
|
1042
|
+
const preTr = trDom['nextSibling']
|
|
1043
|
+
if (preTr) {
|
|
1044
|
+
const targetCell = preTr.querySelector('.' + tdClass)
|
|
1045
|
+
that.currentSelectCell = targetCell
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
},
|
|
1050
|
+
// 选中右侧单元格
|
|
1051
|
+
selectRightCell(that) {
|
|
1052
|
+
if (that.currentSelectCell) {
|
|
1053
|
+
const nextCell = that.currentSelectCell['nextSibling']
|
|
1054
|
+
if (nextCell) {
|
|
1055
|
+
let classes
|
|
1056
|
+
const classObj = nextCell.attributes['class']
|
|
1057
|
+
if (classObj) {
|
|
1058
|
+
classes = classObj['nodeValue']
|
|
1059
|
+
}
|
|
1060
|
+
if (classes && classes.indexOf(' is-hidden') > 0) {
|
|
1061
|
+
// 表示需要处理冻结列情况
|
|
1062
|
+
that.getTargetCellWithFixTable(that, classes, nextCell)
|
|
1063
|
+
} else {
|
|
1064
|
+
that.currentSelectCell = nextCell
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
},
|
|
1069
|
+
// 选中左侧单元格
|
|
1070
|
+
selectLeftCell(that) {
|
|
1071
|
+
if (that.currentSelectCell) {
|
|
1072
|
+
const preCell = that.currentSelectCell['previousSibling']
|
|
1073
|
+
if (preCell) {
|
|
1074
|
+
let classes
|
|
1075
|
+
const classObj = preCell.attributes['class']
|
|
1076
|
+
if (classObj) {
|
|
1077
|
+
classes = classObj['nodeValue']
|
|
1078
|
+
}
|
|
1079
|
+
if (classes && classes.indexOf(' is-hidden') > 0) {
|
|
1080
|
+
// 表示需要处理冻结列情况
|
|
1081
|
+
that.getTargetCellWithFixTable(that, classes, preCell)
|
|
1082
|
+
} else {
|
|
1083
|
+
that.currentSelectCell = preCell
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
},
|
|
1088
|
+
// 左右箭头时,有冻结列时,获得目的单元格
|
|
1089
|
+
getTargetCellWithFixTable(that, classes, currentCell) {
|
|
1090
|
+
const tr = currentCell.parentNode
|
|
1091
|
+
if (tr) {
|
|
1092
|
+
const tbody = tr.parentNode
|
|
1093
|
+
if (tbody) {
|
|
1094
|
+
const table = tbody.parentNode
|
|
1095
|
+
if (table) {
|
|
1096
|
+
const tableDiv = table.parentNode
|
|
1097
|
+
if (tableDiv) {
|
|
1098
|
+
const classObj = tableDiv.attributes['class']
|
|
1099
|
+
if (classObj) {
|
|
1100
|
+
const tableDivClasses = classObj['nodeValue']
|
|
1101
|
+
if (
|
|
1102
|
+
tableDivClasses &&
|
|
1103
|
+
tableDivClasses.indexOf('el-table__fixed-body-wrapper') >= 0
|
|
1104
|
+
) {
|
|
1105
|
+
// 表示当前单元格是冻结列中的,需要在非冻结列中获得该单元格
|
|
1106
|
+
let tdClass = null
|
|
1107
|
+
if (classes && classes.indexOf(' ') > 0) {
|
|
1108
|
+
const classArr = classes.split(' ')
|
|
1109
|
+
tdClass = classArr[0]
|
|
1110
|
+
}
|
|
1111
|
+
if (tdClass) {
|
|
1112
|
+
const targetCell = document.querySelector(
|
|
1113
|
+
'.' +
|
|
1114
|
+
this.code +
|
|
1115
|
+
' .el-table__body-wrapper .current-row .' +
|
|
1116
|
+
tdClass
|
|
1117
|
+
)
|
|
1118
|
+
that.currentSelectCell = targetCell
|
|
1119
|
+
}
|
|
1120
|
+
} else if (
|
|
1121
|
+
tableDivClasses &&
|
|
1122
|
+
tableDivClasses.indexOf('el-table__body-wrapper') >= 0
|
|
1123
|
+
) {
|
|
1124
|
+
// 表示当前单元格是非冻结列中的,需要在冻结列中获得该单元格
|
|
1125
|
+
let tdClass = null
|
|
1126
|
+
if (classes && classes.indexOf(' ') > 0) {
|
|
1127
|
+
const classArr = classes.split(' ')
|
|
1128
|
+
tdClass = classArr[0]
|
|
1129
|
+
}
|
|
1130
|
+
if (tdClass) {
|
|
1131
|
+
const targetCell = document.querySelector(
|
|
1132
|
+
'.' +
|
|
1133
|
+
this.code +
|
|
1134
|
+
' .el-table__fixed-body-wrapper .current-row .' +
|
|
1135
|
+
tdClass
|
|
1136
|
+
)
|
|
1137
|
+
that.currentSelectCell = targetCell
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
},
|
|
1146
|
+
// 存储有默认值的字段集合
|
|
1147
|
+
storeHasDefaultValueColumns(column, gridParams) {
|
|
1148
|
+
if (
|
|
1149
|
+
column.defaultValue !== undefined &&
|
|
1150
|
+
column.defaultValue !== null &&
|
|
1151
|
+
column.defaultValue !== ''
|
|
1152
|
+
) {
|
|
1153
|
+
if (
|
|
1154
|
+
gridParams.defaultValueColumns === undefined ||
|
|
1155
|
+
gridParams.defaultValueColumns === null
|
|
1156
|
+
) {
|
|
1157
|
+
gridParams.defaultValueColumns = []
|
|
1158
|
+
}
|
|
1159
|
+
gridParams.defaultValueColumns.push(column)
|
|
1160
|
+
}
|
|
1161
|
+
},
|
|
1162
|
+
// 判断是不是表单子表的使用
|
|
1163
|
+
judgeIsFormSubTable() {
|
|
1164
|
+
// 没有分页
|
|
1165
|
+
// 没有排序
|
|
1166
|
+
const gridParams = store.get(this.code)
|
|
1167
|
+
if (
|
|
1168
|
+
gridParams &&
|
|
1169
|
+
gridParams.options &&
|
|
1170
|
+
gridParams.options.isFormSubTable !== undefined &&
|
|
1171
|
+
gridParams.options.isFormSubTable === true
|
|
1172
|
+
) {
|
|
1173
|
+
this.isFormSubTable = true
|
|
1174
|
+
}
|
|
1175
|
+
},
|
|
1176
|
+
/**
|
|
1177
|
+
* 给列设置操作信息
|
|
1178
|
+
* @param operationSetting 操作列设置,{prop:[{按钮组件},{按钮组件},{link组件}],prop:[{},{}]}
|
|
1179
|
+
*/
|
|
1180
|
+
initColumnOperation(column, operationSetting) {
|
|
1181
|
+
if (operationSetting && operationSetting[column.prop]) {
|
|
1182
|
+
const prop = column.prop
|
|
1183
|
+
column.operations = operationSetting[prop]
|
|
1184
|
+
}
|
|
1185
|
+
},
|
|
1186
|
+
// 获得属性列操作信息
|
|
1187
|
+
getOptionOperations() {
|
|
1188
|
+
if (
|
|
1189
|
+
typeof this.options['operations'] !== 'undefined' &&
|
|
1190
|
+
this.options['operations'] !== null
|
|
1191
|
+
) {
|
|
1192
|
+
return this.options['operations']
|
|
1193
|
+
}
|
|
1194
|
+
},
|
|
1195
|
+
initSetting() {
|
|
1196
|
+
const gridParams = store.get(this.code)
|
|
1197
|
+
if (typeof this.options !== 'undefined') {
|
|
1198
|
+
Object.assign(gridParams.options, this.options)
|
|
1199
|
+
if (!gridParams.options.lineEditOptions) {
|
|
1200
|
+
gridParams.options.lineEditOptions = gridParams.defaultLineEditOptions
|
|
1201
|
+
}
|
|
1202
|
+
if (
|
|
1203
|
+
typeof this.options['customFormatter'] !== 'undefined' &&
|
|
1204
|
+
this.options['customFormatter'] !== null
|
|
1205
|
+
) {
|
|
1206
|
+
this.myCustomFormatter = this.options['customFormatter']
|
|
1207
|
+
}
|
|
1208
|
+
} else {
|
|
1209
|
+
gridParams.options = {}
|
|
1210
|
+
gridParams.options.lineEditOptions = gridParams.defaultLineEditOptions
|
|
1211
|
+
}
|
|
1212
|
+
if (!isHasEditOption('input', this.code)) {
|
|
1213
|
+
gridParams.options.lineEditOptions.input =
|
|
1214
|
+
gridParams.defaultLineEditOptions.input
|
|
1215
|
+
}
|
|
1216
|
+
if (
|
|
1217
|
+
!this.myCustomFormatter &&
|
|
1218
|
+
typeof this.customFormatter !== 'undefined' &&
|
|
1219
|
+
this.customFormatter !== null
|
|
1220
|
+
) {
|
|
1221
|
+
this.myCustomFormatter = this.customFormatter
|
|
1222
|
+
}
|
|
1223
|
+
if (
|
|
1224
|
+
this.options &&
|
|
1225
|
+
this.options.dynamicServiceName &&
|
|
1226
|
+
this.options.dynamicServiceName !== undefined
|
|
1227
|
+
) {
|
|
1228
|
+
this.dynamicServiceName = this.options.dynamicServiceName
|
|
1229
|
+
gridParams.dynamicServiceName = this.dynamicServiceName
|
|
1230
|
+
}
|
|
1231
|
+
if (
|
|
1232
|
+
this.options &&
|
|
1233
|
+
this.options.system &&
|
|
1234
|
+
this.options.system !== undefined
|
|
1235
|
+
) {
|
|
1236
|
+
gridParams.system = this.options.system
|
|
1237
|
+
}
|
|
1238
|
+
if (
|
|
1239
|
+
this.options &&
|
|
1240
|
+
this.options.additionalParamMap &&
|
|
1241
|
+
this.options.additionalParamMap !== undefined
|
|
1242
|
+
) {
|
|
1243
|
+
gridParams.additionalParamMap = this.options.additionalParamMap
|
|
1244
|
+
}
|
|
1245
|
+
},
|
|
1246
|
+
changeRowStyle(param) {
|
|
1247
|
+
// param的格式:{row, rowIndex}
|
|
1248
|
+
const gridParams = store.get(this.code)
|
|
1249
|
+
if (this.lineEdit && this.lineEdit.editable) {
|
|
1250
|
+
if (param.rowIndex === gridParams.$rowIndex) {
|
|
1251
|
+
if (
|
|
1252
|
+
!isObjectValueEqual(
|
|
1253
|
+
param.row,
|
|
1254
|
+
gridParams.orgGridData[gridParams.$rowIndex]
|
|
1255
|
+
)
|
|
1256
|
+
) {
|
|
1257
|
+
// return { 'background': 'rgb(245, 181, 203)' }
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
if (isHasOptionFunction('rowStyleRender', this.code)) {
|
|
1262
|
+
param.additionalParamMap = gridParams.additionalParamMap
|
|
1263
|
+
return gridParams.options.rowStyleRender.call(this, param)
|
|
1264
|
+
}
|
|
1265
|
+
if (
|
|
1266
|
+
this.options &&
|
|
1267
|
+
this.options.renderRow &&
|
|
1268
|
+
this.options.renderRow.hasOwnProperty(param.rowIndex)
|
|
1269
|
+
) {
|
|
1270
|
+
return { background: this.options.renderRow[param.rowIndex] }
|
|
1271
|
+
}
|
|
1272
|
+
},
|
|
1273
|
+
changeCellStyle(param) {
|
|
1274
|
+
const gridParams = store.get(this.code)
|
|
1275
|
+
let funName = null
|
|
1276
|
+
let columnOptions = null
|
|
1277
|
+
if (param && param.column && param.column.property) {
|
|
1278
|
+
if (gridParams && gridParams.columnOptionMap) {
|
|
1279
|
+
if (gridParams.columnOptionMap[param.column.property]) {
|
|
1280
|
+
columnOptions = gridParams.columnOptionMap[param.column.property]
|
|
1281
|
+
if (columnOptions.events && columnOptions.events.cellStyle) {
|
|
1282
|
+
funName = columnOptions.events.cellStyle
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
// {row, column, rowIndex, columnIndex}
|
|
1288
|
+
// 获取对应单元格配置
|
|
1289
|
+
if (isHasOptionFunction('cellStyleRender', this.code)) {
|
|
1290
|
+
param.additionalParamMap = gridParams.additionalParamMap
|
|
1291
|
+
return gridParams.options.cellStyleRender.call(this, param)
|
|
1292
|
+
} else if (
|
|
1293
|
+
funName !== null &&
|
|
1294
|
+
columnOptions !== null &&
|
|
1295
|
+
gridParams.options &&
|
|
1296
|
+
gridParams.options['eventCallBack'] &&
|
|
1297
|
+
gridParams.options['eventCallBack'][funName] &&
|
|
1298
|
+
typeof gridParams.options['eventCallBack'][funName] === 'function'
|
|
1299
|
+
) {
|
|
1300
|
+
const params = {
|
|
1301
|
+
value: param.row[param.column.property],
|
|
1302
|
+
row: param.row,
|
|
1303
|
+
column: columnOptions,
|
|
1304
|
+
prop: param.column.property,
|
|
1305
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
1306
|
+
rowIndex: param.rowIndex
|
|
1307
|
+
}
|
|
1308
|
+
return gridParams.options['eventCallBack'][funName].call(this, params)
|
|
1309
|
+
}
|
|
1310
|
+
},
|
|
1311
|
+
changeHeaderStyle(param) {
|
|
1312
|
+
// param的格式:{row, column, rowIndex, columnIndex}
|
|
1313
|
+
// 区分是编辑模式还是应用模式
|
|
1314
|
+
if (
|
|
1315
|
+
typeof this.options.isAdministerListView !== 'undefined' &&
|
|
1316
|
+
this.options.isAdministerListView != null &&
|
|
1317
|
+
this.options.isAdministerListView === true
|
|
1318
|
+
) {
|
|
1319
|
+
// 编辑模式
|
|
1320
|
+
const column = param.column
|
|
1321
|
+
if (column.type === 'selection') {
|
|
1322
|
+
if (this.backgroundColorMap['$selection']) {
|
|
1323
|
+
return { background: this.backgroundColorMap['$selection'] }
|
|
1324
|
+
}
|
|
1325
|
+
} else if (
|
|
1326
|
+
column.type &&
|
|
1327
|
+
column.type === 'default' &&
|
|
1328
|
+
!column.property
|
|
1329
|
+
) {
|
|
1330
|
+
if (this.backgroundColorMap['$index']) {
|
|
1331
|
+
return { background: this.backgroundColorMap['$index'] }
|
|
1332
|
+
}
|
|
1333
|
+
} else {
|
|
1334
|
+
if (column.property && this.backgroundColorMap[column.property]) {
|
|
1335
|
+
return { background: this.backgroundColorMap[column.property] }
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
} else {
|
|
1339
|
+
const gridParams = store.get(this.code)
|
|
1340
|
+
let funName = null
|
|
1341
|
+
let columnOptions = null
|
|
1342
|
+
if (param && param.column && param.column.property) {
|
|
1343
|
+
if (gridParams && gridParams.columnOptionMap) {
|
|
1344
|
+
if (gridParams.columnOptionMap[param.column.property]) {
|
|
1345
|
+
columnOptions = gridParams.columnOptionMap[param.column.property]
|
|
1346
|
+
if (
|
|
1347
|
+
columnOptions.events &&
|
|
1348
|
+
columnOptions.events.headerCellStyle
|
|
1349
|
+
) {
|
|
1350
|
+
funName = columnOptions.events.headerCellStyle
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
// 应用模式
|
|
1356
|
+
// 修改表头样式,当某些字段需要编辑时,某些字段不需要编辑时,为了突出显示有权限编辑的字段,可以使用该功能
|
|
1357
|
+
if (
|
|
1358
|
+
gridParams.options.renderHeader &&
|
|
1359
|
+
gridParams.options.renderHeader.props
|
|
1360
|
+
) {
|
|
1361
|
+
const column = param.column
|
|
1362
|
+
const props = gridParams.options.renderHeader.props
|
|
1363
|
+
const propsArr = props.split(',')
|
|
1364
|
+
for (let i = 0; i < propsArr.length; i++) {
|
|
1365
|
+
const prop = propsArr[i]
|
|
1366
|
+
if (column.property === prop.trim()) {
|
|
1367
|
+
let backgroundColor = '#c3f4e2'
|
|
1368
|
+
if (
|
|
1369
|
+
typeof gridParams.options.renderHeader.color !== 'undefined'
|
|
1370
|
+
) {
|
|
1371
|
+
backgroundColor = gridParams.options.renderHeader.color
|
|
1372
|
+
}
|
|
1373
|
+
return { background: backgroundColor }
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
} else if (
|
|
1377
|
+
funName !== null &&
|
|
1378
|
+
columnOptions !== null &&
|
|
1379
|
+
gridParams.options &&
|
|
1380
|
+
gridParams.options['eventCallBack'] &&
|
|
1381
|
+
gridParams.options['eventCallBack'][funName] &&
|
|
1382
|
+
typeof gridParams.options['eventCallBack'][funName] === 'function'
|
|
1383
|
+
) {
|
|
1384
|
+
// const param = { value: param.row[param.column.property], row: param.row, column: columnOptions, prop: param.column.property }
|
|
1385
|
+
param.additionalParamMap = gridParams.additionalParamMap
|
|
1386
|
+
return gridParams.options['eventCallBack'][funName].call(this, param)
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
},
|
|
1390
|
+
fetchData(searchParam, isSearch, parentRowIds, resove) {
|
|
1391
|
+
const gridParams = store.get(this.code)
|
|
1392
|
+
// 查询数据需要区分,如果时列表管理编辑模式,使用静态数据
|
|
1393
|
+
if (gridParams.options && gridParams.options.isPageInfo) {
|
|
1394
|
+
// 预览模式且从表单子表进入
|
|
1395
|
+
} else {
|
|
1396
|
+
if (gridParams.options && gridParams.options.isAdministerListView) {
|
|
1397
|
+
// 根据类型生成静态数据
|
|
1398
|
+
if (
|
|
1399
|
+
gridParams.options.SuperGrid &&
|
|
1400
|
+
gridParams.options.SuperGrid.simulationDate
|
|
1401
|
+
) {
|
|
1402
|
+
if (isHasOptionFunction('gridDataLoaded', this.code)) {
|
|
1403
|
+
const gridData = gridParams.options.gridDataLoaded.call(this, {
|
|
1404
|
+
gridData: gridParams.options.SuperGrid.simulationDate,
|
|
1405
|
+
columns: gridParams.columns,
|
|
1406
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
1407
|
+
})
|
|
1408
|
+
if (gridData) {
|
|
1409
|
+
this.gridData = gridData
|
|
1410
|
+
} else {
|
|
1411
|
+
this.gridData = gridParams.options.SuperGrid.simulationDate
|
|
1412
|
+
}
|
|
1413
|
+
} else {
|
|
1414
|
+
this.gridData = gridParams.options.SuperGrid.simulationDate
|
|
1415
|
+
}
|
|
1416
|
+
gridParams.gridData = this.gridData
|
|
1417
|
+
}
|
|
1418
|
+
} else if (
|
|
1419
|
+
gridParams.options &&
|
|
1420
|
+
gridParams.options.isFormSubTable &&
|
|
1421
|
+
gridParams.options.subTableData &&
|
|
1422
|
+
gridParams.options.subTableData.length > 0
|
|
1423
|
+
) {
|
|
1424
|
+
this.packageSubTableData(gridParams, gridParams.options.subTableData)
|
|
1425
|
+
} else {
|
|
1426
|
+
const isCanRefreshTableData = this.canRefreshTableData(gridParams)
|
|
1427
|
+
if (isCanRefreshTableData) {
|
|
1428
|
+
// 可以刷新表格记录
|
|
1429
|
+
return this.fetchListData(
|
|
1430
|
+
searchParam,
|
|
1431
|
+
isSearch,
|
|
1432
|
+
parentRowIds,
|
|
1433
|
+
resove
|
|
1434
|
+
)
|
|
1435
|
+
} else {
|
|
1436
|
+
// 子表无记录时不需要刷新子表记录。表示是新建或修改时子表无记录,且不需要刷新子表。
|
|
1437
|
+
if (this.isSubTableEmpty(gridParams)) {
|
|
1438
|
+
// 表示是新建表单时,子表记录集合是空数组
|
|
1439
|
+
console.log('子表无记录----code=', this.code, gridParams)
|
|
1440
|
+
const subTableData = []
|
|
1441
|
+
this.packageSubTableData(gridParams, subTableData)
|
|
1442
|
+
}
|
|
1443
|
+
this.hasLoadData = true
|
|
1444
|
+
gridParams.loaded = true
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
},
|
|
1449
|
+
isSubTableEmpty(gridParams) {
|
|
1450
|
+
return (
|
|
1451
|
+
gridParams.options &&
|
|
1452
|
+
gridParams.options.isFormSubTable &&
|
|
1453
|
+
(gridParams.options.subTableData === undefined ||
|
|
1454
|
+
gridParams.options.subTableData === null ||
|
|
1455
|
+
gridParams.options.subTableData.length === 0)
|
|
1456
|
+
)
|
|
1457
|
+
},
|
|
1458
|
+
packageSubTableData(gridParams, initSubTableData) {
|
|
1459
|
+
this.hasLoadData = false
|
|
1460
|
+
gridParams.loaded = true
|
|
1461
|
+
let subTableData = []
|
|
1462
|
+
// 如果有子表数据,则展示传递的子表数据
|
|
1463
|
+
if (isHasOptionFunction('gridDataLoaded', this.code)) {
|
|
1464
|
+
const gridData = gridParams.options.gridDataLoaded.call(this, {
|
|
1465
|
+
gridData: initSubTableData,
|
|
1466
|
+
columns: gridParams.columns,
|
|
1467
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
1468
|
+
})
|
|
1469
|
+
if (gridData) {
|
|
1470
|
+
subTableData = gridData
|
|
1471
|
+
this.hasLoadData = true
|
|
1472
|
+
} else {
|
|
1473
|
+
subTableData = initSubTableData
|
|
1474
|
+
this.hasLoadData = true
|
|
1475
|
+
}
|
|
1476
|
+
} else {
|
|
1477
|
+
subTableData = initSubTableData
|
|
1478
|
+
this.hasLoadData = true
|
|
1479
|
+
}
|
|
1480
|
+
if (subTableData) {
|
|
1481
|
+
// 子表时所有记录的所有字段设置默认值null,优化子表编辑时性能
|
|
1482
|
+
subTableData.forEach((item) => {
|
|
1483
|
+
this.setColumnsDefaultValue(gridParams.allColumns, item)
|
|
1484
|
+
})
|
|
1485
|
+
}
|
|
1486
|
+
if (this.pagination && this.isSubTableShowPage === true) {
|
|
1487
|
+
// 表示子表需要显示分页
|
|
1488
|
+
this.subTableData = subTableData
|
|
1489
|
+
// 更新记录总条数
|
|
1490
|
+
this.pagination.total = this.subTableData.length
|
|
1491
|
+
gridParams.subTableData = this.subTableData
|
|
1492
|
+
this.gridData = this.getSubTableGridData(this.subTableData)
|
|
1493
|
+
} else {
|
|
1494
|
+
this.gridData = subTableData
|
|
1495
|
+
}
|
|
1496
|
+
gridParams.gridData = this.gridData
|
|
1497
|
+
// 完成深拷贝,复制一份对象,行编辑时使用
|
|
1498
|
+
gridParams.orgGridData = [].concat(
|
|
1499
|
+
JSON.parse(JSON.stringify(this.gridData))
|
|
1500
|
+
)
|
|
1501
|
+
},
|
|
1502
|
+
canRefreshTableData(gridParams) {
|
|
1503
|
+
let isCanRefreshTableData = false
|
|
1504
|
+
if (gridParams.options && !gridParams.options.isFormSubTable) {
|
|
1505
|
+
// 如果不是子表时
|
|
1506
|
+
isCanRefreshTableData = true
|
|
1507
|
+
} else if (
|
|
1508
|
+
gridParams.options &&
|
|
1509
|
+
gridParams.options.isFormSubTable &&
|
|
1510
|
+
gridParams.options.canRrefreshSubtableData !== undefined &&
|
|
1511
|
+
gridParams.options.canRrefreshSubtableData === true
|
|
1512
|
+
) {
|
|
1513
|
+
// 是子表,且配置了子表无记录时更新子表记录集合
|
|
1514
|
+
isCanRefreshTableData = true
|
|
1515
|
+
}
|
|
1516
|
+
return isCanRefreshTableData
|
|
1517
|
+
},
|
|
1518
|
+
getSubTableGridData(subTableData) {
|
|
1519
|
+
let gridData = subTableData
|
|
1520
|
+
if (this.isSubTableShowPage === true) {
|
|
1521
|
+
if (subTableData && subTableData.length > 0) {
|
|
1522
|
+
// const subTableData = JSON.parse(JSON.stringify(this.subTableData))
|
|
1523
|
+
this.pagination.total = subTableData.length
|
|
1524
|
+
// 当前是第几页
|
|
1525
|
+
let currentPage = this.currentPage
|
|
1526
|
+
if (currentPage === undefined || currentPage === null) {
|
|
1527
|
+
currentPage = 1
|
|
1528
|
+
}
|
|
1529
|
+
// 每页显示多少条记录
|
|
1530
|
+
let pageSize = this.pageSize
|
|
1531
|
+
if (pageSize === null && this.pagination) {
|
|
1532
|
+
pageSize = this.pagination.pageSize
|
|
1533
|
+
}
|
|
1534
|
+
if (pageSize === undefined || pageSize === null) {
|
|
1535
|
+
pageSize = 20
|
|
1536
|
+
}
|
|
1537
|
+
// 当前页的第一条记录的数组下标
|
|
1538
|
+
const startRowIndex = (currentPage - 1) * pageSize
|
|
1539
|
+
// 当前页的最后一条记录的数组下标
|
|
1540
|
+
let lastRowIndex = startRowIndex + pageSize
|
|
1541
|
+
if (subTableData.length > startRowIndex) {
|
|
1542
|
+
// 表示当前页有记录
|
|
1543
|
+
if (lastRowIndex > subTableData.length) {
|
|
1544
|
+
// 表示最后一条记录超过下标了
|
|
1545
|
+
lastRowIndex = subTableData.length
|
|
1546
|
+
}
|
|
1547
|
+
// 前包,后不包
|
|
1548
|
+
gridData = subTableData.slice(startRowIndex, lastRowIndex)
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
if (gridData === undefined || gridData === null) {
|
|
1553
|
+
gridData = []
|
|
1554
|
+
}
|
|
1555
|
+
return gridData
|
|
1556
|
+
},
|
|
1557
|
+
fetchListData(searchParam, isSearch, parentRowIds, resove) {
|
|
1558
|
+
return new Promise((resolve, reject) => {
|
|
1559
|
+
this.isLoading = true
|
|
1560
|
+
this.hasLoadData = false
|
|
1561
|
+
if (isSearch === undefined || isSearch === false) {
|
|
1562
|
+
// 如果不是查询时才需要从缓存中获得结果
|
|
1563
|
+
// 如果是刷新当前列表,则需要获得缓存中的window.sessionStorage
|
|
1564
|
+
const isRefreshList = window.sessionStorage.getItem(
|
|
1565
|
+
'refreshList-' + this.code
|
|
1566
|
+
)
|
|
1567
|
+
// console.log('fetchData--isRefreshList--', isRefreshList)
|
|
1568
|
+
if (isRefreshList !== undefined && isRefreshList === 'true') {
|
|
1569
|
+
const searchParamJson = window.sessionStorage.getItem(
|
|
1570
|
+
'searchParam-' + this.code
|
|
1571
|
+
)
|
|
1572
|
+
// console.log('fetchData--searchParamJson--', searchParamJson)
|
|
1573
|
+
// console.log('fetchData--pagination--', this.pagination)
|
|
1574
|
+
if (
|
|
1575
|
+
searchParamJson !== undefined &&
|
|
1576
|
+
searchParamJson !== null &&
|
|
1577
|
+
searchParamJson !== ''
|
|
1578
|
+
) {
|
|
1579
|
+
searchParam = JSON.parse(searchParamJson)
|
|
1580
|
+
const pagination = searchParam.pagination
|
|
1581
|
+
if (pagination) {
|
|
1582
|
+
this.currentPage = pagination.currentPage
|
|
1583
|
+
this.pagination.pageSize = pagination.pageSize
|
|
1584
|
+
this.pagination.showTotal = pagination.showTotal
|
|
1585
|
+
}
|
|
1586
|
+
this.getInitSearchForm(searchParam.searchForm)
|
|
1587
|
+
// this.searchFormContent = searchParam.searchForm
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
window.sessionStorage.removeItem('refreshList-' + this.code)
|
|
1592
|
+
if (searchParam === undefined) {
|
|
1593
|
+
searchParam = this.getSearchParam()
|
|
1594
|
+
}
|
|
1595
|
+
const gridParams = store.get(this.code)
|
|
1596
|
+
let param = searchParam
|
|
1597
|
+
|
|
1598
|
+
if (gridParams.options.extraParam || parentRowIds !== undefined) {
|
|
1599
|
+
param = getExtraParam(searchParam, gridParams)
|
|
1600
|
+
}
|
|
1601
|
+
// 导出需要这两个参数
|
|
1602
|
+
gridParams.searchParam = searchParam
|
|
1603
|
+
gridParams.url = this.url
|
|
1604
|
+
let requestUrl = this.url
|
|
1605
|
+
if (parentRowIds !== undefined && parentRowIds !== null) {
|
|
1606
|
+
// 表示是查询子集合时
|
|
1607
|
+
param = Object.assign({}, param)
|
|
1608
|
+
// 清空查询子集合时,分页信息,即不需要分页查询子集合
|
|
1609
|
+
param.searchParam.pagination = null
|
|
1610
|
+
// 父节点id传给后台
|
|
1611
|
+
param['parentIds'] = parentRowIds
|
|
1612
|
+
// 父级字段名,例如:parentId 或 fk_parent_id
|
|
1613
|
+
param['parentProp'] = this.parentProp
|
|
1614
|
+
// 传入系统code
|
|
1615
|
+
param.systemCode = getSystemCode()
|
|
1616
|
+
|
|
1617
|
+
requestUrl = this.options.subRowUrl
|
|
1618
|
+
}
|
|
1619
|
+
// 解决新建后,查询,再点新建报“有未保存的行”问题,解决方案是一旦刷新列表,就还原这些状态
|
|
1620
|
+
gridParams.isCreateRow = false
|
|
1621
|
+
gridParams.isEditRow = false
|
|
1622
|
+
gridParams.$lastSaveRowIndex = null
|
|
1623
|
+
gridParams.$rowIndex = null
|
|
1624
|
+
gridParams.canSaveRow = true
|
|
1625
|
+
// 是否根据权限显示数据
|
|
1626
|
+
gridParams.withDataPermission = gridParams.options.isWithDataPermission
|
|
1627
|
+
// 对象是否是流程实体
|
|
1628
|
+
gridParams.isWorkflowEntity = gridParams.options.isWorkflowEntity
|
|
1629
|
+
// 缓存查询条件及当前页数
|
|
1630
|
+
window.sessionStorage.setItem(
|
|
1631
|
+
'searchParam-' + this.code,
|
|
1632
|
+
JSON.stringify(param)
|
|
1633
|
+
)
|
|
1634
|
+
if (
|
|
1635
|
+
this.parentProp &&
|
|
1636
|
+
searchParam.searchForm &&
|
|
1637
|
+
searchParam.searchForm.length > 0
|
|
1638
|
+
) {
|
|
1639
|
+
// 表示是树形列表的查询时,查询结果不需要树形显示,后台处理的数据没有加has_children来实现的
|
|
1640
|
+
param.listViewTreeSetting = null
|
|
1641
|
+
}
|
|
1642
|
+
this.$http
|
|
1643
|
+
.post(requestUrl, param)
|
|
1644
|
+
.then((data) => {
|
|
1645
|
+
if (typeof parentRowIds === 'undefined' || parentRowIds === null) {
|
|
1646
|
+
let tableData = []
|
|
1647
|
+
// 对数据做序列化,比如:处理xss攻击
|
|
1648
|
+
if (isHasOptionFunction('gridDataLoaded', this.code)) {
|
|
1649
|
+
const gridDataLoadedParam = {
|
|
1650
|
+
gridData: data.data,
|
|
1651
|
+
columns: gridParams.columns,
|
|
1652
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
1653
|
+
}
|
|
1654
|
+
if (searchParam) {
|
|
1655
|
+
gridDataLoadedParam.searchForm = searchParam.searchForm
|
|
1656
|
+
gridDataLoadedParam.additionalParamMap =
|
|
1657
|
+
searchParam.additionalParamMap
|
|
1658
|
+
}
|
|
1659
|
+
const gridData = gridParams.options.gridDataLoaded.call(
|
|
1660
|
+
this,
|
|
1661
|
+
gridDataLoadedParam
|
|
1662
|
+
)
|
|
1663
|
+
if (gridData) {
|
|
1664
|
+
tableData = gridData
|
|
1665
|
+
} else {
|
|
1666
|
+
tableData = data.data
|
|
1667
|
+
}
|
|
1668
|
+
} else {
|
|
1669
|
+
tableData = data.data
|
|
1670
|
+
}
|
|
1671
|
+
if (!tableData) {
|
|
1672
|
+
tableData = []
|
|
1673
|
+
}
|
|
1674
|
+
if (gridParams.options.isFormSubTable) {
|
|
1675
|
+
// 子表时默认不全部行编辑
|
|
1676
|
+
if (tableData) {
|
|
1677
|
+
// 子表时所有记录的所有字段设置默认值null,优化子表编辑时性能
|
|
1678
|
+
tableData.forEach((item) => {
|
|
1679
|
+
this.setColumnsDefaultValue(gridParams.allColumns, item)
|
|
1680
|
+
})
|
|
1681
|
+
}
|
|
1682
|
+
// console.log('子表数据循环', this.gridData)
|
|
1683
|
+
// this.gridData.forEach(item => {
|
|
1684
|
+
// item.$editing = true
|
|
1685
|
+
// })
|
|
1686
|
+
if (this.pagination && this.isSubTableShowPage === true) {
|
|
1687
|
+
// 表示子表需要显示分页
|
|
1688
|
+
this.subTableData = tableData
|
|
1689
|
+
this.gridData = this.getSubTableGridData(this.subTableData)
|
|
1690
|
+
gridParams.subTableData = this.subTableData
|
|
1691
|
+
} else {
|
|
1692
|
+
this.gridData = tableData
|
|
1693
|
+
}
|
|
1694
|
+
if (this.pagination) {
|
|
1695
|
+
this.pagination.total = tableData.length
|
|
1696
|
+
}
|
|
1697
|
+
} else {
|
|
1698
|
+
this.gridData = tableData
|
|
1699
|
+
|
|
1700
|
+
if (this.pagination) {
|
|
1701
|
+
this.pagination.total = data.total
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
if (data.summaries && Object.keys(data.summaries).length > 0) {
|
|
1705
|
+
this.summaries = data.summaries
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1708
|
+
gridParams.gridData = this.gridData
|
|
1709
|
+
|
|
1710
|
+
// 完成深拷贝,复制一份对象,行编辑时使用
|
|
1711
|
+
gridParams.orgGridData = [].concat(
|
|
1712
|
+
JSON.parse(JSON.stringify(this.gridData))
|
|
1713
|
+
)
|
|
1714
|
+
|
|
1715
|
+
gridParams.pagination = this.pagination
|
|
1716
|
+
gridParams.loaded = true
|
|
1717
|
+
|
|
1718
|
+
// TODO: 输入焦点默认停在第一个可编辑的单元格
|
|
1719
|
+
if (this.lineEdit.editable) {
|
|
1720
|
+
if (typeof isSearch === 'undefined' || isSearch === false) {
|
|
1721
|
+
// 不是查询时,才需要创建第一行记录
|
|
1722
|
+
if (this.gridData.length === 0) {
|
|
1723
|
+
if (
|
|
1724
|
+
this.options &&
|
|
1725
|
+
this.options.isDefaultShowEdit !== null &&
|
|
1726
|
+
this.options.isDefaultShowEdit !== undefined &&
|
|
1727
|
+
this.options.isDefaultShowEdit === true
|
|
1728
|
+
) {
|
|
1729
|
+
this.createRow(this.code, null, this.gridData)
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
if (this.gridData.length > 0) {
|
|
1733
|
+
this.lineEdit['editingCell'] = {
|
|
1734
|
+
row: 0,
|
|
1735
|
+
prop: getFirstEditableColumn(this.code),
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
this.hasLoadData = true
|
|
1741
|
+
} else {
|
|
1742
|
+
// 对数据做序列化,比如:处理xss攻击
|
|
1743
|
+
if (isHasOptionFunction('gridDataLoaded', this.code)) {
|
|
1744
|
+
gridParams.options.gridDataLoaded.call(this, {
|
|
1745
|
+
gridData: data,
|
|
1746
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
1747
|
+
})
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1750
|
+
if (isHasOptionFunction('loadChildrenComplete', this.code)) {
|
|
1751
|
+
gridParams.options.loadChildrenComplete.call(this, {
|
|
1752
|
+
parentRowIds: parentRowIds,
|
|
1753
|
+
gridData: data,
|
|
1754
|
+
columns: gridParams.columns,
|
|
1755
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
1756
|
+
})
|
|
1757
|
+
}
|
|
1758
|
+
if (typeof resove !== 'undefined' && resove !== null) {
|
|
1759
|
+
// 首次加载或点击三角展开父节点时走该分支
|
|
1760
|
+
// 刷新数据后,移除该父节点下的所有已选中的子节点记录。
|
|
1761
|
+
// 必须调用该方法,否则在删除记录时,数据即使刷新了,已选中集合this.$refs.superGrid.store.states.selection中仍会有该已删除记录,导致再次执行删除报id不存在
|
|
1762
|
+
this.removeGridStoreSelection(parentRowIds)
|
|
1763
|
+
resove(data[parentRowIds[0]])
|
|
1764
|
+
} else {
|
|
1765
|
+
// 刷新父记录对应的子记录集合时需要,例如:删除时
|
|
1766
|
+
parentRowIds.forEach((parentRowId) => {
|
|
1767
|
+
// 单行父记录id
|
|
1768
|
+
this.$refs.superGrid.store.states.lazyTreeNodeMap[
|
|
1769
|
+
parentRowId
|
|
1770
|
+
] = data[parentRowId]
|
|
1771
|
+
this.$refs.superGrid.store.states.treeData[
|
|
1772
|
+
parentRowId
|
|
1773
|
+
].children = data[parentRowId]
|
|
1774
|
+
})
|
|
1775
|
+
// 刷新数据后,移除该父节点下的所有已选中的子节点记录
|
|
1776
|
+
// 必须调用该方法,否则在删除记录时,数据即使刷新了,已选中集合this.$refs.superGrid.store.states.selection中仍会有该已删除记录,导致再次执行删除报id不存在
|
|
1777
|
+
this.removeGridStoreSelection(parentRowIds)
|
|
1778
|
+
}
|
|
1779
|
+
this.hasLoadData = true
|
|
1780
|
+
}
|
|
1781
|
+
resolve()
|
|
1782
|
+
})
|
|
1783
|
+
.catch((error) => {
|
|
1784
|
+
if (isHasOptionFunction('loadError', this.code)) {
|
|
1785
|
+
gridParams.options.loadError.call(this, this.code, error)
|
|
1786
|
+
}
|
|
1787
|
+
reject(error)
|
|
1788
|
+
})
|
|
1789
|
+
})
|
|
1790
|
+
},
|
|
1791
|
+
// 获得初始查询条件对象
|
|
1792
|
+
getInitSearchForm(searchFormArr) {
|
|
1793
|
+
const gridParams = store.get(this.code)
|
|
1794
|
+
if (searchFormArr && searchFormArr.length > 0) {
|
|
1795
|
+
this.searchFormContent = {}
|
|
1796
|
+
searchFormArr.forEach((item) => {
|
|
1797
|
+
// 获得的是"isDeleted"
|
|
1798
|
+
let prop = item.propName
|
|
1799
|
+
// 获得的是“deleted”
|
|
1800
|
+
const columnProp = item.columnProp
|
|
1801
|
+
const dataType = item.dataType
|
|
1802
|
+
if (dataType && dataType === 'BOOLEAN') {
|
|
1803
|
+
prop = columnProp
|
|
1804
|
+
}
|
|
1805
|
+
this.initSearchProps.push(prop)
|
|
1806
|
+
const propValue = item.propValue
|
|
1807
|
+
if (prop && prop.indexOf('.') > 0) {
|
|
1808
|
+
// 动态给searchForm添加属性,包括多级嵌套属性,属性的初始值都为 null
|
|
1809
|
+
addDynamicProp(this.searchFormContent, prop, propValue)
|
|
1810
|
+
} else {
|
|
1811
|
+
this.searchFormContent[prop] = propValue
|
|
1812
|
+
}
|
|
1813
|
+
})
|
|
1814
|
+
gridParams.searchForm = searchFormArr
|
|
1815
|
+
// 调用查询api方法,该方法中调用了@showSearch方法,用于控制“查询”按钮改名为“取消查询”
|
|
1816
|
+
this.showSearchForm()
|
|
1817
|
+
} else {
|
|
1818
|
+
gridParams.searchForm = null
|
|
1819
|
+
}
|
|
1820
|
+
},
|
|
1821
|
+
showDemo() {
|
|
1822
|
+
this.isLoading = true
|
|
1823
|
+
this.$http
|
|
1824
|
+
.get(this.url)
|
|
1825
|
+
.then((data) => {
|
|
1826
|
+
// 根据this.options.showColumns设置显示的字段
|
|
1827
|
+
this.getShowColumns(data)
|
|
1828
|
+
|
|
1829
|
+
Object.assign(this, data)
|
|
1830
|
+
const gridParams = store.get(this.code)
|
|
1831
|
+
gridParams.listCode = this.code
|
|
1832
|
+
|
|
1833
|
+
gridParams.columns = this.columns
|
|
1834
|
+
if (gridParams.columns && this.options.dynamicColumns) {
|
|
1835
|
+
for (var i = 0; i < this.options.dynamicColumns.length; i++) {
|
|
1836
|
+
this.options.dynamicColumns[i].dynamic = true
|
|
1837
|
+
gridParams.columns.push(this.options.dynamicColumns[i])
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
gridParams.lineEdit = this.lineEdit
|
|
1841
|
+
gridParams.basicInfo = this.basicInfo
|
|
1842
|
+
gridParams.pagination = this.pagination
|
|
1843
|
+
gridParams.query = this.query
|
|
1844
|
+
|
|
1845
|
+
this.gridData = data.gridData
|
|
1846
|
+
// 对数据做序列化,比如:处理xss攻击
|
|
1847
|
+
if (isHasOptionFunction('gridDataLoaded', this.code)) {
|
|
1848
|
+
const gridData = gridParams.options.gridDataLoaded.call(this, {
|
|
1849
|
+
gridData: data.gridData,
|
|
1850
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
1851
|
+
})
|
|
1852
|
+
if (gridData) {
|
|
1853
|
+
this.gridData = gridData
|
|
1854
|
+
} else {
|
|
1855
|
+
this.gridData = data.gridData
|
|
1856
|
+
}
|
|
1857
|
+
} else {
|
|
1858
|
+
this.gridData = data.gridData
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
if (this.pagination) {
|
|
1862
|
+
this.pagination.total = data.total
|
|
1863
|
+
}
|
|
1864
|
+
if (!this.gridData) {
|
|
1865
|
+
this.gridData = []
|
|
1866
|
+
}
|
|
1867
|
+
gridParams.gridData = this.gridData
|
|
1868
|
+
// 完成深拷贝,复制一份对象,行编辑时使用
|
|
1869
|
+
gridParams.orgGridData = [].concat(
|
|
1870
|
+
JSON.parse(JSON.stringify(this.gridData))
|
|
1871
|
+
)
|
|
1872
|
+
gridParams.pagination = this.pagination
|
|
1873
|
+
|
|
1874
|
+
// TODO: 输入焦点默认停在第一个可编辑的单元格
|
|
1875
|
+
if (this.lineEdit.editable) {
|
|
1876
|
+
if (this.gridData.length === 0) {
|
|
1877
|
+
this.createRow(this.code, null, this.gridData)
|
|
1878
|
+
}
|
|
1879
|
+
this.lineEdit['editingCell'] = {
|
|
1880
|
+
row: 0,
|
|
1881
|
+
prop: getFirstEditableColumn(this.code),
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
if (isHasOptionFunction('gridComplete', this.code)) {
|
|
1885
|
+
gridParams.options.gridComplete.call(
|
|
1886
|
+
this,
|
|
1887
|
+
this.gridData,
|
|
1888
|
+
gridParams.columns
|
|
1889
|
+
)
|
|
1890
|
+
}
|
|
1891
|
+
})
|
|
1892
|
+
.catch((error) => {
|
|
1893
|
+
if (isHasOptionFunction('loadError', this.code)) {
|
|
1894
|
+
const gridParams = store.get(this.code)
|
|
1895
|
+
gridParams.options.loadError.call(this, this.code, error)
|
|
1896
|
+
}
|
|
1897
|
+
})
|
|
1898
|
+
},
|
|
1899
|
+
doSearch(searchForm) {
|
|
1900
|
+
// 修改当前页为第1页
|
|
1901
|
+
this.currentPage = 1
|
|
1902
|
+
// 将toolbar 参数和查询表单参数合并
|
|
1903
|
+
if (searchForm && searchForm.length > 0) {
|
|
1904
|
+
if (this.toolbarFieldParam && this.toolbarFieldParam.length > 0) {
|
|
1905
|
+
if (searchForm.length === 1) {
|
|
1906
|
+
searchForm[0].leftBracket = '('
|
|
1907
|
+
searchForm[0].rightBracket = ')'
|
|
1908
|
+
}
|
|
1909
|
+
if (searchForm[searchForm.length - 1].joinSign === 'or') {
|
|
1910
|
+
searchForm[searchForm.length - 1].joinSign = 'and'
|
|
1911
|
+
}
|
|
1912
|
+
// 拼接
|
|
1913
|
+
// param.concat(toolbarFieldParam)
|
|
1914
|
+
Array.prototype.push.apply(searchForm, this.toolbarFieldParam)
|
|
1915
|
+
}
|
|
1916
|
+
} else {
|
|
1917
|
+
if (this.toolbarFieldParam && this.toolbarFieldParam.length > 0) {
|
|
1918
|
+
searchForm = this.toolbarFieldParam
|
|
1919
|
+
}
|
|
1920
|
+
}
|
|
1921
|
+
this.search(searchForm, true)
|
|
1922
|
+
},
|
|
1923
|
+
doSearchDialog(searchForm) {
|
|
1924
|
+
// 修改当前页为第1页
|
|
1925
|
+
this.currentPage = 1
|
|
1926
|
+
this.search(searchForm, true)
|
|
1927
|
+
this.closeSearchFormDialog()
|
|
1928
|
+
},
|
|
1929
|
+
// cs123
|
|
1930
|
+
search(searchForm, isSearch, parentRowIds) {
|
|
1931
|
+
// 重新查询列表数据时,抛出refresh事件,供父组件捕获做自己的业务处理
|
|
1932
|
+
$emit(this, 'refresh')
|
|
1933
|
+
const vm = this
|
|
1934
|
+
return new Promise((resolve, reject) => {
|
|
1935
|
+
const gridParams = store.get(vm.code)
|
|
1936
|
+
if (typeof searchForm !== 'undefined' && searchForm !== null) {
|
|
1937
|
+
gridParams.searchForm = searchForm
|
|
1938
|
+
} else {
|
|
1939
|
+
gridParams.searchForm = null
|
|
1940
|
+
}
|
|
1941
|
+
if (gridParams.options && gridParams.options.isAdministerListView) {
|
|
1942
|
+
// 根据类型生成静态数据
|
|
1943
|
+
if (
|
|
1944
|
+
gridParams.options.SuperGrid &&
|
|
1945
|
+
gridParams.options.SuperGrid.simulationDate
|
|
1946
|
+
) {
|
|
1947
|
+
let gridData
|
|
1948
|
+
if (isHasOptionFunction('gridDataLoaded', vm.code)) {
|
|
1949
|
+
gridData = gridParams.options.gridDataLoaded.call(this, {
|
|
1950
|
+
gridData: gridParams.options.SuperGrid.simulationDate,
|
|
1951
|
+
columns: gridParams.columns,
|
|
1952
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
1953
|
+
})
|
|
1954
|
+
if (!gridData) {
|
|
1955
|
+
gridData = gridParams.options.SuperGrid.simulationDate
|
|
1956
|
+
}
|
|
1957
|
+
} else {
|
|
1958
|
+
gridData = gridParams.options.SuperGrid.simulationDate
|
|
1959
|
+
}
|
|
1960
|
+
resolve(gridData)
|
|
1961
|
+
}
|
|
1962
|
+
} else if (
|
|
1963
|
+
gridParams.options &&
|
|
1964
|
+
gridParams.options.isFormSubTable &&
|
|
1965
|
+
gridParams.options.subTableData &&
|
|
1966
|
+
gridParams.options.subTableData.length > 0
|
|
1967
|
+
) {
|
|
1968
|
+
let gridData
|
|
1969
|
+
vm.hasLoadData = false
|
|
1970
|
+
gridParams.loaded = true
|
|
1971
|
+
// 如果有子表数据,则展示传递的子表数据
|
|
1972
|
+
if (isHasOptionFunction('gridDataLoaded', vm.code)) {
|
|
1973
|
+
gridData = gridParams.options.gridDataLoaded.call(this, {
|
|
1974
|
+
gridData: gridParams.options.subTableData,
|
|
1975
|
+
columns: gridParams.columns,
|
|
1976
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
1977
|
+
})
|
|
1978
|
+
if (!gridData) {
|
|
1979
|
+
gridData = gridParams.options.subTableData
|
|
1980
|
+
vm.hasLoadData = true
|
|
1981
|
+
}
|
|
1982
|
+
} else {
|
|
1983
|
+
gridData = gridParams.options.subTableData
|
|
1984
|
+
vm.hasLoadData = true
|
|
1985
|
+
}
|
|
1986
|
+
resolve(gridData)
|
|
1987
|
+
} else {
|
|
1988
|
+
vm.fetchData(vm.getSearchParam(), isSearch, parentRowIds)
|
|
1989
|
+
.then((data) => {
|
|
1990
|
+
console.log('打印1====', gridParams)
|
|
1991
|
+
if (
|
|
1992
|
+
gridParams !== undefined &&
|
|
1993
|
+
gridParams.options !== undefined &&
|
|
1994
|
+
gridParams.options.isHiddenSearchForm !== undefined &&
|
|
1995
|
+
gridParams.options.isHiddenSearchForm === true
|
|
1996
|
+
) {
|
|
1997
|
+
// 查询时,是否隐藏查询区域,默认是不隐藏查询区域
|
|
1998
|
+
console.log('打印2====', vm)
|
|
1999
|
+
vm.showSearch = false
|
|
2000
|
+
$emit(vm, 'cancel-search')
|
|
2001
|
+
}
|
|
2002
|
+
console.log('打印3====', vm)
|
|
2003
|
+
console.log('打印4====', vm.$refs)
|
|
2004
|
+
if (vm.$refs && vm.$refs.sf) {
|
|
2005
|
+
console.log('打印5====', vm.$refs.sf)
|
|
2006
|
+
vm.$refs.sf.loading = false
|
|
2007
|
+
vm.$refs.sf.searchComplete()
|
|
2008
|
+
}
|
|
2009
|
+
console.log('打印6====', vm)
|
|
2010
|
+
// 重新计算列表高度
|
|
2011
|
+
this.resizeTableHeight()
|
|
2012
|
+
resolve(data)
|
|
2013
|
+
})
|
|
2014
|
+
.catch((error) => {
|
|
2015
|
+
if (vm.$refs.sf) {
|
|
2016
|
+
vm.$refs.sf.loading = false
|
|
2017
|
+
vm.$refs.sf.searchComplete()
|
|
2018
|
+
}
|
|
2019
|
+
reject(error)
|
|
2020
|
+
})
|
|
2021
|
+
}
|
|
2022
|
+
})
|
|
2023
|
+
},
|
|
2024
|
+
// addSearchParam(searchData) {
|
|
2025
|
+
// if (searchData && searchData.length > 0) {
|
|
2026
|
+
// const gridParams = store.get(this.code)
|
|
2027
|
+
// if (typeof (gridParams.searchForm) !== 'undefined') {
|
|
2028
|
+
// const searchForm = gridParams.searchForm
|
|
2029
|
+
// searchForm.concat()
|
|
2030
|
+
// searchParam.searchForm = gridParams.searchForm
|
|
2031
|
+
// } else {
|
|
2032
|
+
// searchParam.searchForm = []
|
|
2033
|
+
// }
|
|
2034
|
+
// }
|
|
2035
|
+
// },
|
|
2036
|
+
getPaginationInfo() {
|
|
2037
|
+
const gridParams = store.get(this.code)
|
|
2038
|
+
if (this.pagination) {
|
|
2039
|
+
// 判断是否删除后请求数据
|
|
2040
|
+
if (this.isDelete && this.currentPage > 1) {
|
|
2041
|
+
const pageNum = Math.ceil(
|
|
2042
|
+
(this.pagination.total - this.gridData.length) /
|
|
2043
|
+
this.pagination.pageSize
|
|
2044
|
+
)
|
|
2045
|
+
this.currentPage =
|
|
2046
|
+
this.currentPage > pageNum ? pageNum : this.currentPage
|
|
2047
|
+
this.isDelete = false
|
|
2048
|
+
}
|
|
2049
|
+
const pagination = {
|
|
2050
|
+
currentPage: this.currentPage,
|
|
2051
|
+
pageSize: this.pagination.pageSize,
|
|
2052
|
+
showTotal: this.pagination.showTotal,
|
|
2053
|
+
}
|
|
2054
|
+
if (this.pageSize !== null) {
|
|
2055
|
+
// 表示更改了每页显示的数据条数
|
|
2056
|
+
pagination.pageSize = this.pageSize
|
|
2057
|
+
}
|
|
2058
|
+
if (
|
|
2059
|
+
typeof gridParams.currentPage !== 'undefined' &&
|
|
2060
|
+
gridParams.currentPage !== null
|
|
2061
|
+
) {
|
|
2062
|
+
// 保持页数时使用
|
|
2063
|
+
pagination.currentPage = gridParams.currentPage
|
|
2064
|
+
// 必须清空一下,否则会导致翻页有问题
|
|
2065
|
+
gridParams.currentPage = null
|
|
2066
|
+
}
|
|
2067
|
+
return pagination
|
|
2068
|
+
} else {
|
|
2069
|
+
// TODO 临时解决列表工具栏有默认值时触发查询,查询没有分页问题,
|
|
2070
|
+
// 因为获取页面默认值后触发查询时候,列表的配置信息,比如分页是否编辑等元数据还没有查询过来
|
|
2071
|
+
return {
|
|
2072
|
+
currentPage: 1,
|
|
2073
|
+
pageSize: 20,
|
|
2074
|
+
showTotal: true,
|
|
2075
|
+
}
|
|
2076
|
+
}
|
|
2077
|
+
},
|
|
2078
|
+
getSearchParam() {
|
|
2079
|
+
const searchParam = {
|
|
2080
|
+
code: this.code,
|
|
2081
|
+
}
|
|
2082
|
+
const gridParams = store.get(this.code)
|
|
2083
|
+
const pagination = this.getPaginationInfo()
|
|
2084
|
+
if (pagination && pagination !== null) {
|
|
2085
|
+
searchParam.pagination = pagination
|
|
2086
|
+
}
|
|
2087
|
+
// 排序信息
|
|
2088
|
+
if (this.sortInfo !== null) {
|
|
2089
|
+
// 表示更改了排序信息
|
|
2090
|
+
searchParam.sorts = this.sortInfo
|
|
2091
|
+
}
|
|
2092
|
+
if (this.mergeFields && this.mergeFields.length > 0) {
|
|
2093
|
+
if (!searchParam.sorts) {
|
|
2094
|
+
searchParam.sorts = []
|
|
2095
|
+
}
|
|
2096
|
+
const mergeFieldsArr = []
|
|
2097
|
+
for (const mergeField of this.mergeFields) {
|
|
2098
|
+
let flag = true
|
|
2099
|
+
for (const so of searchParam.sorts) {
|
|
2100
|
+
if (so.prop === mergeField) {
|
|
2101
|
+
flag = false
|
|
2102
|
+
break
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
if (flag) {
|
|
2106
|
+
mergeFieldsArr.push({
|
|
2107
|
+
prop: mergeField,
|
|
2108
|
+
order: 'ascending',
|
|
2109
|
+
})
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
2112
|
+
mergeFieldsArr.push(...searchParam.sorts)
|
|
2113
|
+
searchParam.sorts = mergeFieldsArr
|
|
2114
|
+
}
|
|
2115
|
+
// 是否有初始过滤条件
|
|
2116
|
+
if (
|
|
2117
|
+
gridParams.options &&
|
|
2118
|
+
typeof gridParams.options.initSearchForm !== 'undefined'
|
|
2119
|
+
) {
|
|
2120
|
+
searchParam.initSearchForm = gridParams.options.initSearchForm
|
|
2121
|
+
}
|
|
2122
|
+
if (
|
|
2123
|
+
gridParams.query &&
|
|
2124
|
+
typeof gridParams.query.defaultQueryCriteria !== 'undefined'
|
|
2125
|
+
) {
|
|
2126
|
+
// json字符串转数组
|
|
2127
|
+
searchParam.defaultQueryCriteria = JSON.parse(
|
|
2128
|
+
gridParams.query.defaultQueryCriteria
|
|
2129
|
+
)
|
|
2130
|
+
}
|
|
2131
|
+
if (typeof gridParams.searchForm !== 'undefined') {
|
|
2132
|
+
searchParam.searchForm = gridParams.searchForm
|
|
2133
|
+
} else {
|
|
2134
|
+
searchParam.searchForm = []
|
|
2135
|
+
}
|
|
2136
|
+
if (this.dynamicColumnInfo) {
|
|
2137
|
+
searchParam.dynamicColumnInfo = this.dynamicColumnInfo
|
|
2138
|
+
}
|
|
2139
|
+
if (this.dynamicServiceName) {
|
|
2140
|
+
searchParam.dynamicServiceName = this.dynamicServiceName
|
|
2141
|
+
}
|
|
2142
|
+
const additionalParamMap = gridParams.additionalParamMap
|
|
2143
|
+
if (additionalParamMap) {
|
|
2144
|
+
if (additionalParamMap && typeof additionalParamMap === 'object') {
|
|
2145
|
+
searchParam.additionalParamMap = additionalParamMap
|
|
2146
|
+
} else if (additionalParamMap && additionalParamMap !== '') {
|
|
2147
|
+
searchParam.additionalParamMap = JSON.parse(additionalParamMap)
|
|
2148
|
+
}
|
|
2149
|
+
}
|
|
2150
|
+
return searchParam
|
|
2151
|
+
},
|
|
2152
|
+
getComponentType(prop) {
|
|
2153
|
+
let type = 'NormalColumn'
|
|
2154
|
+
if (prop === '$index') {
|
|
2155
|
+
type = 'IndexColumn'
|
|
2156
|
+
} else if (prop === '$selection') {
|
|
2157
|
+
// 设置选中行时使用
|
|
2158
|
+
store.get(this.code).isMulitiSelect = true
|
|
2159
|
+
type = 'SelectionColumn'
|
|
2160
|
+
} else if (prop === undefined) {
|
|
2161
|
+
type = 'GroupColumn'
|
|
2162
|
+
}
|
|
2163
|
+
// console.log('%c描述-180428','color:#2E3435;background:#F8BB07;padding:3px;border-radius:2px',this.myCustomFormatter);
|
|
2164
|
+
// console.log('%c描述-155704','color:#2E3435;background:#F8BB07;padding:3px;border-radius:2px',type);
|
|
2165
|
+
return type
|
|
2166
|
+
},
|
|
2167
|
+
focusOnFirstEditableInput() {
|
|
2168
|
+
if (this.basicInfo.editable) {
|
|
2169
|
+
this.lineEdit.editingCell.row = 0
|
|
2170
|
+
this.lineEdit.editingCell.prop = getFirstEditableColumn(this.code)
|
|
2171
|
+
}
|
|
2172
|
+
},
|
|
2173
|
+
handleSizeChange(val) {
|
|
2174
|
+
if (!this.options || !this.options.isPageShow) {
|
|
2175
|
+
// console.log(`每页 ${val} 条`)
|
|
2176
|
+
this.currentPage = 1
|
|
2177
|
+
this.pageSize = val
|
|
2178
|
+
this.pagination.pageSize = val
|
|
2179
|
+
this.changePage()
|
|
2180
|
+
}
|
|
2181
|
+
},
|
|
2182
|
+
handleCurrentChange(val) {
|
|
2183
|
+
if (!this.options || !this.options.isPageShow) {
|
|
2184
|
+
// 翻页操作会导致筛选项发生变化,所以需要清空已有的
|
|
2185
|
+
this.changePage()
|
|
2186
|
+
}
|
|
2187
|
+
},
|
|
2188
|
+
changePage() {
|
|
2189
|
+
// 翻页操作会导致筛选项发生变化,所以需要清空已有的
|
|
2190
|
+
this.$refs.superGrid.clearFilter()
|
|
2191
|
+
// TODO: 把当前页数、每页条数、查询条件、排序信息传回后台
|
|
2192
|
+
if (this.isSubTableShowPage) {
|
|
2193
|
+
this.gridData = this.getSubTableGridData(this.subTableData)
|
|
2194
|
+
const gridParams = store.get(this.code)
|
|
2195
|
+
gridParams.gridData = this.gridData
|
|
2196
|
+
// 完成深拷贝,复制一份对象,行编辑时使用
|
|
2197
|
+
gridParams.orgGridData = [].concat(
|
|
2198
|
+
JSON.parse(JSON.stringify(this.gridData))
|
|
2199
|
+
)
|
|
2200
|
+
} else {
|
|
2201
|
+
this.fetchData(this.getSearchParam())
|
|
2202
|
+
}
|
|
2203
|
+
},
|
|
2204
|
+
handleSortChange({ column, prop, order }) {
|
|
2205
|
+
if (!this.options || !this.options.isPageShow) {
|
|
2206
|
+
let columnSetting = null
|
|
2207
|
+
const items = this.visibleColumns.filter((item) => {
|
|
2208
|
+
return column.property === item.prop
|
|
2209
|
+
})
|
|
2210
|
+
if (items && items.length > 0) {
|
|
2211
|
+
columnSetting = items[0]
|
|
2212
|
+
}
|
|
2213
|
+
if (!isCanRefreshGrid(this.code)) {
|
|
2214
|
+
// 如果最后编辑行没有保存或撤销编辑,则给出提示
|
|
2215
|
+
const gridParams = store.get(this.code)
|
|
2216
|
+
console.log(
|
|
2217
|
+
'请先保存或撤销编辑第' + gridParams.$rowIndex + 1 + '行记录,再排序'
|
|
2218
|
+
)
|
|
2219
|
+
this.$refs.superGrid.clearSort()
|
|
2220
|
+
} else {
|
|
2221
|
+
// TODO: 应该调用fetchData来获取信息,把当前页数、查询条件、排序信息传回后台
|
|
2222
|
+
if (prop !== null && columnSetting && columnSetting !== null) {
|
|
2223
|
+
// 当点击第3次时,prop会是空,表示清空排序字段,还原原顺序
|
|
2224
|
+
let orgProp = columnSetting.orgProp
|
|
2225
|
+
// sql查询时,会把点“.”改为两个下划线"__"
|
|
2226
|
+
const replaceDot = '__'
|
|
2227
|
+
if (orgProp && orgProp.indexOf(replaceDot) > 0) {
|
|
2228
|
+
// 表示包括点“.”,需要把两个下划线"__"重新改为点“.”,否则会导致查询报500错误
|
|
2229
|
+
orgProp = orgProp.replace(replaceDot, '.')
|
|
2230
|
+
}
|
|
2231
|
+
this.sortInfo = [
|
|
2232
|
+
{
|
|
2233
|
+
prop: orgProp,
|
|
2234
|
+
order: order,
|
|
2235
|
+
},
|
|
2236
|
+
]
|
|
2237
|
+
} else {
|
|
2238
|
+
this.sortInfo = null
|
|
2239
|
+
}
|
|
2240
|
+
this.fetchData(this.getSearchParam())
|
|
2241
|
+
this.focusOnFirstEditableInput()
|
|
2242
|
+
$emit(this, 'sort-change', { columnSetting, prop, order, column })
|
|
2243
|
+
}
|
|
2244
|
+
}
|
|
2245
|
+
},
|
|
2246
|
+
isMergeable(prop) {
|
|
2247
|
+
for (const column of this.columns) {
|
|
2248
|
+
if (column.prop === prop) {
|
|
2249
|
+
if (
|
|
2250
|
+
this.mergeFields &&
|
|
2251
|
+
this.mergeFields.indexOf(column.prop) !== -1
|
|
2252
|
+
) {
|
|
2253
|
+
return true
|
|
2254
|
+
} else {
|
|
2255
|
+
return column.span
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
},
|
|
2260
|
+
rowSpan({ row, column, rowIndex, columnIndex }) {
|
|
2261
|
+
if (this.isMergeable(column.property)) {
|
|
2262
|
+
const row = this.spanArr[column.property][rowIndex]
|
|
2263
|
+
const col = row > 0 ? 1 : 0
|
|
2264
|
+
return {
|
|
2265
|
+
rowspan: row,
|
|
2266
|
+
colspan: col,
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
},
|
|
2270
|
+
packageSummaryColumnProps() {
|
|
2271
|
+
const summaryColumnProps = []
|
|
2272
|
+
this.visibleColumns.forEach((item) => {
|
|
2273
|
+
if (item.total !== undefined && item.total === true) {
|
|
2274
|
+
summaryColumnProps.push(item.prop)
|
|
2275
|
+
}
|
|
2276
|
+
})
|
|
2277
|
+
return summaryColumnProps
|
|
2278
|
+
},
|
|
2279
|
+
getSummaries(param) {
|
|
2280
|
+
// 后台返回时需要处理好序号列和多选列
|
|
2281
|
+
if (this.basicInfo.summary !== 'no') {
|
|
2282
|
+
const summaryMap = this.summaries
|
|
2283
|
+
if (summaryMap) {
|
|
2284
|
+
return this.getCustomSummaries(param, summaryMap)
|
|
2285
|
+
} else {
|
|
2286
|
+
return this.getDefaultSummaries(param)
|
|
2287
|
+
}
|
|
2288
|
+
} else {
|
|
2289
|
+
return []
|
|
2290
|
+
}
|
|
2291
|
+
},
|
|
2292
|
+
getCustomSummaries(param, summaryMap) {
|
|
2293
|
+
// key为字段名,value为
|
|
2294
|
+
const { columns } = param
|
|
2295
|
+
const sums = []
|
|
2296
|
+
columns.forEach((column, index) => {
|
|
2297
|
+
const prop = column.property
|
|
2298
|
+
const summaryVal = summaryMap[prop]
|
|
2299
|
+
if (summaryVal !== undefined && summaryVal !== null) {
|
|
2300
|
+
sums[index] = summaryVal
|
|
2301
|
+
} else {
|
|
2302
|
+
sums[index] = ''
|
|
2303
|
+
}
|
|
2304
|
+
})
|
|
2305
|
+
return sums
|
|
2306
|
+
},
|
|
2307
|
+
getDefaultSummaries(param) {
|
|
2308
|
+
const sums = []
|
|
2309
|
+
const summaryColumnProps = this.packageSummaryColumnProps()
|
|
2310
|
+
if (summaryColumnProps.length > 0) {
|
|
2311
|
+
const { columns, data } = param
|
|
2312
|
+
let totalColIndex = null
|
|
2313
|
+
columns.forEach((column, index) => {
|
|
2314
|
+
let colTotal = 0
|
|
2315
|
+
const prop = column.property
|
|
2316
|
+
if (prop && prop !== '$selection' && prop !== '$index') {
|
|
2317
|
+
// 设置合计列
|
|
2318
|
+
if (totalColIndex === undefined || totalColIndex === null) {
|
|
2319
|
+
totalColIndex = index
|
|
2320
|
+
sums[index] = '合计'
|
|
2321
|
+
return
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2324
|
+
if (summaryColumnProps.indexOf(prop) >= 0) {
|
|
2325
|
+
// 表示该列需要合计
|
|
2326
|
+
if (data) {
|
|
2327
|
+
data.forEach((row) => {
|
|
2328
|
+
let fieldValue = getEntityFieldValueWithOutCase(row, prop)
|
|
2329
|
+
let numberValue
|
|
2330
|
+
if (fieldValue !== undefined && fieldValue !== null) {
|
|
2331
|
+
// 表示值存在,不需要转换
|
|
2332
|
+
numberValue = Number(fieldValue)
|
|
2333
|
+
} else {
|
|
2334
|
+
// 表示值不存在,需要转小写,再获得一遍
|
|
2335
|
+
const reg1 = /[A-Z]+/ // 大写字母
|
|
2336
|
+
if (this.isSql && reg1.test(prop)) {
|
|
2337
|
+
fieldValue = getEntityFieldValueWithOutCase(
|
|
2338
|
+
row,
|
|
2339
|
+
prop.toLowerCase()
|
|
2340
|
+
)
|
|
2341
|
+
if (fieldValue !== undefined && fieldValue !== null) {
|
|
2342
|
+
numberValue = Number(fieldValue)
|
|
2343
|
+
}
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2346
|
+
if (
|
|
2347
|
+
numberValue !== undefined &&
|
|
2348
|
+
numberValue !== null &&
|
|
2349
|
+
!isNaN(numberValue)
|
|
2350
|
+
) {
|
|
2351
|
+
colTotal += numberValue
|
|
2352
|
+
}
|
|
2353
|
+
})
|
|
2354
|
+
}
|
|
2355
|
+
sums[index] = colTotal
|
|
2356
|
+
} else {
|
|
2357
|
+
sums[index] = ''
|
|
2358
|
+
}
|
|
2359
|
+
})
|
|
2360
|
+
}
|
|
2361
|
+
return sums
|
|
2362
|
+
},
|
|
2363
|
+
configColumns() {
|
|
2364
|
+
this.showColumnConfig = true
|
|
2365
|
+
// 完成深拷贝,复制一份对象,行编辑时使用
|
|
2366
|
+
this.orgColumnConfig = [].concat(JSON.parse(JSON.stringify(this.columns)))
|
|
2367
|
+
},
|
|
2368
|
+
// 行拖拽
|
|
2369
|
+
rowDrop() {
|
|
2370
|
+
if (this.lineEdit && this.lineEdit.urlToSaveOrder) {
|
|
2371
|
+
const tbody = document.querySelector('.el-table__body-wrapper tbody')
|
|
2372
|
+
if (tbody != null) {
|
|
2373
|
+
const vm = this
|
|
2374
|
+
Sortable.create(tbody, {
|
|
2375
|
+
onEnd({ newIndex, oldIndex }) {
|
|
2376
|
+
const params = {
|
|
2377
|
+
oldIndex: oldIndex,
|
|
2378
|
+
newIndex: newIndex,
|
|
2379
|
+
}
|
|
2380
|
+
this.$http
|
|
2381
|
+
.post(this.lineEdit.urlToSaveOrder, params)
|
|
2382
|
+
.then((data) => {
|
|
2383
|
+
const currRow = vm.gridData.splice(oldIndex, 1)[0]
|
|
2384
|
+
vm.gridData.splice(newIndex, 0, currRow)
|
|
2385
|
+
})
|
|
2386
|
+
},
|
|
2387
|
+
})
|
|
2388
|
+
}
|
|
2389
|
+
}
|
|
2390
|
+
},
|
|
2391
|
+
closeCustomConfig(isRefreshGrid) {
|
|
2392
|
+
if (isRefreshGrid !== undefined && isRefreshGrid === true) {
|
|
2393
|
+
this.refreshGridInitialize()
|
|
2394
|
+
}
|
|
2395
|
+
this.showColumnConfig = false
|
|
2396
|
+
},
|
|
2397
|
+
resetCustomConfig() {
|
|
2398
|
+
this.refreshGridInitialize()
|
|
2399
|
+
},
|
|
2400
|
+
refreshGridInitialize() {
|
|
2401
|
+
this.initialize().then(() => {
|
|
2402
|
+
// 添加该代码是为了解决保存字段个性化配置后,重新渲染列表问题,例如:列宽重新计算问题
|
|
2403
|
+
this.refreshGrid = false
|
|
2404
|
+
const vm = this
|
|
2405
|
+
setTimeout(function () {
|
|
2406
|
+
vm.refreshGrid = true
|
|
2407
|
+
}, 100)
|
|
2408
|
+
})
|
|
2409
|
+
},
|
|
2410
|
+
loadChildren(row, treeNode, resove) {
|
|
2411
|
+
if (this.isLazy) {
|
|
2412
|
+
this.loadChildrenNode(row, treeNode, resove)
|
|
2413
|
+
}
|
|
2414
|
+
},
|
|
2415
|
+
loadChildrenNode(row, treeNode, resove) {
|
|
2416
|
+
const subRowUrl = this.options.subRowUrl
|
|
2417
|
+
if (
|
|
2418
|
+
typeof subRowUrl !== 'undefined' &&
|
|
2419
|
+
subRowUrl !== '' &&
|
|
2420
|
+
subRowUrl !== null
|
|
2421
|
+
) {
|
|
2422
|
+
const parentRowIds = []
|
|
2423
|
+
parentRowIds.push(row.id ? row.id : row.ID)
|
|
2424
|
+
this.fetchData(this.getSearchParam(), false, parentRowIds, resove)
|
|
2425
|
+
}
|
|
2426
|
+
},
|
|
2427
|
+
expandChange(row, expanded) {
|
|
2428
|
+
if (this.isLazy) {
|
|
2429
|
+
// console.log('expandChange==row, expanded', row, expanded, this.$refs.superGrid.store.states)
|
|
2430
|
+
if (expanded === false) {
|
|
2431
|
+
// 折叠时清空表格缓存的已加载的标识位,使其能够动态更新子集合
|
|
2432
|
+
// 必须添加这句,否则不会重新走load
|
|
2433
|
+
if (this.$refs.superGrid.store.states.treeData) {
|
|
2434
|
+
this.$refs.superGrid.store.states.treeData[
|
|
2435
|
+
row.id ? row.id : row.ID
|
|
2436
|
+
].loaded = false
|
|
2437
|
+
}
|
|
2438
|
+
} else {
|
|
2439
|
+
// console.log('expandChange=this.$refs.superGrid.store.states.lazyTreeNodeMap', this.$refs.superGrid.store.states.lazyTreeNodeMap)
|
|
2440
|
+
// console.log('expandChange=this.$refs.superGrid.store.states.treeData', this.$refs.superGrid.store.states.treeData)
|
|
2441
|
+
// console.log('expandChange=this.$refs.superGrid.store.states.selection', this.$refs.superGrid.store.states.selection)
|
|
2442
|
+
}
|
|
2443
|
+
}
|
|
2444
|
+
},
|
|
2445
|
+
removeGridStoreSelection(parentRowIds) {
|
|
2446
|
+
let selection = []
|
|
2447
|
+
if (this.$refs.superGrid.store.states.selection) {
|
|
2448
|
+
selection = [].concat(
|
|
2449
|
+
JSON.parse(
|
|
2450
|
+
JSON.stringify(this.$refs.superGrid.store.states.selection)
|
|
2451
|
+
)
|
|
2452
|
+
)
|
|
2453
|
+
}
|
|
2454
|
+
for (let i = 0; i < selection.length; i++) {
|
|
2455
|
+
if (
|
|
2456
|
+
parentRowIds &&
|
|
2457
|
+
parentRowIds.indexOf(selection[i][this.parentProp]) >= 0
|
|
2458
|
+
) {
|
|
2459
|
+
// 移除第i个元素
|
|
2460
|
+
this.$refs.superGrid.store.states.selection.splice(i, 1)
|
|
2461
|
+
if (this.$refs.superGrid.store.states.selection.length > 0) {
|
|
2462
|
+
this.removeGridStoreSelection(parentRowIds)
|
|
2463
|
+
}
|
|
2464
|
+
break
|
|
2465
|
+
}
|
|
2466
|
+
}
|
|
2467
|
+
},
|
|
2468
|
+
changeHederWidth(newWidth, oldWidth, column, event) {
|
|
2469
|
+
const newCellWidth = newWidth - 5
|
|
2470
|
+
let myNewWidth = newCellWidth
|
|
2471
|
+
this.dragColumnProp = column.property
|
|
2472
|
+
const gridParams = store.get(this.code)
|
|
2473
|
+
if (isHasOptionFunction('resizeColumn', this.code)) {
|
|
2474
|
+
const newWidth = gridParams.options.resizeColumn.call(this, {
|
|
2475
|
+
code: this.code,
|
|
2476
|
+
newWidth: newWidth,
|
|
2477
|
+
oldWidth: oldWidth,
|
|
2478
|
+
column: column,
|
|
2479
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
2480
|
+
})
|
|
2481
|
+
if (newWidth) {
|
|
2482
|
+
myNewWidth = newWidth
|
|
2483
|
+
}
|
|
2484
|
+
}
|
|
2485
|
+
this.newWidth = Math.ceil(myNewWidth)
|
|
2486
|
+
if (
|
|
2487
|
+
typeof this.options.isAdministerListView !== 'undefined' &&
|
|
2488
|
+
this.options.isAdministerListView != null &&
|
|
2489
|
+
this.options.isAdministerListView === true
|
|
2490
|
+
) {
|
|
2491
|
+
// 表示是列表字段配置时
|
|
2492
|
+
$emit(this, 'changeHederWidth', this.newWidth)
|
|
2493
|
+
} else {
|
|
2494
|
+
// 应用模式时
|
|
2495
|
+
// 保存拖动后的列宽
|
|
2496
|
+
this.saveColumnWidth(this.dragColumnProp, this.newWidth).then(() => {
|
|
2497
|
+
const items = this.getColumnByElementColumn(column)
|
|
2498
|
+
if (items && items.length > 0) {
|
|
2499
|
+
items[0].widthType = 'custom'
|
|
2500
|
+
items[0].width = this.newWidth + ''
|
|
2501
|
+
}
|
|
2502
|
+
})
|
|
2503
|
+
}
|
|
2504
|
+
},
|
|
2505
|
+
resetSearch() {
|
|
2506
|
+
let searchForm = null
|
|
2507
|
+
if (this.toolbarFieldParam && this.toolbarFieldParam.length > 0) {
|
|
2508
|
+
searchForm = this.toolbarFieldParam
|
|
2509
|
+
}
|
|
2510
|
+
// 修改当前页为第1页
|
|
2511
|
+
this.currentPage = 1
|
|
2512
|
+
this.search(searchForm, false)
|
|
2513
|
+
},
|
|
2514
|
+
// 获取列信息
|
|
2515
|
+
getColumnInformation() {
|
|
2516
|
+
return this.visibleColumns
|
|
2517
|
+
},
|
|
2518
|
+
// 点击表头触发回调
|
|
2519
|
+
headerClick(column, event) {
|
|
2520
|
+
// 三种类型
|
|
2521
|
+
const items = this.getColumnByElementColumn(column)
|
|
2522
|
+
if (items && items.length > 0) {
|
|
2523
|
+
$emit(this, 'header-click', items[0])
|
|
2524
|
+
this.changeHeaderStyleTwo(items[0])
|
|
2525
|
+
} else {
|
|
2526
|
+
$emit(this, 'header-click', null)
|
|
2527
|
+
}
|
|
2528
|
+
this.clearHeaderContextmenu()
|
|
2529
|
+
},
|
|
2530
|
+
changeHeaderStyleTwo(item) {
|
|
2531
|
+
// 改变options中的配置
|
|
2532
|
+
// 还原所有颜色(隐藏字段判断,设置为灰色;选中字段设置为蓝色)
|
|
2533
|
+
if (
|
|
2534
|
+
typeof this.options.isAdministerListView !== 'undefined' &&
|
|
2535
|
+
this.options.isAdministerListView != null &&
|
|
2536
|
+
this.options.isAdministerListView === true
|
|
2537
|
+
) {
|
|
2538
|
+
this.createBackgroundColorMap()
|
|
2539
|
+
this.backgroundColorMap[item.prop] = '#409EFF'
|
|
2540
|
+
if (this.$refs && this.$refs.superGrid) {
|
|
2541
|
+
this.$refs.superGrid.doLayout()
|
|
2542
|
+
}
|
|
2543
|
+
}
|
|
2544
|
+
},
|
|
2545
|
+
// 编辑模式下创建一个对象,存储各个表头的背景色
|
|
2546
|
+
createBackgroundColorMap() {
|
|
2547
|
+
const items = this.getColumnInformation()
|
|
2548
|
+
const backgroundColorMap = {}
|
|
2549
|
+
if (items && items.length > 0) {
|
|
2550
|
+
for (var i = 0; i < items.length; i++) {
|
|
2551
|
+
const item = items[i]
|
|
2552
|
+
if (item.show === undefined || item.show) {
|
|
2553
|
+
// 表示显示
|
|
2554
|
+
} else {
|
|
2555
|
+
backgroundColorMap[item.prop] = '#808080'
|
|
2556
|
+
}
|
|
2557
|
+
if (
|
|
2558
|
+
this.backgroundColorMap &&
|
|
2559
|
+
this.backgroundColorMap[item.prop] === '#409EFF' &&
|
|
2560
|
+
this.externalClickFlag
|
|
2561
|
+
) {
|
|
2562
|
+
backgroundColorMap[item.prop] = '#409EFF'
|
|
2563
|
+
}
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2566
|
+
this.backgroundColorMap = backgroundColorMap
|
|
2567
|
+
this.externalClickFlag = false
|
|
2568
|
+
if (this.$refs && this.$refs.superGrid) {
|
|
2569
|
+
this.$refs.superGrid.doLayout()
|
|
2570
|
+
}
|
|
2571
|
+
},
|
|
2572
|
+
// 根据element事件传递的column来获取自定义封装的column
|
|
2573
|
+
getColumnByElementColumn(column) {
|
|
2574
|
+
let items = null
|
|
2575
|
+
if (column.type && column.type === 'selection') {
|
|
2576
|
+
// 表示为选择框
|
|
2577
|
+
items = this.visibleColumns.filter((item) => {
|
|
2578
|
+
return item.prop === '$selection'
|
|
2579
|
+
})
|
|
2580
|
+
} else if (column.type && column.type === 'default' && !column.property) {
|
|
2581
|
+
// 表示为序号
|
|
2582
|
+
items = this.visibleColumns.filter((item) => {
|
|
2583
|
+
return item.prop === '$index'
|
|
2584
|
+
})
|
|
2585
|
+
} else if (column.property) {
|
|
2586
|
+
// 表示为普通字段
|
|
2587
|
+
items = this.visibleColumns.filter((item) => {
|
|
2588
|
+
return column.property === item.prop
|
|
2589
|
+
})
|
|
2590
|
+
}
|
|
2591
|
+
return items
|
|
2592
|
+
},
|
|
2593
|
+
// 右键表头
|
|
2594
|
+
headerContextmenu(column, event) {
|
|
2595
|
+
// 阻止鼠标的默认事件
|
|
2596
|
+
event.preventDefault()
|
|
2597
|
+
const items = this.getColumnByElementColumn(column)
|
|
2598
|
+
if (items && items.length > 0) {
|
|
2599
|
+
const item = items[0]
|
|
2600
|
+
$emit(this, 'header-click', items[0])
|
|
2601
|
+
this.changeHeaderStyleTwo(items[0])
|
|
2602
|
+
this.showHeaderContextmenu = true
|
|
2603
|
+
this.rightClickColumn = item
|
|
2604
|
+
this.$nextTick(() => {
|
|
2605
|
+
const menu = this.$refs.headerMenu.$el
|
|
2606
|
+
const scrollTop =
|
|
2607
|
+
document.documentElement.scrollTop || document.body.scrollTop
|
|
2608
|
+
menu.style.display = 'block'
|
|
2609
|
+
menu.style.left = event.clientX + 'px'
|
|
2610
|
+
// 当滑动滚动条时也能准确获取菜单位置
|
|
2611
|
+
menu.style.top = event.clientY + scrollTop - 10 + 'px'
|
|
2612
|
+
})
|
|
2613
|
+
}
|
|
2614
|
+
},
|
|
2615
|
+
// 清除右键菜单显示
|
|
2616
|
+
clearHeaderContextmenu() {
|
|
2617
|
+
this.showHeaderContextmenu = false
|
|
2618
|
+
this.rightClickColumn = null
|
|
2619
|
+
},
|
|
2620
|
+
// 返回表单子表模式下数据
|
|
2621
|
+
validatorSunTableListData() {
|
|
2622
|
+
// 返回之前需要进行规则校验
|
|
2623
|
+
let gridData = this.gridData
|
|
2624
|
+
if (this.isSubTableShowPage) {
|
|
2625
|
+
gridData = this.subTableData
|
|
2626
|
+
}
|
|
2627
|
+
if (gridData && gridData.length > 0) {
|
|
2628
|
+
const pageSize = this.pagination && this.pagination.pageSize
|
|
2629
|
+
const validateRules = formValidatorService.getValidator(this.code)
|
|
2630
|
+
for (let i = 0; i < gridData.length; i++) {
|
|
2631
|
+
const row = gridData[i]
|
|
2632
|
+
// 取消最后一个编辑行的状态
|
|
2633
|
+
if (row.$editing !== undefined && row.$editing === true) {
|
|
2634
|
+
setEntityFieldValue(row, '$editing', false)
|
|
2635
|
+
// 取消上一行选中状态时,触发un-edit事件,处理下拉多选选项组问题
|
|
2636
|
+
$emit(eventBus, 'un-edit', { row: row })
|
|
2637
|
+
}
|
|
2638
|
+
let needValidate = true
|
|
2639
|
+
if (isHasEditOption('isEnableValidate', this.code)) {
|
|
2640
|
+
// 表示配置了是否启用必填验证
|
|
2641
|
+
needValidate =
|
|
2642
|
+
this.gridParams.options.lineEditOptions['isEnableValidate']
|
|
2643
|
+
}
|
|
2644
|
+
let validateResult = true
|
|
2645
|
+
if (needValidate === true) {
|
|
2646
|
+
let pageNum
|
|
2647
|
+
// 每页的记录下标,提示时使用
|
|
2648
|
+
let pageRowIndex
|
|
2649
|
+
if (
|
|
2650
|
+
this.isSubTableShowPage &&
|
|
2651
|
+
pageSize !== undefined &&
|
|
2652
|
+
pageSize > 0
|
|
2653
|
+
) {
|
|
2654
|
+
pageNum = Math.ceil((i + 1) / pageSize)
|
|
2655
|
+
pageRowIndex = i + 1 - (pageNum - 1) * pageSize
|
|
2656
|
+
}
|
|
2657
|
+
validateResult = formValidatorService.validator(
|
|
2658
|
+
row,
|
|
2659
|
+
this.code,
|
|
2660
|
+
i,
|
|
2661
|
+
validateRules,
|
|
2662
|
+
this.isSubTableShowPage,
|
|
2663
|
+
pageNum,
|
|
2664
|
+
pageRowIndex
|
|
2665
|
+
)
|
|
2666
|
+
}
|
|
2667
|
+
if (validateResult !== null && validateResult !== undefined) {
|
|
2668
|
+
if (
|
|
2669
|
+
typeof validateResult === 'string' ||
|
|
2670
|
+
validateResult === false
|
|
2671
|
+
) {
|
|
2672
|
+
return false
|
|
2673
|
+
}
|
|
2674
|
+
}
|
|
2675
|
+
}
|
|
2676
|
+
return true
|
|
2677
|
+
}
|
|
2678
|
+
return true
|
|
2679
|
+
},
|
|
2680
|
+
getSunTableListData() {
|
|
2681
|
+
return this.isSubTableShowPage ? this.subTableData : this.gridData
|
|
2682
|
+
},
|
|
2683
|
+
rowDblclickEvent(row, column, event) {
|
|
2684
|
+
const gridParams = store.get(this.code)
|
|
2685
|
+
if (
|
|
2686
|
+
gridParams.options &&
|
|
2687
|
+
gridParams.options.isFormSubTable &&
|
|
2688
|
+
gridParams.options.isPdfEditor
|
|
2689
|
+
) {
|
|
2690
|
+
// 如果是子表并且是pdf模式
|
|
2691
|
+
} else if (this.isFormSubTable) {
|
|
2692
|
+
// 表示是表单的子表,点击时需要将当前行设为行编辑状态,并保存上一行的记录(不是保存到数据库,只是把编辑状态改为false)
|
|
2693
|
+
if (column.property &&
|
|
2694
|
+
column.property !== 'operation') {
|
|
2695
|
+
let canEdit = true
|
|
2696
|
+
const gridParams = store.get(this.code)
|
|
2697
|
+
if (isEditOptionFunction('beforeEdit', this.code)) {
|
|
2698
|
+
const isSubTableShowPage = gridParams.isSubTableShowPage
|
|
2699
|
+
// 每页显示多少条
|
|
2700
|
+
const pageSize = gridParams.pagination && gridParams.pagination.pageSize
|
|
2701
|
+
canEdit = gridParams.options.lineEditOptions.beforeEdit.call(this, {
|
|
2702
|
+
gridData: isSubTableShowPage ? gridParams.subTableData : gridParams.gridData,
|
|
2703
|
+
listCode: this.code,
|
|
2704
|
+
entity: row,
|
|
2705
|
+
columns: gridParams.columns,
|
|
2706
|
+
isMobile: false,
|
|
2707
|
+
pageGridData: isSubTableShowPage ? gridParams.gridData : null,
|
|
2708
|
+
pageSize,
|
|
2709
|
+
additionalParamMap: gridParams.additionalParamMap
|
|
2710
|
+
})
|
|
2711
|
+
}
|
|
2712
|
+
if (isPromise(canEdit)) {
|
|
2713
|
+
canEdit.then((result) => {
|
|
2714
|
+
if (result === undefined || result === true) {
|
|
2715
|
+
this.rowDbClickEditRow(gridParams, row)
|
|
2716
|
+
}
|
|
2717
|
+
})
|
|
2718
|
+
} else {
|
|
2719
|
+
if (canEdit === undefined || canEdit === true) {
|
|
2720
|
+
this.rowDbClickEditRow(gridParams, row)
|
|
2721
|
+
}
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2724
|
+
} else {
|
|
2725
|
+
if (row) {
|
|
2726
|
+
if (
|
|
2727
|
+
gridParams &&
|
|
2728
|
+
gridParams.lineEdit &&
|
|
2729
|
+
gridParams.lineEdit.editable &&
|
|
2730
|
+
gridParams.canntEdit
|
|
2731
|
+
) {
|
|
2732
|
+
let index = this.gridData.findIndex(function (item) {
|
|
2733
|
+
return (
|
|
2734
|
+
(item.id && item.id === row.id) ||
|
|
2735
|
+
(item.ID && item.ID === row.ID)
|
|
2736
|
+
)
|
|
2737
|
+
})
|
|
2738
|
+
if (index < 0) {
|
|
2739
|
+
index = 0
|
|
2740
|
+
}
|
|
2741
|
+
this.editRow(index)
|
|
2742
|
+
}
|
|
2743
|
+
}
|
|
2744
|
+
}
|
|
2745
|
+
this.rowDblClick(row, column, event)
|
|
2746
|
+
},
|
|
2747
|
+
rowDbClickEditRow(gridParams, row) {
|
|
2748
|
+
// 取消上一行的编辑状态
|
|
2749
|
+
let editRows
|
|
2750
|
+
if (this.isSubTableShowPage) {
|
|
2751
|
+
editRows = this.subTableData.filter(
|
|
2752
|
+
row => row.$editing !== undefined && row.$editing === true
|
|
2753
|
+
)
|
|
2754
|
+
} else {
|
|
2755
|
+
editRows = this.gridData.filter(
|
|
2756
|
+
row => row.$editing !== undefined && row.$editing === true
|
|
2757
|
+
)
|
|
2758
|
+
}
|
|
2759
|
+
if (editRows && editRows.length > 0) {
|
|
2760
|
+
editRows.forEach(editRow => {
|
|
2761
|
+
setEntityFieldValue(editRow, '$editing', false)
|
|
2762
|
+
// 取消上一行选中状态时,触发un-edit事件,处理下拉多选选项组问题
|
|
2763
|
+
eventBus.$emit('un-edit', { row: editRow })
|
|
2764
|
+
// this.$set(editRow, '$editing', false)
|
|
2765
|
+
})
|
|
2766
|
+
}
|
|
2767
|
+
gridParams.isEditRow = false
|
|
2768
|
+
setEntityFieldValue(row, '$editing', true)
|
|
2769
|
+
gridParams.$editRow = row
|
|
2770
|
+
// this.$set(row, '$editing', true)
|
|
2771
|
+
gridParams.isEditRow = true
|
|
2772
|
+
},
|
|
2773
|
+
rowClickEvent(row, column, event) {
|
|
2774
|
+
// if (
|
|
2775
|
+
// this.isFormSubTable &&
|
|
2776
|
+
// column.property &&
|
|
2777
|
+
// column.property !== 'operation'
|
|
2778
|
+
// ) {
|
|
2779
|
+
// // 表示是表单的子表,点击时需要将当前行设为行编辑状态,并保存上一行的记录(不是保存到数据库,只是把编辑状态改为false)
|
|
2780
|
+
// // 取消上一行的编辑状态
|
|
2781
|
+
// const gridParams = store.get(this.code)
|
|
2782
|
+
// const editRows = this.gridData.filter(
|
|
2783
|
+
// row => row.$editing !== undefined && row.$editing === true
|
|
2784
|
+
// )
|
|
2785
|
+
// if (editRows && editRows.length > 0) {
|
|
2786
|
+
// editRows.forEach(editRow => {
|
|
2787
|
+
// this.$set(editRow, '$editing', false)
|
|
2788
|
+
// })
|
|
2789
|
+
// }
|
|
2790
|
+
// gridParams.isEditRow = false
|
|
2791
|
+
// this.$set(row, '$editing', true)
|
|
2792
|
+
// gridParams.isEditRow = true
|
|
2793
|
+
// }
|
|
2794
|
+
// this.rowClick(row, column, event)
|
|
2795
|
+
},
|
|
2796
|
+
openPageDialog(openPageParams) {
|
|
2797
|
+
let jumpMode
|
|
2798
|
+
if (openPageParams) {
|
|
2799
|
+
jumpMode = openPageParams.jumpMode
|
|
2800
|
+
}
|
|
2801
|
+
const popPageSetting = openPageParams
|
|
2802
|
+
if (jumpMode === 'popup') {
|
|
2803
|
+
// 弹出页面
|
|
2804
|
+
this.jumpPageSetting = popPageSetting
|
|
2805
|
+
this.$emit('open-grid-dialog', this.jumpPageSetting)
|
|
2806
|
+
this.isShowPageDialog = true
|
|
2807
|
+
} else if (jumpMode === 'refresh') {
|
|
2808
|
+
this.$router.push({ path: '/dsc/page', query: popPageSetting })
|
|
2809
|
+
}
|
|
2810
|
+
},
|
|
2811
|
+
closeSearchFormDialog() {
|
|
2812
|
+
this.showSearch = false
|
|
2813
|
+
},
|
|
2814
|
+
// 获取当前列表的查询方式,page项目使用
|
|
2815
|
+
getQueryMode() {
|
|
2816
|
+
if (this.query && this.query.showType === 'popup') {
|
|
2817
|
+
return 'popup'
|
|
2818
|
+
} else {
|
|
2819
|
+
return 'embedded'
|
|
2820
|
+
}
|
|
2821
|
+
},
|
|
2822
|
+
selectCell(row, column, cell, event) {
|
|
2823
|
+
if (cell) {
|
|
2824
|
+
this.cellClick(row, column, cell, event)
|
|
2825
|
+
this.$nextTick(() => {
|
|
2826
|
+
cell.style['border'] = '2px solid #409EFF'
|
|
2827
|
+
this.currentSelectCell = cell
|
|
2828
|
+
})
|
|
2829
|
+
}
|
|
2830
|
+
},
|
|
2831
|
+
// 刷新列表数据
|
|
2832
|
+
refreshGridData() {
|
|
2833
|
+
this.refresh(false, true)
|
|
2834
|
+
},
|
|
2835
|
+
// 刷新列表数据
|
|
2836
|
+
refresData(data) {
|
|
2837
|
+
const gridParams = store.get(this.code)
|
|
2838
|
+
gridParams.gridData = data
|
|
2839
|
+
store.set(this.code, gridParams)
|
|
2840
|
+
if (this.parentFormData) {
|
|
2841
|
+
this.parentFormData[this.code] = data
|
|
2842
|
+
}
|
|
2843
|
+
this['gridData'] = data
|
|
2844
|
+
},
|
|
2845
|
+
refresPortData(port, value, index) {
|
|
2846
|
+
if (this.gridData[index]) {
|
|
2847
|
+
this.gridData[index][port] = value
|
|
2848
|
+
this.$forceUpdate()
|
|
2849
|
+
}
|
|
2850
|
+
},
|
|
2851
|
+
|
|
2852
|
+
refresPortsData(entity, index) {
|
|
2853
|
+
if (entity) {
|
|
2854
|
+
for (const key in entity) {
|
|
2855
|
+
if (this.gridData[index]) {
|
|
2856
|
+
this.gridData[index][key] = entity[key]
|
|
2857
|
+
this.$forceUpdate()
|
|
2858
|
+
console.log('this.$forceUpdate()', this.$refs[key])
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
// entity.forEach(item => {
|
|
2862
|
+
// if (this.gridData[index]) {
|
|
2863
|
+
// this.$set(this.gridData[index], item.prop, item.value)
|
|
2864
|
+
// }
|
|
2865
|
+
// })
|
|
2866
|
+
}
|
|
2867
|
+
},
|
|
2868
|
+
refresMainTableFields(map) {
|
|
2869
|
+
$emit(this, 'refresMainTableFields', map)
|
|
2870
|
+
},
|
|
2871
|
+
openFold(isOpen) {
|
|
2872
|
+
this.resizeTableHeight()
|
|
2873
|
+
},
|
|
2874
|
+
// 设置字段禁止编辑
|
|
2875
|
+
fnProhibitToEdit(entity) {
|
|
2876
|
+
if (entity) {
|
|
2877
|
+
if (entity.isForceUpdate) {
|
|
2878
|
+
this.$emit('fn-prohibit-to-edit', entity)
|
|
2879
|
+
}
|
|
2880
|
+
for (const key in entity) {
|
|
2881
|
+
// console.log('key', key)
|
|
2882
|
+
// console.log('this.$refs[key]', this.$refs)
|
|
2883
|
+
if (this.$refs[key]) {
|
|
2884
|
+
this.$refs[key][0].fnProhibitToEdit(entity[key])
|
|
2885
|
+
}
|
|
2886
|
+
}
|
|
2887
|
+
}
|
|
2888
|
+
},
|
|
2889
|
+
// 设置字段禁止编辑
|
|
2890
|
+
prohibitToEdit(entity) {
|
|
2891
|
+
this.fnProhibitToEdit(entity)
|
|
2892
|
+
},
|
|
2893
|
+
// 树形结构时数据展示
|
|
2894
|
+
getTreeProps(parentProp, isSql, isLazy, dataSourceType) {
|
|
2895
|
+
let treeProps = {
|
|
2896
|
+
children: 'children',
|
|
2897
|
+
hasChildren: '_has_children',
|
|
2898
|
+
}
|
|
2899
|
+
if (parentProp) {
|
|
2900
|
+
treeProps = {
|
|
2901
|
+
children: 'children',
|
|
2902
|
+
}
|
|
2903
|
+
let hasChildren = 'hasChildren'
|
|
2904
|
+
if (isLazy) {
|
|
2905
|
+
if (isSql) {
|
|
2906
|
+
if (dataSourceType === 'oracle') {
|
|
2907
|
+
hasChildren = 'HAS_CHILDREN'
|
|
2908
|
+
} else {
|
|
2909
|
+
hasChildren = 'has_children'
|
|
2910
|
+
}
|
|
2911
|
+
}
|
|
2912
|
+
}
|
|
2913
|
+
treeProps.hasChildren = hasChildren
|
|
2914
|
+
}
|
|
2915
|
+
return treeProps
|
|
2916
|
+
},
|
|
2917
|
+
refreshSubTableData(data) {
|
|
2918
|
+
const gridParams = store.get(this.code)
|
|
2919
|
+
gridParams.subTableData = data
|
|
2920
|
+
store.set(this.code, gridParams)
|
|
2921
|
+
this['subTableData'] = data
|
|
2922
|
+
},
|
|
2923
|
+
// 选择记录
|
|
2924
|
+
selectRecord(selection, row){
|
|
2925
|
+
let selectRecordEventResult = true
|
|
2926
|
+
const gridParams = store.get(this.code)
|
|
2927
|
+
if (isHasOptionFunction('selectRecord', this.code)) {
|
|
2928
|
+
selectRecordEventResult = gridParams.options.selectRecord.call(this, {
|
|
2929
|
+
gridData: this.isSubTableShowPage
|
|
2930
|
+
? this.subTableData
|
|
2931
|
+
: this.gridData,
|
|
2932
|
+
columns: gridParams.columns,
|
|
2933
|
+
superGrid: this.$refs.superGrid,
|
|
2934
|
+
pageGridData: this.isSubTableShowPage
|
|
2935
|
+
? this.gridData
|
|
2936
|
+
: null,
|
|
2937
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
2938
|
+
selection: selection,
|
|
2939
|
+
row: row,
|
|
2940
|
+
parentFormData: this.parentFormData
|
|
2941
|
+
})
|
|
2942
|
+
if(selectRecordEventResult !== undefined && selectRecordEventResult=== false){
|
|
2943
|
+
// 最后选中的记录取消选中状态
|
|
2944
|
+
this.$refs.superGrid.toggleRowSelection(row, false)
|
|
2945
|
+
}
|
|
2946
|
+
}
|
|
2947
|
+
this.select(selection, row)
|
|
2948
|
+
},
|
|
2949
|
+
// 取消选择记录
|
|
2950
|
+
selectAllRecord(selection){
|
|
2951
|
+
let selectAllRecordsEventResult = true
|
|
2952
|
+
const gridParams = store.get(this.code)
|
|
2953
|
+
if (isHasOptionFunction('selectAllRecords', this.code)) {
|
|
2954
|
+
selectAllRecordsEventResult = gridParams.options.selectAllRecords.call(this, {
|
|
2955
|
+
gridData: this.isSubTableShowPage
|
|
2956
|
+
? this.subTableData
|
|
2957
|
+
: this.gridData,
|
|
2958
|
+
columns: gridParams.columns,
|
|
2959
|
+
superGrid: this.$refs.superGrid,
|
|
2960
|
+
pageGridData: this.isSubTableShowPage
|
|
2961
|
+
? this.gridData
|
|
2962
|
+
: null,
|
|
2963
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
2964
|
+
selection: selection,
|
|
2965
|
+
parentFormData: this.parentFormData
|
|
2966
|
+
})
|
|
2967
|
+
if(selectAllRecordsEventResult !== undefined && selectAllRecordsEventResult=== false){
|
|
2968
|
+
// 取消所有记录选中状态
|
|
2969
|
+
this.$refs.superGrid.toggleAllSelection()
|
|
2970
|
+
}
|
|
2971
|
+
}
|
|
2972
|
+
this.selectAll(selection)
|
|
2973
|
+
},
|
|
2974
|
+
// 选择记录发生改变时
|
|
2975
|
+
selectionChangeEvent(newSelection){
|
|
2976
|
+
const gridParams = store.get(this.code)
|
|
2977
|
+
if (isHasOptionFunction('selectionChange', this.code)) {
|
|
2978
|
+
gridParams.options.selectionChange.call(this, {
|
|
2979
|
+
gridData: this.isSubTableShowPage
|
|
2980
|
+
? this.subTableData
|
|
2981
|
+
: this.gridData,
|
|
2982
|
+
columns: gridParams.columns,
|
|
2983
|
+
superGrid: this.$refs.superGrid,
|
|
2984
|
+
pageGridData: this.isSubTableShowPage
|
|
2985
|
+
? this.gridData
|
|
2986
|
+
: null,
|
|
2987
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
2988
|
+
selection: newSelection,
|
|
2989
|
+
parentFormData: this.parentFormData
|
|
2990
|
+
})
|
|
2991
|
+
// if(selectionChangeEventResult !== undefined && selectionChangeEventResult=== false){
|
|
2992
|
+
// // 最后选中的记录取消选中状态
|
|
2993
|
+
// this.$refs.superGrid.toggleRowSelection(newSelection[newSelection.length - 1], false)
|
|
2994
|
+
// }
|
|
2995
|
+
}
|
|
2996
|
+
this.selectionChange(newSelection)
|
|
2997
|
+
},
|
|
2998
|
+
},
|
|
2999
|
+
emits: [
|
|
3000
|
+
'change-grid-data',
|
|
3001
|
+
'change-rows-per-page',
|
|
3002
|
+
'set-select-options',
|
|
3003
|
+
'setSearchType',
|
|
3004
|
+
'sort-change',
|
|
3005
|
+
'changeHederWidth',
|
|
3006
|
+
'header-click',
|
|
3007
|
+
'un-edit',
|
|
3008
|
+
'refresMainTableFields',
|
|
3009
|
+
'refresh',
|
|
3010
|
+
'cancel-search',
|
|
3011
|
+
,
|
|
3012
|
+
],
|
|
3013
|
+
}
|
|
3014
|
+
</script>
|
|
3015
|
+
|
|
3016
|
+
<style lang="scss" rel="stylesheet/scss" scoped>
|
|
3017
|
+
.grid-area {
|
|
3018
|
+
.elTable th {
|
|
3019
|
+
padding: 2px 0 !important;
|
|
3020
|
+
}
|
|
3021
|
+
.elTable td {
|
|
3022
|
+
padding: 2px 0 !important;
|
|
3023
|
+
}
|
|
3024
|
+
}
|
|
3025
|
+
</style>
|