imatrix-ui 2.8.21-dw → 2.8.21
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/lib/super-ui.css +1 -1
- package/lib/super-ui.umd.min.js +5 -35
- package/package.json +4 -2
- package/packages/breadcrumb/index.js +6 -0
- package/packages/breadcrumb/src/breadcrumb.vue +71 -0
- package/packages/department-tree/index.js +6 -0
- package/packages/department-tree/src/department-tree.vue +108 -0
- package/packages/department-tree-inline/index.js +6 -0
- package/packages/department-tree-inline/src/department-multi-tree-inline.vue +402 -0
- package/packages/department-tree-inline/src/department-single-tree-inline.vue +284 -0
- package/packages/department-tree-inline/src/department-tree-inline.vue +86 -0
- package/packages/department-tree-inline/src/department-tree-service.js +245 -0
- package/packages/department-tree-inline/src/search-result.vue +176 -0
- package/packages/department-user-tree/index.js +6 -0
- package/packages/department-user-tree/src/department-user-multiple-tree.vue +116 -0
- package/packages/department-user-tree/src/department-user-single-tree.vue +76 -0
- package/packages/department-user-tree/src/department-user-tree.vue +101 -0
- package/packages/department-user-tree-inline/index.js +6 -0
- package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +626 -0
- package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +269 -0
- package/packages/department-user-tree-inline/src/department-user-tree-inline.vue +79 -0
- package/packages/department-user-tree-inline/src/department-user-tree-multi-service.js +230 -0
- package/packages/department-user-tree-inline/src/department-user-tree-single-service.js +122 -0
- package/packages/department-user-tree-inline/src/search-result.vue +197 -0
- package/packages/directives/prevent-reclick.js +19 -0
- package/packages/dynamic-source-select/index.js +6 -0
- package/packages/dynamic-source-select/src/dynamic-source-select-service.js +70 -0
- package/packages/dynamic-source-select/src/dynamic-source-select.vue +440 -0
- package/packages/dynamic-source-select/src/events.js +55 -0
- package/packages/fs-preview/index.js +6 -0
- package/packages/fs-preview/src/fs-preview.vue +226 -0
- package/packages/fs-upload/index.js +6 -0
- package/packages/fs-upload/src/fs-upload-multi.vue +420 -0
- package/packages/fs-upload/src/fs-upload-single.vue +312 -0
- package/packages/fs-upload/src/fs-upload.vue +189 -0
- package/packages/fs-upload/src/see-big-picture.vue +55 -0
- package/packages/fs-upload-list/index.js +6 -0
- package/packages/fs-upload-list/src/fs-upload-list.vue +287 -0
- package/packages/hamburger/index.js +6 -0
- package/packages/hamburger/src/hamburger.vue +38 -0
- package/packages/index.js +121 -0
- package/packages/multipart-upload/index.js +6 -0
- package/packages/multipart-upload/src/index.vue +73 -0
- package/packages/multipart-upload/src/multipart-upload-form.vue +297 -0
- package/packages/multipart-upload/src/multipart-upload-list.vue +378 -0
- package/packages/organization-input/index.js +6 -0
- package/packages/organization-input/src/organization-input.vue +542 -0
- package/packages/plugins/export-data-new.js +453 -0
- package/packages/plugins/export-data.js +361 -0
- package/packages/plugins/index.js +15 -0
- package/packages/plugins/public-method.js +43 -0
- package/packages/remove-department/index.js +6 -0
- package/packages/remove-department/src/remove-department.vue +172 -0
- package/packages/remove-department/src/remove-dept-service.js +20 -0
- package/packages/remove-user/index.js +6 -0
- package/packages/remove-user/src/remove-user-service.js +20 -0
- package/packages/remove-user/src/remove-user.vue +195 -0
- package/packages/remove-workgroup/index.js +6 -0
- package/packages/remove-workgroup/src/remove-workgroup-service.js +20 -0
- package/packages/remove-workgroup/src/remove-workgroup.vue +159 -0
- package/packages/rich-editor/index.js +7 -0
- package/packages/rich-editor/index.vue +278 -0
- package/packages/rich-editor/langs/zh-Hans.js +1 -0
- package/packages/rich-editor/viewer.vue +103 -0
- package/packages/scan-code-input/index.js +6 -0
- package/packages/scan-code-input/src/events.js +33 -0
- package/packages/scan-code-input/src/scan-code-input-colse.vue +131 -0
- package/packages/scan-code-input/src/scan-code-input.vue +116 -0
- package/packages/secret-info/index.js +7 -0
- package/packages/secret-info/index.vue +90 -0
- package/packages/super-grid/index.js +7 -0
- package/packages/super-grid/src/apis.js +763 -0
- package/packages/super-grid/src/columns-config.vue +335 -0
- package/packages/super-grid/src/custom-formatter.js +250 -0
- package/packages/super-grid/src/dynamic-input.vue +1279 -0
- package/packages/super-grid/src/eventBus.js +2 -0
- package/packages/super-grid/src/events.js +55 -0
- package/packages/super-grid/src/formValidatorUtil.js +226 -0
- package/packages/super-grid/src/formatter.js +181 -0
- package/packages/super-grid/src/group-column.vue +100 -0
- package/packages/super-grid/src/header-context-menu.vue +87 -0
- package/packages/super-grid/src/index-column.vue +51 -0
- package/packages/super-grid/src/normal-column.vue +769 -0
- package/packages/super-grid/src/public-methods.js +31 -0
- package/packages/super-grid/src/row-operation.vue +161 -0
- package/packages/super-grid/src/search-button.vue +66 -0
- package/packages/super-grid/src/search-condition-input.vue +61 -0
- package/packages/super-grid/src/search-condition-list.vue +59 -0
- package/packages/super-grid/src/search-form-advancedQuery.vue +653 -0
- package/packages/super-grid/src/search-form-dialog.vue +79 -0
- package/packages/super-grid/src/search-form-item.vue +386 -0
- package/packages/super-grid/src/search-form-number.vue +38 -0
- package/packages/super-grid/src/search-form-open.vue +162 -0
- package/packages/super-grid/src/search-form-ordinarySearch.vue +188 -0
- package/packages/super-grid/src/search-form.vue +634 -0
- package/packages/super-grid/src/search-methods.js +387 -0
- package/packages/super-grid/src/selection-column.vue +43 -0
- package/packages/super-grid/src/store.js +3 -0
- package/packages/super-grid/src/super-grid-service.js +561 -0
- package/packages/super-grid/src/super-grid.vue +2793 -0
- package/packages/super-grid/src/utils.js +763 -0
- package/packages/super-grid/src/view-image-dialog.vue +130 -0
- package/packages/super-nine-grid/index.js +7 -0
- package/packages/super-nine-grid/src/apis.js +103 -0
- package/packages/super-nine-grid/src/custom-formatter.js +66 -0
- package/packages/super-nine-grid/src/formatter.js +132 -0
- package/packages/super-nine-grid/src/search-form-number.vue +38 -0
- package/packages/super-nine-grid/src/search-form.vue +430 -0
- package/packages/super-nine-grid/src/search-methods.js +134 -0
- package/packages/super-nine-grid/src/store.js +3 -0
- package/packages/super-nine-grid/src/super-grid-service.js +91 -0
- package/packages/super-nine-grid/src/super-nine-grid.vue +872 -0
- package/packages/super-nine-grid/src/utils.js +261 -0
- package/packages/svg-icon/index.js +6 -0
- package/packages/svg-icon/src/svg-icon.vue +43 -0
- package/packages/utils/utils.js +152 -0
- package/packages/utils/value-set.js +86 -0
- package/packages/valid-code/index.js +7 -0
- package/packages/valid-code/src/valid-code.vue +95 -0
- package/packages/workflow-button/index.js +6 -0
- package/packages/workflow-button/src/workflow-button.vue +325 -0
- package/packages/workflow-history-list/index.js +6 -0
- package/packages/workflow-history-list/src/api.js +7 -0
- package/packages/workflow-history-list/src/workflow-history-list.vue +185 -0
- package/packages/workgroup-tree/index.js +6 -0
- package/packages/workgroup-tree/src/workgroup-tree.vue +76 -0
- package/packages/workgroup-tree-inline/index.js +6 -0
- package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +317 -0
- package/packages/workgroup-tree-inline/src/workgroup-tree-service.js +43 -0
- package/packages/workgroup-user-tree/index.js +6 -0
- package/packages/workgroup-user-tree/src/workgroup-user-tree.vue +100 -0
- package/packages/workgroup-user-tree-inline/index.js +6 -0
- package/packages/workgroup-user-tree-inline/src/workgroup-tree-inline-service.js +163 -0
- package/packages/workgroup-user-tree-inline/src/workgroup-user-tree-inline.vue +436 -0
- package/packages/year-range-picker/index.js +6 -0
- package/packages/year-range-picker/src/year-range-picker.vue +51 -0
- package/src/i18n/i18n.js +1 -1
- package/src/i18n/langs/cn.js +4 -2
- package/src/i18n/langs/en.js +4 -2
- package/src/index.js +93 -0
- package/src/permission.js +7 -3
- package/src/plugins.js +3 -3
- package/src/router/index.js +24 -0
- package/src/store/getters.js +2 -1
- package/src/store/modules/app.js +10 -1
- package/src/styles/display-layout.scss +34 -0
- package/src/styles/index.scss +32 -4
- package/src/styles/theme/dark-blue/button.scss +9 -0
- package/src/styles/theme/dark-blue/card.scss +64 -0
- package/src/styles/theme/dark-blue/checkbox.scss +10 -0
- package/src/styles/theme/dark-blue/dark-blue-var.scss +8 -0
- package/src/styles/theme/dark-blue/dialog.scss +21 -0
- package/src/styles/theme/dark-blue/element-variables.scss +7 -0
- package/src/styles/theme/dark-blue/font.scss +71 -0
- package/src/styles/theme/dark-blue/form.scss +51 -0
- package/src/styles/theme/dark-blue/index.scss +247 -0
- package/src/styles/theme/dark-blue/input.scss +15 -0
- package/src/styles/theme/dark-blue/pagination.scss +14 -0
- package/src/styles/theme/dark-blue/scrollbar-style.scss +32 -0
- package/src/styles/theme/dark-blue/sidebar.scss +296 -0
- package/src/styles/theme/dark-blue/tab.scss +83 -0
- package/src/styles/theme/dark-blue/table.scss +60 -0
- package/src/styles/theme/dark-blue/tree.scss +31 -0
- package/src/styles/theme/dark-blue/var.scss +1028 -0
- package/src/styles/theme/gray/form-style.scss +2 -2
- package/src/styles/theme/gray/input-style.scss +8 -0
- package/src/utils/auth-api.js +115 -0
- package/src/utils/auth.js +34 -42
- package/src/utils/calculator/calculator-factory.js +2 -2
- package/src/utils/common-util.js +34 -0
- package/src/utils/jump-page-utils.js +29 -5
- package/src/utils/menu.js +19 -0
- package/src/utils/permission.js +4 -0
- package/src/utils/request.js +18 -2
- package/src/utils/util.js +7 -3
- package/src/views/dsc-component/Sidebar/Item.vue +4 -4
- package/src/views/dsc-component/Sidebar/Link.vue +11 -2
- package/src/views/dsc-component/Sidebar/SidebarItem.vue +36 -20
- package/src/views/dsc-component/Sidebar/index.vue +24 -12
- package/src/views/dsc-component/tabs/tab-content.vue +16 -1
- package/src/views/login/index.vue +1 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const events = {
|
|
2
|
+
select: function(selection, row) {
|
|
3
|
+
this.$emit('select', selection, row)
|
|
4
|
+
},
|
|
5
|
+
selectAll: function(selection) {
|
|
6
|
+
this.$emit('select-all', selection)
|
|
7
|
+
},
|
|
8
|
+
selectionChange: function(selection) {
|
|
9
|
+
this.$emit('selection-change', selection)
|
|
10
|
+
},
|
|
11
|
+
cellMouseEnter: function(row, column, cell, event) {
|
|
12
|
+
this.$emit('cell-mouse-enter', row, column, cell, event)
|
|
13
|
+
},
|
|
14
|
+
cellMouseLeave: function(row, column, cell, event) {
|
|
15
|
+
this.$emit('cell-mouse-leave', row, column, cell, event)
|
|
16
|
+
},
|
|
17
|
+
cellClick: function(row, column, cell, event) {
|
|
18
|
+
this.$emit('cell-click', row, column, cell, event)
|
|
19
|
+
},
|
|
20
|
+
cellDblClick: function(row, column, cell, event) {
|
|
21
|
+
this.$emit('cell-dblclick', row, column, cell, event)
|
|
22
|
+
},
|
|
23
|
+
rowClick: function(row, column, event) {
|
|
24
|
+
this.$emit('row-click', row, column, event)
|
|
25
|
+
},
|
|
26
|
+
rowContextMenu: function(row, column, event) {
|
|
27
|
+
this.$emit('row-contextmenu', row, column, event)
|
|
28
|
+
},
|
|
29
|
+
rowDblClick: function(row, column, event) {
|
|
30
|
+
this.$emit('row-dblclick', row, column, event)
|
|
31
|
+
},
|
|
32
|
+
headerClick: function(column, event) {
|
|
33
|
+
this.$emit('header-click', column, event)
|
|
34
|
+
},
|
|
35
|
+
headerContextMenu: function(column, event) {
|
|
36
|
+
this.$emit('header-contextmenu', column, event)
|
|
37
|
+
},
|
|
38
|
+
// super-grid.vue中已经做了处理
|
|
39
|
+
// sortChange: function({ column, prop, order }) {
|
|
40
|
+
// this.$emit('sort-change', { column, prop, order })
|
|
41
|
+
// },
|
|
42
|
+
filterChange: function(filters) {
|
|
43
|
+
this.$emit('filter-change', filters)
|
|
44
|
+
},
|
|
45
|
+
currentChange: function(currentRow, oldCurrentRow) {
|
|
46
|
+
this.$emit('current-change', currentRow, oldCurrentRow)
|
|
47
|
+
},
|
|
48
|
+
headerDragEnd: function(newWidth, oldWidth, column, event) {
|
|
49
|
+
this.$emit('header-dragend', newWidth, oldWidth, column, event)
|
|
50
|
+
},
|
|
51
|
+
expandChange: function(row, expandedRows) {
|
|
52
|
+
this.$emit('expand-change', row, expandedRows)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export default events
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import Validator from 'async-validator'
|
|
2
|
+
import store from './store'
|
|
3
|
+
import Vue from 'vue'
|
|
4
|
+
import {
|
|
5
|
+
isDisableEdit
|
|
6
|
+
} from './utils'
|
|
7
|
+
import {
|
|
8
|
+
getI18n
|
|
9
|
+
} from '../../../src/utils/util'
|
|
10
|
+
|
|
11
|
+
function setObjectPropRule(editField, rules, leafRule) {
|
|
12
|
+
const rule = {}
|
|
13
|
+
const prop = editField.prop
|
|
14
|
+
if (!rules) {
|
|
15
|
+
rules = {}
|
|
16
|
+
}
|
|
17
|
+
let num = 0
|
|
18
|
+
const props = prop.split('.')
|
|
19
|
+
props.forEach(subProp => {
|
|
20
|
+
let objectRule
|
|
21
|
+
if (num === props.length - 1) {
|
|
22
|
+
// 说明是最后一个
|
|
23
|
+
objectRule = getEndObjectRule(rule, props, subProp)
|
|
24
|
+
objectRule.fields[subProp] = leafRule
|
|
25
|
+
} else {
|
|
26
|
+
let lastObjectRule
|
|
27
|
+
if (num === 0) {
|
|
28
|
+
objectRule = rules
|
|
29
|
+
} else {
|
|
30
|
+
lastObjectRule = getLastObjectRule(rule, props, props[num - 1])
|
|
31
|
+
objectRule = lastObjectRule.fields
|
|
32
|
+
}
|
|
33
|
+
if (!objectRule[subProp]) {
|
|
34
|
+
objectRule[subProp] = {
|
|
35
|
+
type: 'object',
|
|
36
|
+
required: true,
|
|
37
|
+
fields: {}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (num === 0) {
|
|
41
|
+
rule[subProp] = objectRule[subProp]
|
|
42
|
+
} else {
|
|
43
|
+
lastObjectRule.fields[subProp] = objectRule[subProp]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
num++
|
|
47
|
+
})
|
|
48
|
+
return rule
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function getLastObjectRule(rule, props, currentProp) {
|
|
52
|
+
let lastObjectdRule
|
|
53
|
+
for (let i = 0; i < props.length; i++) {
|
|
54
|
+
const subProp = props[i]
|
|
55
|
+
if (i === 0) {
|
|
56
|
+
lastObjectdRule = rule[subProp]
|
|
57
|
+
} else {
|
|
58
|
+
lastObjectdRule = lastObjectdRule.fields[props[i]]
|
|
59
|
+
}
|
|
60
|
+
if (subProp === currentProp) {
|
|
61
|
+
break
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return lastObjectdRule
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function getEndObjectRule(rule, props, currentProp) {
|
|
68
|
+
let lastObjectdRule
|
|
69
|
+
for (let i = 0; i < props.length; i++) {
|
|
70
|
+
if (i === 0) {
|
|
71
|
+
lastObjectdRule = rule[props[i]]
|
|
72
|
+
} else {
|
|
73
|
+
lastObjectdRule = lastObjectdRule.fields[props[i]]
|
|
74
|
+
}
|
|
75
|
+
if (i !== props.length - 1) {
|
|
76
|
+
const leafSubProp = props[i + 1]
|
|
77
|
+
if (leafSubProp === currentProp) {
|
|
78
|
+
break
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return lastObjectdRule
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @param {editFieldInfos} Array 编辑字段信息集合
|
|
87
|
+
*/
|
|
88
|
+
function getValidator(listCode) {
|
|
89
|
+
if (!listCode) {
|
|
90
|
+
listCode = store.get('_list_code')
|
|
91
|
+
}
|
|
92
|
+
const gridParams = store.get(listCode)
|
|
93
|
+
const editFieldInfos = gridParams.columns
|
|
94
|
+
const rules = {}
|
|
95
|
+
if (editFieldInfos) {
|
|
96
|
+
editFieldInfos.forEach(editField => {
|
|
97
|
+
const prop = editField.prop
|
|
98
|
+
if (prop && editField.validations && !isDisableEdit(prop, listCode)) {
|
|
99
|
+
const validations = JSON.parse(editField.validations)
|
|
100
|
+
validations.forEach(item => {
|
|
101
|
+
if (item.pattern) {
|
|
102
|
+
// 后台传递的是正则字符串,不能直接使用
|
|
103
|
+
item.pattern = new RegExp(item.pattern)
|
|
104
|
+
}
|
|
105
|
+
})
|
|
106
|
+
if (prop.indexOf('.') > 0) {
|
|
107
|
+
setObjectPropRule(editField, rules, validations)
|
|
108
|
+
} else {
|
|
109
|
+
if (validations && validations.length > 0) {
|
|
110
|
+
rules[prop] = [...validations]
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
// console.log('rules', rules)
|
|
117
|
+
return rules
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* 验证实体
|
|
121
|
+
* @param {*} entity 实体记录
|
|
122
|
+
* @param {*} listCode 列表编码
|
|
123
|
+
* @param {*} $index 当前行下标
|
|
124
|
+
* @param {*} rules 验证规则
|
|
125
|
+
* @param {*} isSubTableShowPage 表单子表是否显示分页区域
|
|
126
|
+
* @param {*} pageNum 当前记录在子表中的第几页
|
|
127
|
+
* @returns void
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
function validator(entity, listCode, $index, rules, isSubTableShowPage, pageNum, pageRowIndex) {
|
|
131
|
+
return validatorEntity(entity, listCode, $index, rules, true, isSubTableShowPage, pageNum, pageRowIndex)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function validatorEntity(entity, listCode, $index, rules, isShouldRepeateValdate, isSubTableShowPage, pageNum, pageRowIndex) {
|
|
135
|
+
let result = false
|
|
136
|
+
let validateRules
|
|
137
|
+
if (rules) {
|
|
138
|
+
validateRules = rules
|
|
139
|
+
} else {
|
|
140
|
+
validateRules = getValidator(listCode)
|
|
141
|
+
}
|
|
142
|
+
const validator = new Validator(validateRules)
|
|
143
|
+
if (!listCode) {
|
|
144
|
+
listCode = store.get('_list_code')
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const gridParams = store.get(listCode)
|
|
148
|
+
validator.validate(entity, {
|
|
149
|
+
first: true
|
|
150
|
+
},
|
|
151
|
+
(errors, fields) => {
|
|
152
|
+
let fieldName
|
|
153
|
+
if (errors) {
|
|
154
|
+
const message = errors[0]['message']
|
|
155
|
+
fieldName = errors[0]['field']
|
|
156
|
+
if ($index !== null && $index !== undefined && gridParams.gridData.length > $index) {
|
|
157
|
+
Vue.set(gridParams.gridData[$index], 'validateErrorField', errors[0]['field'])
|
|
158
|
+
if (isSubTableShowPage !== undefined && isSubTableShowPage && pageNum !== undefined && pageRowIndex !== undefined) {
|
|
159
|
+
// 表示表单子表验证时
|
|
160
|
+
result = getI18n().t('superGrid.pageRecordLine', {
|
|
161
|
+
pageNum: pageNum,
|
|
162
|
+
row: pageRowIndex
|
|
163
|
+
}) + ',' + message
|
|
164
|
+
} else {
|
|
165
|
+
// 表示列表记录验证时
|
|
166
|
+
result = getI18n().t('superGrid.recordLine', {
|
|
167
|
+
row: ($index + 1)
|
|
168
|
+
}) + ',' + message
|
|
169
|
+
}
|
|
170
|
+
} else if (gridParams.$rowIndex !== null && gridParams.$rowIndex !== undefined && gridParams.gridData.length > gridParams.$rowIndex) {
|
|
171
|
+
Vue.set(gridParams.gridData[gridParams.$rowIndex], 'validateErrorField', errors[0]['field'])
|
|
172
|
+
result = getI18n().t('superGrid.recordLine', {
|
|
173
|
+
row: (gridParams.$rowIndex + 1)
|
|
174
|
+
}) + ',' + message
|
|
175
|
+
}
|
|
176
|
+
} else {
|
|
177
|
+
// 验证成功后,将最后验证失败的字段置空
|
|
178
|
+
if ($index !== null && $index !== undefined && gridParams.gridData.length > $index) {
|
|
179
|
+
if (isSubTableShowPage !== undefined && isSubTableShowPage) {
|
|
180
|
+
Vue.set(gridParams.subTableData[$index], 'validateErrorField', '')
|
|
181
|
+
} else {
|
|
182
|
+
Vue.set(gridParams.gridData[$index], 'validateErrorField', '')
|
|
183
|
+
}
|
|
184
|
+
} else if (gridParams.$rowIndex !== null && gridParams.$rowIndex !== undefined && gridParams.gridData.length > gridParams.$rowIndex) {
|
|
185
|
+
Vue.set(gridParams.gridData[gridParams.$rowIndex], 'validateErrorField', '')
|
|
186
|
+
} else if ($index !== null && $index !== undefined && isSubTableShowPage !== undefined && isSubTableShowPage && gridParams.gridData.length <= $index) {
|
|
187
|
+
// 表示可能是子表分页时,清空子表的
|
|
188
|
+
Vue.set(gridParams.subTableData[$index], 'validateErrorField', '')
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
result = true
|
|
192
|
+
}
|
|
193
|
+
if (fieldName && isShouldRepeateValdate === true) {
|
|
194
|
+
// 将实体中字段名改为大写,然后再验证一次该字段是否已填值。因为mysql中jdbc获得实体记录字段名是小写的,但是验证规则中字段名是大写的,所以会导致字段验证失败
|
|
195
|
+
const reg1 = /[A-Z]+/ // 大写字母
|
|
196
|
+
if ((result !== undefined && result + '' !== 'true' && result + '' !== 'false') && (gridParams.isSql !== undefined && gridParams.isSql === true && reg1.test(fieldName) && entity[fieldName.toLowerCase()] !== undefined)) {
|
|
197
|
+
// 表示验证失败,需要重新验证一次
|
|
198
|
+
const copyEntity = JSON.parse(JSON.stringify(entity))
|
|
199
|
+
copyEntity[fieldName.toUpperCase()] = entity[fieldName.toLowerCase()]
|
|
200
|
+
delete copyEntity[fieldName.toLowerCase()]
|
|
201
|
+
result = validatorEntity(copyEntity, listCode, $index, rules, false)
|
|
202
|
+
}
|
|
203
|
+
if (result !== undefined && result + '' !== 'true' && result + '' !== 'false') {
|
|
204
|
+
// 表示验证失败
|
|
205
|
+
if (gridParams.showValidateError) {
|
|
206
|
+
gridParams.showValidateError = false
|
|
207
|
+
Vue.prototype.$message({
|
|
208
|
+
showClose: true,
|
|
209
|
+
message: result,
|
|
210
|
+
type: 'warning',
|
|
211
|
+
onClose: (messageEle) => {
|
|
212
|
+
gridParams.showValidateError = true
|
|
213
|
+
}
|
|
214
|
+
})
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
})
|
|
219
|
+
|
|
220
|
+
return result
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export default {
|
|
224
|
+
validator,
|
|
225
|
+
getValidator
|
|
226
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { isDynamicDataSourceSource } from './utils'
|
|
2
|
+
const formatter = {
|
|
3
|
+
number: function(inputValue, options) {
|
|
4
|
+
// 小数位数
|
|
5
|
+
const precision = options.precision
|
|
6
|
+
// 数字符号
|
|
7
|
+
const sign = options.sign
|
|
8
|
+
// 是否显示千分位
|
|
9
|
+
const isDelimiter = options.delimiter
|
|
10
|
+
// 是否显示科学计数法
|
|
11
|
+
const scientific = options.scientific
|
|
12
|
+
// 几位开始计算
|
|
13
|
+
let scientificNum = options.scientificNum
|
|
14
|
+
if (inputValue !== undefined && inputValue != null) {
|
|
15
|
+
if (precision > 0) {
|
|
16
|
+
// 表示有小数
|
|
17
|
+
inputValue = parseFloat(inputValue)
|
|
18
|
+
inputValue = inputValue.toFixed(precision)
|
|
19
|
+
}
|
|
20
|
+
if (isDelimiter) {
|
|
21
|
+
const inputValueStr = inputValue + ''
|
|
22
|
+
const value = inputValueStr.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,')
|
|
23
|
+
if (sign) {
|
|
24
|
+
return value + sign
|
|
25
|
+
} else {
|
|
26
|
+
return value
|
|
27
|
+
}
|
|
28
|
+
} else if (scientific != null) {
|
|
29
|
+
let isScientific = false
|
|
30
|
+
if (scientificNum) {
|
|
31
|
+
scientificNum = parseInt(scientificNum)
|
|
32
|
+
} else {
|
|
33
|
+
scientificNum = 11
|
|
34
|
+
}
|
|
35
|
+
if (inputValue.length >= scientificNum) {
|
|
36
|
+
isScientific = true
|
|
37
|
+
}
|
|
38
|
+
if (isScientific) {
|
|
39
|
+
inputValue = '' + inputValue
|
|
40
|
+
inputValue = parseFloat(inputValue)
|
|
41
|
+
inputValue = inputValue.toExponential() // 转换为标准的科学计数法形式(字符串)
|
|
42
|
+
// const tmpArray = eformat.match(/\d(?:\.(\d*))?e([+-]\d+)/) // 分离出小数值和指数值
|
|
43
|
+
// inputValue = inputValue.toFixed(Math.max(0, (tmpArray[1] || '').length - tmpArray[2]))
|
|
44
|
+
}
|
|
45
|
+
} else {
|
|
46
|
+
if (sign) {
|
|
47
|
+
return inputValue + sign
|
|
48
|
+
} else {
|
|
49
|
+
return inputValue
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return inputValue
|
|
55
|
+
},
|
|
56
|
+
currency: function(value, options) {
|
|
57
|
+
// 单位:$ 或 ¥
|
|
58
|
+
const sign = options.sign
|
|
59
|
+
return sign + this.number(value, options)
|
|
60
|
+
},
|
|
61
|
+
date: function(value, options) {
|
|
62
|
+
// format格式,例如:yyyy-m-d,yyyy-m-d hh:mm:ss等等
|
|
63
|
+
const format = options.format
|
|
64
|
+
if (value != null) {
|
|
65
|
+
const date = new Date(value)
|
|
66
|
+
var y = date.getFullYear()
|
|
67
|
+
var m = date.getMonth() + 1
|
|
68
|
+
var d = date.getDate()
|
|
69
|
+
var h = date.getHours()
|
|
70
|
+
var min = date.getMinutes()
|
|
71
|
+
var s = date.getSeconds()
|
|
72
|
+
if (m < 10) {
|
|
73
|
+
m = '0' + m
|
|
74
|
+
}
|
|
75
|
+
if (d < 10) {
|
|
76
|
+
d = '0' + d
|
|
77
|
+
}
|
|
78
|
+
if (h < 10) {
|
|
79
|
+
h = '0' + h
|
|
80
|
+
}
|
|
81
|
+
if (min < 10) {
|
|
82
|
+
min = '0' + min
|
|
83
|
+
}
|
|
84
|
+
if (s < 10) {
|
|
85
|
+
s = '0' + s
|
|
86
|
+
}
|
|
87
|
+
const newValue = format.replace('yyyy', y)
|
|
88
|
+
.replace('mm', min)
|
|
89
|
+
.replace('M', m)
|
|
90
|
+
.replace('m', m)
|
|
91
|
+
.replace('d', d)
|
|
92
|
+
.replace('hh', h)
|
|
93
|
+
.replace('ss', s)
|
|
94
|
+
// 判断格式化的值是否包含NaN,如果包含NaN取数据库的值
|
|
95
|
+
if (newValue.indexOf('NaN') === -1) {
|
|
96
|
+
return newValue
|
|
97
|
+
}
|
|
98
|
+
return value
|
|
99
|
+
}
|
|
100
|
+
return value
|
|
101
|
+
},
|
|
102
|
+
time: function(value, options) {
|
|
103
|
+
return this.date(value, options)
|
|
104
|
+
},
|
|
105
|
+
percent: function(value, options) {
|
|
106
|
+
if (value || value >= 0) {
|
|
107
|
+
return this.number(value, options) + '%'
|
|
108
|
+
}
|
|
109
|
+
return value
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function doFormat(column, value) {
|
|
114
|
+
value = doFormatWithValueSet(column, value)
|
|
115
|
+
if (value === undefined || value === null) {
|
|
116
|
+
return
|
|
117
|
+
}
|
|
118
|
+
// 获得默认的格式设置
|
|
119
|
+
if (column.formatter === undefined) {
|
|
120
|
+
if (column.dataType === 'DATE') {
|
|
121
|
+
// 默认的“DATE”类型的格式设置
|
|
122
|
+
column.formatter = {
|
|
123
|
+
type: 'date',
|
|
124
|
+
options: {
|
|
125
|
+
format: 'yyyy-m-d'
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
} else if (column.dataType === 'TIME') {
|
|
129
|
+
// 默认的“TIME”类型的格式设置
|
|
130
|
+
column.formatter = {
|
|
131
|
+
type: 'time',
|
|
132
|
+
options: {
|
|
133
|
+
format: 'yyyy-m-d hh:mm:ss'
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
const columnFormatter = column.formatter
|
|
139
|
+
if (columnFormatter !== undefined && formatter[columnFormatter.type] !== undefined) {
|
|
140
|
+
return formatter[columnFormatter.type](value, columnFormatter.options)
|
|
141
|
+
} else {
|
|
142
|
+
return value
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export function doFormatWithValueSet(column, value) {
|
|
147
|
+
if (value === undefined || value === null) {
|
|
148
|
+
return value
|
|
149
|
+
}
|
|
150
|
+
const valueSet = column.valueSet
|
|
151
|
+
// 先处理值设置再处理格式化设置:即会对值设置的结果进行格式化设置
|
|
152
|
+
if (valueSet !== undefined) {
|
|
153
|
+
if (column.componentType === 'multiselect' && !isDynamicDataSourceSource(column)) {
|
|
154
|
+
if (typeof (value) === 'number') {
|
|
155
|
+
// 当value是0时, value instanceof Number 为false
|
|
156
|
+
value += ''
|
|
157
|
+
}
|
|
158
|
+
const beforeLabel = (value + '').split(',')
|
|
159
|
+
const label = []
|
|
160
|
+
beforeLabel.forEach(element => {
|
|
161
|
+
const item = valueSet.filter(item => {
|
|
162
|
+
return item.value === element + ''
|
|
163
|
+
})
|
|
164
|
+
if (item.length > 0) {
|
|
165
|
+
label.push(item[0].label)
|
|
166
|
+
}
|
|
167
|
+
})
|
|
168
|
+
value = label.join(',')
|
|
169
|
+
} else {
|
|
170
|
+
const item = valueSet.filter(item => {
|
|
171
|
+
return item.value === value + ''
|
|
172
|
+
})
|
|
173
|
+
if (item.length > 0) {
|
|
174
|
+
// 数据库的原始值要显示成label值,后续对这个label进行格式化(不是处理原始值)
|
|
175
|
+
value = item[0].label
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return value
|
|
180
|
+
}
|
|
181
|
+
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
|
|
2
|
+
<template>
|
|
3
|
+
<el-table-column
|
|
4
|
+
width="150"
|
|
5
|
+
:align="column.groupHeader?'center':''"
|
|
6
|
+
>
|
|
7
|
+
<template v-slot:header>
|
|
8
|
+
<span class="cell--span" :title="label" v-html="label" />
|
|
9
|
+
</template>
|
|
10
|
+
<template v-if="customFormat">
|
|
11
|
+
<component
|
|
12
|
+
:is="child.prop?'NormalColumn':'GroupColumn'"
|
|
13
|
+
v-for="(child, index) in visibleChildren"
|
|
14
|
+
:key="child.label + index"
|
|
15
|
+
:column="child"
|
|
16
|
+
:is-sql="isSql"
|
|
17
|
+
:custom-format="child.prop ?customFormat[child.prop] : customFormat"
|
|
18
|
+
:list-code="listCode"
|
|
19
|
+
@findIndex="findIndex(scope.$index)"
|
|
20
|
+
@refresData="refresData"
|
|
21
|
+
@refresPortData="refresPortData"
|
|
22
|
+
@refresPortsData="refresPortsData"
|
|
23
|
+
@refresMainTableFields="refresMainTableFields"
|
|
24
|
+
/>
|
|
25
|
+
</template>
|
|
26
|
+
<template v-else>
|
|
27
|
+
<component
|
|
28
|
+
:is="child.prop?'NormalColumn':'GroupColumn'"
|
|
29
|
+
v-for="(child, index) in visibleChildren"
|
|
30
|
+
:key="child.label + index"
|
|
31
|
+
:is-sql="isSql"
|
|
32
|
+
:column="child"
|
|
33
|
+
:list-code="listCode"
|
|
34
|
+
/>
|
|
35
|
+
</template>
|
|
36
|
+
</el-table-column>
|
|
37
|
+
</template>
|
|
38
|
+
<script>
|
|
39
|
+
import NormalColumn from './normal-column'
|
|
40
|
+
import GroupColumn from './group-column'
|
|
41
|
+
import { doFormatWithValueSet } from './formatter'
|
|
42
|
+
export default {
|
|
43
|
+
name: 'GroupColumn',
|
|
44
|
+
components: {
|
|
45
|
+
NormalColumn,
|
|
46
|
+
GroupColumn
|
|
47
|
+
},
|
|
48
|
+
props: {
|
|
49
|
+
column: {
|
|
50
|
+
type: Object,
|
|
51
|
+
default: null
|
|
52
|
+
},
|
|
53
|
+
// 操作列、占位符列内容显示的函数,格式为:{'属性名':方法},例如:{'name':viewUser,'operation':showOperation}
|
|
54
|
+
customFormat: {
|
|
55
|
+
type: Object,
|
|
56
|
+
default: null
|
|
57
|
+
},
|
|
58
|
+
listCode: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: null
|
|
61
|
+
},
|
|
62
|
+
isSql: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: false
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
data() {
|
|
68
|
+
return {
|
|
69
|
+
label: null // 标题
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
computed: {
|
|
73
|
+
visibleChildren() {
|
|
74
|
+
if (this.column.children) {
|
|
75
|
+
return this.column.children.filter(column => {
|
|
76
|
+
return column.show === undefined || column.show
|
|
77
|
+
})
|
|
78
|
+
} else {
|
|
79
|
+
return []
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
created() {
|
|
84
|
+
this.label = this.getHeader()
|
|
85
|
+
},
|
|
86
|
+
methods: {
|
|
87
|
+
getHeader() {
|
|
88
|
+
if (!this.column.titleValueSet) {
|
|
89
|
+
return this.column.label.replace(/\\n/g, '</br>')
|
|
90
|
+
} else {
|
|
91
|
+
return this.formatHeader()
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
formatHeader() {
|
|
95
|
+
return doFormatWithValueSet(this.column.titleValueSetValue, this.column.label)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
</script>
|
|
100
|
+
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ul class="context-menu">
|
|
3
|
+
<li v-for="menu in buttomArr" :key="menu.name">
|
|
4
|
+
<i :class="menu.icon" /><span @click="buttonClick(menu.event, menu)">{{ menu.label }}</span>
|
|
5
|
+
</li>
|
|
6
|
+
</ul>
|
|
7
|
+
</template>
|
|
8
|
+
<script>
|
|
9
|
+
// import Vue from 'vue'
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
name: 'HeaderContextMenu',
|
|
13
|
+
components: {
|
|
14
|
+
},
|
|
15
|
+
filters: {
|
|
16
|
+
},
|
|
17
|
+
props: {
|
|
18
|
+
buttomArr: {
|
|
19
|
+
type: Array,
|
|
20
|
+
default: null
|
|
21
|
+
},
|
|
22
|
+
column: {
|
|
23
|
+
type: Object,
|
|
24
|
+
default: null
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
data() {
|
|
28
|
+
return {
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
computed: {
|
|
33
|
+
|
|
34
|
+
},
|
|
35
|
+
watch: {
|
|
36
|
+
|
|
37
|
+
},
|
|
38
|
+
created() {
|
|
39
|
+
console.log('12345', this.buttomArr)
|
|
40
|
+
},
|
|
41
|
+
methods: {
|
|
42
|
+
// 操作按钮的点击事件
|
|
43
|
+
buttonClick(event, data) {
|
|
44
|
+
if (event) {
|
|
45
|
+
if (typeof (event) === 'function') {
|
|
46
|
+
event.call(this, data, this.column)
|
|
47
|
+
} else {
|
|
48
|
+
this.$emit(event, data, this.column)
|
|
49
|
+
}
|
|
50
|
+
this.$emit('clearHeaderContextmenu')
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
</script>
|
|
56
|
+
<style lang="scss" scoped>
|
|
57
|
+
li {
|
|
58
|
+
color: #333;
|
|
59
|
+
}
|
|
60
|
+
.context-menu {
|
|
61
|
+
position: fixed;
|
|
62
|
+
background: #fff;
|
|
63
|
+
z-index: 999;
|
|
64
|
+
padding:5px;
|
|
65
|
+
margin:0;
|
|
66
|
+
margin-top: 30px
|
|
67
|
+
}
|
|
68
|
+
.context-menu li {
|
|
69
|
+
min-width: 75px;
|
|
70
|
+
height: 28px;
|
|
71
|
+
line-height: 28px;
|
|
72
|
+
text-align: left;
|
|
73
|
+
color: #1a1a1a;
|
|
74
|
+
}
|
|
75
|
+
.context-menu li:hover {
|
|
76
|
+
background: #42b983;
|
|
77
|
+
color: #fff;
|
|
78
|
+
}
|
|
79
|
+
.context-menu {
|
|
80
|
+
border: 1px solid #eee;
|
|
81
|
+
box-shadow: 0 0.5em 1em 0 rgba(0,0,0,.1);
|
|
82
|
+
border-radius: 5px;
|
|
83
|
+
}
|
|
84
|
+
li {
|
|
85
|
+
list-style-type:none;
|
|
86
|
+
}
|
|
87
|
+
</style>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
|
|
2
|
+
<template>
|
|
3
|
+
<el-table-column
|
|
4
|
+
align="center"
|
|
5
|
+
:fixed="fixed"
|
|
6
|
+
:width="column.width?column.width:'80'"
|
|
7
|
+
>
|
|
8
|
+
<template v-slot:header>
|
|
9
|
+
<span class="cell--span">{{ $t('superGrid.index') }}</span>
|
|
10
|
+
</template>
|
|
11
|
+
<template slot-scope="scope">
|
|
12
|
+
<span class="cell--span">
|
|
13
|
+
{{ scope.$index + 1 }}
|
|
14
|
+
</span>
|
|
15
|
+
</template>
|
|
16
|
+
</el-table-column>
|
|
17
|
+
</template>
|
|
18
|
+
<script>
|
|
19
|
+
/**
|
|
20
|
+
* 序号列
|
|
21
|
+
*/
|
|
22
|
+
export default {
|
|
23
|
+
name: 'IndexColumn',
|
|
24
|
+
components: {
|
|
25
|
+
},
|
|
26
|
+
props: {
|
|
27
|
+
column: {
|
|
28
|
+
type: Object,
|
|
29
|
+
default: null
|
|
30
|
+
},
|
|
31
|
+
isLineEdit: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: false
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
},
|
|
37
|
+
computed: {
|
|
38
|
+
fixed() {
|
|
39
|
+
if (this.column.fixed && (this.column.fixed === 'false' || this.column.fixed === '')) {
|
|
40
|
+
return false
|
|
41
|
+
}
|
|
42
|
+
// 序号只支持左固定
|
|
43
|
+
if (this.column.fixed && (this.column.fixed === 'right')) {
|
|
44
|
+
return 'left'
|
|
45
|
+
}
|
|
46
|
+
return this.column.fixed
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
</script>
|
|
51
|
+
|