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,340 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<vxe-grid
|
|
4
|
-
v-bind="option"
|
|
5
|
-
v-if="show"
|
|
6
|
-
ref="tableRef"
|
|
7
|
-
@edit-closed="editClosedEvent"
|
|
8
|
-
:data="configData.form[props.type].filter(o => o.alignMode == props.alignMode)">
|
|
9
|
-
<template #toolbar_buttons>
|
|
10
|
-
<el-button @click="onAdd">新增</el-button>
|
|
11
|
-
</template>
|
|
12
|
-
<template #switch_default="{ row,column }">
|
|
13
|
-
<el-switch
|
|
14
|
-
active-value="1"
|
|
15
|
-
inactive-value="0"
|
|
16
|
-
v-model="row[column.field]"
|
|
17
|
-
/>
|
|
18
|
-
</template>
|
|
19
|
-
<template #checkedBox_default="{ column, row,rowIndex }">
|
|
20
|
-
<el-checkbox v-model="row[column.field]" :disabled="row['code'] == 'add' || row['code'] == 'edit'"
|
|
21
|
-
@change="checkbox" true-value="1"
|
|
22
|
-
false-value="0"/>
|
|
23
|
-
</template>
|
|
24
|
-
<template #codemirror="{ row,column }">
|
|
25
|
-
<olCodemirrorTag v-model="row[column.field]"/>
|
|
26
|
-
</template>
|
|
27
|
-
<template #operation="{ row,rowIndex }">
|
|
28
|
-
<el-button @click="removeBtn(row, rowIndex)" type="danger" circle plain>
|
|
29
|
-
<el-icon>
|
|
30
|
-
<Delete/>
|
|
31
|
-
</el-icon>
|
|
32
|
-
</el-button>
|
|
33
|
-
</template>
|
|
34
|
-
</vxe-grid>
|
|
35
|
-
</div>
|
|
36
|
-
</template>
|
|
37
|
-
<script setup>
|
|
38
|
-
import {Delete} from '@element-plus/icons-vue'
|
|
39
|
-
import {defineExpose, defineProps, inject, nextTick, onMounted, reactive, ref} from "vue";
|
|
40
|
-
import {getNewArrData, updateSortCall} from "@/utils/TableSortUtil";
|
|
41
|
-
import VXETable from "vxe-table";
|
|
42
|
-
|
|
43
|
-
const configData = inject("configData")
|
|
44
|
-
const updateBtnData = inject('updateBtnData', Function, true)
|
|
45
|
-
const props = defineProps({
|
|
46
|
-
type: {
|
|
47
|
-
required: true,
|
|
48
|
-
type: String
|
|
49
|
-
}, alignMode: {
|
|
50
|
-
required: true,
|
|
51
|
-
type: String
|
|
52
|
-
},
|
|
53
|
-
})
|
|
54
|
-
const tableRef = ref();
|
|
55
|
-
const show = ref(true)
|
|
56
|
-
const option = reactive({
|
|
57
|
-
expandConfig: {
|
|
58
|
-
trigger: "cell"
|
|
59
|
-
},
|
|
60
|
-
rowConfig: {
|
|
61
|
-
isCurrent: true
|
|
62
|
-
},
|
|
63
|
-
align: 'center',
|
|
64
|
-
editConfig: {
|
|
65
|
-
trigger: 'click',
|
|
66
|
-
mode: 'cell',
|
|
67
|
-
showStatus: true,
|
|
68
|
-
beforeEditMethod: ({column, row}) => {
|
|
69
|
-
const field = column.field
|
|
70
|
-
if ((row.code == 'add' || row.code == 'edit') && field == "code") {
|
|
71
|
-
return false
|
|
72
|
-
}
|
|
73
|
-
return true
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
pagerConfig: {
|
|
77
|
-
enabled: false
|
|
78
|
-
},
|
|
79
|
-
toolbarConfig: {
|
|
80
|
-
slots: {
|
|
81
|
-
buttons: 'toolbar_buttons'
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
scrollX: {enabled: true, gt: 1},
|
|
85
|
-
scrollY: {enabled: true, gt: 1},
|
|
86
|
-
height: 350,
|
|
87
|
-
index: true,
|
|
88
|
-
searchBtn: false,
|
|
89
|
-
emptyBtn: false,
|
|
90
|
-
menu: false,
|
|
91
|
-
header: false,
|
|
92
|
-
columns: [
|
|
93
|
-
/* {
|
|
94
|
-
title: '序号',
|
|
95
|
-
field: 'sort',
|
|
96
|
-
width: 80,
|
|
97
|
-
},*/
|
|
98
|
-
{
|
|
99
|
-
type: "seq",
|
|
100
|
-
className: 'move',
|
|
101
|
-
width: 60,
|
|
102
|
-
title: "序号",
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
title: '按钮名称',
|
|
106
|
-
field: 'name',
|
|
107
|
-
editRender: {name: 'input'},
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
title: '定义编码',
|
|
111
|
-
field: 'code',
|
|
112
|
-
editRender: {
|
|
113
|
-
name: 'input', events: {
|
|
114
|
-
change: ({row}) => {
|
|
115
|
-
setTimeout(() => {
|
|
116
|
-
if (row.code != '') {
|
|
117
|
-
row.clickCallBackMethod = row.code + "ButClick"
|
|
118
|
-
} else {
|
|
119
|
-
row.clickCallBackMethod = ''
|
|
120
|
-
}
|
|
121
|
-
}, 100)
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
}, {
|
|
126
|
-
title: '图标',
|
|
127
|
-
field: 'icon',
|
|
128
|
-
editRender: {name: 'input'},
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
title: '主题',
|
|
132
|
-
field: 'status',
|
|
133
|
-
editRender: {name: 'input'},
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
title: '是否启用表单',
|
|
137
|
-
field: 'isForm',
|
|
138
|
-
slots: {
|
|
139
|
-
// 使用插槽模板渲染
|
|
140
|
-
default: 'checkedBox_default',
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
title: '单击回调方法',
|
|
145
|
-
visible: props.type == 'toolButOptions',
|
|
146
|
-
field: 'clickCallBackMethod',
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
title: '自定义函数',
|
|
150
|
-
field: 'customFunction',
|
|
151
|
-
slots: {
|
|
152
|
-
// 使用插槽模板渲染
|
|
153
|
-
default: 'codemirror',
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
title: '参数1',
|
|
158
|
-
field: 'beforeFunction',
|
|
159
|
-
slots: {
|
|
160
|
-
// 使用插槽模板渲染
|
|
161
|
-
default: 'codemirror',
|
|
162
|
-
},
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
title: '参数2',
|
|
166
|
-
field: 'afterFunction',
|
|
167
|
-
slots: {
|
|
168
|
-
// 使用插槽模板渲染
|
|
169
|
-
default: 'codemirror',
|
|
170
|
-
},
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
title: 'json',
|
|
174
|
-
field: 'json',
|
|
175
|
-
slots: {
|
|
176
|
-
// 使用插槽模板渲染
|
|
177
|
-
default: 'codemirror',
|
|
178
|
-
},
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
title: '默认',
|
|
182
|
-
children: [
|
|
183
|
-
{
|
|
184
|
-
title: '禁用',
|
|
185
|
-
field: 'defaultDisabled',
|
|
186
|
-
visible: props.type == 'toolButOptions',
|
|
187
|
-
width: 80,
|
|
188
|
-
slots: {
|
|
189
|
-
// 使用插槽模板渲染
|
|
190
|
-
default: 'switch_default',
|
|
191
|
-
},
|
|
192
|
-
}, {
|
|
193
|
-
title: '显示',
|
|
194
|
-
field: 'defaultShow',
|
|
195
|
-
visible: props.type == 'toolButOptions',
|
|
196
|
-
width: 80,
|
|
197
|
-
slots: {
|
|
198
|
-
// 使用插槽模板渲染
|
|
199
|
-
default: 'switch_default',
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
],
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
title: '回调方法',
|
|
206
|
-
children: [
|
|
207
|
-
{
|
|
208
|
-
title: '单击(click)',
|
|
209
|
-
field: 'clickCallBackMethod',
|
|
210
|
-
visible: props.type != 'toolButOptions',
|
|
211
|
-
}, {
|
|
212
|
-
title: '显示(show)',
|
|
213
|
-
field: 'showCallBack',
|
|
214
|
-
visible: props.type != 'toolButOptions',
|
|
215
|
-
slots: {
|
|
216
|
-
// 使用插槽模板渲染
|
|
217
|
-
default: 'codemirror',
|
|
218
|
-
},
|
|
219
|
-
}, {
|
|
220
|
-
title: '禁用(disabled)',
|
|
221
|
-
field: 'disabledCallBack',
|
|
222
|
-
visible: props.type != 'toolButOptions',
|
|
223
|
-
slots: {
|
|
224
|
-
// 使用插槽模板渲染
|
|
225
|
-
default: 'codemirror',
|
|
226
|
-
},
|
|
227
|
-
}
|
|
228
|
-
],
|
|
229
|
-
}, {
|
|
230
|
-
title: '操作',
|
|
231
|
-
field: 'operation',
|
|
232
|
-
width: 80,
|
|
233
|
-
slots: {
|
|
234
|
-
// 使用插槽模板渲染
|
|
235
|
-
default: 'operation',
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
]
|
|
239
|
-
});
|
|
240
|
-
const checkbox = (params) => {
|
|
241
|
-
console.log(params)
|
|
242
|
-
}
|
|
243
|
-
const onAdd = () => {
|
|
244
|
-
let newBtn = {
|
|
245
|
-
name: '',
|
|
246
|
-
code: '',
|
|
247
|
-
defaultShow: '1',
|
|
248
|
-
deleted: 0,
|
|
249
|
-
isForm: 0,
|
|
250
|
-
seq: getDataSource().length + 1,
|
|
251
|
-
sort: getDataSource().length + 1
|
|
252
|
-
}
|
|
253
|
-
if (props.alignMode) {
|
|
254
|
-
newBtn.alignMode = props.alignMode;
|
|
255
|
-
}
|
|
256
|
-
configData.form[props.type].push(newBtn)
|
|
257
|
-
loadData();
|
|
258
|
-
setTimeout(() => {
|
|
259
|
-
tableRef.value.setEditRow(tableRef.value.getData(newBtn.sort), 'name')
|
|
260
|
-
}, 500)
|
|
261
|
-
}
|
|
262
|
-
const removeBtn = (row, rowIndex) => {
|
|
263
|
-
configData.form[props.type].splice(rowIndex, 1)
|
|
264
|
-
let index = 0;
|
|
265
|
-
for (var obj of configData.form[props.type.replaceAll("Options", "")]) {
|
|
266
|
-
if (obj == row.code) {
|
|
267
|
-
configData.form[props.type.replaceAll("Options", "")].splice(index, 1)
|
|
268
|
-
return
|
|
269
|
-
}
|
|
270
|
-
index++;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
const editClosedEvent = ({row, column}) => {
|
|
274
|
-
const $table = tableRef.value
|
|
275
|
-
if ($table) {
|
|
276
|
-
const field = column.field
|
|
277
|
-
const cellValue = row[field]
|
|
278
|
-
// 判断单元格值是否被修改
|
|
279
|
-
if ($table.isUpdateByRow(row, field)) {
|
|
280
|
-
setTimeout(() => {
|
|
281
|
-
VXETable.modal.message({
|
|
282
|
-
content: `局部保存成功! ${field}=${cellValue}`,
|
|
283
|
-
status: 'success'
|
|
284
|
-
})
|
|
285
|
-
// 局部更新单元格为已保存状态
|
|
286
|
-
$table.reloadRow(row, null, field)
|
|
287
|
-
}, 300)
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
updateBtnData(configData.form[props.type], props.type)
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
function getDataSource() {
|
|
294
|
-
if (props.alignMode) {
|
|
295
|
-
return configData.form[props.type].filter(o => o.alignMode == props.alignMode)
|
|
296
|
-
}
|
|
297
|
-
return configData.form[props.type];
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
function loadData() {
|
|
301
|
-
tableRef.value.reloadData(getDataSource())
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
function updateSort(oldIndex, newIndex) {
|
|
305
|
-
let newsArr = getNewArrData(oldIndex, newIndex, getDataSource())
|
|
306
|
-
let index = 0;
|
|
307
|
-
for (const obj of newsArr) {
|
|
308
|
-
obj.sort = ++index;
|
|
309
|
-
}
|
|
310
|
-
show.value = false;
|
|
311
|
-
let reverseArr = configData.form[props.type].filter(o => o.alignMode != props.alignMode)
|
|
312
|
-
for (let reverseArrElement of reverseArr) {
|
|
313
|
-
newsArr.push(reverseArrElement)
|
|
314
|
-
}
|
|
315
|
-
configData.form[props.type] = newsArr
|
|
316
|
-
nextTick(() => {
|
|
317
|
-
show.value = true;
|
|
318
|
-
nextTick(() => {
|
|
319
|
-
updateSortCall(tableRef, updateSort)
|
|
320
|
-
})
|
|
321
|
-
})
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
onMounted(() => {
|
|
325
|
-
nextTick(() => {
|
|
326
|
-
updateSortCall(tableRef, updateSort)
|
|
327
|
-
})
|
|
328
|
-
})
|
|
329
|
-
defineExpose({
|
|
330
|
-
loadData
|
|
331
|
-
})
|
|
332
|
-
|
|
333
|
-
</script>
|
|
334
|
-
|
|
335
|
-
<style lang="scss">
|
|
336
|
-
.newBtn {
|
|
337
|
-
background: #f2f8fe
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
</style>
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div style="height: 55vh">
|
|
3
|
-
<vxe-grid
|
|
4
|
-
:key="key"
|
|
5
|
-
v-if="tableShow"
|
|
6
|
-
v-bind="option"
|
|
7
|
-
ref="sortTableRef"
|
|
8
|
-
row-class-name="default-row"
|
|
9
|
-
:data="list">
|
|
10
|
-
<template #sort-slot>
|
|
11
|
-
<div style="display: flex;justify-content: center;align-items: center">
|
|
12
|
-
<el-icon>
|
|
13
|
-
<SemiSelect/>
|
|
14
|
-
</el-icon>
|
|
15
|
-
</div>
|
|
16
|
-
</template>
|
|
17
|
-
</vxe-grid>
|
|
18
|
-
</div>
|
|
19
|
-
</template>
|
|
20
|
-
<script setup>
|
|
21
|
-
import {SemiSelect} from '@element-plus/icons-vue'
|
|
22
|
-
import Sortable from "sortablejs";
|
|
23
|
-
import {defineExpose,defineProps, nextTick, onMounted, reactive, ref} from "vue";
|
|
24
|
-
|
|
25
|
-
const props = defineProps({
|
|
26
|
-
list: {
|
|
27
|
-
type: Array,
|
|
28
|
-
default: () => {
|
|
29
|
-
return []
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
})
|
|
33
|
-
const list = reactive(JSON.parse(JSON.stringify(props.list)));
|
|
34
|
-
const sortTableRef = ref();
|
|
35
|
-
const sorter = ref()
|
|
36
|
-
const tableShow = ref(true)
|
|
37
|
-
const key = ref(0)
|
|
38
|
-
|
|
39
|
-
const option = reactive({
|
|
40
|
-
height: 'auto',
|
|
41
|
-
columns: [
|
|
42
|
-
{
|
|
43
|
-
width: 100,
|
|
44
|
-
title: '',
|
|
45
|
-
slots: {
|
|
46
|
-
default: 'sort-slot'
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
title: '序号',
|
|
51
|
-
width: 100,
|
|
52
|
-
field: 'form.sortSeq',
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
title: '名称',
|
|
56
|
-
field: 'form.name',
|
|
57
|
-
search: true,
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
title: '编码',
|
|
61
|
-
field: 'form.code',
|
|
62
|
-
search: true,
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const startSort = () => {
|
|
69
|
-
let el = sortTableRef.value.$el.querySelector(".vxe-table--body-wrapper tbody")
|
|
70
|
-
sorter.value = Sortable.create(el, {
|
|
71
|
-
animation: 150,
|
|
72
|
-
sort: true,
|
|
73
|
-
handle: '.vxe-body--row',
|
|
74
|
-
// 结束拖拽
|
|
75
|
-
onEnd: function ({oldIndex, newIndex}) {
|
|
76
|
-
console.log(list)
|
|
77
|
-
if (oldIndex == newIndex) return;
|
|
78
|
-
let dire = newIndex > oldIndex ? 1 : -1; // 1: 向下, -1: 向上
|
|
79
|
-
list[oldIndex].form.sortSeq = list[newIndex].form.sortSeq
|
|
80
|
-
// 从拖拽位置开始
|
|
81
|
-
let cur = oldIndex
|
|
82
|
-
while (cur != newIndex) {
|
|
83
|
-
cur += dire
|
|
84
|
-
list[cur].form.sortSeq -= dire // 向反方向挪动一个单位
|
|
85
|
-
}
|
|
86
|
-
//调整数据顺序,防止数据混乱
|
|
87
|
-
cur = oldIndex
|
|
88
|
-
while (cur != newIndex) {
|
|
89
|
-
let temp = list[cur];
|
|
90
|
-
list[cur] = list[cur + dire];
|
|
91
|
-
list[cur + dire] = temp;
|
|
92
|
-
cur += dire
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
})
|
|
97
|
-
}
|
|
98
|
-
const setList = (data) => {
|
|
99
|
-
key.value++
|
|
100
|
-
nextTick(() => {
|
|
101
|
-
list.length = 0
|
|
102
|
-
for (let item of data) {
|
|
103
|
-
item.form.sortSeq = item.form.seq
|
|
104
|
-
list.push(item)
|
|
105
|
-
}
|
|
106
|
-
sortTableRef.value.reloadData(list)
|
|
107
|
-
startSort()
|
|
108
|
-
})
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
onMounted(() => {
|
|
112
|
-
startSort()
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
defineExpose({
|
|
116
|
-
list,
|
|
117
|
-
setList,
|
|
118
|
-
tableShow
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
</script>
|
|
122
|
-
|
|
123
|
-
<style>
|
|
124
|
-
.default-row {
|
|
125
|
-
cursor: move;
|
|
126
|
-
user-select: none;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.default-row:hover {
|
|
130
|
-
background-color: rgba(192, 192, 192, .1);
|
|
131
|
-
}
|
|
132
|
-
</style>
|