ol-base-components 3.2.0 → 3.2.2

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.2.0",
3
+ "version": "3.2.2",
4
4
  "private": false,
5
5
  "main": "src/package/index.js",
6
6
  "bin": {
package/src/App.vue CHANGED
@@ -1,6 +1,9 @@
1
1
  <template>
2
2
  <div id="app">
3
- <ol-customSearch :form-search-data="formSearchData" @onSave="saveHandler"></ol-customSearch>
3
+ <ol-customSearch
4
+ :form-search-data="formSearchData"
5
+ @handleSearch="handleSearch"
6
+ ></ol-customSearch>
4
7
  =========
5
8
  <!-- <div>table组件案例</div> -->
6
9
  <!-- url="/api/app/stock-in/stock-in-pages" -->
@@ -136,7 +139,7 @@ export default {
136
139
  // timer: [],
137
140
  // range: [10, 200],
138
141
  },
139
- tableSearch: [
142
+ tableSearch1: [
140
143
  // {
141
144
  // label: "数字区间",
142
145
  // value: "range",
@@ -274,6 +277,81 @@ export default {
274
277
  // inputType: "text"
275
278
  // }
276
279
  ],
280
+ tableSearch: [
281
+ {
282
+ label: "选项1",
283
+ value: "code1",
284
+ inputType: "text",
285
+ compare: "contains",
286
+ children: [],
287
+ props: {},
288
+ },
289
+ {
290
+ label: "选项2",
291
+ value: "code2",
292
+ inputType: "number",
293
+ compare: "eq",
294
+ children: [],
295
+ props: {},
296
+ },
297
+ {
298
+ label: "选项3",
299
+ value: "code3",
300
+ inputType: "select",
301
+ compare: "eq",
302
+ children: [
303
+ {
304
+ key: 0,
305
+ value: "货位点",
306
+ },
307
+ {
308
+ key: 1,
309
+ value: "环线载货通道点",
310
+ },
311
+ {
312
+ key: 2,
313
+ value: "其它载货通道点",
314
+ },
315
+ {
316
+ key: 3,
317
+ value: "提升机点",
318
+ },
319
+ {
320
+ key: 4,
321
+ value: "充电点",
322
+ },
323
+ {
324
+ key: 5,
325
+ value: "暂停位点",
326
+ },
327
+ {
328
+ key: 6,
329
+ value: "提升机等待位",
330
+ },
331
+ {
332
+ key: 7,
333
+ value: "入库口",
334
+ },
335
+ {
336
+ key: 8,
337
+ value: "出库口",
338
+ },
339
+ {
340
+ key: 9,
341
+ value: "地图外",
342
+ },
343
+ ],
344
+ props: {},
345
+ optionSource: {
346
+ sourceType: "dict",
347
+ dictKey: "pointType",
348
+ apiUrl: "",
349
+ valueField: "id",
350
+ labelField: "name",
351
+ options: [],
352
+ },
353
+ },
354
+ ],
277
355
  customs: [
278
356
  {
279
357
  name: "选项1",
@@ -1,7 +1,6 @@
1
1
  <template>
2
2
  <ol-search
3
3
  :form-search-data="formSearchData"
4
- @handleSearch="handleSearch"
5
4
  @onSave="onSave"
6
5
  v-bind="$attrs"
7
6
  v-on="$listeners"
@@ -59,12 +59,12 @@
59
59
  size="small"
60
60
  placeholder="请选择类型"
61
61
  @change="handleTypeChange(scope.row)"
62
- disabled
62
+ :disabled="['number', 'picker'].includes(scope.row.inputType)"
63
63
  >
64
64
  <el-option label="文本输入" value="text" />
65
- <el-option label="数字输入" value="number" />
65
+ <el-option label="数字输入" value="number" disabled />
66
66
  <el-option label="下拉选择" value="select" />
67
- <el-option label="日期选择" value="picker" />
67
+ <el-option label="日期选择" value="picker" disabled />
68
68
  </el-select>
69
69
  </template>
70
70
  </el-table-column>
@@ -187,7 +187,7 @@
187
187
  </el-select>
188
188
  </el-form-item>
189
189
 
190
- <el-form-item v-if="currentOptionConfig.sourceType === 'api'" label="文本字段">
190
+ <el-form-item v-if="currentOptionConfig.sourceType === 'api'" label="文本字段">
191
191
  <el-input v-model="currentOptionConfig.labelField" placeholder="如:name" />
192
192
  </el-form-item>
193
193
 
@@ -447,6 +447,7 @@ export default {
447
447
  }
448
448
  this.$emit("save", this.configList);
449
449
  this.dialogVisible = false;
450
+ console.log(`\x1b[36m\x1b[4mol插件-动态搜索框配置数据`, this.configList);
450
451
  },
451
452
  async loadItemOptionsForSave(item) {
452
453
  if (!item.optionSource) return;
@@ -27,5 +27,3 @@ const translateWord = async word => {
27
27
  return word.charAt(0).toUpperCase() + word.slice(1);
28
28
  }
29
29
  };
30
-
31
- // 由于配置更新children
@@ -164,7 +164,7 @@
164
164
  {{ expend ? "收起" : "展开" }}</el-button
165
165
  >
166
166
  <el-button
167
- v-if="formSearchData.enableConfig"
167
+ v-if="formSearchData.customs && formSearchData.customs.length"
168
168
  plain
169
169
  size="small"
170
170
  icon="el-icon-setting"
@@ -266,7 +266,7 @@ export default {
266
266
  // 表格框架各种样式
267
267
  options: {},
268
268
  reset: false, // 是否要重置
269
- enableConfig: false, // 是否启用配置功能
269
+ customs: [], //根据customs确定是动态还是swagger配置
270
270
  };
271
271
  },
272
272
  },
@@ -495,10 +495,15 @@ export default {
495
495
  const filterConditions = [];
496
496
  Object.keys(formSearch).forEach(key => {
497
497
  const tempItem = this.formSearchData.tableSearch.find(item => item.value === key);
498
- if (formSearch[key] !== undefined && formSearch[key] !== null) {
498
+ if (
499
+ formSearch[key] !== undefined &&
500
+ formSearch[key] !== null &&
501
+ formSearch[key] !== "" &&
502
+ formSearch[key] != []
503
+ ) {
499
504
  filterConditions.push({
500
505
  key: key,
501
- value: formSearch[key],
506
+ values: Array.isArray(formSearch[key]) ? formSearch[key] : [formSearch[key]], //必须包数组,后端会统一处理
502
507
  compare: tempItem && tempItem.compare ? tempItem.compare : "",
503
508
  });
504
509
  }
@@ -546,6 +551,7 @@ export default {
546
551
  } else {
547
552
  // 转成接口需要的结构filterConditions
548
553
  const filterConditions = this.setFilterConditionsByFormSearch(this.formSearch) || [];
554
+
549
555
  // 动态模式
550
556
  this.$emit("handleSearch", this.formSearch, { filterConditions });
551
557
  console.log(`\x1b[36m\x1b[4mol插件-动态搜索框查询`, this.formSearch, { filterConditions });
@@ -643,11 +649,11 @@ export default {
643
649
 
644
650
  let response;
645
651
  if (method === "post") {
646
- response = await this.$http.post(apiUrl);
652
+ response = await this.post({ url: apiUrl });
647
653
  } else {
648
- response = await this.$http.get(apiUrl);
654
+ response = await this.get({ url: apiUrl });
649
655
  }
650
-
656
+ if (response.code !== 200) return;
651
657
  if (response.result && Array.isArray(response.result)) {
652
658
  const { valueField, labelField } = item.optionSource;
653
659
  const children = response.result.map(d => ({
@@ -210,8 +210,6 @@ const components = [OlTable, OlSearch, OlCustomSearch, Dialog, OlForm, OlNumberR
210
210
  const install = async function (Vue) {
211
211
  // 设置全局数据
212
212
  components.map(item => {
213
- console.log(777, item);
214
-
215
213
  Vue.component(`ol-${item.name}`, item);
216
214
  });
217
215
  consoleTooltip();