ol-base-components 3.3.5 → 3.3.7
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
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<ol-search
|
|
3
|
+
:key="key"
|
|
3
4
|
:form-search-data="formSearchData"
|
|
4
|
-
|
|
5
|
+
isCustoms
|
|
5
6
|
v-bind="$attrs"
|
|
7
|
+
@onSave="onSave"
|
|
8
|
+
method="post"
|
|
6
9
|
v-on="$listeners"
|
|
7
|
-
|
|
10
|
+
ref="customSearchRef"
|
|
8
11
|
/>
|
|
9
12
|
</template>
|
|
10
13
|
|
|
@@ -78,15 +81,15 @@ export default {
|
|
|
78
81
|
if (res.code !== 200) return;
|
|
79
82
|
const configList = res.result.settingJson ? JSON.parse(res.result.settingJson) : [];
|
|
80
83
|
this.$set(this.formSearchData, "tableSearch", configList);
|
|
81
|
-
this.$
|
|
82
|
-
|
|
83
|
-
|
|
84
|
+
this.$refs.customSearchRef.init();
|
|
85
|
+
// this.$nextTick(() => {
|
|
86
|
+
// this.key++;
|
|
87
|
+
// });
|
|
84
88
|
});
|
|
85
89
|
},
|
|
86
90
|
//保存
|
|
87
91
|
onSave(configList) {
|
|
88
92
|
const targetMenuId = this.menuId || (this.currentPageItem && this.currentPageItem.id);
|
|
89
|
-
|
|
90
93
|
this.post({
|
|
91
94
|
url: `/api/app/menu-search-setting`,
|
|
92
95
|
data: {
|
|
@@ -281,6 +281,15 @@ export default {
|
|
|
281
281
|
type: Function,
|
|
282
282
|
default: null,
|
|
283
283
|
},
|
|
284
|
+
isCustoms: {
|
|
285
|
+
type: Boolean,
|
|
286
|
+
default: false,
|
|
287
|
+
},
|
|
288
|
+
// 请求方式 post get
|
|
289
|
+
method: {
|
|
290
|
+
type: String,
|
|
291
|
+
default: "get",
|
|
292
|
+
},
|
|
284
293
|
},
|
|
285
294
|
data() {
|
|
286
295
|
return {
|
|
@@ -323,13 +332,9 @@ export default {
|
|
|
323
332
|
},
|
|
324
333
|
methods: {
|
|
325
334
|
async init() {
|
|
326
|
-
if (
|
|
327
|
-
!this.formSearchData ||
|
|
328
|
-
!this.formSearchData.customs ||
|
|
329
|
-
!this.formSearchData.customs.length
|
|
330
|
-
) {
|
|
335
|
+
if (!this.isCustoms) {
|
|
331
336
|
const swaggerData = await getData();
|
|
332
|
-
let swaggersearchColumns = swaggerData.paths[this.url].
|
|
337
|
+
let swaggersearchColumns = swaggerData.paths[this.url][this.method].parameters || [];
|
|
333
338
|
if (typeof this.onSwagger === "function") {
|
|
334
339
|
try {
|
|
335
340
|
const res = await this.onSwagger({ columns: swaggersearchColumns });
|
|
@@ -496,12 +501,7 @@ export default {
|
|
|
496
501
|
const filterConditions = [];
|
|
497
502
|
Object.keys(formSearch).forEach(key => {
|
|
498
503
|
const tempItem = this.formSearchData.tableSearch.find(item => item.value === key);
|
|
499
|
-
if (
|
|
500
|
-
formSearch[key] !== undefined &&
|
|
501
|
-
formSearch[key] !== null &&
|
|
502
|
-
formSearch[key] !== "" &&
|
|
503
|
-
formSearch[key] != []
|
|
504
|
-
) {
|
|
504
|
+
if (formSearch[key] !== undefined && formSearch[key] !== null && formSearch[key] !== "") {
|
|
505
505
|
filterConditions.push({
|
|
506
506
|
key: key,
|
|
507
507
|
values: Array.isArray(formSearch[key]) ? formSearch[key] : [formSearch[key]], //必须包数组,后端会统一处理
|
|
@@ -513,11 +513,7 @@ export default {
|
|
|
513
513
|
},
|
|
514
514
|
// 搜索查询按钮
|
|
515
515
|
handleSearch(formName, item) {
|
|
516
|
-
if (
|
|
517
|
-
!this.formSearchData ||
|
|
518
|
-
!this.formSearchData.customs ||
|
|
519
|
-
!this.formSearchData.customs.length
|
|
520
|
-
) {
|
|
516
|
+
if (!this.isCustoms) {
|
|
521
517
|
if (this.formSearch.createdTime) {
|
|
522
518
|
this.formSearch.BeginTime = this.formSearch.createdTime[0];
|
|
523
519
|
this.formSearch.EndTime = this.formSearch.createdTime[1];
|
|
@@ -22,6 +22,10 @@ export default {
|
|
|
22
22
|
type: String,
|
|
23
23
|
default: "",
|
|
24
24
|
},
|
|
25
|
+
printData: {
|
|
26
|
+
type: [Object, Array],
|
|
27
|
+
default: () => {},
|
|
28
|
+
},
|
|
25
29
|
},
|
|
26
30
|
data() {
|
|
27
31
|
return {
|
|
@@ -75,8 +79,19 @@ export default {
|
|
|
75
79
|
if (!Array.isArray(this.templateList)) return;
|
|
76
80
|
const tempItem = this.templateList.find(item => item.id === command);
|
|
77
81
|
if (!tempItem) return this.$message.error("未找到打印模板");
|
|
82
|
+
|
|
83
|
+
const data = this.printData;
|
|
84
|
+
const isValidData =
|
|
85
|
+
data &&
|
|
86
|
+
((Array.isArray(data) && data.length > 0) ||
|
|
87
|
+
(typeof data === "object" && Object.keys(data).length > 0));
|
|
88
|
+
|
|
89
|
+
if (!isValidData) {
|
|
90
|
+
return this.$message.error("打印数据不能为空");
|
|
91
|
+
}
|
|
92
|
+
|
|
78
93
|
this.$hiprint.print({
|
|
79
|
-
printData:
|
|
94
|
+
printData: data,
|
|
80
95
|
defaultTemplate: tempItem.templeteJson ? JSON.parse(tempItem.templeteJson) : {},
|
|
81
96
|
});
|
|
82
97
|
},
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
>
|
|
66
66
|
<div class="avatar-wrapper">
|
|
67
67
|
<div class="layui-table-tool-self">
|
|
68
|
-
<print-template-selector :menuId="menuId" />
|
|
68
|
+
<print-template-selector :menuId="menuId" :printData="tableData.printData" />
|
|
69
69
|
</div>
|
|
70
70
|
</div>
|
|
71
71
|
</div>
|
|
@@ -440,6 +440,11 @@ export default {
|
|
|
440
440
|
type: Function,
|
|
441
441
|
default: null,
|
|
442
442
|
},
|
|
443
|
+
// 请求方式 post get
|
|
444
|
+
method: {
|
|
445
|
+
type: String,
|
|
446
|
+
default: "get",
|
|
447
|
+
},
|
|
443
448
|
},
|
|
444
449
|
|
|
445
450
|
data() {
|
|
@@ -497,8 +502,8 @@ export default {
|
|
|
497
502
|
getData()
|
|
498
503
|
.then(async swaggerData => {
|
|
499
504
|
let swaggerColumns =
|
|
500
|
-
swaggerData.paths[this.url].
|
|
501
|
-
.properties.items.items.properties;
|
|
505
|
+
swaggerData.paths[this.url][this.method].responses["200"].content["application/json"]
|
|
506
|
+
.schema.properties.items.items.properties;
|
|
502
507
|
if (typeof this.onSwagger === "function") {
|
|
503
508
|
try {
|
|
504
509
|
const res = await this.onSwagger({ columns: swaggerColumns });
|