olp-table 5.3.4 → 5.3.5
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/package.json +12 -92
- package/.env.build +0 -1
- package/README.md +0 -26
- package/babel.config.js +0 -5
- package/jsconfig.json +0 -22
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -17
- package/rmMode.bat +0 -1
- package/src/App.vue +0 -199
- package/src/api/crud.js +0 -22
- package/src/api/dist.js +0 -6
- package/src/assets/iconfont/iconfont.css +0 -20
- package/src/assets/iconfont/iconfont.json +0 -16
- 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 +0 -75
- package/src/components/codemirror-tag.vue +0 -100
- package/src/components/lazy-load-select.vue +0 -107
- package/src/components/ol-dialog-excel.vue +0 -112
- package/src/components/ol-dialog-import.vue +0 -304
- package/src/components/ol-dialog-json.vue +0 -82
- package/src/components/ol-dialog-table.vue +0 -81
- package/src/components/ol-dialog-upload-file.vue +0 -208
- package/src/components/ol-dict-tag.vue +0 -271
- package/src/components/ol-select-dom.vue +0 -71
- package/src/components/ol-table-filter.vue +0 -28
- package/src/components/ol-table-render.vue +0 -44
- package/src/components/ol-table-select.vue +0 -150
- package/src/components/pinia-init.vue +0 -18
- package/src/components/table/model/ModelMixins.js +0 -43
- package/src/components/table/model/model-index.vue +0 -121
- package/src/components/table/model/ot-left-right.vue +0 -18
- package/src/components/table/model/ot-left-tree-right-table.scss +0 -14
- package/src/components/table/model/ot-left-tree-right-table.vue +0 -41
- package/src/components/table/model/ot-top-1-bottom-2.vue +0 -39
- package/src/components/table/model/ot-top-2-bottom-1.vue +0 -38
- package/src/components/table/model/ot-top-2-bottom-2.vue +0 -38
- package/src/components/table/model/ot-top-bottom.vue +0 -18
- package/src/components/table/model/splitpanesModel.css +0 -22
- package/src/components/table/model/splitpanesModel.vue +0 -54
- package/src/components/table/ol-form/index.vue +0 -537
- package/src/components/table/ol-form-v3/index.vue +0 -455
- package/src/components/table/ol-main-form-sub-table/index.vue +0 -601
- package/src/components/table/ol-pager/index.vue +0 -46
- package/src/components/table/ol-table/components/ol-table-column-config/columnIndex.vue +0 -233
- package/src/components/table/ol-table/components/ol-table-column-config/index.vue +0 -145
- package/src/components/table/ol-table/components/ol-table-column-dict-color/index.vue +0 -88
- package/src/components/table/ol-table/index.vue +0 -232
- package/src/components/table/ol-table-operate/index.vue +0 -61
- package/src/components/table/ol-table-search/index.vue +0 -17
- package/src/components/table/ol-table-tool-btn/index.vue +0 -60
- package/src/components/tree/components/o-tree.vue +0 -289
- package/src/components/tree/index.vue +0 -46
- package/src/components/v-component/index.vue +0 -43
- package/src/config/dev-config.js +0 -5
- package/src/config/prod-config.js +0 -5
- package/src/config/shared-config.js +0 -20
- package/src/data.js +0 -9378
- package/src/directives/permission/hasPermi.js +0 -63
- package/src/directives/permission/hasRole.js +0 -30
- package/src/main.js +0 -55
- package/src/mixins/VTMixin/DefaultMethods.js +0 -749
- package/src/mixins/VTMixin/OTMixinBody.js +0 -105
- package/src/mixins/VTMixin/OTMixinBodyFooter.js +0 -93
- package/src/mixins/VTMixin/OTMixinBodyMethods.js +0 -420
- package/src/mixins/VTMixin/OTMixinColumnMethod.js +0 -450
- package/src/mixins/VTMixin/OTMixinInitMethod.js +0 -130
- package/src/mixins/VTMixin/OTMixinPager.js +0 -38
- package/src/mixins/VTMixin/OTMixinSortable.js +0 -43
- package/src/mixins/VTMixin/index.js +0 -18
- package/src/package/index.js +0 -20
- package/src/plugins/axios.js +0 -61
- package/src/store/dict.js +0 -76
- package/src/store/dictType.js +0 -52
- package/src/store/permi.js +0 -45
- package/src/styles/common.scss +0 -37
- package/src/styles/index.scss +0 -48
- package/src/styles/theme.scss +0 -32
- package/src/utils/AESCRUDUtils.js +0 -87
- package/src/utils/DateUtils.js +0 -35
- package/src/utils/ExcelUtil.js +0 -159
- package/src/utils/TableSortUtil.js +0 -91
- package/src/utils/columnProp.js +0 -3
- package/src/utils/groupCompute.js +0 -68
- package/src/utils/http/httpFactory.js +0 -92
- package/src/utils/http/httpFactory2.js +0 -79
- package/src/utils/http/httpUtil.js +0 -123
- package/src/utils/http/httpUtils.js +0 -38
- package/src/utils/loadStyle.js +0 -14
- package/src/utils/message.js +0 -56
- package/src/utils/object.js +0 -80
- package/src/utils/security/TokenUtil.js +0 -19
- package/src/utils/tree.js +0 -54
- package/src/utils/util.js +0 -127
- package/src/views/Test/index.vue +0 -77
- package/src/views/Test/index2.vue +0 -33
- package/src/views/components/btn-config/index.vue +0 -202
- package/src/views/components/option-config/index.vue +0 -192
- package/src/views/db/chineseToEnglish.vue +0 -127
- package/src/views/db/filed.vue +0 -395
- package/src/views/db/index.vue +0 -192
- package/src/views/db/preview/index.vue +0 -139
- package/src/views/db/preview/left.vue +0 -204
- package/src/views/db/preview/right.vue +0 -466
- package/src/views/groupTable/index.vue +0 -137
- package/src/views/groupTable/ol-table-column-config/columnIndex.vue +0 -194
- package/src/views/groupTable/ol-table-column-config/index.vue +0 -92
- package/src/views/table/add-or-edit/config/base-config/index.vue +0 -539
- package/src/views/table/add-or-edit/config/base-config/table-form.vue +0 -333
- package/src/views/table/add-or-edit/config/column-config/header-config.vue +0 -475
- package/src/views/table/add-or-edit/config/column-config/index.vue +0 -790
- package/src/views/table/add-or-edit/config/data/column.js +0 -218
- package/src/views/table/add-or-edit/config/data/crud.js +0 -122
- package/src/views/table/add-or-edit/config/data/events.js +0 -109
- package/src/views/table/add-or-edit/config/data/method.js +0 -127
- package/src/views/table/add-or-edit/config/data/option.js +0 -725
- package/src/views/table/add-or-edit/config/data/page.js +0 -79
- package/src/views/table/add-or-edit/config/field-config/filed-config-table.vue +0 -42
- package/src/views/table/add-or-edit/config/field-config/index.vue +0 -91
- package/src/views/table/add-or-edit/config/form-config/index.vue +0 -1179
- package/src/views/table/add-or-edit/config/index.vue +0 -376
- package/src/views/table/add-or-edit/config/initFormObject.js +0 -25
- package/src/views/table/add-or-edit/config/script-config/LeftMeun.vue +0 -71
- package/src/views/table/add-or-edit/config/script-config/index.vue +0 -70
- package/src/views/table/add-or-edit/config/table-config/btn-config.vue +0 -340
- package/src/views/table/add-or-edit/config/table-config/btn-sort.vue +0 -132
- package/src/views/table/add-or-edit/config/table-config/index.vue +0 -446
- package/src/views/table/add-or-edit/configOld/dataTags/filed-config-table-model.vue +0 -41
- package/src/views/table/add-or-edit/configOld/dataTags/filed-config.vue +0 -74
- package/src/views/table/add-or-edit/configOld/dataTags/index.vue +0 -439
- package/src/views/table/add-or-edit/configOld/dataTags/set-table-sql.vue +0 -79
- package/src/views/table/add-or-edit/configOld/dataTags/table-on-config.vue +0 -74
- package/src/views/table/add-or-edit/configOld/index.vue +0 -127
- package/src/views/table/add-or-edit/configOld/tableTags/columnConfig.js +0 -5
- package/src/views/table/add-or-edit/configOld/tableTags/index.vue +0 -353
- package/src/views/table/add-or-edit/configOld/tableTags/operation-but-config.vue +0 -75
- package/src/views/table/add-or-edit/configOld/tableTags/tool-but-config.vue +0 -92
- package/src/views/table/add-or-edit/index.vue +0 -201
- package/src/views/table/add-or-edit/themeModel/index.vue +0 -53
- package/src/views/table/add-or-edit/themeModel/init-model-table.vue +0 -48
- package/src/views/table/add-or-edit/themeModel/init-model.vue +0 -81
- package/src/views/table/add-or-edit/themeModel/left-right.vue +0 -24
- package/src/views/table/add-or-edit/themeModel/left-tree-right-table.vue +0 -75
- package/src/views/table/add-or-edit/themeModel/olTableSearchModelMixins.js +0 -42
- package/src/views/table/add-or-edit/themeModel/splitpanesThemeModel.vue +0 -49
- package/src/views/table/add-or-edit/themeModel/top-1-bottom-2.vue +0 -29
- package/src/views/table/add-or-edit/themeModel/top-2-bottom-1.vue +0 -32
- package/src/views/table/add-or-edit/themeModel/top-2-bottom-2.vue +0 -32
- package/src/views/table/add-or-edit/themeModel/top-bottom.vue +0 -14
- package/src/views/table/index.vue +0 -43
- package/src/views/table/index2.vue +0 -199
- package/src/views/table/preview/index.vue +0 -29
- package/src/views/tree/components/config-core-data.vue +0 -85
- package/src/views/tree/components/config-core-table.vue +0 -362
- package/src/views/tree/components/config-core-tree/data/events.js +0 -95
- package/src/views/tree/components/config-core-tree/data/option.js +0 -88
- package/src/views/tree/components/config-core-tree/data/prop.js +0 -28
- package/src/views/tree/components/config-core-tree/index.vue +0 -181
- package/src/views/tree/components/config-core.vue +0 -42
- package/src/views/tree/components/form-config/index.vue +0 -967
- package/src/views/tree/index.vue +0 -424
- package/vue.config.js +0 -44
- /package/{olp-table/demo.html → demo.html} +0 -0
- /package/{olp-table/fonts → fonts}/iconfont.1720006583309.7e4906d9.woff +0 -0
- /package/{olp-table/fonts → fonts}/iconfont.1720006583309.947a27f0.ttf +0 -0
- /package/{olp-table/olp-table.common.js → olp-table.common.js} +0 -0
- /package/{olp-table/olp-table.css → olp-table.css} +0 -0
- /package/{olp-table/olp-table.umd.js → olp-table.umd.js} +0 -0
- /package/{olp-table/olp-table.umd.min.js → olp-table.umd.min.js} +0 -0
|
@@ -1,790 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<vxe-grid v-if="show" v-bind="gridOptions" ref="vexGridRef"
|
|
4
|
-
:expand-config="{ labelField: 'seq' }"
|
|
5
|
-
resizable>
|
|
6
|
-
<template #toolbar_buttons>
|
|
7
|
-
<el-button @click="onAdd">新增列</el-button>
|
|
8
|
-
<el-button @click="headerConfigShow">多级表头配置</el-button>
|
|
9
|
-
<el-button @click="setGroupByMin">批量设置分组为SUM</el-button>
|
|
10
|
-
</template>
|
|
11
|
-
<template #seq="{ rowIndex}">
|
|
12
|
-
<vxe-button size="mini" style="padding:0" type="text">
|
|
13
|
-
<span class="vxe-icon-sort"/>{{ rowIndex + 1 }}
|
|
14
|
-
</vxe-button>
|
|
15
|
-
</template>
|
|
16
|
-
<template #label_filter="{ column, $panel }">
|
|
17
|
-
<input type="type" v-for="(option, index) in column.filters"
|
|
18
|
-
:key="index"
|
|
19
|
-
v-model="option.data"
|
|
20
|
-
@input="$panel.changeOption($event, !!option.data, option)"
|
|
21
|
-
@keyup.enter="enterFilterEvent({ column, $panel })">
|
|
22
|
-
</template>
|
|
23
|
-
<!-- 通用多选框 -->
|
|
24
|
-
<template #checkedBox_header="{ column }">
|
|
25
|
-
<div style="display: flex;align-items: center;">
|
|
26
|
-
<el-checkbox v-model="column.params.all" @change="headerClick(column)"></el-checkbox>
|
|
27
|
-
<span style="margin-left: 5px;">{{ column.title }} </span>
|
|
28
|
-
|
|
29
|
-
</div>
|
|
30
|
-
</template>
|
|
31
|
-
<template #checkedBox_default="{ column, row }">
|
|
32
|
-
<el-checkbox v-model="row[column.field]" true-value="1" false-value="0"
|
|
33
|
-
@change="checkBoxClick(column, row)"/>
|
|
34
|
-
</template>
|
|
35
|
-
<!-- 通用下拉框 -->
|
|
36
|
-
<template #select_default="{ column, row }">
|
|
37
|
-
<el-select filterable clearable v-model="row[column.field]"
|
|
38
|
-
placeholder="可搜索">
|
|
39
|
-
<el-option
|
|
40
|
-
v-for="item in dictType.val()"
|
|
41
|
-
:key="item.value"
|
|
42
|
-
:label="item.label"
|
|
43
|
-
:value="item.value">
|
|
44
|
-
</el-option>
|
|
45
|
-
</el-select>
|
|
46
|
-
</template>
|
|
47
|
-
<!-- 通用弹窗 -->
|
|
48
|
-
<template #dialog_default="{ column, row }">
|
|
49
|
-
<olCodemirrorTag v-model="row[column.field]" :title="row.title+' - console.log(cellValue, row, column) '"
|
|
50
|
-
size="small">
|
|
51
|
-
<template #toolbar-left>
|
|
52
|
-
<el-button type="primary" @click="row[column.prompt] = !row[column.prompt]">用法提示</el-button>
|
|
53
|
-
</template>
|
|
54
|
-
<template #tip-header>
|
|
55
|
-
<div v-if="row[column.prompt]"
|
|
56
|
-
style="text-align: center;padding: 10px;background-color: #282C34;color: #fff;">
|
|
57
|
-
<h3>格式化显示的内容</h3>
|
|
58
|
-
<p>格式化字符串,以下为实例,当前处于函数中,可直接return</p>
|
|
59
|
-
<p>参数:(({ cellValue, row, column }) => any) | any[] | string</p>
|
|
60
|
-
<p>return cellValue && cellValue >= 18 ? cellValue + '成年人' : cellValue + '未成年'</p>
|
|
61
|
-
</div>
|
|
62
|
-
</template>
|
|
63
|
-
</olCodemirrorTag>
|
|
64
|
-
</template>
|
|
65
|
-
<!-- 展开行 -->
|
|
66
|
-
<!-- <template #content="{ row, rowIndex }">
|
|
67
|
-
<div style="width: 80%;padding:30px 50px 12px;display: flex;">
|
|
68
|
-
<avue-form ref="formRef" :option="option" v-model="row.form"></avue-form>
|
|
69
|
-
</div>
|
|
70
|
-
</template>-->
|
|
71
|
-
<!-- 操作栏 -->
|
|
72
|
-
<template #operate="{ row }">
|
|
73
|
-
<el-button @click="removeRowEvent(row)" type="danger" size="small" circle plain>
|
|
74
|
-
<el-icon>
|
|
75
|
-
<Delete/>
|
|
76
|
-
</el-icon>
|
|
77
|
-
</el-button>
|
|
78
|
-
</template>
|
|
79
|
-
</vxe-grid>
|
|
80
|
-
<HeaderConfig ref="headerConfig" @ok="setGroupColumnData"/>
|
|
81
|
-
</div>
|
|
82
|
-
|
|
83
|
-
</template>
|
|
84
|
-
<script setup>
|
|
85
|
-
import {ref, reactive, defineExpose, onMounted, nextTick, defineEmits, watch, defineProps, inject} from "vue"
|
|
86
|
-
import {Delete} from '@element-plus/icons-vue'
|
|
87
|
-
import VXETable from 'vxe-table'
|
|
88
|
-
import XEUtils from 'xe-utils'
|
|
89
|
-
import Sortable from "sortablejs"
|
|
90
|
-
import {storeDict} from "@/store/dict";
|
|
91
|
-
import {storeDictType} from "@/store/dictType";
|
|
92
|
-
import HeaderConfig from "@/views/table/add-or-edit/config/column-config/header-config.vue";
|
|
93
|
-
import {get} from "@/utils/http/httpUtils";
|
|
94
|
-
|
|
95
|
-
const props = defineProps({
|
|
96
|
-
addVisible: {},
|
|
97
|
-
editVisible: {},
|
|
98
|
-
})
|
|
99
|
-
const show = ref(false)
|
|
100
|
-
const vexGridRef = ref()
|
|
101
|
-
const headerConfig = ref()
|
|
102
|
-
const dict = storeDict();
|
|
103
|
-
const dictType = storeDictType();
|
|
104
|
-
|
|
105
|
-
function setShow(value) {
|
|
106
|
-
nextTick(() => {
|
|
107
|
-
show.value = value;
|
|
108
|
-
updateSort()
|
|
109
|
-
})
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function setGroupByMin() {
|
|
113
|
-
gridOptions.data.forEach(item => {
|
|
114
|
-
if (item.groupToOtherProp != 1 && !item.groupTotalToOtherProp) {
|
|
115
|
-
item.groupTotalToOtherProp = 'sum'
|
|
116
|
-
}
|
|
117
|
-
})
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
const http = inject('http')
|
|
121
|
-
|
|
122
|
-
dict.init(http)
|
|
123
|
-
dictType.init(http)
|
|
124
|
-
|
|
125
|
-
function headerConfigShow() {
|
|
126
|
-
if (gridOptions.data) {
|
|
127
|
-
let tableConfigId = gridOptions.data[0].parentId;
|
|
128
|
-
get(http, '/online/tableConfigColumn/queryGroupByParentId', {id: tableConfigId}).then(res => {
|
|
129
|
-
headerConfig.value.setColumn(res)
|
|
130
|
-
})
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
watch(props, () => {
|
|
135
|
-
for (let column of gridOptions.columns) {
|
|
136
|
-
if (column.prop == 'addDisplay' || column.field == 'addDisplay') {
|
|
137
|
-
if (!column.visible && props.addVisible) {
|
|
138
|
-
checkBoxAllChange(column.field)
|
|
139
|
-
}
|
|
140
|
-
column.visible = props.addVisible;
|
|
141
|
-
}
|
|
142
|
-
if (column.prop == 'editDisplay' || column.field == 'editDisplay') {
|
|
143
|
-
if (!column.visible && props.editVisible) {
|
|
144
|
-
checkBoxAllChange(column.field)
|
|
145
|
-
}
|
|
146
|
-
column.visible = props.editVisible;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
if (show.value) {
|
|
150
|
-
vexGridRef.value.loadColumn(gridOptions.columns)
|
|
151
|
-
}
|
|
152
|
-
}, {deep: true})
|
|
153
|
-
|
|
154
|
-
const checkBoxAllChange = (field) => {
|
|
155
|
-
emits('checkBoxAll', {
|
|
156
|
-
checkBoxName: field == 'editDisplay' ? 'edit' : 'add',
|
|
157
|
-
isAll: true,
|
|
158
|
-
list: gridOptions.data.filter(row => row[field] == '1')
|
|
159
|
-
})
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
//表头全选框更新
|
|
163
|
-
const headerClick = (column) => {
|
|
164
|
-
if (column.field != 'columnAuth' && column.field == 'visible') {
|
|
165
|
-
let columnField = vexGridRef.value.getColumnByField('columnAuth');
|
|
166
|
-
columnField.params.all = column.params.all
|
|
167
|
-
headerClick(columnField)
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
gridOptions.data.forEach(item => {
|
|
171
|
-
item[column.field] = column.params.all ? '1' : '0'
|
|
172
|
-
})
|
|
173
|
-
if (column.params.all == '0') {
|
|
174
|
-
//全不选的时候
|
|
175
|
-
if (column.field == 'addDisplay') {
|
|
176
|
-
emits("checkBoxAll", {
|
|
177
|
-
checkBoxName: "add",
|
|
178
|
-
isAll: false,
|
|
179
|
-
list: gridOptions.data
|
|
180
|
-
})
|
|
181
|
-
} else if (column.field == 'editDisplay') {
|
|
182
|
-
emits("checkBoxAll", {
|
|
183
|
-
checkBoxName: "edit",
|
|
184
|
-
isAll: false,
|
|
185
|
-
list: gridOptions.data
|
|
186
|
-
})
|
|
187
|
-
}
|
|
188
|
-
} else if (column.params.all == '1') {
|
|
189
|
-
//全选
|
|
190
|
-
if (column.field == 'addDisplay') {
|
|
191
|
-
emits("checkBoxAll", {
|
|
192
|
-
checkBoxName: "add",
|
|
193
|
-
isAll: true,
|
|
194
|
-
list: gridOptions.data
|
|
195
|
-
})
|
|
196
|
-
} else if (column.field == 'editDisplay') {
|
|
197
|
-
emits("checkBoxAll", {
|
|
198
|
-
checkBoxName: "edit",
|
|
199
|
-
isAll: true,
|
|
200
|
-
list: gridOptions.data
|
|
201
|
-
})
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
//表格多选框更新
|
|
206
|
-
const checkBoxClick = (column, row) => {
|
|
207
|
-
emits("checkBoxChange", {
|
|
208
|
-
row: row,
|
|
209
|
-
column: column,
|
|
210
|
-
})
|
|
211
|
-
if (column.field != 'columnAuth' && column.field == 'visible') {
|
|
212
|
-
let columnField = vexGridRef.value.getColumnByField('columnAuth');
|
|
213
|
-
row.columnAuth = row.visible
|
|
214
|
-
checkBoxClick(columnField, row)
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
let f = true
|
|
218
|
-
gridOptions.data.forEach(item => {
|
|
219
|
-
if (item[column.field] != '1') {
|
|
220
|
-
f = false
|
|
221
|
-
}
|
|
222
|
-
})
|
|
223
|
-
column.params.all = f
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
//拿到数据
|
|
227
|
-
const setData = (data) => {
|
|
228
|
-
if (!data) {
|
|
229
|
-
return
|
|
230
|
-
}
|
|
231
|
-
gridOptions.data = data
|
|
232
|
-
//查看多选框是否多选
|
|
233
|
-
gridOptions.columns.forEach(item => {
|
|
234
|
-
if (item.slots && item.slots.default == "checkedBox_default") {
|
|
235
|
-
//默认全选状态
|
|
236
|
-
let flag = gridOptions.data.length > 0
|
|
237
|
-
gridOptions.data.forEach(row => {
|
|
238
|
-
if (row[item.field] != "1") {
|
|
239
|
-
//有某个参数没选择则不是全选的状态
|
|
240
|
-
flag = false
|
|
241
|
-
}
|
|
242
|
-
})
|
|
243
|
-
item.params.all = flag
|
|
244
|
-
}
|
|
245
|
-
})
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
//新增新字段
|
|
249
|
-
const onAdd = () => {
|
|
250
|
-
let newBtn = {visible: 0, form: {}, sort: gridOptions.data.length + 1}
|
|
251
|
-
gridOptions.data.push(newBtn)
|
|
252
|
-
vexGridRef.value.loadData(gridOptions.data)
|
|
253
|
-
setTimeout(() => {
|
|
254
|
-
vexGridRef.value.scrollToRow(gridOptions.data[newBtn.sort - 1], null)
|
|
255
|
-
}, 500)
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
//删除数据
|
|
259
|
-
const removeRowEvent = (row) => {
|
|
260
|
-
VXETable.modal.confirm('您确定要删除该数据?')
|
|
261
|
-
.then(() => {
|
|
262
|
-
gridOptions.data = gridOptions.data.filter(item => item._X_ROW_KEY != row._X_ROW_KEY)
|
|
263
|
-
handleCheckBoxClick(row)
|
|
264
|
-
})
|
|
265
|
-
.catch(() => {
|
|
266
|
-
})
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
const handleCheckBoxClick = (row) => {
|
|
270
|
-
for (let column of gridOptions.columns) {
|
|
271
|
-
if (column.field == 'addDisplay' || column.field == 'editDisplay') {
|
|
272
|
-
row.addDisplay = undefined
|
|
273
|
-
row.editDisplay = undefined
|
|
274
|
-
checkBoxClick(column, row)
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
//表更新
|
|
280
|
-
const updateData = (data) => {
|
|
281
|
-
let list = gridOptions.data
|
|
282
|
-
// 字段映射hash表
|
|
283
|
-
let map = {}
|
|
284
|
-
for (let item of list) {
|
|
285
|
-
if (item.visible == 1) {
|
|
286
|
-
item.visible = "1"
|
|
287
|
-
}
|
|
288
|
-
map[item.asName] = item
|
|
289
|
-
}
|
|
290
|
-
gridOptions.data = []
|
|
291
|
-
if (!data) {
|
|
292
|
-
return
|
|
293
|
-
}
|
|
294
|
-
data.forEach((item, index) => {
|
|
295
|
-
if (map[item.prop]) {
|
|
296
|
-
// 存在字段不覆盖
|
|
297
|
-
gridOptions.data.push(map[item.prop])
|
|
298
|
-
return
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
if (!item.column_comment || item.column_comment.toString().trim()) {
|
|
302
|
-
item.column_comment = item.prop
|
|
303
|
-
}
|
|
304
|
-
let data = {
|
|
305
|
-
field: item.prop,
|
|
306
|
-
title: item.column_comment,
|
|
307
|
-
tableField: item.column_name,
|
|
308
|
-
asName: item.prop,
|
|
309
|
-
sort: index,
|
|
310
|
-
visible: "1",
|
|
311
|
-
form: {},
|
|
312
|
-
label: item.column_comment
|
|
313
|
-
}
|
|
314
|
-
//映射表更新返回的字段
|
|
315
|
-
gridOptions.data.push(data)
|
|
316
|
-
})
|
|
317
|
-
// title格式化
|
|
318
|
-
updateTitleAndWidth()
|
|
319
|
-
// 列权限更新
|
|
320
|
-
updateColumnAuth()
|
|
321
|
-
}
|
|
322
|
-
const visible = (item) => {
|
|
323
|
-
return item.visible && '1' == item.visible
|
|
324
|
-
}
|
|
325
|
-
const setAddDisplay = (value) => {
|
|
326
|
-
let data = []
|
|
327
|
-
gridOptions.data.forEach(item => {
|
|
328
|
-
if (visible(item)) {
|
|
329
|
-
item.addDisplay = value
|
|
330
|
-
data.push(item)
|
|
331
|
-
}
|
|
332
|
-
})
|
|
333
|
-
doEmits('add', data)
|
|
334
|
-
}
|
|
335
|
-
const doEmits = (name, data) => {
|
|
336
|
-
emits('checkBoxAll', {
|
|
337
|
-
checkBoxName: name,
|
|
338
|
-
isAll: true,
|
|
339
|
-
list: data
|
|
340
|
-
})
|
|
341
|
-
}
|
|
342
|
-
const setEditDisplay = (value) => {
|
|
343
|
-
let data = []
|
|
344
|
-
gridOptions.data.forEach(item => {
|
|
345
|
-
if (visible(item)) {
|
|
346
|
-
item.editDisplay = value
|
|
347
|
-
data.push(item)
|
|
348
|
-
}
|
|
349
|
-
})
|
|
350
|
-
doEmits('edit', data)
|
|
351
|
-
}
|
|
352
|
-
const updateColumnAuth = () => {
|
|
353
|
-
gridOptions.data.forEach(item => {
|
|
354
|
-
if (item.visible == '0') {
|
|
355
|
-
item.columnAuth = item.visible
|
|
356
|
-
}
|
|
357
|
-
})
|
|
358
|
-
}
|
|
359
|
-
const updateTitleAndWidth = () => {
|
|
360
|
-
gridOptions.data.forEach(item => {
|
|
361
|
-
let index = -1
|
|
362
|
-
if (item.title) {
|
|
363
|
-
item.title = item.title.trim()
|
|
364
|
-
}
|
|
365
|
-
if (item.title && (index = item.title.indexOf(' ')) != -1) {
|
|
366
|
-
item.title = item.title.substring(0, index)
|
|
367
|
-
}
|
|
368
|
-
if (item.title && (index = item.title.indexOf('(')) >= 1) {
|
|
369
|
-
item.title = item.title.substring(0, index)
|
|
370
|
-
}
|
|
371
|
-
if (item.title && (index = item.title.lastIndexOf('(')) >= 1) {
|
|
372
|
-
item.title = item.title.substring(0, index)
|
|
373
|
-
}
|
|
374
|
-
})
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
//表格配置项
|
|
378
|
-
const gridOptions = reactive({
|
|
379
|
-
scrollX: {enabled: true, gt: 1},
|
|
380
|
-
scrollY: {enabled: true, gt: 1},
|
|
381
|
-
border: true,
|
|
382
|
-
showHeaderOverflow: true,
|
|
383
|
-
showOverflow: true,
|
|
384
|
-
height: 620,
|
|
385
|
-
align: "center",
|
|
386
|
-
size: 'mini',
|
|
387
|
-
rowConfig: {isHover: true, isCurrent: true},
|
|
388
|
-
editConfig: {
|
|
389
|
-
trigger: 'click',
|
|
390
|
-
mode: 'cell'
|
|
391
|
-
},
|
|
392
|
-
toolbarConfig: {
|
|
393
|
-
custom: true,
|
|
394
|
-
zoom: true,
|
|
395
|
-
slots: {
|
|
396
|
-
buttons: 'toolbar_buttons'
|
|
397
|
-
},
|
|
398
|
-
perfect: true,
|
|
399
|
-
},
|
|
400
|
-
columns: [
|
|
401
|
-
/* {
|
|
402
|
-
type: "expand",
|
|
403
|
-
title: "其他属性",
|
|
404
|
-
width: 80,
|
|
405
|
-
fixed: "left",
|
|
406
|
-
slots: {
|
|
407
|
-
content: 'content',
|
|
408
|
-
},
|
|
409
|
-
},*/
|
|
410
|
-
{
|
|
411
|
-
type: "seq",
|
|
412
|
-
width: 60,
|
|
413
|
-
title: "序号",
|
|
414
|
-
slots: {
|
|
415
|
-
default: 'seq'
|
|
416
|
-
},
|
|
417
|
-
},
|
|
418
|
-
{
|
|
419
|
-
title: '字段',
|
|
420
|
-
field: 'field',
|
|
421
|
-
fixed: 'left',
|
|
422
|
-
width: 200,
|
|
423
|
-
editRender: {props: {clearable: true}, name: '$input'},
|
|
424
|
-
filters: [{data: ''}],
|
|
425
|
-
filterMethod({option, row, column}) {
|
|
426
|
-
if (option.data) {
|
|
427
|
-
return XEUtils.toValueString(row[column.field]).toLowerCase().indexOf(option.data) > -1
|
|
428
|
-
}
|
|
429
|
-
return true
|
|
430
|
-
},
|
|
431
|
-
slots: {filter: 'label_filter'}
|
|
432
|
-
},
|
|
433
|
-
{
|
|
434
|
-
title: '字段描述',
|
|
435
|
-
field: 'label',
|
|
436
|
-
fixed: 'left',
|
|
437
|
-
width: 200,
|
|
438
|
-
filters: [{data: ''}],
|
|
439
|
-
filterMethod({option, row, column}) {
|
|
440
|
-
if (option.data) {
|
|
441
|
-
return XEUtils.toValueString(row[column.field]).toLowerCase().indexOf(option.data) > -1
|
|
442
|
-
}
|
|
443
|
-
return true
|
|
444
|
-
},
|
|
445
|
-
slots: {filter: 'label_filter'}
|
|
446
|
-
}, {
|
|
447
|
-
title: '标题',
|
|
448
|
-
field: 'title',
|
|
449
|
-
width: 200,
|
|
450
|
-
editRender: {props: {clearable: true}, name: '$input'},
|
|
451
|
-
filters: [{data: ''}],
|
|
452
|
-
filterMethod({option, row, column}) {
|
|
453
|
-
if (option.data) {
|
|
454
|
-
return XEUtils.toValueString(row[column.field]).toLowerCase().indexOf(option.data) > -1
|
|
455
|
-
}
|
|
456
|
-
return true
|
|
457
|
-
},
|
|
458
|
-
slots: {filter: 'label_filter'}
|
|
459
|
-
},
|
|
460
|
-
{
|
|
461
|
-
title: '显示',
|
|
462
|
-
field: 'visible',
|
|
463
|
-
align: 'center',
|
|
464
|
-
width: 80,
|
|
465
|
-
params: {
|
|
466
|
-
all: null
|
|
467
|
-
},
|
|
468
|
-
slots: {
|
|
469
|
-
header: 'checkedBox_header',
|
|
470
|
-
default: 'checkedBox_default'
|
|
471
|
-
},
|
|
472
|
-
},
|
|
473
|
-
{
|
|
474
|
-
title: '新增',
|
|
475
|
-
field: 'addDisplay',
|
|
476
|
-
align: 'center',
|
|
477
|
-
visible: props.addVisible,
|
|
478
|
-
params: {
|
|
479
|
-
all: 1
|
|
480
|
-
},
|
|
481
|
-
width: 80,
|
|
482
|
-
slots: {
|
|
483
|
-
header: 'checkedBox_header',
|
|
484
|
-
default: 'checkedBox_default'
|
|
485
|
-
}
|
|
486
|
-
}, {
|
|
487
|
-
title: '编辑',
|
|
488
|
-
field: 'editDisplay',
|
|
489
|
-
align: 'center',
|
|
490
|
-
width: 80,
|
|
491
|
-
visible: props.editVisible,
|
|
492
|
-
params: {
|
|
493
|
-
all: 0
|
|
494
|
-
},
|
|
495
|
-
slots: {
|
|
496
|
-
header: 'checkedBox_header',
|
|
497
|
-
default: 'checkedBox_default'
|
|
498
|
-
}
|
|
499
|
-
},
|
|
500
|
-
{
|
|
501
|
-
title: '不保存',
|
|
502
|
-
field: 'tableSaveToOtherProp',
|
|
503
|
-
width: 100,
|
|
504
|
-
params: {
|
|
505
|
-
all: 0
|
|
506
|
-
},
|
|
507
|
-
slots: {
|
|
508
|
-
default: 'checkedBox_default'
|
|
509
|
-
}
|
|
510
|
-
}, {
|
|
511
|
-
title: '排序',
|
|
512
|
-
field: 'sortable',
|
|
513
|
-
align: 'center',
|
|
514
|
-
width: 100,
|
|
515
|
-
params: {
|
|
516
|
-
all: 0,
|
|
517
|
-
dictCode: 'order_by_type'
|
|
518
|
-
},
|
|
519
|
-
editRender: {props: {clearable: true, filterable: true}, name: '$select', options: dict.val('order_by_type')},
|
|
520
|
-
},
|
|
521
|
-
{
|
|
522
|
-
title: '数据字典',
|
|
523
|
-
field: 'dictCode',
|
|
524
|
-
params: {
|
|
525
|
-
dictCode: 'dictCode'
|
|
526
|
-
},
|
|
527
|
-
width: 200,
|
|
528
|
-
editRender: {props: {clearable: true, filterable: true}, name: '$select', options: dictType.val()}
|
|
529
|
-
// editRender: {props: {clearable: true, filterable: true}, name: 'input', options: dictType.val()}
|
|
530
|
-
}, {
|
|
531
|
-
title: '搜索类型',
|
|
532
|
-
field: 'selectType',
|
|
533
|
-
params: {
|
|
534
|
-
dictCode: 'select_type'
|
|
535
|
-
},
|
|
536
|
-
width: 120,
|
|
537
|
-
editRender: {props: {clearable: true, filterable: true}, name: '$select', options: dict.val('select_type')},
|
|
538
|
-
},
|
|
539
|
-
{
|
|
540
|
-
title: '控件类型',
|
|
541
|
-
field: 'selectDom',
|
|
542
|
-
/*params: {
|
|
543
|
-
dictCode: 'select_dom'
|
|
544
|
-
},*/
|
|
545
|
-
width: 180,
|
|
546
|
-
editRender: {props: {clearable: true, filterable: true}, name: '$select', options: dict.val('select_dom')}
|
|
547
|
-
/*slots: {
|
|
548
|
-
default: 'select_default'
|
|
549
|
-
},*/
|
|
550
|
-
},
|
|
551
|
-
{
|
|
552
|
-
title: '固定',
|
|
553
|
-
field: 'fixed',
|
|
554
|
-
params: {
|
|
555
|
-
dictCode: 'table_fixed'
|
|
556
|
-
},
|
|
557
|
-
editRender: {props: {clearable: true}, name: '$select', options: dict.val('table_fixed')},
|
|
558
|
-
width: 80,
|
|
559
|
-
},
|
|
560
|
-
{
|
|
561
|
-
title: '合计',
|
|
562
|
-
field: 'totalToOtherProp',
|
|
563
|
-
width: 100,
|
|
564
|
-
params: {
|
|
565
|
-
all: null
|
|
566
|
-
},
|
|
567
|
-
editRender: {
|
|
568
|
-
props: {clearable: true, filterable: true},
|
|
569
|
-
name: '$select',
|
|
570
|
-
options: dict.val('online_calculation_type')
|
|
571
|
-
}
|
|
572
|
-
},
|
|
573
|
-
{
|
|
574
|
-
title: '分组',
|
|
575
|
-
field: 'groupToOtherProp',
|
|
576
|
-
width: 100,
|
|
577
|
-
params: {
|
|
578
|
-
all: null
|
|
579
|
-
},
|
|
580
|
-
slots: {
|
|
581
|
-
default: 'checkedBox_default'
|
|
582
|
-
}
|
|
583
|
-
},
|
|
584
|
-
{
|
|
585
|
-
title: '分组合计',
|
|
586
|
-
field: 'groupTotalToOtherProp',
|
|
587
|
-
width: 100,
|
|
588
|
-
editRender: {
|
|
589
|
-
props: {clearable: true, filterable: true},
|
|
590
|
-
name: '$select',
|
|
591
|
-
options: dict.val('online_calculation_type')
|
|
592
|
-
}
|
|
593
|
-
},
|
|
594
|
-
{
|
|
595
|
-
title: '行合并',
|
|
596
|
-
field: 'mergeFlag',
|
|
597
|
-
width: 100,
|
|
598
|
-
params: {
|
|
599
|
-
all: null
|
|
600
|
-
},
|
|
601
|
-
slots: {
|
|
602
|
-
header: 'checkedBox_header',
|
|
603
|
-
default: 'checkedBox_default'
|
|
604
|
-
},
|
|
605
|
-
},
|
|
606
|
-
{
|
|
607
|
-
title: '可列配置',
|
|
608
|
-
field: 'columnAuth',
|
|
609
|
-
align: 'center',
|
|
610
|
-
width: 80,
|
|
611
|
-
params: {
|
|
612
|
-
all: null
|
|
613
|
-
},
|
|
614
|
-
slots: {
|
|
615
|
-
header: 'checkedBox_header',
|
|
616
|
-
default: 'checkedBox_default'
|
|
617
|
-
},
|
|
618
|
-
},
|
|
619
|
-
{
|
|
620
|
-
title: '对齐',
|
|
621
|
-
field: 'align',
|
|
622
|
-
params: {
|
|
623
|
-
dictCode: 'align'
|
|
624
|
-
},
|
|
625
|
-
editRender: {props: {clearable: true}, name: '$select', options: dict.val('align')},
|
|
626
|
-
width: 80,
|
|
627
|
-
},
|
|
628
|
-
{
|
|
629
|
-
title: '列宽',
|
|
630
|
-
width: 80,
|
|
631
|
-
field: 'width',
|
|
632
|
-
editRender: {props: {clearable: true}, name: '$input'},
|
|
633
|
-
},
|
|
634
|
-
{
|
|
635
|
-
title: '列宽拖动',
|
|
636
|
-
field: 'resizable',
|
|
637
|
-
width: 80,
|
|
638
|
-
params: {
|
|
639
|
-
all: null
|
|
640
|
-
},
|
|
641
|
-
slots: {
|
|
642
|
-
header: 'checkedBox_header',
|
|
643
|
-
default: 'checkedBox_default'
|
|
644
|
-
},
|
|
645
|
-
},
|
|
646
|
-
{
|
|
647
|
-
title: 'formatter',
|
|
648
|
-
field: 'formatter',
|
|
649
|
-
width: 168,
|
|
650
|
-
slots: {
|
|
651
|
-
default: 'dialog_default'
|
|
652
|
-
}
|
|
653
|
-
}, {
|
|
654
|
-
title: '搜索顺序',
|
|
655
|
-
field: 'searchSort',
|
|
656
|
-
width: 100,
|
|
657
|
-
editRender: {name: '$input', props: {type: 'number'}},
|
|
658
|
-
},
|
|
659
|
-
{
|
|
660
|
-
title: '搜索默认值',
|
|
661
|
-
field: 'valueSEARCHToOtherProp',
|
|
662
|
-
width: 100,
|
|
663
|
-
editRender: {name: '$input'},
|
|
664
|
-
},
|
|
665
|
-
{
|
|
666
|
-
title: '不可清空',
|
|
667
|
-
field: 'clearableSEARCHToOtherProp',
|
|
668
|
-
width: 100,
|
|
669
|
-
params: {},
|
|
670
|
-
slots: {
|
|
671
|
-
default: 'checkedBox_default'
|
|
672
|
-
}
|
|
673
|
-
},
|
|
674
|
-
{
|
|
675
|
-
title: '时间',
|
|
676
|
-
field: 'toDateSEARCHToOtherProp',
|
|
677
|
-
width: 80,
|
|
678
|
-
params: {},
|
|
679
|
-
slots: {
|
|
680
|
-
default: 'checkedBox_default'
|
|
681
|
-
}
|
|
682
|
-
},
|
|
683
|
-
{
|
|
684
|
-
title: '搜索span',
|
|
685
|
-
field: 'spanSEARCHToOtherProp',
|
|
686
|
-
width: 110,
|
|
687
|
-
editRender: {name: '$input', props: {clearable: true, min: 2, max: 24, type: 'number'},},
|
|
688
|
-
},
|
|
689
|
-
{
|
|
690
|
-
title: '搜索label',
|
|
691
|
-
field: 'titleSEARCHToOtherProp',
|
|
692
|
-
width: 120,
|
|
693
|
-
editRender: {name: '$input', props: {clearable: true}}
|
|
694
|
-
},
|
|
695
|
-
{
|
|
696
|
-
title: '搜索别名',
|
|
697
|
-
field: 'tableNameSEARCHToOtherProp',
|
|
698
|
-
width: 100,
|
|
699
|
-
editRender: {name: '$input', props: {clearable: true}}
|
|
700
|
-
},
|
|
701
|
-
{
|
|
702
|
-
title: '操作',
|
|
703
|
-
width: 100,
|
|
704
|
-
fixed: 'right',
|
|
705
|
-
align: 'center',
|
|
706
|
-
slots: {
|
|
707
|
-
default: 'operate'
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
],
|
|
711
|
-
data: [],
|
|
712
|
-
groupColumns: [],
|
|
713
|
-
})
|
|
714
|
-
//表格拖动更新
|
|
715
|
-
const updateSort = () => {
|
|
716
|
-
nextTick(() => {
|
|
717
|
-
if (!vexGridRef.value) {
|
|
718
|
-
return
|
|
719
|
-
}
|
|
720
|
-
//el绑定元素需要找到vxe的DOM下的tbody元素
|
|
721
|
-
Sortable.create(vexGridRef.value.$el.querySelector('.body--wrapper>.vxe-table--body tbody'), {
|
|
722
|
-
animation: 200,//拖拽动画过渡时间
|
|
723
|
-
sort: true,
|
|
724
|
-
handle: '.col--seq', //必须设置该属性,属性值为你要拖动的该单元格的样式名
|
|
725
|
-
// 元素被选中
|
|
726
|
-
onStart: function (/**Event*/evt) {
|
|
727
|
-
//关闭所有展开行
|
|
728
|
-
vexGridRef.value.clearRowExpand()
|
|
729
|
-
evt.oldIndex // element index within parent
|
|
730
|
-
},
|
|
731
|
-
// 结束拖拽
|
|
732
|
-
onEnd: function (/**Event*/{oldIndex, newIndex, item}) {
|
|
733
|
-
//evt.to; // 目标列表
|
|
734
|
-
//evt.from; // 来自以前的列表
|
|
735
|
-
//evt.oldIndex; // 元素在旧父元素中的旧索引
|
|
736
|
-
//evt.newIndex; // 元素在新父元素中的新索引
|
|
737
|
-
//evt.clone // 克隆元素
|
|
738
|
-
//evt.pullMode; // 当项在另一个可排序中时:"clone"(克隆),"true"(移动)
|
|
739
|
-
let rowNode = vexGridRef.value.getRowNode(item);
|
|
740
|
-
newIndex = rowNode.index - oldIndex + newIndex
|
|
741
|
-
|
|
742
|
-
const list = JSON.parse(JSON.stringify(gridOptions.data)) //保存旧数据
|
|
743
|
-
const targetRow = list.splice(rowNode.index, 1)[0] //保存移动的元素并删除原列表中移动的元素
|
|
744
|
-
list.splice(newIndex, 0, targetRow) //插入到目标新索引中
|
|
745
|
-
const newsArr = JSON.parse(JSON.stringify(list)) //重新赋值数组
|
|
746
|
-
//将新数据重新排序
|
|
747
|
-
for (let i = 0; i < newsArr.length; i++) {
|
|
748
|
-
newsArr[i].sort = i + 1
|
|
749
|
-
}
|
|
750
|
-
gridOptions.data = newsArr
|
|
751
|
-
},
|
|
752
|
-
})
|
|
753
|
-
})
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
onMounted(() => {
|
|
757
|
-
updateSort()
|
|
758
|
-
})
|
|
759
|
-
const enterFilterEvent = ({$panel}) => {
|
|
760
|
-
$panel.confirmFilter()
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
// 子组件调用父组件
|
|
764
|
-
const emits = defineEmits(['checkBoxChange']) //声明 emits
|
|
765
|
-
function getColumns() {
|
|
766
|
-
return gridOptions.data
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
function getGroupColumnData() {
|
|
770
|
-
return gridOptions.groupColumns
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
function setGroupColumnData(value) {
|
|
774
|
-
gridOptions.groupColumns = value.groupColumns
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
// 对外暴露
|
|
778
|
-
defineExpose({
|
|
779
|
-
setData, updateData, gridOptions, vexGridRef, getColumns, setAddDisplay, setEditDisplay, setShow, getGroupColumnData
|
|
780
|
-
})
|
|
781
|
-
</script>
|
|
782
|
-
<style>
|
|
783
|
-
.expand-wrapper {
|
|
784
|
-
padding: 20px;
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
.test {
|
|
788
|
-
padding: 80px;
|
|
789
|
-
}
|
|
790
|
-
</style>
|