@lambo-design/workflow-approve 1.0.0-beta.95 → 1.0.0-beta.96

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@lambo-design/workflow-approve",
3
- "version": "1.0.0-beta.95",
3
+ "version": "1.0.0-beta.96",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "lambo",
@@ -13,7 +13,7 @@
13
13
  "axios": "^0.24.0",
14
14
  "axios-cache-plugin": "^0.1.0",
15
15
  "@lambo-design/core": "^4.7.1-beta.169",
16
- "@lambo-design/shared": "^1.0.0-beta.297"
16
+ "@lambo-design/shared": "^1.0.0-beta.298"
17
17
  },
18
18
  "dependencies": {
19
19
  "bpmn-js": "^7.3.1",
@@ -1,224 +1,224 @@
1
- <template>
2
- <div>
3
- <Row>
4
- <Row>
5
- <span v-for="(item, index) in attachmentdata" :key="index" style="font-size: 14px">
6
- <span v-if="index>0">、</span>
7
- <span style="color:#2D8cF0 "> {{ item.fileName }}</span>
8
- <a @click="forRemoveAttachment(index)" style="font-size: 13px;">.删除</a>
9
- </span>
10
- <div>
11
- <div slot="buttons">
12
- <Upload :action="actionUrl" :on-error="handleError" :before-upload="handleUpload" :show-upload-list="false"
13
- multiple
14
- :on-success="handleSuccess" :on-progress="handleProgress"
15
- :on-format-error="handleFormatError"
16
- :format="['xlsx', 'xls','txt','rar','zip','doc','docx','jpg','pdf','gif','png']">
17
- <Button :loading="loading" icon="ios-arrow-round-up" type="primary"
18
- style="color: #808080;border-color:#e0e0e0;" ghost>添加附件
19
- </Button>
20
- </Upload>
21
- </div>
22
- </div>
23
- </Row>
24
- <Row style="margin-top: 10px">
25
- <span style="color: red;font-size: 14px">* 支持扩展名: .rar .zip .doc .docx .pdf .jpg...</span>
26
- </Row>
27
- </Row>
28
- </div>
29
- </template>
30
-
31
- <script>
32
-
33
-
34
- export default {
35
- name: "attachment",
36
- components: {},
37
- props: {
38
- actionUrl: {
39
- default: "/api/oss-server/file/put",
40
- },
41
- attachmentdata: {
42
- type: Array,
43
- default: function () {
44
- return []
45
- }
46
- },
47
- attachmentColumn: {
48
- default: function () {
49
- let column = [
50
- {title: "序号", type: 'index', width: 80, align: "center"},
51
- {
52
- title: "相关附件", key: "fileName", minWidth: 200, align: 'left', tooltip: true,
53
- render: (h, {row}) => {
54
- return h("a", {
55
- on: {
56
- 'click': () => {
57
- let reg = /\.(gif|jpg|jpeg|bmp|png)$/
58
- let regs = /\.pdf$/
59
- if (reg.test(row.fileName)) {
60
- let imgs = [];
61
- let url = this.ossServerContext + "/file/get/" + row.fileId;
62
- this.imgPreview(url);
63
- } else if (regs.test(row.fileName)) {
64
- window.open(this.ossServerContext + "/file/getFileStream?fileId=" + row.fileId, "_blank");
65
- } else {
66
- window.open(this.ossServerContext + "/file/get/" + row.fileId, "_blank");
67
- }
68
- }
69
- }
70
- }, row.fileName);
71
- }
72
- },
73
- {
74
- title: "操作", width: 80, align: "center",
75
- render: (h, {index}) => {
76
- return h('div', [
77
- h('Button', {
78
- props: {
79
- type: 'warning',
80
- size: 'small',
81
- ghost: true
82
- },
83
- on: {
84
- click: () => {
85
- this.forRemoveAttachment(index)
86
- }
87
- }
88
- }, '删除')
89
- ]);
90
- }
91
- }
92
- ];
93
- return column
94
- }
95
- },
96
- },
97
- data() {
98
- return {
99
- loading: false,
100
- modalImg: false,
101
- image: "",
102
- tempFileArr: [],
103
- percentage: null,
104
- file_name: '',
105
- fileList: [],
106
- }
107
- },
108
- methods: {
109
- openAttachment(item) {
110
- let reg = /\.(gif|jpg|jpeg|bmp|png)$/;
111
- let regs = /\.pdf$/;
112
-
113
- if (reg.test(item.fileName)) {
114
- let imgs = [];
115
- let url = this.ossServerContext + "/file/get/" + item.fileId;
116
- this.imgPreview(url);
117
- } else if (regs.test(item.fileName)) {
118
- window.open(this.ossServerContext + "/file/getFileStream?fileId=" + item.fileId, "_blank");
119
- } else {
120
- window.open(this.ossServerContext + "/file/get/" + item.fileId, "_blank");
121
- }
122
- },
123
- handleSuccess: function (response, file, fileList) {
124
- let self = this;
125
- let tempArr = JSON.parse(JSON.stringify(this.tempFileArr))
126
-
127
- tempArr.forEach(function (value, index, array) {
128
- if (value == file.name) {
129
- self.tempFileArr.splice(index, 1)
130
- }
131
- });
132
-
133
- if (response.code == 1 && self.tempFileArr && self.tempFileArr.length < 1) {
134
- self.loading = false;
135
- self.$Message.success("上传成功");
136
- }
137
-
138
- if (response.code == 1) {
139
- if (response.data != undefined && response.data != null && response.data.length > 0) {
140
- let tempData = [].concat(response.data);
141
- this.attachmentdata.push({
142
- fileName: tempData[0].originalName,
143
- fileId: tempData[0].fileName,
144
- });
145
- }
146
-
147
- this.fileList = fileList
148
-
149
- } else {
150
- self.loading = false;
151
- this.$Message.error({
152
- content: file.name + '上传失败!',
153
- });
154
- //this.$Message.error("上传失败!");
155
-
156
- let j = 0;
157
- for (let i = 0; i < fileList.length; i++) {
158
- if (fileList[i].canceled) {
159
- continue;
160
- }
161
- if (fileList[i].name === file.name && fileList[i].timestamp === file.timestamp) {
162
- j = i;
163
- }
164
- }
165
-
166
- //console.log(fileList)
167
- fileList.splice(j, 1);
168
-
169
- }
170
-
171
- },
172
- handleError: function (error, file, fileList) {
173
- this.loading = false
174
- this.$Message.error({
175
- content: fileList.name + ' 上传失败!',
176
- });
177
- },
178
- handleUpload: function (file) {
179
- if (!file.canceled) {
180
- this.tempFileArr.push(file.name)
181
- }
182
- },
183
- forRemoveAttachment: function (index) {
184
- this.attachmentdata.splice(index, 1);
185
- this.$refs.attachmentTable.tableRefresh()
186
- },
187
- //查看附件
188
- imgPreview: function (img) {
189
- this.modalImg = true
190
- this.image = img;
191
- },
192
- //查看附件
193
- cancelUpload: function (item, fileList) {
194
- item.showProgress = false;
195
- item.canceled = true;
196
- },
197
- handleProgress(event, file, fileList) {
198
- this.loading = true
199
-
200
-
201
- },
202
- handleFormatError(file) {
203
- this.loading = false
204
- this.$Notice.warning({
205
- title: "文件格式不正确",
206
- desc: "文件 " + file.name + " 格式不支持,请上传其他格式的文件。",
207
- });
208
- },
209
-
210
- }
211
- }
212
- </script>
213
-
214
- <style scoped>
215
- .demo-spin-icon-load {
216
- animation: ani-demo-spin 1s linear infinite;
217
- }
218
-
219
- /deep/ .ivu-icon {
220
- zoom: 130%;
221
- color: #808080;
222
- margin-right: -1px;
223
- }
224
- </style>
1
+ <template>
2
+ <div>
3
+ <Row>
4
+ <Row>
5
+ <span v-for="(item, index) in attachmentdata" :key="index" style="font-size: 14px">
6
+ <span v-if="index>0">、</span>
7
+ <span style="color:#2D8cF0 "> {{ item.fileName }}</span>
8
+ <a @click="forRemoveAttachment(index)" style="font-size: 13px;">.删除</a>
9
+ </span>
10
+ <div>
11
+ <div slot="buttons">
12
+ <Upload :action="actionUrl" :on-error="handleError" :before-upload="handleUpload" :show-upload-list="false"
13
+ multiple
14
+ :on-success="handleSuccess" :on-progress="handleProgress"
15
+ :on-format-error="handleFormatError"
16
+ :format="['xlsx', 'xls','txt','rar','zip','doc','docx','jpg','pdf','gif','png']">
17
+ <Button :loading="loading" icon="ios-arrow-round-up" type="primary"
18
+ style="color: #808080;border-color:#e0e0e0;" ghost>添加附件
19
+ </Button>
20
+ </Upload>
21
+ </div>
22
+ </div>
23
+ </Row>
24
+ <Row style="margin-top: 10px">
25
+ <span style="color: red;font-size: 14px">* 支持扩展名: .rar .zip .doc .docx .pdf .jpg...</span>
26
+ </Row>
27
+ </Row>
28
+ </div>
29
+ </template>
30
+
31
+ <script>
32
+
33
+
34
+ export default {
35
+ name: "attachment",
36
+ components: {},
37
+ props: {
38
+ actionUrl: {
39
+ default: "/api/oss-server/file/put",
40
+ },
41
+ attachmentdata: {
42
+ type: Array,
43
+ default: function () {
44
+ return []
45
+ }
46
+ },
47
+ attachmentColumn: {
48
+ default: function () {
49
+ let column = [
50
+ {title: "序号", type: 'index', width: 80, align: "center"},
51
+ {
52
+ title: "相关附件", key: "fileName", minWidth: 200, align: 'left', tooltip: true,
53
+ render: (h, {row}) => {
54
+ return h("a", {
55
+ on: {
56
+ 'click': () => {
57
+ let reg = /\.(gif|jpg|jpeg|bmp|png)$/
58
+ let regs = /\.pdf$/
59
+ if (reg.test(row.fileName)) {
60
+ let imgs = [];
61
+ let url = this.ossServerContext + "/file/get/" + row.fileId;
62
+ this.imgPreview(url);
63
+ } else if (regs.test(row.fileName)) {
64
+ window.open(this.ossServerContext + "/file/getFileStream?fileId=" + row.fileId, "_blank");
65
+ } else {
66
+ window.open(this.ossServerContext + "/file/get/" + row.fileId, "_blank");
67
+ }
68
+ }
69
+ }
70
+ }, row.fileName);
71
+ }
72
+ },
73
+ {
74
+ title: "操作", width: 80, align: "center",
75
+ render: (h, {index}) => {
76
+ return h('div', [
77
+ h('Button', {
78
+ props: {
79
+ type: 'warning',
80
+ size: 'small',
81
+ ghost: true
82
+ },
83
+ on: {
84
+ click: () => {
85
+ this.forRemoveAttachment(index)
86
+ }
87
+ }
88
+ }, '删除')
89
+ ]);
90
+ }
91
+ }
92
+ ];
93
+ return column
94
+ }
95
+ },
96
+ },
97
+ data() {
98
+ return {
99
+ loading: false,
100
+ modalImg: false,
101
+ image: "",
102
+ tempFileArr: [],
103
+ percentage: null,
104
+ file_name: '',
105
+ fileList: [],
106
+ }
107
+ },
108
+ methods: {
109
+ openAttachment(item) {
110
+ let reg = /\.(gif|jpg|jpeg|bmp|png)$/;
111
+ let regs = /\.pdf$/;
112
+
113
+ if (reg.test(item.fileName)) {
114
+ let imgs = [];
115
+ let url = this.ossServerContext + "/file/get/" + item.fileId;
116
+ this.imgPreview(url);
117
+ } else if (regs.test(item.fileName)) {
118
+ window.open(this.ossServerContext + "/file/getFileStream?fileId=" + item.fileId, "_blank");
119
+ } else {
120
+ window.open(this.ossServerContext + "/file/get/" + item.fileId, "_blank");
121
+ }
122
+ },
123
+ handleSuccess: function (response, file, fileList) {
124
+ let self = this;
125
+ let tempArr = JSON.parse(JSON.stringify(this.tempFileArr))
126
+
127
+ tempArr.forEach(function (value, index, array) {
128
+ if (value == file.name) {
129
+ self.tempFileArr.splice(index, 1)
130
+ }
131
+ });
132
+
133
+ if (response.code == 1 && self.tempFileArr && self.tempFileArr.length < 1) {
134
+ self.loading = false;
135
+ self.$Message.success("上传成功");
136
+ }
137
+
138
+ if (response.code == 1) {
139
+ if (response.data != undefined && response.data != null && response.data.length > 0) {
140
+ let tempData = [].concat(response.data);
141
+ this.attachmentdata.push({
142
+ fileName: tempData[0].originalName,
143
+ fileId: tempData[0].fileName,
144
+ });
145
+ }
146
+
147
+ this.fileList = fileList
148
+
149
+ } else {
150
+ self.loading = false;
151
+ this.$Message.error({
152
+ content: file.name + '上传失败!',
153
+ });
154
+ //this.$Message.error("上传失败!");
155
+
156
+ let j = 0;
157
+ for (let i = 0; i < fileList.length; i++) {
158
+ if (fileList[i].canceled) {
159
+ continue;
160
+ }
161
+ if (fileList[i].name === file.name && fileList[i].timestamp === file.timestamp) {
162
+ j = i;
163
+ }
164
+ }
165
+
166
+ //console.log(fileList)
167
+ fileList.splice(j, 1);
168
+
169
+ }
170
+
171
+ },
172
+ handleError: function (error, file, fileList) {
173
+ this.loading = false
174
+ this.$Message.error({
175
+ content: fileList.name + ' 上传失败!',
176
+ });
177
+ },
178
+ handleUpload: function (file) {
179
+ if (!file.canceled) {
180
+ this.tempFileArr.push(file.name)
181
+ }
182
+ },
183
+ forRemoveAttachment: function (index) {
184
+ this.attachmentdata.splice(index, 1);
185
+ this.$refs.attachmentTable.tableRefresh()
186
+ },
187
+ //查看附件
188
+ imgPreview: function (img) {
189
+ this.modalImg = true
190
+ this.image = img;
191
+ },
192
+ //查看附件
193
+ cancelUpload: function (item, fileList) {
194
+ item.showProgress = false;
195
+ item.canceled = true;
196
+ },
197
+ handleProgress(event, file, fileList) {
198
+ this.loading = true
199
+
200
+
201
+ },
202
+ handleFormatError(file) {
203
+ this.loading = false
204
+ this.$Notice.warning({
205
+ title: "文件格式不正确",
206
+ desc: "文件 " + file.name + " 格式不支持,请上传其他格式的文件。",
207
+ });
208
+ },
209
+
210
+ }
211
+ }
212
+ </script>
213
+
214
+ <style scoped>
215
+ .demo-spin-icon-load {
216
+ animation: ani-demo-spin 1s linear infinite;
217
+ }
218
+
219
+ /deep/ .ivu-icon {
220
+ zoom: 130%;
221
+ color: #808080;
222
+ margin-right: -1px;
223
+ }
224
+ </style>