ol-base-components 3.3.7 → 3.3.9
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
package/src/App.vue
CHANGED
package/src/main.js
CHANGED
|
@@ -6,7 +6,7 @@ import OlCom, { swaggerInstall, Hiprint } from "@/package/index.js";
|
|
|
6
6
|
Vue.use(ElementUI);
|
|
7
7
|
Vue.use(Hiprint);
|
|
8
8
|
|
|
9
|
-
Vue.use(OlCom);
|
|
9
|
+
Vue.use(OlCom, { method: "post" });
|
|
10
10
|
swaggerInstall("http://220.179.249.140:20025/swagger/v1/swagger.json").then(() => {});
|
|
11
11
|
new Vue({
|
|
12
12
|
render: h => h(App),
|
|
@@ -288,7 +288,6 @@ export default {
|
|
|
288
288
|
// 请求方式 post get
|
|
289
289
|
method: {
|
|
290
290
|
type: String,
|
|
291
|
-
default: "get",
|
|
292
291
|
},
|
|
293
292
|
},
|
|
294
293
|
data() {
|
|
@@ -317,6 +316,12 @@ export default {
|
|
|
317
316
|
this.loadOptionSources();
|
|
318
317
|
});
|
|
319
318
|
},
|
|
319
|
+
computed: {
|
|
320
|
+
// 优先级:props > 全局配置 > 默认值
|
|
321
|
+
finalMethod() {
|
|
322
|
+
return this.method || (this.$olBaseConfig && this.$olBaseConfig.method) || "get";
|
|
323
|
+
},
|
|
324
|
+
},
|
|
320
325
|
watch: {
|
|
321
326
|
"formSearchData.value": {
|
|
322
327
|
handler: function (newVal, OldVal) {
|
|
@@ -332,9 +337,9 @@ export default {
|
|
|
332
337
|
},
|
|
333
338
|
methods: {
|
|
334
339
|
async init() {
|
|
335
|
-
if (!this.isCustoms) {
|
|
340
|
+
if (!this.isCustoms && this.url) {
|
|
336
341
|
const swaggerData = await getData();
|
|
337
|
-
let swaggersearchColumns = swaggerData.paths[this.url][this.
|
|
342
|
+
let swaggersearchColumns = swaggerData.paths[this.url][this.finalMethod].parameters || [];
|
|
338
343
|
if (typeof this.onSwagger === "function") {
|
|
339
344
|
try {
|
|
340
345
|
const res = await this.onSwagger({ columns: swaggersearchColumns });
|
package/src/package/index.js
CHANGED
|
@@ -219,11 +219,12 @@ const components = [
|
|
|
219
219
|
OlPrint,
|
|
220
220
|
OlPrintModel,
|
|
221
221
|
];
|
|
222
|
-
const install = async function (Vue) {
|
|
222
|
+
const install = async function (Vue, options) {
|
|
223
223
|
// 设置全局数据
|
|
224
224
|
components.map(item => {
|
|
225
225
|
Vue.component(`ol-${item.name}`, item);
|
|
226
226
|
});
|
|
227
|
+
Vue.prototype.$olBaseConfig = options || {};
|
|
227
228
|
consoleTooltip();
|
|
228
229
|
};
|
|
229
230
|
|
|
@@ -443,7 +443,6 @@ export default {
|
|
|
443
443
|
// 请求方式 post get
|
|
444
444
|
method: {
|
|
445
445
|
type: String,
|
|
446
|
-
default: "get",
|
|
447
446
|
},
|
|
448
447
|
},
|
|
449
448
|
|
|
@@ -487,10 +486,14 @@ export default {
|
|
|
487
486
|
});
|
|
488
487
|
},
|
|
489
488
|
},
|
|
489
|
+
// 优先级:props > 全局配置 > 默认值
|
|
490
|
+
finalMethod() {
|
|
491
|
+
return this.method || (this.$olBaseConfig && this.$olBaseConfig.method) || "get";
|
|
492
|
+
},
|
|
490
493
|
},
|
|
491
494
|
created() {
|
|
492
495
|
// 通过swagger完善columns
|
|
493
|
-
this.init();
|
|
496
|
+
if (this.url) this.init();
|
|
494
497
|
},
|
|
495
498
|
// 组件销毁时清理监听器
|
|
496
499
|
beforeDestroy() {
|
|
@@ -502,8 +505,9 @@ export default {
|
|
|
502
505
|
getData()
|
|
503
506
|
.then(async swaggerData => {
|
|
504
507
|
let swaggerColumns =
|
|
505
|
-
swaggerData.paths[this.url][this.
|
|
506
|
-
|
|
508
|
+
swaggerData.paths[this.url][this.finalMethod].responses["200"].content[
|
|
509
|
+
"application/json"
|
|
510
|
+
].schema.properties.items.items.properties;
|
|
507
511
|
if (typeof this.onSwagger === "function") {
|
|
508
512
|
try {
|
|
509
513
|
const res = await this.onSwagger({ columns: swaggerColumns });
|