sh-view 1.7.5 → 2.0.0
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/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-form/js/methods.js +146 -0
- 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 -286
- 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 -0
- 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 +91 -153
- 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 +315 -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 -418
- package/packages/components/global-components/sh-upload/js/ajax.js +80 -0
- package/packages/components/global-components/sh-upload/js/mixin.js +257 -0
- 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 -184
- 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-layout/index.vue +0 -142
- package/packages/components/global-components/sh-upload/components/u-img.vue +0 -63
- package/packages/components/global-components/sh-upload/components/u-list.vue +0 -100
- package/packages/components/global-components/sh-vxe-form/js/methods.js +0 -170
- package/packages/components/global-components/sh-vxe-list/index.vue +0 -129
- 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,170 +0,0 @@
|
|
|
1
|
-
const vxeEvents = {
|
|
2
|
-
// -------- 表单
|
|
3
|
-
// 表单提交
|
|
4
|
-
onFormSubmit(params) {
|
|
5
|
-
this.$emit('submit', params)
|
|
6
|
-
},
|
|
7
|
-
// 表单重置
|
|
8
|
-
onFormReset(params) {
|
|
9
|
-
this.initFormItems()
|
|
10
|
-
this.$vUtils.clear(this.data, null)
|
|
11
|
-
this.$emit('reset', params)
|
|
12
|
-
},
|
|
13
|
-
// 表单项编辑回调
|
|
14
|
-
async onFormEditClosed(obj, renderbox) {
|
|
15
|
-
let { property, data } = obj
|
|
16
|
-
if (this.formRules[property]) {
|
|
17
|
-
let valerr = await this.formRef().validateField(property)
|
|
18
|
-
if (!valerr) {
|
|
19
|
-
this.formRef().clearValidate(property)
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
this.$emit('edit-closed', obj, renderbox, this)
|
|
23
|
-
Object.assign(this.data, data)
|
|
24
|
-
},
|
|
25
|
-
// 表单校验不通过
|
|
26
|
-
onFormSubmitInvalid(params) {
|
|
27
|
-
this.$emit('submit-invalid', params)
|
|
28
|
-
},
|
|
29
|
-
// 表单折叠按钮被手动点击时会触发该事件
|
|
30
|
-
onFormCollapse(params) {
|
|
31
|
-
this.$emit('collapse', params)
|
|
32
|
-
},
|
|
33
|
-
// 前缀点击事件
|
|
34
|
-
onPrefixClick(params, render) {
|
|
35
|
-
this.$emit('prefix-click', params, render)
|
|
36
|
-
},
|
|
37
|
-
// 后缀点击事件
|
|
38
|
-
onSuffixClick(params, render) {
|
|
39
|
-
this.$emit('suffix-click', params, render)
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const vxeMethods = {
|
|
44
|
-
// 表单验证方法
|
|
45
|
-
validate(callback) {
|
|
46
|
-
return this.formRef().validate(callback)
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const shMethods = {
|
|
51
|
-
// 初始化
|
|
52
|
-
initCreated() {
|
|
53
|
-
this.initFormItems()
|
|
54
|
-
this.initFormData()
|
|
55
|
-
},
|
|
56
|
-
// 初始化表单字段
|
|
57
|
-
initFormData() {
|
|
58
|
-
const that = this
|
|
59
|
-
that.$vUtils.eachTree(that.items, item => {
|
|
60
|
-
let renderProps = item.renderProps || item.itemRender?.props || {}
|
|
61
|
-
if (!that.$vUtils.isNone(renderProps?.defaultValue) && that.$vUtils.isNone(that.$vUtils.get(that.data, item.field))) {
|
|
62
|
-
that.$vUtils.set(that.data, item.field, renderProps.defaultValue || null)
|
|
63
|
-
}
|
|
64
|
-
})
|
|
65
|
-
},
|
|
66
|
-
// 初始化表单项
|
|
67
|
-
initFormItems(items) {
|
|
68
|
-
const that = this
|
|
69
|
-
let originItems = items || that.items
|
|
70
|
-
let formItemsArr = [] // 表单项
|
|
71
|
-
let rules = {} // 校验规则
|
|
72
|
-
that.generateFormItem(originItems, formItemsArr, rules)
|
|
73
|
-
that.initEditRules(rules)
|
|
74
|
-
that.formItems = formItemsArr
|
|
75
|
-
this.initFormData()
|
|
76
|
-
},
|
|
77
|
-
// 初始化验证规则
|
|
78
|
-
initEditRules(rules) {
|
|
79
|
-
const that = this
|
|
80
|
-
if (rules && that.$vUtils.isPlainObject(rules)) {
|
|
81
|
-
Object.keys(rules).forEach(key => {
|
|
82
|
-
if (that.formRules[key]) {
|
|
83
|
-
that.formRules[key] = Array.from(new Set(that.formRules[key].concat(rules[key])))
|
|
84
|
-
} else {
|
|
85
|
-
that.formRules[key] = rules[key]
|
|
86
|
-
}
|
|
87
|
-
})
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
// 获取默认验证信息
|
|
91
|
-
getDefaultMessage(renderType, title) {
|
|
92
|
-
let message = ''
|
|
93
|
-
const selectRenders = ['$vSelect', '$vTree', '$vTime', '$vSwitch', '$vCheckbox', '$vCheckgroup', '$vRadio', '$vRadiogroup', '$vUpload']
|
|
94
|
-
if (selectRenders.includes(renderType)) {
|
|
95
|
-
message = '请选择' + title
|
|
96
|
-
} else {
|
|
97
|
-
message = '请输入' + title
|
|
98
|
-
}
|
|
99
|
-
return message
|
|
100
|
-
},
|
|
101
|
-
// 判断为true
|
|
102
|
-
isTrue(value) {
|
|
103
|
-
return String(value) === '1' || String(value).toLowerCase() === 'true'
|
|
104
|
-
},
|
|
105
|
-
// 生成全表头
|
|
106
|
-
generateColumnsAll(columns, resultColumns = []) {
|
|
107
|
-
columns.forEach((column, index) => {
|
|
108
|
-
if (column.children && Array.isArray(column.children) && column.children.length) {
|
|
109
|
-
this.generateColumnsAll(column.children, resultColumns)
|
|
110
|
-
} else {
|
|
111
|
-
resultColumns.push(column)
|
|
112
|
-
}
|
|
113
|
-
})
|
|
114
|
-
return resultColumns
|
|
115
|
-
},
|
|
116
|
-
// 自动生成表单渲染项
|
|
117
|
-
generateFormItem(formItems = [], itemArr = [], rules = {}) {
|
|
118
|
-
const that = this
|
|
119
|
-
formItems.forEach(ori => {
|
|
120
|
-
let tar = Object.assign({}, that.itemConfigDefault, ori)
|
|
121
|
-
if (ori.children && ori.children.length > 0) {
|
|
122
|
-
let childrenArr = []
|
|
123
|
-
that.generateFormItem(ori.children, childrenArr, rules)
|
|
124
|
-
if (that.isItemTitle) {
|
|
125
|
-
// 补入标题渲染器
|
|
126
|
-
let groupTitleRender = Object.assign({}, that.titleConfigDefault, tar, { span: 24, field: '' })
|
|
127
|
-
delete groupTitleRender.children
|
|
128
|
-
childrenArr.unshift(groupTitleRender)
|
|
129
|
-
}
|
|
130
|
-
tar.children = childrenArr
|
|
131
|
-
if (!tar.span) tar.span = 24
|
|
132
|
-
itemArr.push(tar)
|
|
133
|
-
} else {
|
|
134
|
-
let renderConfig = {
|
|
135
|
-
name: ori.renderName || '$vInput',
|
|
136
|
-
props: Object.assign({}, ori.renderProps || {})
|
|
137
|
-
}
|
|
138
|
-
if (that.readonly || that.disabled) {
|
|
139
|
-
renderConfig.props.disabled = true
|
|
140
|
-
}
|
|
141
|
-
tar.itemRender = Object.assign({}, renderConfig, ori.itemRender || {})
|
|
142
|
-
// 首先提取校验配置
|
|
143
|
-
if (that.isTrue(ori['renderRequire'])) {
|
|
144
|
-
// 若配置了校验参数则走校验参数,没配置则给默认校验条件
|
|
145
|
-
if (ori['requireProps'] && Array.isArray(ori['requireProps']) && ori['requireProps'].length > 0) {
|
|
146
|
-
rules[ori['field']] = ori['requireProps']
|
|
147
|
-
} else {
|
|
148
|
-
let dataType = 'string'
|
|
149
|
-
let arrayType = ['$vCheckgroup', '$vUpload', '$vTable']
|
|
150
|
-
if (arrayType.includes(ori['renderName']) || ((ori['renderName'] === '$vSelect' || ori['renderName'] === '$vTree') && that.isTrue(renderConfig.props.multiple))) {
|
|
151
|
-
dataType = 'array'
|
|
152
|
-
}
|
|
153
|
-
rules[ori['field']] = [{ required: true, message: that.getDefaultMessage(ori['renderName'], ori['title']), type: dataType }]
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
// 表单不支持编辑渲染过滤
|
|
157
|
-
let notRenderName = ['seq', 'checkbox', 'radio', '$vImg', '$vHref', '$vGlobalOption']
|
|
158
|
-
if (!((ori.renderName && notRenderName.includes(ori.renderName)) || notRenderName.includes(ori.type))) {
|
|
159
|
-
itemArr.push(tar)
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
})
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
export default {
|
|
167
|
-
...vxeEvents,
|
|
168
|
-
...vxeMethods,
|
|
169
|
-
...shMethods
|
|
170
|
-
}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="sh-list">
|
|
3
|
-
<template v-if="$slots.header"><slot name="header"></slot></template>
|
|
4
|
-
<vxe-list ref="vxeList" :data="dataSourse" :size="size" :class-name="className" :loading="loading" :height="height" :auto-resize="autoResize" :sync-resize="syncResize" :scroll-y="scrollY">
|
|
5
|
-
<template #default="{ items }">
|
|
6
|
-
<sh-empty v-if="items.length === 0 && !loading" :no-data-icon="noDataIcon" :no-data-text="noDataText"></sh-empty>
|
|
7
|
-
<Row :gutter="grid.gutter">
|
|
8
|
-
<Col v-for="(item, itemindex) in items" :key="itemindex" v-bind="grid">
|
|
9
|
-
<div class="sh-list-item" :class="itemClassName">
|
|
10
|
-
<slot name="item" :item="item"></slot>
|
|
11
|
-
</div>
|
|
12
|
-
</Col>
|
|
13
|
-
</Row>
|
|
14
|
-
</template>
|
|
15
|
-
</vxe-list>
|
|
16
|
-
<template v-if="$slots.footer"><slot name="footer"></slot></template>
|
|
17
|
-
<vxe-pager v-if="pagerConfig" v-bind="listPagerConfig" @page-change="onPageChange"></vxe-pager>
|
|
18
|
-
</div>
|
|
19
|
-
</template>
|
|
20
|
-
|
|
21
|
-
<script>
|
|
22
|
-
export default {
|
|
23
|
-
name: 'ShList',
|
|
24
|
-
props: {
|
|
25
|
-
dataSourse: {
|
|
26
|
-
type: Array,
|
|
27
|
-
default() {
|
|
28
|
-
return []
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
size: {
|
|
32
|
-
type: String
|
|
33
|
-
},
|
|
34
|
-
className: {
|
|
35
|
-
type: String
|
|
36
|
-
},
|
|
37
|
-
itemClassName: {
|
|
38
|
-
type: String
|
|
39
|
-
},
|
|
40
|
-
loading: {
|
|
41
|
-
type: Boolean
|
|
42
|
-
},
|
|
43
|
-
height: {
|
|
44
|
-
type: [String, Number],
|
|
45
|
-
default: 'auto'
|
|
46
|
-
},
|
|
47
|
-
autoResize: {
|
|
48
|
-
type: Boolean
|
|
49
|
-
},
|
|
50
|
-
syncResize: {
|
|
51
|
-
type: [Boolean, String, Number]
|
|
52
|
-
},
|
|
53
|
-
scrollY: {
|
|
54
|
-
type: [Boolean, Object],
|
|
55
|
-
default() {
|
|
56
|
-
return { enabled: false, gt: 60 }
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
pagerConfig: {
|
|
60
|
-
type: [Object, Boolean],
|
|
61
|
-
default: false
|
|
62
|
-
},
|
|
63
|
-
noDataIcon: {
|
|
64
|
-
type: String
|
|
65
|
-
},
|
|
66
|
-
noDataText: {
|
|
67
|
-
type: String
|
|
68
|
-
},
|
|
69
|
-
grid: {
|
|
70
|
-
type: Object,
|
|
71
|
-
default() {
|
|
72
|
-
return { gutter: 0, span: 24 }
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
emits: ['page-change'],
|
|
77
|
-
data() {
|
|
78
|
-
return {
|
|
79
|
-
pagerConfigDefault: {
|
|
80
|
-
currentPage: 1,
|
|
81
|
-
pageSize: 50,
|
|
82
|
-
total: 0
|
|
83
|
-
},
|
|
84
|
-
listPagerConfig: {}
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
computed: {},
|
|
88
|
-
watch: {
|
|
89
|
-
pagerConfig: {
|
|
90
|
-
handler(newvalue, oldValue) {
|
|
91
|
-
this.initPagerConfig()
|
|
92
|
-
},
|
|
93
|
-
deep: true,
|
|
94
|
-
immediate: true
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
created() {},
|
|
98
|
-
mounted() {},
|
|
99
|
-
beforeUnmount() {},
|
|
100
|
-
methods: {
|
|
101
|
-
listRef() {
|
|
102
|
-
return this.$refs.vxeList
|
|
103
|
-
},
|
|
104
|
-
// 初始化分页配置
|
|
105
|
-
initPagerConfig() {
|
|
106
|
-
this.listPagerConfig = Object.assign({}, this.pagerConfigDefault, this.pagerConfig)
|
|
107
|
-
},
|
|
108
|
-
// 分页变化触发
|
|
109
|
-
onPageChange(data) {
|
|
110
|
-
let { currentPage, pageSize } = data
|
|
111
|
-
this.listPagerConfig.currentPage = currentPage
|
|
112
|
-
this.listPagerConfig.pageSize = pageSize
|
|
113
|
-
this.$emit('page-change', data)
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
</script>
|
|
118
|
-
|
|
119
|
-
<style lang="scss" scoped>
|
|
120
|
-
.sh-list {
|
|
121
|
-
position: relative;
|
|
122
|
-
.sh-list-item {
|
|
123
|
-
display: flex;
|
|
124
|
-
width: 100%;
|
|
125
|
-
justify-content: space-between;
|
|
126
|
-
align-items: center;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
</style>
|
|
@@ -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>
|