sh-view 1.7.6 → 2.0.1
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/.eslintrc.js +20 -21
- package/dist/css/227.45fab5b7.css +1 -0
- package/dist/css/291.e7facf7d.css +1 -0
- package/dist/css/299.e98df6ce.css +1 -0
- package/dist/css/358.e641c5d1.css +1 -0
- package/dist/css/534.726e6699.css +1 -0
- package/dist/css/769.8008ac6c.css +1 -0
- package/dist/css/index.2bd4fb37.css +1 -0
- package/dist/css/index.2bd4fb37.css.gz +0 -0
- package/dist/fonts/iconfont.03e5a9f9.ttf +0 -0
- package/dist/fonts/iconfont.03e5a9f9.ttf.gz +0 -0
- package/dist/fonts/ionicons.31fd4446.ttf +0 -0
- package/dist/fonts/ionicons.31fd4446.ttf.gz +0 -0
- package/dist/fonts/ionicons.d03f2836.woff2 +0 -0
- package/dist/fonts/ionicons.dacd136b.woff +0 -0
- package/dist/fonts/ionicons.dacd136b.woff.gz +0 -0
- package/dist/img/ionicons.6e8059e8.svg +870 -0
- package/dist/img/ionicons.6e8059e8.svg.gz +0 -0
- package/dist/js/152.588ca5b4.js +1 -0
- package/dist/js/165.f026fdcd.js +1 -0
- package/dist/js/227.6d340a71.js +1 -0
- package/dist/js/257.285f071f.js +1 -0
- package/dist/js/264.32b3a9a5.js +1 -0
- package/dist/js/291.e100da5e.js +1 -0
- package/dist/js/299.2062f9ff.js +1 -0
- package/dist/js/322.ff97ab5e.js +1 -0
- package/dist/js/333.da633859.js +1 -0
- package/dist/js/341.d4433549.js +1 -0
- package/dist/js/358.81429379.js +1 -0
- package/dist/js/387.7b1e3b8a.js +1 -0
- package/dist/js/392.c53bf6c9.js +1 -0
- package/dist/js/400.03e3be15.js +1 -0
- package/dist/js/41.fca2504e.js +1 -0
- package/dist/js/444.a0350517.js +1 -0
- package/dist/js/452.7f75d556.js +2 -0
- package/dist/js/452.7f75d556.js.gz +0 -0
- package/dist/js/497.06080ae1.js +1 -0
- package/dist/js/514.2ea0055a.js +1 -0
- package/dist/js/534.40a67536.js +1 -0
- package/dist/js/558.6175bf20.js +15 -0
- package/dist/js/558.6175bf20.js.gz +0 -0
- package/dist/js/586.098ab36d.js +1 -0
- package/dist/js/593.df7d7c2e.js +1 -0
- package/dist/js/601.abf6f256.js +1 -0
- package/dist/js/654.99b45cd4.js +18 -0
- package/dist/js/654.99b45cd4.js.gz +0 -0
- package/dist/js/668.a15a0058.js +1 -0
- package/dist/js/704.52e87fec.js +1 -0
- package/dist/js/720.aceca876.js +1 -0
- package/dist/js/769.1376ca7f.js +1 -0
- package/dist/js/875.975891f5.js +1 -0
- package/dist/js/89.c7317ccb.js +1 -0
- package/dist/js/94.d54e8b09.js +1 -0
- package/dist/js/chunk-vendors.e05ef0ac.js +438 -0
- package/dist/js/chunk-vendors.e05ef0ac.js.gz +0 -0
- package/dist/js/index.b31868df.js +1 -0
- package/dist/js/index.b31868df.js.gz +0 -0
- package/package.json +10 -10
- package/packages/assets/css/animated.scss +167 -2
- package/packages/assets/css/loader.scss +42 -42
- package/packages/assets/css/main.scss +41 -21
- package/packages/assets/css/theme.scss +83 -44
- package/packages/components/global-components/sh-alert/index.vue +173 -0
- package/packages/components/global-components/sh-badge/index.vue +227 -0
- package/packages/components/global-components/sh-card/index.vue +140 -122
- package/packages/components/global-components/sh-code-editor/index.vue +260 -260
- package/packages/components/global-components/sh-col/css/index.scss +76 -0
- package/packages/components/global-components/sh-col/index.vue +83 -0
- package/packages/components/global-components/sh-corner/index.vue +1 -9
- package/packages/components/global-components/sh-count-to/index.vue +102 -46
- package/packages/components/global-components/sh-date/index.vue +40 -0
- package/packages/components/global-components/sh-drawer/index.vue +518 -0
- package/packages/components/global-components/sh-drawer/scrollbar.js +76 -0
- package/packages/components/global-components/sh-empty/index.vue +43 -43
- package/packages/components/global-components/{sh-vxe-form → sh-form}/css/index.scss +6 -6
- package/packages/components/global-components/{sh-vxe-form → sh-form}/index.vue +114 -115
- package/packages/components/global-components/{sh-vxe-form → sh-form}/js/methods.js +146 -157
- package/packages/components/global-components/{sh-vxe-form → sh-form}/mixin/defaultData.js +32 -33
- package/packages/components/global-components/sh-header/index.vue +293 -269
- package/packages/components/global-components/sh-icon/css/default/fonts/ionicons.svg +870 -0
- package/packages/components/global-components/sh-icon/css/default/fonts/ionicons.ttf +0 -0
- package/packages/components/global-components/sh-icon/css/default/fonts/ionicons.woff +0 -0
- package/packages/components/global-components/sh-icon/css/default/fonts/ionicons.woff2 +0 -0
- package/packages/components/global-components/sh-icon/css/default/icons.scss +2583 -0
- package/packages/components/global-components/sh-icon/css/default/index.scss +27 -0
- package/packages/components/global-components/sh-icon/css/font/fonts/iconfont.js +1 -0
- package/packages/components/global-components/sh-icon/css/font/fonts/iconfont.json +247 -0
- package/packages/components/global-components/sh-icon/css/font/fonts/iconfont.ttf +0 -0
- package/packages/components/global-components/sh-icon/css/font/fonts/iconfont.woff +0 -0
- package/packages/components/global-components/sh-icon/css/font/fonts/iconfont.woff2 +0 -0
- package/packages/components/global-components/sh-icon/css/font/icons.scss +135 -0
- package/packages/components/global-components/sh-icon/css/font/index.scss +16 -0
- package/packages/components/global-components/sh-icon/icon-default.vue +32 -0
- package/packages/components/global-components/sh-icon/{icons.vue → icon-font.vue} +32 -32
- package/packages/components/global-components/sh-icon/index.vue +28 -27
- package/packages/components/global-components/sh-image/index.vue +123 -0
- package/packages/components/global-components/sh-list/index.vue +141 -0
- package/packages/components/global-components/sh-loading/index.vue +49 -42
- package/packages/components/global-components/{sh-vxe-modal → sh-modal}/index.vue +209 -209
- package/packages/components/global-components/sh-noticebar/index.vue +201 -201
- package/packages/components/global-components/sh-poptip/index.vue +479 -0
- package/packages/components/global-components/sh-poptip/popper.js +115 -0
- package/packages/components/global-components/sh-progress/index.vue +290 -0
- package/packages/components/global-components/sh-pull-refresh/index.vue +290 -290
- package/packages/components/global-components/{sh-vxe-query → sh-query}/index.vue +317 -310
- package/packages/components/global-components/sh-result/index.vue +110 -88
- package/packages/components/global-components/sh-row/css/index.scss +21 -0
- package/packages/components/global-components/sh-row/index.vue +63 -0
- package/packages/components/global-components/sh-split/components/trigger.vue +33 -0
- package/packages/components/global-components/sh-split/index.vue +334 -142
- package/packages/components/global-components/sh-table/components/importModal.vue +351 -0
- package/packages/components/global-components/{sh-vxe-table → sh-table}/css/index.scss +4 -22
- package/packages/components/global-components/{sh-vxe-table → sh-table}/index.vue +329 -351
- package/packages/components/global-components/{sh-vxe-table → sh-table}/js/methods.js +33 -88
- package/packages/components/global-components/{sh-vxe-table → sh-table}/js/props.js +304 -313
- package/packages/components/global-components/{sh-vxe-table → sh-table}/mixin/defaultData.js +94 -116
- package/packages/components/global-components/sh-tabs/index.vue +322 -0
- package/packages/components/global-components/sh-tag/index.vue +163 -0
- package/packages/components/global-components/{sh-vxe-toolbar → sh-toolbar}/index.vue +177 -172
- package/packages/components/global-components/sh-tree/components/table-tree.vue +280 -0
- package/packages/components/global-components/sh-tree/css/index.scss +54 -0
- package/packages/components/global-components/sh-tree/index.vue +195 -0
- package/packages/components/global-components/sh-tree/mixin/treeProps.js +124 -0
- package/packages/components/global-components/sh-upload/index.vue +278 -275
- package/packages/components/global-components/sh-water-fall/index.vue +87 -87
- package/packages/components/index.js +85 -59
- package/packages/components/other-components/sh-cron-modal/css/index.scss +2 -2
- package/packages/components/other-components/sh-menu-card/index.vue +224 -224
- package/packages/css/index.js +4 -6
- package/packages/directive/index.js +19 -19
- package/packages/directive/module/click-out.js +14 -0
- package/packages/directive/module/draggable.js +42 -42
- package/packages/directive/module/line-clamp.js +22 -0
- package/packages/directive/module/prevent-click.js +18 -0
- package/packages/directive/module/resize.js +19 -0
- package/packages/directive/module/ripple.js +166 -0
- package/packages/index.js +39 -40
- package/packages/utils/transfer-queue.js +12 -0
- package/packages/vxeTable/css/index.scss +12 -98
- package/packages/vxeTable/css/variable.scss +7 -265
- package/packages/vxeTable/index.js +184 -183
- package/packages/vxeTable/plugins/export.js +450 -0
- package/packages/vxeTable/render/cell/vxe-render-checkgroup.vue +36 -36
- package/packages/vxeTable/render/cell/vxe-render-goption.vue +94 -93
- package/packages/vxeTable/render/cell/vxe-render-img.vue +21 -28
- package/packages/vxeTable/render/cell/vxe-render-input.vue +51 -51
- package/packages/vxeTable/render/cell/vxe-render-progress.vue +19 -19
- package/packages/vxeTable/render/cell/vxe-render-radiogroup.vue +36 -36
- package/packages/vxeTable/render/cell/vxe-render-select.vue +36 -36
- package/packages/vxeTable/render/cell/vxe-render-tree.vue +59 -59
- package/packages/vxeTable/render/globalRenders.jsx +498 -491
- package/packages/assets/icons/demo.css +0 -539
- package/packages/assets/icons/iconfont.css +0 -415
- package/packages/assets/icons/iconfont.js +0 -1
- package/packages/assets/icons/iconfont.json +0 -709
- package/packages/assets/icons/iconfont.ttf +0 -0
- package/packages/assets/icons/iconfont.woff +0 -0
- package/packages/assets/icons/iconfont.woff2 +0 -0
- package/packages/assets/img/image-error.png +0 -0
- package/packages/assets/img/square-image.png +0 -0
- package/packages/components/global-components/sh-iv-form/components/iv-group-item.vue +0 -57
- package/packages/components/global-components/sh-iv-form/components/iv-single-item.vue +0 -76
- package/packages/components/global-components/sh-iv-form/index.vue +0 -255
- package/packages/components/global-components/sh-vxe-list/index.vue +0 -149
- package/packages/components/global-components/sh-vxe-table/components/importModal.vue +0 -377
- package/packages/components/global-components/sh-vxe-tree/components/table-tree.vue +0 -233
- package/packages/components/global-components/sh-vxe-tree/css/index.scss +0 -20
- package/packages/components/global-components/sh-vxe-tree/index.vue +0 -85
- package/packages/components/global-components/sh-vxe-tree/js/props.js +0 -120
- package/packages/components/global-components/sh-vxe-tree/js/treeMethods.js +0 -169
- package/packages/components/global-components/sh-vxe-tree/mixin/defaultData.js +0 -54
- package/packages/components/global-components/sh-vxe-tree/vxe-direct-tree.vue +0 -203
- package/packages/components/global-components/sh-vxe-tree/vxe-select-tree.vue +0 -291
- package/packages/components/other-components/sh-markdown/tinymce/langs/ar.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/az.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/bg_BG.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/bn_BD.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/ca.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/cs.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/cy.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/da.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/de.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/dv.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/el.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/eo.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/es.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/es_MX.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/et.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/eu.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/fa.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/fi.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/fr_FR.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/ga.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/gl.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/he_IL.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/hi.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/hr.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/hu_HU.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/hy.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/id.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/is_IS.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/it.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/ja.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/kab.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/kk.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/ko_KR.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/ku.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/lt.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/lv.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/nb_NO.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/ne.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/nl.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/nl_BE.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/oc.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/pl.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/pt_BR.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/ro.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/ru.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/sk.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/sl_SI.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/sq.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/sr.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/sv_SE.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/ta.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/tg.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/th_TH.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/tr.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/ug.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/uk.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/vi.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/skins/content/dark/content.css +0 -72
- package/packages/components/other-components/sh-markdown/tinymce/skins/content/dark/content.min.css +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/skins/content/default/content.min.css +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/skins/content/document/content.css +0 -72
- package/packages/components/other-components/sh-markdown/tinymce/skins/content/document/content.min.css +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/skins/content/writer/content.css +0 -68
- package/packages/components/other-components/sh-markdown/tinymce/skins/content/writer/content.min.css +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/content.css +0 -714
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/content.inline.css +0 -726
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/content.inline.min.css +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/content.min.css +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/content.mobile.css +0 -29
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/content.mobile.min.css +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/fonts/tinymce-mobile.woff +0 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/skin.css +0 -3047
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/skin.min.css +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/skin.mobile.css +0 -673
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/skin.mobile.min.css +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/skin.shadowdom.css +0 -37
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css +0 -7
- package/packages/directive/directives.js +0 -27
- package/packages/iview/css/index.scss +0 -32
- package/packages/iview/index.js +0 -25
- /package/packages/components/global-components/{sh-vxe-form → sh-form}/components/form-item.vue +0 -0
- /package/packages/components/global-components/{sh-vxe-form → sh-form}/js/props.js +0 -0
- /package/packages/components/global-components/{sh-vxe-table → sh-table}/js/excel_to_json.js +0 -0
|
@@ -1,377 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<sh-modal :visible="visible" title="导入报表" width="900" :loading="modalLoading" :show-footer="false" :transfer="false" @close="onModalClose">
|
|
3
|
-
<div class="import-template-top">
|
|
4
|
-
<transition name="fade">
|
|
5
|
-
<Progress v-if="showProgress" :percent="progressPercent" :stroke-width="2">
|
|
6
|
-
<template v-if="progressPercent === 100"><span>上传成功</span></template>
|
|
7
|
-
</Progress>
|
|
8
|
-
</transition>
|
|
9
|
-
</div>
|
|
10
|
-
<div class="import-template-head">
|
|
11
|
-
<vxe-button :size="size" @click="handleDownloadTemplateBtn">下载导入模板</vxe-button>
|
|
12
|
-
<vxe-button :size="size" status="primary" @click="handleImportFileBtn">选择导入文件</vxe-button>
|
|
13
|
-
<div class="floatright">
|
|
14
|
-
<Poptip v-if="importErrorData.length > 0" trigger="click" title="错误信息" placement="bottom-end">
|
|
15
|
-
<vxe-button :size="size" status="danger"
|
|
16
|
-
>共发现 <strong>{{ importErrorData.length }}</strong> 条不符合规范数据</vxe-button
|
|
17
|
-
>
|
|
18
|
-
<template #content>
|
|
19
|
-
<div class="import-template-error-list">
|
|
20
|
-
<div v-for="(errData, errDataIndex) in importErrorData" :key="errDataIndex" class="error-item">
|
|
21
|
-
第 <strong class="red">{{ errData.rowIndex }}</strong> 行,错误:<span class="red">{{ errData.errMsg }}</span>
|
|
22
|
-
</div>
|
|
23
|
-
</div>
|
|
24
|
-
</template>
|
|
25
|
-
</Poptip>
|
|
26
|
-
</div>
|
|
27
|
-
</div>
|
|
28
|
-
<div class="import-template-body">
|
|
29
|
-
<sh-table
|
|
30
|
-
ref="shtable"
|
|
31
|
-
:height="height"
|
|
32
|
-
:size="size"
|
|
33
|
-
:columns="tableColumns"
|
|
34
|
-
:data-sourse="importTableData"
|
|
35
|
-
:global-config="tableGlobalConfig"
|
|
36
|
-
:edit-rules="importRules"
|
|
37
|
-
:pager-config="false"
|
|
38
|
-
:disabled="false"></sh-table>
|
|
39
|
-
</div>
|
|
40
|
-
<div class="import-template-foot">
|
|
41
|
-
<div class="foot-left"></div>
|
|
42
|
-
<div class="foot-right">
|
|
43
|
-
<vxe-button :size="size" @click="onModalClose">取消</vxe-button>
|
|
44
|
-
<vxe-button :size="size" status="primary" @click="handleImportDataBtn('all')">全部导入</vxe-button>
|
|
45
|
-
<vxe-button v-if="tableGlobalConfig.checkbox || tableGlobalConfig.radio" :size="size" status="warning" @click="handleImportDataBtn('select')">导入选中</vxe-button>
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
48
|
-
</sh-modal>
|
|
49
|
-
</template>
|
|
50
|
-
|
|
51
|
-
<script>
|
|
52
|
-
import * as XLSX from 'xlsx'
|
|
53
|
-
import excelToJson from '../js/excel_to_json'
|
|
54
|
-
export default {
|
|
55
|
-
name: 'TableImport',
|
|
56
|
-
props: {
|
|
57
|
-
visible: {
|
|
58
|
-
type: Boolean
|
|
59
|
-
},
|
|
60
|
-
columns: {
|
|
61
|
-
type: Array
|
|
62
|
-
},
|
|
63
|
-
height: {
|
|
64
|
-
type: [Number, String],
|
|
65
|
-
default: 360
|
|
66
|
-
},
|
|
67
|
-
needValidate: {
|
|
68
|
-
type: Boolean
|
|
69
|
-
},
|
|
70
|
-
importRules: {
|
|
71
|
-
type: Object,
|
|
72
|
-
default() {
|
|
73
|
-
return {}
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
importConfig: {
|
|
77
|
-
type: Object,
|
|
78
|
-
default() {
|
|
79
|
-
return {}
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
importOption: {
|
|
83
|
-
type: Object,
|
|
84
|
-
default() {
|
|
85
|
-
return {}
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
globalConfig: {
|
|
89
|
-
type: Object,
|
|
90
|
-
default() {
|
|
91
|
-
return {}
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
size: {
|
|
95
|
-
type: String,
|
|
96
|
-
default: 'mini' // medium / small / mini
|
|
97
|
-
},
|
|
98
|
-
downloadTemplateCallback: {
|
|
99
|
-
type: Function
|
|
100
|
-
},
|
|
101
|
-
downloadTemplateFinished: {
|
|
102
|
-
type: Function
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
emits: ['confirm', 'update:visible'],
|
|
106
|
-
data() {
|
|
107
|
-
return {
|
|
108
|
-
importTableData: [],
|
|
109
|
-
importErrorData: [],
|
|
110
|
-
modalLoading: false,
|
|
111
|
-
showProgress: false,
|
|
112
|
-
progressPercent: 0
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
computed: {
|
|
116
|
-
tableGlobalConfig() {
|
|
117
|
-
return Object.assign({ checkbox: false, seq: true, zoom: false, title: true, tableName: '导入预览' }, this.globalConfig)
|
|
118
|
-
},
|
|
119
|
-
tableColumns() {
|
|
120
|
-
return this.columns.filter(item => !(item.type === 'seq' || item.type === 'checkbox' || item.type === 'radio' || item.renderName === '$vGlobalOption'))
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
watch: {},
|
|
124
|
-
created() {
|
|
125
|
-
this.initCreated()
|
|
126
|
-
},
|
|
127
|
-
mounted() {},
|
|
128
|
-
beforeUnmount() {},
|
|
129
|
-
methods: {
|
|
130
|
-
// 初始化
|
|
131
|
-
initCreated() {
|
|
132
|
-
this.showProgress = false
|
|
133
|
-
this.progressPercent = 0
|
|
134
|
-
this.importTableData = []
|
|
135
|
-
},
|
|
136
|
-
// 弹窗关闭
|
|
137
|
-
onModalClose() {
|
|
138
|
-
this.$emit('update:visible', false)
|
|
139
|
-
},
|
|
140
|
-
// 确认导入数据按钮
|
|
141
|
-
async handleImportDataBtn(type = 'all') {
|
|
142
|
-
const that = this
|
|
143
|
-
let importData = type === 'all' ? this.importTableData : this.$refs.shtable.getSelectionData()
|
|
144
|
-
if (!importData || !Array.isArray(importData) || importData.length < 1) {
|
|
145
|
-
that.msginfo('未导入数据')
|
|
146
|
-
return false
|
|
147
|
-
}
|
|
148
|
-
if (that.needValidate) {
|
|
149
|
-
let validateErrMap = await that.handleImportDataValidate(importData)
|
|
150
|
-
if (validateErrMap) {
|
|
151
|
-
that.msgerror('导入校验失败,请检查数据')
|
|
152
|
-
return validateErrMap
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
that.$emit('confirm', importData)
|
|
156
|
-
that.onModalClose()
|
|
157
|
-
},
|
|
158
|
-
// 导入数据验证
|
|
159
|
-
async handleImportDataValidate(rows) {
|
|
160
|
-
return this.$refs.shtable.validate(rows)
|
|
161
|
-
},
|
|
162
|
-
// 下载导入模板按钮
|
|
163
|
-
handleDownloadTemplateBtn() {
|
|
164
|
-
const that = this
|
|
165
|
-
if (typeof that.downloadTemplateCallback === 'function') {
|
|
166
|
-
that.downloadTemplateCallback()
|
|
167
|
-
} else {
|
|
168
|
-
let defaultOption = {
|
|
169
|
-
filename: '模板',
|
|
170
|
-
sheetName: this.importOption.filename || '模板',
|
|
171
|
-
type: 'xlsx',
|
|
172
|
-
original: false,
|
|
173
|
-
download: true,
|
|
174
|
-
message: false,
|
|
175
|
-
useStyle: false,
|
|
176
|
-
columns: this.$refs.shtable
|
|
177
|
-
.tableRef()
|
|
178
|
-
.getColumns()
|
|
179
|
-
.filter(item => item.type !== 'seq'),
|
|
180
|
-
data: [],
|
|
181
|
-
sheetMethod: ({ options, workbook, worksheet }) => {},
|
|
182
|
-
afterExportMethod: options => {
|
|
183
|
-
this.handleDownloadTemplateFinished(options)
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
this.$refs.shtable.tableRef().exportData(Object.assign(defaultOption, this.importOption))
|
|
187
|
-
}
|
|
188
|
-
},
|
|
189
|
-
// 下载导入模板成功回调
|
|
190
|
-
handleDownloadTemplateFinished(options) {
|
|
191
|
-
this.msgsuccess('下载模板完成!')
|
|
192
|
-
if (typeof this.downloadTemplateCallback === 'function') {
|
|
193
|
-
this.downloadTemplateFinished(options)
|
|
194
|
-
}
|
|
195
|
-
},
|
|
196
|
-
// 选择导入文件按钮
|
|
197
|
-
handleImportFileBtn() {
|
|
198
|
-
if (typeof this.importFileCallback === 'function') {
|
|
199
|
-
this.importFileCallback()
|
|
200
|
-
} else {
|
|
201
|
-
let defaultOption = {
|
|
202
|
-
mode: 'covering',
|
|
203
|
-
types: ['xlsx', 'csv'],
|
|
204
|
-
message: false,
|
|
205
|
-
remote: true,
|
|
206
|
-
importMethod: obj => {
|
|
207
|
-
this.handleImportFileMethod(obj)
|
|
208
|
-
},
|
|
209
|
-
afterImportMethod: options => {
|
|
210
|
-
this.handleImportFileFinished(options)
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
this.$refs.shtable.tableRef().importData(Object.assign(defaultOption, this.importConfig))
|
|
214
|
-
}
|
|
215
|
-
},
|
|
216
|
-
// 选择导入文件成功回调
|
|
217
|
-
async handleImportFileMethod({ file, options }) {
|
|
218
|
-
const that = this
|
|
219
|
-
const fileExt = file.name.split('.').pop().toLocaleLowerCase()
|
|
220
|
-
if (fileExt === 'xlsx' || fileExt === 'xls') {
|
|
221
|
-
that.file = file
|
|
222
|
-
try {
|
|
223
|
-
let fileRes = await that.readFile(file)
|
|
224
|
-
let { results, errDatas } = that.dealImportTableData(that.tableColumns, fileRes)
|
|
225
|
-
that.importTableData = results
|
|
226
|
-
that.importErrorData = errDatas
|
|
227
|
-
setTimeout(() => {
|
|
228
|
-
that.showProgress = false
|
|
229
|
-
}, 2000)
|
|
230
|
-
} catch (e) {
|
|
231
|
-
that.msgerror(e.message || e)
|
|
232
|
-
}
|
|
233
|
-
} else {
|
|
234
|
-
}
|
|
235
|
-
},
|
|
236
|
-
// 选择导入文件成功回调
|
|
237
|
-
handleImportFileFinished(options) {},
|
|
238
|
-
// 读取文件
|
|
239
|
-
async readFile(file) {
|
|
240
|
-
return new Promise((resolve, reject) => {
|
|
241
|
-
const reader = new FileReader()
|
|
242
|
-
reader.readAsArrayBuffer(file)
|
|
243
|
-
reader.onloadstart = e => {
|
|
244
|
-
this.modalLoading = true
|
|
245
|
-
this.showProgress = true
|
|
246
|
-
}
|
|
247
|
-
reader.onprogress = e => {
|
|
248
|
-
this.progressPercent = Math.round((e.loaded / e.total) * 100)
|
|
249
|
-
}
|
|
250
|
-
reader.onerror = e => {
|
|
251
|
-
reject(new Error('文件读取出错'))
|
|
252
|
-
}
|
|
253
|
-
reader.onload = e => {
|
|
254
|
-
this.modalLoading = false
|
|
255
|
-
const data = e.target.result
|
|
256
|
-
const workbook = XLSX.read(data, { type: 'binary' })
|
|
257
|
-
let sheetNames = workbook.SheetNames
|
|
258
|
-
let excelJsonMap = {}
|
|
259
|
-
sheetNames.forEach(sheet => {
|
|
260
|
-
excelJsonMap[sheet] = excelToJson.sheet_to_json(workbook.Sheets[sheet])
|
|
261
|
-
})
|
|
262
|
-
let sheetActive = sheetNames.find(item => item === this.$parent.tableExportConfig.sheetName) || sheetNames[0]
|
|
263
|
-
resolve(excelJsonMap[sheetActive])
|
|
264
|
-
}
|
|
265
|
-
})
|
|
266
|
-
},
|
|
267
|
-
// 根据表格读取数据生成表格数据
|
|
268
|
-
dealImportTableData(columns, results) {
|
|
269
|
-
const that = this
|
|
270
|
-
let colsplit = '.'
|
|
271
|
-
let tableAllColumns = that.generateColumnsAll(columns)
|
|
272
|
-
let errDatas = []
|
|
273
|
-
results.map((row, rowIndex) => {
|
|
274
|
-
Object.keys(row).forEach((key, keyIndex) => {
|
|
275
|
-
let fieldObj = tableAllColumns.find(col =>
|
|
276
|
-
key.indexOf(colsplit) === -1 ? key === col.title || key === col.field : key.split(colsplit).includes(col.title) || key.split(colsplit).includes(col.field)
|
|
277
|
-
)
|
|
278
|
-
let fieldName = (fieldObj && fieldObj.field) || ''
|
|
279
|
-
if (fieldName) {
|
|
280
|
-
row[fieldName] = String(row[key])
|
|
281
|
-
delete row[key]
|
|
282
|
-
}
|
|
283
|
-
let fieldRender = (fieldObj && fieldObj.renderName) || ''
|
|
284
|
-
if (fieldRender) {
|
|
285
|
-
let fieldRenderProps = (fieldObj && fieldObj.renderProps) || {}
|
|
286
|
-
switch (fieldRender) {
|
|
287
|
-
case '$vSelect':
|
|
288
|
-
case '$vSwitch':
|
|
289
|
-
case '$vCheckgroup':
|
|
290
|
-
case '$vRadiogroup':
|
|
291
|
-
if (fieldRenderProps.options && Array.isArray(fieldRenderProps.options)) {
|
|
292
|
-
// 如果匹配到选择项则保留,否则删除掉不规范数据
|
|
293
|
-
// 判断导入值为数据源的key or value 去匹配
|
|
294
|
-
let rowsplit = fieldRenderProps.split || ','
|
|
295
|
-
let rowValue = null
|
|
296
|
-
if ((fieldRenderProps.multiple || fieldRender === '$vCheckgroup') && row[fieldName].indexOf(rowsplit) !== -1) {
|
|
297
|
-
let rowValues = row[fieldName].split(rowsplit)
|
|
298
|
-
let values = fieldRenderProps.options.map(opt => {
|
|
299
|
-
if (rowValues.includes(String(opt.value)) || rowValues.includes(opt.label)) {
|
|
300
|
-
return opt.value
|
|
301
|
-
}
|
|
302
|
-
})
|
|
303
|
-
if (values.length > 0) rowValue = values.join(rowsplit)
|
|
304
|
-
} else {
|
|
305
|
-
let opt = fieldRenderProps.options.find(opt => String(row[fieldName]) === String(opt.value) || String(row[fieldName]) === opt.label)
|
|
306
|
-
if (opt) rowValue = opt.value
|
|
307
|
-
}
|
|
308
|
-
if (rowValue === null && row[fieldName]) {
|
|
309
|
-
errDatas.push({
|
|
310
|
-
rowIndex: rowIndex + 1,
|
|
311
|
-
errMsg: `字段【${fieldObj.title}】不符合数据源规范,已被清空`
|
|
312
|
-
})
|
|
313
|
-
delete row[fieldName]
|
|
314
|
-
} else {
|
|
315
|
-
row[fieldName] = rowValue
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
break
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
})
|
|
322
|
-
})
|
|
323
|
-
return { results, errDatas }
|
|
324
|
-
},
|
|
325
|
-
// 生成全表头
|
|
326
|
-
generateColumnsAll(columns, resultColumns = []) {
|
|
327
|
-
columns.forEach((column, index) => {
|
|
328
|
-
if (column.children && Array.isArray(column.children) && column.children.length) {
|
|
329
|
-
this.generateColumnsAll(column.children, resultColumns)
|
|
330
|
-
} else {
|
|
331
|
-
if (column.field) {
|
|
332
|
-
resultColumns.push({
|
|
333
|
-
title: column.title,
|
|
334
|
-
field: column.field,
|
|
335
|
-
renderName: column.renderName,
|
|
336
|
-
renderProps: column.renderProps
|
|
337
|
-
})
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
})
|
|
341
|
-
return resultColumns
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
</script>
|
|
346
|
-
|
|
347
|
-
<style lang="scss" scoped>
|
|
348
|
-
.import-template-head {
|
|
349
|
-
+ .import-template-body,
|
|
350
|
-
+ .import-template-foot {
|
|
351
|
-
margin-top: 10px;
|
|
352
|
-
}
|
|
353
|
-
.floatright {
|
|
354
|
-
float: right;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
.import-template-body {
|
|
358
|
-
+ .import-template-foot,
|
|
359
|
-
+ .import-template-error {
|
|
360
|
-
margin-top: 10px;
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
.import-template-foot {
|
|
364
|
-
display: flex;
|
|
365
|
-
align-items: center;
|
|
366
|
-
justify-content: space-between;
|
|
367
|
-
}
|
|
368
|
-
.import-template-error-list {
|
|
369
|
-
max-height: 300px;
|
|
370
|
-
overflow: auto;
|
|
371
|
-
font-size: 13px;
|
|
372
|
-
.error-item {
|
|
373
|
-
display: block;
|
|
374
|
-
margin-bottom: 5px;
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
</style>
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<vxe-grid
|
|
3
|
-
ref="vxeTreeTable"
|
|
4
|
-
v-bind="tableConfigIn"
|
|
5
|
-
:class="{ 'sh-vxe-tree-table': true, 'is--hidecheck': globalConfig.checkHide }"
|
|
6
|
-
:height="height"
|
|
7
|
-
:size="size"
|
|
8
|
-
:loading="loading"
|
|
9
|
-
:columns="tableColumns"
|
|
10
|
-
:data="filterData || tableData"
|
|
11
|
-
:row-config="rowConfigIn"
|
|
12
|
-
:radio-config="radioConfigIn"
|
|
13
|
-
:checkbox-config="checkboxConfigIn"
|
|
14
|
-
:pager-config="pagerConfigIn"
|
|
15
|
-
:tree-config="treeConfigIn"
|
|
16
|
-
@radio-change="onRadioChange"
|
|
17
|
-
@checkbox-change="onSelectionChange"
|
|
18
|
-
@checkbox-all="onSelectionChange"
|
|
19
|
-
@checkbox-range-end="onSelectionChange">
|
|
20
|
-
<template #treeNodeCell="scoped">
|
|
21
|
-
<span>{{ getTreeNodeCellContent(scoped) }}</span>
|
|
22
|
-
</template>
|
|
23
|
-
<template #empty>
|
|
24
|
-
<sh-empty :no-data-icon="parentProps.noDataIcon" :no-data-text="parentProps.noDataText"></sh-empty>
|
|
25
|
-
</template>
|
|
26
|
-
</vxe-grid>
|
|
27
|
-
</template>
|
|
28
|
-
|
|
29
|
-
<script>
|
|
30
|
-
import defaultData from '../mixin/defaultData'
|
|
31
|
-
export default {
|
|
32
|
-
name: 'TableTree',
|
|
33
|
-
props: {
|
|
34
|
-
parentProps: {
|
|
35
|
-
type: Object,
|
|
36
|
-
default() {
|
|
37
|
-
return {}
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
loading: {
|
|
41
|
-
type: Boolean
|
|
42
|
-
},
|
|
43
|
-
height: {
|
|
44
|
-
type: [Number, String],
|
|
45
|
-
default: 'auto'
|
|
46
|
-
},
|
|
47
|
-
filterText: {
|
|
48
|
-
type: String
|
|
49
|
-
},
|
|
50
|
-
size: {
|
|
51
|
-
type: String,
|
|
52
|
-
default: 'medium' // medium / small / mini
|
|
53
|
-
},
|
|
54
|
-
globalConfig: {
|
|
55
|
-
type: Object,
|
|
56
|
-
default() {
|
|
57
|
-
return {}
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
tableData: {
|
|
61
|
-
type: Array,
|
|
62
|
-
default() {
|
|
63
|
-
return []
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
selectedKeys: {
|
|
67
|
-
type: Array,
|
|
68
|
-
default() {
|
|
69
|
-
return []
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
emits: ['select'],
|
|
74
|
-
data() {
|
|
75
|
-
return {
|
|
76
|
-
...defaultData,
|
|
77
|
-
filterData: null,
|
|
78
|
-
filterChangeDebounce: this.$vUtils.debounce(this.handleMyTableFilter, 500)
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
computed: {
|
|
82
|
-
multiple() {
|
|
83
|
-
return this.parentProps.multiple || false
|
|
84
|
-
},
|
|
85
|
-
tableConfigIn() {
|
|
86
|
-
return Object.assign({ showHeader: !!(this.globalConfig.hasAll && this.multiple) }, this.tableConfigDefault, this.globalConfig.tableConfig)
|
|
87
|
-
},
|
|
88
|
-
pagerConfigIn() {
|
|
89
|
-
return Object.assign({ enabled: false }, this.globalConfig.pagerConfig)
|
|
90
|
-
},
|
|
91
|
-
rowConfigIn() {
|
|
92
|
-
return Object.assign({ isCurrent: false }, this.tableConfigIn.rowConfig, { keyField: this.parentProps.nodeKey })
|
|
93
|
-
},
|
|
94
|
-
radioConfigIn() {
|
|
95
|
-
return Object.assign({ labelField: this.parentProps.labelField, checkRowKey: this.selectedKeys[0], checkMethod: this.tableCheckMethods }, this.globalConfig.radioConfig)
|
|
96
|
-
},
|
|
97
|
-
checkboxConfigIn() {
|
|
98
|
-
return Object.assign({ labelField: this.parentProps.labelField, checkRowKeys: this.selectedKeys, checkMethod: this.tableCheckMethods }, this.globalConfig.checkboxConfig)
|
|
99
|
-
},
|
|
100
|
-
treeConfigIn() {
|
|
101
|
-
return Object.assign({ rowField: this.parentProps.nodeKey, transform: this.globalConfig.transform }, this.globalConfig.treeConfig)
|
|
102
|
-
},
|
|
103
|
-
tableColumns() {
|
|
104
|
-
let { globalConfig, multiple, checkboxConfigIn, radioConfigIn, parentProps } = this
|
|
105
|
-
let defaultColumn = {
|
|
106
|
-
field: multiple ? checkboxConfigIn.labelField : radioConfigIn.labelField,
|
|
107
|
-
title: parentProps.labelTitle || (multiple ? '全部' : ''),
|
|
108
|
-
type: parentProps.disabled ? 'html' : multiple ? 'checkbox' : 'radio',
|
|
109
|
-
treeNode: true,
|
|
110
|
-
width: globalConfig.columns ? globalConfig?.defaultWidth || 150 : '100%',
|
|
111
|
-
slots: { default: 'treeNodeCell' }
|
|
112
|
-
}
|
|
113
|
-
return [defaultColumn].concat(globalConfig.columns || [])
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
watch: {
|
|
117
|
-
selectedKeys: {
|
|
118
|
-
handler(newvalue, oldValue) {},
|
|
119
|
-
deep: true
|
|
120
|
-
},
|
|
121
|
-
filterText: {
|
|
122
|
-
handler(newvalue, oldValue) {
|
|
123
|
-
this.filterChangeDebounce(newvalue)
|
|
124
|
-
},
|
|
125
|
-
deep: true,
|
|
126
|
-
immediate: true
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
created() {},
|
|
130
|
-
mounted() {
|
|
131
|
-
this.initMounted()
|
|
132
|
-
},
|
|
133
|
-
beforeUnmount() {},
|
|
134
|
-
methods: {
|
|
135
|
-
tableRef() {
|
|
136
|
-
return this.$refs.vxeTreeTable
|
|
137
|
-
},
|
|
138
|
-
initMounted() {
|
|
139
|
-
this.initSelection()
|
|
140
|
-
},
|
|
141
|
-
initSelection() {
|
|
142
|
-
const that = this
|
|
143
|
-
let nodeKey = that.parentProps.nodeKey || 'id'
|
|
144
|
-
setTimeout(() => {
|
|
145
|
-
if (that.selectedKeys && that.selectedKeys.length > 0) {
|
|
146
|
-
that.tableRef().scrollToRow({ [nodeKey]: that.selectedKeys[0] })
|
|
147
|
-
}
|
|
148
|
-
})
|
|
149
|
-
},
|
|
150
|
-
// 单选框变化
|
|
151
|
-
onRadioChange(obj) {
|
|
152
|
-
const that = this
|
|
153
|
-
let nodeKey = that.parentProps.nodeKey || 'id'
|
|
154
|
-
let { newValue } = obj
|
|
155
|
-
let selectedKeys = []
|
|
156
|
-
if (newValue && (newValue[nodeKey] || newValue[nodeKey] === 0)) {
|
|
157
|
-
selectedKeys.push(newValue[nodeKey])
|
|
158
|
-
}
|
|
159
|
-
that.treeSelectedChange(selectedKeys, newValue ? [newValue] : [], obj)
|
|
160
|
-
},
|
|
161
|
-
// 复选框变化
|
|
162
|
-
onSelectionChange(obj) {
|
|
163
|
-
const that = this
|
|
164
|
-
let nodeKey = that.parentProps.nodeKey || 'id'
|
|
165
|
-
let { records = [] } = obj
|
|
166
|
-
let selectedKeys = []
|
|
167
|
-
if (Array.isArray(records) && records.length > 0) {
|
|
168
|
-
records.forEach(item => {
|
|
169
|
-
selectedKeys.push(item[nodeKey])
|
|
170
|
-
})
|
|
171
|
-
}
|
|
172
|
-
that.treeSelectedChange(selectedKeys, records, obj)
|
|
173
|
-
},
|
|
174
|
-
// 全局搜索过滤事件
|
|
175
|
-
handleMyTableFilter(text) {
|
|
176
|
-
const that = this
|
|
177
|
-
let filterText = that.$vUtils.toValueString(text).trim().toLowerCase()
|
|
178
|
-
let filterData = null
|
|
179
|
-
if (filterText) {
|
|
180
|
-
const searchProps = [{ rkey: that.parentProps.labelField, format: that.parentProps.labelFormat }]
|
|
181
|
-
let tableColumnsAll = that.tableRef().getColumns()
|
|
182
|
-
tableColumnsAll.forEach(col => {
|
|
183
|
-
let renderObj = col.cellRender || col.editRender || col.itemRender
|
|
184
|
-
let noSearchArr = ['$vGlobalOption', '$vImg', '$vCheckbox', '$vRadio', '$vUpload', '$vCode', 'seq', 'checkbox', 'radio']
|
|
185
|
-
if (col.property && renderObj && renderObj.name && !noSearchArr.includes(renderObj.name) && !noSearchArr.includes(col.type)) {
|
|
186
|
-
searchProps.push({ rkey: col.property, rname: renderObj.name, rprops: Object.assign({}, renderObj.props, col.rprops) })
|
|
187
|
-
}
|
|
188
|
-
})
|
|
189
|
-
filterData = that.$vUtils.searchTree(that.tableData, row => {
|
|
190
|
-
return searchProps.some(item => {
|
|
191
|
-
let cellValue = item.format ? that.$vUtils.format(item.format, row) : that.$vUtils.get(row, item.rkey)
|
|
192
|
-
if (that.$vxePluginNames.expendRenders && that.$vxePluginNames.expendRenders.includes(item.rname)) {
|
|
193
|
-
let { rtext } = that.$vUtils.formatRender(cellValue, item.rkey, row, item.rname, item.rprops, that)
|
|
194
|
-
return String(rtext).toLowerCase().indexOf(filterText) > -1
|
|
195
|
-
}
|
|
196
|
-
return that.$vUtils.trim(cellValue).toLowerCase().indexOf(filterText) > -1
|
|
197
|
-
})
|
|
198
|
-
})
|
|
199
|
-
}
|
|
200
|
-
if (that.filterData === null && !filterText) {
|
|
201
|
-
return
|
|
202
|
-
}
|
|
203
|
-
that.filterData = filterData
|
|
204
|
-
if (filterData && filterData.length > 0) {
|
|
205
|
-
that.tableRef().setTreeExpand(filterData[0], true)
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
// 获取选中的数据
|
|
209
|
-
getSelectionData() {
|
|
210
|
-
return this.tableRef().getCheckboxRecords()
|
|
211
|
-
},
|
|
212
|
-
// 树变化提交
|
|
213
|
-
async treeSelectedChange(selectedKeys, selectedRows, obj) {
|
|
214
|
-
this.$emit('select', selectedKeys, selectedRows, obj)
|
|
215
|
-
},
|
|
216
|
-
tableCheckMethods({ row }) {
|
|
217
|
-
if (this.parentProps.isLeaf && !this.parentProps.multiple) {
|
|
218
|
-
return +row.isleaf === 1 || +row.isLeaf === 1
|
|
219
|
-
}
|
|
220
|
-
return true
|
|
221
|
-
},
|
|
222
|
-
getTreeNodeCellContent({ row, column }) {
|
|
223
|
-
let { labelFormat, field } = this.parentProps
|
|
224
|
-
if (labelFormat) {
|
|
225
|
-
return this.$vUtils.format(labelFormat, row)
|
|
226
|
-
}
|
|
227
|
-
return this.$vUtils.get(row, column.property)
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
</script>
|
|
232
|
-
|
|
233
|
-
<style lang="scss" scoped></style>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
.sh-vxe-tree{
|
|
2
|
-
position: relative;
|
|
3
|
-
width: 100%;
|
|
4
|
-
.vxe-input{
|
|
5
|
-
width: 100%;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.sh-vxe-tree-table{
|
|
10
|
-
.is--disabled.vxe-radio, .vxe-table--render-default .is--disabled.vxe-cell--radio,
|
|
11
|
-
.is--disabled.vxe-checkbox, .vxe-table--render-default .is--disabled.vxe-cell--checkbox{
|
|
12
|
-
color: inherit;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.sh-vxe-tree-result{
|
|
17
|
-
position: relative;
|
|
18
|
-
top: 50%;
|
|
19
|
-
transform: translateY(-60%);
|
|
20
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="sh-vxe-tree" :style="{ height: shVxeTableHeight }">
|
|
3
|
-
<component
|
|
4
|
-
:is="curCompunent"
|
|
5
|
-
ref="vxe-tree-child"
|
|
6
|
-
v-bind="$props"
|
|
7
|
-
:selected-keys="selectedKeys"
|
|
8
|
-
:global-config="treeGlobalConfig"
|
|
9
|
-
@change="treeSelectedChange"
|
|
10
|
-
@focus="treeSelectedFocus"
|
|
11
|
-
@blur="treeSelectedBlur"></component>
|
|
12
|
-
</div>
|
|
13
|
-
</template>
|
|
14
|
-
|
|
15
|
-
<script>
|
|
16
|
-
import vxeDirectTree from './vxe-direct-tree.vue'
|
|
17
|
-
import vxeSelectTree from './vxe-select-tree.vue'
|
|
18
|
-
import props from './js/props'
|
|
19
|
-
export default {
|
|
20
|
-
name: 'ShTree',
|
|
21
|
-
components: {
|
|
22
|
-
vxeDirectTree,
|
|
23
|
-
vxeSelectTree
|
|
24
|
-
},
|
|
25
|
-
props: {
|
|
26
|
-
...props
|
|
27
|
-
},
|
|
28
|
-
emits: ['update:modelValue', 'change', 'focus', 'blur'],
|
|
29
|
-
data() {
|
|
30
|
-
return {
|
|
31
|
-
selectedKeys: [],
|
|
32
|
-
selectionData: []
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
computed: {
|
|
36
|
-
curCompunent() {
|
|
37
|
-
return this.isSelect ? 'vxeSelectTree' : 'vxeDirectTree'
|
|
38
|
-
},
|
|
39
|
-
shVxeTableHeight() {
|
|
40
|
-
return this.height === '100%' || this.height === 'auto' ? '100%' : 'auto'
|
|
41
|
-
},
|
|
42
|
-
treeGlobalConfig() {
|
|
43
|
-
return Object.assign({ treeFilter: true, initServer: !this.isSelect }, this.globalConfig)
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
watch: {
|
|
47
|
-
modelValue: {
|
|
48
|
-
handler(newvalue, oldValue) {
|
|
49
|
-
this.selectedKeys = newvalue
|
|
50
|
-
},
|
|
51
|
-
deep: true,
|
|
52
|
-
immediate: true
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
created() {},
|
|
56
|
-
mounted() {},
|
|
57
|
-
methods: {
|
|
58
|
-
// 初始化
|
|
59
|
-
initCreated() {},
|
|
60
|
-
// 树节点获取焦点事件
|
|
61
|
-
treeSelectedFocus() {
|
|
62
|
-
this.$emit('focus', this.selectedKeys || [], this.selectionData || [])
|
|
63
|
-
},
|
|
64
|
-
// 树节点选择变换事件
|
|
65
|
-
treeSelectedChange(selectedKeys, selectedRows, obj) {
|
|
66
|
-
this.selectedKeys = selectedKeys
|
|
67
|
-
this.selectionData = selectedRows
|
|
68
|
-
this.$emit('update:modelValue', selectedKeys, selectedRows, obj)
|
|
69
|
-
this.$emit('change', selectedKeys, selectedRows, obj)
|
|
70
|
-
},
|
|
71
|
-
// 树收起下拉回调blur方法
|
|
72
|
-
treeSelectedBlur(obj) {
|
|
73
|
-
this.$emit('blur', this.selectedKeys || [], this.selectionData || [])
|
|
74
|
-
},
|
|
75
|
-
// 获取选中数据
|
|
76
|
-
getSelectionData() {
|
|
77
|
-
return this.selectionData
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
</script>
|
|
82
|
-
|
|
83
|
-
<style lang="scss">
|
|
84
|
-
@import 'css/index.scss';
|
|
85
|
-
</style>
|