ol-base-components 3.4.0 → 3.4.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.4.0",
3
+ "version": "3.4.2",
4
4
  "private": false,
5
5
  "main": "src/package/index.js",
6
6
  "bin": {
package/src/App.vue CHANGED
@@ -5,6 +5,7 @@
5
5
  :form-search-data="formSearchData"
6
6
  @handleSearch="handleSearch"
7
7
  :dragable="false"
8
+ @onSave="save"
8
9
  ></ol-customSearch>
9
10
  =========
10
11
  <!-- <div>table组件案例</div> -->
@@ -68,6 +69,7 @@ export default {
68
69
  headTool: true, // 开启头部工具栏
69
70
  refreshBtn: true, // 开启表格头部刷新按钮
70
71
  downloadBtn: true, // 开启表格头部下载按钮
72
+ // smartPrintBtn: false,
71
73
  }, // 序号和复选框
72
74
  rows: [
73
75
  {
@@ -848,6 +850,11 @@ export default {
848
850
  done(data);
849
851
  }
850
852
  },
853
+ save(e) {
854
+ console.log(123, e);
855
+
856
+ // this.formSearchData.value.usageStatus = null;
857
+ },
851
858
  },
852
859
  };
853
860
  </script>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775783951523" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4933" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M947.257271 1024H76.742729A35.794183 35.794183 0 0 1 40.948546 988.205817V35.794183A35.794183 35.794183 0 0 1 76.742729 0h870.514542a35.794183 35.794183 0 0 1 35.794183 35.794183v952.411634a35.794183 35.794183 0 0 1-35.794183 35.794183zM112.536913 952.411633h798.926174V71.588367H112.536913z" fill="#545454" p-id="4934"></path><path d="M298.666667 895.14094A35.794183 35.794183 0 0 1 261.440716 859.060403V437.261745a35.794183 35.794183 0 0 1 71.588367 0V859.060403A35.794183 35.794183 0 0 1 298.666667 895.14094zM726.192394 508.563758H470.478747a35.794183 35.794183 0 0 1 0-71.588367h257.718121a35.794183 35.794183 0 0 1 0 71.588367zM730.774049 293.798658H279.480984a35.794183 35.794183 0 0 1 0-71.588367h451.293065a35.794183 35.794183 0 0 1 0 71.588367zM726.192394 684.098434H470.478747a35.794183 35.794183 0 1 1 0-71.588367h257.718121a35.794183 35.794183 0 0 1 0 71.588367zM726.192394 852.187919H470.478747a35.794183 35.794183 0 0 1 0-71.588366h257.718121a35.794183 35.794183 0 0 1 0 71.588366z" fill="#545454" p-id="4935"></path></svg>
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, { method: "post", isSmartPrint: true });
9
+ Vue.use(OlCom, { method: "post", smartPrintBtn: true });
10
10
  swaggerInstall("http://220.179.249.140:20025/swagger/v1/swagger.json").then(() => {});
