cloud-web-corejs 1.0.54-dev.426 → 1.0.54-dev.429

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloud-web-corejs",
3
3
  "private": false,
4
- "version": "1.0.54-dev.426",
4
+ "version": "1.0.54-dev.429",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -217,24 +217,43 @@ export default {
217
217
  // }, 0);
218
218
  // return img
219
219
  // },
220
- // images_upload_handler(blobInfo, success, failure, progress) {
221
- // progress(0);
222
- // const token = _this.$store.getters.token;
223
- // getToken(token).then(response => {
224
- // const url = response.data.qiniu_url;
225
- // const formData = new FormData();
226
- // formData.append('token', response.data.qiniu_token);
227
- // formData.append('key', response.data.qiniu_key);
228
- // formData.append('file', blobInfo.blob(), url);
229
- // upload(formData).then(() => {
230
- // success(url);
231
- // progress(100);
232
- // })
233
- // }).catch(err => {
234
- // failure('出现未知问题,刷新页面,或者联系程序员')
235
- // console.log(err);
236
- // });
237
- // },
220
+ images_upload_handler(blobInfo, success, failure, progress) {
221
+ progress(0);
222
+ _this.$baseUpload.upload({
223
+ file:blobInfo.blob(),
224
+ onProgress:(e)=>{
225
+ progress(e.percent)
226
+ },
227
+ callback:(res)=>{
228
+ if(res.type=="success"){
229
+ let url = res.objx.domain + res.objx.url;
230
+ success(url);
231
+ progress(100);
232
+ }else{
233
+ failure(res.content)
234
+ }
235
+ },
236
+ error:(e)=>{
237
+ failure(e.message)
238
+ }
239
+ })
240
+ /* progress(0);
241
+ const token = _this.$store.getters.token;
242
+ getToken(token).then(response => {
243
+ const url = response.data.qiniu_url;
244
+ const formData = new FormData();
245
+ formData.append('token', response.data.qiniu_token);
246
+ formData.append('key', response.data.qiniu_key);
247
+ formData.append('file', blobInfo.blob(), url);
248
+ upload(formData).then(() => {
249
+ success(url);
250
+ progress(100);
251
+ })
252
+ }).catch(err => {
253
+ failure('出现未知问题,刷新页面,或者联系程序员')
254
+ console.log(err);
255
+ }); */
256
+ },
238
257
  });
239
258
  },
240
259
  destroyTinymce() {
@@ -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
- this.handleCustomEvent(this.field.options.copyDataHandle, ["copyData"], [copyData])
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
- 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
- }
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
- downloadButton: "",
3451
+ downloadButtonFlag: 1,
3452
+ dataTableName: null,
3453
+ attachmentType: null,
3454
+ fileName: null,
3452
3455
 
3453
3456
  onCreated: "",
3454
3457
  onMounted: "",