@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,355 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- <div :style="{ width: '100%', height: '100%' }" style="z-index: 10001"> -->
|
|
3
|
+
<div class="ks-area-select-multi">
|
|
4
|
+
<area-search ref="areaSearch" v-model="searchListShow" @closeDropdown="closeDropdown" @searchSelect="searchSelect" :placeholder="placeholder" />
|
|
5
|
+
<div class="formItem-input" v-show="!searchListShow">
|
|
6
|
+
<div class="formItem-input-content">
|
|
7
|
+
<van-dropdown-menu active-color="#03050D" z-index="10002" :overlay="false" v-show="textOver">
|
|
8
|
+
<van-dropdown-item
|
|
9
|
+
class="areapop-dropdown"
|
|
10
|
+
ref="areaPopDropdownItem"
|
|
11
|
+
title-class="ks-area-txt-icon"
|
|
12
|
+
@opened="showAreaPop = true"
|
|
13
|
+
@close="showAreaPop = false"
|
|
14
|
+
>
|
|
15
|
+
<template #title>
|
|
16
|
+
<div class="nav-item">
|
|
17
|
+
<img v-if="showAreaPop" src="https://erphostjs.kye-erp.com/kuasheng-h5/assets/ks-area-select/arrow-up@2x.png" alt="收起" />
|
|
18
|
+
<img v-else src="https://erphostjs.kye-erp.com/kuasheng-h5/assets/ks-area-select/arrow-down@2x.png" alt="展开" />
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
<area-list-pop :areaList="selectDisplayData" @remove="remove" :style="{ height: selectedPopHeight + 'px' }" />
|
|
22
|
+
</van-dropdown-item>
|
|
23
|
+
</van-dropdown-menu>
|
|
24
|
+
<div class="formItem-input-content-tags" v-if="!showAreaPop" ref="areaNamesBox">
|
|
25
|
+
<div v-if="selectDisplayData && selectDisplayData.length" class="formItem-input-value" ref="areaNames">
|
|
26
|
+
<span class="txtItem" v-for="item in selectDisplayData" :key="item.districtID">{{ item.name }} <ks-icon name="cross" @click="remove(item)"/></span>
|
|
27
|
+
</div>
|
|
28
|
+
<div v-else class="formItem-input-placeholder">{{ selectPlaceholder }}</div>
|
|
29
|
+
</div>
|
|
30
|
+
<div v-else class="area-pop-tip">已选区域</div>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="ks-area-picker-wrap" v-show="!searchListShow">
|
|
34
|
+
<areaPicker :level="levelOptions.length" :isArea="isArea" ref="areaPickerRef" />
|
|
35
|
+
</div>
|
|
36
|
+
<div class="bot-btn-wrap">
|
|
37
|
+
<van-button type="primary" plain round @click="onReset" class="btn-normal">重置</van-button>
|
|
38
|
+
<van-button type="primary" round @click="onSubmit">确定{{ selectDisplayData.length ? `(${selectDisplayData.length})` : '' }}</van-button>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
<!-- </div> -->
|
|
42
|
+
</template>
|
|
43
|
+
<script>
|
|
44
|
+
import { HOT_CITY_LIST } from './common'
|
|
45
|
+
import areaSearch from './area-search.vue'
|
|
46
|
+
import areaListPop from './areas-pop.vue'
|
|
47
|
+
import areaPicker from './area-picker.vue'
|
|
48
|
+
|
|
49
|
+
// const districtLevels = ['province', 'city', 'zone', 'street']
|
|
50
|
+
const getRouteName = (node, key = 'simpleName', join = '') => {
|
|
51
|
+
const routeNames = [node[key]]
|
|
52
|
+
let currentNode = node._parent
|
|
53
|
+
while (currentNode && currentNode.districtID && currentNode.districtID !== 'all') {
|
|
54
|
+
routeNames.push(currentNode[key])
|
|
55
|
+
currentNode = currentNode._parent
|
|
56
|
+
}
|
|
57
|
+
return routeNames.reverse().join(join)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export default {
|
|
61
|
+
props: {
|
|
62
|
+
// 最多可选择
|
|
63
|
+
maxlength: {
|
|
64
|
+
type: Number
|
|
65
|
+
},
|
|
66
|
+
placeholder: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: '请输入搜索内容'
|
|
69
|
+
},
|
|
70
|
+
selectPlaceholder: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: '请选择区域'
|
|
73
|
+
},
|
|
74
|
+
// 是否包括大区
|
|
75
|
+
isArea: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: false
|
|
78
|
+
},
|
|
79
|
+
// 热门城市列表
|
|
80
|
+
hotList: {
|
|
81
|
+
type: Array,
|
|
82
|
+
default: () => {
|
|
83
|
+
return HOT_CITY_LIST
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
// 地址树数据
|
|
87
|
+
areaData: {
|
|
88
|
+
type: Array,
|
|
89
|
+
default: () => {
|
|
90
|
+
return []
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
// 只读状态
|
|
94
|
+
readOnly: {
|
|
95
|
+
type: Boolean,
|
|
96
|
+
default: false
|
|
97
|
+
},
|
|
98
|
+
levelOptions: {
|
|
99
|
+
type: Array,
|
|
100
|
+
default: () => {
|
|
101
|
+
return [{ name: '省/直辖市', disabled: false }, { name: '城市' }, { name: '区/县' }, { name: '镇/街道' }]
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
name: 'ks-area-select-multi',
|
|
106
|
+
components: {
|
|
107
|
+
areaSearch,
|
|
108
|
+
areaListPop,
|
|
109
|
+
areaPicker
|
|
110
|
+
},
|
|
111
|
+
data() {
|
|
112
|
+
return {
|
|
113
|
+
idMap: null,
|
|
114
|
+
selectedPopHeight: 200,
|
|
115
|
+
checkedData: [],
|
|
116
|
+
searchListShow: false,
|
|
117
|
+
showAreaPop: false,
|
|
118
|
+
textOver: false
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
computed: {
|
|
122
|
+
selectDisplayData() {
|
|
123
|
+
const displayData =
|
|
124
|
+
this.checkedData.map(node => {
|
|
125
|
+
return { districtID: node.districtID, name: getRouteName(node) }
|
|
126
|
+
}) || []
|
|
127
|
+
return displayData
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
watch: {
|
|
131
|
+
selectDisplayData() {
|
|
132
|
+
setTimeout(() => {
|
|
133
|
+
if (this.$refs.areaNames) {
|
|
134
|
+
this.textOver = this.$refs.areaNames.clientWidth > this.$refs.areaNamesBox.clientWidth
|
|
135
|
+
if (this.textOver) {
|
|
136
|
+
this.selectedPopHeight = this.$refs.areaPickerRef.$el.clientHeight + 56
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}, 0)
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
// updated() {
|
|
143
|
+
// this.$refs.areaSearch.handleCancel()
|
|
144
|
+
// },
|
|
145
|
+
methods: {
|
|
146
|
+
closeDropdown() {
|
|
147
|
+
this.$refs.areaPopDropdownItem && this.$refs.areaPopDropdownItem.toggle(false)
|
|
148
|
+
},
|
|
149
|
+
closePop() {
|
|
150
|
+
// this.searchListShow = false
|
|
151
|
+
this.$refs.areaSearch && this.$refs.areaSearch.handleCancel()
|
|
152
|
+
this.closeDropdown()
|
|
153
|
+
},
|
|
154
|
+
remove(item) {
|
|
155
|
+
if (this.idMap) {
|
|
156
|
+
const mapItem = this.idMap.get(item.districtID)
|
|
157
|
+
// console.error(mapItem, 'mapItem')
|
|
158
|
+
this.$refs.areaPickerRef.checkboxClick(mapItem, mapItem.index, mapItem._erpZoom)
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
async searchSelect(item) {
|
|
162
|
+
if (!item.isChecked) {
|
|
163
|
+
await this.$refs.areaPickerRef.showHistoryDataChecked([
|
|
164
|
+
{
|
|
165
|
+
districtID: item.districtID,
|
|
166
|
+
districtName: item.districAllName,
|
|
167
|
+
simpleName: item.districtName
|
|
168
|
+
}
|
|
169
|
+
])
|
|
170
|
+
} else {
|
|
171
|
+
if (this.idMap) {
|
|
172
|
+
const mapItem = this.idMap.get(item.districtID)
|
|
173
|
+
await this.$refs.areaPickerRef.checkboxClick(mapItem, mapItem.index, mapItem._erpZoom)
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
this.$nextTick(() => {
|
|
177
|
+
this.$refs.areaSearch.updatedData()
|
|
178
|
+
})
|
|
179
|
+
},
|
|
180
|
+
onSubmit() {
|
|
181
|
+
this.$emit(
|
|
182
|
+
'change',
|
|
183
|
+
this.checkedData.map(item => {
|
|
184
|
+
return {
|
|
185
|
+
districtLevel: item.districtLevel,
|
|
186
|
+
districtID: item.districtID,
|
|
187
|
+
allDistrictID: getRouteName(item, 'districtID', '/'),
|
|
188
|
+
districtName: item.simpleName,
|
|
189
|
+
allDistrictName: getRouteName(item, 'simpleName', '/')
|
|
190
|
+
}
|
|
191
|
+
})
|
|
192
|
+
)
|
|
193
|
+
this.$emit('close')
|
|
194
|
+
},
|
|
195
|
+
onReset() {
|
|
196
|
+
this.textOver = false
|
|
197
|
+
this.searchListShow = false
|
|
198
|
+
this.closeDropdown()
|
|
199
|
+
this.$refs.areaPickerRef.clearAll()
|
|
200
|
+
this.$refs.areaSearch.updatedData()
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
</script>
|
|
205
|
+
<style lang="less" scoped>
|
|
206
|
+
.ks-area-select-multi {
|
|
207
|
+
position: relative;
|
|
208
|
+
height: 100%;
|
|
209
|
+
overflow: hidden;
|
|
210
|
+
.titleWrap {
|
|
211
|
+
width: 100%;
|
|
212
|
+
height: 28px;
|
|
213
|
+
margin-top: 52px;
|
|
214
|
+
margin-left: 16px;
|
|
215
|
+
.word {
|
|
216
|
+
display: inline-block;
|
|
217
|
+
font-size: 18px;
|
|
218
|
+
display: flex;
|
|
219
|
+
align-items: center;
|
|
220
|
+
.icon {
|
|
221
|
+
width: 20px;
|
|
222
|
+
height: 20px;
|
|
223
|
+
display: inline-block;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
.formItem-input {
|
|
228
|
+
height: 24px;
|
|
229
|
+
margin: 10px 0;
|
|
230
|
+
color: #888ea6;
|
|
231
|
+
font-size: 12px;
|
|
232
|
+
font-family: PingFangSC, PingFangSC-Regular;
|
|
233
|
+
font-weight: 400;
|
|
234
|
+
overflow: hidden;
|
|
235
|
+
padding: 0 0 0 16px;
|
|
236
|
+
line-height: 24px;
|
|
237
|
+
/deep/ .van-overlay {
|
|
238
|
+
height: 100vh !important;
|
|
239
|
+
}
|
|
240
|
+
.formItem-input-content {
|
|
241
|
+
position: relative;
|
|
242
|
+
-webkit-overflow-scrolling: unset;
|
|
243
|
+
/deep/ .van-dropdown-menu {
|
|
244
|
+
position: absolute;
|
|
245
|
+
z-index: 999;
|
|
246
|
+
height: 36px;
|
|
247
|
+
width: 58px;
|
|
248
|
+
top: -6px;
|
|
249
|
+
right: 0;
|
|
250
|
+
background: linear-gradient(90deg, rgba(255, 255, 255, 0) 12%, #ffffff 35%);
|
|
251
|
+
.van-dropdown-menu__title {
|
|
252
|
+
&::after {
|
|
253
|
+
display: none;
|
|
254
|
+
}
|
|
255
|
+
.van-ellipsis {
|
|
256
|
+
.nav-item {
|
|
257
|
+
position: relative;
|
|
258
|
+
width: 10px;
|
|
259
|
+
height: 18px;
|
|
260
|
+
img {
|
|
261
|
+
width: 10px;
|
|
262
|
+
height: 5px;
|
|
263
|
+
position: absolute;
|
|
264
|
+
top: 7px;
|
|
265
|
+
left: 0;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
.arrow-down-icon-active {
|
|
271
|
+
display: none;
|
|
272
|
+
}
|
|
273
|
+
.van-dropdown-item--down {
|
|
274
|
+
border-radius: 0;
|
|
275
|
+
}
|
|
276
|
+
.van-dropdown-item__content {
|
|
277
|
+
border-radius: 0 0 12px 12px;
|
|
278
|
+
border-start-end-radius: 0;
|
|
279
|
+
border-start-start-radius: 0;
|
|
280
|
+
max-height: unset !important;
|
|
281
|
+
border-end-end-radius: 20px;
|
|
282
|
+
border-end-start-radius: 20px;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
.area-pop-tip {
|
|
286
|
+
color: #03050d;
|
|
287
|
+
font-size: 12px;
|
|
288
|
+
}
|
|
289
|
+
.formItem-input-content-tags {
|
|
290
|
+
overflow-x: auto;
|
|
291
|
+
width: calc(100% - 40px);
|
|
292
|
+
&::-webkit-scrollbar {
|
|
293
|
+
display: none;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
.formItem-input-value {
|
|
298
|
+
color: #165DFF;
|
|
299
|
+
font-size: 12px;
|
|
300
|
+
width: max-content;
|
|
301
|
+
.txtItem {
|
|
302
|
+
display: inline-block;
|
|
303
|
+
background: #f1f0fe;
|
|
304
|
+
color: #165DFF;
|
|
305
|
+
border-radius: 4px;
|
|
306
|
+
padding: 6px 28px 6px 12px;
|
|
307
|
+
margin-left: 8px;
|
|
308
|
+
font-size: 12px;
|
|
309
|
+
font-family: PingFangSC, PingFangSC-Regular;
|
|
310
|
+
font-weight: 400;
|
|
311
|
+
line-height: 12px;
|
|
312
|
+
position: relative;
|
|
313
|
+
.van-icon {
|
|
314
|
+
position: absolute;
|
|
315
|
+
padding: 6px;
|
|
316
|
+
right: 0;
|
|
317
|
+
top: 0;
|
|
318
|
+
}
|
|
319
|
+
&:first-child {
|
|
320
|
+
margin-left: 0px;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
.ks-area-picker-wrap {
|
|
326
|
+
position: relative;
|
|
327
|
+
width: 100%;
|
|
328
|
+
height: calc(100% - 145px);
|
|
329
|
+
}
|
|
330
|
+
.bot-btn-wrap {
|
|
331
|
+
width: 100%;
|
|
332
|
+
position: absolute;
|
|
333
|
+
left: 0;
|
|
334
|
+
bottom: 0px;
|
|
335
|
+
box-sizing: border-box;
|
|
336
|
+
display: flex;
|
|
337
|
+
justify-content: space-around;
|
|
338
|
+
background-color: #fff;
|
|
339
|
+
padding: 10px 16px;
|
|
340
|
+
.van-button {
|
|
341
|
+
width: 50%;
|
|
342
|
+
height: 36px;
|
|
343
|
+
line-height: 34px;
|
|
344
|
+
border-radius: 6px !important;
|
|
345
|
+
}
|
|
346
|
+
.van-button--primary {
|
|
347
|
+
margin-left: 6px;
|
|
348
|
+
}
|
|
349
|
+
.van-button--plain {
|
|
350
|
+
margin-right: 6px;
|
|
351
|
+
margin-left: 0;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
</style>
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { cloneDeep } from './common'
|
|
2
|
+
|
|
3
|
+
const APPKEY = 10205
|
|
4
|
+
const setChildrenData = (data, item, idMap, key, rootChecked = false) => {
|
|
5
|
+
const cloneData = cloneDeep(data)
|
|
6
|
+
const childrenData = cloneData.map((v, index) => {
|
|
7
|
+
const splitName = v.districtName.split('-')
|
|
8
|
+
v.simpleName = splitName[splitName.length - 1]
|
|
9
|
+
v.isChecked = false
|
|
10
|
+
v.index = index + 1
|
|
11
|
+
v.isIndeterminate = false
|
|
12
|
+
v._erpZoom = key
|
|
13
|
+
v._parent = item
|
|
14
|
+
v.childrenNode = []
|
|
15
|
+
idMap.set(v.districtID, v)
|
|
16
|
+
return v
|
|
17
|
+
})
|
|
18
|
+
const childrenList = [
|
|
19
|
+
{
|
|
20
|
+
simpleName: '不限',
|
|
21
|
+
index: 0,
|
|
22
|
+
isChecked: rootChecked,
|
|
23
|
+
isChoose: false,
|
|
24
|
+
isIndeterminate: false,
|
|
25
|
+
districtLevel: item.districtLevel,
|
|
26
|
+
_erpZoom: key,
|
|
27
|
+
_parent: item
|
|
28
|
+
},
|
|
29
|
+
...childrenData
|
|
30
|
+
]
|
|
31
|
+
item.childrenNode = childrenList
|
|
32
|
+
return childrenList
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default {
|
|
36
|
+
methods: {
|
|
37
|
+
/**
|
|
38
|
+
* 获取子节点数据
|
|
39
|
+
* @param: item key
|
|
40
|
+
* **/
|
|
41
|
+
async getAreaChildren(idMap, item, key, rootChecked) {
|
|
42
|
+
try {
|
|
43
|
+
let method = 'address.addressBgTerritory.getMultiLevelThinkList'
|
|
44
|
+
let param = {
|
|
45
|
+
method: method,
|
|
46
|
+
jsonrpc: '2.0',
|
|
47
|
+
params: {
|
|
48
|
+
districtID: item.districtID,
|
|
49
|
+
showParam: 0
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const data = await this.$http(method, APPKEY, param)
|
|
53
|
+
if (data && data.districtList) {
|
|
54
|
+
return setChildrenData(data.districtList, item, idMap, key, rootChecked)
|
|
55
|
+
}
|
|
56
|
+
} catch (error) {
|
|
57
|
+
// console.log(error)
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
async getAreaLinkData(idArry, idMap, areaTree) {
|
|
61
|
+
try {
|
|
62
|
+
if (!idArry || !idArry.length) {
|
|
63
|
+
return
|
|
64
|
+
}
|
|
65
|
+
const data = await this.$http('address.regionInfo.getInfoByDistrictId', '50243', { districtIds: idArry })
|
|
66
|
+
if (data) {
|
|
67
|
+
// 大区对象
|
|
68
|
+
const treeData = data.childrenNode
|
|
69
|
+
const newMap = new Map()
|
|
70
|
+
const loopSetMap = function(mapData) {
|
|
71
|
+
newMap.set(mapData.districtID, mapData)
|
|
72
|
+
mapData.childrenNode &&
|
|
73
|
+
mapData.childrenNode.map(item => {
|
|
74
|
+
loopSetMap(item)
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
treeData.map(item => {
|
|
78
|
+
loopSetMap(item)
|
|
79
|
+
})
|
|
80
|
+
const loopAreaSet = function(areaItem) {
|
|
81
|
+
if (areaItem.districtID) {
|
|
82
|
+
if (!areaItem.childrenNode || !areaItem.childrenNode.length) {
|
|
83
|
+
// 排除不限
|
|
84
|
+
const childrenData = newMap.get(areaItem.districtID)
|
|
85
|
+
if (!childrenData || !childrenData.childrenNode) {
|
|
86
|
+
return
|
|
87
|
+
}
|
|
88
|
+
setChildrenData(childrenData.childrenNode, areaItem, idMap, areaItem._erpZoom + 1)
|
|
89
|
+
}
|
|
90
|
+
areaItem.childrenNode.map(item => {
|
|
91
|
+
loopAreaSet(item)
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
areaTree.childrenNode.map(areaItem => {
|
|
96
|
+
loopAreaSet(areaItem)
|
|
97
|
+
})
|
|
98
|
+
}
|
|
99
|
+
} catch (error) {
|
|
100
|
+
// console.log(error)
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
/**
|
|
104
|
+
* 向上(父级)递归数据处理
|
|
105
|
+
* @param: item
|
|
106
|
+
* **/
|
|
107
|
+
setFather(item) {
|
|
108
|
+
if (item._parent && item._erpZoom !== 0) {
|
|
109
|
+
const bortherItem = item._parent.childrenNode.slice(1, item._parent.childrenNode.length)
|
|
110
|
+
const allChecked = bortherItem.every(item => {
|
|
111
|
+
return item.isChecked
|
|
112
|
+
})
|
|
113
|
+
const allNoChecked = item._parent.childrenNode.every(item => {
|
|
114
|
+
return item.isChecked === false
|
|
115
|
+
})
|
|
116
|
+
const someIndeterminate = item._parent.childrenNode.some(item => {
|
|
117
|
+
return item.isIndeterminate === true
|
|
118
|
+
})
|
|
119
|
+
const firstItem = item._parent.childrenNode[0].isChecked
|
|
120
|
+
item._parent._parent &&
|
|
121
|
+
item._parent._parent.childrenNode.map(item => {
|
|
122
|
+
item.isChoose = false
|
|
123
|
+
})
|
|
124
|
+
item._parent.isChoose = true
|
|
125
|
+
item._parent.isChecked = firstItem || allChecked
|
|
126
|
+
item._parent.isIndeterminate = firstItem ? false : someIndeterminate || !(allNoChecked || allChecked)
|
|
127
|
+
if (item._parent._parent && item._erpZoom !== 1) {
|
|
128
|
+
item._parent._parent.childrenNode[0].isChecked = false
|
|
129
|
+
}
|
|
130
|
+
this.setFather(item._parent)
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
/**
|
|
134
|
+
* 同级数据处理
|
|
135
|
+
* @param: item itemIndex type
|
|
136
|
+
* **/
|
|
137
|
+
setPeer(item, itemIndex, type) {
|
|
138
|
+
if (itemIndex === 0) {
|
|
139
|
+
item._parent &&
|
|
140
|
+
item._parent.childrenNode.map((v, vIndex) => {
|
|
141
|
+
if (v.isChoose || v.isChecked || v.isIndeterminate) {
|
|
142
|
+
this.clearChildren(v)
|
|
143
|
+
}
|
|
144
|
+
if (vIndex === 0) {
|
|
145
|
+
v.isChecked = type
|
|
146
|
+
} else {
|
|
147
|
+
v.isChecked = false
|
|
148
|
+
v.isIndeterminate = false
|
|
149
|
+
}
|
|
150
|
+
v.isChoose = false
|
|
151
|
+
})
|
|
152
|
+
} else {
|
|
153
|
+
if (item._erpZoom !== 0) {
|
|
154
|
+
type && item._parent && (item._parent.childrenNode[0].isChecked = false)
|
|
155
|
+
} else {
|
|
156
|
+
item._parent && (item._parent.isChecked = false)
|
|
157
|
+
}
|
|
158
|
+
item._parent &&
|
|
159
|
+
item._parent.childrenNode.map(v => {
|
|
160
|
+
v.isChoose = false
|
|
161
|
+
})
|
|
162
|
+
item.isChoose = type
|
|
163
|
+
}
|
|
164
|
+
item.isChecked = type
|
|
165
|
+
item.isIndeterminate = false
|
|
166
|
+
},
|
|
167
|
+
/**
|
|
168
|
+
* 向下递归数据处理
|
|
169
|
+
* @param: item
|
|
170
|
+
* **/
|
|
171
|
+
clearChildren(item) {
|
|
172
|
+
item.childrenNode &&
|
|
173
|
+
item.childrenNode.map(v => {
|
|
174
|
+
if (v.isChoose || v.isChecked || v.isIndeterminate) {
|
|
175
|
+
this.clearChildren(v)
|
|
176
|
+
v.isChoose = false
|
|
177
|
+
v.isChecked = false
|
|
178
|
+
v.isIndeterminate = false
|
|
179
|
+
}
|
|
180
|
+
})
|
|
181
|
+
},
|
|
182
|
+
/**
|
|
183
|
+
* 清除子节点的choose checked Indeterminate状态
|
|
184
|
+
* @param {*} data
|
|
185
|
+
*/
|
|
186
|
+
clearStatus(data) {
|
|
187
|
+
const clearLoop = item => {
|
|
188
|
+
item.childrenNode &&
|
|
189
|
+
item.childrenNode.map(v => {
|
|
190
|
+
if (v.isChoose || v.isChecked || v.isIndeterminate) {
|
|
191
|
+
clearLoop(v)
|
|
192
|
+
}
|
|
193
|
+
})
|
|
194
|
+
item.isChoose = false
|
|
195
|
+
item.isChecked = false
|
|
196
|
+
item.isIndeterminate = false
|
|
197
|
+
}
|
|
198
|
+
clearLoop(data)
|
|
199
|
+
},
|
|
200
|
+
/**
|
|
201
|
+
* 打开当前节点的相关链路
|
|
202
|
+
* @param {*} item
|
|
203
|
+
* @param {*} selectData 链路二维数组
|
|
204
|
+
*/
|
|
205
|
+
openAddressLink(item, selectData) {
|
|
206
|
+
const openFatherLink = currentItem => {
|
|
207
|
+
const _parent = currentItem._parent
|
|
208
|
+
if (currentItem && currentItem._erpZoom !== 0) {
|
|
209
|
+
_parent.childrenNode && (selectData[currentItem._erpZoom] = _parent.childrenNode)
|
|
210
|
+
openFatherLink(_parent)
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
openFatherLink(item)
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#### 参数
|
|
2
|
+
参数名 | 说明 | 默认值
|
|
3
|
+
-----------|--------|--------
|
|
4
|
+
level | 地址选择级数(1-5) | 4
|
|
5
|
+
|
|
6
|
+
#### 事件
|
|
7
|
+
事件名 | 说明
|
|
8
|
+
-----------|--------
|
|
9
|
+
select | 选择到最后一级时触发
|
|
10
|
+
|
|
11
|
+
#### 用法
|
|
12
|
+
- 使用组件的open方法打开显示(通过ref调用open方法),如果有初始值可以在调用open方法时传入,没有初始值不用传入参数
|
|
13
|
+
|
|
14
|
+
```javascript
|
|
15
|
+
<template>
|
|
16
|
+
<div>
|
|
17
|
+
<ks-button @click="openArea">四级地址选择</ks-button>
|
|
18
|
+
<area-select ref="area" @select="handleSelect" />
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
import AreaSelect from '../components/area-select/index'
|
|
24
|
+
export default {
|
|
25
|
+
components: {AreaSelect},
|
|
26
|
+
methods: {
|
|
27
|
+
openArea () {
|
|
28
|
+
let arr = [{"id":"XZ1-08","name":"四川省","level":"province"},{"id":"XZ2-043","name":"成都市","level":"city"},{"id":"XZ3-2611","name":"成华区","level":"zone"},{"id":"XZ4-035231","name":"保和街道","level":"street"}]
|
|
29
|
+
this.$refs.area.open(arr)
|
|
30
|
+
// this.$refs.area.open() //无参数
|
|
31
|
+
},
|
|
32
|
+
handleSelect (e) {
|
|
33
|
+
console.log(e)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
- 数据结构(open方法传入的参数和select事件返回的参数结构一样)
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
[
|
|
45
|
+
{"id":"XZ1-08","name":"四川省","level":"province"},
|
|
46
|
+
{"id":"XZ2-043","name":"成都市","level":"city"},
|
|
47
|
+
{"id":"XZ3-2611","name":"成华区","level":"zone"},
|
|
48
|
+
{"id":"XZ4-035231","name":"保和街道","level":"street"}
|
|
49
|
+
]
|
|
50
|
+
```
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export const hotCity = () => {
|
|
2
|
+
return [
|
|
3
|
+
{
|
|
4
|
+
title: '北京',
|
|
5
|
+
id: 'XZ2-174',
|
|
6
|
+
value: [{id: 'XZ1-06', name: '北京', level: 'province'}, {id: 'XZ2-174', name: '北京市', level: 'city'}]
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
title: '上海',
|
|
10
|
+
id: 'XZ2-040',
|
|
11
|
+
value: [{id: 'XZ1-01', name: '上海', level: 'province'}, {id: 'XZ2-040', name: '上海市', level: 'city'}]
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
title: '广州',
|
|
15
|
+
id: 'XZ2-042',
|
|
16
|
+
value: [{id: 'XZ1-31', name: '广东省', level: 'province'}, {id: 'XZ2-042', name: '广州市', level: 'city'}]
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
title: '深圳',
|
|
20
|
+
id: 'XZ2-229',
|
|
21
|
+
value: [{id: 'XZ1-31', name: '广东省', level: 'province'}, {id: 'XZ2-229', name: '深圳市', level: 'city'}]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
title: '杭州',
|
|
25
|
+
id: 'XZ2-213',
|
|
26
|
+
value: [{id: 'XZ1-22', name: '浙江省', level: 'province'}, {id: 'XZ2-213', name: '杭州市', level: 'city'}]
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
title: '武汉',
|
|
30
|
+
id: 'XZ2-342',
|
|
31
|
+
value: [{id: 'XZ1-23', name: '湖北省', level: 'province'}, {id: 'XZ2-342', name: '武汉市', level: 'city'}]
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
title: '成都',
|
|
35
|
+
id: 'XZ2-043',
|
|
36
|
+
value: [{id: 'XZ1-08', name: '四川省', level: 'province'}, {id: 'XZ2-043', name: '成都市', level: 'city'}]
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const createTitles = (level = 4) => {
|
|
42
|
+
let arr = new Array(level)
|
|
43
|
+
arr[0] = '请选择'
|
|
44
|
+
return arr
|
|
45
|
+
}
|