olp-table 5.3.1 → 5.3.4
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/.env.build +1 -0
- package/README.md +26 -0
- package/babel.config.js +5 -0
- package/jsconfig.json +22 -0
- package/{olp-table.common.js → olp-table/olp-table.common.js} +5 -5
- package/{olp-table.umd.js → olp-table/olp-table.umd.js} +5 -5
- package/{olp-table.umd.min.js → olp-table/olp-table.umd.min.js} +3 -3
- package/package.json +92 -12
- package/public/favicon.ico +0 -0
- package/public/index.html +17 -0
- package/rmMode.bat +1 -0
- package/src/App.vue +199 -0
- package/src/api/crud.js +22 -0
- package/src/api/dist.js +6 -0
- package/src/assets/iconfont/iconfont.css +20 -0
- package/src/assets/iconfont/iconfont.json +16 -0
- package/src/assets/iconfont/iconfont.ttf +0 -0
- package/src/assets/iconfont/iconfont.woff +0 -0
- package/src/assets/iconfont/iconfont.woff2 +0 -0
- package/src/assets/logo.png +0 -0
- package/src/components/auto-height/index.vue +75 -0
- package/src/components/codemirror-tag.vue +100 -0
- package/src/components/lazy-load-select.vue +107 -0
- package/src/components/ol-dialog-excel.vue +112 -0
- package/src/components/ol-dialog-import.vue +304 -0
- package/src/components/ol-dialog-json.vue +82 -0
- package/src/components/ol-dialog-table.vue +81 -0
- package/src/components/ol-dialog-upload-file.vue +208 -0
- package/src/components/ol-dict-tag.vue +271 -0
- package/src/components/ol-select-dom.vue +71 -0
- package/src/components/ol-table-filter.vue +28 -0
- package/src/components/ol-table-render.vue +44 -0
- package/src/components/ol-table-select.vue +150 -0
- package/src/components/pinia-init.vue +18 -0
- package/src/components/table/model/ModelMixins.js +43 -0
- package/src/components/table/model/model-index.vue +121 -0
- package/src/components/table/model/ot-left-right.vue +18 -0
- package/src/components/table/model/ot-left-tree-right-table.scss +14 -0
- package/src/components/table/model/ot-left-tree-right-table.vue +41 -0
- package/src/components/table/model/ot-top-1-bottom-2.vue +39 -0
- package/src/components/table/model/ot-top-2-bottom-1.vue +38 -0
- package/src/components/table/model/ot-top-2-bottom-2.vue +38 -0
- package/src/components/table/model/ot-top-bottom.vue +18 -0
- package/src/components/table/model/splitpanesModel.css +22 -0
- package/src/components/table/model/splitpanesModel.vue +54 -0
- package/src/components/table/ol-form/index.vue +537 -0
- package/src/components/table/ol-form-v3/index.vue +455 -0
- package/src/components/table/ol-main-form-sub-table/index.vue +601 -0
- package/src/components/table/ol-pager/index.vue +46 -0
- package/src/components/table/ol-table/components/ol-table-column-config/columnIndex.vue +233 -0
- package/src/components/table/ol-table/components/ol-table-column-config/index.vue +145 -0
- package/src/components/table/ol-table/components/ol-table-column-dict-color/index.vue +88 -0
- package/src/components/table/ol-table/index.vue +232 -0
- package/src/components/table/ol-table-operate/index.vue +61 -0
- package/src/components/table/ol-table-search/index.vue +17 -0
- package/src/components/table/ol-table-tool-btn/index.vue +60 -0
- package/src/components/tree/components/o-tree.vue +289 -0
- package/src/components/tree/index.vue +46 -0
- package/src/components/v-component/index.vue +43 -0
- package/src/config/dev-config.js +5 -0
- package/src/config/prod-config.js +5 -0
- package/src/config/shared-config.js +20 -0
- package/src/data.js +9378 -0
- package/src/directives/permission/hasPermi.js +63 -0
- package/src/directives/permission/hasRole.js +30 -0
- package/src/main.js +55 -0
- package/src/mixins/VTMixin/DefaultMethods.js +749 -0
- package/src/mixins/VTMixin/OTMixinBody.js +105 -0
- package/src/mixins/VTMixin/OTMixinBodyFooter.js +93 -0
- package/src/mixins/VTMixin/OTMixinBodyMethods.js +420 -0
- package/src/mixins/VTMixin/OTMixinColumnMethod.js +450 -0
- package/src/mixins/VTMixin/OTMixinInitMethod.js +130 -0
- package/src/mixins/VTMixin/OTMixinPager.js +38 -0
- package/src/mixins/VTMixin/OTMixinSortable.js +43 -0
- package/src/mixins/VTMixin/index.js +18 -0
- package/src/package/index.js +20 -0
- package/src/plugins/axios.js +61 -0
- package/src/store/dict.js +76 -0
- package/src/store/dictType.js +52 -0
- package/src/store/permi.js +45 -0
- package/src/styles/common.scss +37 -0
- package/src/styles/index.scss +48 -0
- package/src/styles/theme.scss +32 -0
- package/src/utils/AESCRUDUtils.js +87 -0
- package/src/utils/DateUtils.js +35 -0
- package/src/utils/ExcelUtil.js +159 -0
- package/src/utils/TableSortUtil.js +91 -0
- package/src/utils/columnProp.js +3 -0
- package/src/utils/groupCompute.js +68 -0
- package/src/utils/http/httpFactory.js +92 -0
- package/src/utils/http/httpFactory2.js +79 -0
- package/src/utils/http/httpUtil.js +123 -0
- package/src/utils/http/httpUtils.js +38 -0
- package/src/utils/loadStyle.js +14 -0
- package/src/utils/message.js +56 -0
- package/src/utils/object.js +80 -0
- package/src/utils/security/TokenUtil.js +19 -0
- package/src/utils/tree.js +54 -0
- package/src/utils/util.js +127 -0
- package/src/views/Test/index.vue +77 -0
- package/src/views/Test/index2.vue +33 -0
- package/src/views/components/btn-config/index.vue +202 -0
- package/src/views/components/option-config/index.vue +192 -0
- package/src/views/db/chineseToEnglish.vue +127 -0
- package/src/views/db/filed.vue +395 -0
- package/src/views/db/index.vue +192 -0
- package/src/views/db/preview/index.vue +139 -0
- package/src/views/db/preview/left.vue +204 -0
- package/src/views/db/preview/right.vue +466 -0
- package/src/views/groupTable/index.vue +137 -0
- package/src/views/groupTable/ol-table-column-config/columnIndex.vue +194 -0
- package/src/views/groupTable/ol-table-column-config/index.vue +92 -0
- package/src/views/table/add-or-edit/config/base-config/index.vue +539 -0
- package/src/views/table/add-or-edit/config/base-config/table-form.vue +333 -0
- package/src/views/table/add-or-edit/config/column-config/header-config.vue +475 -0
- package/src/views/table/add-or-edit/config/column-config/index.vue +790 -0
- package/src/views/table/add-or-edit/config/data/column.js +218 -0
- package/src/views/table/add-or-edit/config/data/crud.js +122 -0
- package/src/views/table/add-or-edit/config/data/events.js +109 -0
- package/src/views/table/add-or-edit/config/data/method.js +127 -0
- package/src/views/table/add-or-edit/config/data/option.js +725 -0
- package/src/views/table/add-or-edit/config/data/page.js +79 -0
- package/src/views/table/add-or-edit/config/field-config/filed-config-table.vue +42 -0
- package/src/views/table/add-or-edit/config/field-config/index.vue +91 -0
- package/src/views/table/add-or-edit/config/form-config/index.vue +1179 -0
- package/src/views/table/add-or-edit/config/index.vue +376 -0
- package/src/views/table/add-or-edit/config/initFormObject.js +25 -0
- package/src/views/table/add-or-edit/config/script-config/LeftMeun.vue +71 -0
- package/src/views/table/add-or-edit/config/script-config/index.vue +70 -0
- package/src/views/table/add-or-edit/config/table-config/btn-config.vue +340 -0
- package/src/views/table/add-or-edit/config/table-config/btn-sort.vue +132 -0
- package/src/views/table/add-or-edit/config/table-config/index.vue +446 -0
- package/src/views/table/add-or-edit/configOld/dataTags/filed-config-table-model.vue +41 -0
- package/src/views/table/add-or-edit/configOld/dataTags/filed-config.vue +74 -0
- package/src/views/table/add-or-edit/configOld/dataTags/index.vue +439 -0
- package/src/views/table/add-or-edit/configOld/dataTags/set-table-sql.vue +79 -0
- package/src/views/table/add-or-edit/configOld/dataTags/table-on-config.vue +74 -0
- package/src/views/table/add-or-edit/configOld/index.vue +127 -0
- package/src/views/table/add-or-edit/configOld/tableTags/columnConfig.js +5 -0
- package/src/views/table/add-or-edit/configOld/tableTags/index.vue +353 -0
- package/src/views/table/add-or-edit/configOld/tableTags/operation-but-config.vue +75 -0
- package/src/views/table/add-or-edit/configOld/tableTags/tool-but-config.vue +92 -0
- package/src/views/table/add-or-edit/index.vue +201 -0
- package/src/views/table/add-or-edit/themeModel/index.vue +53 -0
- package/src/views/table/add-or-edit/themeModel/init-model-table.vue +48 -0
- package/src/views/table/add-or-edit/themeModel/init-model.vue +81 -0
- package/src/views/table/add-or-edit/themeModel/left-right.vue +24 -0
- package/src/views/table/add-or-edit/themeModel/left-tree-right-table.vue +75 -0
- package/src/views/table/add-or-edit/themeModel/olTableSearchModelMixins.js +42 -0
- package/src/views/table/add-or-edit/themeModel/splitpanesThemeModel.vue +49 -0
- package/src/views/table/add-or-edit/themeModel/top-1-bottom-2.vue +29 -0
- package/src/views/table/add-or-edit/themeModel/top-2-bottom-1.vue +32 -0
- package/src/views/table/add-or-edit/themeModel/top-2-bottom-2.vue +32 -0
- package/src/views/table/add-or-edit/themeModel/top-bottom.vue +14 -0
- package/src/views/table/index.vue +43 -0
- package/src/views/table/index2.vue +199 -0
- package/src/views/table/preview/index.vue +29 -0
- package/src/views/tree/components/config-core-data.vue +85 -0
- package/src/views/tree/components/config-core-table.vue +362 -0
- package/src/views/tree/components/config-core-tree/data/events.js +95 -0
- package/src/views/tree/components/config-core-tree/data/option.js +88 -0
- package/src/views/tree/components/config-core-tree/data/prop.js +28 -0
- package/src/views/tree/components/config-core-tree/index.vue +181 -0
- package/src/views/tree/components/config-core.vue +42 -0
- package/src/views/tree/components/form-config/index.vue +967 -0
- package/src/views/tree/index.vue +424 -0
- package/vue.config.js +44 -0
- /package/{demo.html → olp-table/demo.html} +0 -0
- /package/{fonts → olp-table/fonts}/iconfont.1720006583309.7e4906d9.woff +0 -0
- /package/{fonts → olp-table/fonts}/iconfont.1720006583309.947a27f0.ttf +0 -0
- /package/{olp-table.css → olp-table/olp-table.css} +0 -0
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-dialog
|
|
3
|
+
v-model="show"
|
|
4
|
+
title="配置中心"
|
|
5
|
+
width="90%"
|
|
6
|
+
style="height: 600px;"
|
|
7
|
+
align-center
|
|
8
|
+
>
|
|
9
|
+
<vxe-grid v-bind="gridOptions" ref="vexGridRef">
|
|
10
|
+
<template #toolbar_buttons>
|
|
11
|
+
<vxe-button status="success" @click="saveEvent">保存表头</vxe-button>
|
|
12
|
+
<vxe-button status="success" @click="delEvent">取消上级表头</vxe-button>
|
|
13
|
+
</template>
|
|
14
|
+
<!-- 通用多选框 -->
|
|
15
|
+
<template #checkedBox_header="{ column }">
|
|
16
|
+
<div style="display: flex;align-items: center;">
|
|
17
|
+
<el-checkbox v-model="column.params.all" @change="checkBoxClick(column,)"
|
|
18
|
+
:disabled="column.params.all == true && column.params.disabled == 'sss'"><span
|
|
19
|
+
style="margin-left: 5px;">{{ column.title }} </span></el-checkbox>
|
|
20
|
+
<i v-if="column.children" class="vxe-icon-edit"
|
|
21
|
+
@click="menuClickEvent({menu:'edit',column: column})"/>
|
|
22
|
+
<i v-if="column.children" class="vxe-icon-add"
|
|
23
|
+
@click="menuClickEvent({menu:'add',column: column})"/>
|
|
24
|
+
<i v-if="column.children" class="vxe-icon-delete"
|
|
25
|
+
@click="menuClickEvent({menu:'del',column: column})"/>
|
|
26
|
+
<i v-else-if="column.params.parentField" class="vxe-icon-delete"
|
|
27
|
+
@click="menuClickEvent({menu:'oneDel',column: column})"/>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
</vxe-grid>
|
|
31
|
+
<div v-if="gridOptions.selectedColumns.length >= 1">
|
|
32
|
+
<span>表头信息</span>
|
|
33
|
+
<el-form style="margin-top: 20px" :model="gridOptions.form" label-width="80px">
|
|
34
|
+
<el-form-item label="表头名称" prop="title" :span="24">
|
|
35
|
+
<el-input v-model="gridOptions.form.title"/>
|
|
36
|
+
</el-form-item>
|
|
37
|
+
</el-form>
|
|
38
|
+
</div>
|
|
39
|
+
<template #footer>
|
|
40
|
+
<span>
|
|
41
|
+
<vxe-button @click="close">取消</vxe-button>
|
|
42
|
+
<vxe-button status="primary" @click="save(true)">保存</vxe-button>
|
|
43
|
+
</span>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<el-dialog v-model="showPopup" title="表头信息" :width="600" :height="300" show-zoom>
|
|
47
|
+
<el-form style="margin-top: 20px" :model="gridOptions.form" label-width="80px">
|
|
48
|
+
<el-form-item label="表头名称" prop="title" :span="24">
|
|
49
|
+
<el-input v-model="gridOptions.form.title"/>
|
|
50
|
+
</el-form-item>
|
|
51
|
+
</el-form>
|
|
52
|
+
<template #footer>
|
|
53
|
+
<span>
|
|
54
|
+
<vxe-button @click="editClose">取消</vxe-button>
|
|
55
|
+
<vxe-button status="primary" @click="editSave(true)">保存</vxe-button>
|
|
56
|
+
</span>
|
|
57
|
+
</template>
|
|
58
|
+
</el-dialog>
|
|
59
|
+
|
|
60
|
+
</el-dialog>
|
|
61
|
+
</template>
|
|
62
|
+
<script setup>
|
|
63
|
+
import {ref, reactive, defineExpose, nextTick, onMounted} from "vue"
|
|
64
|
+
import {storeDict} from "@/store/dict";
|
|
65
|
+
import {useMessage} from "@/utils/message";
|
|
66
|
+
|
|
67
|
+
const show = ref(false)
|
|
68
|
+
const formShow = ref(false)
|
|
69
|
+
const showPopup = ref(false)
|
|
70
|
+
const vexGridRef = ref()
|
|
71
|
+
const dict = storeDict();
|
|
72
|
+
// 子组件调用父组件
|
|
73
|
+
const emits = defineEmits(['headerCommit']) //声明 emits
|
|
74
|
+
const close = () => {
|
|
75
|
+
show.value = false
|
|
76
|
+
}
|
|
77
|
+
const save = () => {
|
|
78
|
+
let columns = gridOptions.columns;
|
|
79
|
+
let rows = getColumns(columns)
|
|
80
|
+
console.log('rows:', JSON.stringify(rows))
|
|
81
|
+
emits('ok', {
|
|
82
|
+
groupColumns: rows
|
|
83
|
+
})
|
|
84
|
+
close()
|
|
85
|
+
}
|
|
86
|
+
const getColumns = (columns) => {
|
|
87
|
+
let rows = []
|
|
88
|
+
for (const column of columns) {
|
|
89
|
+
let row = {
|
|
90
|
+
id: column.id,
|
|
91
|
+
field: column.field,
|
|
92
|
+
title: column.title
|
|
93
|
+
}
|
|
94
|
+
if (column.children) {
|
|
95
|
+
row.children = getColumns(column.children)
|
|
96
|
+
}
|
|
97
|
+
rows.push(row)
|
|
98
|
+
}
|
|
99
|
+
return rows;
|
|
100
|
+
}
|
|
101
|
+
const editClose = () => {
|
|
102
|
+
showPopup.value = false
|
|
103
|
+
}
|
|
104
|
+
const editSave = () => {
|
|
105
|
+
let columns = gridOptions.columns;
|
|
106
|
+
setColumnTitle(columns)
|
|
107
|
+
showPopup.value = false
|
|
108
|
+
vexGridRef.value.loadColumn(gridOptions.columns)
|
|
109
|
+
}
|
|
110
|
+
const setColumnTitle = (columns) => {
|
|
111
|
+
for (let col of columns) {
|
|
112
|
+
if (col.field == gridOptions.form.field) {
|
|
113
|
+
col.title = gridOptions.form.title
|
|
114
|
+
gridOptions.form.title = ''
|
|
115
|
+
} else if (col.children) {
|
|
116
|
+
setColumnTitle(col.children)
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
const clearCheckAll = (columns) => {
|
|
121
|
+
gridOptions.selectedColumns = []
|
|
122
|
+
for (const column of columns) {
|
|
123
|
+
if (column.params.all == true) {
|
|
124
|
+
column.params.all = false
|
|
125
|
+
}
|
|
126
|
+
if (column.children) {
|
|
127
|
+
clearCheckAll(column.children)
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
vexGridRef.value.loadColumn(gridOptions.columns)
|
|
131
|
+
}
|
|
132
|
+
const menuClickEvent = ({menu, column}) => {
|
|
133
|
+
// eslint-disable-next-line no-case-declarations
|
|
134
|
+
let columns = gridOptions.columns;
|
|
135
|
+
switch (menu) {
|
|
136
|
+
case 'edit':
|
|
137
|
+
if (!column.children) {
|
|
138
|
+
useMessage().error("当前表头不可以编辑!")
|
|
139
|
+
return
|
|
140
|
+
}
|
|
141
|
+
gridOptions.form = column
|
|
142
|
+
showPopup.value = true
|
|
143
|
+
break
|
|
144
|
+
case 'del':
|
|
145
|
+
let rows = del(column, columns)
|
|
146
|
+
if (rows && rows.length >= 1) {
|
|
147
|
+
columns.push(...rows)
|
|
148
|
+
}
|
|
149
|
+
break
|
|
150
|
+
case 'add' :
|
|
151
|
+
// eslint-disable-next-line no-case-declarations
|
|
152
|
+
let addColumns = []
|
|
153
|
+
addDel(column, columns, addColumns)
|
|
154
|
+
if (addColumns && addColumns.length >= 1) {
|
|
155
|
+
addChildren(column, columns, addColumns)
|
|
156
|
+
}
|
|
157
|
+
delTableFieldNull(columns)
|
|
158
|
+
break
|
|
159
|
+
case 'oneDel' :
|
|
160
|
+
// eslint-disable-next-line no-case-declarations
|
|
161
|
+
let addColumns1 = []
|
|
162
|
+
oneDel(column, columns, addColumns1)
|
|
163
|
+
if (addColumns1 && addColumns1.length >= 1) {
|
|
164
|
+
columns.push(...addColumns1)
|
|
165
|
+
}
|
|
166
|
+
delTableFieldNull(columns)
|
|
167
|
+
gridOptions.columns.sort((a, b) => a.sort - b.sort);
|
|
168
|
+
break
|
|
169
|
+
}
|
|
170
|
+
clearCheckAll(gridOptions.columns)
|
|
171
|
+
}
|
|
172
|
+
const oneDel = (column, columns, addColumns) => {
|
|
173
|
+
for (let i = 0; i < columns.length; i++) {
|
|
174
|
+
let row = columns[i]
|
|
175
|
+
if (column.field == row.field) {
|
|
176
|
+
row.params.parentField = undefined
|
|
177
|
+
addColumns.push(row)
|
|
178
|
+
columns.splice(i, 1)
|
|
179
|
+
return
|
|
180
|
+
}
|
|
181
|
+
if (row.children) {
|
|
182
|
+
oneDel(column, row.children, addColumns)
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
// 往分组表头加入标题
|
|
187
|
+
const addDel = (column, columns, addColumns) => {
|
|
188
|
+
for (let i = 0; i < columns.length; i++) {
|
|
189
|
+
let row = columns[i]
|
|
190
|
+
if (!row.children && row.params.all == true) {
|
|
191
|
+
row.params.parentField = undefined
|
|
192
|
+
addColumns.push(row)
|
|
193
|
+
columns.splice(i, 1)
|
|
194
|
+
--i
|
|
195
|
+
continue
|
|
196
|
+
}
|
|
197
|
+
if (row.children) {
|
|
198
|
+
addDel(column, row.children, addColumns)
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
const delTableFieldNull = (columns) => {
|
|
203
|
+
for (let i = 0; i < columns.length; i++) {
|
|
204
|
+
let row = columns[i]
|
|
205
|
+
if (!row.tableField && (!row.children || row.children.length == 0)) {
|
|
206
|
+
columns.splice(i, 1)
|
|
207
|
+
--i
|
|
208
|
+
continue
|
|
209
|
+
}
|
|
210
|
+
if (row.children) {
|
|
211
|
+
delTableFieldNull(row.children)
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
const addChildren = (column, columns, addColumns) => {
|
|
216
|
+
for (let i = 0; i < columns.length; i++) {
|
|
217
|
+
let row = columns[i]
|
|
218
|
+
// 当前加入表头
|
|
219
|
+
if (row.field == column.field) {
|
|
220
|
+
row.children.push(...addColumns)
|
|
221
|
+
return
|
|
222
|
+
}
|
|
223
|
+
if (row.children) {
|
|
224
|
+
addChildren(column, row.children, addColumns)
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
}
|
|
229
|
+
// 当前 模板
|
|
230
|
+
const del = (column, columns) => {
|
|
231
|
+
for (let i = 0; i < columns.length; i++) {
|
|
232
|
+
let row = columns[i]
|
|
233
|
+
if (row.field == column.field) {
|
|
234
|
+
columns.splice(i, 1)
|
|
235
|
+
return row.children;
|
|
236
|
+
}
|
|
237
|
+
if (row.children) {
|
|
238
|
+
let rows = del(column, row.children);
|
|
239
|
+
if (rows && rows.length >= 1) {
|
|
240
|
+
row.children.push(...rows)
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
const del1 = (column) => {
|
|
246
|
+
// eslint-disable-next-line no-case-declarations
|
|
247
|
+
let columns = column.children;
|
|
248
|
+
// eslint-disable-next-line no-case-declarations
|
|
249
|
+
let addColumns = []
|
|
250
|
+
for (let i = 0; i < columns.length; i++) {
|
|
251
|
+
let row = columns[i]
|
|
252
|
+
if (row.params.all != true) {
|
|
253
|
+
addColumns.push(row)
|
|
254
|
+
columns.splice(i, 1)
|
|
255
|
+
--i;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
let rows = gridOptions.columns;
|
|
259
|
+
for (let i = 0; i < rows.length; i++) {
|
|
260
|
+
let row = rows[i]
|
|
261
|
+
if (row.field == column.field) {
|
|
262
|
+
row.children = columns
|
|
263
|
+
rows.splice(i + 1, 0, ...addColumns)
|
|
264
|
+
break
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
const delChildren = (columns, column) => {
|
|
270
|
+
for (let i = 0; i < columns.length; i++) {
|
|
271
|
+
let col = columns[i];
|
|
272
|
+
if (column.field == col.field) {
|
|
273
|
+
columns.splice(i, 1)
|
|
274
|
+
break
|
|
275
|
+
}
|
|
276
|
+
if (col.children) {
|
|
277
|
+
delChildren(col.children, column)
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
const delEvent = () => {
|
|
282
|
+
let columns = gridOptions.columns;
|
|
283
|
+
let addColumns = []
|
|
284
|
+
let column = {}
|
|
285
|
+
addDel(column, columns, addColumns)
|
|
286
|
+
columns.push(...addColumns)
|
|
287
|
+
delTableFieldNull(columns)
|
|
288
|
+
clearCheckAll(gridOptions.columns)
|
|
289
|
+
gridOptions.columns.sort((a, b) => a.sort - b.sort);
|
|
290
|
+
}
|
|
291
|
+
const saveEvent = () => {
|
|
292
|
+
let column = getColumn();
|
|
293
|
+
column.title = gridOptions.form.title
|
|
294
|
+
gridOptions.form.title = ''
|
|
295
|
+
const uuid = require('uuid');
|
|
296
|
+
const uniqueId = uuid.v4();
|
|
297
|
+
column.field = uniqueId
|
|
298
|
+
let rows = []
|
|
299
|
+
let columns = JSON.parse(JSON.stringify(gridOptions.columns));
|
|
300
|
+
|
|
301
|
+
let start = -1;
|
|
302
|
+
// for (let i = 0; i < columns.length; i++) {
|
|
303
|
+
// let row = columns[i];
|
|
304
|
+
// if (row.params.all == true) {
|
|
305
|
+
// row.params.disabled = true
|
|
306
|
+
// row.params.parentField = column.field
|
|
307
|
+
// rows.push(row)
|
|
308
|
+
// columns.splice(i, 1)
|
|
309
|
+
// if (start < i) {
|
|
310
|
+
// start = i;
|
|
311
|
+
// }
|
|
312
|
+
// i = i - 1
|
|
313
|
+
// }
|
|
314
|
+
// }
|
|
315
|
+
column.children = []
|
|
316
|
+
gridOptions.hasAdd = true
|
|
317
|
+
getSelectedColumn(columns, column);
|
|
318
|
+
// column.children = rows
|
|
319
|
+
// columns.splice(start, 0, column)
|
|
320
|
+
gridOptions.columns = columns
|
|
321
|
+
vexGridRef.value.loadColumn(columns)
|
|
322
|
+
formShow.value = false
|
|
323
|
+
showPopup.value = false
|
|
324
|
+
clearCheckAll(gridOptions.columns)
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function getSelectedColumn(columns, column) {
|
|
328
|
+
for (let i = 0; i < columns.length; i++) {
|
|
329
|
+
let row = columns[i];
|
|
330
|
+
// 把子表头赋值给父表头
|
|
331
|
+
if (row.params.all == true) {
|
|
332
|
+
row.params.disabled = true
|
|
333
|
+
row.params.all = false
|
|
334
|
+
row.params.parentField = column.field
|
|
335
|
+
column.children.push(row)
|
|
336
|
+
// 删除表头信息
|
|
337
|
+
columns.splice(i, 1)
|
|
338
|
+
if (gridOptions.hasAdd) {
|
|
339
|
+
gridOptions.hasAdd = false
|
|
340
|
+
// 添加表头信息
|
|
341
|
+
columns.splice(i, 0, column)
|
|
342
|
+
}
|
|
343
|
+
--i;
|
|
344
|
+
}
|
|
345
|
+
if (row.children) {
|
|
346
|
+
getSelectedColumn(row.children, column)
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function setColumn(columns) {
|
|
352
|
+
if (!columns) {
|
|
353
|
+
return
|
|
354
|
+
}
|
|
355
|
+
gridOptions.selectedColumns = []
|
|
356
|
+
nextTick(() => {
|
|
357
|
+
show.value = true;
|
|
358
|
+
showPopup.value = false
|
|
359
|
+
columns = JSON.parse(JSON.stringify(columns));
|
|
360
|
+
// table_fixed
|
|
361
|
+
columns = addColumnSlots(columns)
|
|
362
|
+
gridOptions.columns = columns
|
|
363
|
+
// arr = addColumnSlots(arr)
|
|
364
|
+
// gridOptions.columns = arr
|
|
365
|
+
//vexGridRef.value.loadColumn(gridOptions.columns)
|
|
366
|
+
})
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
const addColumnSlots = (rows) => {
|
|
370
|
+
let columns = []
|
|
371
|
+
for (let row of rows) {
|
|
372
|
+
if (row.visible == '0') {
|
|
373
|
+
continue
|
|
374
|
+
}
|
|
375
|
+
if (row.fixed) {
|
|
376
|
+
row.fixed = getDictLabelByValue('table_fixed', row.fixed)
|
|
377
|
+
}
|
|
378
|
+
row = Object.assign({}, getColumn(), row)
|
|
379
|
+
row.minWidth = row.width
|
|
380
|
+
columns.push(row)
|
|
381
|
+
if (row.children) {
|
|
382
|
+
row.tableField = undefined
|
|
383
|
+
row.children = addColumnSlots(row.children)
|
|
384
|
+
continue
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
return columns
|
|
388
|
+
}
|
|
389
|
+
const getColumn = () => {
|
|
390
|
+
return {
|
|
391
|
+
params: {
|
|
392
|
+
all: '0',
|
|
393
|
+
disabled: false
|
|
394
|
+
},
|
|
395
|
+
slots: {
|
|
396
|
+
header: 'checkedBox_header'
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
const checkBoxClick = (column) => {
|
|
401
|
+
formShow.value = column.params.all
|
|
402
|
+
gridOptions.selectedColumns = []
|
|
403
|
+
setSelectedColumns(gridOptions.columns)
|
|
404
|
+
}
|
|
405
|
+
const setSelectedColumns = (columns) => {
|
|
406
|
+
for (const row of columns) {
|
|
407
|
+
if (row.params.all == true) {
|
|
408
|
+
gridOptions.selectedColumns.push(row)
|
|
409
|
+
}
|
|
410
|
+
if (row.children) {
|
|
411
|
+
setSelectedColumns(row.children)
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
const getDisabled = (val) => {
|
|
416
|
+
if (val.params.all == true) {
|
|
417
|
+
return true
|
|
418
|
+
}
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
const getDictLabelByValue = (dictCode, val) => {
|
|
423
|
+
for (const option of dict.val(dictCode)) {
|
|
424
|
+
if (option.value == val) {
|
|
425
|
+
return option.label
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
return val
|
|
429
|
+
}
|
|
430
|
+
//表格配置项
|
|
431
|
+
const gridOptions = reactive({
|
|
432
|
+
border: true,
|
|
433
|
+
showHeaderOverflow: false,
|
|
434
|
+
height: 0,
|
|
435
|
+
align: "center",
|
|
436
|
+
columnConfig: {
|
|
437
|
+
resizable: true
|
|
438
|
+
},
|
|
439
|
+
toolbarConfig: {
|
|
440
|
+
slots: {
|
|
441
|
+
buttons: 'toolbar_buttons'
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
selectedColumns: [],
|
|
445
|
+
columns: [],
|
|
446
|
+
data: [],
|
|
447
|
+
form: {
|
|
448
|
+
title: ''
|
|
449
|
+
},
|
|
450
|
+
curColumnIndex: 0,
|
|
451
|
+
// 判断是否添加表头信息
|
|
452
|
+
hasAdd: true,
|
|
453
|
+
})
|
|
454
|
+
onMounted(() => {
|
|
455
|
+
setColumn()
|
|
456
|
+
})
|
|
457
|
+
// 对外暴露
|
|
458
|
+
defineExpose({
|
|
459
|
+
setColumn
|
|
460
|
+
})
|
|
461
|
+
</script>
|
|
462
|
+
<style>
|
|
463
|
+
.expand-wrapper {
|
|
464
|
+
padding: 20px;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
.test {
|
|
468
|
+
padding: 80px;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
.vxe-icon-edit, .vxe-icon-add, .vxe-icon-delete {
|
|
472
|
+
margin: 5px;
|
|
473
|
+
cursor: pointer
|
|
474
|
+
}
|
|
475
|
+
</style>
|