ol-base-components 3.4.1 → 3.4.3

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.4.1",
3
+ "version": "3.4.3",
4
4
  "private": false,
5
5
  "main": "src/package/index.js",
6
6
  "bin": {
package/src/App.vue CHANGED
@@ -5,6 +5,8 @@
5
5
  :form-search-data="formSearchData"
6
6
  @handleSearch="handleSearch"
7
7
  :dragable="false"
8
+ @onSave="save"
9
+ dragable
8
10
  ></ol-customSearch>
9
11
  =========
10
12
  <!-- <div>table组件案例</div> -->
@@ -849,6 +851,11 @@ export default {
849
851
  done(data);
850
852
  }
851
853
  },
854
+ save(e) {
855
+ console.log(123, e);
856
+
857
+ // this.formSearchData.value.usageStatus = null;
858
+ },
852
859
  },
853
860
  };
854
861
  </script>
@@ -5,6 +5,7 @@
5
5
  width="60%"
6
6
  :close-on-click-modal="false"
7
7
  @close="handleClose"
8
+ append-to-body
8
9
  >
9
10
  <div class="search-config-container">
10
11
  <div class="config-header">
@@ -342,6 +343,14 @@ export default {
342
343
  type: Boolean,
343
344
  default: false,
344
345
  },
346
+ formSearchData: {
347
+ type: Object,
348
+ default: () => {},
349
+ },
350
+ formSearch: {
351
+ type: Object,
352
+ default: () => {},
353
+ },
345
354
  tableSearch: {
346
355
  type: Array,
347
356
  default: () => [],
@@ -396,6 +405,8 @@ export default {
396
405
  },
397
406
  created() {
398
407
  this.loadAllDictList();
408
+ // 重置数据
409
+ this.setArrVModelReset();
399
410
  },
400
411
  watch: {
401
412
  visible: {
@@ -876,6 +887,16 @@ export default {
876
887
  this.configList.push(newItem);
877
888
  this.customsDialogVisible = false;
878
889
  },
890
+ // 处理数组和非数组的双向绑定值, 例如:下拉框和日期选择器切换成多选下拉框时间范围时候 双向绑定的值的类型要改变。this.formSearch是实际双向绑定的值
891
+ setArrVModelReset() {
892
+ this.tableSearch.forEach(item => {
893
+ const { value: key, inputType } = item;
894
+ if (!Object.keys(this.formSearch).includes(key)) return;
895
+ if (!(inputType === "select" || inputType === "picker")) return; //只有下拉框和日期选择器会有 双向绑定数组
896
+ delete this.formSearchData.value[key];
897
+ delete this.formSearch[key];
898
+ });
899
+ },
879
900
  },
880
901
  };
881
902
  </script>
@@ -14,6 +14,7 @@
14
14
  v-bind="{
15
15
  ...(formSearchData.options && formSearchData.options.formProps),
16
16
  }"
17
+ :key="key"
17
18
  >
18
19
  <!-- 'label-width': '100px', -->
19
20
  <div
@@ -179,6 +180,8 @@
179
180
  v-if="configDialogVisible"
180
181
  :visible.sync="configDialogVisible"
181
182
  :table-search="formSearchData.tableSearch"
183
+ :formSearchData="formSearchData"
184
+ :formSearch="formSearch"
182
185
  :customs="formSearchData.customs"
183
186
  @save="handleSaveConfig"
184
187
  v-bind="$attrs"
@@ -306,6 +309,7 @@ export default {
306
309
  },
307
310
  tempBoxData: [],
308
311
  optionBox: [],
312
+ key: 0,
309
313
  };
310
314
  },
311
315
  async created() {
@@ -601,11 +605,15 @@ export default {
601
605
  this.configDialogVisible = true;
602
606
  },
603
607
  handleSaveConfig(configList) {
608
+ if (this.isCustomSearch) {
609
+ this.key++; // 下拉框多选时候高度被撑开,改成单选时候高度无法重置。所以重写渲染。这里不管直接全都重写渲染
610
+ }
604
611
  this.formSearchData.tableSearch = configList;
605
612
  this.findTableSearch =
606
613
  this.formSearchData.tableSearch.length > this.tableSearchSlice
607
614
  ? this.formSearchData.tableSearch.slice(0, this.tableSearchSlice)
608
615
  : this.formSearchData.tableSearch;
616
+
609
617
  this.$emit("onSave", configList);
610
618
  },
611
619
  async loadOptionSources() {