ocpview-plus 1.0.19 → 1.1.1

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/README.md CHANGED
@@ -1,3 +1,27 @@
1
-
2
- ### 1.0.18 更新说明
3
- ListDetail 模板 EditGrid 增加键盘导航
1
+
2
+ ### 1.0.18 更新说明
3
+ ListDetail 模板 EditGrid 增加键盘导航
4
+
5
+ ### 1.0.19 更新说明
6
+ ListDetail 模板 EditGrid 屏蔽键盘导航
7
+
8
+ ### 1.1.0 更新说明
9
+ 支持单据明细导出
10
+ 用例简介:
11
+ ```
12
+ // 按钮配置
13
+ {
14
+ icon: "custom-export",
15
+ name: "billExport",
16
+ text: "导出",
17
+ }
18
+
19
+
20
+ // 多明细导出配置,若非多明细可不配置
21
+ billImportConfig: {
22
+ typeData: [
23
+ { code: 'goods_1', name: '单品' },
24
+ { code: 'comb_2', name: '组合' },
25
+ ],
26
+ }
27
+ ```
@@ -453,7 +453,7 @@ common.initEview = function(ViewUI2) {
453
453
  common.initAnchor(ViewUI2.Anchor);
454
454
  };
455
455
  const name = "ocpview-plus";
456
- const version$2 = "1.0.16";
456
+ const version$2 = "1.1.0";
457
457
  const title = "ocpviewPlus";
458
458
  const description = "A high quality Service UI components Library with Vue.js";
459
459
  const homepage = "";
@@ -1558,6 +1558,80 @@ caseMethod.doExportReport = function(_baseUrl, _method, _param, that) {
1558
1558
  });
1559
1559
  caseMethod.downloadFile(url, that);
1560
1560
  };
