cloud-web-corejs 1.0.54-dev.425 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloud-web-corejs",
3
3
  "private": false,
4
- "version": "1.0.54-dev.425",
4
+ "version": "1.0.54-dev.427",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -0,0 +1,133 @@
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
+
88
+ this.downloadHandle();
89
+ },
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
+
103
+
104
+ let reportTemplate = this.getFormRef().reportTemplate;
105
+ let formCode = reportTemplate.formCode;
106
+ let formScriptEnabled = this.field.options.formScriptEnabled || false;
107
+ let scriptCode = this.field.options.formScriptCode;
108
+ if (!scriptCode) return;
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
+ });
126
+ },
127
+ },
128
+ };
129
+ </script>
130
+
131
+ <style lang="scss" scoped>
132
+ @import "~@/styles/global.scss"; //* static-content-wrapper已引入,还需要重复引入吗? *//
133
+ </style>
@@ -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 = {
@@ -3423,6 +3423,44 @@ 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
+ downloadButtonFlag: 1,
3452
+ dataTableName: null,
3453
+ attachmentType: null,
3454
+ fileName: null,
3455
+
3456
+ onCreated: "",
3457
+ onMounted: "",
3458
+ ...defaultWfConfig,
3459
+ showRuleFlag: 1,
3460
+ showRuleEnabled: 1,
3461
+ showRules: [],
3462
+ },
3463
+ },
3426
3464
  ];
3427
3465
 
3428
3466
  export const businessFields = [