cloud-web-corejs 1.0.54-dev.426 → 1.0.54-dev.427
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 +30 -40
- package/src/components/xform/form-designer/setting-panel/property-editor/downloadButtonFlag-editor.vue +32 -0
- package/src/components/xform/form-designer/setting-panel/propertyRegister.js +1 -0
- package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +4 -1
- package/src/components/xform/form-render/container-item/data-table-mixin.js +1 -2874
- package/src/utils/vab.js +6 -6
package/package.json
CHANGED
package/src/components/xform/form-designer/form-widget/field-widget/download-button-widget.vue
CHANGED
|
@@ -84,56 +84,46 @@ export default {
|
|
|
84
84
|
methods: {
|
|
85
85
|
clickHandle() {
|
|
86
86
|
if (this.designState || this.field.options.disabled) return;
|
|
87
|
-
/* let copyData = this.$baseLodash.cloneDeep(this.formModel);
|
|
88
87
|
|
|
89
|
-
|
|
90
|
-
this.getFormRef().openCopyEditTab(copyData); */
|
|
88
|
+
this.downloadHandle();
|
|
91
89
|
},
|
|
92
90
|
downloadHandle() {
|
|
91
|
+
let dataTableName = this.field.options.dataTableName
|
|
92
|
+
if(!dataTableName)return
|
|
93
|
+
let attachmentType = this.field.options.attachmentType
|
|
94
|
+
if(!attachmentType)return;
|
|
95
|
+
let $grid = this.getWidgetRef(dataTableName).getGridTable();
|
|
96
|
+
let checkRows = $grid.getCheckboxRecords(true);
|
|
97
|
+
if(!checkRows.length){
|
|
98
|
+
this.$message.error(this.$t1("请勾选需要下载的数据"))
|
|
99
|
+
return
|
|
100
|
+
}
|
|
101
|
+
let ids = checkRows.map(item=>item.id);
|
|
102
|
+
|
|
93
103
|
|
|
94
|
-
},
|
|
95
|
-
loadDataDefaultHandle() {
|
|
96
104
|
let reportTemplate = this.getFormRef().reportTemplate;
|
|
97
105
|
let formCode = reportTemplate.formCode;
|
|
98
106
|
let formScriptEnabled = this.field.options.formScriptEnabled || false;
|
|
99
107
|
let scriptCode = this.field.options.formScriptCode;
|
|
100
108
|
if (!scriptCode) return;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
this.$downloadByFileWhole(data, (url)=>{
|
|
119
|
-
this.openInNewTab(url)
|
|
120
|
-
})
|
|
121
|
-
}else{
|
|
122
|
-
this.$message.error(this.$t1("下载文件失败"))
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
});
|
|
126
|
-
}
|
|
109
|
+
let accessParam = this.handleCustomEvent(this.field.options.formScriptParam);
|
|
110
|
+
return this.formHttp({
|
|
111
|
+
scriptCode: scriptCode,
|
|
112
|
+
data: {
|
|
113
|
+
ids,
|
|
114
|
+
attachmentType,
|
|
115
|
+
...accessParam,
|
|
116
|
+
},
|
|
117
|
+
success: (res) => {
|
|
118
|
+
let data = res.objx;
|
|
119
|
+
if (data) {
|
|
120
|
+
this.$downloadByFileWhole(data, this.field.options.fileName);
|
|
121
|
+
} else {
|
|
122
|
+
this.$message.error(this.$t1("下载文件失败"));
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
});
|
|
127
126
|
},
|
|
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
127
|
},
|
|
138
128
|
};
|
|
139
129
|
</script>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<el-form-item label-width="0">
|
|
4
|
+
<el-divider class="custom-divider-margin-top">下载设置</el-divider>
|
|
5
|
+
</el-form-item>
|
|
6
|
+
<el-form-item label="表格唯一名称">
|
|
7
|
+
<el-input v-model="optionModel.dataTableName" clearable></el-input>
|
|
8
|
+
</el-form-item>
|
|
9
|
+
<el-form-item label="类型">
|
|
10
|
+
<el-input v-model="optionModel.attachmentType" clearable></el-input>
|
|
11
|
+
</el-form-item>
|
|
12
|
+
<el-form-item label="文件名">
|
|
13
|
+
<el-input v-model="optionModel.fileName" clearable></el-input>
|
|
14
|
+
</el-form-item>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script>
|
|
19
|
+
import i18n from "../../../../../components/xform/utils/i18n";
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
name: "downloadButtonFlag-editor",
|
|
23
|
+
mixins: [i18n],
|
|
24
|
+
props: {
|
|
25
|
+
designer: Object,
|
|
26
|
+
selectedWidget: Object,
|
|
27
|
+
optionModel: Object,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<style scoped></style>
|
|
@@ -166,6 +166,7 @@ const COMMON_PROPERTIES = {
|
|
|
166
166
|
"autoValueEnabled": "autoValueEnabled-editor",
|
|
167
167
|
// "commonAttributeEnabled": "commonAttributeEnabled-editor"
|
|
168
168
|
"colorClass": "colorClass-editor",
|
|
169
|
+
"downloadButtonFlag": "downloadButtonFlag-editor"
|
|
169
170
|
}
|
|
170
171
|
|
|
171
172
|
const ADVANCED_PROPERTIES = {
|
|
@@ -3448,7 +3448,10 @@ export const advancedFields = [
|
|
|
3448
3448
|
customClass: "",
|
|
3449
3449
|
...httpConfig,
|
|
3450
3450
|
|
|
3451
|
-
|
|
3451
|
+
downloadButtonFlag: 1,
|
|
3452
|
+
dataTableName: null,
|
|
3453
|
+
attachmentType: null,
|
|
3454
|
+
fileName: null,
|
|
3452
3455
|
|
|
3453
3456
|
onCreated: "",
|
|
3454
3457
|
onMounted: "",
|