@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,85 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="van-calendar__body" ref="body">
|
|
3
|
+
<div class="van-calendar__month" v-for="y of years" :key="y">
|
|
4
|
+
<div class="van-calendar__month-title">{{ y }}年</div>
|
|
5
|
+
<div class="van-calendar__days">
|
|
6
|
+
<div
|
|
7
|
+
class="van-calendar__day ks-month__day"
|
|
8
|
+
v-for="m of months"
|
|
9
|
+
:class="{'van-calendar__day--disabled': (currentMin && +new Date(`${y}/${m}/1`) < currentMin) || (currentMax && +new Date(`${y}/${m}/1`) > currentMax)}"
|
|
10
|
+
:key="m"
|
|
11
|
+
@click="handleSelect(y, m, (currentMin && +new Date(`${y}/${m}/1`) < currentMin) || (currentMax && +new Date(`${y}/${m}/1`) > currentMax))"
|
|
12
|
+
>
|
|
13
|
+
<div :class="{'van-calendar__selected-day': +currentMonth === +new Date(`${y}/${m}/1`)}">{{ m }}月</div>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
<script>
|
|
20
|
+
import { getRangeYears, foramtToMonth, formatToString } from './utils'
|
|
21
|
+
|
|
22
|
+
export default {
|
|
23
|
+
name: "month-select",
|
|
24
|
+
props: {
|
|
25
|
+
defaultValue: {
|
|
26
|
+
type: [Date, String, Number],
|
|
27
|
+
default: new Date()
|
|
28
|
+
},
|
|
29
|
+
yearRange: {
|
|
30
|
+
type: Array,
|
|
31
|
+
default: () => [new Date().getFullYear() - 5, new Date().getFullYear()],
|
|
32
|
+
},
|
|
33
|
+
horizontal: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false
|
|
36
|
+
},
|
|
37
|
+
min: [String, Number, Date],
|
|
38
|
+
max: [String, Number, Date]
|
|
39
|
+
},
|
|
40
|
+
data() {
|
|
41
|
+
return {
|
|
42
|
+
years: getRangeYears(this.yearRange),
|
|
43
|
+
months: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
|
|
44
|
+
currentMonth: null,
|
|
45
|
+
currentMin: null,
|
|
46
|
+
currentMax: null
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
methods: {
|
|
50
|
+
init () {
|
|
51
|
+
this.currentMonth = foramtToMonth(this.defaultValue)
|
|
52
|
+
this.currentMin = this.min ? +foramtToMonth(this.min) : null
|
|
53
|
+
this.currentMax = this.max ? +foramtToMonth(this.max) : null
|
|
54
|
+
let monthStr = formatToString(this.currentMonth, 'month')
|
|
55
|
+
let arr = monthStr.split('/')
|
|
56
|
+
this.handleSelect(arr[0], arr[1], false)
|
|
57
|
+
this.scrollInto()
|
|
58
|
+
},
|
|
59
|
+
scrollInto() {
|
|
60
|
+
setTimeout(() => {
|
|
61
|
+
if (this.currentMonth) {
|
|
62
|
+
let top = this.$el.querySelector('.van-calendar__selected-day')
|
|
63
|
+
this.$refs.body.scrollTop = top ? top.getBoundingClientRect().top - 100 : 0
|
|
64
|
+
}
|
|
65
|
+
}, 240)
|
|
66
|
+
},
|
|
67
|
+
handleSelect(y, m, disabled) {
|
|
68
|
+
if (!disabled) {
|
|
69
|
+
this.currentMonth = foramtToMonth(`${y}/${m}`)
|
|
70
|
+
this.$emit("select", {date: this.currentMonth, str: formatToString(this.currentMonth, 'month')})
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<style lang="less">
|
|
78
|
+
.ks-month__day {
|
|
79
|
+
width: 16.666%;
|
|
80
|
+
height: 50px;
|
|
81
|
+
// .van-calendar__day--start::after, .van-calendar__day--end::after {
|
|
82
|
+
// width: !important;
|
|
83
|
+
// }
|
|
84
|
+
}
|
|
85
|
+
</style>
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="van-calendar__body" ref="body">
|
|
3
|
+
<div class="van-calendar__month" v-for="y of years" :key="y">
|
|
4
|
+
<div class="van-calendar__month-title">{{ y }}年</div>
|
|
5
|
+
<div class="van-calendar__days">
|
|
6
|
+
<div
|
|
7
|
+
class="van-calendar__day ks-quarter__day"
|
|
8
|
+
v-for="(value, key) of cnQuarters"
|
|
9
|
+
:key="key"
|
|
10
|
+
@click="handleSelect(y, key)"
|
|
11
|
+
>
|
|
12
|
+
<div :class="{'ks-quarter__selected-day': String(y) === String(currentYear) && String(key) === String(currentQuarter)}">
|
|
13
|
+
{{value}}
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
import { getRangeYears } from './utils'
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
name: 'quarter-select',
|
|
26
|
+
props: {
|
|
27
|
+
defaultValue: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: (function () {
|
|
30
|
+
let _quarters = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4]
|
|
31
|
+
let _date = new Date()
|
|
32
|
+
let y = _date.getFullYear()
|
|
33
|
+
let m = _date.getMonth()
|
|
34
|
+
return `${y}-${_quarters[m]}`
|
|
35
|
+
}())
|
|
36
|
+
},
|
|
37
|
+
yearRange: {
|
|
38
|
+
type: Array,
|
|
39
|
+
default: () => ([new Date().getFullYear() - 2, new Date().getFullYear()])
|
|
40
|
+
},
|
|
41
|
+
horizontal: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: false
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
data () {
|
|
47
|
+
return {
|
|
48
|
+
years: getRangeYears(this.yearRange),
|
|
49
|
+
cnQuarters: {
|
|
50
|
+
'1': '一季度',
|
|
51
|
+
'2': '二季度',
|
|
52
|
+
'3': '三季度',
|
|
53
|
+
'4': '四季度'
|
|
54
|
+
},
|
|
55
|
+
currentYear: null,
|
|
56
|
+
currentQuarter: null
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
methods: {
|
|
60
|
+
init () {
|
|
61
|
+
let arr = this.defaultValue.split('-')
|
|
62
|
+
this.handleSelect(arr[0], arr[1])
|
|
63
|
+
this.scrollInto()
|
|
64
|
+
},
|
|
65
|
+
scrollInto () {
|
|
66
|
+
setTimeout(() => {
|
|
67
|
+
let top = this.$el.querySelector('.ks-quarte__selected-day')
|
|
68
|
+
this.$refs.body.scrollTop = top ? top.getBoundingClientRect().top - 100 : 0
|
|
69
|
+
}, 240)
|
|
70
|
+
},
|
|
71
|
+
handleSelect (y, q) {
|
|
72
|
+
this.currentYear = y
|
|
73
|
+
this.currentQuarter = q
|
|
74
|
+
this.$emit('select', {year: y, quarter: q, cn: this.cnQuarters[q]})
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
</script>
|
|
79
|
+
|
|
80
|
+
<style lang="less">
|
|
81
|
+
.ks-quarter__day {
|
|
82
|
+
width: 25%;
|
|
83
|
+
height: 74px;
|
|
84
|
+
}
|
|
85
|
+
.ks-quarter__selected-day {
|
|
86
|
+
height: 32px;
|
|
87
|
+
line-height: 32px;
|
|
88
|
+
font-size: 14px;
|
|
89
|
+
background-color: #165DFF;
|
|
90
|
+
color: #fff;
|
|
91
|
+
padding: 0 16px;
|
|
92
|
+
border-radius: 999px;
|
|
93
|
+
}
|
|
94
|
+
</style>
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
@title-color: #165DFF;
|
|
2
|
+
@day-text-color: #333;
|
|
3
|
+
@selected-bgcolor: #165DFF;
|
|
4
|
+
@selected-text-color: #fff;
|
|
5
|
+
|
|
6
|
+
// mixin
|
|
7
|
+
.header-title-text (@height: 40px) {
|
|
8
|
+
text-align: center;
|
|
9
|
+
height: @height;
|
|
10
|
+
line-height: @height;
|
|
11
|
+
font-size: 14px;
|
|
12
|
+
color: @title-color;
|
|
13
|
+
&-split {
|
|
14
|
+
color: @day-text-color;
|
|
15
|
+
}
|
|
16
|
+
&-end-not {
|
|
17
|
+
color: #ddd;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
.footer-btn () {
|
|
21
|
+
height: 58px;
|
|
22
|
+
padding: 16px 16px 0 16px;
|
|
23
|
+
// box-shadow: 0 0 4px 0 rgba(115,162,255,0.22);
|
|
24
|
+
z-index: 1;
|
|
25
|
+
.van-button {
|
|
26
|
+
border-radius: 8px;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// 公共样式
|
|
31
|
+
.ks-date-picker {
|
|
32
|
+
&__body {
|
|
33
|
+
flex: 1;
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
height: 100%;
|
|
36
|
+
position: relative;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// 覆盖vant样式
|
|
41
|
+
.ks-date-picker {
|
|
42
|
+
.van-calendar__header {
|
|
43
|
+
box-shadow: none;
|
|
44
|
+
}
|
|
45
|
+
.van-calendar__body {
|
|
46
|
+
height: 100%;
|
|
47
|
+
flex: 1;
|
|
48
|
+
overflow: auto;
|
|
49
|
+
overflow-x: hidden;
|
|
50
|
+
-webkit-overflow-scrolling: touch;
|
|
51
|
+
}
|
|
52
|
+
.van-calendar__month-title {
|
|
53
|
+
height: 40px;
|
|
54
|
+
line-height: 40px;
|
|
55
|
+
color: @day-text-color;
|
|
56
|
+
}
|
|
57
|
+
.van-calendar__day {
|
|
58
|
+
color: @day-text-color;
|
|
59
|
+
}
|
|
60
|
+
.van-calendar__selected-day, .van-calendar__day--start, .van-calendar__day--end {
|
|
61
|
+
color: @selected-text-color;
|
|
62
|
+
background-color: @selected-bgcolor;
|
|
63
|
+
border-radius: 50%;
|
|
64
|
+
width: 44px;
|
|
65
|
+
height: 44px;
|
|
66
|
+
line-height: 44px;
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
}
|
|
71
|
+
.van-calendar__day--start-end {
|
|
72
|
+
color: @selected-text-color;
|
|
73
|
+
background-color: @selected-bgcolor;
|
|
74
|
+
width: 54px;
|
|
75
|
+
height: 44px;
|
|
76
|
+
line-height: 44px;
|
|
77
|
+
display: flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
position: relative;
|
|
81
|
+
}
|
|
82
|
+
.van-calendar__day--middle:after {
|
|
83
|
+
top: 3px;
|
|
84
|
+
bottom: 3px;
|
|
85
|
+
}
|
|
86
|
+
.van-calendar__day--start, .van-calendar__day--end {
|
|
87
|
+
position: relative;
|
|
88
|
+
}
|
|
89
|
+
.van-calendar__day--start::after {
|
|
90
|
+
position: absolute;
|
|
91
|
+
left: 50%;
|
|
92
|
+
top: 0;
|
|
93
|
+
bottom: 0;
|
|
94
|
+
width: 85%;
|
|
95
|
+
content: " ";
|
|
96
|
+
background-color: rgba(22,93,255,.1);
|
|
97
|
+
}
|
|
98
|
+
.van-calendar__day--end::after {
|
|
99
|
+
position: absolute;
|
|
100
|
+
right: 50%;
|
|
101
|
+
top: 0;
|
|
102
|
+
bottom: 0;
|
|
103
|
+
width: 85%;
|
|
104
|
+
content: " ";
|
|
105
|
+
background-color: rgba(22,93,255,.1);
|
|
106
|
+
}
|
|
107
|
+
.van-calendar__bottom-info {
|
|
108
|
+
font-size: 10px;
|
|
109
|
+
line-height: 10px;
|
|
110
|
+
font-weight: 300;
|
|
111
|
+
bottom: 3px;
|
|
112
|
+
position: absolute;
|
|
113
|
+
right: 0;
|
|
114
|
+
left: 0;
|
|
115
|
+
}
|
|
116
|
+
.van-calendar__confirm {
|
|
117
|
+
height: 44px;
|
|
118
|
+
line-height: 44px;
|
|
119
|
+
margin-top: 0;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// 时间对象格式为文本格式
|
|
2
|
+
export const formatToString = (date, type) => {
|
|
3
|
+
if (!date) {
|
|
4
|
+
return null
|
|
5
|
+
}
|
|
6
|
+
let _date = new Date(date)
|
|
7
|
+
let y = _date.getFullYear()
|
|
8
|
+
let m = _date.getMonth() + 1
|
|
9
|
+
m = m < 10 ? '0' + m : m
|
|
10
|
+
let d = _date.getDate()
|
|
11
|
+
d = d < 10 ? '0' + d : d
|
|
12
|
+
return type === 'month' ? `${y}/${m}` : `${y}/${m}/${d}`
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const formatToDate = (date) => {
|
|
16
|
+
if (!date) {
|
|
17
|
+
return null
|
|
18
|
+
}
|
|
19
|
+
if (typeof date === 'string') {
|
|
20
|
+
date = date.replace(/-/g, "/")
|
|
21
|
+
return new Date(date)
|
|
22
|
+
} else {
|
|
23
|
+
return new Date(date)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const foramtToMonth = (date) => {
|
|
28
|
+
if (!date) {
|
|
29
|
+
return null
|
|
30
|
+
}
|
|
31
|
+
let _date = null
|
|
32
|
+
if (typeof date === 'string') {
|
|
33
|
+
let arr = date.replace(/-/g, "/").split('/')
|
|
34
|
+
_date = new Date(`${arr[0]}/${arr[1]}/01`)
|
|
35
|
+
} else {
|
|
36
|
+
let d = new Date(date)
|
|
37
|
+
_date = new Date(`${d.getFullYear()}/${d.getMonth() + 1}/01`)
|
|
38
|
+
}
|
|
39
|
+
return _date
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 生成年的区间
|
|
44
|
+
* @param {*} arr
|
|
45
|
+
*/
|
|
46
|
+
export const getRangeYears = (arr) => {
|
|
47
|
+
let num = arr[1]
|
|
48
|
+
let years = []
|
|
49
|
+
while (num >= arr[0]) {
|
|
50
|
+
years.unshift(num)
|
|
51
|
+
num = num - 1
|
|
52
|
+
}
|
|
53
|
+
return years
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 生成所有年的星期
|
|
59
|
+
* @param {*} arr
|
|
60
|
+
* @param {*} firstDayOfWeek
|
|
61
|
+
*/
|
|
62
|
+
export const getYearsAndWeeks = (arr, firstDayOfWeek) => {
|
|
63
|
+
let years = getRangeYears(arr)
|
|
64
|
+
const getAYearWeeks = (year) => {
|
|
65
|
+
let weeks = []
|
|
66
|
+
let _date = new Date(year, 11, 31)
|
|
67
|
+
let _day = _date.getDay() - firstDayOfWeek + 1
|
|
68
|
+
let _start = new Date(year, 11, 31 - _day)
|
|
69
|
+
let _end = new Date(year + 1, 0, 6 - _day)
|
|
70
|
+
const f = (date) => {
|
|
71
|
+
let y = date.getFullYear()
|
|
72
|
+
let m = date.getMonth() + 1
|
|
73
|
+
let d = date.getDate()
|
|
74
|
+
return [
|
|
75
|
+
`${y}/${m}/${d}`,
|
|
76
|
+
`${String(m).length > 1 ? m : '0' + m}/${String(d).length > 1 ? d : '0' + d}`
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
while (_end.getFullYear() >= year) {
|
|
80
|
+
let _startArr = f(_start)
|
|
81
|
+
let _endArr = f(_end)
|
|
82
|
+
weeks.unshift({
|
|
83
|
+
startDay: new Date(_startArr[0]),
|
|
84
|
+
startDayStr: _startArr[1],
|
|
85
|
+
endDay: new Date(_endArr[0]),
|
|
86
|
+
endDayStr: _endArr[1]
|
|
87
|
+
})
|
|
88
|
+
_start.setDate(_start.getDate() - 7)
|
|
89
|
+
_end.setDate(_end.getDate() - 7)
|
|
90
|
+
}
|
|
91
|
+
return weeks
|
|
92
|
+
}
|
|
93
|
+
return years.map(year => {
|
|
94
|
+
return {
|
|
95
|
+
year,
|
|
96
|
+
weeks: getAYearWeeks(year)
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export const typeToSelectotMap = {
|
|
102
|
+
'date': 'DateSelect',
|
|
103
|
+
'daterange': 'DateRangeSelect',
|
|
104
|
+
'month': 'MonthSelect',
|
|
105
|
+
'monthrange': 'MonthRangeSelect',
|
|
106
|
+
'week': 'WeekSelect',
|
|
107
|
+
'quarter': 'QuarterSelect',
|
|
108
|
+
'dateweekmonth': 'DateWeekMonth'
|
|
109
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="van-calendar__body" ref="body">
|
|
3
|
+
<div class="van-calendar__month" v-for="y of years" :key="y.year">
|
|
4
|
+
<div class="van-calendar__month-title">{{ y.year }}年</div>
|
|
5
|
+
<div class="van-calendar__days">
|
|
6
|
+
<div
|
|
7
|
+
class="van-calendar__day ks-week__day"
|
|
8
|
+
v-for="(w, i) of y.weeks"
|
|
9
|
+
:key="i"
|
|
10
|
+
:class="{'ks-week__selected-day': y.year === currentYear && (i + 1) === currentWeek}"
|
|
11
|
+
@click="handleSelect(y.year, i + 1, w)"
|
|
12
|
+
>
|
|
13
|
+
<div>{{String(i + 1).length > 1 ? i + 1 : '0' + (i + 1)}}周({{w.startDayStr}}~{{w.endDayStr}})</div>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
import { getYearsAndWeeks } from './utils'
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
name: 'week-select',
|
|
25
|
+
props: {
|
|
26
|
+
defaultValue: {
|
|
27
|
+
type: [Date, String, Number],
|
|
28
|
+
default: new Date()
|
|
29
|
+
},
|
|
30
|
+
yearRange: {
|
|
31
|
+
type: Array,
|
|
32
|
+
default: () => ([new Date().getFullYear() - 2, new Date().getFullYear()])
|
|
33
|
+
},
|
|
34
|
+
horizontal: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false
|
|
37
|
+
},
|
|
38
|
+
firstDayOfWeek: {
|
|
39
|
+
type: Number,
|
|
40
|
+
default: 1,
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
data () {
|
|
44
|
+
return {
|
|
45
|
+
years: getYearsAndWeeks(this.yearRange, this.firstDayOfWeek),
|
|
46
|
+
currentYear: null,
|
|
47
|
+
currentWeek: null,
|
|
48
|
+
currentStart: null,
|
|
49
|
+
currentEnd: null,
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
methods: {
|
|
53
|
+
init () {
|
|
54
|
+
let _date = new Date(this.defaultValue)
|
|
55
|
+
let y = _date.getFullYear()
|
|
56
|
+
let _year = this.years.find(item => item.year === y)
|
|
57
|
+
let _index = _year.weeks.findIndex(item => +item.startDay <= +_date && +item.endDay >= +_date)
|
|
58
|
+
let _week = _year.weeks[_index]
|
|
59
|
+
this.handleSelect(y, _index + 1, _week)
|
|
60
|
+
this.scrollInto()
|
|
61
|
+
},
|
|
62
|
+
scrollInto () {
|
|
63
|
+
setTimeout(() => {
|
|
64
|
+
let top = this.$el.querySelector('.ks-week__selected-day')
|
|
65
|
+
this.$refs.body.scrollTop = top ? top.getBoundingClientRect().top - 100 : 0
|
|
66
|
+
}, 240)
|
|
67
|
+
},
|
|
68
|
+
handleSelect (y, w, week) {
|
|
69
|
+
this.currentYear = y
|
|
70
|
+
this.currentWeek = w
|
|
71
|
+
this.currentStart = week.startDay
|
|
72
|
+
this.currentEnd = week.endDay
|
|
73
|
+
this.$emit('select', {year: y, week, num: w})
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<style lang="less">
|
|
80
|
+
.ks-week__day {
|
|
81
|
+
width: 50%;
|
|
82
|
+
height: 44px;
|
|
83
|
+
}
|
|
84
|
+
.ks-week__selected-day {
|
|
85
|
+
color: #165DFF !important;
|
|
86
|
+
position: relative;
|
|
87
|
+
&::after {
|
|
88
|
+
font: normal normal normal 14px/1 'vant-icon';
|
|
89
|
+
font-size: 12px;
|
|
90
|
+
text-rendering: auto;
|
|
91
|
+
-webkit-font-smoothing: antialiased;
|
|
92
|
+
content: '\F0C8';
|
|
93
|
+
display: inline-block;
|
|
94
|
+
position: absolute;
|
|
95
|
+
right: 4px;
|
|
96
|
+
top: 16px;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
</style>
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<van-field v-if="isField"
|
|
4
|
+
v-model="value"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
@blur="handleBlur"
|
|
7
|
+
@input="handleInput"
|
|
8
|
+
@clear="handleClear"
|
|
9
|
+
@focus="handleFocus"
|
|
10
|
+
@click-left-icon="clickLeftIcon"
|
|
11
|
+
@click-right-icon="clickRightIcon">
|
|
12
|
+
<div v-if="maskFiled.mask"
|
|
13
|
+
slot="input"
|
|
14
|
+
class="ks-mobile-decrypt"
|
|
15
|
+
@click="decryptBtn">
|
|
16
|
+
{{ value }}
|
|
17
|
+
</div>
|
|
18
|
+
<div v-else-if="maskFiled.maskSec"
|
|
19
|
+
slot="input">
|
|
20
|
+
{{ maskSecDefault }}
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
</van-field>
|
|
24
|
+
<span v-else
|
|
25
|
+
:class="maskFiled.mask ? 'ks-mobile-decrypt' : ''"
|
|
26
|
+
@click="decryptBtn">{{maskFiled.maskSec ? maskSecDefault : value}}</span>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
<script>
|
|
30
|
+
export default {
|
|
31
|
+
/**
|
|
32
|
+
* formModel 表单数据@必填
|
|
33
|
+
* fieldName 对应的后端字段名@必填
|
|
34
|
+
* fieldNameStr 和label名称一致
|
|
35
|
+
* maskSecDefault 敏感字段默认显示的内容
|
|
36
|
+
* isField 是否是在表单中使用 默认为否
|
|
37
|
+
* idKey 解密时的dataId 作为列表数据的唯一标识
|
|
38
|
+
* meunCode: {
|
|
39
|
+
* moduleCode 解密时菜单ID@必填
|
|
40
|
+
* moduleName 当前模块名@必填
|
|
41
|
+
* }
|
|
42
|
+
*/
|
|
43
|
+
props: {
|
|
44
|
+
value: [String, Number],
|
|
45
|
+
formModel: Object,
|
|
46
|
+
// 绑定属性、字段
|
|
47
|
+
fieldName: String,
|
|
48
|
+
// 字段中文名
|
|
49
|
+
fieldNameStr: String,
|
|
50
|
+
maskSecDefault: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: '✽✽✽'
|
|
53
|
+
},
|
|
54
|
+
isField: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: false
|
|
57
|
+
},
|
|
58
|
+
idKey: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: 'id'
|
|
61
|
+
},
|
|
62
|
+
confirmText: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: '如非必要请勿查看,此操作会联动风控系统监控!'
|
|
65
|
+
},
|
|
66
|
+
meunCode: {
|
|
67
|
+
type: Object,
|
|
68
|
+
default: () => {
|
|
69
|
+
return {
|
|
70
|
+
moduleCode: '',
|
|
71
|
+
moduleName: ''
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
computed: {
|
|
77
|
+
maskFiled () {
|
|
78
|
+
let mask = null
|
|
79
|
+
let maskSec = null
|
|
80
|
+
if (this.formModel) {
|
|
81
|
+
let tempModel = this.formModel
|
|
82
|
+
if (tempModel[this.fieldName + 'Mask'] && this.value.includes('***')) {
|
|
83
|
+
mask = tempModel[this.fieldName + 'Mask']
|
|
84
|
+
}
|
|
85
|
+
if (!tempModel[this.fieldName] && tempModel.hasOwnProperty(this.fieldName + 'MaskSec')) {
|
|
86
|
+
maskSec = 'maskSec'
|
|
87
|
+
}
|
|
88
|
+
tempModel = tempModel[this.fieldName]
|
|
89
|
+
}
|
|
90
|
+
return { mask, maskSec }
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
methods: {
|
|
94
|
+
isEmpty (val) {
|
|
95
|
+
return val === '' || val === null || val === undefined
|
|
96
|
+
},
|
|
97
|
+
// 创建随机ID 保证解密唯一值
|
|
98
|
+
createUuid () {
|
|
99
|
+
return Math.random().toString(36).substr(3)
|
|
100
|
+
},
|
|
101
|
+
decryptBtn () {
|
|
102
|
+
if (!this.maskFiled.mask) {
|
|
103
|
+
return
|
|
104
|
+
}
|
|
105
|
+
vant.Dialog.confirm({
|
|
106
|
+
title: '温馨提示',
|
|
107
|
+
message: this.confirmText
|
|
108
|
+
}).then(() => {
|
|
109
|
+
this.decrypt()
|
|
110
|
+
}).catch(() => {
|
|
111
|
+
})
|
|
112
|
+
},
|
|
113
|
+
async decrypt () {
|
|
114
|
+
try {
|
|
115
|
+
let params = {
|
|
116
|
+
dataId: this.formModel[this.idKey] || this.createUuid(),
|
|
117
|
+
moduleCode: this.meunCode.moduleCode,
|
|
118
|
+
fieldName: this.fieldName,
|
|
119
|
+
fieldContent: this.formModel[this.fieldName + 'Mask'],
|
|
120
|
+
fieldNameStr: this.fieldNameStr,
|
|
121
|
+
buttonName: this.meunCode.moduleName
|
|
122
|
+
}
|
|
123
|
+
let res = await this.$http('syslog.sensitiveFieldViewLog.save', '10135', params)
|
|
124
|
+
this.value = res
|
|
125
|
+
this.$emit('input', res)
|
|
126
|
+
if (this.idKey !== '') {
|
|
127
|
+
this.$emit('decryptData', res, this.fieldName, this.formModel[this.idKey])
|
|
128
|
+
}
|
|
129
|
+
} catch (err) {
|
|
130
|
+
console.log(err)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
},
|
|
134
|
+
handleBlur () {
|
|
135
|
+
this.$emit('blur')
|
|
136
|
+
},
|
|
137
|
+
handleInput (val) {
|
|
138
|
+
this.$emit('input', val)
|
|
139
|
+
},
|
|
140
|
+
handleFocus (val) {
|
|
141
|
+
this.$emit('focus', val)
|
|
142
|
+
},
|
|
143
|
+
handleClear () {
|
|
144
|
+
this.$emit('clear')
|
|
145
|
+
},
|
|
146
|
+
clickLeftIcon () {
|
|
147
|
+
this.$emit('click-left-icon')
|
|
148
|
+
},
|
|
149
|
+
clickRightIcon () {
|
|
150
|
+
this.$emit('click-right-icon')
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
</script>
|
|
155
|
+
<style scoped>
|
|
156
|
+
.ks-mobile-decrypt {
|
|
157
|
+
color: #165DFF;
|
|
158
|
+
}
|
|
159
|
+
</style>
|