1561
+ caseMethod.doBillExport = function(baseUrl, method, param, ctx) {
1562
+ const _param = Object.assign({}, param);
1563
+ const url = encodeURI(
1564
+ getresturl(baseUrl, method, _param, ctx) + "&param=" + JSON.stringify(_param)
1565
+ );
1566
+ ctx.$Spin.show({
1567
+ render: (h10) => h10("div", "\u5BFC\u51FA\u4E2D...,\u8BF7\u52FF\u5173\u95ED!")
1568
+ });
1569
+ caseMethod.downloadExcel(url, ctx, param);
1570
+ };
1571
+ caseMethod.downloadExcel = function(url, ctx, postObj = {}) {
1572
+ const xhr2 = new XMLHttpRequest();
1573
+ xhr2.open("POST", url, true);
1574
+ xhr2.responseType = "blob";
1575
+ xhr2.setRequestHeader("Content-Type", "application/json");
1576
+ xhr2.onload = function() {
1577
+ var _a2;
1578
+ ctx.$Spin.hide();
1579
+ if (this.status !== 200) {
1580
+ (_a2 = ctx.alert) == null ? void 0 : _a2.call(ctx, `\u5BFC\u51FA\u5931\u8D25\uFF1A${this.status} ${this.statusText}`);
1581
+ return;
1582
+ }
1583
+ const blob = this.response;
1584
+ const reader = new FileReader();
1585
+ reader.onload = () => {
1586
+ var _a3;
1587
+ let text = reader.result;
1588
+ try {
1589
+ const json = JSON.parse(text);
1590
+ if (json.returncode && json.returncode !== "0") {
1591
+ (_a3 = ctx.alert) == null ? void 0 : _a3.call(ctx, json.data || "\u5BFC\u51FA\u5931\u8D25");
1592
+ return;
1593
+ }
1594
+ } catch (e10) {
1595
+ }
1596
+ let filename = buildFilename(postObj, xhr2);
1597
+ const a2 = document.createElement("a");
1598
+ a2.href = URL.createObjectURL(blob);
1599
+ a2.download = filename;
1600
+ document.body.appendChild(a2);
1601
+ a2.click();
1602
+ setTimeout(() => document.body.removeChild(a2), 120);
1603
+ };
1604
+ reader.readAsText(blob);
1605
+ };
1606
+ xhr2.onerror = () => {
1607
+ var _a2;
1608
+ ctx.$Spin.hide();
1609
+ (_a2 = ctx.alert) == null ? void 0 : _a2.call(ctx, "\u7F51\u7EDC\u9519\u8BEF\uFF0C\u5BFC\u51FA\u5931\u8D25");
1610
+ };
1611
+ xhr2.send(JSON.stringify(postObj));
1612
+ };
1613
+ function buildFilename(postObj, xhr2) {
1614
+ let cd2 = xhr2.getResponseHeader("content-disposition");
1615
+ if (cd2 && cd2.includes("filename=")) {
1616
+ let match = cd2.match(/filename\*=UTF-8''(.+)/i);
1617
+ if (match && match[1])
1618
+ return decodeURIComponent(match[1]);
1619
+ let tmp = cd2.split("filename=")[1];
1620
+ if (tmp)
1621
+ return tmp.replace(/["']/g, "");
1622
+ }
1623
+ const now2 = new Date();
1624
+ const t10 = [
1625
+ now2.getFullYear(),
1626
+ String(now2.getMonth() + 1).padStart(2, "0"),
1627
+ String(now2.getDate()).padStart(2, "0"),
1628
+ String(now2.getHours()).padStart(2, "0"),
1629
+ String(now2.getMinutes()).padStart(2, "0"),
1630
+ String(now2.getSeconds()).padStart(2, "0")
1631
+ ].join("");
1632
+ const billmoduleid = postObj.billmoduleid || "export";
1633
+ return `${t10}${billmoduleid}.xlsx`;
1634
+ }
1561
1635
  caseMethod.getFilesInfo = function(billno, billmoduleid, notdelfile, scenetype, callBackMethod) {
1562
1636
  let usercode = caseMethod.getUserCode();
1563
1637
  let username = caseMethod.getUserName();
@@ -27003,13 +27077,6 @@ const _sfc_main$1s = {
27003
27077
  if (this.config.onOpenChange) {
27004
27078
  this.config.onOpenChange(newValue);
27005
27079
  }
27006
- if (!newValue) {
27007
- if (this.searchParam) {
27008
- if (!this.searchParam.notfatherclean) {
27009
- this.query.Config.lastQueryParam = {};
27010
- }
27011
- }
27012
- }
27013
27080
  },
27014
27081
  immediate: true
27015
27082
  }
@@ -39215,6 +39282,33 @@ const _sfc_main$H = {
39215
39282
  billImport.setUrl(url, classPrefix, para);
39216
39283
  billImport.setShowUpload(true);
39217
39284
  },
39285
+ billExport(action) {
39286
+ let url = this.uiconfig.resources;
39287
+ const method = this.uiconfig.classPrefix + "." + this.getActionMethod(action);
39288
+ let param = this.getExportParam();
39289
+ let billImport = this.getBillImport();
39290
+ const cfg = billImport.config || {};
39291
+ const typeData = cfg.typeData || [];
39292
+ if (typeData.length <= 1) {
39293
+ this.doBillExport(url, method, param, this);
39294
+ return;
39295
+ }
39296
+ billImport.setExportUrl(url, method, param, typeData);
39297
+ },
39298
+ getExportParam() {
39299
+ if (this.customGetExportParam) {
39300
+ return this.customGetExportParam();
39301
+ }
39302
+ let data = this.getData();
39303
+ let obj = {};
39304
+ let name2 = "billno";
39305
+ obj.billno = data[name2];
39306
+ obj.billmoduleid = this.globalConfig.modulecode;
39307
+ if (data["mktcode"]) {
39308
+ obj.mktcode = data["mktcode"];
39309
+ }
39310
+ return obj;
39311
+ },
39218
39312
  getBillImport() {
39219
39313
  return this.$refs.billImport;
39220
39314
  },
@@ -41382,6 +41476,22 @@ const _sfc_main$D = {
41382
41476
  setModeltype(value) {
41383
41477
  this.modeltype = value;
41384
41478
  },
41479
+ setExportUrl(url, method, param, typeData) {
41480
+ this.modeltype = "export";
41481
+ this.curlUrl = this.getResturl(url, method, {}, this);
41482
+ this.param = param;
41483
+ this.myConfig.typeData = typeData;
41484
+ this.showUpload = true;
41485
+ },
41486
+ confirmExport() {
41487
+ if (!this.type) {
41488
+ this.$Message.error("\u8BF7\u9009\u62E9\u5BFC\u51FA\u7C7B\u578B");
41489
+ return;
41490
+ }
41491
+ let newParam = Object.assign({}, this.param);
41492
+ newParam.billmoduleid = newParam.billmoduleid + "_" + this.type.split("_")[1];
41493
+ this.downloadExcel(this.curlUrl, this, newParam);
41494
+ },
41385
41495
  setShowUpload(flag) {
41386
41496
  if (flag) {
41387
41497
  this.init();
@@ -41592,7 +41702,7 @@ function _sfc_render$A(_ctx, _cache, $props, $setup, $data, $options) {
41592
41702
  }, {
41593
41703
  default: withCtx(() => [
41594
41704
  createVNode(_component_Button, { style: { "width": "150px" } }, {
41595
- default: withCtx(() => _cache[5] || (_cache[5] = [
41705
+ default: withCtx(() => _cache[7] || (_cache[7] = [
41596
41706
  createTextVNode("\u9009\u62E9\u6587\u4EF6")
41597
41707
  ])),
41598
41708
  _: 1
@@ -41614,7 +41724,7 @@ function _sfc_render$A(_ctx, _cache, $props, $setup, $data, $options) {
41614
41724
  size: "18",
41615
41725
  class: "demo-spin-icon-load"
41616
41726
  }),
41617
- _cache[6] || (_cache[6] = createElementVNode("div", null, "\u5BFC\u5165\u4E2D", -1))
41727
+ _cache[8] || (_cache[8] = createElementVNode("div", null, "\u5BFC\u5165\u4E2D", -1))
41618
41728
  ]),
41619
41729
  _: 1
41620
41730
  }, 512), [
@@ -41654,10 +41764,41 @@ function _sfc_render$A(_ctx, _cache, $props, $setup, $data, $options) {
41654
41764
  }, 8, ["modelValue"])
41655
41765
  ]),
41656
41766
  _: 1
41767
+ }, 8, ["modelValue", "onOnOk"])) : createCommentVNode("", true),
41768
+ $data.modeltype === "export" ? (openBlock(), createBlock(_component_Modal, {
41769
+ key: 2,
41770
+ modelValue: $data.showUpload,
41771
+ "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => $data.showUpload = $event),
41772
+ title: "\u5BFC\u51FA\u9009\u62E9",
41773
+ onOnOk: $options.confirmExport,
41774
+ "class-name": "vertical-center-modal\u2014bill"
41775
+ }, {
41776
+ default: withCtx(() => [
41777
+ createVNode(_component_RadioGroup, {
41778
+ modelValue: $data.type,
41779
+ "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => $data.type = $event)
41780
+ }, {
41781
+ default: withCtx(() => [
41782
+ (openBlock(true), createElementBlock(Fragment, null, renderList($data.myConfig.typeData, (item, index) => {
41783
+ return openBlock(), createBlock(_component_Radio, {
41784
+ key: index,
41785
+ label: item.code
41786
+ }, {
41787
+ default: withCtx(() => [
41788
+ createElementVNode("span", null, toDisplayString(item.name), 1)
41789
+ ]),
41790
+ _: 2
41791
+ }, 1032, ["label"]);
41792
+ }), 128))
41793
+ ]),
41794
+ _: 1
41795
+ }, 8, ["modelValue"])
41796
+ ]),
41797
+ _: 1
41657
41798
  }, 8, ["modelValue", "onOnOk"])) : createCommentVNode("", true)
41658
41799
  ]);
41659
41800
  }
41660
- var mBillImport = /* @__PURE__ */ _export_sfc$1(_sfc_main$D, [["render", _sfc_render$A], ["__scopeId", "data-v-28ca1387"]]);
41801
+ var mBillImport = /* @__PURE__ */ _export_sfc$1(_sfc_main$D, [["render", _sfc_render$A], ["__scopeId", "data-v-14d9a5da"]]);
41661
41802
  var layouttemplate_vue_vue_type_style_index_0_lang = "";
41662
41803
  const _sfc_main$C = {
41663
41804
  name: "BillTemplate",