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,130 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-dialog
|
|
3
|
+
:append-to-body="true"
|
|
4
|
+
:show-close="true"
|
|
5
|
+
:title="$t('imatrixUIPublicModel.preview')"
|
|
6
|
+
:visible="true"
|
|
7
|
+
@close="$emit('close')"
|
|
8
|
+
>
|
|
9
|
+
<template v-slot:title>
|
|
10
|
+
<span>{{ $t('imatrixUIPublicModel.preview') }}
|
|
11
|
+
<!-- <i v-if="downloadable" class="el-icon-download" style="padding-left:5px;cursor:pointer;color:#409EFF" @click="downloadFile()" /> -->
|
|
12
|
+
<i v-if="deleteable" class="el-icon-delete" style="padding-left:5px;cursor:pointer;color:#F56C6C" @click="deleteFile()" />
|
|
13
|
+
</span>
|
|
14
|
+
</template>
|
|
15
|
+
<el-carousel :interval="5000" arrow="always" @change="changeFile">
|
|
16
|
+
<el-carousel-item v-for="item in fileList" :key="item.serverName" style="background-color:#eee">
|
|
17
|
+
<el-image v-if="item.isImg" :src="item.src" :preview-src-list="[item.src]" />
|
|
18
|
+
<div v-else style="text-align:center;margin-top: 50px;">
|
|
19
|
+
<div style="font-size: 18px">
|
|
20
|
+
{{ item.showName }}
|
|
21
|
+
</div>
|
|
22
|
+
<div style="padding-top:10px;">
|
|
23
|
+
{{ $t('superGrid.previewTitleWhenNotImg') }}
|
|
24
|
+
</div>
|
|
25
|
+
<div style="padding-top:10px">
|
|
26
|
+
<el-button type="primary" size="small" @click="preview()">
|
|
27
|
+
{{ $t('fsUpload.preview') }}
|
|
28
|
+
</el-button>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</el-carousel-item>
|
|
32
|
+
</el-carousel>
|
|
33
|
+
</el-dialog>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script>
|
|
37
|
+
import Vue from 'vue'
|
|
38
|
+
import { isPlateSys, getSystemFrontendUrl } from '../../../src/utils/common-util'
|
|
39
|
+
import { getToken } from '../../../src/utils/auth'
|
|
40
|
+
export default {
|
|
41
|
+
name: 'ViewImageDialog',
|
|
42
|
+
props: {
|
|
43
|
+
fileList: {
|
|
44
|
+
type: Array,
|
|
45
|
+
default: function() {
|
|
46
|
+
return []
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
downloadable: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: function() {
|
|
52
|
+
return true
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
deleteable: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: function() {
|
|
58
|
+
return false
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
data() {
|
|
63
|
+
const token = getToken()
|
|
64
|
+
let previewUrl = Vue.prototype.baseURL + '/common/fs-upload/preview?jwt=' + token
|
|
65
|
+
if (isPlateSys(Vue.prototype.systemCode)) {
|
|
66
|
+
previewUrl = Vue.prototype.baseAPI + '/component/fs-upload/preview?jwt=' + token
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
showName: null,
|
|
70
|
+
serverName: null,
|
|
71
|
+
file: null,
|
|
72
|
+
previewUrl
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
methods: {
|
|
76
|
+
changeFile(currentIndex, origIndex) {
|
|
77
|
+
const file = this.fileList[currentIndex]
|
|
78
|
+
this.file = file
|
|
79
|
+
this.showName = file.showName
|
|
80
|
+
this.serverName = file.serverName
|
|
81
|
+
},
|
|
82
|
+
downloadFile() {
|
|
83
|
+
if (!this.showName) {
|
|
84
|
+
const file = this.fileList[0]
|
|
85
|
+
this.showName = file.showName
|
|
86
|
+
this.serverName = file.serverName
|
|
87
|
+
}
|
|
88
|
+
const token = getToken()
|
|
89
|
+
let url = Vue.prototype.baseURL + '/common/super-form/downloads?jwt=' + token
|
|
90
|
+
if (isPlateSys(Vue.prototype.systemCode)) {
|
|
91
|
+
url = Vue.prototype.baseAPI + '/component/super-form/downloads?jwt=' + token
|
|
92
|
+
}
|
|
93
|
+
window.location.href = url + '&showName=' + encodeURI(this.showName) + '&serverPath=' + this.serverName
|
|
94
|
+
},
|
|
95
|
+
preview() {
|
|
96
|
+
if (!this.showName) {
|
|
97
|
+
const file = this.fileList[0]
|
|
98
|
+
this.showName = file.showName
|
|
99
|
+
this.serverName = file.serverName
|
|
100
|
+
}
|
|
101
|
+
if (Vue.prototype.customPreviewUrl) {
|
|
102
|
+
window.open(getSystemFrontendUrl(Vue.prototype.portalUrl) + '/#/file-service/preview?serverPath=' + this.serverName +
|
|
103
|
+
'&showName=' + encodeURI(this.showName),
|
|
104
|
+
this.showName
|
|
105
|
+
)
|
|
106
|
+
} else {
|
|
107
|
+
window.open(this.previewUrl + '&showName=' + encodeURI(this.showName) + '&serverPath=' + this.serverName)
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
deleteFile() {
|
|
111
|
+
let index
|
|
112
|
+
if (this.fileList && this.fileList.length > 0) {
|
|
113
|
+
if (!this.showName) {
|
|
114
|
+
const file = this.fileList[0]
|
|
115
|
+
this.showName = file.showName
|
|
116
|
+
this.serverName = file.serverName
|
|
117
|
+
}
|
|
118
|
+
const serverName = this.serverName
|
|
119
|
+
index = this.fileList.findIndex(function(item) {
|
|
120
|
+
return item.serverName === serverName
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
this.$emit('delete', this.fileList, index)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
</script>
|
|
128
|
+
|
|
129
|
+
<style lang="scss" scoped>
|
|
130
|
+
</style>
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import store from './store'
|
|
2
|
+
const apis = {
|
|
3
|
+
// 刷新列表数据
|
|
4
|
+
refresh() {
|
|
5
|
+
return new Promise((resolve, reject) => {
|
|
6
|
+
if (this.$refs) {
|
|
7
|
+
// 刷新列表数据
|
|
8
|
+
if (this.$refs.sf) {
|
|
9
|
+
this.search(this.$refs.sf.searchParams, true).then(() => resolve()).catch(error => reject(error))
|
|
10
|
+
} else {
|
|
11
|
+
this.search(null, true).then(() => resolve()).catch(error => reject(error))
|
|
12
|
+
}
|
|
13
|
+
} else {
|
|
14
|
+
resolve()
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
},
|
|
18
|
+
// 显示查询
|
|
19
|
+
showSearchForm() {
|
|
20
|
+
this.showSearch = true
|
|
21
|
+
this.$emit('showSearch')
|
|
22
|
+
},
|
|
23
|
+
// 取消查询
|
|
24
|
+
cancelSearch() {
|
|
25
|
+
this.showSearch = false
|
|
26
|
+
this.$emit('cancelSearch')
|
|
27
|
+
},
|
|
28
|
+
// 获得查询条件
|
|
29
|
+
getSearchForm() {
|
|
30
|
+
const gridParams = store.get(this.storeId)
|
|
31
|
+
if (gridParams.searchForm) {
|
|
32
|
+
return gridParams.searchForm
|
|
33
|
+
} else {
|
|
34
|
+
return []
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
// 获得列表所有数据
|
|
38
|
+
getGridData(listCode) {
|
|
39
|
+
if (!listCode) {
|
|
40
|
+
listCode = store.get('_nine_list_code')
|
|
41
|
+
}
|
|
42
|
+
if (listCode && listCode.indexOf('~') < 0) {
|
|
43
|
+
// 拼接默认的九宫格gridId
|
|
44
|
+
listCode = listCode + '~' + '_nineGrid'
|
|
45
|
+
}
|
|
46
|
+
const gridParams = store.get(listCode)
|
|
47
|
+
return gridParams.gridData
|
|
48
|
+
},
|
|
49
|
+
// 获得字段配置
|
|
50
|
+
getColumns(listCode) {
|
|
51
|
+
if (!listCode) {
|
|
52
|
+
listCode = store.get('_nine_list_code')
|
|
53
|
+
}
|
|
54
|
+
if (listCode && listCode.indexOf('~') < 0) {
|
|
55
|
+
// 拼接默认的九宫格gridId
|
|
56
|
+
listCode = listCode + '~' + '_nineGrid'
|
|
57
|
+
}
|
|
58
|
+
const gridParams = store.get(listCode)
|
|
59
|
+
return gridParams.columns
|
|
60
|
+
},
|
|
61
|
+
// listCode 列表编码~gridId,例如:MMS_BUSSINESS_SYSTEM~grid1
|
|
62
|
+
getPagination(listCode) {
|
|
63
|
+
if (!listCode) {
|
|
64
|
+
listCode = store.get('_nine_list_code')
|
|
65
|
+
}
|
|
66
|
+
if (listCode && listCode.indexOf('~') < 0) {
|
|
67
|
+
// 拼接默认的九宫格gridId
|
|
68
|
+
listCode = listCode + '~' + '_nineGrid'
|
|
69
|
+
}
|
|
70
|
+
const gridParams = store.get(listCode)
|
|
71
|
+
return gridParams.pagination
|
|
72
|
+
},
|
|
73
|
+
// 获得选中的记录集合
|
|
74
|
+
getSelections() {
|
|
75
|
+
return this.selections
|
|
76
|
+
},
|
|
77
|
+
// 获得选中的记录id集合
|
|
78
|
+
getSelectionIds() {
|
|
79
|
+
return this.selectionIds
|
|
80
|
+
},
|
|
81
|
+
// 清空选中的记录
|
|
82
|
+
clearSelections() {
|
|
83
|
+
this.selections = []
|
|
84
|
+
this.selectionIds = []
|
|
85
|
+
this.selectionModels = {}
|
|
86
|
+
this.currentId = null
|
|
87
|
+
},
|
|
88
|
+
// 单选时获得选中的记录
|
|
89
|
+
getSelection() {
|
|
90
|
+
if (this.selections && this.selections.length > 0) {
|
|
91
|
+
return this.selections[0]
|
|
92
|
+
}
|
|
93
|
+
return null
|
|
94
|
+
},
|
|
95
|
+
// 单选时获得选中的记录id集合
|
|
96
|
+
getSelectionId() {
|
|
97
|
+
if (this.selectionIds && this.selectionIds.length > 0) {
|
|
98
|
+
return this.selectionIds[0]
|
|
99
|
+
}
|
|
100
|
+
return null
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
export default apis
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// import Vue from 'vue'
|
|
2
|
+
import { doFormat } from './formatter'
|
|
3
|
+
const customFormatter = {
|
|
4
|
+
isObjectProp(prop) {
|
|
5
|
+
if (prop.indexOf('.') > 0) {
|
|
6
|
+
return true
|
|
7
|
+
} else {
|
|
8
|
+
return false
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
objectPropOriginalValue(row, prop) {
|
|
13
|
+
try {
|
|
14
|
+
// console.log('---super-grid--objectPropOriginalValue--')
|
|
15
|
+
let objValue = row
|
|
16
|
+
const props = prop.split('.')
|
|
17
|
+
props.forEach(subProp => {
|
|
18
|
+
if (objValue) {
|
|
19
|
+
objValue = objValue[subProp]
|
|
20
|
+
} else {
|
|
21
|
+
objValue = ''
|
|
22
|
+
throw objValue
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
return objValue
|
|
26
|
+
} catch (e) {
|
|
27
|
+
// console.log(e)
|
|
28
|
+
return ''
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
objectPropValue(row, column, prop) {
|
|
33
|
+
// console.log('---super-grid--objectPropValue--')
|
|
34
|
+
const val = doFormat(column, this.objectPropOriginalValue(row, prop))
|
|
35
|
+
return val
|
|
36
|
+
},
|
|
37
|
+
getColumnValue(row, column) {
|
|
38
|
+
const prop = column.prop
|
|
39
|
+
let originalValue = row[prop]
|
|
40
|
+
if (this.isObjectProp(prop)) {
|
|
41
|
+
originalValue = this.objectPropOriginalValue(row, prop)
|
|
42
|
+
}
|
|
43
|
+
const formatValue = doFormat(column, originalValue)
|
|
44
|
+
return { originalValue, formatValue }
|
|
45
|
+
},
|
|
46
|
+
onClickFun(row, column, onClick, rowIndex) {
|
|
47
|
+
const values = this.getColumnValue(row, column)
|
|
48
|
+
onClick.call(this, values.originalValue, values.formatValue, row, column, rowIndex)
|
|
49
|
+
},
|
|
50
|
+
isShowButtonFun(entity, button) {
|
|
51
|
+
const isShowFun = button.isShow
|
|
52
|
+
if (isShowFun === undefined) {
|
|
53
|
+
return true
|
|
54
|
+
}
|
|
55
|
+
if (typeof (isShowFun) === 'function') {
|
|
56
|
+
let isShow = isShowFun.call(this, entity, button)
|
|
57
|
+
if (isShow === undefined) {
|
|
58
|
+
isShow = true
|
|
59
|
+
}
|
|
60
|
+
return isShow
|
|
61
|
+
} else {
|
|
62
|
+
return isShowFun
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export default customFormatter
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
const formatter = {
|
|
2
|
+
number: function(value, options) {
|
|
3
|
+
debugger
|
|
4
|
+
// 小数位数
|
|
5
|
+
const precision = options.precision
|
|
6
|
+
// 是否显示千分位
|
|
7
|
+
const isDelimiter = options.delimiter
|
|
8
|
+
// 是否显示科学计数法
|
|
9
|
+
const scientific = options.scientific
|
|
10
|
+
// 几位开始计算
|
|
11
|
+
let scientificNum = options.scientificNum
|
|
12
|
+
if (value != null) {
|
|
13
|
+
if (precision > 0) {
|
|
14
|
+
// 表示有小数
|
|
15
|
+
value = parseFloat(value)
|
|
16
|
+
value = value.toFixed(precision)
|
|
17
|
+
}
|
|
18
|
+
if (isDelimiter) {
|
|
19
|
+
value = value.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,')
|
|
20
|
+
}
|
|
21
|
+
if (scientific != null) {
|
|
22
|
+
let isScientific = false
|
|
23
|
+
if (scientificNum) {
|
|
24
|
+
scientificNum = parseInt(scientificNum)
|
|
25
|
+
} else {
|
|
26
|
+
scientificNum = 11
|
|
27
|
+
}
|
|
28
|
+
if (value.length >= scientificNum) {
|
|
29
|
+
isScientific = true
|
|
30
|
+
}
|
|
31
|
+
if (isScientific) {
|
|
32
|
+
value = '' + value
|
|
33
|
+
value = parseFloat(value)
|
|
34
|
+
value = value.toExponential() // 转换为标准的科学计数法形式(字符串)
|
|
35
|
+
// const tmpArray = eformat.match(/\d(?:\.(\d*))?e([+-]\d+)/) // 分离出小数值和指数值
|
|
36
|
+
// value = value.toFixed(Math.max(0, (tmpArray[1] || '').length - tmpArray[2]))
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return value
|
|
42
|
+
},
|
|
43
|
+
currency: function(value, options) {
|
|
44
|
+
// 单位:$ 或 ¥
|
|
45
|
+
const sign = options.sign
|
|
46
|
+
return sign + this.number(value, options)
|
|
47
|
+
},
|
|
48
|
+
date: function(value, options) {
|
|
49
|
+
// format格式,例如:yyyy-m-d,yyyy-m-d hh:mm:ss等等
|
|
50
|
+
const format = options.format
|
|
51
|
+
if (value != null) {
|
|
52
|
+
const date = new Date(value)
|
|
53
|
+
var y = date.getFullYear()
|
|
54
|
+
var m = date.getMonth() + 1
|
|
55
|
+
var d = date.getDate()
|
|
56
|
+
var h = date.getHours()
|
|
57
|
+
var min = date.getMinutes()
|
|
58
|
+
var s = date.getSeconds()
|
|
59
|
+
if (m < 10) {
|
|
60
|
+
m = '0' + m
|
|
61
|
+
}
|
|
62
|
+
if (d < 10) {
|
|
63
|
+
d = '0' + d
|
|
64
|
+
}
|
|
65
|
+
if (h < 10) {
|
|
66
|
+
h = '0' + h
|
|
67
|
+
}
|
|
68
|
+
if (min < 10) {
|
|
69
|
+
min = '0' + min
|
|
70
|
+
}
|
|
71
|
+
if (s < 10) {
|
|
72
|
+
s = '0' + s
|
|
73
|
+
}
|
|
74
|
+
return format.replace('yyyy', y)
|
|
75
|
+
.replace('m', m)
|
|
76
|
+
.replace('d', d)
|
|
77
|
+
.replace('hh', h)
|
|
78
|
+
.replace('mm', min)
|
|
79
|
+
.replace('ss', s)
|
|
80
|
+
}
|
|
81
|
+
return value
|
|
82
|
+
},
|
|
83
|
+
time: function(value, options) {
|
|
84
|
+
return this.date(value, options)
|
|
85
|
+
},
|
|
86
|
+
percent: function(value, options) {
|
|
87
|
+
return this.number(value, options) + '%'
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function doFormat(column, value) {
|
|
92
|
+
if (value === undefined || column === undefined) {
|
|
93
|
+
return value
|
|
94
|
+
}
|
|
95
|
+
// 先处理值设置再处理格式化设置:即会对值设置的结果进行格式化设置
|
|
96
|
+
if (column.valueSet !== undefined) {
|
|
97
|
+
const item = column.valueSet.filter(item => {
|
|
98
|
+
return item.value === value + ''
|
|
99
|
+
})
|
|
100
|
+
if (item.length > 0) {
|
|
101
|
+
// 数据库的原始值要显示成label值,后续对这个label进行格式化(不是处理原始值)
|
|
102
|
+
value = item[0].label
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// 获得默认的格式设置
|
|
106
|
+
if (column.formatter === undefined) {
|
|
107
|
+
if (column.dataType === 'DATE') {
|
|
108
|
+
// 默认的“DATE”类型的格式设置
|
|
109
|
+
column.formatter = {
|
|
110
|
+
type: 'date',
|
|
111
|
+
options: {
|
|
112
|
+
format: 'yyyy-m-d'
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
} else if (column.dataType === 'TIME') {
|
|
116
|
+
// 默认的“TIME”类型的格式设置
|
|
117
|
+
column.formatter = {
|
|
118
|
+
type: 'time',
|
|
119
|
+
options: {
|
|
120
|
+
format: 'yyyy-m-d hh:mm:ss'
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
const columnFormatter = column.formatter
|
|
126
|
+
if (columnFormatter !== undefined && formatter[columnFormatter.type] !== undefined) {
|
|
127
|
+
return formatter[columnFormatter.type](value, columnFormatter.options)
|
|
128
|
+
} else {
|
|
129
|
+
return value
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<el-input-number
|
|
4
|
+
v-model="number1"
|
|
5
|
+
@change="setValue()"
|
|
6
|
+
/>
|
|
7
|
+
<span>---</span>
|
|
8
|
+
<el-input-number
|
|
9
|
+
v-model="number2"
|
|
10
|
+
@change="setValue()"
|
|
11
|
+
/>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
<script>
|
|
15
|
+
export default {
|
|
16
|
+
props: {
|
|
17
|
+
r: {
|
|
18
|
+
type: Number,
|
|
19
|
+
default: null
|
|
20
|
+
},
|
|
21
|
+
n: {
|
|
22
|
+
type: Number,
|
|
23
|
+
default: null
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
data() {
|
|
27
|
+
return {
|
|
28
|
+
number1: null,
|
|
29
|
+
number2: null
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
methods: {
|
|
33
|
+
setValue() {
|
|
34
|
+
this.$emit('setValue', [this.number1, this.number2], this.r, this.n)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
</script>
|