hbte-saas-ui 0.0.2 → 1.0.0
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 +8 -2
- package/.browserslistrc +0 -3
- package/.editorconfig +0 -7
- package/.env.development +0 -1
- package/.env.lib +0 -1
- package/.eslintrc.js +0 -14
- package/.prettierrc +0 -3
- package/babel.config.js +0 -3
- package/docs/.vuepress/config.js +0 -23
- package/docs/.vuepress/styles/index.styl +0 -4
- package/docs/AdvQuery.md +0 -26
- package/docs/CustomQuery.md +0 -21
- package/docs/EditArea.md +0 -16
- package/docs/FilterDrop.md +0 -29
- package/docs/FullTable.md +0 -68
- package/docs/Pagination.md +0 -22
- package/docs/QueryForm.md +0 -27
- package/docs/README.md +0 -17
- package/docs/Table.md +0 -58
- package/docs/ToolGroup.md +0 -32
- package/examples/App.vue +0 -97
- package/examples/image/hb-image-viewer/3k.jpg +0 -0
- package/examples/image/hb-image-viewer/a.jpg +0 -0
- package/examples/image/hb-image-viewer/b.jpg +0 -0
- package/examples/main.js +0 -39
- package/examples/mock/authority.js +0 -1108
- package/examples/mock/dept.js +0 -4001
- package/examples/mock/fulltable.js +0 -407
- package/examples/mock/organizeData.js +0 -18965
- package/examples/router/index.js +0 -111
- package/examples/views/ElementCpTest.vue +0 -299
- package/examples/views/Fragment.vue +0 -196
- package/examples/views/HBAdvQuery.vue +0 -150
- package/examples/views/HBAuthority.vue +0 -339
- package/examples/views/HBDialog.vue +0 -39
- package/examples/views/HBEditarea.vue +0 -350
- package/examples/views/HBFilterDrop.vue +0 -72
- package/examples/views/HBFloatFooter.vue +0 -42
- package/examples/views/HBFullTable.vue +0 -751
- package/examples/views/HBImageViewer.vue +0 -57
- package/examples/views/HBNavMenu.vue +0 -37
- package/examples/views/HBOrganizeDialog.vue +0 -133
- package/examples/views/HBPagination.vue +0 -80
- package/examples/views/HBSelectVague.vue +0 -57
- package/examples/views/HBToolgroup.vue +0 -29
- package/examples/views/HBTopBar.vue +0 -16
- package/packages/adv-query/index.js +0 -5
- package/packages/adv-query/src/main.vue +0 -294
- package/packages/area-select/index.js +0 -7
- package/packages/area-select/src/main.vue +0 -37
- package/packages/authority/index.js +0 -5
- package/packages/authority/src/main.vue +0 -606
- package/packages/config.js +0 -3
- package/packages/custom-query/index.js +0 -5
- package/packages/custom-query/src/main.vue +0 -80
- package/packages/dialog/index.js +0 -7
- package/packages/dialog/src/main.vue +0 -176
- package/packages/edit-area/index.js +0 -13
- package/packages/edit-area/src/config.js +0 -3
- package/packages/edit-area/src/main.vue +0 -304
- package/packages/edit-area/src/simulateEvent.js +0 -219
- package/packages/filter-drop/index.js +0 -6
- package/packages/filter-drop/src/main.vue +0 -107
- package/packages/float-footer/index.js +0 -7
- package/packages/float-footer/src/main.vue +0 -40
- package/packages/fragment/index.js +0 -7
- package/packages/fragment/src/main.vue +0 -74
- package/packages/fragment/src/old.vue +0 -144
- package/packages/full-table/index.js +0 -6
- package/packages/full-table/src/config.js +0 -14
- package/packages/full-table/src/main.vue +0 -141
- package/packages/image-viewer/index.js +0 -8
- package/packages/image-viewer/src/main.js +0 -14
- package/packages/image-viewer/src/main.vue +0 -138
- package/packages/image-viewer/src/svg/cancel.svg +0 -2
- package/packages/image-viewer/src/svg/delete.svg +0 -2
- package/packages/image-viewer/src/svg/download.svg +0 -2
- package/packages/image-viewer/src/svg/rotate.svg +0 -77
- package/packages/image-viewer/src/svg/scaledown.svg +0 -71
- package/packages/image-viewer/src/svg/scaleup.svg +0 -72
- package/packages/index.js +0 -43
- package/packages/nav-menu/index.js +0 -7
- package/packages/nav-menu/src/main.vue +0 -277
- package/packages/organize-dialog/index.js +0 -5
- package/packages/organize-dialog/src/main.vue +0 -427
- package/packages/pagination/index.js +0 -6
- package/packages/pagination/src/main.vue +0 -146
- package/packages/query-form/index.js +0 -5
- package/packages/query-form/src/main.vue +0 -142
- package/packages/select-vague/index.js +0 -5
- package/packages/select-vague/src/main.vue +0 -80
- package/packages/table/index.js +0 -5
- package/packages/table/src/main.vue +0 -265
- package/packages/theme-chalk/adv-query.scss +0 -107
- package/packages/theme-chalk/authority.scss +0 -103
- package/packages/theme-chalk/common/elementCover.scss +0 -722
- package/packages/theme-chalk/common/flex.scss +0 -66
- package/packages/theme-chalk/common/global.scss +0 -147
- package/packages/theme-chalk/common/reset.scss +0 -92
- package/packages/theme-chalk/common/var.scss +0 -46
- package/packages/theme-chalk/custom-query.scss +0 -10
- package/packages/theme-chalk/dialog.scss +0 -9
- package/packages/theme-chalk/edit-area.scss +0 -119
- package/packages/theme-chalk/filter-drop.scss +0 -81
- package/packages/theme-chalk/float-footer.scss +0 -14
- package/packages/theme-chalk/fonts/iconfont.ttf +0 -0
- package/packages/theme-chalk/fragment.scss +0 -51
- package/packages/theme-chalk/full-table.scss +0 -40
- package/packages/theme-chalk/icon.scss +0 -96
- package/packages/theme-chalk/image-viewer.scss +0 -94
- package/packages/theme-chalk/images/company-logo--default.png +0 -0
- package/packages/theme-chalk/images/nodata.png +0 -0
- package/packages/theme-chalk/images/user-logo--default.png +0 -0
- package/packages/theme-chalk/index.scss +0 -21
- package/packages/theme-chalk/nav-menu.scss +0 -205
- package/packages/theme-chalk/organize-dialog.scss +0 -170
- package/packages/theme-chalk/pagination.scss +0 -91
- package/packages/theme-chalk/select.scss +0 -8
- package/packages/theme-chalk/table.scss +0 -102
- package/packages/theme-chalk/tool-group.scss +0 -105
- package/packages/theme-chalk/top-bar.scss +0 -195
- package/packages/tool-group/index.js +0 -13
- package/packages/tool-group/src/config.js +0 -40
- package/packages/tool-group/src/main.vue +0 -93
- package/packages/top-bar/index.js +0 -7
- package/packages/top-bar/src/main.vue +0 -280
- package/public/index.html +0 -20
- package/vue.config.js +0 -6
|
@@ -1,751 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="hb-testtable">
|
|
3
|
-
<hb-advquery
|
|
4
|
-
class="hb-testtable-header"
|
|
5
|
-
:qryFormProps="qryFormProps"
|
|
6
|
-
:qryFormData="qryFormData"
|
|
7
|
-
:customQueryData="customQueryData"
|
|
8
|
-
@AdvQuery="handleAdvSearch"
|
|
9
|
-
:showCusQuery="false"
|
|
10
|
-
>
|
|
11
|
-
<el-dropdown trigger="click" size="small" slot="cusBtn">
|
|
12
|
-
<el-button size="mini" class="el-dropdown-link">
|
|
13
|
-
按钮插槽<i class="el-icon-arrow-down el-icon--right"></i>
|
|
14
|
-
</el-button>
|
|
15
|
-
|
|
16
|
-
<el-dropdown-menu slot="dropdown">
|
|
17
|
-
<el-dropdown-item>全部</el-dropdown-item>
|
|
18
|
-
</el-dropdown-menu>
|
|
19
|
-
</el-dropdown>
|
|
20
|
-
|
|
21
|
-
<hb-toolgroup
|
|
22
|
-
slot="tools"
|
|
23
|
-
:icons="['add']"
|
|
24
|
-
@search="handleSearch"
|
|
25
|
-
@event="handleTools"
|
|
26
|
-
>
|
|
27
|
-
<p>
|
|
28
|
-
此页面不止调用一个组件,仅再现业务场景的布局实现方案,包含多个组件具体业务自行控制
|
|
29
|
-
<el-button size="mini" @click="handleValidDoubleRow"
|
|
30
|
-
>手动校验编辑列</el-button
|
|
31
|
-
>
|
|
32
|
-
<el-button size="mini" @click="handleChangeColumns"
|
|
33
|
-
>主动切换列配置</el-button
|
|
34
|
-
>
|
|
35
|
-
</p>
|
|
36
|
-
</hb-toolgroup>
|
|
37
|
-
|
|
38
|
-
<div slot="dropdownSlot">
|
|
39
|
-
<span>12345678</span>
|
|
40
|
-
</div>
|
|
41
|
-
</hb-advquery>
|
|
42
|
-
<div class="hb-testtable-body">
|
|
43
|
-
<hb-fulltable
|
|
44
|
-
ref="table"
|
|
45
|
-
class="hb-testtable-body__inner"
|
|
46
|
-
:tableData="tableData"
|
|
47
|
-
:columns="columns"
|
|
48
|
-
:pageData="pageData"
|
|
49
|
-
:pageSizes="pageSizes"
|
|
50
|
-
:select="true"
|
|
51
|
-
:selectable="
|
|
52
|
-
(row) => {
|
|
53
|
-
return row.id % 2 === 1;
|
|
54
|
-
}
|
|
55
|
-
"
|
|
56
|
-
@pageSizeChange="handlePageSizeChange"
|
|
57
|
-
@pageNumChange="handlePageNumChange"
|
|
58
|
-
@columnsChange="handleColumnsChange"
|
|
59
|
-
>
|
|
60
|
-
<el-table-column
|
|
61
|
-
slot="company"
|
|
62
|
-
slot-scope="{ column, align }"
|
|
63
|
-
:label="column.label"
|
|
64
|
-
:key="column.prop"
|
|
65
|
-
:minWidth="column.minWidth"
|
|
66
|
-
:align="align"
|
|
67
|
-
:show-overflow-tooltip="false"
|
|
68
|
-
>
|
|
69
|
-
<template #header>
|
|
70
|
-
<!-- 排序方案 -->
|
|
71
|
-
<span @click="handleClickTop"
|
|
72
|
-
>公司
|
|
73
|
-
<i v-if="column.sort === 0" class="el-icon-caret-bottom"></i>
|
|
74
|
-
<i v-else-if="column.sort === 1" class="el-icon-caret-top"></i>
|
|
75
|
-
<i
|
|
76
|
-
v-else
|
|
77
|
-
class="el-icon-caret-bottom"
|
|
78
|
-
style="color: #999 !important"
|
|
79
|
-
></i>
|
|
80
|
-
</span>
|
|
81
|
-
</template>
|
|
82
|
-
<template v-slot="{ row }">
|
|
83
|
-
<span>公司名:{{ row.company }}</span>
|
|
84
|
-
</template>
|
|
85
|
-
</el-table-column>
|
|
86
|
-
</hb-fulltable>
|
|
87
|
-
</div>
|
|
88
|
-
</div>
|
|
89
|
-
</template>
|
|
90
|
-
|
|
91
|
-
<script>
|
|
92
|
-
// 测试数据
|
|
93
|
-
import json from "../mock/fulltable";
|
|
94
|
-
export default {
|
|
95
|
-
data() {
|
|
96
|
-
return {
|
|
97
|
-
// 高级查询数据
|
|
98
|
-
customQueryData: [
|
|
99
|
-
{
|
|
100
|
-
label: "aaa",
|
|
101
|
-
value: "aaa",
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
label: "bbb",
|
|
105
|
-
value: "bbb",
|
|
106
|
-
},
|
|
107
|
-
],
|
|
108
|
-
qryFormData: {
|
|
109
|
-
a: "",
|
|
110
|
-
b: false,
|
|
111
|
-
c: "",
|
|
112
|
-
d: "",
|
|
113
|
-
e: "",
|
|
114
|
-
f: "",
|
|
115
|
-
g: [],
|
|
116
|
-
h: "",
|
|
117
|
-
all: [],
|
|
118
|
-
},
|
|
119
|
-
qryFormProps: [
|
|
120
|
-
{
|
|
121
|
-
type: "input",
|
|
122
|
-
label: "求助事项",
|
|
123
|
-
prop: "a",
|
|
124
|
-
placeholder: "请输入求助事项",
|
|
125
|
-
maxlength: "64",
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
type: "switch",
|
|
129
|
-
label: "负责部门",
|
|
130
|
-
prop: "b",
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
type: "radio",
|
|
134
|
-
label: "事项分类",
|
|
135
|
-
prop: "c",
|
|
136
|
-
placeholder: "请输入作业名称",
|
|
137
|
-
optList: [
|
|
138
|
-
{
|
|
139
|
-
label: "a",
|
|
140
|
-
value: "1",
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
label: "b",
|
|
144
|
-
value: "2",
|
|
145
|
-
},
|
|
146
|
-
],
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
type: "select",
|
|
150
|
-
label: "重要程度",
|
|
151
|
-
prop: "d",
|
|
152
|
-
multiple: true,
|
|
153
|
-
placeholder: "请选择重要程度",
|
|
154
|
-
optList: [
|
|
155
|
-
{
|
|
156
|
-
label: "a",
|
|
157
|
-
value: "1",
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
label: "b",
|
|
161
|
-
value: "2",
|
|
162
|
-
},
|
|
163
|
-
],
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
type: "selectAll",
|
|
167
|
-
label: "重要程度",
|
|
168
|
-
prop: "all",
|
|
169
|
-
multiple: true,
|
|
170
|
-
placeholder: "请选择重要程度",
|
|
171
|
-
optList: [
|
|
172
|
-
{
|
|
173
|
-
label: "a",
|
|
174
|
-
value: "1",
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
label: "b",
|
|
178
|
-
value: "2",
|
|
179
|
-
},
|
|
180
|
-
],
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
type: "daterange",
|
|
184
|
-
label: "日期",
|
|
185
|
-
prop: "e",
|
|
186
|
-
placeholder: "请选择日期",
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
type: "date",
|
|
190
|
-
label: "日期",
|
|
191
|
-
prop: "f",
|
|
192
|
-
placeholder: "请选择日期",
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
type: "checkbox",
|
|
196
|
-
label: "多选",
|
|
197
|
-
prop: "g",
|
|
198
|
-
placeholder: "多选",
|
|
199
|
-
optList: [
|
|
200
|
-
{
|
|
201
|
-
label: "a",
|
|
202
|
-
value: "1",
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
label: "b",
|
|
206
|
-
value: "2",
|
|
207
|
-
},
|
|
208
|
-
],
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
label: "插槽",
|
|
212
|
-
prop: "h",
|
|
213
|
-
slot: true,
|
|
214
|
-
},
|
|
215
|
-
],
|
|
216
|
-
// 列表数据
|
|
217
|
-
tableData: [],
|
|
218
|
-
params: { kw: "" }, // 额外params
|
|
219
|
-
columns: [
|
|
220
|
-
{
|
|
221
|
-
prop: "edit1",
|
|
222
|
-
label: "编辑列1",
|
|
223
|
-
minWidth: 200,
|
|
224
|
-
edit: {
|
|
225
|
-
keepEdit: true,
|
|
226
|
-
type: "input",
|
|
227
|
-
validate(next, value) {
|
|
228
|
-
if (value && value.length > 2) {
|
|
229
|
-
next(new Error("不能大于2个字"));
|
|
230
|
-
} else {
|
|
231
|
-
next();
|
|
232
|
-
}
|
|
233
|
-
},
|
|
234
|
-
},
|
|
235
|
-
currentSelect: true,
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
prop: "edit2",
|
|
239
|
-
label: "编辑列2",
|
|
240
|
-
minWidth: 200,
|
|
241
|
-
editCondition: function (rowIndex) {
|
|
242
|
-
return rowIndex % 2 === 0;
|
|
243
|
-
},
|
|
244
|
-
edit: {
|
|
245
|
-
keepEdit: true,
|
|
246
|
-
type: "select",
|
|
247
|
-
insert: "edit2",
|
|
248
|
-
multiple: true,
|
|
249
|
-
validate(next, value) {
|
|
250
|
-
if (value && value.length > 2) {
|
|
251
|
-
next(new Error("最多只能选择2项"));
|
|
252
|
-
} else {
|
|
253
|
-
next();
|
|
254
|
-
}
|
|
255
|
-
},
|
|
256
|
-
optList: [
|
|
257
|
-
{
|
|
258
|
-
label: "值1",
|
|
259
|
-
value: "1",
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
label: "值2",
|
|
263
|
-
value: "2",
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
label: "值3",
|
|
267
|
-
value: "3",
|
|
268
|
-
},
|
|
269
|
-
],
|
|
270
|
-
},
|
|
271
|
-
currentSelect: true,
|
|
272
|
-
},
|
|
273
|
-
{
|
|
274
|
-
prop: "edit3",
|
|
275
|
-
label: "编辑列3",
|
|
276
|
-
minWidth: 200,
|
|
277
|
-
edit: {
|
|
278
|
-
keepEdit: true,
|
|
279
|
-
type: "input",
|
|
280
|
-
validate(next, value) {
|
|
281
|
-
if (value === "") {
|
|
282
|
-
next(new Error("不能为空"));
|
|
283
|
-
} else {
|
|
284
|
-
next();
|
|
285
|
-
}
|
|
286
|
-
},
|
|
287
|
-
},
|
|
288
|
-
currentSelect: true,
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
prop: "name",
|
|
292
|
-
label: "名称",
|
|
293
|
-
minWidth: 150,
|
|
294
|
-
slot: false,
|
|
295
|
-
fixed: "left",
|
|
296
|
-
always: "true",
|
|
297
|
-
edit: {
|
|
298
|
-
type: "input",
|
|
299
|
-
validate(next, value) {
|
|
300
|
-
if (value && value.length > 5) {
|
|
301
|
-
next(new Error("不能大于5个字"));
|
|
302
|
-
} else {
|
|
303
|
-
next();
|
|
304
|
-
}
|
|
305
|
-
},
|
|
306
|
-
},
|
|
307
|
-
currentSelect: true,
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
prop: "code",
|
|
311
|
-
label: "编码",
|
|
312
|
-
minWidth: 240,
|
|
313
|
-
slot: false,
|
|
314
|
-
edit: {
|
|
315
|
-
type: "select",
|
|
316
|
-
multiple: true,
|
|
317
|
-
insert: (row) => {
|
|
318
|
-
return row.code ? row.code.split(",") : [];
|
|
319
|
-
},
|
|
320
|
-
change: (next, row, value) => {
|
|
321
|
-
// 请求修改列数据
|
|
322
|
-
if (value) {
|
|
323
|
-
const optItem = [
|
|
324
|
-
{
|
|
325
|
-
label: "编码123",
|
|
326
|
-
value: "123",
|
|
327
|
-
},
|
|
328
|
-
{
|
|
329
|
-
label: "编码456",
|
|
330
|
-
value: "456",
|
|
331
|
-
},
|
|
332
|
-
{
|
|
333
|
-
label: "编码789",
|
|
334
|
-
value: "789",
|
|
335
|
-
},
|
|
336
|
-
].filter((item) => value.indexOf(item.value) !== -1);
|
|
337
|
-
// 模拟修改cell内容
|
|
338
|
-
this.setProp(
|
|
339
|
-
row.id,
|
|
340
|
-
"code",
|
|
341
|
-
optItem.map((item) => item.value).join(","),
|
|
342
|
-
next
|
|
343
|
-
);
|
|
344
|
-
} else {
|
|
345
|
-
next();
|
|
346
|
-
}
|
|
347
|
-
},
|
|
348
|
-
validate(next, value) {
|
|
349
|
-
if (value && value.length > 2) {
|
|
350
|
-
next(new Error("最多只能选择2项"));
|
|
351
|
-
} else {
|
|
352
|
-
next();
|
|
353
|
-
}
|
|
354
|
-
},
|
|
355
|
-
optList: [
|
|
356
|
-
{
|
|
357
|
-
label: "编码123",
|
|
358
|
-
value: "123",
|
|
359
|
-
},
|
|
360
|
-
{
|
|
361
|
-
label: "编码456",
|
|
362
|
-
value: "456",
|
|
363
|
-
},
|
|
364
|
-
{
|
|
365
|
-
label: "编码789",
|
|
366
|
-
value: "789",
|
|
367
|
-
},
|
|
368
|
-
],
|
|
369
|
-
},
|
|
370
|
-
currentSelect: true,
|
|
371
|
-
},
|
|
372
|
-
{
|
|
373
|
-
prop: "open",
|
|
374
|
-
label: "开关",
|
|
375
|
-
minWidth: 150,
|
|
376
|
-
sort: null,
|
|
377
|
-
edit: {
|
|
378
|
-
type: "switch",
|
|
379
|
-
change: (next, row, value) => {
|
|
380
|
-
console.log("开关", value);
|
|
381
|
-
this.setProp(row.id, "open", value, next);
|
|
382
|
-
},
|
|
383
|
-
optList: ["开", "关"],
|
|
384
|
-
},
|
|
385
|
-
currentSelect: true,
|
|
386
|
-
},
|
|
387
|
-
{
|
|
388
|
-
prop: "size",
|
|
389
|
-
label: "大小",
|
|
390
|
-
minWidth: 200,
|
|
391
|
-
sort: null,
|
|
392
|
-
edit: {
|
|
393
|
-
type: "radio",
|
|
394
|
-
change: (next, row, value) => {
|
|
395
|
-
this.setProp(row.id, "size", value, next);
|
|
396
|
-
},
|
|
397
|
-
optList: [
|
|
398
|
-
{
|
|
399
|
-
label: "大",
|
|
400
|
-
value: "big",
|
|
401
|
-
},
|
|
402
|
-
{
|
|
403
|
-
label: "中",
|
|
404
|
-
value: "middle",
|
|
405
|
-
},
|
|
406
|
-
{
|
|
407
|
-
label: "小",
|
|
408
|
-
value: "small",
|
|
409
|
-
},
|
|
410
|
-
],
|
|
411
|
-
},
|
|
412
|
-
currentSelect: true,
|
|
413
|
-
},
|
|
414
|
-
{
|
|
415
|
-
prop: "color",
|
|
416
|
-
label: "颜色",
|
|
417
|
-
minWidth: 210,
|
|
418
|
-
sort: null,
|
|
419
|
-
edit: {
|
|
420
|
-
type: "checkbox",
|
|
421
|
-
insert: (row) => {
|
|
422
|
-
return row.color
|
|
423
|
-
? [
|
|
424
|
-
{
|
|
425
|
-
label: "红",
|
|
426
|
-
value: "red",
|
|
427
|
-
},
|
|
428
|
-
{
|
|
429
|
-
label: "蓝",
|
|
430
|
-
value: "blue",
|
|
431
|
-
},
|
|
432
|
-
{
|
|
433
|
-
label: "绿",
|
|
434
|
-
value: "green",
|
|
435
|
-
},
|
|
436
|
-
]
|
|
437
|
-
.filter((item) => row.color.indexOf(item.label) !== -1)
|
|
438
|
-
.map((item) => item.value)
|
|
439
|
-
: [];
|
|
440
|
-
},
|
|
441
|
-
change: (next, row, value) => {
|
|
442
|
-
this.setProp(
|
|
443
|
-
row.id,
|
|
444
|
-
"color",
|
|
445
|
-
[
|
|
446
|
-
{
|
|
447
|
-
label: "红",
|
|
448
|
-
value: "red",
|
|
449
|
-
},
|
|
450
|
-
{
|
|
451
|
-
label: "蓝",
|
|
452
|
-
value: "blue",
|
|
453
|
-
},
|
|
454
|
-
{
|
|
455
|
-
label: "绿",
|
|
456
|
-
value: "green",
|
|
457
|
-
},
|
|
458
|
-
]
|
|
459
|
-
.filter((item) => value.indexOf(item.value) !== -1)
|
|
460
|
-
.map((item) => item.label)
|
|
461
|
-
.join(","),
|
|
462
|
-
next
|
|
463
|
-
);
|
|
464
|
-
},
|
|
465
|
-
optList: [
|
|
466
|
-
{
|
|
467
|
-
label: "红",
|
|
468
|
-
value: "red",
|
|
469
|
-
},
|
|
470
|
-
{
|
|
471
|
-
label: "蓝",
|
|
472
|
-
value: "blue",
|
|
473
|
-
},
|
|
474
|
-
{
|
|
475
|
-
label: "绿",
|
|
476
|
-
value: "green",
|
|
477
|
-
},
|
|
478
|
-
],
|
|
479
|
-
},
|
|
480
|
-
currentSelect: true,
|
|
481
|
-
},
|
|
482
|
-
{
|
|
483
|
-
prop: "addr",
|
|
484
|
-
label: "地址",
|
|
485
|
-
minWidth: 150,
|
|
486
|
-
slot: false,
|
|
487
|
-
edit: {
|
|
488
|
-
type: "select",
|
|
489
|
-
change: (next, row, value) => {
|
|
490
|
-
// 请求修改列数据
|
|
491
|
-
if (value) {
|
|
492
|
-
const optItem = [
|
|
493
|
-
{
|
|
494
|
-
label: "测试",
|
|
495
|
-
value: "test",
|
|
496
|
-
},
|
|
497
|
-
].find((item) => item.value === value);
|
|
498
|
-
// 模拟修改cell内容
|
|
499
|
-
this.setProp(row.id, "addrId", optItem.value, () => {
|
|
500
|
-
this.setProp(row.id, "addr", optItem.label, next);
|
|
501
|
-
});
|
|
502
|
-
} else {
|
|
503
|
-
next();
|
|
504
|
-
}
|
|
505
|
-
},
|
|
506
|
-
insert: (row) => {
|
|
507
|
-
return row.addrId;
|
|
508
|
-
},
|
|
509
|
-
optList: [
|
|
510
|
-
{
|
|
511
|
-
label: "测试",
|
|
512
|
-
value: "test",
|
|
513
|
-
},
|
|
514
|
-
],
|
|
515
|
-
},
|
|
516
|
-
currentSelect: true,
|
|
517
|
-
},
|
|
518
|
-
{
|
|
519
|
-
prop: "company",
|
|
520
|
-
label: "公司",
|
|
521
|
-
minWidth: 150,
|
|
522
|
-
slot: true,
|
|
523
|
-
sort: null,
|
|
524
|
-
currentSelect: true,
|
|
525
|
-
},
|
|
526
|
-
{
|
|
527
|
-
prop: "date",
|
|
528
|
-
label: "时间",
|
|
529
|
-
minWidth: 180,
|
|
530
|
-
slot: false,
|
|
531
|
-
edit: {
|
|
532
|
-
type: "date",
|
|
533
|
-
change: (next, row, value) => {
|
|
534
|
-
this.setProp(row.id, "date", value, next);
|
|
535
|
-
},
|
|
536
|
-
},
|
|
537
|
-
currentSelect: true,
|
|
538
|
-
},
|
|
539
|
-
{
|
|
540
|
-
prop: "daterange",
|
|
541
|
-
label: "时间范围",
|
|
542
|
-
minWidth: 380,
|
|
543
|
-
slot: false,
|
|
544
|
-
edit: {
|
|
545
|
-
type: "daterange",
|
|
546
|
-
insert: (row) => {
|
|
547
|
-
return row.daterange ? row.daterange.split(",") : [];
|
|
548
|
-
},
|
|
549
|
-
change: (next, row, value) => {
|
|
550
|
-
this.setProp(
|
|
551
|
-
row.id,
|
|
552
|
-
"daterange",
|
|
553
|
-
Array.isArray(value) ? value.join(",") : "",
|
|
554
|
-
next
|
|
555
|
-
);
|
|
556
|
-
},
|
|
557
|
-
},
|
|
558
|
-
currentSelect: true,
|
|
559
|
-
},
|
|
560
|
-
{
|
|
561
|
-
prop: "remark",
|
|
562
|
-
label: "说明",
|
|
563
|
-
minWidth: 800,
|
|
564
|
-
slot: false,
|
|
565
|
-
currentSelect: true,
|
|
566
|
-
},
|
|
567
|
-
],
|
|
568
|
-
// 分页数据
|
|
569
|
-
pageData: {
|
|
570
|
-
pageSize: 5,
|
|
571
|
-
pageNum: 1,
|
|
572
|
-
total: 0,
|
|
573
|
-
},
|
|
574
|
-
pageSizes: [5, 10, 15],
|
|
575
|
-
};
|
|
576
|
-
},
|
|
577
|
-
methods: {
|
|
578
|
-
/**
|
|
579
|
-
* @function loadList 模拟加载列表请求
|
|
580
|
-
*/
|
|
581
|
-
loadList() {
|
|
582
|
-
this.$refs.table.openLoading();
|
|
583
|
-
setTimeout(() => {
|
|
584
|
-
// const tableData = json.getTableData(
|
|
585
|
-
// this.pageData.pageNum,
|
|
586
|
-
// this.pageData.pageSize,
|
|
587
|
-
// this.params.kw
|
|
588
|
-
// );
|
|
589
|
-
const tableData = json.getTableDataEmpty(
|
|
590
|
-
this.pageData.pageNum,
|
|
591
|
-
this.pageData.pageSize,
|
|
592
|
-
this.params.kw
|
|
593
|
-
);
|
|
594
|
-
|
|
595
|
-
const serverColumns = json.getColumns();
|
|
596
|
-
const localColumms = this.$lodash.cloneDeep(this.columns);
|
|
597
|
-
// 处理tableData
|
|
598
|
-
this.tableData = tableData.list;
|
|
599
|
-
// 处理columns:选中状态同步,prop以当前页面为准
|
|
600
|
-
const columnsStep1 = localColumms.map((item) => {
|
|
601
|
-
const serverCol = serverColumns.find((col) => item.prop === col.prop);
|
|
602
|
-
if (serverCol) {
|
|
603
|
-
this.$set(item, "currentSelect", serverCol.currentSelect);
|
|
604
|
-
}
|
|
605
|
-
return item;
|
|
606
|
-
});
|
|
607
|
-
// 处理columns:顺序同步
|
|
608
|
-
let columnsStep2 = [];
|
|
609
|
-
const indexMap = serverColumns.map((item) => item.prop);
|
|
610
|
-
indexMap.forEach((prop) => {
|
|
611
|
-
let indexCache = null;
|
|
612
|
-
const col = columnsStep1.find((item, index) => {
|
|
613
|
-
if (item.prop === prop) {
|
|
614
|
-
indexCache = index;
|
|
615
|
-
return true;
|
|
616
|
-
}
|
|
617
|
-
});
|
|
618
|
-
if (col) {
|
|
619
|
-
columnsStep2.push(columnsStep1.splice(indexCache, 1)[0]);
|
|
620
|
-
}
|
|
621
|
-
});
|
|
622
|
-
columnsStep2 = columnsStep2.concat(columnsStep1);
|
|
623
|
-
this.columns = this.$lodash.cloneDeep(columnsStep2);
|
|
624
|
-
// 设置页码
|
|
625
|
-
this.$set(this.pageData, "total", tableData.total);
|
|
626
|
-
this.$refs.table.closeLoading();
|
|
627
|
-
}, 800);
|
|
628
|
-
},
|
|
629
|
-
/**
|
|
630
|
-
* @event setProp 模拟修改字段请求
|
|
631
|
-
* @param {String} id 该行id
|
|
632
|
-
* @param {String} prop 该行的字段
|
|
633
|
-
* @param {*} value 要修改的值
|
|
634
|
-
* @param {Function} callback 回调
|
|
635
|
-
*/
|
|
636
|
-
setProp(id, prop, value, callback) {
|
|
637
|
-
setTimeout(() => {
|
|
638
|
-
json.setTableCell(id, prop, value);
|
|
639
|
-
callback();
|
|
640
|
-
}, 720);
|
|
641
|
-
},
|
|
642
|
-
/** events */
|
|
643
|
-
|
|
644
|
-
/**
|
|
645
|
-
* @event handleTools 点击tools
|
|
646
|
-
*/
|
|
647
|
-
handleTools(event) {
|
|
648
|
-
this.$message.success(`点击了按钮${event}`);
|
|
649
|
-
},
|
|
650
|
-
/**
|
|
651
|
-
* @event handleSearch 关键字搜索
|
|
652
|
-
*/
|
|
653
|
-
handleSearch(kw) {
|
|
654
|
-
this.$set(this.params, "kw", kw);
|
|
655
|
-
this.$set(this.pageData, "pageNum", 1);
|
|
656
|
-
this.loadList();
|
|
657
|
-
},
|
|
658
|
-
/**
|
|
659
|
-
* @function handleAdvSearch 高级查询搜索
|
|
660
|
-
* 高级查询使用prop传值,直接进行查询
|
|
661
|
-
*/
|
|
662
|
-
handleAdvSearch() {
|
|
663
|
-
this.$$message.success("高级查询,太麻烦懒得模拟数据了,只重置了页码");
|
|
664
|
-
this.$set(this.pageData, "pageNum", 1);
|
|
665
|
-
this.loadList();
|
|
666
|
-
},
|
|
667
|
-
/**
|
|
668
|
-
* @event handlePageChange 切换页数
|
|
669
|
-
*/
|
|
670
|
-
handlePageSizeChange(size) {
|
|
671
|
-
this.$message.success("切换了页数");
|
|
672
|
-
this.$set(this.pageData, "pageSize", size);
|
|
673
|
-
this.$set(this.pageData, "pageNum", 1);
|
|
674
|
-
this.loadList();
|
|
675
|
-
},
|
|
676
|
-
/**
|
|
677
|
-
* @event handlePageNumChange 切换页码
|
|
678
|
-
*/
|
|
679
|
-
handlePageNumChange(num) {
|
|
680
|
-
this.$message.success("切换了页码");
|
|
681
|
-
this.$set(this.pageData, "pageNum", num);
|
|
682
|
-
this.loadList();
|
|
683
|
-
},
|
|
684
|
-
/**
|
|
685
|
-
* @event handleColumnsChange 切换列配置
|
|
686
|
-
*/
|
|
687
|
-
handleColumnsChange(newColumns) {
|
|
688
|
-
this.$message.success("切换了列配置");
|
|
689
|
-
json.setColumns(newColumns);
|
|
690
|
-
this.loadList();
|
|
691
|
-
},
|
|
692
|
-
/**
|
|
693
|
-
* @event handleClickTop 保存列排序
|
|
694
|
-
*/
|
|
695
|
-
handleClickTop() {
|
|
696
|
-
const columns = this.columns.find((item) => item.prop === "company");
|
|
697
|
-
const num = columns.sort ? 0 : 1;
|
|
698
|
-
this.$set(columns, "sort", num);
|
|
699
|
-
console.log("静态排序", columns);
|
|
700
|
-
},
|
|
701
|
-
/**
|
|
702
|
-
* @event handleChangeColumns 主动切换列
|
|
703
|
-
*/
|
|
704
|
-
handleChangeColumns() {
|
|
705
|
-
const newCol = this.$lodash
|
|
706
|
-
.cloneDeep(this.columns)
|
|
707
|
-
.slice(0, 4)
|
|
708
|
-
.reverse()
|
|
709
|
-
.map((item) => {
|
|
710
|
-
item.currentSelect = true;
|
|
711
|
-
return item;
|
|
712
|
-
});
|
|
713
|
-
this.columns = newCol;
|
|
714
|
-
},
|
|
715
|
-
/**
|
|
716
|
-
* @event handleValidDoubleRow 校验偶数列
|
|
717
|
-
*/
|
|
718
|
-
handleValidDoubleRow() {
|
|
719
|
-
this.$refs.table.validateEdit((res) => {
|
|
720
|
-
console.log("校验结果", res);
|
|
721
|
-
});
|
|
722
|
-
},
|
|
723
|
-
},
|
|
724
|
-
mounted() {
|
|
725
|
-
this.loadList();
|
|
726
|
-
},
|
|
727
|
-
};
|
|
728
|
-
</script>
|
|
729
|
-
|
|
730
|
-
<style lang="scss" scoped>
|
|
731
|
-
.hb-testtable {
|
|
732
|
-
height: calc(100vh);
|
|
733
|
-
display: flex;
|
|
734
|
-
flex-direction: column;
|
|
735
|
-
.hb-testtable-header {
|
|
736
|
-
transition: height 0.15s ease-out;
|
|
737
|
-
}
|
|
738
|
-
.hb-testtable-body {
|
|
739
|
-
position: relative;
|
|
740
|
-
flex: 1;
|
|
741
|
-
transition: height 0.15s ease-out;
|
|
742
|
-
.hb-testtable-body__inner {
|
|
743
|
-
position: absolute;
|
|
744
|
-
height: 100%;
|
|
745
|
-
width: 100%;
|
|
746
|
-
left: 0;
|
|
747
|
-
top: 0;
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
</style>
|