ocpview-plus 1.0.19 → 1.1.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/README.md +33 -3
- package/dist/ocpviewplus.min.esm.js +164 -11
- package/dist/ocpviewplus.min.js +2 -2
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/masterplate/base.vue +31 -0
- package/src/components/masterplate/billimport.vue +276 -238
- package/src/components/poptextbox/poptextbox.vue +24 -31
- package/src/components/upload/billimport.vue +21 -6
- package/src/method/case/case.js +200 -106
package/README.md
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
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
|
+
```
|
|
28
|
+
|
|
29
|
+
### 1.1.1 更新说明
|
|
30
|
+
导出默认加mktcode
|
|
31
|
+
|
|
32
|
+
### 1.1.2 更新说明
|
|
33
|
+
导出xls格式
|
|
@@ -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.
|
|
456
|
+
const version$2 = "1.1.2";
|
|
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) + "¶m=" + 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}.xls`;
|
|
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
|
}
|
|
@@ -33818,6 +33885,18 @@ const _sfc_main$14 = {
|
|
|
33818
33885
|
window.open(temp, "_self");
|
|
33819
33886
|
}
|
|
33820
33887
|
},
|
|
33888
|
+
setExportDownUrl(url, param) {
|
|
33889
|
+
let self2 = this;
|
|
33890
|
+
this.url = this.getResturl(url, null, {}, self2);
|
|
33891
|
+
if (this.myConfig.typeData.length > 1) {
|
|
33892
|
+
this.param = param;
|
|
33893
|
+
this.type = this.myConfig.typeData[0].code;
|
|
33894
|
+
this.showUpload = true;
|
|
33895
|
+
} else {
|
|
33896
|
+
let temp = this.url + "¶m=" + encodeURI(JSON.stringify(param));
|
|
33897
|
+
window.open(temp, "_self");
|
|
33898
|
+
}
|
|
33899
|
+
},
|
|
33821
33900
|
handleUpload(file) {
|
|
33822
33901
|
if (!this.checkFormat(file)) {
|
|
33823
33902
|
this.handleFormatError(file);
|
|
@@ -39215,6 +39294,33 @@ const _sfc_main$H = {
|
|
|
39215
39294
|
billImport.setUrl(url, classPrefix, para);
|
|
39216
39295
|
billImport.setShowUpload(true);
|
|
39217
39296
|
},
|
|
39297
|
+
billExport(action) {
|
|
39298
|
+
let url = this.uiconfig.resources;
|
|
39299
|
+
const method = this.uiconfig.classPrefix + "." + this.getActionMethod(action);
|
|
39300
|
+
let param = this.getExportParam();
|
|
39301
|
+
let billImport = this.getBillImport();
|
|
39302
|
+
const cfg = billImport.config || {};
|
|
39303
|
+
const typeData = cfg.typeData || [];
|
|
39304
|
+
if (typeData.length <= 1) {
|
|
39305
|
+
this.doBillExport(url, method, param, this);
|
|
39306
|
+
return;
|
|
39307
|
+
}
|
|
39308
|
+
billImport.setExportUrl(url, method, param, typeData);
|
|
39309
|
+
},
|
|
39310
|
+
getExportParam() {
|
|
39311
|
+
if (this.customGetExportParam) {
|
|
39312
|
+
return this.customGetExportParam();
|
|
39313
|
+
}
|
|
39314
|
+
let data = this.getData();
|
|
39315
|
+
let obj = {};
|
|
39316
|
+
let name2 = "billno";
|
|
39317
|
+
obj.billno = data[name2];
|
|
39318
|
+
obj.billmoduleid = this.globalConfig.modulecode;
|
|
39319
|
+
if (data["mktcode"]) {
|
|
39320
|
+
obj.mktcode = data["mktcode"];
|
|
39321
|
+
}
|
|
39322
|
+
return obj;
|
|
39323
|
+
},
|
|
39218
39324
|
getBillImport() {
|
|
39219
39325
|
return this.$refs.billImport;
|
|
39220
39326
|
},
|
|
@@ -41382,6 +41488,22 @@ const _sfc_main$D = {
|
|
|
41382
41488
|
setModeltype(value) {
|
|
41383
41489
|
this.modeltype = value;
|
|
41384
41490
|
},
|
|
41491
|
+
setExportUrl(url, method, param, typeData) {
|
|
41492
|
+
this.modeltype = "export";
|
|
41493
|
+
this.curlUrl = this.getResturl(url, method, {}, this);
|
|
41494
|
+
this.param = param;
|
|
41495
|
+
this.myConfig.typeData = typeData;
|
|
41496
|
+
this.showUpload = true;
|
|
41497
|
+
},
|
|
41498
|
+
confirmExport() {
|
|
41499
|
+
if (!this.type) {
|
|
41500
|
+
this.$Message.error("\u8BF7\u9009\u62E9\u5BFC\u51FA\u7C7B\u578B");
|
|
41501
|
+
return;
|
|
41502
|
+
}
|
|
41503
|
+
let newParam = Object.assign({}, this.param);
|
|
41504
|
+
newParam.billmoduleid = newParam.billmoduleid + "_" + this.type.split("_")[1];
|
|
41505
|
+
this.downloadExcel(this.curlUrl, this, newParam);
|
|
41506
|
+
},
|
|
41385
41507
|
setShowUpload(flag) {
|
|
41386
41508
|
if (flag) {
|
|
41387
41509
|
this.init();
|
|
@@ -41592,7 +41714,7 @@ function _sfc_render$A(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
41592
41714
|
}, {
|
|
41593
41715
|
default: withCtx(() => [
|
|
41594
41716
|
createVNode(_component_Button, { style: { "width": "150px" } }, {
|
|
41595
|
-
default: withCtx(() => _cache[
|
|
41717
|
+
default: withCtx(() => _cache[7] || (_cache[7] = [
|
|
41596
41718
|
createTextVNode("\u9009\u62E9\u6587\u4EF6")
|
|
41597
41719
|
])),
|
|
41598
41720
|
_: 1
|
|
@@ -41614,7 +41736,7 @@ function _sfc_render$A(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
41614
41736
|
size: "18",
|
|
41615
41737
|
class: "demo-spin-icon-load"
|
|
41616
41738
|
}),
|
|
41617
|
-
_cache[
|
|
41739
|
+
_cache[8] || (_cache[8] = createElementVNode("div", null, "\u5BFC\u5165\u4E2D", -1))
|
|
41618
41740
|
]),
|
|
41619
41741
|
_: 1
|
|
41620
41742
|
}, 512), [
|
|
@@ -41654,10 +41776,41 @@ function _sfc_render$A(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
41654
41776
|
}, 8, ["modelValue"])
|
|
41655
41777
|
]),
|
|
41656
41778
|
_: 1
|
|
41779
|
+
}, 8, ["modelValue", "onOnOk"])) : createCommentVNode("", true),
|
|
41780
|
+
$data.modeltype === "export" ? (openBlock(), createBlock(_component_Modal, {
|
|
41781
|
+
key: 2,
|
|
41782
|
+
modelValue: $data.showUpload,
|
|
41783
|
+
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => $data.showUpload = $event),
|
|
41784
|
+
title: "\u5BFC\u51FA\u9009\u62E9",
|
|
41785
|
+
onOnOk: $options.confirmExport,
|
|
41786
|
+
"class-name": "vertical-center-modal\u2014bill"
|
|
41787
|
+
}, {
|
|
41788
|
+
default: withCtx(() => [
|
|
41789
|
+
createVNode(_component_RadioGroup, {
|
|
41790
|
+
modelValue: $data.type,
|
|
41791
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => $data.type = $event)
|
|
41792
|
+
}, {
|
|
41793
|
+
default: withCtx(() => [
|
|
41794
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList($data.myConfig.typeData, (item, index) => {
|
|
41795
|
+
return openBlock(), createBlock(_component_Radio, {
|
|
41796
|
+
key: index,
|
|
41797
|
+
label: item.code
|
|
41798
|
+
}, {
|
|
41799
|
+
default: withCtx(() => [
|
|
41800
|
+
createElementVNode("span", null, toDisplayString(item.name), 1)
|
|
41801
|
+
]),
|
|
41802
|
+
_: 2
|
|
41803
|
+
}, 1032, ["label"]);
|
|
41804
|
+
}), 128))
|
|
41805
|
+
]),
|
|
41806
|
+
_: 1
|
|
41807
|
+
}, 8, ["modelValue"])
|
|
41808
|
+
]),
|
|
41809
|
+
_: 1
|
|
41657
41810
|
}, 8, ["modelValue", "onOnOk"])) : createCommentVNode("", true)
|
|
41658
41811
|
]);
|
|
41659
41812
|
}
|
|
41660
|
-
var mBillImport = /* @__PURE__ */ _export_sfc$1(_sfc_main$D, [["render", _sfc_render$A], ["__scopeId", "data-v-
|
|
41813
|
+
var mBillImport = /* @__PURE__ */ _export_sfc$1(_sfc_main$D, [["render", _sfc_render$A], ["__scopeId", "data-v-14d9a5da"]]);
|
|
41661
41814
|
var layouttemplate_vue_vue_type_style_index_0_lang = "";
|
|
41662
41815
|
const _sfc_main$C = {
|
|
41663
41816
|
name: "BillTemplate",
|