ol-base-components 3.3.6 → 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,6 +1,6 @@
1
1
  {
2
2
  "name": "ol-base-components",
3
- "version": "3.3.6",
3
+ "version": "3.3.7",
4
4
  "private": false,
5
5
  "main": "src/package/index.js",
6
6
  "bin": {
@@ -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,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].get.parameters || [];
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];
@@ -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].get.responses["200"].content["application/json"].schema
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 });