doway-coms 2.2.18 → 2.2.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.browserslistrc +2 -2
- package/README.md +28 -28
- package/package.json +53 -53
- package/packages/AuditsList/index.js +7 -7
- package/packages/AuditsList/src/index.vue +262 -262
- package/packages/BaseButton/index.js +7 -7
- package/packages/BaseButton/src/index.vue +241 -241
- package/packages/BaseCheckbox/index.js +7 -7
- package/packages/BaseCheckbox/src/index.vue +134 -134
- package/packages/BaseDate/index.js +7 -7
- package/packages/BaseDate/src/index.vue +197 -197
- package/packages/BaseDateWeek/index.js +7 -7
- package/packages/BaseDateWeek/src/index.vue +163 -163
- package/packages/BaseDatetime/index.js +7 -7
- package/packages/BaseDatetime/src/index.vue +196 -196
- package/packages/BaseForm/index.js +7 -7
- package/packages/BaseForm/src/index.vue +728 -728
- package/packages/BaseGantt/index.js +9 -9
- package/packages/BaseGantt/src/index.vue +608 -608
- package/packages/BaseGrid/index.js +9 -9
- package/packages/BaseGrid/src/SeqSetting.vue +278 -278
- package/packages/BaseGrid/src/index.vue +3580 -3580
- package/packages/BaseGridAdjust/index.js +9 -9
- package/packages/BaseGridAdjust/src/index.vue +482 -482
- package/packages/BaseInput/index.js +7 -7
- package/packages/BaseInput/src/index.vue +164 -164
- package/packages/BaseIntervalInput/index.js +7 -7
- package/packages/BaseIntervalInput/src/index.vue +310 -310
- package/packages/BaseKanbanEmpty/index.js +7 -7
- package/packages/BaseKanbanEmpty/src/index.vue +176 -176
- package/packages/BaseNumberInput/index.js +7 -7
- package/packages/BaseNumberInput/src/index.vue +293 -293
- package/packages/BasePagination/index.js +7 -7
- package/packages/BasePagination/src/index.vue +91 -91
- package/packages/BasePictureCard/index.js +7 -7
- package/packages/BasePictureCard/src/index.vue +580 -580
- package/packages/BasePrintPreview/index.js +7 -7
- package/packages/BasePrintPreview/src/index.vue +129 -129
- package/packages/BasePulldown/index.js +7 -7
- package/packages/BasePulldown/src/index.vue +1265 -1265
- package/packages/BaseSearch/index.js +7 -7
- package/packages/BaseSearch/src/index.vue +935 -935
- package/packages/BaseSelect/index.js +7 -7
- package/packages/BaseSelect/src/index.vue +155 -155
- package/packages/BaseSelectMulti/index.js +7 -7
- package/packages/BaseSelectMulti/src/index.vue +148 -148
- package/packages/BaseTextArea/index.js +7 -7
- package/packages/BaseTextArea/src/index.vue +178 -178
- package/packages/BaseTime/index.js +7 -7
- package/packages/BaseTime/src/index.vue +166 -166
- package/packages/BaseTool/index.js +7 -7
- package/packages/BaseTool/src/index.vue +349 -349
- package/packages/BaseToolStatus/index.js +7 -7
- package/packages/BaseToolStatus/src/index.vue +388 -388
- package/packages/BaseTreeSelect/index.js +8 -8
- package/packages/BaseTreeSelect/src/index.vue +437 -416
- package/packages/LeaveAMessage/index.js +7 -7
- package/packages/LeaveAMessage/src/index.vue +597 -597
- package/packages/index.js +191 -191
- package/packages/styles/default.css +78 -78
- package/packages/styles/default.less +84 -84
- package/packages/utils/api.js +107 -107
- package/packages/utils/auth.js +38 -38
- package/packages/utils/common.js +610 -610
- package/packages/utils/dom.js +181 -181
- package/packages/utils/enum.js +86 -86
- package/packages/utils/filters.js +472 -472
- package/packages/utils/gridFormat.js +66 -66
- package/packages/utils/msg.js +84 -84
- package/packages/utils/patchFiles.js +44 -44
- package/packages/utils/request.js +178 -178
- package/packages/utils/store.js +305 -303
- package/vue.config.js +59 -59
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// 导入组件,组件必须声明 name
|
|
2
|
-
import BaseGrid from './src/index.vue';
|
|
3
|
-
import VXETable from 'vxe-table'
|
|
4
|
-
// 为组件提供 install 安装方法,供按需引入
|
|
5
|
-
BaseGrid.install = function(Vue) {
|
|
6
|
-
Vue.use(VXETable)
|
|
7
|
-
Vue.component(BaseGrid.name, BaseGrid);
|
|
8
|
-
};
|
|
9
|
-
// 默认导出组件
|
|
1
|
+
// 导入组件,组件必须声明 name
|
|
2
|
+
import BaseGrid from './src/index.vue';
|
|
3
|
+
import VXETable from 'vxe-table'
|
|
4
|
+
// 为组件提供 install 安装方法,供按需引入
|
|
5
|
+
BaseGrid.install = function(Vue) {
|
|
6
|
+
Vue.use(VXETable)
|
|
7
|
+
Vue.component(BaseGrid.name, BaseGrid);
|
|
8
|
+
};
|
|
9
|
+
// 默认导出组件
|
|
10
10
|
export default BaseGrid;
|
|
@@ -1,279 +1,279 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="content-card">
|
|
3
|
-
<!-- 查询框 -->
|
|
4
|
-
<div style="margin: 10px 10px 10px 0px">
|
|
5
|
-
<a-input
|
|
6
|
-
ref="searchInput"
|
|
7
|
-
v-model="searchField"
|
|
8
|
-
placeholder="搜索添加更多字段"
|
|
9
|
-
><a-icon slot="prefix" type="search" />
|
|
10
|
-
</a-input>
|
|
11
|
-
</div>
|
|
12
|
-
<div :style="{ height: height-250+'px', overflow:'auto' }" class="field-content">
|
|
13
|
-
<div class="field-card">
|
|
14
|
-
<div class="card-tltle">显示字段</div>
|
|
15
|
-
<div ref="dragForm">
|
|
16
|
-
<div
|
|
17
|
-
:class="{ 'not-sort': searchField }"
|
|
18
|
-
v-for="item in columns.filter(x=> x.visible)"
|
|
19
|
-
:key="item.currentKey"
|
|
20
|
-
:data-id="item.currentKey"
|
|
21
|
-
class="drag-row show-sort"
|
|
22
|
-
v-show="showField(item.title)"
|
|
23
|
-
>
|
|
24
|
-
<div style="margin-right: 7px;" class="move">
|
|
25
|
-
<img src="../../styles/icon/drag.svg" alt="" style="width: 20px" >
|
|
26
|
-
</div>
|
|
27
|
-
<div style="flex: 1;" class="move">{{ item.title }}</div>
|
|
28
|
-
<div style="margin-left: auto;"><a-switch v-model="item.visible" @change="onCheckboxChange(item)" size="small"/></div>
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
</div>
|
|
32
|
-
<div class="field-card">
|
|
33
|
-
<div class="card-tltle">未显示字段</div>
|
|
34
|
-
<div ref="notShownField">
|
|
35
|
-
<div
|
|
36
|
-
v-for="(item, index) in columns.filter(x=> !x.visible)"
|
|
37
|
-
:key="index"
|
|
38
|
-
:data-id="index"
|
|
39
|
-
class="drag-row"
|
|
40
|
-
>
|
|
41
|
-
<div>{{ item.title }}</div>
|
|
42
|
-
<div style="margin-left: auto;">
|
|
43
|
-
<a-switch
|
|
44
|
-
:disabled="!item.sysVisible"
|
|
45
|
-
v-model="item.visible"
|
|
46
|
-
@change="onCheckboxChange(item)"
|
|
47
|
-
size="small"
|
|
48
|
-
/></div>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
</template>
|
|
55
|
-
<script>
|
|
56
|
-
import {
|
|
57
|
-
Row,
|
|
58
|
-
Col,
|
|
59
|
-
Input,
|
|
60
|
-
Checkbox,
|
|
61
|
-
Button,
|
|
62
|
-
Icon,
|
|
63
|
-
Switch,
|
|
64
|
-
} from "ant-design-vue";
|
|
65
|
-
import Sortable from 'sortablejs'
|
|
66
|
-
import { saveUserModuleDataFieldApi } from "../../utils/api";
|
|
67
|
-
export default {
|
|
68
|
-
components: {
|
|
69
|
-
"a-icon": Icon,
|
|
70
|
-
"a-row": Row,
|
|
71
|
-
"a-col": Col,
|
|
72
|
-
"a-input": Input,
|
|
73
|
-
"a-checkbox": Checkbox,
|
|
74
|
-
"a-button": Button,
|
|
75
|
-
"a-switch": Switch,
|
|
76
|
-
},
|
|
77
|
-
props: {
|
|
78
|
-
userDefineColumns: {
|
|
79
|
-
type: Array,
|
|
80
|
-
default: function () {
|
|
81
|
-
return [];
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
height: {
|
|
85
|
-
type: Number,
|
|
86
|
-
default: function () {
|
|
87
|
-
return 0;
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
moduleCode: {
|
|
91
|
-
type: String,
|
|
92
|
-
default: function () {
|
|
93
|
-
return '';
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
dataCode: {
|
|
97
|
-
type: String,
|
|
98
|
-
default: function () {
|
|
99
|
-
return '';
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
data() {
|
|
104
|
-
return {
|
|
105
|
-
searchField: null,
|
|
106
|
-
// 接收所有字段数据
|
|
107
|
-
adjustUserDefineColumns: [],
|
|
108
|
-
// 可显示字段数据
|
|
109
|
-
columns:[],
|
|
110
|
-
// 改变后顺序记录数组
|
|
111
|
-
currentSortKeys: [],
|
|
112
|
-
// 拖拽表单配置
|
|
113
|
-
options: {}
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
created() {
|
|
117
|
-
this.setColumnsOptions()
|
|
118
|
-
},
|
|
119
|
-
mounted() {
|
|
120
|
-
// 初始排序数组
|
|
121
|
-
this.currentSortKeys = this.columns.map(x=>x.currentKey)
|
|
122
|
-
this.setOptions()
|
|
123
|
-
},
|
|
124
|
-
methods: {
|
|
125
|
-
updateColumns(currentColumns) {
|
|
126
|
-
this.adjustUserDefineColumns = JSON.parse(JSON.stringify(currentColumns))
|
|
127
|
-
this.setColumnsOptions()
|
|
128
|
-
},
|
|
129
|
-
setColumnsOptions() {
|
|
130
|
-
this.adjustUserDefineColumns = this.userDefineColumns
|
|
131
|
-
// 设置唯一标识,用于保存时找到字段并重新排序
|
|
132
|
-
this.adjustUserDefineColumns.forEach((x, index)=> x.currentKey = index + x.field)
|
|
133
|
-
this.columns = [];
|
|
134
|
-
this.adjustUserDefineColumns.forEach((item) => {
|
|
135
|
-
// 去除操作列和序号、多选框列
|
|
136
|
-
if (item.field === "operation" || item.field == undefined) {
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
const column = {
|
|
140
|
-
currentKey: item.currentKey,
|
|
141
|
-
field: item.field,
|
|
142
|
-
title: item.title,
|
|
143
|
-
visible: item.visible,
|
|
144
|
-
sysVisible: item.params.sysVisible, // 系统隐藏字段不可操作
|
|
145
|
-
width: item.width,
|
|
146
|
-
filters: item.filters,
|
|
147
|
-
order: item.order,
|
|
148
|
-
}
|
|
149
|
-
this.columns.push(column);
|
|
150
|
-
})
|
|
151
|
-
},
|
|
152
|
-
// 配置方法
|
|
153
|
-
setOptions() {
|
|
154
|
-
var vm = this
|
|
155
|
-
//获取对象
|
|
156
|
-
var el = vm.$refs.dragForm
|
|
157
|
-
//设置配置
|
|
158
|
-
vm.options = {
|
|
159
|
-
group:'sortableDrag',
|
|
160
|
-
animation: 200,
|
|
161
|
-
handle:".move",
|
|
162
|
-
sort: true,
|
|
163
|
-
filter: ".not-sort", // not-sort用来控制筛选时不可拖拽
|
|
164
|
-
forceFallback: true, // 禁用html5原生拖拽行为,使得可以同时使用拖拽及鼠标滚轴
|
|
165
|
-
//拖动结束
|
|
166
|
-
onEnd: function (evt) {
|
|
167
|
-
//获取拖动后的排序
|
|
168
|
-
vm.currentSortKeys = sortable.toArray()
|
|
169
|
-
// 调取保存
|
|
170
|
-
vm.saveSortable()
|
|
171
|
-
},
|
|
172
|
-
};
|
|
173
|
-
//初始化
|
|
174
|
-
var sortable = Sortable.create(el, vm.options);
|
|
175
|
-
},
|
|
176
|
-
onCheckboxChange() {
|
|
177
|
-
let vm = this
|
|
178
|
-
// 在渲染切换后获取渲染后div内容,进行赋值
|
|
179
|
-
this.$nextTick(()=>{
|
|
180
|
-
let sortableElement = vm.$refs.dragForm
|
|
181
|
-
let sortKeys = []
|
|
182
|
-
for (let i = 0; i < sortableElement.children.length; i++) {
|
|
183
|
-
sortKeys.push(sortableElement.children[i].dataset.id)
|
|
184
|
-
}
|
|
185
|
-
vm.currentSortKeys = sortKeys
|
|
186
|
-
this.saveSortable()
|
|
187
|
-
})
|
|
188
|
-
// 保存之前将显示字段数组删除当前的
|
|
189
|
-
},
|
|
190
|
-
// 保存拖拽后排序
|
|
191
|
-
saveSortable() {
|
|
192
|
-
let vm = this
|
|
193
|
-
let postData = {
|
|
194
|
-
moduleCode: vm.moduleCode,
|
|
195
|
-
dataCode: vm.dataCode,
|
|
196
|
-
fields: [],
|
|
197
|
-
}
|
|
198
|
-
let currentDrag = JSON.parse(JSON.stringify(vm.currentSortKeys))
|
|
199
|
-
// 将不显示数组最后放入
|
|
200
|
-
let notShowColumns = vm.columns.filter(x=>!x.visible).map(i=>i.currentKey)
|
|
201
|
-
currentDrag.push(...notShowColumns)
|
|
202
|
-
// 循环按照当前顺序赋值序号
|
|
203
|
-
currentDrag.forEach((item, index) => {
|
|
204
|
-
let tempObject = vm.columns.find(x => x.currentKey == item)
|
|
205
|
-
let tempData = {
|
|
206
|
-
field: tempObject.field,
|
|
207
|
-
sort: index + 1,
|
|
208
|
-
hidden: !tempObject.visible,
|
|
209
|
-
width: tempObject.width,
|
|
210
|
-
extraInfo:{}
|
|
211
|
-
}
|
|
212
|
-
if (tempObject.filters && tempObject.filters[0].data.bindingValues.length) {
|
|
213
|
-
tempObject.filters[0].checked = true;
|
|
214
|
-
tempData.extraInfo.filterExpression = tempObject.filters
|
|
215
|
-
}
|
|
216
|
-
if (tempObject.order) {
|
|
217
|
-
tempData.extraInfo.order = tempObject.order
|
|
218
|
-
}
|
|
219
|
-
postData.fields.push(tempData)
|
|
220
|
-
})
|
|
221
|
-
saveUserModuleDataFieldApi(postData)
|
|
222
|
-
.then(res => {
|
|
223
|
-
// 返回表格组件触发更新
|
|
224
|
-
vm.$emit('saveSeqConfig',postData, res.content)
|
|
225
|
-
})
|
|
226
|
-
.catch((err) => {
|
|
227
|
-
console.debug(err)
|
|
228
|
-
})
|
|
229
|
-
.finally(() => {})
|
|
230
|
-
},
|
|
231
|
-
showField(title) {
|
|
232
|
-
let isShow = true
|
|
233
|
-
if (this.searchField && (title.indexOf(this.searchField) == -1)) {
|
|
234
|
-
isShow = false
|
|
235
|
-
}
|
|
236
|
-
return isShow
|
|
237
|
-
}
|
|
238
|
-
},
|
|
239
|
-
}
|
|
240
|
-
</script>
|
|
241
|
-
<style scoped lang="scss">
|
|
242
|
-
.content-card {
|
|
243
|
-
font-weight: 600;
|
|
244
|
-
min-width: 240px;
|
|
245
|
-
}
|
|
246
|
-
.show-sort:hover {
|
|
247
|
-
background-color: #f7f7f7;
|
|
248
|
-
}
|
|
249
|
-
.drag-row {
|
|
250
|
-
cursor: pointer;
|
|
251
|
-
padding-right: 5px;
|
|
252
|
-
height: 36px;
|
|
253
|
-
display: flex;
|
|
254
|
-
align-items: center;
|
|
255
|
-
}
|
|
256
|
-
/* 修改滚动条整体样式 */
|
|
257
|
-
.field-content::-webkit-scrollbar {
|
|
258
|
-
width: 7px; /* 设置滚动条宽度 */
|
|
259
|
-
}
|
|
260
|
-
/* 修改滚动条轨道样式 */
|
|
261
|
-
.field-content::-webkit-scrollbar-track {
|
|
262
|
-
background-color: #f1f1f1; /* 设置轨道背景色 */
|
|
263
|
-
}
|
|
264
|
-
/* 修改滚动条滑块样式 */
|
|
265
|
-
.field-content::-webkit-scrollbar-thumb {
|
|
266
|
-
background-color: #888; /* 设置滑块背景色 */
|
|
267
|
-
}
|
|
268
|
-
/* 修改滚动条滑块在hover状态下的样式 */
|
|
269
|
-
.field-content::-webkit-scrollbar-thumb:hover {
|
|
270
|
-
background-color: #555; /* 设置滑块hover时背景色 */
|
|
271
|
-
}
|
|
272
|
-
.field-card {
|
|
273
|
-
margin: 10px 10px 0px 0px;
|
|
274
|
-
font-size: 15px;
|
|
275
|
-
.card-tltle {
|
|
276
|
-
margin-bottom: 10px;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<div class="content-card">
|
|
3
|
+
<!-- 查询框 -->
|
|
4
|
+
<div style="margin: 10px 10px 10px 0px">
|
|
5
|
+
<a-input
|
|
6
|
+
ref="searchInput"
|
|
7
|
+
v-model="searchField"
|
|
8
|
+
placeholder="搜索添加更多字段"
|
|
9
|
+
><a-icon slot="prefix" type="search" />
|
|
10
|
+
</a-input>
|
|
11
|
+
</div>
|
|
12
|
+
<div :style="{ height: height-250+'px', overflow:'auto' }" class="field-content">
|
|
13
|
+
<div class="field-card">
|
|
14
|
+
<div class="card-tltle">显示字段</div>
|
|
15
|
+
<div ref="dragForm">
|
|
16
|
+
<div
|
|
17
|
+
:class="{ 'not-sort': searchField }"
|
|
18
|
+
v-for="item in columns.filter(x=> x.visible)"
|
|
19
|
+
:key="item.currentKey"
|
|
20
|
+
:data-id="item.currentKey"
|
|
21
|
+
class="drag-row show-sort"
|
|
22
|
+
v-show="showField(item.title)"
|
|
23
|
+
>
|
|
24
|
+
<div style="margin-right: 7px;" class="move">
|
|
25
|
+
<img src="../../styles/icon/drag.svg" alt="" style="width: 20px" >
|
|
26
|
+
</div>
|
|
27
|
+
<div style="flex: 1;" class="move">{{ item.title }}</div>
|
|
28
|
+
<div style="margin-left: auto;"><a-switch v-model="item.visible" @change="onCheckboxChange(item)" size="small"/></div>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
<div class="field-card">
|
|
33
|
+
<div class="card-tltle">未显示字段</div>
|
|
34
|
+
<div ref="notShownField">
|
|
35
|
+
<div
|
|
36
|
+
v-for="(item, index) in columns.filter(x=> !x.visible)"
|
|
37
|
+
:key="index"
|
|
38
|
+
:data-id="index"
|
|
39
|
+
class="drag-row"
|
|
40
|
+
>
|
|
41
|
+
<div>{{ item.title }}</div>
|
|
42
|
+
<div style="margin-left: auto;">
|
|
43
|
+
<a-switch
|
|
44
|
+
:disabled="!item.sysVisible"
|
|
45
|
+
v-model="item.visible"
|
|
46
|
+
@change="onCheckboxChange(item)"
|
|
47
|
+
size="small"
|
|
48
|
+
/></div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</template>
|
|
55
|
+
<script>
|
|
56
|
+
import {
|
|
57
|
+
Row,
|
|
58
|
+
Col,
|
|
59
|
+
Input,
|
|
60
|
+
Checkbox,
|
|
61
|
+
Button,
|
|
62
|
+
Icon,
|
|
63
|
+
Switch,
|
|
64
|
+
} from "ant-design-vue";
|
|
65
|
+
import Sortable from 'sortablejs'
|
|
66
|
+
import { saveUserModuleDataFieldApi } from "../../utils/api";
|
|
67
|
+
export default {
|
|
68
|
+
components: {
|
|
69
|
+
"a-icon": Icon,
|
|
70
|
+
"a-row": Row,
|
|
71
|
+
"a-col": Col,
|
|
72
|
+
"a-input": Input,
|
|
73
|
+
"a-checkbox": Checkbox,
|
|
74
|
+
"a-button": Button,
|
|
75
|
+
"a-switch": Switch,
|
|
76
|
+
},
|
|
77
|
+
props: {
|
|
78
|
+
userDefineColumns: {
|
|
79
|
+
type: Array,
|
|
80
|
+
default: function () {
|
|
81
|
+
return [];
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
height: {
|
|
85
|
+
type: Number,
|
|
86
|
+
default: function () {
|
|
87
|
+
return 0;
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
moduleCode: {
|
|
91
|
+
type: String,
|
|
92
|
+
default: function () {
|
|
93
|
+
return '';
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
dataCode: {
|
|
97
|
+
type: String,
|
|
98
|
+
default: function () {
|
|
99
|
+
return '';
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
data() {
|
|
104
|
+
return {
|
|
105
|
+
searchField: null,
|
|
106
|
+
// 接收所有字段数据
|
|
107
|
+
adjustUserDefineColumns: [],
|
|
108
|
+
// 可显示字段数据
|
|
109
|
+
columns:[],
|
|
110
|
+
// 改变后顺序记录数组
|
|
111
|
+
currentSortKeys: [],
|
|
112
|
+
// 拖拽表单配置
|
|
113
|
+
options: {}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
created() {
|
|
117
|
+
this.setColumnsOptions()
|
|
118
|
+
},
|
|
119
|
+
mounted() {
|
|
120
|
+
// 初始排序数组
|
|
121
|
+
this.currentSortKeys = this.columns.map(x=>x.currentKey)
|
|
122
|
+
this.setOptions()
|
|
123
|
+
},
|
|
124
|
+
methods: {
|
|
125
|
+
updateColumns(currentColumns) {
|
|
126
|
+
this.adjustUserDefineColumns = JSON.parse(JSON.stringify(currentColumns))
|
|
127
|
+
this.setColumnsOptions()
|
|
128
|
+
},
|
|
129
|
+
setColumnsOptions() {
|
|
130
|
+
this.adjustUserDefineColumns = this.userDefineColumns
|
|
131
|
+
// 设置唯一标识,用于保存时找到字段并重新排序
|
|
132
|
+
this.adjustUserDefineColumns.forEach((x, index)=> x.currentKey = index + x.field)
|
|
133
|
+
this.columns = [];
|
|
134
|
+
this.adjustUserDefineColumns.forEach((item) => {
|
|
135
|
+
// 去除操作列和序号、多选框列
|
|
136
|
+
if (item.field === "operation" || item.field == undefined) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const column = {
|
|
140
|
+
currentKey: item.currentKey,
|
|
141
|
+
field: item.field,
|
|
142
|
+
title: item.title,
|
|
143
|
+
visible: item.visible,
|
|
144
|
+
sysVisible: item.params.sysVisible, // 系统隐藏字段不可操作
|
|
145
|
+
width: item.width,
|
|
146
|
+
filters: item.filters,
|
|
147
|
+
order: item.order,
|
|
148
|
+
}
|
|
149
|
+
this.columns.push(column);
|
|
150
|
+
})
|
|
151
|
+
},
|
|
152
|
+
// 配置方法
|
|
153
|
+
setOptions() {
|
|
154
|
+
var vm = this
|
|
155
|
+
//获取对象
|
|
156
|
+
var el = vm.$refs.dragForm
|
|
157
|
+
//设置配置
|
|
158
|
+
vm.options = {
|
|
159
|
+
group:'sortableDrag',
|
|
160
|
+
animation: 200,
|
|
161
|
+
handle:".move",
|
|
162
|
+
sort: true,
|
|
163
|
+
filter: ".not-sort", // not-sort用来控制筛选时不可拖拽
|
|
164
|
+
forceFallback: true, // 禁用html5原生拖拽行为,使得可以同时使用拖拽及鼠标滚轴
|
|
165
|
+
//拖动结束
|
|
166
|
+
onEnd: function (evt) {
|
|
167
|
+
//获取拖动后的排序
|
|
168
|
+
vm.currentSortKeys = sortable.toArray()
|
|
169
|
+
// 调取保存
|
|
170
|
+
vm.saveSortable()
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
//初始化
|
|
174
|
+
var sortable = Sortable.create(el, vm.options);
|
|
175
|
+
},
|
|
176
|
+
onCheckboxChange() {
|
|
177
|
+
let vm = this
|
|
178
|
+
// 在渲染切换后获取渲染后div内容,进行赋值
|
|
179
|
+
this.$nextTick(()=>{
|
|
180
|
+
let sortableElement = vm.$refs.dragForm
|
|
181
|
+
let sortKeys = []
|
|
182
|
+
for (let i = 0; i < sortableElement.children.length; i++) {
|
|
183
|
+
sortKeys.push(sortableElement.children[i].dataset.id)
|
|
184
|
+
}
|
|
185
|
+
vm.currentSortKeys = sortKeys
|
|
186
|
+
this.saveSortable()
|
|
187
|
+
})
|
|
188
|
+
// 保存之前将显示字段数组删除当前的
|
|
189
|
+
},
|
|
190
|
+
// 保存拖拽后排序
|
|
191
|
+
saveSortable() {
|
|
192
|
+
let vm = this
|
|
193
|
+
let postData = {
|
|
194
|
+
moduleCode: vm.moduleCode,
|
|
195
|
+
dataCode: vm.dataCode,
|
|
196
|
+
fields: [],
|
|
197
|
+
}
|
|
198
|
+
let currentDrag = JSON.parse(JSON.stringify(vm.currentSortKeys))
|
|
199
|
+
// 将不显示数组最后放入
|
|
200
|
+
let notShowColumns = vm.columns.filter(x=>!x.visible).map(i=>i.currentKey)
|
|
201
|
+
currentDrag.push(...notShowColumns)
|
|
202
|
+
// 循环按照当前顺序赋值序号
|
|
203
|
+
currentDrag.forEach((item, index) => {
|
|
204
|
+
let tempObject = vm.columns.find(x => x.currentKey == item)
|
|
205
|
+
let tempData = {
|
|
206
|
+
field: tempObject.field,
|
|
207
|
+
sort: index + 1,
|
|
208
|
+
hidden: !tempObject.visible,
|
|
209
|
+
width: tempObject.width,
|
|
210
|
+
extraInfo:{}
|
|
211
|
+
}
|
|
212
|
+
if (tempObject.filters && tempObject.filters[0].data.bindingValues.length) {
|
|
213
|
+
tempObject.filters[0].checked = true;
|
|
214
|
+
tempData.extraInfo.filterExpression = tempObject.filters
|
|
215
|
+
}
|
|
216
|
+
if (tempObject.order) {
|
|
217
|
+
tempData.extraInfo.order = tempObject.order
|
|
218
|
+
}
|
|
219
|
+
postData.fields.push(tempData)
|
|
220
|
+
})
|
|
221
|
+
saveUserModuleDataFieldApi(postData)
|
|
222
|
+
.then(res => {
|
|
223
|
+
// 返回表格组件触发更新
|
|
224
|
+
vm.$emit('saveSeqConfig',postData, res.content)
|
|
225
|
+
})
|
|
226
|
+
.catch((err) => {
|
|
227
|
+
console.debug(err)
|
|
228
|
+
})
|
|
229
|
+
.finally(() => {})
|
|
230
|
+
},
|
|
231
|
+
showField(title) {
|
|
232
|
+
let isShow = true
|
|
233
|
+
if (this.searchField && (title.indexOf(this.searchField) == -1)) {
|
|
234
|
+
isShow = false
|
|
235
|
+
}
|
|
236
|
+
return isShow
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
}
|
|
240
|
+
</script>
|
|
241
|
+
<style scoped lang="scss">
|
|
242
|
+
.content-card {
|
|
243
|
+
font-weight: 600;
|
|
244
|
+
min-width: 240px;
|
|
245
|
+
}
|
|
246
|
+
.show-sort:hover {
|
|
247
|
+
background-color: #f7f7f7;
|
|
248
|
+
}
|
|
249
|
+
.drag-row {
|
|
250
|
+
cursor: pointer;
|
|
251
|
+
padding-right: 5px;
|
|
252
|
+
height: 36px;
|
|
253
|
+
display: flex;
|
|
254
|
+
align-items: center;
|
|
255
|
+
}
|
|
256
|
+
/* 修改滚动条整体样式 */
|
|
257
|
+
.field-content::-webkit-scrollbar {
|
|
258
|
+
width: 7px; /* 设置滚动条宽度 */
|
|
259
|
+
}
|
|
260
|
+
/* 修改滚动条轨道样式 */
|
|
261
|
+
.field-content::-webkit-scrollbar-track {
|
|
262
|
+
background-color: #f1f1f1; /* 设置轨道背景色 */
|
|
263
|
+
}
|
|
264
|
+
/* 修改滚动条滑块样式 */
|
|
265
|
+
.field-content::-webkit-scrollbar-thumb {
|
|
266
|
+
background-color: #888; /* 设置滑块背景色 */
|
|
267
|
+
}
|
|
268
|
+
/* 修改滚动条滑块在hover状态下的样式 */
|
|
269
|
+
.field-content::-webkit-scrollbar-thumb:hover {
|
|
270
|
+
background-color: #555; /* 设置滑块hover时背景色 */
|
|
271
|
+
}
|
|
272
|
+
.field-card {
|
|
273
|
+
margin: 10px 10px 0px 0px;
|
|
274
|
+
font-size: 15px;
|
|
275
|
+
.card-tltle {
|
|
276
|
+
margin-bottom: 10px;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
279
|
</style>
|