cloud-web-corejs 1.0.54-dev.425 → 1.0.54-dev.426
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 +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/download-button-widget.vue +143 -0
- package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +35 -0
- package/src/components/xform/form-render/index.vue +2 -0
- package/src/components/xform/form-render/indexMixin.js +5 -0
- package/src/components/xform/lang/zh-CN.js +1 -0
- package/src/utils/vab.js +6 -2
package/package.json
CHANGED
package/src/components/xform/form-designer/form-widget/field-widget/download-button-widget.vue
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<static-content-wrapper
|
|
3
|
+
:designer="designer"
|
|
4
|
+
:field="field"
|
|
5
|
+
:design-state="designState"
|
|
6
|
+
:display-style="field.options.displayStyle"
|
|
7
|
+
:parent-widget="parentWidget"
|
|
8
|
+
:parent-list="parentList"
|
|
9
|
+
:index-of-parent-list="indexOfParentList"
|
|
10
|
+
:sub-form-row-index="subFormRowIndex"
|
|
11
|
+
:sub-form-col-index="subFormColIndex"
|
|
12
|
+
:sub-form-row-id="subFormRowId"
|
|
13
|
+
>
|
|
14
|
+
<el-button
|
|
15
|
+
class="button-sty"
|
|
16
|
+
@click="clickHandle"
|
|
17
|
+
icon="el-icon-download"
|
|
18
|
+
:disabled="!designState && field.options.disabled"
|
|
19
|
+
>
|
|
20
|
+
{{ getI18nLabel(field.options.label) }}
|
|
21
|
+
</el-button>
|
|
22
|
+
</static-content-wrapper>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script>
|
|
26
|
+
import StaticContentWrapper from "./static-content-wrapper";
|
|
27
|
+
import emitter from "../../../utils/emitter";
|
|
28
|
+
import i18n from "../../../utils/i18n";
|
|
29
|
+
import fieldMixin from "./fieldMixin";
|
|
30
|
+
|
|
31
|
+
export default {
|
|
32
|
+
name: "download-button-widget",
|
|
33
|
+
componentName: "FieldWidget", //必须固定为FieldWidget,用于接收父级组件的broadcast事件
|
|
34
|
+
mixins: [emitter, fieldMixin, i18n],
|
|
35
|
+
props: {
|
|
36
|
+
field: Object,
|
|
37
|
+
parentWidget: Object,
|
|
38
|
+
parentList: Array,
|
|
39
|
+
indexOfParentList: Number,
|
|
40
|
+
designer: Object,
|
|
41
|
+
|
|
42
|
+
designState: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false,
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
subFormRowIndex: {
|
|
48
|
+
/* 子表单组件行索引,从0开始计数 */ type: Number,
|
|
49
|
+
default: -1,
|
|
50
|
+
},
|
|
51
|
+
subFormColIndex: {
|
|
52
|
+
/* 子表单组件列索引,从0开始计数 */ type: Number,
|
|
53
|
+
default: -1,
|
|
54
|
+
},
|
|
55
|
+
subFormRowId: {
|
|
56
|
+
/* 子表单组件行Id,唯一id且不可变 */ type: String,
|
|
57
|
+
default: "",
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
components: {
|
|
61
|
+
StaticContentWrapper,
|
|
62
|
+
},
|
|
63
|
+
computed: {},
|
|
64
|
+
beforeCreate() {
|
|
65
|
+
/* 这里不能访问方法和属性!! */
|
|
66
|
+
},
|
|
67
|
+
created() {
|
|
68
|
+
/* 注意:子组件mounted在父组件created之后、父组件mounted之前触发,故子组件mounted需要用到的prop
|
|
69
|
+
需要在父组件created中初始化!! */
|
|
70
|
+
this.registerToRefList();
|
|
71
|
+
this.initEventHandler();
|
|
72
|
+
|
|
73
|
+
this.handleOnCreated();
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
mounted() {
|
|
77
|
+
this.handleOnMounted();
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
beforeDestroy() {
|
|
81
|
+
this.unregisterFromRefList();
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
methods: {
|
|
85
|
+
clickHandle() {
|
|
86
|
+
if (this.designState || this.field.options.disabled) return;
|
|
87
|
+
/* let copyData = this.$baseLodash.cloneDeep(this.formModel);
|
|
88
|
+
|
|
89
|
+
this.handleCustomEvent(this.field.options.copyDataHandle, ["copyData"], [copyData])
|
|
90
|
+
this.getFormRef().openCopyEditTab(copyData); */
|
|
91
|
+
},
|
|
92
|
+
downloadHandle() {
|
|
93
|
+
|
|
94
|
+
},
|
|
95
|
+
loadDataDefaultHandle() {
|
|
96
|
+
let reportTemplate = this.getFormRef().reportTemplate;
|
|
97
|
+
let formCode = reportTemplate.formCode;
|
|
98
|
+
let formScriptEnabled = this.field.options.formScriptEnabled || false;
|
|
99
|
+
let scriptCode = this.field.options.formScriptCode;
|
|
100
|
+
if (!scriptCode) return;
|
|
101
|
+
if (dataId) {
|
|
102
|
+
let accessParam = this.handleCustomEvent(
|
|
103
|
+
this.field.options.formScriptParam
|
|
104
|
+
);
|
|
105
|
+
return this.formHttp({
|
|
106
|
+
scriptCode: scriptCode,
|
|
107
|
+
data: {
|
|
108
|
+
formCode: formCode,
|
|
109
|
+
formVersion: reportTemplate.formVersion,
|
|
110
|
+
taBm: this.fieldKeyName,
|
|
111
|
+
data: {
|
|
112
|
+
...accessParam,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
success: (res) => {
|
|
116
|
+
let data = res.objx;
|
|
117
|
+
if(data){
|
|
118
|
+
this.$downloadByFileWhole(data, (url)=>{
|
|
119
|
+
this.openInNewTab(url)
|
|
120
|
+
})
|
|
121
|
+
}else{
|
|
122
|
+
this.$message.error(this.$t1("下载文件失败"))
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
openInNewTab(url) {
|
|
129
|
+
if (!url) return;
|
|
130
|
+
var a = document.createElement("a");
|
|
131
|
+
a.href = url;
|
|
132
|
+
a.target = "_blank";
|
|
133
|
+
document.body.appendChild(a);
|
|
134
|
+
a.click();
|
|
135
|
+
document.body.removeChild(a);
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
</script>
|
|
140
|
+
|
|
141
|
+
<style lang="scss" scoped>
|
|
142
|
+
@import "~@/styles/global.scss"; //* static-content-wrapper已引入,还需要重复引入吗? *//
|
|
143
|
+
</style>
|
|
@@ -3423,6 +3423,41 @@ export const advancedFields = [
|
|
|
3423
3423
|
|
|
3424
3424
|
},
|
|
3425
3425
|
},
|
|
3426
|
+
|
|
3427
|
+
{
|
|
3428
|
+
type: "download-button",
|
|
3429
|
+
icon: "button",
|
|
3430
|
+
commonFlag: !0,
|
|
3431
|
+
columnFlag: true,
|
|
3432
|
+
formItemFlag: !1,
|
|
3433
|
+
options: {
|
|
3434
|
+
name: "",
|
|
3435
|
+
label: "附件下载",
|
|
3436
|
+
columnWidth: "200px",
|
|
3437
|
+
size: "",
|
|
3438
|
+
|
|
3439
|
+
// displayStyle: "block",
|
|
3440
|
+
disabled: !1,
|
|
3441
|
+
hidden: !1,
|
|
3442
|
+
buttonTypeFlag: 1,
|
|
3443
|
+
type: "",
|
|
3444
|
+
/*plain: !1,
|
|
3445
|
+
round: !1,
|
|
3446
|
+
circle: !1,
|
|
3447
|
+
icon: "el-icon-download",*/
|
|
3448
|
+
customClass: "",
|
|
3449
|
+
...httpConfig,
|
|
3450
|
+
|
|
3451
|
+
downloadButton: "",
|
|
3452
|
+
|
|
3453
|
+
onCreated: "",
|
|
3454
|
+
onMounted: "",
|
|
3455
|
+
...defaultWfConfig,
|
|
3456
|
+
showRuleFlag: 1,
|
|
3457
|
+
showRuleEnabled: 1,
|
|
3458
|
+
showRules: [],
|
|
3459
|
+
},
|
|
3460
|
+
},
|
|
3426
3461
|
];
|
|
3427
3462
|
|
|
3428
3463
|
export const businessFields = [
|
|
@@ -62,11 +62,13 @@
|
|
|
62
62
|
<searchFormDialog
|
|
63
63
|
v-if="showSearchDialog"
|
|
64
64
|
:visiable.sync="showSearchDialog"
|
|
65
|
+
ref="searchFormDialog"
|
|
65
66
|
:option="searchDialogOption"
|
|
66
67
|
></searchFormDialog>
|
|
67
68
|
<formDialog
|
|
68
69
|
v-if="showFormDialog"
|
|
69
70
|
:visiable.sync="showFormDialog"
|
|
71
|
+
ref="formDialog"
|
|
70
72
|
:option="formDialogOption"
|
|
71
73
|
></formDialog>
|
|
72
74
|
<importDialog
|
|
@@ -2771,6 +2771,11 @@ modules = {
|
|
|
2771
2771
|
this.formDialogOption = option;
|
|
2772
2772
|
this.showFormDialog = true;
|
|
2773
2773
|
},
|
|
2774
|
+
closeFormDialog() {
|
|
2775
|
+
if(this.showFormDialog){
|
|
2776
|
+
this.$refs.formDialog.close();
|
|
2777
|
+
}
|
|
2778
|
+
},
|
|
2774
2779
|
confirmFormDialog() {
|
|
2775
2780
|
this.formDialogOption.confirm && this.formDialogOption.confirm();
|
|
2776
2781
|
},
|
package/src/utils/vab.js
CHANGED
|
@@ -1024,7 +1024,7 @@ install = (Vue, opts = {}) => {
|
|
|
1024
1024
|
});
|
|
1025
1025
|
};
|
|
1026
1026
|
|
|
1027
|
-
Vue.prototype.$downloadByFileWhole = function (fileWhole) {
|
|
1027
|
+
Vue.prototype.$downloadByFileWhole = function (fileWhole, handler) {
|
|
1028
1028
|
let that = this;
|
|
1029
1029
|
if (!fileWhole) {
|
|
1030
1030
|
this.$baseAlert("凭证信息不存在");
|
|
@@ -1049,7 +1049,11 @@ install = (Vue, opts = {}) => {
|
|
|
1049
1049
|
isLoading: true,
|
|
1050
1050
|
success: (res) => {
|
|
1051
1051
|
// window.open(res.objx.url);
|
|
1052
|
-
|
|
1052
|
+
if(!handler){
|
|
1053
|
+
openInNewTab(res.objx.url);
|
|
1054
|
+
}else{
|
|
1055
|
+
handler(res.objx.url)
|
|
1056
|
+
}
|
|
1053
1057
|
},
|
|
1054
1058
|
});
|
|
1055
1059
|
});
|