kz-ui-base 1.0.13 → 1.0.16
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/common/src/components/base/dialog/Dialog.js +113 -2
- package/common/src/components/base/dialog/dialogType.js +32 -10
- package/common/src/components/base/dialog/editDialog.vue +192 -0
- package/common/src/components/base/dialog/lookupDialog.vue +224 -0
- package/common/src/components/base/dialog/printDialog.vue +1 -1
- package/common/src/components/base/dialog/tableDialog.vue +5 -1
- package/common/src/components/base/dialog/uploadDialog.vue +13 -0
- package/common/src/components/customForm/editTable.vue +324 -0
- package/common/src/components/customForm/lookup.vue +162 -0
- package/common/src/components/customForm/searchTable.vue +677 -0
- package/common/src/views/login.vue +8 -26
- package/common/src/views/tenantLogin.vue +12 -20
- package/package.json +1 -1
|
@@ -0,0 +1,677 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="app-container">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
<el-row :gutter="24">
|
|
5
|
+
<!--树数据-->
|
|
6
|
+
<el-col v-if="treeSetting.visable" :span="4" :xs="24">
|
|
7
|
+
<div class="wrapper-container wrapper-container-supplement">
|
|
8
|
+
<div class="head-container">
|
|
9
|
+
<el-input
|
|
10
|
+
v-model="treeShapeName"
|
|
11
|
+
:placeholder="treeSetting.title"
|
|
12
|
+
clearable
|
|
13
|
+
size="small"
|
|
14
|
+
prefix-icon="el-icon-search"
|
|
15
|
+
style="margin-bottom: 20px"
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
<div class="head-container">
|
|
19
|
+
<el-tree
|
|
20
|
+
:data="treeShapeOptions"
|
|
21
|
+
:props="defaultProps"
|
|
22
|
+
:expand-on-click-node="false"
|
|
23
|
+
:filter-node-method="filterNode"
|
|
24
|
+
ref="tree"
|
|
25
|
+
default-expand-all
|
|
26
|
+
@node-click="handleNodeClick"
|
|
27
|
+
/>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</el-col>
|
|
31
|
+
<!--用户数据-->
|
|
32
|
+
<el-col :span="treeSetting.visable ? 20 : 24" :xs="24">
|
|
33
|
+
<div class="wrapper-container" v-show="isShowSearch">
|
|
34
|
+
<el-form
|
|
35
|
+
:model="listQueryParams"
|
|
36
|
+
ref="queryForm"
|
|
37
|
+
:inline="true"
|
|
38
|
+
label-width="100px"
|
|
39
|
+
>
|
|
40
|
+
<component
|
|
41
|
+
v-for="(searchRule, index) in searchRules"
|
|
42
|
+
:key="index"
|
|
43
|
+
:is="
|
|
44
|
+
searchRule.displayType != null
|
|
45
|
+
? 'KZ_' + searchRule.displayType
|
|
46
|
+
: 'KZ_TextBox'
|
|
47
|
+
"
|
|
48
|
+
:column="{ text: searchRule.text, property: 'value' }"
|
|
49
|
+
:entity="searchRule"
|
|
50
|
+
:setting.sync="searchRule.setting"
|
|
51
|
+
:value="searchRule.value"
|
|
52
|
+
>
|
|
53
|
+
</component>
|
|
54
|
+
<el-form-item>
|
|
55
|
+
<el-button
|
|
56
|
+
type="primary"
|
|
57
|
+
icon="el-icon-search"
|
|
58
|
+
size="mini"
|
|
59
|
+
@click="handleQuery"
|
|
60
|
+
>搜索</el-button
|
|
61
|
+
>
|
|
62
|
+
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
|
63
|
+
>重置</el-button
|
|
64
|
+
>
|
|
65
|
+
</el-form-item>
|
|
66
|
+
</el-form>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
<div class="wrapper-container">
|
|
70
|
+
<el-table
|
|
71
|
+
:border="true"
|
|
72
|
+
v-loading="listSetting.loading"
|
|
73
|
+
:data="listData"
|
|
74
|
+
:highlight-current-row="true"
|
|
75
|
+
@current-change="onCurrentChange"
|
|
76
|
+
@selection-change="onSelectionChange"
|
|
77
|
+
>
|
|
78
|
+
<el-table-column
|
|
79
|
+
v-if="isMultiple"
|
|
80
|
+
type="selection"
|
|
81
|
+
width="50"
|
|
82
|
+
align="center"
|
|
83
|
+
/>
|
|
84
|
+
<template v-for="(column, index) in listColumns">
|
|
85
|
+
<el-table-column
|
|
86
|
+
:show-overflow-tooltip="true"
|
|
87
|
+
:key="index"
|
|
88
|
+
:label="column.text"
|
|
89
|
+
align="center"
|
|
90
|
+
:prop="column.property"
|
|
91
|
+
v-if="column.visible != false"
|
|
92
|
+
:min-width="column.width || 100"
|
|
93
|
+
>
|
|
94
|
+
<template slot-scope="scope">
|
|
95
|
+
<div v-if="column.displayType == 'Upload'">
|
|
96
|
+
{{ getFileNickName(scope.row[scope.column.property]) }}
|
|
97
|
+
</div>
|
|
98
|
+
<div v-else-if="column.displayType == 'DatePicker'">
|
|
99
|
+
{{
|
|
100
|
+
dateFormat(
|
|
101
|
+
scope.row,
|
|
102
|
+
column,
|
|
103
|
+
scope.row[column.property],
|
|
104
|
+
scope.row[column.property]
|
|
105
|
+
)
|
|
106
|
+
}}
|
|
107
|
+
</div>
|
|
108
|
+
<div
|
|
109
|
+
v-else-if="
|
|
110
|
+
column.setting &&
|
|
111
|
+
(column.setting.type || column.setting.dictType)
|
|
112
|
+
"
|
|
113
|
+
>
|
|
114
|
+
{{
|
|
115
|
+
tableDisplayFormat(
|
|
116
|
+
scope.row,
|
|
117
|
+
column,
|
|
118
|
+
scope.row[column.property]
|
|
119
|
+
)
|
|
120
|
+
}}
|
|
121
|
+
</div>
|
|
122
|
+
<div v-else-if="column.htmlFormat">
|
|
123
|
+
<span
|
|
124
|
+
v-html="
|
|
125
|
+
evalFunction(
|
|
126
|
+
column.htmlFormat,
|
|
127
|
+
scope.row,
|
|
128
|
+
column,
|
|
129
|
+
scope.row[column.property]
|
|
130
|
+
)
|
|
131
|
+
"
|
|
132
|
+
></span>
|
|
133
|
+
</div>
|
|
134
|
+
<div v-else-if="column.htmlFormat">
|
|
135
|
+
<span
|
|
136
|
+
v-html="
|
|
137
|
+
evalFunction(
|
|
138
|
+
column.htmlFormat,
|
|
139
|
+
scope.row,
|
|
140
|
+
column,
|
|
141
|
+
scope.row[column.property]
|
|
142
|
+
)
|
|
143
|
+
"
|
|
144
|
+
></span>
|
|
145
|
+
</div>
|
|
146
|
+
<div v-else-if="column.format">
|
|
147
|
+
{{
|
|
148
|
+
evalFunction(
|
|
149
|
+
column.format,
|
|
150
|
+
scope.row,
|
|
151
|
+
column,
|
|
152
|
+
scope.row[column.property]
|
|
153
|
+
)
|
|
154
|
+
}}
|
|
155
|
+
</div>
|
|
156
|
+
<div v-else-if="column.click">
|
|
157
|
+
<el-link
|
|
158
|
+
type="primary"
|
|
159
|
+
@click="
|
|
160
|
+
evalFunction(
|
|
161
|
+
column.click,
|
|
162
|
+
scope.row,
|
|
163
|
+
column,
|
|
164
|
+
scope.row[column.property]
|
|
165
|
+
)
|
|
166
|
+
"
|
|
167
|
+
>{{ scope.row[scope.column.property] }}</el-link
|
|
168
|
+
>
|
|
169
|
+
</div>
|
|
170
|
+
<div v-else>
|
|
171
|
+
{{ scope.row[scope.column.property] }}
|
|
172
|
+
</div>
|
|
173
|
+
</template>
|
|
174
|
+
</el-table-column>
|
|
175
|
+
</template>
|
|
176
|
+
|
|
177
|
+
<el-table-column
|
|
178
|
+
label="操作"
|
|
179
|
+
align="center"
|
|
180
|
+
min-width="160"
|
|
181
|
+
class-name="small-padding fixed-width"
|
|
182
|
+
v-if="listSetting.isShowOpColumn"
|
|
183
|
+
>
|
|
184
|
+
<template slot-scope="scope">
|
|
185
|
+
<el-button
|
|
186
|
+
v-for="(opMenu, index) in listCustomOpMenus"
|
|
187
|
+
:key="index"
|
|
188
|
+
size="mini"
|
|
189
|
+
type="text"
|
|
190
|
+
@click="
|
|
191
|
+
onListCustomOpMenuClick({ opMenu: opMenu, data: scope.row })
|
|
192
|
+
"
|
|
193
|
+
>
|
|
194
|
+
{{ opMenu.text }}
|
|
195
|
+
</el-button>
|
|
196
|
+
</template>
|
|
197
|
+
<!-- <template slot-scope="scope">
|
|
198
|
+
<el-button
|
|
199
|
+
size="mini"
|
|
200
|
+
type="text"
|
|
201
|
+
@click="onListCustomOpMenuClick(scope.row)"
|
|
202
|
+
>
|
|
203
|
+
选择批次
|
|
204
|
+
</el-button>
|
|
205
|
+
</template> -->
|
|
206
|
+
</el-table-column>
|
|
207
|
+
</el-table>
|
|
208
|
+
|
|
209
|
+
<pagination
|
|
210
|
+
v-show="listQueryParams.total > 0"
|
|
211
|
+
:total="listQueryParams.total"
|
|
212
|
+
:page.sync="listQueryParams.pageNum"
|
|
213
|
+
:limit.sync="listQueryParams.pageSize"
|
|
214
|
+
@pagination="getList"
|
|
215
|
+
/>
|
|
216
|
+
</div>
|
|
217
|
+
</el-col>
|
|
218
|
+
</el-row>
|
|
219
|
+
</div>
|
|
220
|
+
</template>
|
|
221
|
+
|
|
222
|
+
<script>
|
|
223
|
+
import {
|
|
224
|
+
listEntity,
|
|
225
|
+
getEntity,
|
|
226
|
+
addEntity,
|
|
227
|
+
updateEntity,
|
|
228
|
+
delEntity,
|
|
229
|
+
getUrl,
|
|
230
|
+
treeSelect,
|
|
231
|
+
} from "@api/common/common";
|
|
232
|
+
import { filePriview, getFilePriviewUrl, getFileNickName } from "@utils/file";
|
|
233
|
+
|
|
234
|
+
import KZ_DropDownList from "@components/customForm/dropDownList";
|
|
235
|
+
import KZ_TextBox from "@components/customForm/textBox";
|
|
236
|
+
import KZ_Cascader from "@components/customForm/cascader";
|
|
237
|
+
import KZ_CheckBox from "@components/customForm/checkBox";
|
|
238
|
+
import KZ_ColorPicker from "@components/customForm/colorPicker";
|
|
239
|
+
import KZ_DatePicker from "@components/customForm/datePicker";
|
|
240
|
+
import KZ_Switch from "@components/customForm/switch";
|
|
241
|
+
import KZ_Upload from "@components/customForm/upload";
|
|
242
|
+
import KZ_TextArea from "@components/customForm/textarea";
|
|
243
|
+
import KZ_Lookup from "@components/customForm/lookup";
|
|
244
|
+
|
|
245
|
+
import { getToken } from "@utils/auth";
|
|
246
|
+
import EditDialog from "@components/base/dialog/editDialog";
|
|
247
|
+
import UploadDialog from "@components/base/dialog/uploadDialog";
|
|
248
|
+
import PrintDialog from "@components/base/dialog/printDialog";
|
|
249
|
+
import Treeselect from "@riophae/vue-treeselect";
|
|
250
|
+
|
|
251
|
+
const ignoreProperties = [
|
|
252
|
+
"enterpriseId",
|
|
253
|
+
"sort",
|
|
254
|
+
"createBy",
|
|
255
|
+
"createName",
|
|
256
|
+
"updateBy",
|
|
257
|
+
"updateName",
|
|
258
|
+
"updateTime",
|
|
259
|
+
"isDeleted",
|
|
260
|
+
"params",
|
|
261
|
+
];
|
|
262
|
+
|
|
263
|
+
export default {
|
|
264
|
+
name: "SearchTable",
|
|
265
|
+
props: {
|
|
266
|
+
//微服务模块名称
|
|
267
|
+
moduleName: {
|
|
268
|
+
type: String,
|
|
269
|
+
default: function () {
|
|
270
|
+
return undefined;
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
//实体名称-服务名称
|
|
274
|
+
serviceName: {
|
|
275
|
+
type: String,
|
|
276
|
+
default: function () {
|
|
277
|
+
return undefined;
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
//微服务列表方法Action名称
|
|
281
|
+
getListAction: {
|
|
282
|
+
type: String,
|
|
283
|
+
default: function () {
|
|
284
|
+
return undefined;
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
//微服务ApiUrl地址
|
|
288
|
+
url: {
|
|
289
|
+
type: String,
|
|
290
|
+
default: function () {
|
|
291
|
+
return undefined;
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
setting: {
|
|
295
|
+
type: Object,
|
|
296
|
+
default: function () {
|
|
297
|
+
return undefined;
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
// 列信息
|
|
301
|
+
listColumns: {
|
|
302
|
+
type: Array,
|
|
303
|
+
default: function () {
|
|
304
|
+
return [
|
|
305
|
+
//{ key: 0, text: `用户编码`, property: "userNo", visible: true },
|
|
306
|
+
//{ key: 1, text: `用户账号`, property: "userAccount", visible: true },
|
|
307
|
+
];
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
// 启用多选模式
|
|
311
|
+
isMultiple: {
|
|
312
|
+
type: Boolean,
|
|
313
|
+
default: function () {
|
|
314
|
+
return true;
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
// 显示搜索条件
|
|
318
|
+
isShowSearch: {
|
|
319
|
+
type: Boolean,
|
|
320
|
+
default: function () {
|
|
321
|
+
return true;
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
//是否自动生成列
|
|
325
|
+
isAutoGenerationColumns: {
|
|
326
|
+
type: Boolean,
|
|
327
|
+
default: function () {
|
|
328
|
+
return false;
|
|
329
|
+
},
|
|
330
|
+
},
|
|
331
|
+
//表格是否自动加载数据
|
|
332
|
+
isAutoLoad: {
|
|
333
|
+
type: Boolean,
|
|
334
|
+
default: function () {
|
|
335
|
+
return true;
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
//当前功能主键字段
|
|
339
|
+
pkField: {
|
|
340
|
+
type: String,
|
|
341
|
+
default: function () {
|
|
342
|
+
return "id";
|
|
343
|
+
},
|
|
344
|
+
},
|
|
345
|
+
|
|
346
|
+
defaultProps: {
|
|
347
|
+
type: Object,
|
|
348
|
+
default: function () {
|
|
349
|
+
return {
|
|
350
|
+
children: "children",
|
|
351
|
+
label: "label",
|
|
352
|
+
};
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
|
|
356
|
+
//树设定
|
|
357
|
+
treeSetting: {
|
|
358
|
+
type: Object,
|
|
359
|
+
default: function () {
|
|
360
|
+
return {
|
|
361
|
+
moduleName: undefined,
|
|
362
|
+
serviceName: undefined,
|
|
363
|
+
//树形显示隐藏
|
|
364
|
+
visable: false,
|
|
365
|
+
//搜索框标题
|
|
366
|
+
title: "",
|
|
367
|
+
};
|
|
368
|
+
},
|
|
369
|
+
},
|
|
370
|
+
// 列表分页参数
|
|
371
|
+
listQueryParams: {
|
|
372
|
+
type: Object,
|
|
373
|
+
default: function () {
|
|
374
|
+
return {
|
|
375
|
+
pageNum: 1,
|
|
376
|
+
pageSize: 10,
|
|
377
|
+
totalPages: 1,
|
|
378
|
+
total: 0,
|
|
379
|
+
orderBy: "id",
|
|
380
|
+
};
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
|
+
|
|
384
|
+
// 列表查询条件
|
|
385
|
+
searchRules: {
|
|
386
|
+
type: Array,
|
|
387
|
+
default: function () {
|
|
388
|
+
return [
|
|
389
|
+
//{ key: 0, text: `用户编码`, property: "userNo", value: "", visible: true },
|
|
390
|
+
//{ key: 1, text: `用户账号`, property: "userAccount", value: "", visible: true },
|
|
391
|
+
];
|
|
392
|
+
},
|
|
393
|
+
},
|
|
394
|
+
listCustomOpMenus: {
|
|
395
|
+
type: Array,
|
|
396
|
+
default: function () {
|
|
397
|
+
return [
|
|
398
|
+
// { text: "操作", icon: "el-icon-edit", name: "custom1"}
|
|
399
|
+
];
|
|
400
|
+
},
|
|
401
|
+
},
|
|
402
|
+
parameter: {
|
|
403
|
+
type: Array,
|
|
404
|
+
},
|
|
405
|
+
},
|
|
406
|
+
components: {
|
|
407
|
+
Treeselect,
|
|
408
|
+
EditDialog,
|
|
409
|
+
UploadDialog,
|
|
410
|
+
PrintDialog,
|
|
411
|
+
KZ_Lookup,
|
|
412
|
+
KZ_DropDownList,
|
|
413
|
+
KZ_TextBox,
|
|
414
|
+
KZ_Cascader,
|
|
415
|
+
KZ_CheckBox,
|
|
416
|
+
KZ_ColorPicker,
|
|
417
|
+
KZ_DatePicker,
|
|
418
|
+
KZ_Switch,
|
|
419
|
+
KZ_Upload,
|
|
420
|
+
KZ_TextArea,
|
|
421
|
+
},
|
|
422
|
+
data() {
|
|
423
|
+
return {
|
|
424
|
+
// 遮罩层
|
|
425
|
+
loading: true,
|
|
426
|
+
// 列表数据
|
|
427
|
+
listData: [],
|
|
428
|
+
// 选中数组
|
|
429
|
+
ids: [],
|
|
430
|
+
// 选中数组名称
|
|
431
|
+
idsText: [],
|
|
432
|
+
listSetting: this.setting || {
|
|
433
|
+
//获取列表数据的api方法名
|
|
434
|
+
getListAction: "list",
|
|
435
|
+
//主键字段
|
|
436
|
+
pkField: this.pkField,
|
|
437
|
+
// 遮罩层
|
|
438
|
+
loading: false,
|
|
439
|
+
//是否显示合计行
|
|
440
|
+
isShowSumRow: true,
|
|
441
|
+
//是否启用行内编辑模式
|
|
442
|
+
isOpenInlineEditMode: false,
|
|
443
|
+
//是否显示分页栏
|
|
444
|
+
isShowPager: true,
|
|
445
|
+
//是否显示操作栏
|
|
446
|
+
isShowOpColumn: false,
|
|
447
|
+
},
|
|
448
|
+
// 当前选中行实体
|
|
449
|
+
currentEntity: undefined,
|
|
450
|
+
// 当前选中行实体集合
|
|
451
|
+
currentEntities: undefined,
|
|
452
|
+
//数名称
|
|
453
|
+
treeShapeName: undefined,
|
|
454
|
+
//树选项
|
|
455
|
+
treeShapeOptions: undefined,
|
|
456
|
+
};
|
|
457
|
+
},
|
|
458
|
+
watch: {
|
|
459
|
+
// 根据名称筛选部门树
|
|
460
|
+
treeShapeName(val) {
|
|
461
|
+
this.$refs.tree.filter(val);
|
|
462
|
+
},
|
|
463
|
+
},
|
|
464
|
+
created() {
|
|
465
|
+
if (this.parameter) {
|
|
466
|
+
this.listQueryParams = { ...this.listQueryParams, ...this.parameter };
|
|
467
|
+
}
|
|
468
|
+
//获取树数据
|
|
469
|
+
if (this.treeSetting.visable) {
|
|
470
|
+
this.getTreeSelect();
|
|
471
|
+
}
|
|
472
|
+
this.listSetting.pkField = this.pkField;
|
|
473
|
+
if (this.isAutoLoad) {
|
|
474
|
+
this.getList();
|
|
475
|
+
}
|
|
476
|
+
},
|
|
477
|
+
methods: {
|
|
478
|
+
getFileNickName: getFileNickName,
|
|
479
|
+
getFilePriviewUrl: getFilePriviewUrl,
|
|
480
|
+
filePriview: filePriview,
|
|
481
|
+
/** 下拉树结构 */
|
|
482
|
+
getTreeSelect() {
|
|
483
|
+
treeSelect(this.treeSetting.moduleName).then((response) => {
|
|
484
|
+
this.treeShapeOptions = response.data;
|
|
485
|
+
});
|
|
486
|
+
},
|
|
487
|
+
// 筛选节点
|
|
488
|
+
filterNode(value, data) {
|
|
489
|
+
if (!value) return true;
|
|
490
|
+
return data.label.indexOf(value) !== -1;
|
|
491
|
+
},
|
|
492
|
+
// 节点单击事件
|
|
493
|
+
handleNodeClick(data) {
|
|
494
|
+
let tree = this.treeSetting;
|
|
495
|
+
this.moduleName = this.treeSetting.moduleName;
|
|
496
|
+
this.serviceName = this.treeSetting.serviceName;
|
|
497
|
+
this.listQueryParams[tree.pkField] = data[tree.treeFkField];
|
|
498
|
+
// if (data.type === "0") {
|
|
499
|
+
// this.listQueryParams.deptId = data.id;
|
|
500
|
+
// this.listQueryParams.postId = undefined;
|
|
501
|
+
// } else if (data.type === "1") {
|
|
502
|
+
// this.listQueryParams.postId = data.id;
|
|
503
|
+
// this.listQueryParams.deptId = undefined;
|
|
504
|
+
// }
|
|
505
|
+
this.getList();
|
|
506
|
+
},
|
|
507
|
+
evalFunction(fn, row, column) {
|
|
508
|
+
return this[fn](row, column);
|
|
509
|
+
},
|
|
510
|
+
/** 获取查询条件 */
|
|
511
|
+
getSearchParams(pagerInfo, searchRules) {
|
|
512
|
+
if (!pagerInfo) pagerInfo = this.listQueryParams;
|
|
513
|
+
if (!searchRules) searchRules = this.searchRules;
|
|
514
|
+
var searchParams = {};
|
|
515
|
+
for (var key in pagerInfo) {
|
|
516
|
+
searchParams[key] = pagerInfo[key];
|
|
517
|
+
}
|
|
518
|
+
if (this.searchRules) {
|
|
519
|
+
for (var item of searchRules) {
|
|
520
|
+
searchParams[item.property] = item.value;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
return searchParams;
|
|
524
|
+
},
|
|
525
|
+
/** 查询用户列表 */
|
|
526
|
+
getList() {
|
|
527
|
+
this.loading = true;
|
|
528
|
+
var self = this;
|
|
529
|
+
var responseFunc = (response) => {
|
|
530
|
+
if (
|
|
531
|
+
self.isAutoGenerationColumns &&
|
|
532
|
+
(!this.listColumns || this.listColumns.length == 0) &&
|
|
533
|
+
response.rows &&
|
|
534
|
+
response.rows.length > 0
|
|
535
|
+
) {
|
|
536
|
+
self.autoGenerationColumns(response.rows[0]);
|
|
537
|
+
}
|
|
538
|
+
self.listData = response.rows;
|
|
539
|
+
self.listQueryParams.total = Number(response.total);
|
|
540
|
+
self.loading = false;
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
if (this.url) {
|
|
544
|
+
getUrl(this.url, this.getSearchParams())
|
|
545
|
+
.then(responseFunc)
|
|
546
|
+
.catch(() => {
|
|
547
|
+
this.loading = false;
|
|
548
|
+
});
|
|
549
|
+
} else {
|
|
550
|
+
if (this.moduleName && this.serviceName) {
|
|
551
|
+
listEntity(
|
|
552
|
+
this.moduleName,
|
|
553
|
+
this.serviceName,
|
|
554
|
+
this.getSearchParams(),
|
|
555
|
+
this.listSetting.getListAction || this.getListAction
|
|
556
|
+
)
|
|
557
|
+
.then(responseFunc)
|
|
558
|
+
.catch(() => {
|
|
559
|
+
this.loading = false;
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
},
|
|
564
|
+
autoGenerationColumns(data) {
|
|
565
|
+
if (!this.listColumns) this.listColumns = [];
|
|
566
|
+
this.listColumns.splice(0, this.listColumns.length);
|
|
567
|
+
for (var key in data) {
|
|
568
|
+
var ignore = false;
|
|
569
|
+
for (var ignoreProperty of ignoreProperties) {
|
|
570
|
+
if (key == ignoreProperty) {
|
|
571
|
+
ignore = true;
|
|
572
|
+
break;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
if (ignore) continue;
|
|
576
|
+
var column = { text: key, property: key };
|
|
577
|
+
this.listColumns.push(column);
|
|
578
|
+
}
|
|
579
|
+
},
|
|
580
|
+
/** 表格列显示格式化方法 */
|
|
581
|
+
tableDisplayFormat(row, column, cellValue) {
|
|
582
|
+
for (var col of this.listColumns) {
|
|
583
|
+
if (col.property == column.property) {
|
|
584
|
+
if (col.setting) {
|
|
585
|
+
var result = null;
|
|
586
|
+
if (col.setting.dictType) {
|
|
587
|
+
result = this.getDictLabelByValue(
|
|
588
|
+
col.setting.dictType,
|
|
589
|
+
cellValue
|
|
590
|
+
);
|
|
591
|
+
} else {
|
|
592
|
+
switch (col.setting.type) {
|
|
593
|
+
case "User":
|
|
594
|
+
result = this.getNickNameByUserId(cellValue);
|
|
595
|
+
break;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
return result || cellValue;
|
|
599
|
+
}
|
|
600
|
+
break;
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
return cellValue;
|
|
604
|
+
},
|
|
605
|
+
|
|
606
|
+
/** 更新列表列属性设置 */
|
|
607
|
+
updateListColumn(option, columnNames) {
|
|
608
|
+
this.updateColumns(option, columnNames, this.listColumns);
|
|
609
|
+
},
|
|
610
|
+
updateColumns(option, columnNames, columns) {
|
|
611
|
+
for (var columnName of columnNames) {
|
|
612
|
+
for (var column of columns) {
|
|
613
|
+
if (column.property == columnName) {
|
|
614
|
+
for (var key in option) {
|
|
615
|
+
column[key] = option[key];
|
|
616
|
+
}
|
|
617
|
+
break;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
},
|
|
622
|
+
/** 搜索按钮操作 */
|
|
623
|
+
handleQuery() {
|
|
624
|
+
this.listQueryParams.pageNum = 1;
|
|
625
|
+
this.getList();
|
|
626
|
+
},
|
|
627
|
+
/** 重置按钮操作 */
|
|
628
|
+
resetQuery() {
|
|
629
|
+
for (var searchRule of this.searchRules) {
|
|
630
|
+
this.$set(searchRule, "value", undefined);
|
|
631
|
+
}
|
|
632
|
+
this.resetForm("queryForm");
|
|
633
|
+
this.handleQuery();
|
|
634
|
+
},
|
|
635
|
+
// 多选框选中数据
|
|
636
|
+
onCurrentChange(val) {
|
|
637
|
+
this.currentEntity = val;
|
|
638
|
+
this.single = true;
|
|
639
|
+
this.multiple = false;
|
|
640
|
+
this.$emit("change", this.currentEntity);
|
|
641
|
+
},
|
|
642
|
+
// 多选框选中数据
|
|
643
|
+
onSelectionChange(selection) {
|
|
644
|
+
this.ids = selection.map((item) => item[this.pkField]);
|
|
645
|
+
if (this.displayField)
|
|
646
|
+
this.idsText = selection.map((item) => item[this.displayField]);
|
|
647
|
+
this.single = selection.length == 1;
|
|
648
|
+
this.multiple = selection.length > 1;
|
|
649
|
+
if (selection.length > 0) this.currentEntity = selection[0];
|
|
650
|
+
else this.currentEntity = undefined;
|
|
651
|
+
//this.setOpMenuEnable();
|
|
652
|
+
this.currentEntities = selection;
|
|
653
|
+
this.$emit("change", this.currentEntities);
|
|
654
|
+
},
|
|
655
|
+
// 表单重置
|
|
656
|
+
reset() {
|
|
657
|
+
var entity = {};
|
|
658
|
+
for (var key in this.currentEntity) {
|
|
659
|
+
entity[key] = undefined;
|
|
660
|
+
}
|
|
661
|
+
for (var column of this.editColumns) {
|
|
662
|
+
entity[column.property] = column.default;
|
|
663
|
+
}
|
|
664
|
+
this.currentEntity = entity;
|
|
665
|
+
},
|
|
666
|
+
onListCustomOpMenuClick(args) {
|
|
667
|
+
this.$emit("onListCustomOpMenuClick", args);
|
|
668
|
+
},
|
|
669
|
+
},
|
|
670
|
+
};
|
|
671
|
+
</script>
|
|
672
|
+
|
|
673
|
+
<style scoped>
|
|
674
|
+
.wrapper-container-supplement {
|
|
675
|
+
min-height: 415px;
|
|
676
|
+
}
|
|
677
|
+
</style>
|