11
11
  new Vue({
12
12
  render: h => h(App),
@@ -342,6 +342,14 @@ export default {
342
342
  type: Boolean,
343
343
  default: false,
344
344
  },
345
+ formSearchData: {
346
+ type: Object,
347
+ default: () => {},
348
+ },
349
+ formSearch: {
350
+ type: Object,
351
+ default: () => {},
352
+ },
345
353
  tableSearch: {
346
354
  type: Array,
347
355
  default: () => [],
@@ -396,6 +404,8 @@ export default {
396
404
  },
397
405
  created() {
398
406
  this.loadAllDictList();
407
+ // 重置数据
408
+ this.setArrVModelReset();
399
409
  },
400
410
  watch: {
401
411
  visible: {
@@ -456,6 +466,12 @@ export default {
456
466
  for (const item of this.configList) {
457
467
  if (item.inputType === "select" && item.optionSource) {
458
468
  await this.loadItemOptionsForSave(item);
469
+ // 如果是“包含于”则,下拉框多选
470
+ if (item.compare === "in") {
471
+ item.props.multiple = true;
472
+ } else {
473
+ delete item.props.multiple;
474
+ }
459
475
  }
460
476
  }
461
477
  this.$emit("save", this.configList);
@@ -870,6 +886,16 @@ export default {
870
886
  this.configList.push(newItem);
871
887
  this.customsDialogVisible = false;
872
888
  },
889
+ // 处理数组和非数组的双向绑定值, 例如:下拉框和日期选择器切换成多选下拉框时间范围时候 双向绑定的值的类型要改变。this.formSearch是实际双向绑定的值
890
+ setArrVModelReset() {
891
+ this.tableSearch.forEach(item => {
892
+ const { value: key, inputType } = item;
893
+ if (!Object.keys(this.formSearch).includes(key)) return;
894
+ if (!(inputType === "select" || inputType === "picker")) return; //只有下拉框和日期选择器会有 双向绑定数组
895
+ delete this.formSearchData.value[key];
896
+ delete this.formSearch[key];
897
+ });
898
+ },
873
899
  },
874
900
  };
875
901
  </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() {
@@ -34,12 +34,12 @@
34
34
  </div>
35
35
  <div class="card-body">
36
36
  <div class="card-info">
37
- <span class="info-label">备注:</span>
38
- <span class="info-value">{{ template.remark || "无" }}</span>
37
+ <span class="info-label">数据源URL:</span>
38
+ <span class="info-value">{{ template.sourceUrl || "无" }}</span>
39
39
  </div>
40
40
  <div class="card-info">
41
- <span class="info-label">数据源URL:</span>
42
- <span class="info-value">{{ template.printUrl || "无" }}</span>
41
+ <span class="info-label">备注:</span>
42
+ <span class="info-value">{{ template.remark || "无" }}</span>
43
43
  </div>
44
44
  </div>
45
45
  <div class="card-footer">
@@ -74,11 +74,11 @@
74
74
  <span style="margin-right: 10px">{{ form.templeteJson ? "已创建" : "未创建" }}</span>
75
75
  <el-button type="primary" @click="handleCreateTemplate">创建模板</el-button>
76
76
  </el-form-item>
77
- <el-form-item label="数据源URL" prop="printUrl">
77
+ <el-form-item label="数据源URL" prop="sourceUrl">
78
78
  <el-input
79
- v-model="form.printUrl"
79
+ v-model="form.sourceUrl"
80
80
  placeholder="请输入数据源URL"
81
- @blur="form.printUrl = form.printUrl && form.printUrl.trim()"
81
+ @blur="form.sourceUrl = form.sourceUrl && form.sourceUrl.trim()"
82
82
  ></el-input>
83
83
  </el-form-item>
84
84
  <el-form-item label="备注">
@@ -120,7 +120,7 @@ export default {
120
120
  templeteName: "",
121
121
  remark: "",
122
122
  templeteJson: "",
123
- printUrl: "",
123
+ sourceUrl: "",
124
124
  },
125
125
  rules: {
126
126
  templeteName: [{ required: true, message: "请输入模板名称", trigger: "blur" }],
@@ -192,7 +192,7 @@ export default {
192
192
  templeteName: "",
193
193
  remark: "",
194
194
  templeteJson: "",
195
- printUrl: "",
195
+ sourceUrl: "",
196
196
  };
197
197
  this.dialogVisible = true;
198
198
  this.$nextTick(() => {
@@ -206,7 +206,7 @@ export default {
206
206
  templeteName: template.templeteName,
207
207
  remark: template.remark,
208
208
  templeteJson: template.templeteJson,
209
- printUrl: template.printUrl || "",
209
+ sourceUrl: template.sourceUrl || "",
210
210
  };
211
211
  this.dialogVisible = true;
212
212
  },
@@ -240,7 +240,7 @@ export default {
240
240
  id: this.form.id,
241
241
  templeteName: this.form.templeteName,
242
242
  templeteJson: this.form.templeteJson,
243
- printUrl: this.form.printUrl,
243
+ sourceUrl: this.form.sourceUrl,
244
244
  },
245
245
  });
246
246
  this.$message.success("编辑成功");
@@ -251,7 +251,7 @@ export default {
251
251
  menuId: this.currentMenuId,
252
252
  templeteName: this.form.templeteName,
253
253
  templeteJson: this.form.templeteJson,
254
- printUrl: this.form.printUrl,
254
+ sourceUrl: this.form.sourceUrl,
255
255
  },
256
256
  });
257
257
  this.$message.success("新增成功");
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <el-dropdown @command="handleCommand" trigger="click">
3
3
  <img
4
- src="../../../../assets/print.svg"
4
+ src="../../../../assets/icon/printModel.svg"
5
5
  alt="print"
6
6
  style="width: 14px; height: 14px; cursor: pointer"
7
7
  />
@@ -50,15 +50,15 @@ export default {
50
50
  // remark: "",
51
51
  // templeteJson:
52
52
  // '{"panels":[{"index":0,"name":1,"paperType":"A4","height":297,"width":210,"paperHeader":0,"paperFooter":841.8897637795277,"printElements":[{"options":{"left":67.5,"top":165,"height":36,"width":550,"fields":[],"field":"table","qid":"table","columns":[[{"width":137.5,"title":"名称","field":"name","checked":true,"columnId":"name","fixed":false,"rowspan":1,"colspan":1,"align":"center"},{"width":137.5,"title":"性别","field":"gender","checked":true,"columnId":"gender","fixed":false,"rowspan":1,"colspan":1,"align":"center"},{"width":137.5,"title":"数量","field":"count","checked":true,"columnId":"count","fixed":false,"rowspan":1,"colspan":1,"align":"center"},{"width":137.5,"title":"金额","field":"amount","checked":true,"columnId":"amount","fixed":false,"rowspan":1,"colspan":1,"align":"center"}]]},"printElementType":{"title":"表格","type":"table","editable":true,"columnDisplayEditable":true,"columnDisplayIndexEditable":true,"columnTitleEditable":true,"columnResizable":true,"columnAlignEditable":true,"isEnableEditField":true,"isEnableContextMenu":true,"isEnableInsertRow":true,"isEnableDeleteRow":true,"isEnableInsertColumn":true,"isEnableDeleteColumn":true,"isEnableMergeCell":true}},{"options":{"left":127.5,"top":301.5,"height":9.75,"width":120,"field":"name","testData":"内容","title":"文本","qid":"name"},"printElementType":{"title":"文本","type":"text"}}],"paperNumberContinue":true,"watermarkOptions":{},"panelLayoutOptions":{}}]}',
53
- // printUrl: "api/app/aaa",
53
+ // sourceUrl: "api/app/aaa",
54
54
  // },
55
55
  // {
56
56
  // id: 2,
57
- // templeteName: "printURL模式",
57
+ // templeteName: "sourceUrl模式",
58
58
  // remark: "",
59
59
  // templeteJson:
60
60
  // '{"panels":[{"index":0,"name":1,"paperType":"A4","height":297,"width":210,"paperHeader":0,"paperFooter":841.8897637795277,"printElements":[{"options":{"left":67.5,"top":229.5,"height":36,"width":550,"fields":[],"field":"table","qid":"table","columns":[[{"width":137.5,"title":"名称","field":"name","checked":true,"columnId":"name","fixed":false,"rowspan":1,"colspan":1,"align":"center"},{"width":137.5,"title":"性别","field":"gender","checked":true,"columnId":"gender","fixed":false,"rowspan":1,"colspan":1,"align":"center"},{"width":137.5,"title":"数量","field":"count","checked":true,"columnId":"count","fixed":false,"rowspan":1,"colspan":1,"align":"center"},{"width":137.5,"title":"金额","field":"amount","checked":true,"columnId":"amount","fixed":false,"rowspan":1,"colspan":1,"align":"center"}]]},"printElementType":{"title":"表格","type":"table","editable":true,"columnDisplayEditable":true,"columnDisplayIndexEditable":true,"columnTitleEditable":true,"columnResizable":true,"columnAlignEditable":true,"isEnableEditField":true,"isEnableContextMenu":true,"isEnableInsertRow":true,"isEnableDeleteRow":true,"isEnableInsertColumn":true,"isEnableDeleteColumn":true,"isEnableMergeCell":true}},{"options":{"left":247.5,"top":304.5,"height":9.75,"width":120,"field":"name","testData":"内容","title":"文本","qid":"name"},"printElementType":{"title":"文本","type":"text"}},{"options":{"left":79.5,"top":313.5,"height":32,"width":120,"field":"qrcode","testData":"XS888888888","fontSize":12,"lineHeight":18,"textType":"qrcode","title":"二维码","qid":"qrcode"},"printElementType":{"title":"二维码","type":"text"}}],"paperNumberContinue":true,"watermarkOptions":{},"panelLayoutOptions":{}}]}',
61
- // printUrl: "api/app/bbb",
61
+ // sourceUrl: "api/app/bbb",
62
62
  // },
63
63
  // {
64
64
  // id: 3,
@@ -66,7 +66,7 @@ export default {
66
66
  // remark: "",
67
67
  // templeteJson:
68
68
  // '{"panels":[{"index":0,"name":1,"paperType":"A4","height":297,"width":210,"paperHeader":0,"paperFooter":841.8897637795277,"printElements":[{"options":{"left":67.5,"top":229.5,"height":36,"width":550,"fields":[],"field":"table","qid":"table","columns":[[{"width":137.5,"title":"名称","field":"name","checked":true,"columnId":"name","fixed":false,"rowspan":1,"colspan":1,"align":"center"},{"width":137.5,"title":"性别","field":"gender","checked":true,"columnId":"gender","fixed":false,"rowspan":1,"colspan":1,"align":"center"},{"width":137.5,"title":"数量","field":"count","checked":true,"columnId":"count","fixed":false,"rowspan":1,"colspan":1,"align":"center"},{"width":137.5,"title":"金额","field":"amount","checked":true,"columnId":"amount","fixed":false,"rowspan":1,"colspan":1,"align":"center"}]]},"printElementType":{"title":"表格","type":"table","editable":true,"columnDisplayEditable":true,"columnDisplayIndexEditable":true,"columnTitleEditable":true,"columnResizable":true,"columnAlignEditable":true,"isEnableEditField":true,"isEnableContextMenu":true,"isEnableInsertRow":true,"isEnableDeleteRow":true,"isEnableInsertColumn":true,"isEnableDeleteColumn":true,"isEnableMergeCell":true}},{"options":{"left":247.5,"top":304.5,"height":9.75,"width":120,"field":"name","testData":"内容","title":"文本","qid":"name"},"printElementType":{"title":"文本","type":"text"}},{"options":{"left":79.5,"top":313.5,"height":32,"width":120,"field":"qrcode","testData":"XS888888888","fontSize":12,"lineHeight":18,"textType":"qrcode","title":"二维码","qid":"qrcode"},"printElementType":{"title":"二维码","type":"text"}}],"paperNumberContinue":true,"watermarkOptions":{},"panelLayoutOptions":{}}]}',
69
- // printUrl: "",
69
+ // sourceUrl: "",
70
70
  // },
71
71
  // ],
72
72
  };
@@ -144,7 +144,7 @@ export default {
144
144
 
145
145
  // 如果自定义回调没有调用 done,则走默认逻辑
146
146
  if (!isCustomHandled) {
147
- if (tempItem.printUrl) {
147
+ if (tempItem.sourceUrl) {
148
148
  this.printByApi(options, tempItem);
149
149
  } else {
150
150
  // 没有自定义回调,走默认逻辑
@@ -152,7 +152,7 @@ export default {
152
152
  this.$hiprint.print(options);
153
153
  }
154
154
  }
155
- } else if (tempItem.printUrl) {
155
+ } else if (tempItem.sourceUrl) {
156
156
  this.printByApi(options, tempItem);
157
157
  } else {
158
158
  this.printDefault(options);
@@ -187,7 +187,7 @@ export default {
187
187
  }, []);
188
188
  }
189
189
  const res = await this.get({
190
- url: `${tempItem.printUrl}`,
190
+ url: `${tempItem.sourceUrl}`,
191
191
  data: {
192
192
  ids: ids,
193
193
  },
@@ -196,7 +196,7 @@ export default {
196
196
  if (Array.isArray(res.result) && res.result.length > 0) return res.result;
197
197
  return {};
198
198
  } catch (error) {
199
- console.error(`获取打印数据失败: ${tempItem.printUrl}`, error);
199
+ console.error(`获取打印数据失败: ${tempItem.sourceUrl}`, error);
200
200
  }
201
201
  },
202
202
  },
@@ -68,7 +68,7 @@
68
68
  </div>
69
69
  </div>
70
70
  <div
71
- v-if="tableData.options.downloadBtn && !isSmartPrintComputed"
71
+ v-if="tableData.options.downloadBtn"
72
72
  class="avatar-container right-menu-item hover-effect el-dropdown"
73
73
  @click="printTable"
74
74
  >
@@ -79,7 +79,7 @@
79
79
  </div>
80
80
  </div>
81
81
  <div
82
- v-if="isSmartPrintComputed"
82
+ v-if="isSmartPrintBtn"
83
83
  class="avatar-container right-menu-item hover-effect el-dropdown"
84
84
  >
85
85
  <div class="avatar-wrapper">
@@ -420,6 +420,7 @@ export default {
420
420
  headTool: true, // 开启头部工具栏
421
421
  refreshBtn: true, // 开启表格头部刷新按钮
422
422
  downloadBtn: true, // 开启表格头部下载按钮
423
+ // smartPrintBtn: false,// 是否启用智能打印,字段不存在时候用全局配置
423
424
  }, // 序号和复选框
424
425
  rows: [], // 表数据
425
426
  columns: [], // 表头
@@ -476,11 +477,6 @@ export default {
476
477
  method: {
477
478
  type: String,
478
479
  },
479
- // 是否启用智能打印
480
- isSmartPrint: {
481
- type: Boolean,
482
- default: null,
483
- },
484
480
  },
485
481
 
486
482
  data() {
@@ -527,11 +523,12 @@ export default {
527
523
  finalMethod() {
528
524
  return this.method || (this.$olBaseConfig && this.$olBaseConfig.method) || "get";
529
525
  },
530
- isSmartPrintComputed() {
531
- if (this.isSmartPrint !== null) {
532
- return this.isSmartPrint;
526
+ isSmartPrintBtn() {
527
+ const hasKey = Object.keys(this.tableData.options).includes("smartPrintBtn");
528
+ if (hasKey) {
529
+ return !!this.tableData.options.smartPrintBtn;
533
530
  }
534
- return (this.$olBaseConfig && this.$olBaseConfig.isSmartPrint) || false;
531
+ return (this.$olBaseConfig && this.$olBaseConfig.smartPrintBtn) || false;
535
532
  },
536
533
  },
537
534
  created() {