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
|
@@ -7,10 +7,9 @@ const vxeEvents = {
|
|
|
7
7
|
},
|
|
8
8
|
// 单选框变化
|
|
9
9
|
onRadioChange(params) {
|
|
10
|
-
const that = this
|
|
11
10
|
var { row } = params
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
this.selectionRows = [row]
|
|
12
|
+
this.$emit('radio-change', this.selectionRows, params)
|
|
14
13
|
},
|
|
15
14
|
// 复选框变化
|
|
16
15
|
onSelectionChange(params) {
|
|
@@ -63,15 +62,14 @@ const vxeEvents = {
|
|
|
63
62
|
},
|
|
64
63
|
// 只对 edit-config 配置时有效,单元格编辑状态下被关闭时会触发该事件
|
|
65
64
|
async onEditClosed(params) {
|
|
66
|
-
const that = this
|
|
67
65
|
let { row, column } = params
|
|
68
66
|
let { property, model, rname, rprops } = column
|
|
69
67
|
if ((model.update || model.change) && rname) {
|
|
70
|
-
let { rvalue, rtext } =
|
|
71
|
-
|
|
68
|
+
let { rvalue, rtext } = this.$vUtils.formatRender(model.value, property, row, rname, rprops, this, true)
|
|
69
|
+
this.$vUtils.set(row, column.property, rvalue)
|
|
72
70
|
model.change = false
|
|
73
71
|
}
|
|
74
|
-
|
|
72
|
+
this.$emit('edit-closed', params)
|
|
75
73
|
},
|
|
76
74
|
// 只对 edit-config 配置时有效,单元格被激活编辑时会触发该事件
|
|
77
75
|
async onEditActived(params) {
|
|
@@ -87,10 +85,7 @@ const vxeEvents = {
|
|
|
87
85
|
},
|
|
88
86
|
// 分页变化触发
|
|
89
87
|
onPageChange(params) {
|
|
90
|
-
let { currentPage, pageSize } = params
|
|
91
88
|
this.selectionRows = []
|
|
92
|
-
this.tablePagerConfig.currentPage = currentPage
|
|
93
|
-
this.tablePagerConfig.pageSize = pageSize
|
|
94
89
|
this.$emit('page-change', params)
|
|
95
90
|
},
|
|
96
91
|
|
|
@@ -108,12 +103,10 @@ const vxeEvents = {
|
|
|
108
103
|
const vxeFormEvents = {
|
|
109
104
|
// 表单展开全部/收起切换事件
|
|
110
105
|
onFormCollapsed(value) {
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}, 200)
|
|
116
|
-
}
|
|
106
|
+
const { tableRef } = this
|
|
107
|
+
setTimeout(() => {
|
|
108
|
+
tableRef().recalculate(true)
|
|
109
|
+
})
|
|
117
110
|
},
|
|
118
111
|
// -------- 搜索
|
|
119
112
|
onFormSubmit() {
|
|
@@ -137,10 +130,9 @@ const vxeMethods = {
|
|
|
137
130
|
// // vxe组件方法可通过 this.tableRef() 调用
|
|
138
131
|
// 表格全选
|
|
139
132
|
setSelectionAll() {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
that.selectionRows = that.tableRef().getCheckboxRecords()
|
|
133
|
+
this.isAllChecked = !this.isAllChecked
|
|
134
|
+
this.tableRef().setAllCheckboxRow(this.isAllChecked)
|
|
135
|
+
this.selectionRows = this.tableRef().getCheckboxRecords()
|
|
144
136
|
},
|
|
145
137
|
// 表格打印、导出统一过滤列
|
|
146
138
|
columnDefaultFilterMethod({ column, $columnIndex }) {
|
|
@@ -164,14 +156,14 @@ const vxeMethods = {
|
|
|
164
156
|
data = this.getSelectionData()
|
|
165
157
|
} else {
|
|
166
158
|
data = this.$vUtils.clone(this.tableRef().getTableData().fullData, true)
|
|
167
|
-
let rnameColumns = columns.
|
|
159
|
+
let rnameColumns = columns.filter(col => col.rname)
|
|
168
160
|
rnameColumns.forEach(col => {
|
|
169
161
|
let { property, rname, rprops } = col
|
|
170
162
|
data.forEach(row => {
|
|
171
163
|
let cellValue = this.$vUtils.get(row, property)
|
|
172
164
|
if (!this.$vUtils.isNone(cellValue)) {
|
|
173
|
-
let
|
|
174
|
-
this.$vUtils.set(row, property,
|
|
165
|
+
let { rvalue, rtext } = this.$vUtils.formatRender(cellValue, property, row, rname, rprops, this)
|
|
166
|
+
this.$vUtils.set(row, property, rtext)
|
|
175
167
|
}
|
|
176
168
|
})
|
|
177
169
|
})
|
|
@@ -188,11 +180,11 @@ const vxeMethods = {
|
|
|
188
180
|
},
|
|
189
181
|
// 默认求底部绑定方法vxe
|
|
190
182
|
tableFooterMethod({ columns, data }) {
|
|
191
|
-
|
|
183
|
+
const { footerCalculate, tableFooterCompute } = this
|
|
192
184
|
let footerData = []
|
|
193
|
-
let footerCalculateList =
|
|
185
|
+
let footerCalculateList = footerCalculate.calculate || []
|
|
194
186
|
footerCalculateList.forEach(key => {
|
|
195
|
-
footerData.push(
|
|
187
|
+
footerData.push(tableFooterCompute(columns, data, key, footerCalculate[key]))
|
|
196
188
|
})
|
|
197
189
|
return footerData
|
|
198
190
|
},
|
|
@@ -230,8 +222,8 @@ const vxeMethods = {
|
|
|
230
222
|
})
|
|
231
223
|
},
|
|
232
224
|
tableFooterSpanMethod({ $rowIndex, column, $columnIndex, data }) {
|
|
233
|
-
|
|
234
|
-
let defaultColumns =
|
|
225
|
+
const { columnsConfigDefault, tableGlobalConfig } = this
|
|
226
|
+
let defaultColumns = columnsConfigDefault.filter(item => tableGlobalConfig[item.type])
|
|
235
227
|
let colspan = defaultColumns.length || 1
|
|
236
228
|
if (column.type === 'seq') {
|
|
237
229
|
return { rowspan: 1, colspan: colspan }
|
|
@@ -246,125 +238,57 @@ const vxeMethods = {
|
|
|
246
238
|
const shMethods = {
|
|
247
239
|
// 初始化
|
|
248
240
|
initCreated() {},
|
|
249
|
-
// 初始化分页配置
|
|
250
|
-
initPagerConfig() {
|
|
251
|
-
if (this.pagerConfig === false || this.reverse) {
|
|
252
|
-
this.tablePagerConfig = { enabled: false }
|
|
253
|
-
} else {
|
|
254
|
-
this.tablePagerConfig = Object.assign({}, this.pagerConfigDefault, this.pagerConfig)
|
|
255
|
-
}
|
|
256
|
-
},
|
|
257
241
|
// 初始化生成新表头数据
|
|
258
242
|
initTableColumns(columns = []) {
|
|
259
|
-
let
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
if (!that.tableReverse) {
|
|
265
|
-
that.tableColumnsFixed = that.$vUtils.clone(columnsArr, true)
|
|
266
|
-
} else {
|
|
267
|
-
that.tableColumnsFixed = that.getReverseColumn(that.columns)
|
|
268
|
-
}
|
|
243
|
+
let { columnsArr, columnsFlatArr, formItemsArr, rules } = this.getTransfarColumn(columns)
|
|
244
|
+
this.tableColumnsFlat = columnsFlatArr
|
|
245
|
+
this.tableFormItems = formItemsArr
|
|
246
|
+
this.initEditRules(rules)
|
|
247
|
+
this.tableColumnsFixed = this.$vUtils.clone(columnsArr, true)
|
|
269
248
|
},
|
|
270
249
|
// 初始化验证规则
|
|
271
250
|
initEditRules(rules) {
|
|
272
|
-
const
|
|
273
|
-
if (rules &&
|
|
251
|
+
const { $vUtils } = this
|
|
252
|
+
if (rules && $vUtils.isPlainObject(rules)) {
|
|
274
253
|
Object.keys(rules).forEach(key => {
|
|
275
|
-
if (
|
|
276
|
-
|
|
254
|
+
if (this.tableEditRules[key]) {
|
|
255
|
+
this.tableEditRules[key] = Array.from(new Set(this.tableEditRules[key].concat(rules[key])))
|
|
277
256
|
} else {
|
|
278
|
-
|
|
257
|
+
this.tableEditRules[key] = rules[key]
|
|
279
258
|
}
|
|
280
259
|
})
|
|
281
260
|
}
|
|
282
261
|
},
|
|
283
262
|
// 初始化表头配置默认值
|
|
284
263
|
initColsDefaultValue() {
|
|
285
|
-
const
|
|
264
|
+
const { tableColumnsFlat, dataSourse, $vUtils } = this
|
|
286
265
|
let colsDefaultValue = {}
|
|
287
|
-
|
|
266
|
+
$vUtils.eachTree(tableColumnsFlat, item => {
|
|
288
267
|
let renderObj = item.editRender || item.cellRender || {}
|
|
289
268
|
let noRenderArr = ['$vGlobalOption']
|
|
290
|
-
if (!noRenderArr.includes(renderObj.name) &&
|
|
291
|
-
|
|
269
|
+
if (!noRenderArr.includes(renderObj.name) && !$vUtils.isNone(renderObj.props?.defaultValue)) {
|
|
270
|
+
$vUtils.set(colsDefaultValue, item.field, renderObj.props?.defaultValue)
|
|
292
271
|
}
|
|
293
272
|
})
|
|
294
|
-
|
|
295
|
-
if (Array.isArray(
|
|
296
|
-
|
|
273
|
+
this.tableRowDefaultData = colsDefaultValue
|
|
274
|
+
if (Array.isArray(dataSourse) && Object.keys(colsDefaultValue).length > 0) {
|
|
275
|
+
dataSourse.forEach(row => {
|
|
297
276
|
Object.keys(colsDefaultValue).forEach(field => {
|
|
298
|
-
if (
|
|
299
|
-
|
|
277
|
+
if ($vUtils.isNone($vUtils.get(row, field))) {
|
|
278
|
+
$vUtils.set(row, field, $vUtils.get(colsDefaultValue, field))
|
|
300
279
|
}
|
|
301
280
|
})
|
|
302
281
|
})
|
|
303
282
|
}
|
|
304
283
|
},
|
|
305
|
-
// 反转表格-反转表头及数据
|
|
306
|
-
getReverseColumn(oriColumns) {
|
|
307
|
-
const that = this
|
|
308
|
-
let columns = []
|
|
309
|
-
let columnsNum = that.reverseConfig.num
|
|
310
|
-
let keyPrefix = that.reverseConfig.keyPrefix || 'reversePre'
|
|
311
|
-
let titPrefix = that.reverseConfig.titPrefix || ''
|
|
312
|
-
let valueRenderObj = that.disabled ? { cellRender: { name: '$vRowCell' } } : { editRender: { name: '$vRowCell' } }
|
|
313
|
-
if (columnsNum) {
|
|
314
|
-
for (let i = 1; i <= columnsNum; i++) {
|
|
315
|
-
columns.push(
|
|
316
|
-
Object.assign({ field: `${keyPrefix}title${i}`, title: `名称${i}` }, that.columnObjDefault),
|
|
317
|
-
Object.assign({ field: `${keyPrefix}value${i}`, title: `数值${i}` }, that.columnObjDefault, valueRenderObj)
|
|
318
|
-
)
|
|
319
|
-
}
|
|
320
|
-
} else {
|
|
321
|
-
columns.push(Object.assign({ field: `${keyPrefix}title`, title: '名称', fixed: 'left' }, that.columnObjDefault))
|
|
322
|
-
that.dataSourse.forEach((item, index) => {
|
|
323
|
-
columns.push(Object.assign({ field: `${keyPrefix}value${index + 1}`, title: `${titPrefix}${index + 1}` }, that.columnObjDefault, valueRenderObj))
|
|
324
|
-
})
|
|
325
|
-
}
|
|
326
|
-
return columns
|
|
327
|
-
},
|
|
328
|
-
// 反转表格-反转配置生成数据
|
|
329
|
-
getReverseData(oriData = []) {
|
|
330
|
-
const that = this
|
|
331
|
-
let data = []
|
|
332
|
-
let columnsNum = that.reverseConfig.num
|
|
333
|
-
let keyPrefix = that.reverseConfig.keyPrefix || 'reversePre'
|
|
334
|
-
if (columnsNum) {
|
|
335
|
-
// 将表头平均分组
|
|
336
|
-
let chunkColumns = that.$vUtils.chunk(that.columns, columnsNum)
|
|
337
|
-
chunkColumns.forEach((colGroup, colGroupIndex) => {
|
|
338
|
-
let item = {}
|
|
339
|
-
colGroup.forEach((column, columnIndex) => {
|
|
340
|
-
item[`${keyPrefix}title${columnIndex + 1}`] = column.title
|
|
341
|
-
item[`${keyPrefix}value${columnIndex + 1}`] = oriData[colGroupIndex][column.field] || ''
|
|
342
|
-
item[`${keyPrefix}value${columnIndex + 1}field`] = column.field || ''
|
|
343
|
-
column.field ? (item[`${column.field}RenderName`] = column.renderName || '') : ''
|
|
344
|
-
})
|
|
345
|
-
data.push(item)
|
|
346
|
-
})
|
|
347
|
-
} else {
|
|
348
|
-
data = that.columns.map(column => {
|
|
349
|
-
const item = { [`${keyPrefix}title`]: column.title }
|
|
350
|
-
oriData.forEach((row, index) => {
|
|
351
|
-
item[`${keyPrefix}value${index + 1}`] = row[column.field] || ''
|
|
352
|
-
item[`${keyPrefix}value${index + 1}field`] = column.field || ''
|
|
353
|
-
column.field ? (item[`${column.field}RenderName`] = column.renderName || '') : ''
|
|
354
|
-
})
|
|
355
|
-
return item
|
|
356
|
-
})
|
|
357
|
-
}
|
|
358
|
-
return data
|
|
359
|
-
},
|
|
360
284
|
// 转换生成新表头数据
|
|
361
285
|
getTransfarColumn(oriArr = []) {
|
|
362
|
-
|
|
286
|
+
const { columnObjDefault, columnObj, tableGlobalConfig, isTrue, getDefaultMessage, turnColumnItemFilters, $vUtils } = this
|
|
363
287
|
let columnsFlatArr = []
|
|
364
288
|
let formItemsArr = []
|
|
365
289
|
let rules = {}
|
|
366
|
-
let columnsArr =
|
|
367
|
-
let tar = Object.assign({},
|
|
290
|
+
let columnsArr = $vUtils.mapTree(oriArr, ori => {
|
|
291
|
+
let tar = Object.assign({}, columnObjDefault, columnObj, ori)
|
|
368
292
|
if (ori.children && ori.children.length > 0) {
|
|
369
293
|
tar.sortable = false
|
|
370
294
|
tar.filter = false
|
|
@@ -374,17 +298,17 @@ const shMethods = {
|
|
|
374
298
|
props: Object.assign({}, ori.renderProps || {})
|
|
375
299
|
}
|
|
376
300
|
// 首先提取校验配置
|
|
377
|
-
if (
|
|
301
|
+
if (isTrue(tar['renderRequire'])) {
|
|
378
302
|
// 若配置了校验参数则走校验参数,没配置则给默认校验条件
|
|
379
303
|
if (tar['requireProps'] && Array.isArray(tar['requireProps']) && tar['requireProps'].length > 0) {
|
|
380
304
|
rules[tar['field']] = tar['requireProps']
|
|
381
305
|
} else {
|
|
382
306
|
let dataType = 'string'
|
|
383
307
|
let arrayType = ['$vCheckgroup', '$vUpload', '$vTable']
|
|
384
|
-
if (arrayType.includes(ori['renderName']) || ((ori['renderName'] === '$vSelect' || ori['renderName'] === '$vTree') &&
|
|
308
|
+
if (arrayType.includes(ori['renderName']) || ((ori['renderName'] === '$vSelect' || ori['renderName'] === '$vTree') && isTrue(renderConfig.props.multiple))) {
|
|
385
309
|
dataType = 'array'
|
|
386
310
|
}
|
|
387
|
-
rules[tar['field']] = [{ required: true, message:
|
|
311
|
+
rules[tar['field']] = [{ required: true, message: getDefaultMessage(tar['renderName'], tar['title']), type: dataType }]
|
|
388
312
|
}
|
|
389
313
|
}
|
|
390
314
|
// 个性化设置
|
|
@@ -413,7 +337,7 @@ const shMethods = {
|
|
|
413
337
|
tar.editRender = Object.assign({}, renderConfig, tar.editRender || {})
|
|
414
338
|
}
|
|
415
339
|
// 初始化表单查询配置
|
|
416
|
-
if (
|
|
340
|
+
if (tableGlobalConfig.search) {
|
|
417
341
|
let editFixedNames = ['$vImg', '$vHref', '$vUpload']
|
|
418
342
|
let formItem = Object.assign({}, tar)
|
|
419
343
|
formItem.itemRender = Object.assign({}, renderConfig, tar.editRender || {}, tar.itemRender || {})
|
|
@@ -427,7 +351,7 @@ const shMethods = {
|
|
|
427
351
|
}
|
|
428
352
|
// 初始化过滤条件
|
|
429
353
|
if (tar.filter === true || Number(tar.filter) === 1) {
|
|
430
|
-
|
|
354
|
+
turnColumnItemFilters(tar, renderConfig.props)
|
|
431
355
|
}
|
|
432
356
|
}
|
|
433
357
|
columnsFlatArr.push(tar)
|
|
@@ -519,6 +443,26 @@ const shMethods = {
|
|
|
519
443
|
refreshRender() {
|
|
520
444
|
this.renderKey++
|
|
521
445
|
},
|
|
446
|
+
// 表格工具按钮点击
|
|
447
|
+
handleTableTool({ code }) {
|
|
448
|
+
switch (code) {
|
|
449
|
+
case 'addRow':
|
|
450
|
+
this.handleTableAddRow(null, undefined, true)
|
|
451
|
+
break
|
|
452
|
+
case 'deleteRow':
|
|
453
|
+
this.handleTableDeleteRow(null, true)
|
|
454
|
+
break
|
|
455
|
+
case 'import':
|
|
456
|
+
this.handleTableImportBtn()
|
|
457
|
+
break
|
|
458
|
+
case 'export':
|
|
459
|
+
this.handleTableExportBtn()
|
|
460
|
+
break
|
|
461
|
+
case 'print':
|
|
462
|
+
this.handleTablePrintBtn()
|
|
463
|
+
break
|
|
464
|
+
}
|
|
465
|
+
},
|
|
522
466
|
// 表格导出按钮
|
|
523
467
|
handleTableExportBtn(options) {
|
|
524
468
|
if (typeof this.onExportMethod === 'function') {
|
|
@@ -547,28 +491,21 @@ const shMethods = {
|
|
|
547
491
|
}
|
|
548
492
|
},
|
|
549
493
|
// 自定义操作列点击事件
|
|
550
|
-
handleGoptionClick(btnObj, dataObj) {
|
|
551
|
-
const that = this
|
|
494
|
+
async handleGoptionClick(btnObj, dataObj) {
|
|
552
495
|
if (btnObj.code === 'delete' || btnObj.idConfirm) {
|
|
553
|
-
|
|
554
|
-
content: btnObj.ConfirmContent || `确定${btnObj.content}吗?`
|
|
555
|
-
}).then(() => {
|
|
556
|
-
that.$emit('globaloption', btnObj, dataObj)
|
|
557
|
-
})
|
|
558
|
-
} else {
|
|
559
|
-
that.$emit('globaloption', btnObj, dataObj)
|
|
496
|
+
await this.msgconfirm({ content: btnObj.ConfirmContent || `确定${btnObj.content}吗?` })
|
|
560
497
|
}
|
|
498
|
+
this.$emit('globaloption', btnObj, dataObj)
|
|
561
499
|
},
|
|
562
500
|
// 新增行按钮
|
|
563
501
|
async handleTableAddRow(rows, index = -1, isTool = false) {
|
|
564
|
-
const
|
|
565
|
-
let
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
addRows = await that.onToolbarBtnAddBefore(addRows)
|
|
502
|
+
const { tableRowDefaultData, onToolbarBtnAddBefore, rowConfig, $vUtils, tableRef } = this
|
|
503
|
+
let addRows = rows ? $vUtils.clone(rows, true) : tableRowDefaultData
|
|
504
|
+
if (!isTool && typeof onToolbarBtnAddBefore === 'function') {
|
|
505
|
+
addRows = await onToolbarBtnAddBefore(addRows)
|
|
569
506
|
}
|
|
570
507
|
// 删除主键,以防排序冲突
|
|
571
|
-
let mainKeyField =
|
|
508
|
+
let mainKeyField = rowConfig?.keyField || '_XID'
|
|
572
509
|
if (Array.isArray(addRows)) {
|
|
573
510
|
addRows.forEach(item => {
|
|
574
511
|
delete item[mainKeyField]
|
|
@@ -576,30 +513,31 @@ const shMethods = {
|
|
|
576
513
|
} else {
|
|
577
514
|
delete addRows[mainKeyField]
|
|
578
515
|
}
|
|
579
|
-
let { row: newRow } = await
|
|
580
|
-
await
|
|
581
|
-
if (!isTool)
|
|
516
|
+
let { row: newRow } = await tableRef().insertAt(addRows, index)
|
|
517
|
+
await tableRef().setActiveRow(newRow)
|
|
518
|
+
if (!isTool) this.$emit('toolbaroption', 'add', newRow, tableRef())
|
|
582
519
|
},
|
|
583
520
|
// 删除行按钮
|
|
584
521
|
async handleTableDeleteRow(rows, isTool = false) {
|
|
585
|
-
const that = this
|
|
586
522
|
let deleteRows = rows
|
|
587
523
|
if (isTool) {
|
|
588
|
-
let selectedRows =
|
|
589
|
-
if (selectedRows.length < 1)
|
|
524
|
+
let selectedRows = this.getSelectionData()
|
|
525
|
+
if (selectedRows.length < 1) {
|
|
526
|
+
this.msgwarning('请选择要删除的行!')
|
|
527
|
+
return
|
|
528
|
+
}
|
|
590
529
|
deleteRows = selectedRows
|
|
591
|
-
await
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
let result = await that.onToolbarBtnDeleteBefore(deleteRows)
|
|
530
|
+
await this.msgconfirm({ content: `确定删除吗?` })
|
|
531
|
+
} else if (typeof this.onToolbarBtnDeleteBefore === 'function') {
|
|
532
|
+
let result = await this.onToolbarBtnDeleteBefore(deleteRows)
|
|
595
533
|
if (!result) return
|
|
596
534
|
}
|
|
597
|
-
await
|
|
598
|
-
if (
|
|
599
|
-
let keyField =
|
|
600
|
-
|
|
535
|
+
await this.tableRef().remove(deleteRows)
|
|
536
|
+
if (this.selectionRows && this.selectionRows.length > 0) {
|
|
537
|
+
let keyField = this.rowConfig.keyField || this.$vTableSetup.table.rowConfig.keyField
|
|
538
|
+
this.selectionRows = this.selectionRows.filter(sr => !deleteRows.find(dr => dr[keyField] === sr[keyField]))
|
|
601
539
|
}
|
|
602
|
-
if (!isTool)
|
|
540
|
+
if (!isTool) this.$emit('toolbaroption', 'delete', deleteRows, this.tableRef())
|
|
603
541
|
}
|
|
604
542
|
}
|
|
605
543
|
|