@kyfe/ks-query-table 0.0.9 → 0.0.11
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/{qt-npm/ks-query-table.common.js → index.js} +4 -3
- package/ks-query-table.common.js.map +1 -0
- package/{qt-npm/ks-query-table.umd.js → ks-query-table.umd.js} +4 -3
- package/ks-query-table.umd.js.map +1 -0
- package/{qt-npm/ks-query-table.umd.min.js → ks-query-table.umd.min.js} +2 -2
- package/ks-query-table.umd.min.js.map +1 -0
- package/package.json +10 -81
- package/.bitmap +0 -38
- package/.editorconfig +0 -5
- package/.env.dev +0 -2
- package/.env.gray +0 -2
- package/.env.prod +0 -2
- package/.env.stg +0 -3
- package/.env.uat +0 -2
- package/.eslintignore +0 -1
- package/.eslintrc.js +0 -25
- package/.gitmodules +0 -4
- package/.prettierrc +0 -11
- package/README.md +0 -6
- package/babel.config.js +0 -10
- package/build-apm.sh +0 -9
- package/build.sh +0 -16
- package/config/index.js +0 -20
- package/jsconfig.json +0 -7
- package/kuasheng-sdk/index.js +0 -80
- package/kuasheng-sdk/lib/assets.js +0 -304
- package/kuasheng-sdk/lib/context.js +0 -199
- package/kuasheng-sdk/lib/layout.js +0 -346
- package/kuasheng-sdk/lib/location.js +0 -46
- package/kuasheng-sdk/lib/media.js +0 -342
- package/kuasheng-sdk/lib/navigation.js +0 -30
- package/kuasheng-sdk/lib/request.js +0 -76
- package/kuasheng-sdk/lib/system.js +0 -190
- package/kuasheng-sdk/lib/userinfo.js +0 -98
- package/kuasheng-sdk/util/check.js +0 -102
- package/kuasheng-sdk/util/config.js +0 -47
- package/kuasheng-sdk/util/device.js +0 -25
- package/kuasheng-sdk/util/error.js +0 -19
- package/kuasheng-sdk/util/funtional.js +0 -153
- package/kuasheng-sdk/util/mixin.js +0 -36
- package/kuasheng-sdk/util/requestUtil.js +0 -41
- package/kuasheng-sdk/util/response.js +0 -33
- package/kuasheng-sdk/util/warn.js +0 -35
- package/kuasheng-ui/CHANGELOG.md +0 -9
- package/kuasheng-ui/components/card.vue +0 -57
- package/kuasheng-ui/components/ks-area-select/README.md +0 -43
- package/kuasheng-ui/components/ks-area-select/area-picker.vue +0 -554
- package/kuasheng-ui/components/ks-area-select/area-search.vue +0 -363
- package/kuasheng-ui/components/ks-area-select/areas-pop.vue +0 -56
- package/kuasheng-ui/components/ks-area-select/common.js +0 -183
- package/kuasheng-ui/components/ks-area-select/index.vue +0 -355
- package/kuasheng-ui/components/ks-area-select/mixins.js +0 -216
- package/kuasheng-ui/components/ks-area-single-select/README.md +0 -50
- package/kuasheng-ui/components/ks-area-single-select/hot-city.js +0 -45
- package/kuasheng-ui/components/ks-area-single-select/index.vue +0 -324
- package/kuasheng-ui/components/ks-calendar/index.vue +0 -269
- package/kuasheng-ui/components/ks-call-phone/call-tips.vue +0 -70
- package/kuasheng-ui/components/ks-call-phone/call.vue +0 -178
- package/kuasheng-ui/components/ks-call-phone/index.js +0 -48
- package/kuasheng-ui/components/ks-call-phone/index.vue +0 -131
- 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 +0 -23
- package/kuasheng-ui/components/ks-date-picker/date-picker-bottom.vue +0 -123
- package/kuasheng-ui/components/ks-date-picker/date-picker-dropdown.vue +0 -80
- package/kuasheng-ui/components/ks-date-picker/date-picker-right.vue +0 -87
- package/kuasheng-ui/components/ks-date-picker/date-picker-top.vue +0 -88
- package/kuasheng-ui/components/ks-date-picker/date-picker.js +0 -15
- package/kuasheng-ui/components/ks-date-picker/date-range-select.vue +0 -92
- package/kuasheng-ui/components/ks-date-picker/date-select.vue +0 -65
- package/kuasheng-ui/components/ks-date-picker/date-week-month.vue +0 -131
- package/kuasheng-ui/components/ks-date-picker/index.js +0 -12
- package/kuasheng-ui/components/ks-date-picker/mixin.js +0 -92
- package/kuasheng-ui/components/ks-date-picker/month-range-select.vue +0 -129
- package/kuasheng-ui/components/ks-date-picker/month-select.vue +0 -85
- package/kuasheng-ui/components/ks-date-picker/quarter-select.vue +0 -94
- package/kuasheng-ui/components/ks-date-picker/style.less +0 -121
- package/kuasheng-ui/components/ks-date-picker/utils.js +0 -109
- package/kuasheng-ui/components/ks-date-picker/week-select.vue +0 -99
- package/kuasheng-ui/components/ks-decrypt/index.vue +0 -159
- package/kuasheng-ui/components/ks-employee/README.md +0 -78
- package/kuasheng-ui/components/ks-employee/employee-input.vue +0 -173
- package/kuasheng-ui/components/ks-employee/employee-list.vue +0 -662
- package/kuasheng-ui/components/ks-employee/employee-popup.vue +0 -197
- package/kuasheng-ui/components/ks-employee/employee-search.vue +0 -250
- package/kuasheng-ui/components/ks-employee/employee-selected.vue +0 -173
- package/kuasheng-ui/components/ks-employee/index.js +0 -17
- package/kuasheng-ui/components/ks-employee/package-lock.json +0 -5
- package/kuasheng-ui/components/ks-employee/package.json +0 -15
- package/kuasheng-ui/components/ks-employee/yarn.lock +0 -4
- package/kuasheng-ui/components/ks-field-money/index.js +0 -8
- package/kuasheng-ui/components/ks-field-money/index.vue +0 -212
- package/kuasheng-ui/components/ks-field-money/package.json +0 -11
- package/kuasheng-ui/components/ks-field-money/utils.js +0 -65
- 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 +0 -131
- package/kuasheng-ui/components/ks-history-search/history-list.vue +0 -188
- package/kuasheng-ui/components/ks-history-search/img/delete.png +0 -0
- package/kuasheng-ui/components/ks-history-search/index.js +0 -9
- package/kuasheng-ui/components/ks-history-search/index.vue +0 -125
- package/kuasheng-ui/components/ks-history-search/package-lock.json +0 -5
- package/kuasheng-ui/components/ks-history-search/package.json +0 -15
- package/kuasheng-ui/components/ks-history-search/utils.js +0 -35
- package/kuasheng-ui/components/ks-input-search/index.vue +0 -106
- package/kuasheng-ui/components/ks-list/index.vue +0 -75
- package/kuasheng-ui/components/ks-loading/index.js +0 -16
- package/kuasheng-ui/components/ks-month/index.vue +0 -47
- package/kuasheng-ui/components/ks-month/package.json +0 -3
- package/kuasheng-ui/components/ks-month/range.vue +0 -172
- package/kuasheng-ui/components/ks-month/single.vue +0 -136
- package/kuasheng-ui/components/ks-month/style.less +0 -125
- package/kuasheng-ui/components/ks-month/utils.js +0 -35
- package/kuasheng-ui/components/ks-nav/index.vue +0 -264
- package/kuasheng-ui/components/ks-nav-bar.js +0 -35
- package/kuasheng-ui/components/ks-org/ks-org-tree.vue +0 -247
- package/kuasheng-ui/components/ks-org/ks-popup-tree.vue +0 -154
- package/kuasheng-ui/components/ks-org/ks-tree-input.vue +0 -240
- package/kuasheng-ui/components/ks-org/ks-tree-node.vue +0 -94
- package/kuasheng-ui/components/ks-org/ks-tree.vue +0 -229
- package/kuasheng-ui/components/ks-org/utils.js +0 -54
- package/kuasheng-ui/components/ks-popover/index.vue +0 -457
- package/kuasheng-ui/components/ks-popover/mixin.js +0 -28
- package/kuasheng-ui/components/ks-popover/utils.js +0 -60
- package/kuasheng-ui/components/ks-pull-refresh/index.vue +0 -43
- package/kuasheng-ui/components/ks-quarter/index.vue +0 -256
- package/kuasheng-ui/components/ks-table/README.md +0 -103
- package/kuasheng-ui/components/ks-table/cell.vue +0 -31
- package/kuasheng-ui/components/ks-table/index.js +0 -8
- package/kuasheng-ui/components/ks-table/index.less +0 -486
- package/kuasheng-ui/components/ks-table/index.vue +0 -1088
- package/kuasheng-ui/components/ks-table/package.json +0 -12
- package/kuasheng-ui/components/ks-table/release.md +0 -7
- package/kuasheng-ui/components/ks-toast.js +0 -35
- package/kuasheng-ui/components/ks-upload/index.vue +0 -174
- package/kuasheng-ui/components/ks-user-access.vue +0 -229
- package/kuasheng-ui/components/no-data/README.md +0 -45
- package/kuasheng-ui/components/no-data/image.js +0 -1
- package/kuasheng-ui/components/no-data/index.vue +0 -83
- package/kuasheng-ui/components/notice-bar.vue +0 -16
- package/kuasheng-ui/components/steps.js +0 -11
- package/kuasheng-ui/components/tabs.vue +0 -40
- package/kuasheng-ui/index.js +0 -239
- package/kuasheng-ui/patch/datetime-picker/datetimePicker.md +0 -0
- package/kuasheng-ui/patch/datetime-picker/index.js +0 -46
- package/kuasheng-ui/patch/datetime-picker/utils.js +0 -78
- package/kuasheng-ui/patch/field/field.md +0 -1
- package/kuasheng-ui/patch/field/index.js +0 -122
- package/kuasheng-ui/patch/field/utils.js +0 -36
- package/kuasheng-ui/patch/form/form.md +0 -7
- package/kuasheng-ui/patch/form/index.js +0 -106
- package/kuasheng-ui/patch/index.js +0 -12
- package/kuasheng-ui/patch/pagination/index.js +0 -78
- package/kuasheng-ui/style/animation-ui.less +0 -31
- 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 +0 -1
- package/kuasheng-ui/style/images/success.svg +0 -1
- package/kuasheng-ui/style/index.less +0 -6
- package/kuasheng-ui/style/kuasheng-ui.less +0 -207
- package/kuasheng-ui/style/reset-vant.less +0 -307
- package/kuasheng-ui/style/vant-var.less +0 -138
- package/kuasheng-ui/utils/apis.js +0 -17
- package/kuasheng-ui/utils/axios-adapter.js +0 -47
- package/kuasheng-ui/utils/bem.js +0 -39
- package/kuasheng-ui/utils/bus.js +0 -97
- package/kuasheng-ui/utils/common.js +0 -88
- package/kuasheng-ui/utils/decrypt/config.js +0 -12
- package/kuasheng-ui/utils/decrypt/decrypt-api.js +0 -139
- package/kuasheng-ui/utils/decrypt/index.js +0 -6
- package/kuasheng-ui/utils/decrypt/mask.js +0 -36
- package/kuasheng-ui/utils/decrypt/virtual.js +0 -44
- package/kuasheng-ui/utils/directive.js +0 -57
- package/kuasheng-ui/utils/directive.md +0 -23
- package/kuasheng-ui/utils/drcheck-plugin.js +0 -219
- package/kuasheng-ui/utils/error-plugin.js +0 -88
- package/kuasheng-ui/utils/filter.js +0 -149
- package/kuasheng-ui/utils/http-interceptors.js +0 -18
- package/kuasheng-ui/utils/http.js +0 -140
- package/kuasheng-ui/utils/index.js +0 -5
- package/kuasheng-ui/utils/init-event.js +0 -20
- package/kuasheng-ui/utils/log.js +0 -309
- package/kuasheng-ui/utils/token.js +0 -9
- package/kuasheng-ui/utils/type.js +0 -45
- package/kuasheng-ui/utils/validate.js +0 -20
- package/kuasheng-ui/utils/watermark.js +0 -67
- package/kuasheng-ui/version.js +0 -1
- package/ky-apm/client.js +0 -37
- package/ky-apm/customHttp.js +0 -38
- package/ky-apm/index.js +0 -68
- package/ky-apm/plugins/performance.js +0 -84
- package/ky-apm/plugins/self-error.js +0 -26
- package/ky-apm/warn-log.js +0 -3
- package/plugin/ks-chii-webpack-html/index.js +0 -53
- package/plugin/ks-chii-webpack-html/package.json +0 -16
- package/postcss.config.js +0 -15
- package/public/capsule-positon.js +0 -50
- package/public/fonts/DingTalkJinBuTi.ttf +0 -0
- package/public/framework/axios@0.19.0.min.js +0 -9
- package/public/framework/fastclick@1.0.6.min.js +0 -1
- package/public/framework/iconfont/iconfont.css +0 -91
- package/public/framework/iconfont/iconfont.js +0 -1
- package/public/framework/iconfont/iconfont.json +0 -142
- 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 +0 -7
- package/public/framework/vue-router@3.1.3.min.js +0 -6
- package/public/framework/vue@2.6.10.runtime.min.js +0 -6
- package/public/framework/vuex@3.1.1.min.js +0 -6
- package/public/index.html +0 -260
- package/public/ks@3.0.8.umd.min.js +0 -1
- package/public/ksui@4.0.27.umd.min.js +0 -10
- package/public/status-bar-preset.js +0 -39
- package/qt-npm/ks-query-table.common.js.map +0 -1
- package/qt-npm/ks-query-table.umd.js.map +0 -1
- package/qt-npm/ks-query-table.umd.min.js.map +0 -1
- package/qt-npm/package.json +0 -13
- package/src/App.vue +0 -204
- package/src/common/README.md +0 -94
- package/src/common/http/axios-adapter.js +0 -47
- package/src/common/http/common.js +0 -88
- package/src/common/http/http-interceptors.js +0 -18
- package/src/common/http/http-lock.js +0 -45
- package/src/common/http/index.js +0 -163
- package/src/common/http/token.js +0 -9
- package/src/common/styles/font/AlibabaSans102Ver2-Md.ttf +0 -0
- package/src/common/styles/font.less +0 -12
- package/src/common/styles/variables.less +0 -43
- package/src/common/utils/index.js +0 -1
- package/src/common/utils/platform/README.md +0 -1
- package/src/common/utils/platform/android/.gitkeep +0 -0
- package/src/common/utils/platform/core/index.js +0 -24
- package/src/common/utils/platform/index.js +0 -164
- package/src/common/utils/platform/ios/.gitkeep +0 -0
- package/src/common/utils/platform/subscribe/helper.js +0 -38
- package/src/common/utils/platform/subscribe/index.js +0 -204
- package/src/common/utils/platform/subscribe/table-animation.js +0 -75
- package/src/config/index.js +0 -31
- package/src/config.js +0 -1
- package/src/main.js +0 -73
- package/src/router.js +0 -52
- package/src/view/home/config.js +0 -101
- package/src/view/home/demo1.vue +0 -223
- package/src/view/home/demo2.vue +0 -124
- package/src/view/home/demo3.vue +0 -51
- package/src/view/home/demo4.vue +0 -139
- package/src/view/home/index.vue +0 -97
- package/src/view/home/query-table/README.md +0 -45
- package/src/view/home/query-table/api/index.js +0 -12
- package/src/view/home/query-table/assets/horizontal-back.svg +0 -1
- package/src/view/home/query-table/components/pe-table/cell.js +0 -184
- package/src/view/home/query-table/components/pe-table/collapse.js +0 -334
- package/src/view/home/query-table/components/pe-table/empty.vue +0 -48
- package/src/view/home/query-table/components/pe-table/header.js +0 -328
- 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 +0 -1
- package/src/view/home/query-table/components/pe-table/images/sort.svg +0 -1
- package/src/view/home/query-table/components/pe-table/images/sorting.svg +0 -1
- package/src/view/home/query-table/components/pe-table/images/unfold.svg +0 -1
- package/src/view/home/query-table/components/pe-table/index.vue +0 -841
- package/src/view/home/query-table/components/pe-table/load-more.js +0 -46
- package/src/view/home/query-table/components/pe-table/props/index.js +0 -193
- package/src/view/home/query-table/components/pe-table/row.vue +0 -118
- package/src/view/home/query-table/components/pe-table/scrollbar.js +0 -424
- package/src/view/home/query-table/components/pe-table/stretch-damping.js +0 -112
- package/src/view/home/query-table/components/pe-table/style/cell.less +0 -89
- package/src/view/home/query-table/components/pe-table/style/empty.less +0 -48
- package/src/view/home/query-table/components/pe-table/style/header.less +0 -141
- package/src/view/home/query-table/components/pe-table/style/index.less +0 -88
- package/src/view/home/query-table/components/pe-table/style/load-more.less +0 -61
- package/src/view/home/query-table/components/pe-table/style/row.less +0 -6
- package/src/view/home/query-table/components/pe-table/table-loading.vue +0 -119
- package/src/view/home/query-table/components/pe-table/table-total.vue +0 -53
- package/src/view/home/query-table/components/pe-table/utils/animate.js +0 -80
- package/src/view/home/query-table/components/pe-table/utils/columns.js +0 -290
- package/src/view/home/query-table/components/pe-table/utils/data.js +0 -12
- package/src/view/home/query-table/components/pe-table/utils/fixed.js +0 -69
- package/src/view/home/query-table/components/pe-table/utils/formatter.js +0 -327
- package/src/view/home/query-table/components/pe-table/utils/render-cells.js +0 -424
- package/src/view/home/query-table/components/pe-table/utils/slot.js +0 -28
- package/src/view/home/query-table/components/pe-table/utils/tools.js +0 -84
- package/src/view/home/query-table/components/pe-table/utils/touch-scroll.js +0 -417
- package/src/view/home/query-table/components/query-table/index.vue +0 -496
- package/src/view/home/query-table/components/query-table/mixins/column-mixin.js +0 -102
- package/src/view/home/query-table/components/query-table/mixins/column-setting.js +0 -143
- package/src/view/home/query-table/components/query-table/mixins/data-mixin.js +0 -511
- package/src/view/home/query-table/components/query-table/mixins/pagination-mixin.js +0 -26
- package/src/view/home/query-table/components/query-table/mixins/table-fixed.js +0 -115
- package/src/view/home/query-table/components/query-table/mixins/table-horizontal.js +0 -118
- package/src/view/home/query-table/components/table-horizontal.vue +0 -99
- package/src/view/home/query-table/components/table-pagination.vue +0 -32
- package/src/view/home/query-table/components/table-settings/assets/arrpw-up.svg +0 -1
- package/src/view/home/query-table/components/table-settings/assets/disabled-down.svg +0 -1
- package/src/view/home/query-table/components/table-settings/assets/disabled-up.svg +0 -1
- package/src/view/home/query-table/components/table-settings/assets/down.svg +0 -1
- package/src/view/home/query-table/components/table-settings/assets/up.svg +0 -1
- package/src/view/home/query-table/components/table-settings/index.less +0 -294
- package/src/view/home/query-table/components/table-settings/index.vue +0 -260
- package/src/view/home/query-table/components/table-settings/settings.vue +0 -479
- package/src/view/home/query-table/components/table-settings/test.js +0 -626
- 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 +0 -124
- package/src/view/home/query-table/hooks/use-cache-promise.js +0 -27
- package/src/view/home/query-table/hooks/use-column-config.js +0 -190
- package/src/view/home/query-table/hooks/use-encryption.js +0 -0
- package/src/view/home/query-table/hooks/use-generic-search.js +0 -95
- package/src/view/home/query-table/index.js +0 -7
- package/src/view/home/query-table/store/column-store.js +0 -0
- package/src/view/home/query-table/styles/table.less +0 -24
- package/src/view/home/query-table/utils/column.js +0 -36
- package/src/view/home/query-table/utils/config.js +0 -12
- package/src/view/home/query-table/utils/encryption.js +0 -32
- package/src/view/home/query-table/utils/http.js +0 -1
- package/src/view/home/query-table/utils/localStorage.js +0 -35
- package/src/view/home//351/246/226/351/241/265.md +0 -0
- package/src/web.js +0 -99
- package/vue.config.js +0 -128
- /package/{qt-npm/ks-query-table.css → ks-query-table.css} +0 -0
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { upDateLocalCache } from '../../../hooks/use-generic-search'
|
|
2
|
-
import TableSettings from '../../table-settings/index.vue'
|
|
3
|
-
import { setLocalStorageItem } from '../../../utils/localStorage'
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
data() {
|
|
8
|
-
return {
|
|
9
|
-
showSetting: false,
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
methods: {
|
|
13
|
-
createTableSetting() {
|
|
14
|
-
const $props = this.$props
|
|
15
|
-
if (!$props.showSettingDialog) {
|
|
16
|
-
return null
|
|
17
|
-
}
|
|
18
|
-
const slot = this.$slots.default ? this.$slots.default[0] : this.$scopedSlots
|
|
19
|
-
const tableSettingAttrs = {
|
|
20
|
-
props: {
|
|
21
|
-
value: this.showSetting,
|
|
22
|
-
tableColumns: this.onlineColumns,
|
|
23
|
-
innerTabVisible: this.$props.innerTabVisible,
|
|
24
|
-
disabledAutoHideClose: this.$props.disabledAutoHideClose,
|
|
25
|
-
isShowHorizontal: this.isShowHorizontal,
|
|
26
|
-
},
|
|
27
|
-
on: {
|
|
28
|
-
input: val => (this.showSetting = val),
|
|
29
|
-
confirm: this.settingsConfirm,
|
|
30
|
-
initColumns: this.initColumns,
|
|
31
|
-
cancel: this.settingsCancel,
|
|
32
|
-
back: this.settingsBack,
|
|
33
|
-
reset: this.settingsReset,
|
|
34
|
-
},
|
|
35
|
-
ref: 'tableSettings',
|
|
36
|
-
scopedSlots: {
|
|
37
|
-
top: slot['setting-top'],
|
|
38
|
-
},
|
|
39
|
-
}
|
|
40
|
-
return <TableSettings {...tableSettingAttrs}></TableSettings>
|
|
41
|
-
},
|
|
42
|
-
// 打开个性设置弹窗
|
|
43
|
-
openSetting() {
|
|
44
|
-
this.showSetting = true
|
|
45
|
-
},
|
|
46
|
-
// 个性设置弹窗关闭确认
|
|
47
|
-
settingsConfirm(val) {
|
|
48
|
-
// 关闭动画和设置列头同时执行,在低端机器下阻塞进程。
|
|
49
|
-
setTimeout(async () => {
|
|
50
|
-
this.setOnlineColumns(val)
|
|
51
|
-
this.setColsToStorage(val)
|
|
52
|
-
await this.saveConfigToHttp(this.onlineColumns)
|
|
53
|
-
this.$emit('settingsConfirm', this.onlineColumns)
|
|
54
|
-
}, 0)
|
|
55
|
-
},
|
|
56
|
-
setColsToStorage(clos) {
|
|
57
|
-
if (!this.needCache) return
|
|
58
|
-
setLocalStorageItem('pe_stocks_quotes_table_fields-' + this.searchCode || '', JSON.stringify(clos))
|
|
59
|
-
},
|
|
60
|
-
// 个性设置取消
|
|
61
|
-
settingsCancel() {
|
|
62
|
-
this.$emit('settingsCancel')
|
|
63
|
-
},
|
|
64
|
-
// 个性设置返回
|
|
65
|
-
settingsBack() {
|
|
66
|
-
this.$emit('settingsBack')
|
|
67
|
-
},
|
|
68
|
-
// 个性设置重置
|
|
69
|
-
async settingsReset() {
|
|
70
|
-
this.resizeColumnMap = this.clearResizeColumnMap()
|
|
71
|
-
let val = await this.resetToHttp()
|
|
72
|
-
this.setOnlineColumns(val)
|
|
73
|
-
this.setColsToStorage(val)
|
|
74
|
-
this.$emit('settingsReset', this.onlineColumns)
|
|
75
|
-
},
|
|
76
|
-
/**
|
|
77
|
-
* 用户变更列显示/隐藏后,保存状态
|
|
78
|
-
* @param {*} columns
|
|
79
|
-
* @returns
|
|
80
|
-
*/
|
|
81
|
-
async saveConfigToHttp(columns) {
|
|
82
|
-
if (this.columns.length && !this.forceSaveSettings) {
|
|
83
|
-
return
|
|
84
|
-
}
|
|
85
|
-
this.genericId = await this.getGenericId()
|
|
86
|
-
let fieldContent = this.formatFieldContent(columns)
|
|
87
|
-
let fieldSnapshot = this.formatFieldSnapshot(columns)
|
|
88
|
-
let params = {
|
|
89
|
-
genericId: this.genericId,
|
|
90
|
-
menuId: ksui.menu.id,
|
|
91
|
-
fieldContent: JSON.stringify(fieldContent),
|
|
92
|
-
fieldSnapshot: JSON.stringify(fieldSnapshot),
|
|
93
|
-
}
|
|
94
|
-
await this.$http('system.genericSearch.field.saveOrUpdate', 10124, params)
|
|
95
|
-
await upDateLocalCache(params, 'update')
|
|
96
|
-
},
|
|
97
|
-
/**
|
|
98
|
-
* 个性设置重置
|
|
99
|
-
* @returns
|
|
100
|
-
*/
|
|
101
|
-
async resetToHttp() {
|
|
102
|
-
this.genericId = await this.getGenericId()
|
|
103
|
-
let params = {
|
|
104
|
-
genericId: this.genericId,
|
|
105
|
-
menuId: ksui.menu.id
|
|
106
|
-
}
|
|
107
|
-
let res = await this.$http('system.genericSearch.field.reset', 10124, params)
|
|
108
|
-
window.vant.Toast('重置成功')
|
|
109
|
-
let resetCols = JSON.parse(res.genericSearch)
|
|
110
|
-
resetCols.forEach(v => this.mergeColumn(v))
|
|
111
|
-
// upDateCatch({ id: params.genericId })
|
|
112
|
-
await upDateLocalCache({ ...params, fieldContent: res.genericSearch }, 'reset')
|
|
113
|
-
return resetCols
|
|
114
|
-
},
|
|
115
|
-
// 获取show的列
|
|
116
|
-
formatFieldContent(columns) {
|
|
117
|
-
return columns.filter(v => v.show).map(v => {
|
|
118
|
-
if (v.children) {
|
|
119
|
-
return {
|
|
120
|
-
key: v.key,
|
|
121
|
-
child: (v.children || []).filter(c => c.show).map(c => c.key)
|
|
122
|
-
}
|
|
123
|
-
} else {
|
|
124
|
-
return v.key
|
|
125
|
-
}
|
|
126
|
-
})
|
|
127
|
-
},
|
|
128
|
-
// 获取快照
|
|
129
|
-
formatFieldSnapshot(columns) {
|
|
130
|
-
return columns.reduce((prev, cur) => {
|
|
131
|
-
let obj = { show: !!cur.show }
|
|
132
|
-
if (cur.children && cur.children.length) {
|
|
133
|
-
obj.children = cur.children.reduce((p, c) => {
|
|
134
|
-
p[c.key] = { show: !!c.show }
|
|
135
|
-
return p
|
|
136
|
-
}, {})
|
|
137
|
-
}
|
|
138
|
-
prev[cur.key] = obj
|
|
139
|
-
return prev
|
|
140
|
-
}, {})
|
|
141
|
-
},
|
|
142
|
-
}
|
|
143
|
-
}
|
|
@@ -1,511 +0,0 @@
|
|
|
1
|
-
import cloneDeep from 'lodash/cloneDeep'
|
|
2
|
-
import debounce from 'lodash/debounce'
|
|
3
|
-
// 无限滚动数据的更新时间,防止用户长时间停留,滑动后数据不更新
|
|
4
|
-
const UPDATE_INTERVAL = 5 * 60 * 1000
|
|
5
|
-
// 获取全量id的数量
|
|
6
|
-
const idsPageSize = 10000
|
|
7
|
-
// 每次更新数据的数量
|
|
8
|
-
const upLength = Math.ceil(window.screen.width / 44) + 2
|
|
9
|
-
// 无限滚动需要多加载的行数
|
|
10
|
-
const addRowLength = 500
|
|
11
|
-
|
|
12
|
-
export default {
|
|
13
|
-
props: {
|
|
14
|
-
autoLoadData: {
|
|
15
|
-
type: Boolean,
|
|
16
|
-
default: true
|
|
17
|
-
},
|
|
18
|
-
disabledLoading: {
|
|
19
|
-
type: Boolean,
|
|
20
|
-
default: false
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
data() {
|
|
24
|
-
return {
|
|
25
|
-
// 本次滚动前的开始行
|
|
26
|
-
beforeStartRow: 0,
|
|
27
|
-
// 本次滚动前的结束行
|
|
28
|
-
beforeEndRow: 0,
|
|
29
|
-
// 全量的ids
|
|
30
|
-
tableScrollIds: [],
|
|
31
|
-
// 所有的数据映射map
|
|
32
|
-
tableMap: {},
|
|
33
|
-
lastReqTime: null, // TODO 需要保证code与数据一致,且是最后一次的请求
|
|
34
|
-
// 缓存的排序参数
|
|
35
|
-
orderByClauses: null,
|
|
36
|
-
// querytable 默认300
|
|
37
|
-
innterDelayLoading: 300,
|
|
38
|
-
dataFinish_timeStamp: null, // 数据返回时间
|
|
39
|
-
idsFinish_timeStamp: null, // ids最后返回时间
|
|
40
|
-
isLoadingMore: false // 加载更多加载中状态
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
computed: {
|
|
44
|
-
// 无限滚动用来加载视口数据的key
|
|
45
|
-
idsKey() {
|
|
46
|
-
// 非无限滚动也需要生成map映射
|
|
47
|
-
return this.config.idsKey || this.config.scrollLoad?.idsKey || 'code'
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
created() {
|
|
51
|
-
this.initDefaultData()
|
|
52
|
-
},
|
|
53
|
-
mounted() {
|
|
54
|
-
if (!this.autoLoadData) {
|
|
55
|
-
return
|
|
56
|
-
}
|
|
57
|
-
this.loadData()
|
|
58
|
-
},
|
|
59
|
-
methods: {
|
|
60
|
-
async loadMoreData() {
|
|
61
|
-
// 防止重复加载及无数据时触发
|
|
62
|
-
if (this.isLoadingMore || this.isLoading || !this.tableData || this.tableData.leng === 0) return
|
|
63
|
-
this.isLoadingMore = true
|
|
64
|
-
this.loadData({ page: this.currentPage + 1, loadMore: true })
|
|
65
|
-
},
|
|
66
|
-
initDefaultData() {
|
|
67
|
-
// 不需要响应式
|
|
68
|
-
this.loadIdsMap = {}
|
|
69
|
-
// 需要更新进表格的数据
|
|
70
|
-
this.willUpdateDataArr = []
|
|
71
|
-
},
|
|
72
|
-
// 处理分页参数
|
|
73
|
-
formatPageParams(params, options) {
|
|
74
|
-
const { page } = options || {}
|
|
75
|
-
params.page = page ? page : 1
|
|
76
|
-
return params
|
|
77
|
-
},
|
|
78
|
-
// 处理当前页总数
|
|
79
|
-
formatRowTotal(res) {
|
|
80
|
-
const { scrollLoad } = this.config
|
|
81
|
-
if (!scrollLoad) {
|
|
82
|
-
// 非无限滚动,需要设置为出参表格行数
|
|
83
|
-
res.rowTotal = res.rows.length
|
|
84
|
-
}
|
|
85
|
-
return res
|
|
86
|
-
},
|
|
87
|
-
// 处理排序参数
|
|
88
|
-
formatSortParams(params, options) {
|
|
89
|
-
const { reqProp, order } = options || {}
|
|
90
|
-
if (!(reqProp || this.orderByClauses)) return params
|
|
91
|
-
if (reqProp) {
|
|
92
|
-
// 优先使用传入的排序参数,并保存
|
|
93
|
-
let _orderByClauses = [{ field: reqProp, orderByMode: order === 'ascending' ? 0 : 1 }]
|
|
94
|
-
params.orderByClauses = _orderByClauses
|
|
95
|
-
this.orderByClauses = _orderByClauses
|
|
96
|
-
} else if (this.orderByClauses) {
|
|
97
|
-
// 翻页或其他场景,使用缓存好的排序参数
|
|
98
|
-
params.orderByClauses = this.orderByClauses
|
|
99
|
-
}
|
|
100
|
-
return params
|
|
101
|
-
},
|
|
102
|
-
// 请求数据
|
|
103
|
-
async loadData(options) {
|
|
104
|
-
return new Promise(async (resolve, reject) => {
|
|
105
|
-
try {
|
|
106
|
-
if (!this.disabledLoading && !(options && options.loadMore)) {
|
|
107
|
-
// 底部加载更多时无需表格全局loading
|
|
108
|
-
this.isLoading = true
|
|
109
|
-
}
|
|
110
|
-
const { url, appkey, beforeHttp, afterHttp, scrollLoad, afterSetData, firstScreenDataCompleted } = this.config
|
|
111
|
-
const now = new Date().valueOf()
|
|
112
|
-
this.lastReqTime = now
|
|
113
|
-
|
|
114
|
-
// 需要无限滚动,加载全量id
|
|
115
|
-
scrollLoad && this.loadTableScrollIds(now, options)
|
|
116
|
-
|
|
117
|
-
let params = {
|
|
118
|
-
// 默认页码200
|
|
119
|
-
pageSize: this.config.pageSize || 200
|
|
120
|
-
}
|
|
121
|
-
// 请求前,外部可处理入参
|
|
122
|
-
let beforeParams = { url, appkey, params }
|
|
123
|
-
// 合并外部return的参数
|
|
124
|
-
let $params = typeof beforeHttp === 'function' ? { ...beforeParams, ...await beforeHttp(beforeParams) } : beforeParams
|
|
125
|
-
|
|
126
|
-
let { url: _url, appkey: _appkey, params: _params } = $params
|
|
127
|
-
|
|
128
|
-
// 每次请求,记录时间戳
|
|
129
|
-
let serach_time_stamp = now
|
|
130
|
-
|
|
131
|
-
// 处理分页参数
|
|
132
|
-
_params = this.formatPageParams(_params, options)
|
|
133
|
-
// 处理排序参数
|
|
134
|
-
_params = this.formatSortParams(_params, options)
|
|
135
|
-
let res = await this.$http(_url, _appkey, _params)
|
|
136
|
-
// 非无限滚动,重复请求,不赋值
|
|
137
|
-
if (!scrollLoad && serach_time_stamp < this.lastReqTime) {
|
|
138
|
-
return
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// 只赋值最后一次的请求
|
|
142
|
-
if (serach_time_stamp && this.lastReqTime && serach_time_stamp < this.lastReqTime) return
|
|
143
|
-
|
|
144
|
-
// 请求后,外部可处理出参
|
|
145
|
-
res = typeof afterHttp === 'function' ? await afterHttp(res) : res
|
|
146
|
-
res = this.formatRowTotal(res)
|
|
147
|
-
|
|
148
|
-
const { rowTotal, rows } = res
|
|
149
|
-
|
|
150
|
-
this.setTableData({ rowTotal, rows }, now, options)
|
|
151
|
-
|
|
152
|
-
// TODO 首屏数据设置完成
|
|
153
|
-
typeof afterSetData === 'function' && afterSetData()
|
|
154
|
-
typeof firstScreenDataCompleted === 'function' && firstScreenDataCompleted({ rowTotal, rows })
|
|
155
|
-
// this.tableData = res.rows
|
|
156
|
-
// TODO 取出参配置有问题
|
|
157
|
-
!scrollLoad && this.setPage({ page: _params.page, pageTotal: res.pageTotal })
|
|
158
|
-
if (options && options.loadMore && _params.page >= res.pageTotal || !!scrollLoad) {
|
|
159
|
-
// 当前页码等于最大页码时 或者 无限滚动
|
|
160
|
-
this.loadMoreFinish = true
|
|
161
|
-
}
|
|
162
|
-
this.isLoading = false
|
|
163
|
-
resolve(res)
|
|
164
|
-
} catch (error) {
|
|
165
|
-
this.checkNetType(error)
|
|
166
|
-
// TODO 错误是否需要清空数据
|
|
167
|
-
console.error('[query-table-search-error]', error)
|
|
168
|
-
reject(error)
|
|
169
|
-
}
|
|
170
|
-
})
|
|
171
|
-
},
|
|
172
|
-
// TODO, 暂时处理单元格数据 key都不存在的情况。此方法影响性能,后续要去除
|
|
173
|
-
createBaseData() {
|
|
174
|
-
// return Object.keys(val).reduce((base, v) => {
|
|
175
|
-
// base[v] = '-'
|
|
176
|
-
// return base
|
|
177
|
-
// }, {})
|
|
178
|
-
return {}
|
|
179
|
-
},
|
|
180
|
-
// 获取无限滚动需要的全量id
|
|
181
|
-
async loadTableScrollIds(now, options) {
|
|
182
|
-
try {
|
|
183
|
-
const { scrollLoad, appkey } = this.config
|
|
184
|
-
if (!scrollLoad) return
|
|
185
|
-
|
|
186
|
-
const { getIdsUrl, idsBeforeHttp, idsAfterHttp } = scrollLoad
|
|
187
|
-
|
|
188
|
-
let params = {}
|
|
189
|
-
|
|
190
|
-
// 请求前,外部可处理入参
|
|
191
|
-
let idsBeforeParams = { url: getIdsUrl, appkey, params }
|
|
192
|
-
// 合并外部return的参数
|
|
193
|
-
let $params = typeof idsBeforeHttp === 'function' ? { ...idsBeforeParams, ...await idsBeforeHttp(idsBeforeParams) } : idsBeforeParams
|
|
194
|
-
|
|
195
|
-
let { url: _url, appkey: _appkey, params: _params } = $params
|
|
196
|
-
// 无限滚动,首页数据需要设置唯一时间戳,用于校验是否为最后一次请求,与首页数据时间戳一致
|
|
197
|
-
let serach_time_stamp = now
|
|
198
|
-
|
|
199
|
-
// 处理排序参数
|
|
200
|
-
_params = this.formatSortParams(_params, options)
|
|
201
|
-
// id写死最大请求数量
|
|
202
|
-
let res = await this.$http(_url, _appkey, { ..._params, pageSize: idsPageSize })
|
|
203
|
-
|
|
204
|
-
// 只赋值最后一次的请求
|
|
205
|
-
if (serach_time_stamp && this.lastReqTime && serach_time_stamp < this.lastReqTime) return
|
|
206
|
-
|
|
207
|
-
// 请求后,外部可处理出参
|
|
208
|
-
res = typeof idsAfterHttp === 'function' ? await idsAfterHttp(res) : res
|
|
209
|
-
|
|
210
|
-
// res 需要处理成字符串数组['id1', 'id2]
|
|
211
|
-
this.tableScrollIds = res
|
|
212
|
-
|
|
213
|
-
this.idsFinish_timeStamp = now
|
|
214
|
-
|
|
215
|
-
this.setTableScrollIds()
|
|
216
|
-
} catch (error) {
|
|
217
|
-
console.error('[query-table-search-ids]', error)
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
// 无限滚动过程中加载数据
|
|
221
|
-
async scrollLoadData(scrollOptions) {
|
|
222
|
-
try {
|
|
223
|
-
const { scrollLoad, appkey, url } = this.config
|
|
224
|
-
if (!scrollLoad) return
|
|
225
|
-
|
|
226
|
-
const { scrollBeforeHttp, scrollAfterHttp } = scrollLoad
|
|
227
|
-
let params = {}
|
|
228
|
-
|
|
229
|
-
// 请求前,外部可处理入参
|
|
230
|
-
let scrollBeforeParams = { url, appkey, params }
|
|
231
|
-
|
|
232
|
-
let $params = typeof scrollBeforeHttp === 'function' ? { ...scrollBeforeParams, ...await scrollBeforeHttp(scrollBeforeParams, scrollOptions) } : scrollBeforeParams
|
|
233
|
-
|
|
234
|
-
let { url: _url, appkey: _appkey, params: _params } = $params
|
|
235
|
-
|
|
236
|
-
let res = await this.$http(_url, _appkey, _params)
|
|
237
|
-
|
|
238
|
-
// 请求后,外部可处理出参
|
|
239
|
-
res = typeof scrollAfterHttp === 'function' ? await scrollAfterHttp(res) : res
|
|
240
|
-
|
|
241
|
-
this.updateTableData(res.rows, 'api')
|
|
242
|
-
} catch (error) {
|
|
243
|
-
console.error('[query-table-scrollLoadData]', error)
|
|
244
|
-
}
|
|
245
|
-
// 清空本次请求加载中的ids
|
|
246
|
-
this.clearLoadIds(scrollOptions.code)
|
|
247
|
-
},
|
|
248
|
-
// 清空加载中的ids
|
|
249
|
-
clearLoadIds(codes) {
|
|
250
|
-
for (let index = 0; index < codes.length; index++) {
|
|
251
|
-
delete this.loadIdsMap[codes[index]]
|
|
252
|
-
}
|
|
253
|
-
},
|
|
254
|
-
async setTableData(val, now, loadOptions) {
|
|
255
|
-
let { rowTotal, rows, options: scrollData } = val
|
|
256
|
-
const nowDateStr = +new Date()
|
|
257
|
-
if (!scrollData) {
|
|
258
|
-
// 第一页数据,非滚动
|
|
259
|
-
this.total = rowTotal
|
|
260
|
-
let tableData = []
|
|
261
|
-
let item = null
|
|
262
|
-
// 设置第一页数据,全部双向绑定
|
|
263
|
-
for (let index = 0; index < rows.length; index++) {
|
|
264
|
-
item = rows[index]
|
|
265
|
-
tableData.push({ ...item, id: 'pe_' + Math.random().toString(), __updateTime: nowDateStr })
|
|
266
|
-
}
|
|
267
|
-
// 根据总条数设置空行,用于一次展示所有数据,后续滚动过程中请求后合并空数据
|
|
268
|
-
for (let index = rows.length; index < rowTotal; index++) {
|
|
269
|
-
tableData.push({ ...this.createBaseData(rows[0]), id: 'pe_' + Math.random().toString(), name: '-', selectedFlag: null })
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
if (loadOptions && loadOptions.loadMore) {
|
|
273
|
-
rows.forEach(v => this.tableData.push(v))
|
|
274
|
-
} else {
|
|
275
|
-
this.tableData = tableData
|
|
276
|
-
}
|
|
277
|
-
this.isLoadingMore = false
|
|
278
|
-
this.dataFinish_timeStamp = now
|
|
279
|
-
|
|
280
|
-
this.setTableScrollIds()
|
|
281
|
-
|
|
282
|
-
// 第一页数据,让表格回到顶部
|
|
283
|
-
if (!(loadOptions && loadOptions.loadMore)) {
|
|
284
|
-
this.$refs.peTable && this.$refs.peTable.scrollToTop()
|
|
285
|
-
// 如果有数据,异步存入到map内
|
|
286
|
-
setTimeout(() => {
|
|
287
|
-
this.tableData.forEach(item => {
|
|
288
|
-
if (item.__updateTime) {
|
|
289
|
-
this.tableMap[item[this.idsKey]] = item
|
|
290
|
-
}
|
|
291
|
-
})
|
|
292
|
-
}, 0)
|
|
293
|
-
}
|
|
294
|
-
} else {
|
|
295
|
-
// 滚动加载的数据
|
|
296
|
-
this.updateTableData(rows, 'api')
|
|
297
|
-
}
|
|
298
|
-
},
|
|
299
|
-
// 表格滑动拉取数据
|
|
300
|
-
tableScrollPullData: debounce(async function (e) {
|
|
301
|
-
const { scrollLoad } = this.config
|
|
302
|
-
if (!scrollLoad) return
|
|
303
|
-
let { startRow, endRow, action, rowsPerViewport } = e
|
|
304
|
-
|
|
305
|
-
// code还没请求回来
|
|
306
|
-
if (!this.tableScrollIds.length) {
|
|
307
|
-
// 保存数据用于code取回来后立即执行
|
|
308
|
-
this.beforeStartRow = startRow
|
|
309
|
-
this.beforeEndRow = endRow
|
|
310
|
-
return
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
if (action === 'reload') {
|
|
314
|
-
// 立即请求
|
|
315
|
-
startRow = this.beforeStartRow
|
|
316
|
-
endRow = this.beforeEndRow
|
|
317
|
-
} else {
|
|
318
|
-
// 未产生行数变更时,不调用接口
|
|
319
|
-
if (this.beforeStartRow === startRow && this.beforeEndRow === endRow) {
|
|
320
|
-
return
|
|
321
|
-
} else {
|
|
322
|
-
this.beforeStartRow = startRow
|
|
323
|
-
this.beforeEndRow = endRow
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
// TODO ? 业务逻辑
|
|
329
|
-
// if (startRow !== undefined && endRow !== undefined && isPullKLine) {
|
|
330
|
-
// // 暂时隐藏,后续需要根据调用状态判断是否需要原生方法
|
|
331
|
-
// const curCodes = this.tableScrollIds.slice(startRow, endRow)
|
|
332
|
-
// try {
|
|
333
|
-
// window.ks.callFunc({ method: "preLoadStockKlineToFile", params: { ids: uniq(curCodes) } })
|
|
334
|
-
// } catch (error) {
|
|
335
|
-
// console.log(error)
|
|
336
|
-
// }
|
|
337
|
-
// }
|
|
338
|
-
|
|
339
|
-
// 优化处理,不重复请求已有数据
|
|
340
|
-
let codes = []
|
|
341
|
-
// 预加载多一屏数据
|
|
342
|
-
|
|
343
|
-
// 是否需要预加载
|
|
344
|
-
// 校验下一屏是否是空的
|
|
345
|
-
const checkNextViewData = () => {
|
|
346
|
-
const nowDateStr = +new Date()
|
|
347
|
-
let checkStartRow = startRow
|
|
348
|
-
let checkEndRow = endRow + rowsPerViewport
|
|
349
|
-
let id = null
|
|
350
|
-
let item = null
|
|
351
|
-
let load = false
|
|
352
|
-
while (checkStartRow <= checkEndRow) {
|
|
353
|
-
id = this.tableScrollIds[checkStartRow]
|
|
354
|
-
item = this.tableMap[id]
|
|
355
|
-
const noItem = id && !item
|
|
356
|
-
const oldItem = item && (!item.__updateTime || nowDateStr > UPDATE_INTERVAL + item.__updateTime)
|
|
357
|
-
if (id && (noItem || oldItem)) {
|
|
358
|
-
load = true
|
|
359
|
-
break
|
|
360
|
-
}
|
|
361
|
-
checkStartRow++
|
|
362
|
-
}
|
|
363
|
-
return load
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
if (!checkNextViewData()) {
|
|
367
|
-
return
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
let preloadEndRow = Math.min(endRow + addRowLength, this.tableScrollIds.length)
|
|
371
|
-
if (preloadEndRow > 0) {
|
|
372
|
-
let i = startRow
|
|
373
|
-
const nowDateStr = +new Date()
|
|
374
|
-
let id = null
|
|
375
|
-
let item = null
|
|
376
|
-
while (i <= preloadEndRow) {
|
|
377
|
-
// 如果已经有数据,不需要再请求获取
|
|
378
|
-
// 加入更新时间,如果超过指定时间需要重新获取
|
|
379
|
-
id = this.tableScrollIds[i] || ''
|
|
380
|
-
item = this.tableMap[id]
|
|
381
|
-
|
|
382
|
-
const noItem = id && !item
|
|
383
|
-
const oldItem = item && (!item.__updateTime || nowDateStr > UPDATE_INTERVAL + item.__updateTime)
|
|
384
|
-
const idLoad = this.loadIdsMap[id] // 加载中的数据
|
|
385
|
-
|
|
386
|
-
if (id && (noItem || oldItem) && !idLoad) {
|
|
387
|
-
codes.push(id)
|
|
388
|
-
this.loadIdsMap[id] = true
|
|
389
|
-
}
|
|
390
|
-
i++
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
if (!codes.length) return
|
|
395
|
-
|
|
396
|
-
let options = {
|
|
397
|
-
code: codes,
|
|
398
|
-
startRow,
|
|
399
|
-
endRow,
|
|
400
|
-
}
|
|
401
|
-
this.scrollLoadData(options)
|
|
402
|
-
|
|
403
|
-
}, 100),
|
|
404
|
-
/**
|
|
405
|
-
* 基于ID过滤并合并两个大型数组,保持原始顺序
|
|
406
|
-
* @param {Array} arr1 第一个数组(将被过滤)
|
|
407
|
-
* @param {Array} arr2 第二个数组(将完整保留)
|
|
408
|
-
* @returns {Array} 合并后的新数组
|
|
409
|
-
*/
|
|
410
|
-
filterAndMergeArrays(arr1, arr2) {
|
|
411
|
-
// 创建第二个数组的ID集合用于快速查找
|
|
412
|
-
const arr2IdSet = new Set()
|
|
413
|
-
for (const item of arr2) {
|
|
414
|
-
if (item[this.idsKey]) {
|
|
415
|
-
arr2IdSet.add(item[this.idsKey])
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
// 过滤第一个数组中存在于第二个数组的项
|
|
420
|
-
const filteredArr1 = []
|
|
421
|
-
for (const item of arr1) {
|
|
422
|
-
if (item[this.idsKey] && !arr2IdSet.has(item[this.idsKey])) {
|
|
423
|
-
filteredArr1.push(item)
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
// 合并数组(保持顺序)
|
|
428
|
-
return [...filteredArr1, ...arr2]
|
|
429
|
-
},
|
|
430
|
-
// 更新数据
|
|
431
|
-
updateTableData(arr, type, callback) {
|
|
432
|
-
// 去除已在队列中的的重复数据,以新的为准,减少更新操作,提升性能
|
|
433
|
-
this.willUpdateDataArr = this.filterAndMergeArrays([...this.willUpdateDataArr], arr)
|
|
434
|
-
const nowDateStr = +new Date()
|
|
435
|
-
const step = () => {
|
|
436
|
-
if (this.willUpdateDataArr.length === 0) return
|
|
437
|
-
// 每次只更新设置好的行数
|
|
438
|
-
let upList = this.willUpdateDataArr.splice(0, upLength)
|
|
439
|
-
for (let index = 0; index < upList.length; index++) {
|
|
440
|
-
const item = upList[index]
|
|
441
|
-
const id = item[this.idsKey]
|
|
442
|
-
// 后端返回的直接赋值,实时数据需要该行不为空
|
|
443
|
-
if (this.tableMap[id] && (type === 'api' || this.tableMap[id].__updateTime)) {
|
|
444
|
-
const oldItem = cloneDeep(this.tableMap[id])
|
|
445
|
-
Object.assign(this.tableMap[id], item, { __updateTime: nowDateStr })
|
|
446
|
-
callback && callback(this.tableMap[id], oldItem)
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
// 每次设置完数据,主动更新
|
|
450
|
-
this.$refs?.peTable?.renderViewportRows()
|
|
451
|
-
requestAnimationFrame(step)
|
|
452
|
-
}
|
|
453
|
-
requestAnimationFrame(step)
|
|
454
|
-
},
|
|
455
|
-
resetTableData(i) {
|
|
456
|
-
// 重置下总数
|
|
457
|
-
this.total = i
|
|
458
|
-
if (this.tableData.length !== i) {
|
|
459
|
-
this.tableData = this.tableData.slice(0, i)
|
|
460
|
-
}
|
|
461
|
-
},
|
|
462
|
-
checkSetIds() {
|
|
463
|
-
// 数据返回是最新的,并且ids返回是最新的
|
|
464
|
-
return this.dataFinish_timeStamp === this.lastReqTime && this.idsFinish_timeStamp === this.lastReqTime
|
|
465
|
-
},
|
|
466
|
-
// 给每一行数据设置数据需要的id
|
|
467
|
-
setTableScrollIds() {
|
|
468
|
-
if (!this.config.scrollLoad) return
|
|
469
|
-
// 需要首页search 和 ids 是同一轮
|
|
470
|
-
if (!this.checkSetIds()) return
|
|
471
|
-
let i = Math.min(this.tableData.length, this.tableScrollIds.length)
|
|
472
|
-
// 兜底,ids与rowTotal 长度不一致时,用短的
|
|
473
|
-
this.resetTableData(i)
|
|
474
|
-
let id = null
|
|
475
|
-
let item = null
|
|
476
|
-
while (i--) {
|
|
477
|
-
item = this.tableData[i]
|
|
478
|
-
if (item[this.idsKey] === '-' || !item[this.idsKey]) {
|
|
479
|
-
id = this.tableScrollIds[i]
|
|
480
|
-
item[this.idsKey] = id
|
|
481
|
-
this.tableMap[id] = item
|
|
482
|
-
this.tableMap[id].__index = i
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
const { scrollLoad } = this.config
|
|
486
|
-
const { setScrollIdsAfter } = scrollLoad
|
|
487
|
-
typeof setScrollIdsAfter === 'function' && setScrollIdsAfter()
|
|
488
|
-
},
|
|
489
|
-
// 校验网络状态
|
|
490
|
-
async checkNetType(e) {
|
|
491
|
-
this.isLoading = false
|
|
492
|
-
// 后端超时
|
|
493
|
-
if (e.data && [27057].includes(e.data.code)) {
|
|
494
|
-
this.tableData = []
|
|
495
|
-
this.tableIsAbnormal = true
|
|
496
|
-
return
|
|
497
|
-
}
|
|
498
|
-
// 前端取消
|
|
499
|
-
if (e.message === (window.networkTimeoutMessage || '请求超时,服务器未响应')) {
|
|
500
|
-
this.tableData = []
|
|
501
|
-
this.tableIsAbnormal = true
|
|
502
|
-
return
|
|
503
|
-
}
|
|
504
|
-
if (window.ks) {
|
|
505
|
-
const netStatus = await window.ks.callFunc({ method: 'getNetType', params: {} })
|
|
506
|
-
this.tableData = netStatus === 1 ? [] : this.tableData
|
|
507
|
-
this.tableIsAbnormal = netStatus === 1
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export default {
|
|
3
|
-
props: {
|
|
4
|
-
showPage: Boolean
|
|
5
|
-
},
|
|
6
|
-
data() {
|
|
7
|
-
return {
|
|
8
|
-
currentPage: 1,
|
|
9
|
-
totalPages: 1
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
methods: {
|
|
13
|
-
setPage(res) {
|
|
14
|
-
// TODO 需要缓存页码
|
|
15
|
-
// if (!this.showPage ) {
|
|
16
|
-
// return
|
|
17
|
-
// }
|
|
18
|
-
this.currentPage = res.page
|
|
19
|
-
this.totalPages = res.pageTotal
|
|
20
|
-
},
|
|
21
|
-
onPageChanged(newPage) {
|
|
22
|
-
this.currentPage = newPage
|
|
23
|
-
this.loadData({ page: newPage })
|
|
24
|
-
},
|
|
25
|
-
}
|
|
26
|
-
}
|