ocpview-plus 1.0.18 → 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 +27 -3
- package/dist/ocpviewplus.min.esm.js +152 -19
- package/dist/ocpviewplus.min.js +3 -3
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/grid/editgridbase.vue +6 -6
- 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/method/case/case.js +200 -106
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
|
|
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) + "¶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}.xlsx`;
|
|
1634
|
+
}
|
|
1561
1635
|
caseMethod.getFilesInfo = function(billno, billmoduleid, notdelfile, scenetype, callBackMethod) {
|
|
1562
1636
|
let usercode = caseMethod.getUserCode();
|
|
1563
1637
|
let username = caseMethod.getUserName();
|
|
@@ -9124,9 +9198,6 @@ const _sfc_main$1F = {
|
|
|
9124
9198
|
return this.soltTableColumns.map((c10) => c10.key);
|
|
9125
9199
|
}
|
|
9126
9200
|
},
|
|
9127
|
-
beforeUnmount() {
|
|
9128
|
-
document.removeEventListener("keydown", this.handleKeydown);
|
|
9129
|
-
},
|
|
9130
9201
|
methods: {
|
|
9131
9202
|
customInit() {
|
|
9132
9203
|
if (this.myConfig.items && this.myConfig.items.length > 0) {
|
|
@@ -9178,9 +9249,6 @@ const _sfc_main$1F = {
|
|
|
9178
9249
|
this.customInit2();
|
|
9179
9250
|
}
|
|
9180
9251
|
this.myConfig.getGridObject = this.getGridObject;
|
|
9181
|
-
document.addEventListener("keydown", (e10) => {
|
|
9182
|
-
this.handleKeydown(e10);
|
|
9183
|
-
});
|
|
9184
9252
|
},
|
|
9185
9253
|
getGridObject() {
|
|
9186
9254
|
let that = this;
|
|
@@ -9527,7 +9595,6 @@ const _sfc_main$1F = {
|
|
|
9527
9595
|
return error;
|
|
9528
9596
|
},
|
|
9529
9597
|
EditCell(index, config2) {
|
|
9530
|
-
this.setEditGridFocus(index, config2.key);
|
|
9531
9598
|
if (this.myConfig.readOnly) {
|
|
9532
9599
|
this.cancelCellEditing();
|
|
9533
9600
|
return;
|
|
@@ -9794,7 +9861,6 @@ const _sfc_main$1F = {
|
|
|
9794
9861
|
this.editIndex = nextKey.editIndex;
|
|
9795
9862
|
this.editKey = nextKey.editKey;
|
|
9796
9863
|
this.setcheckInfo(nextKey.editIndex, nextKey.editKey);
|
|
9797
|
-
this.setEditGridFocus(this.editIndex, this.editKey);
|
|
9798
9864
|
}
|
|
9799
9865
|
},
|
|
9800
9866
|
findNextItems(editIndex, editName) {
|
|
@@ -27011,13 +27077,6 @@ const _sfc_main$1s = {
|
|
|
27011
27077
|
if (this.config.onOpenChange) {
|
|
27012
27078
|
this.config.onOpenChange(newValue);
|
|
27013
27079
|
}
|
|
27014
|
-
if (!newValue) {
|
|
27015
|
-
if (this.searchParam) {
|
|
27016
|
-
if (!this.searchParam.notfatherclean) {
|
|
27017
|
-
this.query.Config.lastQueryParam = {};
|
|
27018
|
-
}
|
|
27019
|
-
}
|
|
27020
|
-
}
|
|
27021
27080
|
},
|
|
27022
27081
|
immediate: true
|
|
27023
27082
|
}
|
|
@@ -39223,6 +39282,33 @@ const _sfc_main$H = {
|
|
|
39223
39282
|
billImport.setUrl(url, classPrefix, para);
|
|
39224
39283
|
billImport.setShowUpload(true);
|
|
39225
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
|
+
},
|
|
39226
39312
|
getBillImport() {
|
|
39227
39313
|
return this.$refs.billImport;
|
|
39228
39314
|
},
|
|
@@ -41390,6 +41476,22 @@ const _sfc_main$D = {
|
|
|
41390
41476
|
setModeltype(value) {
|
|
41391
41477
|
this.modeltype = value;
|
|
41392
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
|
+
},
|
|
41393
41495
|
setShowUpload(flag) {
|
|
41394
41496
|
if (flag) {
|
|
41395
41497
|
this.init();
|
|
@@ -41600,7 +41702,7 @@ function _sfc_render$A(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
41600
41702
|
}, {
|
|
41601
41703
|
default: withCtx(() => [
|
|
41602
41704
|
createVNode(_component_Button, { style: { "width": "150px" } }, {
|
|
41603
|
-
default: withCtx(() => _cache[
|
|
41705
|
+
default: withCtx(() => _cache[7] || (_cache[7] = [
|
|
41604
41706
|
createTextVNode("\u9009\u62E9\u6587\u4EF6")
|
|
41605
41707
|
])),
|
|
41606
41708
|
_: 1
|
|
@@ -41622,7 +41724,7 @@ function _sfc_render$A(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
41622
41724
|
size: "18",
|
|
41623
41725
|
class: "demo-spin-icon-load"
|
|
41624
41726
|
}),
|
|
41625
|
-
_cache[
|
|
41727
|
+
_cache[8] || (_cache[8] = createElementVNode("div", null, "\u5BFC\u5165\u4E2D", -1))
|
|
41626
41728
|
]),
|
|
41627
41729
|
_: 1
|
|
41628
41730
|
}, 512), [
|
|
@@ -41662,10 +41764,41 @@ function _sfc_render$A(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
41662
41764
|
}, 8, ["modelValue"])
|
|
41663
41765
|
]),
|
|
41664
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
|
|
41665
41798
|
}, 8, ["modelValue", "onOnOk"])) : createCommentVNode("", true)
|
|
41666
41799
|
]);
|
|
41667
41800
|
}
|
|
41668
|
-
var mBillImport = /* @__PURE__ */ _export_sfc$1(_sfc_main$D, [["render", _sfc_render$A], ["__scopeId", "data-v-
|
|
41801
|
+
var mBillImport = /* @__PURE__ */ _export_sfc$1(_sfc_main$D, [["render", _sfc_render$A], ["__scopeId", "data-v-14d9a5da"]]);
|
|
41669
41802
|
var layouttemplate_vue_vue_type_style_index_0_lang = "";
|
|
41670
41803
|
const _sfc_main$C = {
|
|
41671
41804
|
name: "BillTemplate",
|