@kyfe/ks-query-table 0.0.21 → 0.0.22
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/.bitmap +38 -0
- package/.editorconfig +5 -0
- package/.env.dev +2 -0
- package/.env.gray +2 -0
- package/.env.prod +2 -0
- package/.env.stg +3 -0
- package/.env.uat +2 -0
- package/.eslintignore +1 -0
- package/.eslintrc.js +25 -0
- package/.gitmodules +4 -0
- package/.prettierrc +11 -0
- package/README.md +15 -0
- package/babel.config.js +10 -0
- package/build-apm.sh +9 -0
- package/build.sh +16 -0
- package/config/index.js +20 -0
- package/jsconfig.json +7 -0
- package/kuasheng-sdk/index.js +80 -0
- package/kuasheng-sdk/lib/assets.js +304 -0
- package/kuasheng-sdk/lib/context.js +199 -0
- package/kuasheng-sdk/lib/layout.js +346 -0
- package/kuasheng-sdk/lib/location.js +46 -0
- package/kuasheng-sdk/lib/media.js +342 -0
- package/kuasheng-sdk/lib/navigation.js +30 -0
- package/kuasheng-sdk/lib/request.js +76 -0
- package/kuasheng-sdk/lib/system.js +190 -0
- package/kuasheng-sdk/lib/userinfo.js +98 -0
- package/kuasheng-sdk/util/check.js +102 -0
- package/kuasheng-sdk/util/config.js +47 -0
- package/kuasheng-sdk/util/device.js +25 -0
- package/kuasheng-sdk/util/error.js +19 -0
- package/kuasheng-sdk/util/funtional.js +153 -0
- package/kuasheng-sdk/util/mixin.js +36 -0
- package/kuasheng-sdk/util/requestUtil.js +41 -0
- package/kuasheng-sdk/util/response.js +33 -0
- package/kuasheng-sdk/util/warn.js +35 -0
- package/kuasheng-ui/CHANGELOG.md +9 -0
- package/kuasheng-ui/components/card.vue +57 -0
- package/kuasheng-ui/components/ks-area-select/README.md +43 -0
- package/kuasheng-ui/components/ks-area-select/area-picker.vue +554 -0
- package/kuasheng-ui/components/ks-area-select/area-search.vue +363 -0
- package/kuasheng-ui/components/ks-area-select/areas-pop.vue +56 -0
- package/kuasheng-ui/components/ks-area-select/common.js +183 -0
- package/kuasheng-ui/components/ks-area-select/index.vue +355 -0
- package/kuasheng-ui/components/ks-area-select/mixins.js +216 -0
- package/kuasheng-ui/components/ks-area-single-select/README.md +50 -0
- package/kuasheng-ui/components/ks-area-single-select/hot-city.js +45 -0
- package/kuasheng-ui/components/ks-area-single-select/index.vue +324 -0
- package/kuasheng-ui/components/ks-calendar/index.vue +269 -0
- package/kuasheng-ui/components/ks-call-phone/call-tips.vue +70 -0
- package/kuasheng-ui/components/ks-call-phone/call.vue +178 -0
- package/kuasheng-ui/components/ks-call-phone/index.js +48 -0
- package/kuasheng-ui/components/ks-call-phone/index.vue +131 -0
- package/kuasheng-ui/components/ks-call-phone//345/221/274/345/217/253/347/273/204/344/273/266.md +0 -0
- package/kuasheng-ui/components/ks-date-picker/README.md +23 -0
- package/kuasheng-ui/components/ks-date-picker/date-picker-bottom.vue +123 -0
- package/kuasheng-ui/components/ks-date-picker/date-picker-dropdown.vue +80 -0
- package/kuasheng-ui/components/ks-date-picker/date-picker-right.vue +87 -0
- package/kuasheng-ui/components/ks-date-picker/date-picker-top.vue +88 -0
- package/kuasheng-ui/components/ks-date-picker/date-picker.js +15 -0
- package/kuasheng-ui/components/ks-date-picker/date-range-select.vue +92 -0
- package/kuasheng-ui/components/ks-date-picker/date-select.vue +65 -0
- package/kuasheng-ui/components/ks-date-picker/date-week-month.vue +131 -0
- package/kuasheng-ui/components/ks-date-picker/index.js +12 -0
- package/kuasheng-ui/components/ks-date-picker/mixin.js +92 -0
- package/kuasheng-ui/components/ks-date-picker/month-range-select.vue +129 -0
- package/kuasheng-ui/components/ks-date-picker/month-select.vue +85 -0
- package/kuasheng-ui/components/ks-date-picker/quarter-select.vue +94 -0
- package/kuasheng-ui/components/ks-date-picker/style.less +121 -0
- package/kuasheng-ui/components/ks-date-picker/utils.js +109 -0
- package/kuasheng-ui/components/ks-date-picker/week-select.vue +99 -0
- package/kuasheng-ui/components/ks-decrypt/index.vue +159 -0
- package/kuasheng-ui/components/ks-employee/README.md +78 -0
- package/kuasheng-ui/components/ks-employee/employee-input.vue +173 -0
- package/kuasheng-ui/components/ks-employee/employee-list.vue +662 -0
- package/kuasheng-ui/components/ks-employee/employee-popup.vue +197 -0
- package/kuasheng-ui/components/ks-employee/employee-search.vue +250 -0
- package/kuasheng-ui/components/ks-employee/employee-selected.vue +173 -0
- package/kuasheng-ui/components/ks-employee/index.js +17 -0
- package/kuasheng-ui/components/ks-employee/package-lock.json +5 -0
- package/kuasheng-ui/components/ks-employee/package.json +15 -0
- package/kuasheng-ui/components/ks-employee/yarn.lock +4 -0
- package/kuasheng-ui/components/ks-field-money/index.js +8 -0
- package/kuasheng-ui/components/ks-field-money/index.vue +212 -0
- package/kuasheng-ui/components/ks-field-money/package.json +11 -0
- package/kuasheng-ui/components/ks-field-money/utils.js +65 -0
- package/kuasheng-ui/components/ks-field-money//351/207/221/351/242/235/350/275/254/346/215/242/345/231/250.md +0 -0
- package/kuasheng-ui/components/ks-history-search/history-input.vue +131 -0
- package/kuasheng-ui/components/ks-history-search/history-list.vue +188 -0
- package/kuasheng-ui/components/ks-history-search/img/delete.png +0 -0
- package/kuasheng-ui/components/ks-history-search/index.js +9 -0
- package/kuasheng-ui/components/ks-history-search/index.vue +125 -0
- package/kuasheng-ui/components/ks-history-search/package-lock.json +5 -0
- package/kuasheng-ui/components/ks-history-search/package.json +15 -0
- package/kuasheng-ui/components/ks-history-search/utils.js +35 -0
- package/kuasheng-ui/components/ks-input-search/index.vue +106 -0
- package/kuasheng-ui/components/ks-list/index.vue +75 -0
- package/kuasheng-ui/components/ks-loading/index.js +16 -0
- package/kuasheng-ui/components/ks-month/index.vue +47 -0
- package/kuasheng-ui/components/ks-month/package.json +3 -0
- package/kuasheng-ui/components/ks-month/range.vue +172 -0
- package/kuasheng-ui/components/ks-month/single.vue +136 -0
- package/kuasheng-ui/components/ks-month/style.less +125 -0
- package/kuasheng-ui/components/ks-month/utils.js +35 -0
- package/kuasheng-ui/components/ks-nav/index.vue +264 -0
- package/kuasheng-ui/components/ks-nav-bar.js +35 -0
- package/kuasheng-ui/components/ks-org/ks-org-tree.vue +247 -0
- package/kuasheng-ui/components/ks-org/ks-popup-tree.vue +154 -0
- package/kuasheng-ui/components/ks-org/ks-tree-input.vue +240 -0
- package/kuasheng-ui/components/ks-org/ks-tree-node.vue +94 -0
- package/kuasheng-ui/components/ks-org/ks-tree.vue +229 -0
- package/kuasheng-ui/components/ks-org/utils.js +54 -0
- package/kuasheng-ui/components/ks-popover/index.vue +457 -0
- package/kuasheng-ui/components/ks-popover/mixin.js +28 -0
- package/kuasheng-ui/components/ks-popover/utils.js +60 -0
- package/kuasheng-ui/components/ks-pull-refresh/index.vue +43 -0
- package/kuasheng-ui/components/ks-quarter/index.vue +256 -0
- package/kuasheng-ui/components/ks-table/README.md +103 -0
- package/kuasheng-ui/components/ks-table/cell.vue +31 -0
- package/kuasheng-ui/components/ks-table/index.js +8 -0
- package/kuasheng-ui/components/ks-table/index.less +486 -0
- package/kuasheng-ui/components/ks-table/index.vue +1088 -0
- package/kuasheng-ui/components/ks-table/package.json +12 -0
- package/kuasheng-ui/components/ks-table/release.md +7 -0
- package/kuasheng-ui/components/ks-toast.js +35 -0
- package/kuasheng-ui/components/ks-upload/index.vue +174 -0
- package/kuasheng-ui/components/ks-user-access.vue +229 -0
- package/kuasheng-ui/components/no-data/README.md +45 -0
- package/kuasheng-ui/components/no-data/image.js +1 -0
- package/kuasheng-ui/components/no-data/index.vue +83 -0
- package/kuasheng-ui/components/notice-bar.vue +16 -0
- package/kuasheng-ui/components/steps.js +11 -0
- package/kuasheng-ui/components/tabs.vue +40 -0
- package/kuasheng-ui/index.js +239 -0
- package/kuasheng-ui/patch/datetime-picker/datetimePicker.md +0 -0
- package/kuasheng-ui/patch/datetime-picker/index.js +46 -0
- package/kuasheng-ui/patch/datetime-picker/utils.js +78 -0
- package/kuasheng-ui/patch/field/field.md +1 -0
- package/kuasheng-ui/patch/field/index.js +122 -0
- package/kuasheng-ui/patch/field/utils.js +36 -0
- package/kuasheng-ui/patch/form/form.md +7 -0
- package/kuasheng-ui/patch/form/index.js +106 -0
- package/kuasheng-ui/patch/index.js +12 -0
- package/kuasheng-ui/patch/pagination/index.js +78 -0
- package/kuasheng-ui/style/animation-ui.less +31 -0
- package/kuasheng-ui/style/font/number/font-number1.otf +0 -0
- package/kuasheng-ui/style/font/number/font-number2.ttf +0 -0
- package/kuasheng-ui/style/images/checked.svg +1 -0
- package/kuasheng-ui/style/images/success.svg +1 -0
- package/kuasheng-ui/style/index.less +6 -0
- package/kuasheng-ui/style/kuasheng-ui.less +207 -0
- package/kuasheng-ui/style/reset-vant.less +307 -0
- package/kuasheng-ui/style/vant-var.less +138 -0
- package/kuasheng-ui/utils/apis.js +17 -0
- package/kuasheng-ui/utils/axios-adapter.js +47 -0
- package/kuasheng-ui/utils/bem.js +39 -0
- package/kuasheng-ui/utils/bus.js +97 -0
- package/kuasheng-ui/utils/common.js +88 -0
- package/kuasheng-ui/utils/decrypt/config.js +12 -0
- package/kuasheng-ui/utils/decrypt/decrypt-api.js +139 -0
- package/kuasheng-ui/utils/decrypt/index.js +6 -0
- package/kuasheng-ui/utils/decrypt/mask.js +36 -0
- package/kuasheng-ui/utils/decrypt/virtual.js +44 -0
- package/kuasheng-ui/utils/directive.js +57 -0
- package/kuasheng-ui/utils/directive.md +23 -0
- package/kuasheng-ui/utils/drcheck-plugin.js +219 -0
- package/kuasheng-ui/utils/error-plugin.js +88 -0
- package/kuasheng-ui/utils/filter.js +149 -0
- package/kuasheng-ui/utils/http-interceptors.js +18 -0
- package/kuasheng-ui/utils/http.js +140 -0
- package/kuasheng-ui/utils/index.js +5 -0
- package/kuasheng-ui/utils/init-event.js +20 -0
- package/kuasheng-ui/utils/log.js +309 -0
- package/kuasheng-ui/utils/token.js +9 -0
- package/kuasheng-ui/utils/type.js +45 -0
- package/kuasheng-ui/utils/validate.js +20 -0
- package/kuasheng-ui/utils/watermark.js +67 -0
- package/kuasheng-ui/version.js +1 -0
- package/ky-apm/client.js +37 -0
- package/ky-apm/customHttp.js +38 -0
- package/ky-apm/index.js +68 -0
- package/ky-apm/plugins/performance.js +84 -0
- package/ky-apm/plugins/self-error.js +26 -0
- package/ky-apm/warn-log.js +3 -0
- package/package.json +81 -10
- package/plugin/ks-chii-webpack-html/index.js +53 -0
- package/plugin/ks-chii-webpack-html/package.json +16 -0
- package/postcss.config.js +15 -0
- package/public/capsule-positon.js +50 -0
- package/public/fonts/DingTalkJinBuTi.ttf +0 -0
- package/public/framework/axios@0.19.0.min.js +9 -0
- package/public/framework/fastclick@1.0.6.min.js +1 -0
- package/public/framework/iconfont/iconfont.css +91 -0
- package/public/framework/iconfont/iconfont.js +1 -0
- package/public/framework/iconfont/iconfont.json +142 -0
- package/public/framework/iconfont/iconfont.ttf +0 -0
- package/public/framework/iconfont/iconfont.woff +0 -0
- package/public/framework/iconfont/iconfont.woff2 +0 -0
- package/public/framework/vant@2.5.6.min.js +7 -0
- package/public/framework/vue-router@3.1.3.min.js +6 -0
- package/public/framework/vue@2.6.10.runtime.min.js +6 -0
- package/public/framework/vuex@3.1.1.min.js +6 -0
- package/public/index.html +260 -0
- package/public/ks@3.0.8.umd.min.js +1 -0
- package/public/ksui@4.0.27.umd.min.js +10 -0
- package/public/status-bar-preset.js +39 -0
- package/{index.js → qt-npm/index.js} +3 -3
- package/qt-npm/package.json +13 -0
- package/src/App.vue +204 -0
- package/src/README.md +15 -0
- package/src/common/README.md +94 -0
- package/src/common/http/axios-adapter.js +47 -0
- package/src/common/http/common.js +88 -0
- package/src/common/http/http-interceptors.js +18 -0
- package/src/common/http/http-lock.js +45 -0
- package/src/common/http/index.js +163 -0
- package/src/common/http/token.js +9 -0
- package/src/common/styles/font/AlibabaSans102Ver2-Md.ttf +0 -0
- package/src/common/styles/font.less +12 -0
- package/src/common/styles/variables.less +43 -0
- package/src/common/utils/index.js +1 -0
- package/src/common/utils/platform/README.md +1 -0
- package/src/common/utils/platform/android/.gitkeep +0 -0
- package/src/common/utils/platform/core/index.js +24 -0
- package/src/common/utils/platform/index.js +164 -0
- package/src/common/utils/platform/ios/.gitkeep +0 -0
- package/src/common/utils/platform/subscribe/helper.js +38 -0
- package/src/common/utils/platform/subscribe/index.js +204 -0
- package/src/common/utils/platform/subscribe/table-animation.js +75 -0
- package/src/config/index.js +31 -0
- package/src/config.js +1 -0
- package/src/main.js +73 -0
- package/src/router.js +52 -0
- package/src/view/home/config.js +101 -0
- package/src/view/home/demo1.vue +223 -0
- package/src/view/home/demo2.vue +124 -0
- package/src/view/home/demo3.vue +51 -0
- package/src/view/home/demo4.vue +140 -0
- package/src/view/home/index.vue +97 -0
- package/src/view/home/query-table/README.md +45 -0
- package/src/view/home/query-table/api/index.js +12 -0
- package/src/view/home/query-table/assets/horizontal-back.svg +1 -0
- package/src/view/home/query-table/components/pe-table/cell.js +181 -0
- package/src/view/home/query-table/components/pe-table/collapse.js +334 -0
- package/src/view/home/query-table/components/pe-table/empty.vue +48 -0
- package/src/view/home/query-table/components/pe-table/header.js +328 -0
- package/src/view/home/query-table/components/pe-table/images/abnormal.png +0 -0
- package/src/view/home/query-table/components/pe-table/images/empty.png +0 -0
- package/src/view/home/query-table/components/pe-table/images/fold.svg +1 -0
- package/src/view/home/query-table/components/pe-table/images/sort.svg +1 -0
- package/src/view/home/query-table/components/pe-table/images/sorting.svg +1 -0
- package/src/view/home/query-table/components/pe-table/images/unfold.svg +1 -0
- package/src/view/home/query-table/components/pe-table/index.vue +847 -0
- package/src/view/home/query-table/components/pe-table/load-more.js +46 -0
- package/src/view/home/query-table/components/pe-table/props/index.js +193 -0
- package/src/view/home/query-table/components/pe-table/row.vue +118 -0
- package/src/view/home/query-table/components/pe-table/scrollbar.js +424 -0
- package/src/view/home/query-table/components/pe-table/stretch-damping.js +112 -0
- package/src/view/home/query-table/components/pe-table/style/cell.less +89 -0
- package/src/view/home/query-table/components/pe-table/style/empty.less +48 -0
- package/src/view/home/query-table/components/pe-table/style/header.less +141 -0
- package/src/view/home/query-table/components/pe-table/style/index.less +88 -0
- package/src/view/home/query-table/components/pe-table/style/load-more.less +61 -0
- package/src/view/home/query-table/components/pe-table/style/row.less +6 -0
- package/src/view/home/query-table/components/pe-table/table-loading.vue +120 -0
- package/src/view/home/query-table/components/pe-table/table-total.vue +57 -0
- package/src/view/home/query-table/components/pe-table/utils/animate.js +80 -0
- package/src/view/home/query-table/components/pe-table/utils/columns.js +290 -0
- package/src/view/home/query-table/components/pe-table/utils/data.js +12 -0
- package/src/view/home/query-table/components/pe-table/utils/fixed.js +69 -0
- package/src/view/home/query-table/components/pe-table/utils/formatter.js +327 -0
- package/src/view/home/query-table/components/pe-table/utils/render-cells.js +424 -0
- package/src/view/home/query-table/components/pe-table/utils/slot.js +28 -0
- package/src/view/home/query-table/components/pe-table/utils/tools.js +84 -0
- package/src/view/home/query-table/components/pe-table/utils/touch-scroll.js +417 -0
- package/src/view/home/query-table/components/query-table/index.vue +497 -0
- package/src/view/home/query-table/components/query-table/mixins/column-mixin.js +102 -0
- package/src/view/home/query-table/components/query-table/mixins/column-setting.js +143 -0
- package/src/view/home/query-table/components/query-table/mixins/data-mixin.js +519 -0
- package/src/view/home/query-table/components/query-table/mixins/pagination-mixin.js +26 -0
- package/src/view/home/query-table/components/query-table/mixins/table-fixed.js +130 -0
- package/src/view/home/query-table/components/query-table/mixins/table-horizontal.js +119 -0
- package/src/view/home/query-table/components/table-horizontal.vue +99 -0
- package/src/view/home/query-table/components/table-pagination.vue +32 -0
- package/src/view/home/query-table/components/table-settings/assets/arrpw-up.svg +1 -0
- package/src/view/home/query-table/components/table-settings/assets/disabled-down.svg +1 -0
- package/src/view/home/query-table/components/table-settings/assets/disabled-up.svg +1 -0
- package/src/view/home/query-table/components/table-settings/assets/down.svg +1 -0
- package/src/view/home/query-table/components/table-settings/assets/up.svg +1 -0
- package/src/view/home/query-table/components/table-settings/index.less +294 -0
- package/src/view/home/query-table/components/table-settings/index.vue +260 -0
- package/src/view/home/query-table/components/table-settings/settings.vue +479 -0
- package/src/view/home/query-table/components/table-settings/test.js +626 -0
- package/src/view/home/query-table/components/table-settings//344/270/252/346/200/247/350/256/276/347/275/256.md +0 -0
- package/src/view/home/query-table/components/tooltip.js +124 -0
- package/src/view/home/query-table/hooks/use-cache-promise.js +27 -0
- package/src/view/home/query-table/hooks/use-column-config.js +190 -0
- package/src/view/home/query-table/hooks/use-encryption.js +0 -0
- package/src/view/home/query-table/hooks/use-generic-search.js +95 -0
- package/src/view/home/query-table/index.js +7 -0
- package/src/view/home/query-table/store/column-store.js +0 -0
- package/src/view/home/query-table/styles/table.less +24 -0
- package/src/view/home/query-table/utils/column.js +36 -0
- package/src/view/home/query-table/utils/config.js +12 -0
- package/src/view/home/query-table/utils/encryption.js +32 -0
- package/src/view/home/query-table/utils/http.js +1 -0
- package/src/view/home/query-table/utils/localStorage.js +35 -0
- package/src/view/home//351/246/226/351/241/265.md +0 -0
- package/src/web.js +99 -0
- package/vue.config.js +131 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="container">
|
|
3
|
+
<div class="tab">tab</div>
|
|
4
|
+
<div class="table">
|
|
5
|
+
<QueryTable
|
|
6
|
+
:isScrollShowTotal="isScrollShowTotal"
|
|
7
|
+
ref="table"
|
|
8
|
+
showPage
|
|
9
|
+
:showIndex="true"
|
|
10
|
+
menuId="156439900739872047"
|
|
11
|
+
searchCode="pe_im_stocks-selection_index_field"
|
|
12
|
+
:config="configs">
|
|
13
|
+
<template slot="topUnfixed">
|
|
14
|
+
<div>不吸住</div>
|
|
15
|
+
<div>不吸住</div>
|
|
16
|
+
<div>不吸住</div>
|
|
17
|
+
<div>不吸住</div>
|
|
18
|
+
</template>
|
|
19
|
+
<template slot="topFixed">
|
|
20
|
+
<div>吸住</div>
|
|
21
|
+
<div>吸住</div>
|
|
22
|
+
<div>吸住</div>
|
|
23
|
+
<div>吸住</div>
|
|
24
|
+
<div>吸住</div>
|
|
25
|
+
<div>吸住</div>
|
|
26
|
+
<div @click="$refs.table.openSetting()">打开个性设置</div>
|
|
27
|
+
<div @click="$refs.table.loadData()">刷新</div>
|
|
28
|
+
</template>
|
|
29
|
+
</QueryTable>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
<!-- </div> -->
|
|
33
|
+
<!-- </div> -->
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script>
|
|
37
|
+
import QueryTable from './query-table/index.js'
|
|
38
|
+
import { mockParams } from './config'
|
|
39
|
+
export default {
|
|
40
|
+
mixins: [],
|
|
41
|
+
components: {
|
|
42
|
+
QueryTable,
|
|
43
|
+
},
|
|
44
|
+
data() {
|
|
45
|
+
return {
|
|
46
|
+
isScrollShowTotal: true,
|
|
47
|
+
shwoTable: true,
|
|
48
|
+
// props分功能块
|
|
49
|
+
configs: {
|
|
50
|
+
url: 'pe.stock.app.resource.search.v1',
|
|
51
|
+
appkey: '61189',
|
|
52
|
+
beforeHttp({ params }) {
|
|
53
|
+
// 增加header
|
|
54
|
+
params = { ...mockParams }
|
|
55
|
+
return { params }
|
|
56
|
+
},
|
|
57
|
+
// 处理出参
|
|
58
|
+
afterHttp(res) {
|
|
59
|
+
res.rows[0].name = 'afterHttp'
|
|
60
|
+
return res
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
methods: {
|
|
66
|
+
init() {
|
|
67
|
+
// this.resetTableHeight()
|
|
68
|
+
},
|
|
69
|
+
resetTableHeight() {
|
|
70
|
+
// TODO 先显示再隐藏,让表格继承到正确的高度
|
|
71
|
+
this.shwoTable = false
|
|
72
|
+
this.$nextTick(() => {
|
|
73
|
+
setTimeout(() => {
|
|
74
|
+
this.shwoTable = true
|
|
75
|
+
}, 0)
|
|
76
|
+
})
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
mounted() {
|
|
80
|
+
this.init()
|
|
81
|
+
},
|
|
82
|
+
}
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
<style lang="less" scoped>
|
|
86
|
+
.container {
|
|
87
|
+
height: 100vh;
|
|
88
|
+
.tab {
|
|
89
|
+
height: 100px;
|
|
90
|
+
background: #f96a26;
|
|
91
|
+
}
|
|
92
|
+
.table {
|
|
93
|
+
height: calc(100vh - 100px);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
</style>
|
|
97
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
## 目录说明
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
- **/assets**: 存放公共资源,如图标。
|
|
5
|
+
- **/components**: 存放组件。
|
|
6
|
+
- **/query-table**: 主组件。
|
|
7
|
+
- **/index.vue**: 主组件。
|
|
8
|
+
- **/mixins**: query-table的mixins。
|
|
9
|
+
- **/column-mixin**: 表格列头相关。
|
|
10
|
+
- **/column-setting**: 个性设置相关。
|
|
11
|
+
- **/data-mixin**: 行数据相关。
|
|
12
|
+
- **/pagination-mixin**: 表格分页相关。
|
|
13
|
+
- **/table-fixed**: 吸顶相关。
|
|
14
|
+
- **/table-horizontal.js**: 横屏相关。
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
- **/table-horizontal**: 表格横屏组件。
|
|
18
|
+
- **/table-pagination**: 表格分页组件。
|
|
19
|
+
- **table-settings**: 个性设置组件。
|
|
20
|
+
- **tooltip**: 单元格气泡组件。
|
|
21
|
+
- **/demo**: 存放demo。
|
|
22
|
+
- **/hooks**: 存放封装的通用逻辑。与utils不同的是,hooks内部是可以有状态、多实例的。
|
|
23
|
+
- **/use-cache-promise**: 缓存promise结果。
|
|
24
|
+
- **/use-column-config**: 获取列配置
|
|
25
|
+
- **/use-encryption**: 加解密
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
- **/index.js**: 项目主入口。
|
|
30
|
+
- **/mixins**: 项目级mixins。
|
|
31
|
+
- **/store**: 存放共享数据。注意,不带响应式。
|
|
32
|
+
- **/column-store**: 列存储
|
|
33
|
+
|
|
34
|
+
- **/styles**: 存放样式。
|
|
35
|
+
- **/utils**: 存放工具函数。
|
|
36
|
+
- **/column**: 列工具
|
|
37
|
+
- **/encryption**: 加解密
|
|
38
|
+
- **/http**: http
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
- **/tests**: 存放测试文件,确保代码的质量。
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
- **README.md**: 项目说明文件,提供项目的基本信息和使用说明。
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { http } from '../utils/http'
|
|
2
|
+
|
|
3
|
+
export const APPKEY_SYSTEM = '10124'
|
|
4
|
+
|
|
5
|
+
// 获取当前菜单下的通用查询配置
|
|
6
|
+
export const getGenericSearch = () => {
|
|
7
|
+
return http('system.genericSearch.listByMenuId', APPKEY_SYSTEM, { menuId: ksui.menu.id })
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// 通过id获取详细配置
|
|
11
|
+
export const getGenericSearchById = (params) =>
|
|
12
|
+
http('system.genericSearch.get', APPKEY_SYSTEM, params)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="24" height="24" viewBox="0 0 24 24"><g><g><path d="M16.799951171875,4.299951171875L8.994601171875,11.999951171875L16.799951171875,19.699951171875L15.684901171875,20.799951171875L7.507864171875,12.733281171875C7.097313171875,12.328281171875,7.097313171875,11.671631171875,7.507864171875,11.266621171875L15.684901171875,3.199951171875L16.799951171875,4.299951171875Z" fill-rule="evenodd" fill="#1C1E23" fill-opacity="1"/></g></g></svg>
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
|
|
3
|
+
import isFunction from 'lodash/isFunction'
|
|
4
|
+
import './style/cell.less'
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
name: 'cellCompoent',
|
|
8
|
+
computed: {
|
|
9
|
+
style() {
|
|
10
|
+
const obj = this.fixed
|
|
11
|
+
? {
|
|
12
|
+
zIndex: '10',
|
|
13
|
+
}
|
|
14
|
+
: {}
|
|
15
|
+
return {
|
|
16
|
+
width: this.width + 'px',
|
|
17
|
+
transform: `translateX(${this.offset}px)`,
|
|
18
|
+
...obj,
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
fixedClassName() {
|
|
22
|
+
return this.fixed ? 'pe-table-cell__fixed' : ''
|
|
23
|
+
},
|
|
24
|
+
lastFixedClassName() {
|
|
25
|
+
return this.lastFixedCell ? 'pe-table-cell__last-fixed' : ''
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
data() {
|
|
29
|
+
return {
|
|
30
|
+
width: 0,
|
|
31
|
+
offset: 0,
|
|
32
|
+
text: '',
|
|
33
|
+
column: undefined,
|
|
34
|
+
fixed: false,
|
|
35
|
+
lastFixedCell: false,
|
|
36
|
+
rowData: undefined,
|
|
37
|
+
handleEvent: undefined,
|
|
38
|
+
cellClassName: undefined,
|
|
39
|
+
globalCellClassName: undefined,
|
|
40
|
+
placeholderSign: false,
|
|
41
|
+
longPressTimer: null,
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
mounted() {
|
|
45
|
+
const $cell = this.$refs.cell
|
|
46
|
+
$cell.addEventListener('mousedown', this.startLongPress)
|
|
47
|
+
$cell.addEventListener('mouseup', this.endLongPress)
|
|
48
|
+
$cell.addEventListener('mouseleave', this.endLongPress)
|
|
49
|
+
|
|
50
|
+
$cell.addEventListener('touchstart', this.startLongPress)
|
|
51
|
+
$cell.addEventListener('touchend', this.endLongPress)
|
|
52
|
+
$cell.addEventListener('touchmove', this.endLongPress)
|
|
53
|
+
$cell.addEventListener('touchcancel', this.endLongPress)
|
|
54
|
+
},
|
|
55
|
+
beforeDestroy() {
|
|
56
|
+
const $cell = this.$refs.cell
|
|
57
|
+
$cell.removeEventListener('mousedown', this.startLongPress)
|
|
58
|
+
$cell.removeEventListener('mouseup', this.endLongPress)
|
|
59
|
+
$cell.removeEventListener('mouseleave', this.endLongPress)
|
|
60
|
+
|
|
61
|
+
$cell.removeEventListener('touchstart', this.startLongPress)
|
|
62
|
+
$cell.removeEventListener('touchend', this.endLongPress)
|
|
63
|
+
$cell.removeEventListener('touchmove', this.endLongPress)
|
|
64
|
+
$cell.removeEventListener('touchcancel', this.endLongPress)
|
|
65
|
+
},
|
|
66
|
+
render(h) {
|
|
67
|
+
const { rowCellRender, key } = this.column || {}
|
|
68
|
+
const createContent = () => {
|
|
69
|
+
if (this.placeholderSign) {
|
|
70
|
+
return null
|
|
71
|
+
}
|
|
72
|
+
let labelNode = null
|
|
73
|
+
const params = {
|
|
74
|
+
column: this.column,
|
|
75
|
+
value: this.text,
|
|
76
|
+
rowData: this.originRowData,
|
|
77
|
+
columnIndex: this.columnIndex,
|
|
78
|
+
rowIndex: this.rowIndex,
|
|
79
|
+
}
|
|
80
|
+
const defaultLable = () => <span class="pe-table-cell_label">{this.text}</span>
|
|
81
|
+
if (isFunction(rowCellRender)) {
|
|
82
|
+
labelNode = rowCellRender(h, params)
|
|
83
|
+
if (labelNode === null) {
|
|
84
|
+
labelNode = defaultLable()
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
labelNode = defaultLable()
|
|
88
|
+
}
|
|
89
|
+
return labelNode
|
|
90
|
+
}
|
|
91
|
+
const content = createContent()
|
|
92
|
+
let classNames = [
|
|
93
|
+
'pe-table-cell',
|
|
94
|
+
this.globalCellClassName,
|
|
95
|
+
this.cellClassName,
|
|
96
|
+
this.lastFixedClassName,
|
|
97
|
+
this.fixedClassName
|
|
98
|
+
]
|
|
99
|
+
return (
|
|
100
|
+
<div
|
|
101
|
+
ref="cell"
|
|
102
|
+
class={classNames}
|
|
103
|
+
style={this.style}
|
|
104
|
+
on-click={this.handleClickEvent}
|
|
105
|
+
data-cellkey={key}
|
|
106
|
+
>
|
|
107
|
+
{content}
|
|
108
|
+
</div>
|
|
109
|
+
)
|
|
110
|
+
},
|
|
111
|
+
methods: {
|
|
112
|
+
setContent(text) {
|
|
113
|
+
// 判空,否则没有值会显示undefined,特别是自定义列没有返回的时候
|
|
114
|
+
this.text = undefined === text ? '' : String(text)
|
|
115
|
+
},
|
|
116
|
+
setOffset(offset) {
|
|
117
|
+
this.offset = offset
|
|
118
|
+
},
|
|
119
|
+
reuse({
|
|
120
|
+
id,
|
|
121
|
+
offset,
|
|
122
|
+
text,
|
|
123
|
+
width,
|
|
124
|
+
column,
|
|
125
|
+
fixed,
|
|
126
|
+
lastFixedCell,
|
|
127
|
+
rowData,
|
|
128
|
+
columnIndex,
|
|
129
|
+
rowIndex,
|
|
130
|
+
cellClassName,
|
|
131
|
+
originRowData,
|
|
132
|
+
globalCellClassName,
|
|
133
|
+
placeholderSign,
|
|
134
|
+
}) {
|
|
135
|
+
this.id = id
|
|
136
|
+
this.width = width
|
|
137
|
+
this.column = column
|
|
138
|
+
this.fixed = fixed
|
|
139
|
+
this.lastFixedCell = lastFixedCell
|
|
140
|
+
this.rowData = rowData
|
|
141
|
+
this.columnIndex = columnIndex
|
|
142
|
+
this.rowIndex = rowIndex
|
|
143
|
+
this.cellClassName = cellClassName
|
|
144
|
+
this.globalCellClassName = globalCellClassName
|
|
145
|
+
this.originRowData = originRowData
|
|
146
|
+
this.placeholderSign = placeholderSign
|
|
147
|
+
this.setOffset(offset)
|
|
148
|
+
this.setContent(text)
|
|
149
|
+
},
|
|
150
|
+
handleClickEvent(event) {
|
|
151
|
+
const params = {
|
|
152
|
+
column: this.column,
|
|
153
|
+
rowData: this.originRowData,
|
|
154
|
+
name: 'cell-click',
|
|
155
|
+
rowIndex: this.rowIndex,
|
|
156
|
+
columnIndex: this.columnIndex,
|
|
157
|
+
}
|
|
158
|
+
this.handleEvent && this.handleEvent(event, params)
|
|
159
|
+
},
|
|
160
|
+
handleLongEvent(event, params) {
|
|
161
|
+
this.handleEvent && this.handleEvent(event, params)
|
|
162
|
+
},
|
|
163
|
+
startLongPress(event) {
|
|
164
|
+
this.longPressTimer && this.endLongPress()
|
|
165
|
+
const params = {
|
|
166
|
+
column: this.column,
|
|
167
|
+
rowData: this.originRowData,
|
|
168
|
+
name: 'cell-long',
|
|
169
|
+
rowIndex: this.rowIndex,
|
|
170
|
+
columnIndex: this.columnIndex,
|
|
171
|
+
}
|
|
172
|
+
this.longPressTimer = setTimeout(() => {
|
|
173
|
+
this.handleLongEvent(event, params)
|
|
174
|
+
}, 500);
|
|
175
|
+
},
|
|
176
|
+
endLongPress() {
|
|
177
|
+
clearTimeout(this.longPressTimer)
|
|
178
|
+
this.longPressTimer = null
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
}
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
|
|
3
|
+
// import cloneDeep from 'lodash/cloneDeep'
|
|
4
|
+
// // const queue = []
|
|
5
|
+
// let loading = false
|
|
6
|
+
// export const collapseClass = {
|
|
7
|
+
// bg: 'table2-cell-collapse-bg',
|
|
8
|
+
// colMark: 'table2-cell-collapse_colMark'
|
|
9
|
+
// }
|
|
10
|
+
|
|
11
|
+
// let checkExpandTimer
|
|
12
|
+
|
|
13
|
+
// // // 执行队列中的方法
|
|
14
|
+
// // async function executeQueue() {
|
|
15
|
+
// // // 如果已经有方法在执行或队列为空,则直接返回
|
|
16
|
+
// // if (loading || queue.length === 0) return
|
|
17
|
+
|
|
18
|
+
// // // 获取队列中的第一个方法并执行
|
|
19
|
+
// // const { fn, context, args } = queue.shift()
|
|
20
|
+
// // try {
|
|
21
|
+
// // await fn.apply(context, args)
|
|
22
|
+
// // } catch (error) {
|
|
23
|
+
// // console.error('Error while executing changeCollapseKeys:', error)
|
|
24
|
+
// // } finally {
|
|
25
|
+
// // loading = false
|
|
26
|
+
// // // 继续执行队列中的下一个方法
|
|
27
|
+
// // executeQueue()
|
|
28
|
+
// // }
|
|
29
|
+
// // }
|
|
30
|
+
|
|
31
|
+
// // // 添加方法到队列的函数
|
|
32
|
+
// // function addToQueue(fn, context, args) {
|
|
33
|
+
// // queue.push({ fn, context, args })
|
|
34
|
+
// // }
|
|
35
|
+
|
|
36
|
+
// const collapseType = {
|
|
37
|
+
// expand: 'expand',
|
|
38
|
+
// collapse: 'collapse'
|
|
39
|
+
// }
|
|
40
|
+
|
|
41
|
+
// function formatGroupInfo(group, column) {
|
|
42
|
+
// group.push(column)
|
|
43
|
+
// }
|
|
44
|
+
|
|
45
|
+
// function resetColumnsWidth(collapseAnimationGroup = []) {
|
|
46
|
+
// collapseAnimationGroup.forEach(groupInfo => {
|
|
47
|
+
// groupInfo.columnGroups.forEach(column => {
|
|
48
|
+
// // 解决默认是折叠,然后点击展开
|
|
49
|
+
// if (column.$collapseWidth === undefined) {
|
|
50
|
+
// column.$collapseWidth = column.width
|
|
51
|
+
// }
|
|
52
|
+
// column.width = 0.1
|
|
53
|
+
// })
|
|
54
|
+
// })
|
|
55
|
+
// }
|
|
56
|
+
|
|
57
|
+
// function getCollapseAnimationGroup(collapseKeys, columns) {
|
|
58
|
+
// collapseKeys = cloneDeep(collapseKeys)
|
|
59
|
+
// const groups = []
|
|
60
|
+
// let consecutiveGroup = []
|
|
61
|
+
// columns.forEach(column => {
|
|
62
|
+
// if (collapseKeys.includes(column.key)) {
|
|
63
|
+
// const isChild = column.children && column.children.length
|
|
64
|
+
// if (isChild) {
|
|
65
|
+
// column.children.forEach(childCol => {
|
|
66
|
+
// if (!collapseKeys.includes(childCol.key)) {
|
|
67
|
+
// collapseKeys.push(childCol.key)
|
|
68
|
+
// }
|
|
69
|
+
// })
|
|
70
|
+
// }
|
|
71
|
+
// formatGroupInfo(consecutiveGroup, column)
|
|
72
|
+
// } else {
|
|
73
|
+
// if (consecutiveGroup.length > 0) {
|
|
74
|
+
// groups.push(consecutiveGroup)
|
|
75
|
+
// consecutiveGroup = []
|
|
76
|
+
// }
|
|
77
|
+
// }
|
|
78
|
+
// })
|
|
79
|
+
// consecutiveGroup.length > 0 && groups.push(consecutiveGroup)
|
|
80
|
+
// // 组装配置参数
|
|
81
|
+
// return groups.reduce((res, cur = []) => {
|
|
82
|
+
// res.push({
|
|
83
|
+
// columnGroups: cur,
|
|
84
|
+
// ...cur.reduce(
|
|
85
|
+
// (r, c) => {
|
|
86
|
+
// const { totalWidth } = r
|
|
87
|
+
// r.totalWidth = totalWidth + c.width
|
|
88
|
+
// return r
|
|
89
|
+
// },
|
|
90
|
+
// {
|
|
91
|
+
// totalWidth: 0
|
|
92
|
+
// }
|
|
93
|
+
// )
|
|
94
|
+
// })
|
|
95
|
+
// return res
|
|
96
|
+
// }, [])
|
|
97
|
+
// }
|
|
98
|
+
|
|
99
|
+
// function getCollapseClassNames(labelClassName = '', type) {
|
|
100
|
+
// try {
|
|
101
|
+
// let classNames = labelClassName
|
|
102
|
+
// if (type === 'add') {
|
|
103
|
+
// if (!labelClassName || !labelClassName.includes(collapseClass.bg)) {
|
|
104
|
+
// classNames = `${labelClassName || ''} ${collapseClass.bg}`
|
|
105
|
+
// }
|
|
106
|
+
// } else {
|
|
107
|
+
// classNames = (labelClassName || '').replace(collapseClass.bg, '')
|
|
108
|
+
// }
|
|
109
|
+
// return classNames
|
|
110
|
+
// } catch (e) {
|
|
111
|
+
// return labelClassName
|
|
112
|
+
// }
|
|
113
|
+
// }
|
|
114
|
+
|
|
115
|
+
// function setColumnHighlight(column, visibleFlatColumns) {
|
|
116
|
+
// const collapseColumn = visibleFlatColumns && visibleFlatColumns.find(col => col.key === column.key)
|
|
117
|
+
// if (collapseColumn) collapseColumn.labelClassName = getCollapseClassNames(column.labelClassName, 'add')
|
|
118
|
+
// }
|
|
119
|
+
|
|
120
|
+
// function removeColumnHighlight(column, visibleFlatColumns) {
|
|
121
|
+
// if (column.labelClassName) {
|
|
122
|
+
// const collapseColumn = visibleFlatColumns && visibleFlatColumns.find(col => col.key === column.key)
|
|
123
|
+
// if (collapseColumn) collapseColumn.labelClassName = getCollapseClassNames(column.labelClassName)
|
|
124
|
+
// }
|
|
125
|
+
// }
|
|
126
|
+
|
|
127
|
+
// function createTransitionTime(v = 3) {
|
|
128
|
+
// return `transition: width .${v}s;`
|
|
129
|
+
// }
|
|
130
|
+
|
|
131
|
+
// function setCellCollapseHighlightClass(tds = [], colgroup = [], type, column) {
|
|
132
|
+
// tds.forEach(td => {
|
|
133
|
+
// const [cellEl] = td.children || []
|
|
134
|
+
// if (cellEl && cellEl.classList) {
|
|
135
|
+
// cellEl.classList.add(collapseClass.bg)
|
|
136
|
+
// }
|
|
137
|
+
// })
|
|
138
|
+
// colgroup.forEach(col => {
|
|
139
|
+
// if (col && col.classList) {
|
|
140
|
+
// col.classList.add(collapseClass.colMark)
|
|
141
|
+
// col.style = createTransitionTime()
|
|
142
|
+
// }
|
|
143
|
+
// })
|
|
144
|
+
// // 不做重复采集,场景问题: 当折叠收起子级后,马上再点击,收起父级。则会被重复采集,设置为0.1。
|
|
145
|
+
// if (type === collapseType.collapse && column.width !== 0.1) {
|
|
146
|
+
// column.$collapseWidth = column.width
|
|
147
|
+
// column.width = 0.1
|
|
148
|
+
// } else {
|
|
149
|
+
// column.width = column.$collapseWidth
|
|
150
|
+
// }
|
|
151
|
+
// }
|
|
152
|
+
|
|
153
|
+
// export function removeCellCollapseHighlightClass(tableEl) {
|
|
154
|
+
// loading = false
|
|
155
|
+
// const colgroup = tableEl.querySelectorAll(`.${collapseClass.colMark}`)
|
|
156
|
+
// // if (isRemoveBg) {
|
|
157
|
+
// // const cells = tableEl.querySelectorAll(`.${collapseClass.bg}`)
|
|
158
|
+
// // cells.forEach(el => {
|
|
159
|
+
// // el.classList.remove(collapseClass.bg)
|
|
160
|
+
// // })
|
|
161
|
+
// // }
|
|
162
|
+
// colgroup.forEach(el => {
|
|
163
|
+
// el.classList.remove(collapseClass.colMark)
|
|
164
|
+
// el.style = ''
|
|
165
|
+
// })
|
|
166
|
+
// }
|
|
167
|
+
|
|
168
|
+
// function renderHighlightGroup(collapseAnimationGroup, tableEl, type, callback, vm, emitParams) {
|
|
169
|
+
// try {
|
|
170
|
+
// collapseAnimationGroup.forEach(groupInfo => {
|
|
171
|
+
// groupInfo.columnGroups.forEach(column => {
|
|
172
|
+
// const { key } = column
|
|
173
|
+
// // 设置列背景色高亮
|
|
174
|
+
// column.labelClassName = getCollapseClassNames(column.labelClassName, 'add')
|
|
175
|
+
// column.className = getCollapseClassNames(column.className, 'add')
|
|
176
|
+
// const colgroup = tableEl.querySelectorAll(`[name="${key}"]`)
|
|
177
|
+
// setCellCollapseHighlightClass([], colgroup, type, column)
|
|
178
|
+
// })
|
|
179
|
+
// })
|
|
180
|
+
// const isCollapse = type === collapseType.collapse
|
|
181
|
+
// setTimeout(
|
|
182
|
+
// () => {
|
|
183
|
+
// removeCellCollapseHighlightClass(tableEl, isCollapse)
|
|
184
|
+
// isCollapse && callback()
|
|
185
|
+
// vm.$emit('collapsed', emitParams)
|
|
186
|
+
// // vm._updateTableHeight() // 存在全部一级头点击展开变成二级头,高度计算有误
|
|
187
|
+
// // vm.table._updateTableHeight() // 存在全部一级头点击展开变成二级头,高度计算有误
|
|
188
|
+
// },
|
|
189
|
+
// isCollapse ? 300 : 500
|
|
190
|
+
// )
|
|
191
|
+
// } catch (e) {
|
|
192
|
+
// loading = false
|
|
193
|
+
// }
|
|
194
|
+
// }
|
|
195
|
+
|
|
196
|
+
export default {
|
|
197
|
+
methods: {
|
|
198
|
+
changeCollapseKeys(column) {
|
|
199
|
+
// if (loading) return
|
|
200
|
+
const { collapsed, collapseKeys } = column
|
|
201
|
+
// console.log(key, '---k')
|
|
202
|
+
if (!Array.isArray(collapseKeys) || !this.tableData.length) {
|
|
203
|
+
return
|
|
204
|
+
}
|
|
205
|
+
// loading = true
|
|
206
|
+
const val = !collapsed
|
|
207
|
+
// const visibleFlatColumns = this.visibleFlatColumns
|
|
208
|
+
// const type = collapsed === true ? collapseType.expand : collapseType.collapse
|
|
209
|
+
// const collapseAnimationGroup = getCollapseAnimationGroup(collapseKeys, visibleFlatColumns)
|
|
210
|
+
// const tableEl = this.$el || document
|
|
211
|
+
// const isExpand = type === collapseType.expand
|
|
212
|
+
// clearTimeout(checkExpandTimer)
|
|
213
|
+
// this.checkColumnFreeze(collapseAnimationGroup)
|
|
214
|
+
// if (isExpand) {
|
|
215
|
+
// resetColumnsWidth(collapseAnimationGroup)
|
|
216
|
+
this.updateCollapseMap(collapseKeys, val, column)
|
|
217
|
+
// setColumnHighlight(column, visibleFlatColumns)
|
|
218
|
+
// } else {
|
|
219
|
+
// removeColumnHighlight(column, visibleFlatColumns)
|
|
220
|
+
// }
|
|
221
|
+
// 延迟的目的是为了在做展开的时候先把width:0.1绘制出来
|
|
222
|
+
// setTimeout(
|
|
223
|
+
// () => {
|
|
224
|
+
// const emitParams = { key, column, collapsed: val }
|
|
225
|
+
// renderHighlightGroup(
|
|
226
|
+
// collapseAnimationGroup,
|
|
227
|
+
// tableEl,
|
|
228
|
+
// type,
|
|
229
|
+
// this.updateCollapseMap.bind(this, collapseKeys, val, column),
|
|
230
|
+
// this,
|
|
231
|
+
// emitParams
|
|
232
|
+
// )
|
|
233
|
+
// column.collapsed = type !== collapseType.expand
|
|
234
|
+
// // this.updateColumns()
|
|
235
|
+
// },
|
|
236
|
+
// isExpand ? 20 : 0
|
|
237
|
+
// )
|
|
238
|
+
},
|
|
239
|
+
checkColumnFreeze(columnGroups) {
|
|
240
|
+
try {
|
|
241
|
+
const isAllHide = columnGroups
|
|
242
|
+
.reduce((v, cur) => {
|
|
243
|
+
v.push(...(cur.columnGroups || []).map(col => col.$show))
|
|
244
|
+
return v
|
|
245
|
+
}, [])
|
|
246
|
+
.every(status => status === false)
|
|
247
|
+
if (isAllHide === true) {
|
|
248
|
+
this.table.$message.warning('当前所有被控制列均被隐藏')
|
|
249
|
+
}
|
|
250
|
+
} catch (err) {
|
|
251
|
+
// eslint-disable-next-line
|
|
252
|
+
console.log(err)
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
updateCollapseMap(collapseKeys, status, column) {
|
|
256
|
+
const { key } = column
|
|
257
|
+
const visibleFlatColumns = this.visibleFlatColumns
|
|
258
|
+
for (let i = 0; i < collapseKeys.length; i++) {
|
|
259
|
+
const collapseKey = collapseKeys[i]
|
|
260
|
+
this.collapsedMap[collapseKey] = status
|
|
261
|
+
const index = visibleFlatColumns.findIndex(col => col.key === collapseKey)
|
|
262
|
+
if (index > -1) {
|
|
263
|
+
const col = visibleFlatColumns[index] || {}
|
|
264
|
+
const { childKeys = [], parentNodeKeys, collapseKeys = [] } = col
|
|
265
|
+
col.collapseBg = !status ? 'collapse-bg' : ''
|
|
266
|
+
// 子级的状态需要更新:
|
|
267
|
+
childKeys &&
|
|
268
|
+
childKeys.length &&
|
|
269
|
+
childKeys.forEach(k => {
|
|
270
|
+
if (collapseKeys.indexOf(k) > -1) {
|
|
271
|
+
return true
|
|
272
|
+
}
|
|
273
|
+
this.$set(this.collapsedMap, k, status)
|
|
274
|
+
const childCol = visibleFlatColumns.find(col => col.key === k)
|
|
275
|
+
// 更新对应的column的 collapsed 状态, 如果也存在collapseKeys的话。
|
|
276
|
+
if (childCol && childCol.collapseKeys && childCol.collapseKeys.length) {
|
|
277
|
+
childCol.collapsed = status
|
|
278
|
+
}
|
|
279
|
+
})
|
|
280
|
+
// if (collapseKeys && collapseKeys.length) {
|
|
281
|
+
// col.collapsed = collapseKeys.every(k => this.collapsedMap[k])
|
|
282
|
+
// }
|
|
283
|
+
// 如果存在父级,则在展开的情况下父级也必须展开
|
|
284
|
+
if (!status) {
|
|
285
|
+
parentNodeKeys &&
|
|
286
|
+
parentNodeKeys.length &&
|
|
287
|
+
parentNodeKeys.forEach(k => {
|
|
288
|
+
this.$set(this.collapsedMap, k, status)
|
|
289
|
+
})
|
|
290
|
+
} else {
|
|
291
|
+
// 如果子节点有一个展开,那么自己也要展开
|
|
292
|
+
const hasShowChild = childKeys.length && childKeys.some(k => !this.collapsedMap[k])
|
|
293
|
+
if (hasShowChild) {
|
|
294
|
+
this.$set(this.collapsedMap, col.key, !status)
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
this.updateVisibleFlatColumnsCol(key, {
|
|
299
|
+
collapsed: status,
|
|
300
|
+
collapseBg: !status ? 'collapse-bg' : ''
|
|
301
|
+
})
|
|
302
|
+
}
|
|
303
|
+
// 判断所有子节点是否被折叠,是则需要折叠自己
|
|
304
|
+
if (column.childKeys && column.childKeys.length) {
|
|
305
|
+
if (column.childKeys.every(k => this.collapsedMap[k])) {
|
|
306
|
+
this.collapsedMap[key] = status
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
this.updateColumns()
|
|
310
|
+
this.createHeader()
|
|
311
|
+
this.renderViewportRows()
|
|
312
|
+
this.renderViewportCells()
|
|
313
|
+
// 重新计算滚动条,且保持滚动条位置不变
|
|
314
|
+
this.setScrollOffsetX(this.offsetX)
|
|
315
|
+
this.refreshThumb()
|
|
316
|
+
this.$emit('collapsed')
|
|
317
|
+
},
|
|
318
|
+
updateVisibleFlatColumnsCol(key, obj) {
|
|
319
|
+
const visibleFlatColumns = this.visibleFlatColumns
|
|
320
|
+
const index = visibleFlatColumns.findIndex(col => col.key === key)
|
|
321
|
+
if (index === -1) {
|
|
322
|
+
return
|
|
323
|
+
}
|
|
324
|
+
const col = visibleFlatColumns[index]
|
|
325
|
+
for (const colKey in obj) {
|
|
326
|
+
if (!Object.hasOwnProperty.call(col, colKey)) {
|
|
327
|
+
this.$set(col, colKey, obj[colKey])
|
|
328
|
+
} else {
|
|
329
|
+
col[colKey] = obj[colKey]
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
}
|