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,446 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<el-divider content-position="left">常用属性</el-divider>
|
|
4
|
+
<!-- <avue-form v-if="configDataSource.show" v-model="configData.form" :option="options">-->
|
|
5
|
+
<!-- </avue-form>-->
|
|
6
|
+
<table-form v-if="configDataSource.show" :formData="configData.form"></table-form>
|
|
7
|
+
<el-divider content-position="left">详细配置</el-divider>
|
|
8
|
+
<el-tabs
|
|
9
|
+
v-model="activeName"
|
|
10
|
+
type="card"
|
|
11
|
+
>
|
|
12
|
+
<el-tab-pane lazy label="Option" name="Option">
|
|
13
|
+
<OptionConfig :data-source="Option" :default-data="configData.form.tableObj"></OptionConfig>
|
|
14
|
+
</el-tab-pane>
|
|
15
|
+
<el-tab-pane lazy v-if="configData.form.paging == 1" label="Page" name="page">
|
|
16
|
+
<OptionConfig :data-source="Page"
|
|
17
|
+
:default-data="configData.form.optionObj.pagination"></OptionConfig>
|
|
18
|
+
</el-tab-pane>
|
|
19
|
+
<el-tab-pane lazy label="Events" name="events">
|
|
20
|
+
<OptionConfig :data-source="Events" :default-data="configData.form.optionObj.events"></OptionConfig>
|
|
21
|
+
</el-tab-pane>
|
|
22
|
+
<el-tab-pane lazy label="左工具按钮" name="toolbarBtn">
|
|
23
|
+
<btn-config ref="toolButOptions" alignMode="left" type="toolButOptions"/>
|
|
24
|
+
</el-tab-pane>
|
|
25
|
+
<el-tab-pane lazy label="操作按钮" name="actionbarBtn">
|
|
26
|
+
<btn-config ref="operationButOptions" type="operationButOptions"/>
|
|
27
|
+
</el-tab-pane>
|
|
28
|
+
|
|
29
|
+
<el-tab-pane lazy label="右工具按钮" name="righttoolbarBtn">
|
|
30
|
+
<btn-config ref="toolButOptions" alignMode="right" type="toolButOptions"/>
|
|
31
|
+
</el-tab-pane>
|
|
32
|
+
</el-tabs>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
<script>
|
|
36
|
+
export default {
|
|
37
|
+
name: 'TableConfig'
|
|
38
|
+
}
|
|
39
|
+
</script>
|
|
40
|
+
<script setup>
|
|
41
|
+
import events from "@/views/table/add-or-edit/config/data/events";
|
|
42
|
+
import page from "@/views/table/add-or-edit/config/data/page";
|
|
43
|
+
import option from "@/views/table/add-or-edit/config/data/option";
|
|
44
|
+
import OptionConfig from "@/views/components/option-config/index.vue";
|
|
45
|
+
import {inject, reactive, ref, defineExpose, defineEmits, nextTick, provide} from "vue";
|
|
46
|
+
import BtnConfig from "@/views/table/add-or-edit/config/table-config/btn-config.vue";
|
|
47
|
+
import tableForm from '@/views/table/add-or-edit/config/base-config/table-form.vue'
|
|
48
|
+
|
|
49
|
+
const configData = inject("configData")
|
|
50
|
+
provide('updateBtn', updateBtn)
|
|
51
|
+
const configDataSource = reactive({
|
|
52
|
+
toolButConfig: [],
|
|
53
|
+
operationButConfig: [],
|
|
54
|
+
show: false,
|
|
55
|
+
columns: [],
|
|
56
|
+
})
|
|
57
|
+
const options = reactive({
|
|
58
|
+
menuBtn: false,
|
|
59
|
+
gutter: 20,
|
|
60
|
+
labelWidth: 100,
|
|
61
|
+
labelPosition: 'right',
|
|
62
|
+
column: [
|
|
63
|
+
{
|
|
64
|
+
label: '分页',
|
|
65
|
+
type: 'switch',
|
|
66
|
+
prop: 'paging',
|
|
67
|
+
dicData: [{
|
|
68
|
+
value: '0'
|
|
69
|
+
}, {
|
|
70
|
+
value: '1'
|
|
71
|
+
}],
|
|
72
|
+
activeIcon: "el-icon-check",
|
|
73
|
+
inactiveIcon: "el-icon-close",
|
|
74
|
+
span: 3
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
label: '序号',
|
|
78
|
+
type: 'switch',
|
|
79
|
+
dicData: [{
|
|
80
|
+
value: '0'
|
|
81
|
+
}, {
|
|
82
|
+
value: '1'
|
|
83
|
+
}],
|
|
84
|
+
prop: 'seq',
|
|
85
|
+
activeIcon: "el-icon-check",
|
|
86
|
+
inactiveIcon: "el-icon-close",
|
|
87
|
+
value: true,
|
|
88
|
+
span: 3
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
label: '表格选择框',
|
|
92
|
+
type: 'radio',
|
|
93
|
+
prop: 'selectBox',
|
|
94
|
+
border: true,
|
|
95
|
+
span: 6,
|
|
96
|
+
dicData: [
|
|
97
|
+
{
|
|
98
|
+
label: '多选',
|
|
99
|
+
value: '2',
|
|
100
|
+
}, {
|
|
101
|
+
label: '单选',
|
|
102
|
+
value: '1'
|
|
103
|
+
}, {
|
|
104
|
+
label: '无',
|
|
105
|
+
value: '0'
|
|
106
|
+
}]
|
|
107
|
+
}, {
|
|
108
|
+
label: '工具栏按钮',
|
|
109
|
+
type: 'checkbox',
|
|
110
|
+
prop: 'toolBut',
|
|
111
|
+
border: true,
|
|
112
|
+
labelPosition: 'right',
|
|
113
|
+
span: 7,
|
|
114
|
+
props: {
|
|
115
|
+
label: 'name',
|
|
116
|
+
value: 'code',
|
|
117
|
+
},
|
|
118
|
+
onChange: () => {
|
|
119
|
+
nextTick(() => {
|
|
120
|
+
updateBtn('toolBut')
|
|
121
|
+
})
|
|
122
|
+
},
|
|
123
|
+
dicData: configDataSource.toolButConfig
|
|
124
|
+
}, {
|
|
125
|
+
label: '表格操作栏',
|
|
126
|
+
type: 'checkbox',
|
|
127
|
+
prop: 'operationBut',
|
|
128
|
+
border: true,
|
|
129
|
+
props: {
|
|
130
|
+
label: 'name',
|
|
131
|
+
value: 'code',
|
|
132
|
+
},
|
|
133
|
+
onChange: () => {
|
|
134
|
+
nextTick(() => {
|
|
135
|
+
updateBtn('operationBut')
|
|
136
|
+
})
|
|
137
|
+
},
|
|
138
|
+
span: 5,
|
|
139
|
+
dicData: configDataSource.operationButConfig
|
|
140
|
+
}, {
|
|
141
|
+
label: '首次自动查询',
|
|
142
|
+
type: 'switch',
|
|
143
|
+
prop: 'init',
|
|
144
|
+
dicData: [{
|
|
145
|
+
value: '0'
|
|
146
|
+
}, {
|
|
147
|
+
value: '1'
|
|
148
|
+
}],
|
|
149
|
+
span: 3,
|
|
150
|
+
activeIcon: "el-icon-check",
|
|
151
|
+
inactiveIcon: "el-icon-close"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
label: '树表',
|
|
155
|
+
type: 'switch',
|
|
156
|
+
prop: 'tree',
|
|
157
|
+
dicData: [{
|
|
158
|
+
value: '0'
|
|
159
|
+
}, {
|
|
160
|
+
value: '1'
|
|
161
|
+
}],
|
|
162
|
+
span: 3,
|
|
163
|
+
activeIcon: "el-icon-check",
|
|
164
|
+
inactiveIcon: "el-icon-close",
|
|
165
|
+
onChange: ({value}) => {
|
|
166
|
+
for (let column of options.column) {
|
|
167
|
+
if (['lazy', 'treeId', 'treeParentId', 'openColumn'].indexOf(column.prop) != -1) {
|
|
168
|
+
column.display = value == 1;
|
|
169
|
+
if (value == 1) {
|
|
170
|
+
initColumn()
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
/* {
|
|
177
|
+
label: 'lazy',
|
|
178
|
+
type: 'switch',
|
|
179
|
+
prop: 'lazy',
|
|
180
|
+
display: false,
|
|
181
|
+
activeIcon: "el-icon-check",
|
|
182
|
+
inactiveIcon: "el-icon-close",
|
|
183
|
+
inlinePrompt: true,
|
|
184
|
+
dicData: [{
|
|
185
|
+
value: '0'
|
|
186
|
+
}, {
|
|
187
|
+
value: '1'
|
|
188
|
+
}],
|
|
189
|
+
span: 3,
|
|
190
|
+
value: false,
|
|
191
|
+
onChange: ({value}) => {
|
|
192
|
+
for (let column of options.column) {
|
|
193
|
+
if (['lazyFunction'].indexOf(column.prop) != -1) {
|
|
194
|
+
column.display = value;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
},*/
|
|
199
|
+
{
|
|
200
|
+
label: '树ID',
|
|
201
|
+
prop: 'treeId',
|
|
202
|
+
type: 'select',
|
|
203
|
+
props: {
|
|
204
|
+
label: 'title',
|
|
205
|
+
value: 'field'
|
|
206
|
+
},
|
|
207
|
+
onFocus: initColumn,
|
|
208
|
+
display: false,
|
|
209
|
+
onChange: initColumn,
|
|
210
|
+
span: 5,
|
|
211
|
+
dicData: configDataSource.columns,
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
label: '树列父ID',
|
|
215
|
+
prop: 'treeParentId',
|
|
216
|
+
type: 'select',
|
|
217
|
+
props: {
|
|
218
|
+
label: 'title',
|
|
219
|
+
value: 'field'
|
|
220
|
+
},
|
|
221
|
+
display: false,
|
|
222
|
+
onFocus: initColumn,
|
|
223
|
+
dicData: configDataSource.columns,
|
|
224
|
+
span: 5,
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
label: '展开列',
|
|
228
|
+
prop: 'openColumn',
|
|
229
|
+
type: 'select',
|
|
230
|
+
display: false,
|
|
231
|
+
props: {
|
|
232
|
+
label: 'title',
|
|
233
|
+
value: 'field'
|
|
234
|
+
},
|
|
235
|
+
onFocus: initColumn,
|
|
236
|
+
dicData: configDataSource.columns,
|
|
237
|
+
span: 5,
|
|
238
|
+
},
|
|
239
|
+
/* {
|
|
240
|
+
label: 'lazy回调',
|
|
241
|
+
prop: 'lazyFunction',
|
|
242
|
+
type: 'input',
|
|
243
|
+
display: false,
|
|
244
|
+
span: 6,
|
|
245
|
+
},*/
|
|
246
|
+
]
|
|
247
|
+
})
|
|
248
|
+
|
|
249
|
+
const activeName = ref("Option");
|
|
250
|
+
const toolButOptions = ref();
|
|
251
|
+
const operationButOptions = ref();
|
|
252
|
+
const Page = reactive(JSON.parse(JSON.stringify(page)));
|
|
253
|
+
const Option = reactive(JSON.parse(JSON.stringify(option)));
|
|
254
|
+
const Events = reactive(JSON.parse(JSON.stringify(events)));
|
|
255
|
+
|
|
256
|
+
function initColumn(c) {
|
|
257
|
+
configDataSource.columns.length = 0
|
|
258
|
+
for (let column of JSON.parse(JSON.stringify(configData.tableColumn))) {
|
|
259
|
+
configDataSource.columns.push(column)
|
|
260
|
+
}
|
|
261
|
+
if (c && !configData.form['openColumn']) {
|
|
262
|
+
nextTick(() => {
|
|
263
|
+
configData.form['openColumn'] = configData.form['treeId']
|
|
264
|
+
})
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function updateBtn(type) {
|
|
269
|
+
if (!configData.form[type + 'Options']) {
|
|
270
|
+
return
|
|
271
|
+
}
|
|
272
|
+
var formElement = configData.form[type + 'Options'];
|
|
273
|
+
//删除
|
|
274
|
+
for (let i = formElement.length - 1; i >= 0; i--) {
|
|
275
|
+
let o = formElement[i];
|
|
276
|
+
if (configData.form[type].indexOf(o.code) == -1) {
|
|
277
|
+
formElement.splice(i, 1)
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
let key = formElement.map(item => item.code);
|
|
281
|
+
|
|
282
|
+
//新增
|
|
283
|
+
for (const o of configData[type + 'Config']) {
|
|
284
|
+
if (key.indexOf(o.code) == -1 && configData.form[type].indexOf(o.code) != -1) {
|
|
285
|
+
configData.form[type + 'Options'].push(o);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
if (type == 'toolBut' && toolButOptions.value) {
|
|
289
|
+
toolButOptions.value.loadData();
|
|
290
|
+
} else if (operationButOptions.value) {
|
|
291
|
+
operationButOptions.value.loadData();
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
const emits = defineEmits(['tableConfigChange'])
|
|
296
|
+
//
|
|
297
|
+
const buildJson = (data, defaultOption) => {
|
|
298
|
+
if (defaultOption == null) {
|
|
299
|
+
defaultOption = {}
|
|
300
|
+
}
|
|
301
|
+
let buildOption = defaultOption
|
|
302
|
+
for (let op of data) {
|
|
303
|
+
if (op.value != undefined) {
|
|
304
|
+
let prop = op.t1
|
|
305
|
+
if (op.redirect != null) {
|
|
306
|
+
prop = op.redirect
|
|
307
|
+
}
|
|
308
|
+
let subs = prop.split(".");
|
|
309
|
+
let parent = buildOption;
|
|
310
|
+
for (let i = 0; i < subs.length; i++) {
|
|
311
|
+
if (i < subs.length - 1) {
|
|
312
|
+
if (parent[subs[i]] == null) parent[subs[i]] = {}
|
|
313
|
+
parent = parent[subs[i]]
|
|
314
|
+
} else if (i >= subs.length - 1) {
|
|
315
|
+
if (op.value && (op.t3 == "string[]" || op.t3 == "number[]") && !(op.value instanceof Array)) {
|
|
316
|
+
op.value = op.value.replaceAll("'", '"')
|
|
317
|
+
op.value = JSON.parse(op.value)
|
|
318
|
+
}
|
|
319
|
+
if (op.t3 == 'function') {
|
|
320
|
+
if (op.value && op.value.toString().trim() != 0) {
|
|
321
|
+
parent[subs[i]] = {
|
|
322
|
+
code: op.value,
|
|
323
|
+
flag: "flag##function#",
|
|
324
|
+
isFunction: true
|
|
325
|
+
}
|
|
326
|
+
} else {
|
|
327
|
+
delete parent[subs[i]]
|
|
328
|
+
}
|
|
329
|
+
} else {
|
|
330
|
+
parent[subs[i]] = op.value
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
return buildOption
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
const getOptions = () => {
|
|
341
|
+
let buildOption = {}
|
|
342
|
+
buildOption.table = buildJson(Option, configData.form.optionObj.tableObj)
|
|
343
|
+
buildOption.pagination = buildJson(Page, configData.form.optionObj.pagination)
|
|
344
|
+
if (buildOption.pagination.pageSizes) {
|
|
345
|
+
let pageSizes = JSON.parse(JSON.stringify(buildOption.pagination.pageSizes));
|
|
346
|
+
buildOption.pagination.pageSize = pageSizes[0]
|
|
347
|
+
}
|
|
348
|
+
buildOption.events = buildJson(Events, configData.form.optionObj.events)
|
|
349
|
+
return buildOption
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
const copyParams = (option, data) => {
|
|
354
|
+
for (let item in option) {
|
|
355
|
+
let obj = option[item];
|
|
356
|
+
let sub = data[item]
|
|
357
|
+
if (obj instanceof Object && obj.isFunction && obj.flag == "flag##function#") {
|
|
358
|
+
data[item] = (params) => {
|
|
359
|
+
let fun = null
|
|
360
|
+
eval("fun = (params) => {" + obj.code + "}")
|
|
361
|
+
return fun(params)
|
|
362
|
+
}
|
|
363
|
+
continue
|
|
364
|
+
}
|
|
365
|
+
if (sub == null || sub == undefined) {
|
|
366
|
+
data[item] = obj
|
|
367
|
+
continue
|
|
368
|
+
}
|
|
369
|
+
if (obj instanceof Object && sub instanceof Object) {
|
|
370
|
+
copyParams(obj, sub)
|
|
371
|
+
} else {
|
|
372
|
+
data[item] = obj
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
// 初始化数据
|
|
379
|
+
const initData = (data, defaultData) => {
|
|
380
|
+
if (!defaultData) {
|
|
381
|
+
defaultData = {}
|
|
382
|
+
}
|
|
383
|
+
let defMap = parseRedirectObj(defaultData)
|
|
384
|
+
for (let item of data) {
|
|
385
|
+
let obj = defMap[item.redirect ? item.redirect : item.t1];
|
|
386
|
+
if (obj instanceof Array) {
|
|
387
|
+
obj = JSON.stringify(obj)
|
|
388
|
+
}
|
|
389
|
+
if (obj != null && !(obj instanceof Object)) {
|
|
390
|
+
item.value = obj
|
|
391
|
+
} else if (item.t5 != "-" && item.t3 != 'function') {
|
|
392
|
+
item.value = item.t5
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
function setData() {
|
|
398
|
+
configDataSource.show = false;
|
|
399
|
+
configDataSource.toolButConfig.length = 0;
|
|
400
|
+
for (const o of configData.toolButConfig) {
|
|
401
|
+
configDataSource.toolButConfig.push(o);
|
|
402
|
+
}
|
|
403
|
+
configDataSource.operationButConfig.length = 0;
|
|
404
|
+
for (const o of configData.operationButConfig) {
|
|
405
|
+
configDataSource.operationButConfig.push(o);
|
|
406
|
+
}
|
|
407
|
+
nextTick(() => {
|
|
408
|
+
configDataSource.show = true;
|
|
409
|
+
initData(Option, configData.form.tableObj)
|
|
410
|
+
initData(Page, configData.form.optionObj.pagination)
|
|
411
|
+
initData(Events, configData.form.optionObj.events)
|
|
412
|
+
updateBtn('toolBut')
|
|
413
|
+
updateBtn('operationBut')
|
|
414
|
+
})
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
// 平铺对象
|
|
418
|
+
const parseRedirectObj = (data, map, parent) => {
|
|
419
|
+
if (!map) map = {}
|
|
420
|
+
if (!parent) parent = ""
|
|
421
|
+
for (let key in data) {
|
|
422
|
+
let path = parent
|
|
423
|
+
if (parent != "") {
|
|
424
|
+
path = parent + "." + key
|
|
425
|
+
} else {
|
|
426
|
+
path = key
|
|
427
|
+
}
|
|
428
|
+
let obj = data[key]
|
|
429
|
+
if (obj instanceof Object) {
|
|
430
|
+
if (obj.isFunction && obj.flag == "flag##function#") {
|
|
431
|
+
map[path] = obj.code
|
|
432
|
+
continue
|
|
433
|
+
}
|
|
434
|
+
parseRedirectObj(obj, map, path)
|
|
435
|
+
} else {
|
|
436
|
+
map[path] = obj
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
return map
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
defineExpose({
|
|
444
|
+
getOptions, setData
|
|
445
|
+
})
|
|
446
|
+
</script>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div style="padding: 15px;flex: 1">
|
|
3
|
+
<h4 style="text-align: center">{{obj.joinTable}}({{obj.index}}-{{obj.type}})</h4>
|
|
4
|
+
<vxe-table height="300px" border :data="state.tableData" :stripe="true" size="small">
|
|
5
|
+
<vxe-column type="seq" title="序号" width="60" align="center"/>
|
|
6
|
+
<vxe-column field="checked" title="查询" width="60" align="center">
|
|
7
|
+
<template #default="scope">
|
|
8
|
+
<vxe-checkbox v-model="scope.row.checked" checked-value="1" @change="updateChecked(scope.row)" unchecked-value="0"></vxe-checkbox>
|
|
9
|
+
</template>
|
|
10
|
+
</vxe-column>
|
|
11
|
+
<vxe-column field="column_name" title="字段" align="center" show-overflow/>
|
|
12
|
+
<vxe-column field="column_comment" title="描述" align="center" show-overflow/>
|
|
13
|
+
</vxe-table>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
<script>
|
|
17
|
+
import {reactive, ref} from "vue";
|
|
18
|
+
export default {
|
|
19
|
+
name:'filedConfigTableModel',
|
|
20
|
+
props:{
|
|
21
|
+
item:{}
|
|
22
|
+
},
|
|
23
|
+
setup(prop) {
|
|
24
|
+
const dialogVisible = ref(true);
|
|
25
|
+
const state = reactive({
|
|
26
|
+
tableData:prop.item.columnList,
|
|
27
|
+
})
|
|
28
|
+
const obj = prop.item;
|
|
29
|
+
function updateChecked(e){
|
|
30
|
+
if (e.checked == 1) {
|
|
31
|
+
e.visible = '1';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return {dialogVisible,state,obj,updateChecked}
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
</script>
|
|
39
|
+
<style lang="less">
|
|
40
|
+
|
|
41
|
+
</style>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-dialog
|
|
3
|
+
v-model="dialogVisible"
|
|
4
|
+
:show-close="false"
|
|
5
|
+
title="字段配置"
|
|
6
|
+
width="800px"
|
|
7
|
+
resize
|
|
8
|
+
:overflow="true"
|
|
9
|
+
:before-hide-method="handleClose" showFooter>
|
|
10
|
+
<el-scrollbar>
|
|
11
|
+
<div style="display: flex;" v-if="dialogVisible">
|
|
12
|
+
<filed-config-table-model class="content-box" v-for="(item,index) in state.columnList" :ref="setItemRef" :item="item" style="min-width: 400px"/>
|
|
13
|
+
</div>
|
|
14
|
+
</el-scrollbar>
|
|
15
|
+
<template #footer>
|
|
16
|
+
<span>
|
|
17
|
+
<vxe-button @click="handleClose">取消</vxe-button>
|
|
18
|
+
<vxe-button status="primary" @click="handleClose(true)">保存</vxe-button>
|
|
19
|
+
</span>
|
|
20
|
+
</template>
|
|
21
|
+
</el-dialog>
|
|
22
|
+
</template>
|
|
23
|
+
<script>
|
|
24
|
+
import {onBeforeUpdate, reactive, ref, toRaw} from "vue";
|
|
25
|
+
import filedConfigTableModel from "./filed-config-table-model"
|
|
26
|
+
|
|
27
|
+
export default {
|
|
28
|
+
components: {filedConfigTableModel},
|
|
29
|
+
name: 'filedConfig',
|
|
30
|
+
setup(props, context) {
|
|
31
|
+
const dialogVisible = ref(false)
|
|
32
|
+
const state = reactive({
|
|
33
|
+
columnList: [],
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
function init(data) {
|
|
37
|
+
dialogVisible.value = true;
|
|
38
|
+
state.columnList = data;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const itemRefs = ref([]); // 储存获取的Dom元素或子组件实例
|
|
42
|
+
|
|
43
|
+
const setItemRef = (el) => {
|
|
44
|
+
if (el) {
|
|
45
|
+
itemRefs.value.push(el);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// 每次更新前把实例清空
|
|
50
|
+
onBeforeUpdate(() => {
|
|
51
|
+
itemRefs.value = [];
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
function handleClose(v) {
|
|
55
|
+
if (v === true) {
|
|
56
|
+
let data = {};
|
|
57
|
+
let itemRefsV = itemRefs.value;
|
|
58
|
+
for (let i = 0; i < itemRefsV.length; i++) {
|
|
59
|
+
let tableData = toRaw(itemRefsV[i].obj);
|
|
60
|
+
data[tableData.index] = tableData.columnList;
|
|
61
|
+
}
|
|
62
|
+
context.emit('close', data);
|
|
63
|
+
}
|
|
64
|
+
dialogVisible.value = false;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return {dialogVisible, state, init, handleClose, setItemRef}
|
|
68
|
+
},
|
|
69
|
+
methods: {}
|
|
70
|
+
}
|
|
71
|
+
</script>
|
|
72
|
+
<style lang="less">
|
|
73
|
+
|
|
74
|
+
</style>
|