ol-base-components 3.3.6 → 3.3.8

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,6 +1,6 @@
1
1
  {
2
2
  "name": "ol-base-components",
3
- "version": "3.3.6",
3
+ "version": "3.3.8",
4
4
  "private": false,
5
5
  "main": "src/package/index.js",
6
6
  "bin": {
package/src/App.vue CHANGED
@@ -449,6 +449,7 @@ export default {
449
449
  mounted() {
450
450
  // const el = document.getElementById("ellipsis-container");
451
451
  // this.truncateMiddleByWidth(el)
452
+ console.log(6666, this, this.$olBaseConfig);
452
453
  },
453
454
  methods: {
454
455
  SelectionChange(row) {
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),
@@ -1,10 +1,13 @@
1
1
  <template>
2
2
  <ol-search
3
+ :key="key"
3
4
  :form-search-data="formSearchData"
4
- @onSave="onSave"
5
+ isCustoms
5
6
  v-bind="$attrs"
7
+ @onSave="onSave"
8
+ method="post"
6
9
  v-on="$listeners"
7
- :key="key"
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.$nextTick(() => {
82
- this.key++;
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,17 @@ 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: () => {
292
+ return this.$olBaseConfig.method || "get";
293
+ },
294
+ },
284
295
  },
285
296
  data() {
286
297
  return {
@@ -323,13 +334,9 @@ export default {
323
334
  },
324
335
  methods: {
325
336
  async init() {
326
- if (
327
- !this.formSearchData ||
328
- !this.formSearchData.customs ||
329
- !this.formSearchData.customs.length
330
- ) {
337
+ if (!this.isCustoms && this.url) {
331
338
  const swaggerData = await getData();
332
- let swaggersearchColumns = swaggerData.paths[this.url].get.parameters || [];
339
+ let swaggersearchColumns = swaggerData.paths[this.url][this.method].parameters || [];
333
340
  if (typeof this.onSwagger === "function") {
334
341
  try {
335
342
  const res = await this.onSwagger({ columns: swaggersearchColumns });
@@ -496,12 +503,7 @@ export default {
496
503
  const filterConditions = [];
497
504
  Object.keys(formSearch).forEach(key => {
498
505
  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
- ) {
506
+ if (formSearch[key] !== undefined && formSearch[key] !== null && formSearch[key] !== "") {
505
507
  filterConditions.push({
506
508
  key: key,
507
509
  values: Array.isArray(formSearch[key]) ? formSearch[key] : [formSearch[key]], //必须包数组,后端会统一处理
@@ -513,11 +515,7 @@ export default {
513
515
  },
514
516
  // 搜索查询按钮
515
517
  handleSearch(formName, item) {
516
- if (
517
- !this.formSearchData ||
518
- !this.formSearchData.customs ||
519
- !this.formSearchData.customs.length
520
- ) {
518
+ if (!this.isCustoms) {
521
519
  if (this.formSearch.createdTime) {
522
520
  this.formSearch.BeginTime = this.formSearch.createdTime[0];
523
521
  this.formSearch.EndTime = this.formSearch.createdTime[1];
@@ -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
 
@@ -440,6 +440,13 @@ export default {
440
440
  type: Function,
441
441
  default: null,
442
442
  },
443
+ // 请求方式 post get
444
+ method: {
445
+ type: String,
446
+ default: () => {
447
+ return this.$olBaseConfig.method || "get";
448
+ },
449
+ },
443
450
  },
444
451
 
445
452
  data() {
@@ -485,7 +492,7 @@ export default {
485
492
  },
486
493
  created() {
487
494
  // 通过swagger完善columns
488
- this.init();
495
+ if (this.url) this.init();
489
496
  },
490
497
  // 组件销毁时清理监听器
491
498
  beforeDestroy() {
@@ -497,8 +504,8 @@ export default {
497
504
  getData()
498
505
  .then(async swaggerData => {
499
506
  let swaggerColumns =
500
- swaggerData.paths[this.url].get.responses["200"].content["application/json"].schema
501
- .properties.items.items.properties;
507
+ swaggerData.paths[this.url][this.method].responses["200"].content["application/json"]
508
+ .schema.properties.items.items.properties;
502
509
  if (typeof this.onSwagger === "function") {
503
510
  try {
504
511
  const res = await this.onSwagger({ columns: swaggerColumns });