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,335 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-dialog
|
|
3
|
+
:title="$t('superGrid.columnConfig')"
|
|
4
|
+
width="50%"
|
|
5
|
+
top="5vh"
|
|
6
|
+
append-to-body
|
|
7
|
+
:close-on-click-modal="false"
|
|
8
|
+
:visible="true"
|
|
9
|
+
:show-close="true"
|
|
10
|
+
@open="$emit('open')"
|
|
11
|
+
@opend="$emit('opend')"
|
|
12
|
+
@close="$emit('close')"
|
|
13
|
+
@closed="$emit('closed')"
|
|
14
|
+
>
|
|
15
|
+
<div
|
|
16
|
+
class="operation-area"
|
|
17
|
+
>
|
|
18
|
+
<el-button type="primary" size="small" @click="saveConfig">
|
|
19
|
+
{{ $t('imatrixUIPublicModel.sure') }}
|
|
20
|
+
</el-button>
|
|
21
|
+
<el-button size="small" @click="resetConfig">
|
|
22
|
+
{{ $t('imatrixUIPublicModel.reset') }}
|
|
23
|
+
</el-button>
|
|
24
|
+
<el-button size="small" @click="$emit('close')">
|
|
25
|
+
{{ $t('imatrixUIPublicModel.cancel') }}
|
|
26
|
+
</el-button>
|
|
27
|
+
<span v-if="isDragColumn" style="padding-left:10px;color:red">({{ $t('superGrid.dragColumnOrderMessage') }})</span>
|
|
28
|
+
</div>
|
|
29
|
+
<el-table v-if="hasLoaded" :data="columns" max-height="450" class="custom-config-elTable">
|
|
30
|
+
<el-table-column property="label" :label="$t('superGrid.label')" width="220">
|
|
31
|
+
<template slot-scope="scope">
|
|
32
|
+
<span class="ellipsis cell--span" :title="scope.row.label">{{ scope.row.label }}</span>
|
|
33
|
+
</template>
|
|
34
|
+
</el-table-column>
|
|
35
|
+
<el-table-column property="showType" :label="$t('superGrid.isShow')" width="120">
|
|
36
|
+
<template slot-scope="scope">
|
|
37
|
+
<el-select v-model="scope.row.showType" :disabled="isDisabledShow(scope.row)" @change="changeShow(scope.row, $event)">
|
|
38
|
+
<el-option
|
|
39
|
+
:label="isDisabledShow(scope.row)?$t('superGrid.default'):$t('superGrid.show')"
|
|
40
|
+
value="default"
|
|
41
|
+
/>
|
|
42
|
+
<el-option
|
|
43
|
+
:label="$t('superGrid.hidden')"
|
|
44
|
+
value="false"
|
|
45
|
+
/>
|
|
46
|
+
</el-select>
|
|
47
|
+
</template>
|
|
48
|
+
</el-table-column>
|
|
49
|
+
<el-table-column property="exportType" :label="$t('superGrid.isExportable')" width="120">
|
|
50
|
+
<template slot-scope="scope">
|
|
51
|
+
<el-select v-model="scope.row.exportType" :disabled="isDisabledExport(scope.row)" @change="changeExport(scope.row, $event)">
|
|
52
|
+
<el-option
|
|
53
|
+
:label="isDisabledExport(scope.row)?$t('superGrid.default'):$t('superGrid.export')"
|
|
54
|
+
value="default"
|
|
55
|
+
/>
|
|
56
|
+
<el-option
|
|
57
|
+
:label="$t('superGrid.unExport')"
|
|
58
|
+
value="false"
|
|
59
|
+
/>
|
|
60
|
+
</el-select>
|
|
61
|
+
</template>
|
|
62
|
+
</el-table-column>
|
|
63
|
+
<el-table-column v-if="isDragColumn" property="displayOrderType" :label="$t('superGrid.displayOrder')" width="120">
|
|
64
|
+
<template slot-scope="scope">
|
|
65
|
+
<el-input v-if="scope.row.displayOrderType && scope.row.displayOrderType === 'custom'" v-model="scope.row.displayOrder" clearable size="mini" @clear="clearDisplayOrder(scope.row)" />
|
|
66
|
+
<el-select v-else v-model="scope.row.displayOrderType">
|
|
67
|
+
<el-option
|
|
68
|
+
:label="$t('superGrid.default')"
|
|
69
|
+
value="default"
|
|
70
|
+
/>
|
|
71
|
+
<el-option
|
|
72
|
+
:label="$t('superGrid.custom')"
|
|
73
|
+
value="custom"
|
|
74
|
+
/>
|
|
75
|
+
</el-select>
|
|
76
|
+
</template>
|
|
77
|
+
</el-table-column>
|
|
78
|
+
<el-table-column property="widthType" :label="$t('superGrid.width')" width="120">
|
|
79
|
+
<template slot-scope="scope">
|
|
80
|
+
<el-input v-if="scope.row.widthType && scope.row.widthType === 'custom'" v-model="scope.row.width" size="mini" clearable @clear="clearWidth(scope.row)" />
|
|
81
|
+
<el-select v-else v-model="scope.row.widthType">
|
|
82
|
+
<el-option
|
|
83
|
+
:label="$t('superGrid.default')"
|
|
84
|
+
value="default"
|
|
85
|
+
/>
|
|
86
|
+
<el-option
|
|
87
|
+
:label="$t('superGrid.custom')"
|
|
88
|
+
value="custom"
|
|
89
|
+
/>
|
|
90
|
+
</el-select>
|
|
91
|
+
</template>
|
|
92
|
+
</el-table-column>
|
|
93
|
+
</el-table>
|
|
94
|
+
</el-dialog>
|
|
95
|
+
</template>
|
|
96
|
+
<script>
|
|
97
|
+
import Vue from 'vue'
|
|
98
|
+
import store from './store'
|
|
99
|
+
import Sortable from 'sortablejs'
|
|
100
|
+
export default {
|
|
101
|
+
name: 'ColumnsConfig',
|
|
102
|
+
props: {
|
|
103
|
+
listCode: {
|
|
104
|
+
type: String,
|
|
105
|
+
default: ''
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
data() {
|
|
109
|
+
return {
|
|
110
|
+
columns: [],
|
|
111
|
+
hasLoaded: false
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
created() {
|
|
115
|
+
|
|
116
|
+
},
|
|
117
|
+
mounted() {
|
|
118
|
+
this.listAllColumns().then((columns) => {
|
|
119
|
+
this.columns = columns
|
|
120
|
+
this.hasLoaded = true
|
|
121
|
+
this.$nextTick(() => {
|
|
122
|
+
this.dragColumnDisplayOrder()
|
|
123
|
+
})
|
|
124
|
+
})
|
|
125
|
+
},
|
|
126
|
+
methods: {
|
|
127
|
+
isDisabledShow(row) {
|
|
128
|
+
// 序号、复选框列不可以配置是否显示;占位符列不可以设置是否显示;当不是自定义的显示状态为false时,不可配置是否显示
|
|
129
|
+
return (row.prop && (row.prop === '$index' || row.prop === '$selection')) ||
|
|
130
|
+
row.custom === true || (row.showType && row.showType !== 'false' && row.show === false)
|
|
131
|
+
},
|
|
132
|
+
isDisabledExport(row) {
|
|
133
|
+
// 序号、复选框列不可以配置是否导出;占位符列不可以设置是否导出;当不是自定义的导出状态为false时,不可配置是否导出
|
|
134
|
+
return (row.prop && (row.prop === '$index' || row.prop === '$selection')) ||
|
|
135
|
+
row.custom === true || (row.exportType && row.exportType !== 'false' && row.exportable === false)
|
|
136
|
+
},
|
|
137
|
+
changeShow(row, value) {
|
|
138
|
+
if (value !== undefined && value === 'false') {
|
|
139
|
+
row.show = false
|
|
140
|
+
} else {
|
|
141
|
+
row.show = true
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
changeExport(row, value) {
|
|
145
|
+
if (value !== undefined && value === 'false') {
|
|
146
|
+
row.exportable = false
|
|
147
|
+
} else {
|
|
148
|
+
row.exportable = true
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
saveConfig() {
|
|
152
|
+
const params = {
|
|
153
|
+
'settingColumns': this.columns,
|
|
154
|
+
'listCode': this.listCode
|
|
155
|
+
}
|
|
156
|
+
this.$http.post(Vue.prototype.baseAPI + '/component/super-grids/setting-columns', params).then(data => {
|
|
157
|
+
this.$message({
|
|
158
|
+
type: 'success',
|
|
159
|
+
message: this.$t('imatrixUIMessage.saveSuccessfully'),
|
|
160
|
+
showClose: true
|
|
161
|
+
})
|
|
162
|
+
this.$emit('close', true)
|
|
163
|
+
})
|
|
164
|
+
},
|
|
165
|
+
resetConfig() {
|
|
166
|
+
this.$confirm(this.$t('superGrid.whetherToConfirmReset'), this.$t('imatrixUIMessage.tips'), {
|
|
167
|
+
confirmButtonText: this.$t('imatrixUIPublicModel.sure'),
|
|
168
|
+
cancelButtonText: this.$t('imatrixUIPublicModel.cancel'),
|
|
169
|
+
type: 'warning'
|
|
170
|
+
}).then(() => {
|
|
171
|
+
const url = Vue.prototype.baseAPI + '/component/super-grids/reset-columns/' + this.listCode
|
|
172
|
+
this.$http.delete(url).then(() => {
|
|
173
|
+
this.$message({
|
|
174
|
+
type: 'success',
|
|
175
|
+
message: this.$t('superGrid.resetSuccessful'),
|
|
176
|
+
showClose: true
|
|
177
|
+
})
|
|
178
|
+
this.listAllColumns().then((columns) => {
|
|
179
|
+
this.columns = columns
|
|
180
|
+
this.$emit('reset', true)
|
|
181
|
+
})
|
|
182
|
+
})
|
|
183
|
+
})
|
|
184
|
+
},
|
|
185
|
+
listAllColumns() {
|
|
186
|
+
return new Promise((resolve, reject) => {
|
|
187
|
+
const url = Vue.prototype.baseAPI + '/component/super-grids/all-list-columns/' + this.listCode
|
|
188
|
+
const gridParams = store.get(this.listCode)
|
|
189
|
+
const params = {}
|
|
190
|
+
const isSql = gridParams.isSql
|
|
191
|
+
this.isDragColumn = gridParams.colSetting.isDragColumn
|
|
192
|
+
if (typeof (isSql) !== 'undefined') {
|
|
193
|
+
params.isSql = isSql + ''
|
|
194
|
+
}
|
|
195
|
+
this.$http.post(url, params).then(columns => {
|
|
196
|
+
resolve(columns)
|
|
197
|
+
}).catch(error => {
|
|
198
|
+
reject(error)
|
|
199
|
+
})
|
|
200
|
+
})
|
|
201
|
+
},
|
|
202
|
+
clearDisplayOrder(row) {
|
|
203
|
+
row.displayOrderType = 'default'
|
|
204
|
+
},
|
|
205
|
+
clearWidth(row) {
|
|
206
|
+
row.widthType = 'default'
|
|
207
|
+
},
|
|
208
|
+
// 移动完成后的displayOrder设置
|
|
209
|
+
indexAfterTheChangeUpdateDisplayOrder(dataList, oldIndex, newIndex, prop) {
|
|
210
|
+
if (dataList && dataList.length > 0) {
|
|
211
|
+
if (oldIndex != null && oldIndex !== undefined && oldIndex !== -1) {
|
|
212
|
+
if (newIndex !== null && newIndex !== undefined && newIndex !== -1) {
|
|
213
|
+
if (prop && prop !== '') {
|
|
214
|
+
const selectCol = dataList[newIndex]
|
|
215
|
+
selectCol.displayOrderType = 'custom'
|
|
216
|
+
if (newIndex > oldIndex) {
|
|
217
|
+
// 表示向后移动
|
|
218
|
+
// 位置已经移动,所以参数要赋值给原始位置的下一个
|
|
219
|
+
const afProp = dataList[newIndex - 1][prop]
|
|
220
|
+
const arr = dataList.slice(oldIndex, newIndex)
|
|
221
|
+
if (arr && arr.length > 0) {
|
|
222
|
+
for (let i = arr.length - 1; i > -1; i--) {
|
|
223
|
+
const col = arr[i]
|
|
224
|
+
col.displayOrderType = 'custom'
|
|
225
|
+
if (i === 0) {
|
|
226
|
+
// 紧靠原始位置的上一个
|
|
227
|
+
col[prop] = selectCol[prop]
|
|
228
|
+
} else {
|
|
229
|
+
col[prop] = arr[i - 1][prop]
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
selectCol[prop] = afProp
|
|
234
|
+
} else {
|
|
235
|
+
const befProp = dataList[newIndex + 1][prop]
|
|
236
|
+
// 表示向前移动
|
|
237
|
+
// 位置已经移动,所以参数要赋值给原始位置的上一个
|
|
238
|
+
const arr = dataList.slice(newIndex + 1, oldIndex + 1)
|
|
239
|
+
if (arr && arr.length > 0) {
|
|
240
|
+
for (let i = 0; i < arr.length; i++) {
|
|
241
|
+
const col = arr[i]
|
|
242
|
+
col.displayOrderType = 'custom'
|
|
243
|
+
if (i === arr.length - 1) {
|
|
244
|
+
// 紧靠原始位置的上一个
|
|
245
|
+
col[prop] = selectCol[prop]
|
|
246
|
+
} else {
|
|
247
|
+
col[prop] = arr[i + 1][prop]
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
selectCol[prop] = befProp
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
// 拖动列顺序
|
|
259
|
+
dragColumnDisplayOrder() {
|
|
260
|
+
if (!this.isDragColumn) {
|
|
261
|
+
return
|
|
262
|
+
}
|
|
263
|
+
return new Promise((resolve, reject) => {
|
|
264
|
+
const tbody = document.querySelector('.custom-config-elTable .el-table__body-wrapper tbody')
|
|
265
|
+
if (tbody != null) {
|
|
266
|
+
const vm = this
|
|
267
|
+
Sortable.create(tbody, {
|
|
268
|
+
onEnd({ newIndex, oldIndex }) {
|
|
269
|
+
if (oldIndex !== null && oldIndex !== undefined && oldIndex !== -1 && newIndex !== null && newIndex !== undefined && newIndex !== -1) {
|
|
270
|
+
if (oldIndex > newIndex) {
|
|
271
|
+
// 从后往前
|
|
272
|
+
if (vm.columns && vm.columns.length > 0) {
|
|
273
|
+
const item = vm.columns[oldIndex]
|
|
274
|
+
for (var i = oldIndex - 1; i >= newIndex; i--) {
|
|
275
|
+
const col = vm.columns[i]
|
|
276
|
+
col.displayOrderType = 'custom'
|
|
277
|
+
vm.columns[i + 1] = col
|
|
278
|
+
}
|
|
279
|
+
vm.columns[newIndex] = item
|
|
280
|
+
}
|
|
281
|
+
} else {
|
|
282
|
+
// 从前往后
|
|
283
|
+
if (vm.columns && vm.columns.length > 0) {
|
|
284
|
+
const item = vm.columns[oldIndex]
|
|
285
|
+
for (var k = oldIndex + 1; k <= newIndex; k++) {
|
|
286
|
+
const col = vm.columns[k]
|
|
287
|
+
col.displayOrderType = 'custom'
|
|
288
|
+
vm.columns[k - 1] = col
|
|
289
|
+
}
|
|
290
|
+
vm.columns[newIndex] = item
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
console.log('config拖动字段', vm.columns)
|
|
295
|
+
console.log('config拖动字段oldIndex', oldIndex)
|
|
296
|
+
console.log('config拖动字段newIndex', newIndex)
|
|
297
|
+
vm.hasLoaded = false
|
|
298
|
+
setTimeout(function() {
|
|
299
|
+
vm.hasLoaded = true
|
|
300
|
+
vm.$nextTick(() => {
|
|
301
|
+
vm.indexAfterTheChangeUpdateDisplayOrder(vm.columns, oldIndex, newIndex, 'displayOrder')
|
|
302
|
+
vm.dragColumnDisplayOrder()
|
|
303
|
+
})
|
|
304
|
+
}, 100)
|
|
305
|
+
|
|
306
|
+
// vm.hasLoaded = false
|
|
307
|
+
// // 添加setTimeout是解决拖动顺序后数组columns值改变了,但是列表没有重新渲染问题
|
|
308
|
+
// setTimeout(function() {
|
|
309
|
+
// vm.hasLoaded = true
|
|
310
|
+
// vm.$nextTick(() => {
|
|
311
|
+
// vm.dragColumnDisplayOrder()
|
|
312
|
+
// })
|
|
313
|
+
// const currentColumn = vm.columns[oldIndex]
|
|
314
|
+
// const targetColumn = vm.columns[newIndex]
|
|
315
|
+
// const currentDisplayOrder = currentColumn.displayOrder
|
|
316
|
+
// const targetDisplayOrder = targetColumn.displayOrder
|
|
317
|
+
// vm.columns.splice(oldIndex, 1)
|
|
318
|
+
// vm.columns.splice(newIndex, 0, currentColumn)
|
|
319
|
+
// vm.$set(currentColumn, 'displayOrder', targetDisplayOrder)
|
|
320
|
+
// vm.$set(currentColumn, 'displayOrderType', 'custom')
|
|
321
|
+
// vm.$set(targetColumn, 'displayOrder', currentDisplayOrder)
|
|
322
|
+
// vm.$set(targetColumn, 'displayOrderType', 'custom')
|
|
323
|
+
// vm.hasLoaded = true
|
|
324
|
+
// vm.$nextTick(() => {
|
|
325
|
+
// vm.dragColumnDisplayOrder()
|
|
326
|
+
// })
|
|
327
|
+
// }, 100)
|
|
328
|
+
}
|
|
329
|
+
})
|
|
330
|
+
}
|
|
331
|
+
})
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
</script>
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import Vue from 'vue'
|
|
2
|
+
import {
|
|
3
|
+
doFormat
|
|
4
|
+
} from './formatter'
|
|
5
|
+
import store from './store'
|
|
6
|
+
import {
|
|
7
|
+
initialization,
|
|
8
|
+
jumpToPage
|
|
9
|
+
} from '../../../src/utils/jump-page-utils'
|
|
10
|
+
import {
|
|
11
|
+
analysisFileSetObj, otherFilesToStandard
|
|
12
|
+
} from './utils'
|
|
13
|
+
const customFormatter = {
|
|
14
|
+
/**
|
|
15
|
+
* 自定义格式化值
|
|
16
|
+
* @param {prop} 属性名
|
|
17
|
+
* @param {formatValue} 格式化后的值
|
|
18
|
+
* @param {format} 格式化方法
|
|
19
|
+
* @param {componentName} 组件名
|
|
20
|
+
*/
|
|
21
|
+
customFormatValue(row, prop, format, rowIndex) {
|
|
22
|
+
// const start = new Date().getTime()
|
|
23
|
+
// console.log('---super-grid--customFormatValue--')
|
|
24
|
+
if (this.customFormat) {
|
|
25
|
+
let originalValue = row[prop]
|
|
26
|
+
if (this.isObjectProp(prop)) {
|
|
27
|
+
originalValue = this.objectPropOriginalValue(row, prop)
|
|
28
|
+
}
|
|
29
|
+
const formatValue = doFormat(this.column, originalValue)
|
|
30
|
+
const component = format.call(this, originalValue, formatValue, row, this.column, rowIndex)
|
|
31
|
+
if (typeof (component) === 'undefined') {
|
|
32
|
+
return false
|
|
33
|
+
} else {
|
|
34
|
+
Vue.component(prop + rowIndex, component)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// const end = new Date().getTime()
|
|
38
|
+
// console.log('---super-grid--customFormatValue--time1=', (end - start))
|
|
39
|
+
return true
|
|
40
|
+
} else {
|
|
41
|
+
// const end = new Date().getTime()
|
|
42
|
+
// console.log('---super-grid--customFormatValue--time2=', (end - start))
|
|
43
|
+
return false
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
isObjectProp(prop) {
|
|
48
|
+
// const start = new Date().getTime()
|
|
49
|
+
// console.log('---super-grid--isObjectProp--')
|
|
50
|
+
if (prop && prop.indexOf('.') > 0) {
|
|
51
|
+
// const end = new Date().getTime()
|
|
52
|
+
// console.log('---super-grid--isObjectProp--time1=', (end - start))
|
|
53
|
+
return true
|
|
54
|
+
} else {
|
|
55
|
+
// const end = new Date().getTime()
|
|
56
|
+
// console.log('---super-grid--isObjectProp--time2=', (end - start))
|
|
57
|
+
return false
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
objectPropOriginalValue(row, prop) {
|
|
62
|
+
try {
|
|
63
|
+
// console.log('---super-grid--objectPropOriginalValue--')
|
|
64
|
+
let objValue = row
|
|
65
|
+
if (prop && prop.indexOf('.') > 0) {
|
|
66
|
+
const props = prop.split('.')
|
|
67
|
+
props.forEach(subProp => {
|
|
68
|
+
if (objValue) {
|
|
69
|
+
objValue = objValue[subProp]
|
|
70
|
+
} else {
|
|
71
|
+
objValue = ''
|
|
72
|
+
throw objValue
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
return objValue
|
|
76
|
+
} else {
|
|
77
|
+
return row[prop]
|
|
78
|
+
}
|
|
79
|
+
} catch (e) {
|
|
80
|
+
// console.log(e)
|
|
81
|
+
return ''
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
objectPropValue(row, prop) {
|
|
86
|
+
return this.formatter(row, prop, this.column)
|
|
87
|
+
},
|
|
88
|
+
// 获取显示的值
|
|
89
|
+
// 附件类型,显示值与实际值不相同。如果时子表多选,需要单独判断
|
|
90
|
+
objectPropValueTwo(row, column) {
|
|
91
|
+
if (column.componentType === 'annex' || column.componentType === 'multipartUpload') {
|
|
92
|
+
// 判断是否是对象集合(子表存储)
|
|
93
|
+
const fileSetObj = JSON.parse(column.fileSet)
|
|
94
|
+
if (fileSetObj.childAnnexDataTableCode) {
|
|
95
|
+
// 获取存好的json并解析
|
|
96
|
+
const keyValueParam = analysisFileSetObj(fileSetObj, this.isSql)
|
|
97
|
+
// 子表存储。返回最后一个对象的展示名称
|
|
98
|
+
const fileArr = this.objectPropValue(row, column.prop)
|
|
99
|
+
if (fileArr && fileArr.length > 0) {
|
|
100
|
+
const fileList = otherFilesToStandard(fileSetObj, keyValueParam, fileArr, null)
|
|
101
|
+
return fileList[fileList.length - 1].showName
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
return this.objectPropValue(row, column.prop)
|
|
105
|
+
}
|
|
106
|
+
} else if (column.formatter && column.formatter.type === 'files') {
|
|
107
|
+
// 判断是否是对象集合(子表存储)
|
|
108
|
+
const fileSetObj = JSON.parse(column.formatter.options.fileSet)
|
|
109
|
+
if (fileSetObj.childAnnexDataTableCode) {
|
|
110
|
+
// 获取存好的json并解析
|
|
111
|
+
const keyValueParam = analysisFileSetObj(fileSetObj, this.isSql)
|
|
112
|
+
// 子表存储。返回最后一个对象的展示名称
|
|
113
|
+
const fileArr = this.objectPropValue(row, column.prop)
|
|
114
|
+
if (fileArr && fileArr.length > 0) {
|
|
115
|
+
const fileList = otherFilesToStandard(fileSetObj, keyValueParam, fileArr, null)
|
|
116
|
+
return fileList[fileList.length - 1].showName
|
|
117
|
+
}
|
|
118
|
+
} else {
|
|
119
|
+
return this.objectPropValue(row, column.prop)
|
|
120
|
+
}
|
|
121
|
+
} else {
|
|
122
|
+
return this.objectPropValue(row, column.prop)
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
formatter(row, prop, column) {
|
|
126
|
+
const cellValue = this.objectPropOriginalValue(row, prop)
|
|
127
|
+
if (this.columnFormatter !== undefined && this.columnFormatter.type === 'custom') {
|
|
128
|
+
// 自定义事件
|
|
129
|
+
let funName
|
|
130
|
+
if (this.columnFormatter.options && this.columnFormatter.options.format) {
|
|
131
|
+
funName = this.columnFormatter.options.format
|
|
132
|
+
}
|
|
133
|
+
if (funName && funName !== null && funName !== '') {
|
|
134
|
+
const gridParams = store.get(this.listCode)
|
|
135
|
+
if (gridParams.options && gridParams.options['eventCallBack'] &&
|
|
136
|
+
gridParams.options['eventCallBack'][funName] && typeof (gridParams.options['eventCallBack'][funName]) === 'function') {
|
|
137
|
+
const param = {
|
|
138
|
+
value: cellValue,
|
|
139
|
+
row: row,
|
|
140
|
+
column: this.column,
|
|
141
|
+
prop: prop
|
|
142
|
+
}
|
|
143
|
+
return gridParams.options['eventCallBack'][funName].call(this, param)
|
|
144
|
+
} else {
|
|
145
|
+
return doFormat(column, cellValue)
|
|
146
|
+
}
|
|
147
|
+
} else {
|
|
148
|
+
return doFormat(column, cellValue)
|
|
149
|
+
}
|
|
150
|
+
} else {
|
|
151
|
+
return doFormat(column, cellValue)
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
getColumnValue(row, column) {
|
|
155
|
+
const prop = column.prop
|
|
156
|
+
let originalValue = row[prop]
|
|
157
|
+
if (this.isObjectProp(prop)) {
|
|
158
|
+
originalValue = this.objectPropOriginalValue(row, prop)
|
|
159
|
+
}
|
|
160
|
+
const formatValue = doFormat(column, originalValue)
|
|
161
|
+
return {
|
|
162
|
+
originalValue,
|
|
163
|
+
formatValue
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
onClickFun(row, column, onClick, rowIndex) {
|
|
167
|
+
const values = this.getColumnValue(row, column)
|
|
168
|
+
onClick.call(this, values.originalValue, values.formatValue, row, column, rowIndex)
|
|
169
|
+
},
|
|
170
|
+
isShowButtonFun(row, column, isShowFun, rowIndex) {
|
|
171
|
+
if (isShowFun === undefined) {
|
|
172
|
+
return true
|
|
173
|
+
}
|
|
174
|
+
if (typeof (isShowFun) === 'function') {
|
|
175
|
+
const values = this.getColumnValue(row, column)
|
|
176
|
+
let isShow = isShowFun.call(this, values.originalValue, values.formatValue, row, column, rowIndex)
|
|
177
|
+
if (isShow === undefined) {
|
|
178
|
+
isShow = true
|
|
179
|
+
}
|
|
180
|
+
return isShow
|
|
181
|
+
} else {
|
|
182
|
+
return isShowFun
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
// 超链接解析
|
|
186
|
+
getHyperLinkSetting(column, row, isSql, additionalParamerter, contextParameter, tableName, listCode) {
|
|
187
|
+
const gridParams = store.get(listCode)
|
|
188
|
+
let parentFormData = null
|
|
189
|
+
if (gridParams.options.extraParam && gridParams.options.extraParam.entityMap) {
|
|
190
|
+
parentFormData = gridParams.options.extraParam.entityMap
|
|
191
|
+
}
|
|
192
|
+
let hyperLinkResult = {}
|
|
193
|
+
let jumpPageJson
|
|
194
|
+
if (column && column.formatter && column.formatter.options && column.formatter.options.format) {
|
|
195
|
+
jumpPageJson = column.formatter.options.format
|
|
196
|
+
}
|
|
197
|
+
if (jumpPageJson && jumpPageJson !== '') {
|
|
198
|
+
// 解析是否需要显示该超链接
|
|
199
|
+
const result = initialization(JSON.parse(jumpPageJson), row, isSql, additionalParamerter, contextParameter, tableName, parentFormData)
|
|
200
|
+
// console.log('getHyperLinkSetting--resut=', result)
|
|
201
|
+
if (result && result.label && result.label !== '') {
|
|
202
|
+
console.log('label存在')
|
|
203
|
+
} else {
|
|
204
|
+
result.label = this.objectPropValueTwo(row, column)
|
|
205
|
+
}
|
|
206
|
+
if (result && result.title && result.title !== '') {
|
|
207
|
+
console.log('title存在')
|
|
208
|
+
} else {
|
|
209
|
+
result.title = result.label
|
|
210
|
+
}
|
|
211
|
+
hyperLinkResult = result
|
|
212
|
+
} else {
|
|
213
|
+
// 表示显示超链接
|
|
214
|
+
hyperLinkResult.visible = true
|
|
215
|
+
hyperLinkResult.label = this.objectPropValueTwo(row, column)
|
|
216
|
+
hyperLinkResult.title = hyperLinkResult.label
|
|
217
|
+
}
|
|
218
|
+
return hyperLinkResult
|
|
219
|
+
},
|
|
220
|
+
// 点击超链接
|
|
221
|
+
clickHyperLink(column, row, listCode, rowIndex) {
|
|
222
|
+
let jumpPageJson
|
|
223
|
+
if (column && column.formatter && column.formatter.options && column.formatter.options.format) {
|
|
224
|
+
jumpPageJson = column.formatter.options.format
|
|
225
|
+
}
|
|
226
|
+
if (jumpPageJson && jumpPageJson !== '') {
|
|
227
|
+
// 解析是否需要显示该超链接
|
|
228
|
+
const gridParams = store.get(listCode)
|
|
229
|
+
let parentFormData = null
|
|
230
|
+
if (gridParams.options.extraParam && gridParams.options.extraParam.entityMap) {
|
|
231
|
+
parentFormData = gridParams.options.extraParam.entityMap
|
|
232
|
+
}
|
|
233
|
+
console.log('ridParams.options.extraParam.entityMap', gridParams.options.extraParam)
|
|
234
|
+
jumpToPage(JSON.parse(jumpPageJson), gridParams.system, row.id ? row.id : row.ID, row, gridParams.additionalParamMap, null, null, parentFormData).then((openPageParams) => {
|
|
235
|
+
console.log('clickHyperLink--openPageParams===', openPageParams)
|
|
236
|
+
if (openPageParams) {
|
|
237
|
+
// 点击列表组件中某元素弹出的页面
|
|
238
|
+
openPageParams._position = 'list'
|
|
239
|
+
openPageParams._listCode = listCode
|
|
240
|
+
openPageParams._rowIndex = rowIndex
|
|
241
|
+
// 行编辑的记录
|
|
242
|
+
openPageParams.row = row
|
|
243
|
+
// 通知父页面弹出页面
|
|
244
|
+
this.$emit('open-page', openPageParams)
|
|
245
|
+
}
|
|
246
|
+
})
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
export default customFormatter
|