@weitutech/by-components 1.0.31 → 1.1.1
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/README.md +30 -3
- package/lib/by-components.common.js +7831 -58668
- package/lib/by-components.umd.js +7631 -58451
- package/lib/by-components.umd.min.js +2 -301
- package/package.json +24 -5
- package/CHANGELOG.md +0 -44
- package/docs/extension.md +0 -15
- package/docs/form.md +0 -52
- package/docs/table.md +0 -26
- package/src/components/custom-column/index.vue +0 -369
- package/src/components/fold-search/index.vue +0 -29
- package/src/components/form/comps/custom-date-picker.vue +0 -135
- package/src/components/form/comps/date-picker-range.vue +0 -78
- package/src/components/form/comps/pair-number-input.vue +0 -67
- package/src/components/form/comps/select.vue +0 -127
- package/src/components/form/form.vue +0 -369
- package/src/components/page-search/page-search.vue +0 -114
- package/src/components/pager/index.vue +0 -81
- package/src/components/table/index.vue +0 -240
- package/src/index.js +0 -31
- package/src/plugin/vxeTable.js +0 -300
- package/src/plugin/vxeTable.scss +0 -14
- package/src/style/custom-column.scss +0 -194
- package/src/style/fold-search.scss +0 -21
- package/src/style/form.scss +0 -342
- package/src/style/index.scss +0 -6
- package/src/style/page-search.scss +0 -26
- package/src/style/pager.scss +0 -40
- package/src/style/table.scss +0 -39
- package/src/utils/index.js +0 -32
package/package.json
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weitutech/by-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"private": false,
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "lib/by-components.umd.js",
|
|
6
|
+
"module": "lib/by-components.esm.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"lib",
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"sideEffects": [
|
|
12
|
+
"*.vue",
|
|
13
|
+
"*.scss"
|
|
14
|
+
],
|
|
6
15
|
"scripts": {
|
|
7
16
|
"dev": "vue-cli-service serve",
|
|
8
17
|
"build": "npm run build:js && npm run build:css",
|
|
9
18
|
"build:js": "vue-cli-service build --target lib --name by-components src/index.js",
|
|
10
|
-
"build:css": "sass src/style/index.scss lib/index.css --no-source-map --style=compressed"
|
|
19
|
+
"build:css": "sass src/style/index.scss lib/index.css --no-source-map --style=compressed",
|
|
20
|
+
"lint:fix": "eslint --ext .js,.vue src --fix",
|
|
21
|
+
"format": "prettier --write \"src/**/*.{js,vue,json,scss}\""
|
|
11
22
|
},
|
|
12
23
|
"dependencies": {
|
|
13
24
|
"axios": "^1.7.7",
|
|
@@ -18,15 +29,23 @@
|
|
|
18
29
|
"moment": "^2.30.1",
|
|
19
30
|
"vue": "^2.6.14",
|
|
20
31
|
"vuedraggable": "^2.24.3",
|
|
21
|
-
"vxe-table": "3.8.24"
|
|
32
|
+
"vxe-table": "^3.8.24"
|
|
22
33
|
},
|
|
23
34
|
"devDependencies": {
|
|
35
|
+
"@babel/core": "^7.19.1",
|
|
24
36
|
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
|
|
25
37
|
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
|
|
38
|
+
"@babel/preset-env": "^7.27.2",
|
|
26
39
|
"@vue/cli-plugin-babel": "~5.0.0",
|
|
27
40
|
"@vue/cli-service": "~5.0.0",
|
|
41
|
+
"@vue/eslint-config-prettier": "^10.2.0",
|
|
42
|
+
"eslint": "^8.57.1",
|
|
43
|
+
"eslint-config-prettier": "^9.1.0",
|
|
44
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
45
|
+
"eslint-plugin-vue": "^9.3.0",
|
|
46
|
+
"prettier": "^3.5.3",
|
|
28
47
|
"sass": "^1.79.4",
|
|
29
48
|
"sass-loader": "^16.0.2",
|
|
30
49
|
"vue-template-compiler": "^2.6.14"
|
|
31
50
|
}
|
|
32
|
-
}
|
|
51
|
+
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# 1.0.30 (2025-04-17)
|
|
2
|
-
|
|
3
|
-
### feat
|
|
4
|
-
|
|
5
|
-
- 增加表格列表的保存
|
|
6
|
-
|
|
7
|
-
# 1.0.27 (2024-12-04)
|
|
8
|
-
|
|
9
|
-
### 🍏 Perf
|
|
10
|
-
|
|
11
|
-
- 多级表头分组之间增加间隔
|
|
12
|
-
|
|
13
|
-
# 1.0.26 (2024-12-04)
|
|
14
|
-
|
|
15
|
-
### 🐞 Bug fixes
|
|
16
|
-
|
|
17
|
-
- 修复自定义列中,没有列设置 fixed 时的报错
|
|
18
|
-
|
|
19
|
-
# 1.0.25 (2024-12-04)
|
|
20
|
-
|
|
21
|
-
### 🍏 Perf
|
|
22
|
-
|
|
23
|
-
- 自定义列支持多级表头展示
|
|
24
|
-
|
|
25
|
-
# 1.0.24 (2024-11-30)
|
|
26
|
-
|
|
27
|
-
### 🐞 Bug fixes
|
|
28
|
-
|
|
29
|
-
- 修复表单中通过插槽的组件数据被清空问题导致卡顿问题
|
|
30
|
-
|
|
31
|
-
### 🍏 Perf
|
|
32
|
-
|
|
33
|
-
- 优化选择器组件移除 input 事件、防止选择器选择的时候执行两次
|
|
34
|
-
|
|
35
|
-
# 1.0.23 (2024-11-25)
|
|
36
|
-
|
|
37
|
-
### 🐞 Bug fixes
|
|
38
|
-
|
|
39
|
-
- 修复日期选择器组件在 form 表格组件中使用时对多个不同的时间配置设置初始时间没有生效问题
|
|
40
|
-
|
|
41
|
-
### 🍏 Perf
|
|
42
|
-
|
|
43
|
-
- 优化日期选择器手动设置自定义值的时候自动匹配高亮出现有的时间选项
|
|
44
|
-
- 优化表格组件中对最大宽度和最小宽度的设置
|
package/docs/extension.md
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
### 如需要扩展
|
|
2
|
-
|
|
3
|
-
1. 应从 vex-table 第三方组件库查看是否有相应的功能
|
|
4
|
-
|
|
5
|
-
2. 如需要加入通用实用的表单元素、应该先考虑在组件form中加入、其次是以custom插槽的形式插入
|
|
6
|
-
|
|
7
|
-
### 第三方插件
|
|
8
|
-
|
|
9
|
-
[element-ui](https://element.eleme.cn/#/zh-CN)
|
|
10
|
-
|
|
11
|
-
[vuedraggable](https://www.npmjs.com/package/vuedraggable)
|
|
12
|
-
|
|
13
|
-
[vxe-table](https://vxetable.cn/pluginDocs/table3/#/demo/list)
|
|
14
|
-
|
|
15
|
-
[moment](https://momentjs.cn/)
|
package/docs/form.md
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
### 类型(没有注册看 Element 的组件使用方法)
|
|
2
|
-
|
|
3
|
-
```
|
|
4
|
-
| 'input'
|
|
5
|
-
| 'inputNumber'
|
|
6
|
-
| 'select'
|
|
7
|
-
| 'treeSelect'
|
|
8
|
-
| 'datepicker'
|
|
9
|
-
| 'cascader'
|
|
10
|
-
| 'switch'
|
|
11
|
-
| 'checkbox'
|
|
12
|
-
| 'radio'
|
|
13
|
-
| 'upload'
|
|
14
|
-
| 'customDatePicker' // 自定义的时间选择器
|
|
15
|
-
| 'search' // 搜索按钮区域
|
|
16
|
-
| 'custom' // 自定义
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
#### Event
|
|
20
|
-
|
|
21
|
-
| 事件 | 参数 |
|
|
22
|
-
| ------------- | ------------------- |
|
|
23
|
-
| change | context: IFormItems |
|
|
24
|
-
| queryBtnClick | 无 |
|
|
25
|
-
|
|
26
|
-
完整案列见 [表单 by-form](../README.md)
|
|
27
|
-
|
|
28
|
-
### 特殊说明
|
|
29
|
-
|
|
30
|
-
#### 'customDatePicker'特别说明
|
|
31
|
-
|
|
32
|
-
自定义时间选中器同时支持时间段方式绑定值 和 单独时间方式绑定值
|
|
33
|
-
|
|
34
|
-
```
|
|
35
|
-
// 时间段方式绑定值
|
|
36
|
-
{
|
|
37
|
-
type: 'customDatePicker',
|
|
38
|
-
field: 'report_time',
|
|
39
|
-
label: '报表时间'
|
|
40
|
-
}
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
// 单独时间方式绑定值
|
|
45
|
-
{
|
|
46
|
-
type: 'customDatePicker',
|
|
47
|
-
field: 'report_time', // 仍然保留原来的字段,保证兼容性
|
|
48
|
-
startTimeField: 'start_time', // 新增开始时间字段
|
|
49
|
-
endTimeField: 'end_time', // 新增结束时间字段
|
|
50
|
-
label: '报表时间'
|
|
51
|
-
}
|
|
52
|
-
```
|
package/docs/table.md
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
### table
|
|
2
|
-
#### 自定义列宽
|
|
3
|
-
注意📢: 一个项目中的name属性千万不能重名、一个项目中的name属性千万不能重名、一个项目中的name属性千万不能重名
|
|
4
|
-
给table组件设置name值属性、类型为String格式、表格会自动缓存用户拖拽之后的结果
|
|
5
|
-
#### 自定义列
|
|
6
|
-
给table组件设置以下对象
|
|
7
|
-
customColumnConfig: { // 自定义列
|
|
8
|
-
showCustomColumn: true, // 是否显示自定义列
|
|
9
|
-
infoMethod: getCustomTableList, // 回显用的接口
|
|
10
|
-
infoMethodParams: {}, // 回显用的接口参数
|
|
11
|
-
submitMethod: setCustomTableList, // 保存用的接口
|
|
12
|
-
submitMethodParams: {}, // 保存用的接口参数
|
|
13
|
-
slots: ["source_material_count"] // 需要使用插槽的字段集合
|
|
14
|
-
}
|
|
15
|
-
并通过事件Event @setColumn="handleSetColumn" 实现对列的设置
|
|
16
|
-
const handleSetColumn = (columns) => {
|
|
17
|
-
this.gridOptions.columns = [
|
|
18
|
-
{ type: "checkbox", width: 50, fixed: "left" },
|
|
19
|
-
{ type: "seq", width: 50, fixed: "left", title: "序号" },
|
|
20
|
-
...columns,
|
|
21
|
-
{ title: "操作", width: 80, fixed: "right", slots: { default: "operate" }}
|
|
22
|
-
]
|
|
23
|
-
}
|
|
24
|
-
#### Event
|
|
25
|
-
见[第三方插件vxe-table](./extension.md)
|
|
26
|
-
完整案列见 [表格 by-table](../README.md)
|
|
@@ -1,369 +0,0 @@
|
|
|
1
|
-
<!-- 自定义表头 -->
|
|
2
|
-
<template>
|
|
3
|
-
<div id="custom_column">
|
|
4
|
-
<el-dialog
|
|
5
|
-
:close-on-click-modal="false"
|
|
6
|
-
:visible="dialogVisible"
|
|
7
|
-
width="920px"
|
|
8
|
-
:append-to-body="true"
|
|
9
|
-
:show-close="false"
|
|
10
|
-
custom-class="custom_dialog_class"
|
|
11
|
-
@close="closeDialog"
|
|
12
|
-
>
|
|
13
|
-
<div class="el-dialog-box">
|
|
14
|
-
<!-- 数据指标 -->
|
|
15
|
-
<div class="left_box">
|
|
16
|
-
<div class="box_title">数据指标</div>
|
|
17
|
-
<div class="row" style="padding-right: 20px;">
|
|
18
|
-
<div class="cell">
|
|
19
|
-
<el-input
|
|
20
|
-
v-model="search"
|
|
21
|
-
style="width: 228px; margin-bottom: 10px"
|
|
22
|
-
placeholder="搜索指标"
|
|
23
|
-
size="medium"
|
|
24
|
-
prefix-icon="el-icon-search"
|
|
25
|
-
/>
|
|
26
|
-
</div>
|
|
27
|
-
<el-button type="text" @click="selectNone">全不选</el-button>
|
|
28
|
-
</div>
|
|
29
|
-
<div class="left_box_body">
|
|
30
|
-
<div class="left_nav">
|
|
31
|
-
<ul>
|
|
32
|
-
<li
|
|
33
|
-
v-for="(item, index) in checkBoxMenuBySearch"
|
|
34
|
-
:key="index"
|
|
35
|
-
:class="{ active: activeId === index }"
|
|
36
|
-
@click="setHighlight(index)"
|
|
37
|
-
>
|
|
38
|
-
{{ item.label }}
|
|
39
|
-
</li>
|
|
40
|
-
</ul>
|
|
41
|
-
</div>
|
|
42
|
-
<div class="left_menu">
|
|
43
|
-
<div v-for="(item, index) in checkBoxMenuBySearch" :key="index" ref="tagItem">
|
|
44
|
-
<div class="checkbox_title">
|
|
45
|
-
{{ item.label }}
|
|
46
|
-
</div>
|
|
47
|
-
<el-row>
|
|
48
|
-
<el-col
|
|
49
|
-
v-for="(each, idx) in item.data"
|
|
50
|
-
:key="idx"
|
|
51
|
-
:span="12"
|
|
52
|
-
style="margin-bottom:3px"
|
|
53
|
-
>
|
|
54
|
-
<el-checkbox
|
|
55
|
-
v-model="each.type"
|
|
56
|
-
@change="changeCheckbox(each.key,each.type)"
|
|
57
|
-
>
|
|
58
|
-
{{ each.label }}
|
|
59
|
-
</el-checkbox>
|
|
60
|
-
</el-col>
|
|
61
|
-
</el-row>
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
<!-- 已选指标 -->
|
|
67
|
-
<div class="right_box">
|
|
68
|
-
<div class="drag_box">
|
|
69
|
-
<el-row>
|
|
70
|
-
<div class="drag_text_box">
|
|
71
|
-
<span class="drag_title">{{`已选指标(${number})`}}</span>
|
|
72
|
-
<span class="recover" @click="recoverDefault">恢复默认</span>
|
|
73
|
-
</div>
|
|
74
|
-
</el-row>
|
|
75
|
-
<div class="drag_ul">
|
|
76
|
-
<draggable
|
|
77
|
-
v-model="draggableMenu"
|
|
78
|
-
chosen-class="chosen"
|
|
79
|
-
force-fallback="true"
|
|
80
|
-
animation="500"
|
|
81
|
-
@end="onEnd"
|
|
82
|
-
>
|
|
83
|
-
<transition-group>
|
|
84
|
-
<div
|
|
85
|
-
v-for="(col) in draggableMenu"
|
|
86
|
-
v-show="col.type"
|
|
87
|
-
:class="col.key === 'sort-cut-off' ? 'fixedClass' : 'drag_li_box'"
|
|
88
|
-
:key="col.key"
|
|
89
|
-
>
|
|
90
|
-
<div v-if="col.key !== 'sort-cut-off'">
|
|
91
|
-
<i class="el-icon-rank icon-box" />
|
|
92
|
-
<span class="drag_li_text">{{ col.label }}</span>
|
|
93
|
-
</div>
|
|
94
|
-
<i
|
|
95
|
-
v-if="col.key !== 'sort-cut-off'"
|
|
96
|
-
class="el-icon-close remove"
|
|
97
|
-
@click="changeCheckbox(col.key, false)"
|
|
98
|
-
/>
|
|
99
|
-
</div>
|
|
100
|
-
</transition-group>
|
|
101
|
-
</draggable>
|
|
102
|
-
</div>
|
|
103
|
-
</div>
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
<template #footer>
|
|
107
|
-
<el-row style="margin-top: 7px">
|
|
108
|
-
<el-button
|
|
109
|
-
size="small"
|
|
110
|
-
style="width: 96px"
|
|
111
|
-
@click="closeDialog"
|
|
112
|
-
>取消</el-button>
|
|
113
|
-
<el-button
|
|
114
|
-
size="small"
|
|
115
|
-
style="width: 96px"
|
|
116
|
-
type="primary"
|
|
117
|
-
@click="submit"
|
|
118
|
-
>确定</el-button>
|
|
119
|
-
</el-row>
|
|
120
|
-
</template>
|
|
121
|
-
</el-dialog>
|
|
122
|
-
</div>
|
|
123
|
-
</template>
|
|
124
|
-
|
|
125
|
-
<script>
|
|
126
|
-
import draggable from "vuedraggable"
|
|
127
|
-
import { deepClone } from "../../utils/index"
|
|
128
|
-
export default {
|
|
129
|
-
name: "CustomColumn",
|
|
130
|
-
components: {
|
|
131
|
-
draggable
|
|
132
|
-
},
|
|
133
|
-
props: {
|
|
134
|
-
dialogVisible: {
|
|
135
|
-
type: Boolean,
|
|
136
|
-
default: false
|
|
137
|
-
},
|
|
138
|
-
infoMethod: {
|
|
139
|
-
type: Function,
|
|
140
|
-
required: true,
|
|
141
|
-
default: () => {}
|
|
142
|
-
},
|
|
143
|
-
submitMethod: {
|
|
144
|
-
type: Function,
|
|
145
|
-
required: true,
|
|
146
|
-
default: () => {}
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
data() {
|
|
150
|
-
return {
|
|
151
|
-
draggableMenu: [],
|
|
152
|
-
/** 勾选的主标题菜单 */
|
|
153
|
-
checkBoxMenu: [],
|
|
154
|
-
/** 选中高亮的菜单ID */
|
|
155
|
-
activeId: 0,
|
|
156
|
-
/** 表头id */
|
|
157
|
-
id: undefined,
|
|
158
|
-
/** 表格列接口路径 */
|
|
159
|
-
page: "",
|
|
160
|
-
/** 搜索字段 */
|
|
161
|
-
search: "",
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
computed: {
|
|
165
|
-
number() {
|
|
166
|
-
return this.draggableMenu.filter(item => item.type && item.key !== "sort-cut-off").length
|
|
167
|
-
},
|
|
168
|
-
checkBoxMenuBySearch() {
|
|
169
|
-
if (this.search) {
|
|
170
|
-
return this.checkBoxMenu.map(group => {
|
|
171
|
-
const filteredItems = group.data.filter(item => item.label.includes(this.search))
|
|
172
|
-
return {
|
|
173
|
-
label: group.label,
|
|
174
|
-
data: filteredItems
|
|
175
|
-
};
|
|
176
|
-
}).filter(group => group.data.length > 0)
|
|
177
|
-
} else {
|
|
178
|
-
return this.checkBoxMenu
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
},
|
|
183
|
-
methods: {
|
|
184
|
-
deepClone,
|
|
185
|
-
/**
|
|
186
|
-
* @describe 获取自定义表头数据
|
|
187
|
-
* @param { string } page 表格列接口路径
|
|
188
|
-
* @param { object[] } column 列数据
|
|
189
|
-
*/
|
|
190
|
-
async getCustomTableList(page, column) {
|
|
191
|
-
if (!page) {
|
|
192
|
-
throw new Error("缺少表格列接口路径");
|
|
193
|
-
} else {
|
|
194
|
-
// 克隆一份
|
|
195
|
-
this.columnList = this.deepClone(column)
|
|
196
|
-
this.page = page || ""
|
|
197
|
-
const bePreservedColumn = []
|
|
198
|
-
const res = await this.infoMethod({ page: page })
|
|
199
|
-
if (JSON.stringify(res.data) !== "[]") {
|
|
200
|
-
this.id = res.data.id || undefined
|
|
201
|
-
res.data.column.forEach(col => bePreservedColumn.push(...col.data))
|
|
202
|
-
}
|
|
203
|
-
this.initTableList(this.deepClone(column), bePreservedColumn)
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
/**
|
|
207
|
-
* @describe 第一次保存执行的函数(还未保存过的情况下)
|
|
208
|
-
* @param { object[] } initColumn 初始的列数据
|
|
209
|
-
* @param { object[] } bePreservedColumn 被保存过的列数据
|
|
210
|
-
*/
|
|
211
|
-
initTableList(initColumn, bePreservedColumn = []) {
|
|
212
|
-
const setDraggableMenu = (arr) => {
|
|
213
|
-
const cols = []
|
|
214
|
-
arr.forEach(item => cols.push(...item.data))
|
|
215
|
-
cols.sort((a, b) => a.sort - b.sort)
|
|
216
|
-
if(cols.some(item=> item.fixed)) {
|
|
217
|
-
let cutOffIndex = 0
|
|
218
|
-
for(let index = 0; index <= cols.length; index++) {
|
|
219
|
-
const col = cols[index]
|
|
220
|
-
const nextCol = cols[index + 1]
|
|
221
|
-
if (col.fixed === "left" && (!nextCol || !nextCol.fixed)) {
|
|
222
|
-
cutOffIndex = index + 1
|
|
223
|
-
break
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
cols.splice(cutOffIndex, 0, {
|
|
227
|
-
type: true,
|
|
228
|
-
label: "",
|
|
229
|
-
key: "sort-cut-off",
|
|
230
|
-
parent: ""
|
|
231
|
-
})
|
|
232
|
-
}
|
|
233
|
-
return cols
|
|
234
|
-
}
|
|
235
|
-
if (bePreservedColumn && bePreservedColumn.length > 0) {
|
|
236
|
-
// 需要处理被保存过的进行回显
|
|
237
|
-
initColumn.forEach((cols) => {
|
|
238
|
-
cols.data.forEach((col) => {
|
|
239
|
-
const beSaveCol = bePreservedColumn.find(item => item.key === col.key) || {}
|
|
240
|
-
col.type = (beSaveCol.type === "true" || beSaveCol.type === true) ? true : false
|
|
241
|
-
col.sort = beSaveCol.sort
|
|
242
|
-
col.fixed = beSaveCol.fixed ? beSaveCol.fixed : col.fixed,
|
|
243
|
-
col.parent = { label: cols.label }
|
|
244
|
-
})
|
|
245
|
-
})
|
|
246
|
-
// 需要显示的列的数据
|
|
247
|
-
this.checkBoxMenu = this.deepClone(initColumn)
|
|
248
|
-
this.draggableMenu = setDraggableMenu(this.checkBoxMenu)
|
|
249
|
-
} else {
|
|
250
|
-
// 从未被保存过
|
|
251
|
-
let num = 0
|
|
252
|
-
initColumn.forEach((cols) => {
|
|
253
|
-
cols.data.forEach((col) => {
|
|
254
|
-
num++
|
|
255
|
-
col.type = true
|
|
256
|
-
col.width = col.width ? +col.width : 0,
|
|
257
|
-
col.sort = num
|
|
258
|
-
col.parent = { label: cols.label }
|
|
259
|
-
})
|
|
260
|
-
})
|
|
261
|
-
this.checkBoxMenu = this.deepClone(initColumn)
|
|
262
|
-
this.draggableMenu = setDraggableMenu(this.checkBoxMenu)
|
|
263
|
-
}
|
|
264
|
-
this.$emit("changeTable", this.draggableMenu.filter(item => item.key !== "sort-cut-off").sort((a, b) => a.sort - b.sort))
|
|
265
|
-
this.$emit("changeTableGroup", this.checkBoxMenu)
|
|
266
|
-
},
|
|
267
|
-
// 全不选
|
|
268
|
-
selectNone() {
|
|
269
|
-
this.checkBoxMenu.forEach(cols => cols.data.forEach(col => col.type = false))
|
|
270
|
-
this.draggableMenu.forEach(item => {
|
|
271
|
-
if (item.key === "sort-cut-off") {
|
|
272
|
-
item.type = true
|
|
273
|
-
} else {
|
|
274
|
-
item.type = false
|
|
275
|
-
}
|
|
276
|
-
})
|
|
277
|
-
},
|
|
278
|
-
/**
|
|
279
|
-
* @describe 点击高亮
|
|
280
|
-
* @param { number } index 索引
|
|
281
|
-
*/
|
|
282
|
-
setHighlight(index) {
|
|
283
|
-
this.activeId = index
|
|
284
|
-
if (this.$refs.tagItem) {
|
|
285
|
-
this.$refs.tagItem[index].scrollIntoView({ behavior: "smooth" })
|
|
286
|
-
}
|
|
287
|
-
},
|
|
288
|
-
/**
|
|
289
|
-
* @describe 勾选、关闭
|
|
290
|
-
* @param { string } key 唯一标识
|
|
291
|
-
* @param { boolean } type 是否显示
|
|
292
|
-
*/
|
|
293
|
-
changeCheckbox(key, type) {
|
|
294
|
-
this.draggableMenu.forEach(item => {
|
|
295
|
-
if (item.key === key) {
|
|
296
|
-
item.type = type
|
|
297
|
-
}
|
|
298
|
-
})
|
|
299
|
-
this.checkBoxMenu.forEach(item => {
|
|
300
|
-
item.data.forEach(each => {
|
|
301
|
-
if (each.key === key) {
|
|
302
|
-
each.type = type
|
|
303
|
-
}
|
|
304
|
-
})
|
|
305
|
-
})
|
|
306
|
-
},
|
|
307
|
-
// 恢复默认
|
|
308
|
-
recoverDefault() {
|
|
309
|
-
this.initTableList(this.deepClone(this.columnList))
|
|
310
|
-
},
|
|
311
|
-
// 拖拽结束事件
|
|
312
|
-
onEnd() {
|
|
313
|
-
let isFixed = true
|
|
314
|
-
this.draggableMenu.forEach((item, index) => {
|
|
315
|
-
if (item.key === "sort-cut-off") { isFixed = false }
|
|
316
|
-
if (isFixed) {
|
|
317
|
-
item.sort = index + 1
|
|
318
|
-
item.fixed = "left"
|
|
319
|
-
} else {
|
|
320
|
-
item.sort = index
|
|
321
|
-
delete item.fixed
|
|
322
|
-
}
|
|
323
|
-
})
|
|
324
|
-
},
|
|
325
|
-
// 点击保存
|
|
326
|
-
async submit() {
|
|
327
|
-
const params = {
|
|
328
|
-
column: [],
|
|
329
|
-
id: this.id,
|
|
330
|
-
page: this.page
|
|
331
|
-
}
|
|
332
|
-
this.draggableMenu.forEach(item => {
|
|
333
|
-
if (item.key !== "sort-cut-off") {
|
|
334
|
-
const { parent, ...other } = item
|
|
335
|
-
// 是否存在
|
|
336
|
-
const isExit = params.column.some(col => col.label === parent.label)
|
|
337
|
-
if (isExit) {
|
|
338
|
-
params.column.forEach(col => {
|
|
339
|
-
if (col.label === parent.label) {
|
|
340
|
-
col.data.push(other)
|
|
341
|
-
}
|
|
342
|
-
})
|
|
343
|
-
} else {
|
|
344
|
-
params.column.push({
|
|
345
|
-
label: parent.label,
|
|
346
|
-
data: [other]
|
|
347
|
-
})
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
})
|
|
351
|
-
await this.submitMethod(params)
|
|
352
|
-
const cols = []
|
|
353
|
-
params.column.forEach(item => {
|
|
354
|
-
cols.push(...item.data)
|
|
355
|
-
})
|
|
356
|
-
this.$emit("changeTable", cols.sort((a, b) => a.sort - b.sort))
|
|
357
|
-
this.$emit("changeTableGroup", params.column)
|
|
358
|
-
this.closeDialog()
|
|
359
|
-
},
|
|
360
|
-
// 关闭弹窗
|
|
361
|
-
closeDialog() {
|
|
362
|
-
// 重置数据
|
|
363
|
-
this.search = ""
|
|
364
|
-
this.activeId = 0
|
|
365
|
-
this.$emit("closeDialog")
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
</script>
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="drawer_query_btn b-fold-search">
|
|
3
|
-
<div @click="drawer">
|
|
4
|
-
<template v-if="show == true">
|
|
5
|
-
<span style="color: #3aa1ff; vertical-align:middle;">收起</span> <img style="vertical-align:middle;" src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+PHN2ZyBjbGFzcz0iaWNvbiIgd2lkdGg9IjIwMHB4IiBoZWlnaHQ9IjIwMC4wMHB4IiB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZmlsbD0iIzVjYWRmZiIgZD0iTTg3Ny41IDU2NS45bC0zNjcuNi0zNDAtMzY3LjYgMzQwYy0yMi41IDE0LjUtNTIuNSAxNC41LTY3LjUgMC0xNS0yMS43LTE1LTUwLjcgMC02NS4xTDQ5NSAxMTcuNWMwLTcuMiA3LjUtNy4yIDE1LTcuMnM3LjUgMCAxNSA3LjJsNDIwLjIgMzgzLjNjMjIuNSAyMS43IDE1IDUwLjYgMCA2NS4xLTIyLjcgMTQuNS01Mi43IDE0LjUtNjcuNyAwek00OTQuOCA0NTAuMWMwLTcuMiA3LjUtNy4yIDE1LTcuMnMxNSAwIDE1IDcuMkw5NDUgODMzLjRjMjIuNSAyMS43IDE1IDUwLjYgMCA2NS4xLTIyLjUgMTQuNC01Mi41IDE0LjQtNjcuNSAwTDUwOS44IDU1OC42IDE0Mi4yIDkwNS44Yy0yMi41IDE0LjUtNTIuNSAxNC41LTY3LjUgMC0xNS0yMS43LTE1LTUwLjcgMC02NS4xbDQyMC4xLTM5MC42eiBtMCAwIiAvPjwvc3ZnPg==" alt="收起">
|
|
6
|
-
</template>
|
|
7
|
-
<template v-else>
|
|
8
|
-
<span style="color: #3aa1ff; vertical-align:middle;">展开更多</span> <img style="vertical-align:middle;" src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+PHN2ZyBjbGFzcz0iaWNvbiIgd2lkdGg9IjIwMHB4IiBoZWlnaHQ9IjIwMC4wMHB4IiB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZmlsbD0iIzVjYWRmZiIgZD0iTTE0NS40IDQ2MS4xbDM2Ny42IDM0MCAzNjcuNi0zNDBjMjIuNS0xNC41IDUyLjUtMTQuNSA2Ny41IDAgMTUgMjEuNyAxNSA1MC43IDAgNjUuMUw1MjcuOSA5MDkuNWMwIDcuMi03LjUgNy4yLTE1IDcuMnMtNy41IDAtMTUtNy4yTDc3LjcgNTI2LjJjLTIyLjUtMjEuNy0xNS01MC42IDAtNjUuMSAyMi42LTE0LjUgNTIuNi0xNC41IDY3LjcgMHpNNTI4IDU3Ni45YzAgNy4yLTcuNSA3LjItMTUgNy4ycy0xNSAwLTE1LTcuMkw3Ny44IDE5My42Yy0yMi41LTIxLjctMTUtNTAuNiAwLTY1LjEgMjIuNS0xNC40IDUyLjUtMTQuNCA2Ny41IDBMNTEzIDQ2OC40bDM2Ny42LTM0Ny4yYzIyLjUtMTQuNSA1Mi41LTE0LjUgNjcuNSAwIDE1IDIxLjcgMTUgNTAuNyAwIDY1LjFMNTI4IDU3Ni45eiBtMCAwIiAvPjwvc3ZnPg==" alt="展开更多">
|
|
9
|
-
</template>
|
|
10
|
-
</div>
|
|
11
|
-
</div>
|
|
12
|
-
</template>
|
|
13
|
-
<script>
|
|
14
|
-
export default {
|
|
15
|
-
data() {
|
|
16
|
-
return {
|
|
17
|
-
show: false
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
methods: {
|
|
21
|
-
drawer(value) {
|
|
22
|
-
this.show = !this.show
|
|
23
|
-
this.$emit("change", this.show)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
</script>
|
|
29
|
-
|