eoss-mobiles 0.3.95 → 0.3.97
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/CHANGELOG.md +95 -0
- package/lib/action-sheet.js +4 -4
- package/lib/button-group.js +4 -4
- package/lib/button.js +4 -4
- package/lib/calendar.js +4 -4
- package/lib/cascader.js +4 -4
- package/lib/cell.js +4 -4
- package/lib/checkbox.js +200 -173
- package/lib/circle.js +4 -4
- package/lib/config/api.js +16 -2
- package/lib/count-down.js +4 -4
- package/lib/date.js +108 -108
- package/lib/empty.js +4 -4
- package/lib/eoss-mobile.common.js +651 -83
- package/lib/esign.js +4 -4
- package/lib/field.js +4 -4
- package/lib/flow-btn.js +194 -167
- package/lib/flow-list.js +196 -167
- package/lib/flow.js +241 -212
- package/lib/form.js +93 -6
- package/lib/grid-item.js +4 -4
- package/lib/grid.js +12 -12
- package/lib/image-preview.js +15 -7
- package/lib/image.js +4 -4
- package/lib/index.js +1 -1
- package/lib/list.js +4 -4
- package/lib/loading.js +86 -86
- package/lib/nav-bar.js +4 -4
- package/lib/notice-bar.js +4 -4
- package/lib/pagination.js +4 -4
- package/lib/picker.js +200 -171
- package/lib/popover.js +4 -4
- package/lib/popup.js +4 -4
- package/lib/pull-refresh.js +4 -4
- package/lib/radio.js +199 -170
- package/lib/rate.js +4 -4
- package/lib/retrial-auth.js +194 -167
- package/lib/search.js +4 -4
- package/lib/selector.js +240 -211
- package/lib/skeleton.js +4 -4
- package/lib/stepper.js +4 -4
- package/lib/swipe.js +4 -4
- package/lib/switch.js +4 -4
- package/lib/tab.js +4 -4
- package/lib/table-column.js +194 -165
- package/lib/table.js +16 -16
- package/lib/tabs.js +4 -4
- package/lib/tag.js +4 -4
- package/lib/theme-chalk/fonts/iconfont.scss +98 -98
- package/lib/theme-chalk/fonts/iconfont1.scss +90 -90
- package/lib/uploader.js +2472 -13
- package/package.json +3 -1
- package/packages/action-sheet/index.js +5 -5
- package/packages/action-sheet/src/main.vue +32 -32
- package/packages/button/index.js +5 -5
- package/packages/button/src/main.vue +15 -15
- package/packages/button-group/index.js +5 -5
- package/packages/button-group/src/main.vue +80 -80
- package/packages/calendar/index.js +5 -5
- package/packages/calendar/src/main.vue +34 -34
- package/packages/cascader/index.js +5 -5
- package/packages/cascader/src/main.vue +39 -39
- package/packages/cell/index.js +5 -5
- package/packages/cell/src/main.vue +77 -77
- package/packages/checkbox/index.js +5 -5
- package/packages/checkbox/src/main.vue +232 -232
- package/packages/circle/index.js +5 -5
- package/packages/circle/src/main.vue +27 -27
- package/packages/count-down/index.js +5 -5
- package/packages/count-down/src/main.vue +27 -27
- package/packages/date/index.js +5 -5
- package/packages/date/src/date-time.vue +290 -290
- package/packages/date/src/main.vue +401 -401
- package/packages/empty/index.js +5 -5
- package/packages/empty/src/main.vue +16 -16
- package/packages/esign/index.js +5 -5
- package/packages/esign/src/main.vue +144 -144
- package/packages/field/index.js +5 -5
- package/packages/field/src/main.vue +235 -235
- package/packages/flow/index.js +5 -5
- package/packages/flow/src/components/Circulate.vue +595 -595
- package/packages/flow/src/components/Handle.vue +2404 -2404
- package/packages/flow/src/components/Message.vue +208 -208
- package/packages/flow/src/components/ProcessSettings.vue +342 -342
- package/packages/flow/src/components/supervise.vue +139 -139
- package/packages/flow/src/flowMix.js +288 -288
- package/packages/flow/src/main.vue +116 -116
- package/packages/flow-btn/index.js +5 -5
- package/packages/flow-btn/src/main.vue +494 -494
- package/packages/flow-list/index.js +5 -5
- package/packages/flow-list/src/main.vue +248 -248
- package/packages/form/index.js +5 -5
- package/packages/form/src/main.vue +548 -523
- package/packages/grid/index.js +5 -5
- package/packages/grid/src/main.vue +486 -486
- package/packages/grid-item/index.js +5 -5
- package/packages/grid-item/src/main.vue +16 -16
- package/packages/image/index.js +5 -5
- package/packages/image/src/main.vue +12 -12
- package/packages/image-preview/index.js +5 -5
- package/packages/image-preview/src/main.vue +41 -34
- package/packages/list/index.js +5 -5
- package/packages/list/src/main.vue +32 -32
- package/packages/loading/index.js +5 -5
- package/packages/loading/src/main.vue +19 -19
- package/packages/nav-bar/index.js +5 -5
- package/packages/nav-bar/src/main.vue +24 -24
- package/packages/notice-bar/index.js +5 -5
- package/packages/notice-bar/src/main.vue +15 -15
- package/packages/pagination/index.js +5 -5
- package/packages/pagination/src/main.vue +73 -73
- package/packages/picker/index.js +5 -5
- package/packages/picker/src/main.vue +604 -604
- package/packages/popover/index.js +5 -5
- package/packages/popover/src/main.vue +32 -32
- package/packages/popup/index.js +5 -5
- package/packages/popup/src/main.vue +27 -27
- package/packages/pull-refresh/index.js +5 -5
- package/packages/pull-refresh/src/main.vue +31 -31
- package/packages/radio/index.js +5 -5
- package/packages/radio/src/main.vue +179 -179
- package/packages/rate/index.js +5 -5
- package/packages/rate/src/main.vue +26 -26
- package/packages/retrial-auth/index.js +5 -5
- package/packages/retrial-auth/src/main.vue +257 -257
- package/packages/search/index.js +5 -5
- package/packages/search/src/main.vue +39 -39
- package/packages/selector/index.js +5 -5
- package/packages/selector/src/main.vue +186 -186
- package/packages/selector/src/selector-tree.vue +1117 -1117
- package/packages/selector/src/tree.vue +405 -405
- package/packages/skeleton/index.js +5 -5
- package/packages/skeleton/src/main.vue +17 -17
- package/packages/stepper/index.js +5 -5
- package/packages/stepper/src/main.vue +25 -25
- package/packages/swipe/index.js +5 -5
- package/packages/swipe/src/main.vue +42 -42
- package/packages/switch/index.js +5 -5
- package/packages/switch/src/main.vue +38 -38
- package/packages/tab/index.js +5 -5
- package/packages/tab/src/main.vue +16 -16
- package/packages/table/index.js +5 -5
- package/packages/table/src/main.vue +1006 -1006
- package/packages/table-column/index.js +5 -5
- package/packages/table-column/src/main.vue +931 -931
- package/packages/table-column/src/mixins/table.js +12 -12
- package/packages/tabs/index.js +5 -5
- package/packages/tabs/src/main.vue +34 -34
- package/packages/tag/index.js +5 -5
- package/packages/tag/src/main.vue +16 -16
- package/packages/theme-chalk/lib/action-sheet.css +0 -0
- package/packages/theme-chalk/lib/base.css +1 -0
- package/packages/theme-chalk/lib/button-group.css +1 -0
- package/packages/theme-chalk/lib/button.css +1 -0
- package/packages/theme-chalk/lib/calendar.css +1 -0
- package/packages/theme-chalk/lib/cascader.css +1 -0
- package/packages/theme-chalk/lib/cell.css +1 -0
- package/packages/theme-chalk/lib/checkbox.css +1 -0
- package/packages/theme-chalk/lib/circle.css +1 -0
- package/packages/theme-chalk/lib/count-down.css +0 -0
- package/packages/theme-chalk/lib/date.css +0 -0
- package/packages/theme-chalk/lib/empty.css +0 -0
- package/packages/theme-chalk/lib/esign.css +1 -0
- package/packages/theme-chalk/lib/field.css +1 -0
- package/packages/theme-chalk/lib/flow-btn.css +1 -0
- package/packages/theme-chalk/lib/flow-list-task-read.css +1 -0
- package/packages/theme-chalk/lib/flow-list.css +1 -0
- package/packages/theme-chalk/lib/flow.css +1 -0
- package/packages/theme-chalk/lib/fonts/iconfont.scss +98 -0
- package/packages/theme-chalk/lib/fonts/iconfont.ttf +0 -0
- package/packages/theme-chalk/lib/fonts/iconfont.woff +0 -0
- package/packages/theme-chalk/lib/fonts/iconfont1.scss +90 -0
- package/packages/theme-chalk/lib/form.css +1 -0
- package/packages/theme-chalk/lib/grid-item.css +1 -0
- package/packages/theme-chalk/lib/grid.css +1 -0
- package/packages/theme-chalk/lib/icon.css +1 -0
- package/packages/theme-chalk/lib/image-preview.css +0 -0
- package/packages/theme-chalk/lib/image.css +0 -0
- package/packages/theme-chalk/lib/index.css +1 -0
- package/packages/theme-chalk/lib/list.css +0 -0
- package/packages/theme-chalk/lib/loading.css +0 -0
- package/packages/theme-chalk/lib/nav-bar.css +0 -0
- package/packages/theme-chalk/lib/navbar.css +1 -0
- package/packages/theme-chalk/lib/notice-bar.css +0 -0
- package/packages/theme-chalk/lib/pagination.css +1 -0
- package/packages/theme-chalk/lib/picker.css +1 -0
- package/packages/theme-chalk/lib/popover.css +0 -0
- package/packages/theme-chalk/lib/popup.css +0 -0
- package/packages/theme-chalk/lib/pull-refresh.css +0 -0
- package/packages/theme-chalk/lib/radio.css +1 -0
- package/packages/theme-chalk/lib/rate.css +0 -0
- package/packages/theme-chalk/lib/retrial-auth.css +1 -0
- package/packages/theme-chalk/lib/search.css +0 -0
- package/packages/theme-chalk/lib/selector.css +1 -0
- package/packages/theme-chalk/lib/skeleton.css +0 -0
- package/packages/theme-chalk/lib/stepper.css +1 -0
- package/packages/theme-chalk/lib/swipe.css +0 -0
- package/packages/theme-chalk/lib/switch.css +1 -0
- package/packages/theme-chalk/lib/tab.css +0 -0
- package/packages/theme-chalk/lib/table-column.css +0 -0
- package/packages/theme-chalk/lib/table.css +1 -0
- package/packages/theme-chalk/lib/tabs.css +1 -0
- package/packages/theme-chalk/lib/tag.css +1 -0
- package/packages/theme-chalk/lib/theme.css +0 -0
- package/packages/theme-chalk/lib/tree.css +1 -0
- package/packages/theme-chalk/lib/uploader.css +0 -0
- package/packages/theme-chalk/src/base.scss +195 -195
- package/packages/theme-chalk/src/button-group.scss +25 -25
- package/packages/theme-chalk/src/button.scss +2 -2
- package/packages/theme-chalk/src/calendar.scss +11 -11
- package/packages/theme-chalk/src/cascader.scss +11 -11
- package/packages/theme-chalk/src/cell.scss +14 -14
- package/packages/theme-chalk/src/checkbox.scss +9 -9
- package/packages/theme-chalk/src/circle.scss +6 -6
- package/packages/theme-chalk/src/common/var.scss +1525 -1525
- package/packages/theme-chalk/src/esign.scss +51 -51
- package/packages/theme-chalk/src/field.scss +98 -98
- package/packages/theme-chalk/src/flow-btn.scss +99 -99
- package/packages/theme-chalk/src/flow-list.scss +122 -122
- package/packages/theme-chalk/src/fonts/iconfont.scss +98 -98
- package/packages/theme-chalk/src/fonts/iconfont1.scss +90 -90
- package/packages/theme-chalk/src/form.scss +33 -33
- package/packages/theme-chalk/src/grid-item.scss +16 -16
- package/packages/theme-chalk/src/grid.scss +46 -46
- package/packages/theme-chalk/src/icon.scss +1661 -1661
- package/packages/theme-chalk/src/mixins/color.scss +117 -117
- package/packages/theme-chalk/src/navbar.scss +5 -5
- package/packages/theme-chalk/src/pagination.scss +12 -12
- package/packages/theme-chalk/src/picker.scss +31 -31
- package/packages/theme-chalk/src/radio.scss +6 -6
- package/packages/theme-chalk/src/retrial-auth.scss +28 -28
- package/packages/theme-chalk/src/selector.scss +247 -247
- package/packages/theme-chalk/src/stepper.scss +9 -9
- package/packages/theme-chalk/src/switch.scss +5 -5
- package/packages/theme-chalk/src/table.scss +86 -86
- package/packages/theme-chalk/src/tabs.scss +31 -31
- package/packages/theme-chalk/src/tag.scss +12 -12
- package/packages/theme-chalk/src/theme.scss +1 -1
- package/packages/theme-chalk/src/tree.scss +127 -127
- package/packages/uploader/index.js +5 -5
- package/packages/uploader/src/main.vue +586 -31
- package/src/config/api.js +18 -0
- package/src/index.js +1 -1
- package/src/utils/axios.js +217 -217
- package/src/utils/date-util.js +312 -312
- package/src/utils/http.js +106 -106
- package/src/utils/rules.js +18 -18
- package/src/utils/store.js +21 -21
- package/packages/theme-chalk/gulpfile.js +0 -25
|
@@ -1,31 +1,586 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<van-uploader
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<van-uploader
|
|
3
|
+
v-model="fileList"
|
|
4
|
+
v-bind="$attrs"
|
|
5
|
+
v-on="$listeners"
|
|
6
|
+
:after-read="afterRead"
|
|
7
|
+
:accept="fileAccept"
|
|
8
|
+
:max-size="fileSize"
|
|
9
|
+
multiple
|
|
10
|
+
@oversize="onOversize"
|
|
11
|
+
@click-preview="handlePreview"
|
|
12
|
+
@delete="handleBeforeRemove"
|
|
13
|
+
>
|
|
14
|
+
<template v-for="(index, name) in $slots" :slot="name">
|
|
15
|
+
<slot :name="name" />
|
|
16
|
+
</template>
|
|
17
|
+
</van-uploader>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
import util from 'eoss-mobile/src/utils/util.js';
|
|
22
|
+
import request from 'eoss-mobile/src/utils/http';
|
|
23
|
+
import {
|
|
24
|
+
uploads,
|
|
25
|
+
getAdjunctProperties,
|
|
26
|
+
getAdjunctFileInfos,
|
|
27
|
+
previewAdjunct,
|
|
28
|
+
previewAdjunctOffice,
|
|
29
|
+
previewAdjunct2,
|
|
30
|
+
delAdjunct
|
|
31
|
+
} from 'eoss-mobile/src/config/api.js';
|
|
32
|
+
import axios from 'axios';
|
|
33
|
+
import { ImagePreview } from 'vant';
|
|
34
|
+
import { debounce } from 'throttle-debounce';
|
|
35
|
+
export default {
|
|
36
|
+
name: 'EmUploader',
|
|
37
|
+
props: {
|
|
38
|
+
ownId: {
|
|
39
|
+
required: true,
|
|
40
|
+
type: String,
|
|
41
|
+
default: ''
|
|
42
|
+
},
|
|
43
|
+
code: {
|
|
44
|
+
required: true,
|
|
45
|
+
type: String,
|
|
46
|
+
default: ''
|
|
47
|
+
},
|
|
48
|
+
param: {
|
|
49
|
+
type: Object,
|
|
50
|
+
default() {
|
|
51
|
+
return {};
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
value: {
|
|
55
|
+
type: Array,
|
|
56
|
+
default: () => []
|
|
57
|
+
},
|
|
58
|
+
properties: {
|
|
59
|
+
type: String,
|
|
60
|
+
default() {
|
|
61
|
+
return getAdjunctProperties;
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
host: {
|
|
65
|
+
type: String,
|
|
66
|
+
default() {
|
|
67
|
+
return util.getStorage('host') ? util.getStorage('host') : '';
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
data() {
|
|
72
|
+
return {
|
|
73
|
+
showPreview: false,
|
|
74
|
+
images: [],
|
|
75
|
+
uploadUrl: '',
|
|
76
|
+
kkfileview: null,
|
|
77
|
+
fileAccept: '',
|
|
78
|
+
fileSize: 0,
|
|
79
|
+
filesTotalSize: 0,
|
|
80
|
+
dochubConfig: {},
|
|
81
|
+
fileList: [],
|
|
82
|
+
dochubConfig: {}
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
beforeCreate() {
|
|
86
|
+
this.getFiles = debounce(500, () => {
|
|
87
|
+
this.getFileLists();
|
|
88
|
+
});
|
|
89
|
+
this.getAdjunctPropertie = debounce(500, () => {
|
|
90
|
+
this.getAdjunctProperties();
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
created() {
|
|
94
|
+
const dochubConfig = sessionStorage.getItem('dochubConfig');
|
|
95
|
+
if (dochubConfig) {
|
|
96
|
+
this.dochubConfig = JSON.parse(dochubConfig);
|
|
97
|
+
}
|
|
98
|
+
this.getAdjunctPropertie();
|
|
99
|
+
},
|
|
100
|
+
computed: {
|
|
101
|
+
newValue: {
|
|
102
|
+
get() {
|
|
103
|
+
return this.fileList;
|
|
104
|
+
},
|
|
105
|
+
set(val) {
|
|
106
|
+
return val;
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
params() {
|
|
110
|
+
let params = { userId: util.getStorage('userId'), ...this.param };
|
|
111
|
+
if (this.code !== undefined) {
|
|
112
|
+
params.code = this.code;
|
|
113
|
+
params.bucketCode = this.code;
|
|
114
|
+
}
|
|
115
|
+
if (this.ownId !== undefined) {
|
|
116
|
+
params.ownId = this.ownId;
|
|
117
|
+
params.businessId = this.ownId;
|
|
118
|
+
}
|
|
119
|
+
return params;
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
methods: {
|
|
123
|
+
afterRead(file) {
|
|
124
|
+
file.status = 'uploading';
|
|
125
|
+
file.message = '上传中...';
|
|
126
|
+
this.handleFileUpload(file);
|
|
127
|
+
// this.fileList.push(file);
|
|
128
|
+
},
|
|
129
|
+
onOversize() {
|
|
130
|
+
this.$toast('文件大小超过限制');
|
|
131
|
+
},
|
|
132
|
+
//根据code获取附件参数配置
|
|
133
|
+
getAdjunctProperties() {
|
|
134
|
+
console.log('getAdjunctProperties');
|
|
135
|
+
if (this.code !== undefined) {
|
|
136
|
+
request({
|
|
137
|
+
method: 'get',
|
|
138
|
+
url: this.properties,
|
|
139
|
+
data: { code: this.code, ...this.param },
|
|
140
|
+
params: { code: this.code, ...this.param }
|
|
141
|
+
})
|
|
142
|
+
.then((res) => {
|
|
143
|
+
if (res.rCode === 0) {
|
|
144
|
+
if (res.results) {
|
|
145
|
+
this.excludeNames = res.results.excludeName;
|
|
146
|
+
if (res.results.fileTypeExtName) {
|
|
147
|
+
let fileTypeExtName = res.results.fileTypeExtName.split(';');
|
|
148
|
+
this.fileAccept = fileTypeExtName
|
|
149
|
+
.filter((item) => {
|
|
150
|
+
return item;
|
|
151
|
+
})
|
|
152
|
+
.join(',');
|
|
153
|
+
}
|
|
154
|
+
if (res.results.dochubConfig) {
|
|
155
|
+
this.dochubConfig = res.results.dochubConfig;
|
|
156
|
+
sessionStorage.setItem(
|
|
157
|
+
'dochubConfig',
|
|
158
|
+
JSON.stringify(res.results.dochubConfig)
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
let url = this.dochubConfig.uploadDocumentUrl || uploads;
|
|
162
|
+
this.uploadUrl =
|
|
163
|
+
url.indexOf(this.host) > -1 ? url : this.host + url;
|
|
164
|
+
if (res.results.kkViewRootPath) {
|
|
165
|
+
this.kkfileview = res.results.kkViewRootPath;
|
|
166
|
+
}
|
|
167
|
+
this.fileSize = res.results.limitFileSize
|
|
168
|
+
? res.results.limitFileSize * 1024
|
|
169
|
+
: 0;
|
|
170
|
+
// this.fileTotalSize = res.results.limitTotalSize;
|
|
171
|
+
}
|
|
172
|
+
this.getFiles();
|
|
173
|
+
}
|
|
174
|
+
})
|
|
175
|
+
.catch((err) => {
|
|
176
|
+
if (err.message && err.message !== 'canceled') {
|
|
177
|
+
this.$message.error(err.message);
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
getFileLists() {
|
|
183
|
+
// if (
|
|
184
|
+
// !this.show ||
|
|
185
|
+
// (this.fileList &&
|
|
186
|
+
// Array.isArray(this.fileList) &&
|
|
187
|
+
// this.fileList.length) ||
|
|
188
|
+
// (this.requiredOwnId &&
|
|
189
|
+
// !Object.prototype.hasOwnProperty.call(this.params, 'ownId'))
|
|
190
|
+
// ) {
|
|
191
|
+
// return false;
|
|
192
|
+
// }
|
|
193
|
+
let url =
|
|
194
|
+
typeof this.fileList === 'string'
|
|
195
|
+
? this.fileList
|
|
196
|
+
: this.dochubConfig.getDocumentList
|
|
197
|
+
? this.dochubConfig.getDocumentList
|
|
198
|
+
: getAdjunctFileInfos;
|
|
199
|
+
request({
|
|
200
|
+
method: 'get',
|
|
201
|
+
url: url,
|
|
202
|
+
data: this.params,
|
|
203
|
+
params: this.params,
|
|
204
|
+
format: false
|
|
205
|
+
})
|
|
206
|
+
.then((res) => {
|
|
207
|
+
console.log('getFileLists');
|
|
208
|
+
if (res.rCode === 0) {
|
|
209
|
+
let lists = JSON.parse(JSON.stringify(res.results));
|
|
210
|
+
let filesTotalSize = 0;
|
|
211
|
+
lists.forEach((item) => {
|
|
212
|
+
if (
|
|
213
|
+
Object.prototype.hasOwnProperty.call(item, 'fileSize') &&
|
|
214
|
+
item.fileSize
|
|
215
|
+
) {
|
|
216
|
+
filesTotalSize += parseFloat(item.fileSize, 10);
|
|
217
|
+
} else {
|
|
218
|
+
filesTotalSize += item.size
|
|
219
|
+
? Math.round((item.size / 1024) * 10) / 10
|
|
220
|
+
: 0;
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
this.filesTotalSize = filesTotalSize;
|
|
224
|
+
if (lists.length) {
|
|
225
|
+
this.fileList = lists.map((item) => {
|
|
226
|
+
return { file: new File([], item.originalName), ...item };
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
} else {
|
|
230
|
+
let msg = res.msg || '系统错误,请联系管理员!';
|
|
231
|
+
this.$message.error(msg);
|
|
232
|
+
}
|
|
233
|
+
})
|
|
234
|
+
.catch((err) => {
|
|
235
|
+
if (err.message && err.message !== 'canceled') {
|
|
236
|
+
this.$message.error(err.message);
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
},
|
|
240
|
+
openKkfileview(file) {
|
|
241
|
+
let host = util.win.location.origin;
|
|
242
|
+
if (this.host) {
|
|
243
|
+
if (util.startWith(this.host, 'http')) {
|
|
244
|
+
host = this.host;
|
|
245
|
+
} else {
|
|
246
|
+
host += this.host;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
let url = encodeURIComponent(
|
|
250
|
+
Base64.encode(
|
|
251
|
+
host +
|
|
252
|
+
(typeof this.download === 'string'
|
|
253
|
+
? this.download
|
|
254
|
+
: downloadByAdjunctId) +
|
|
255
|
+
`?adjunctId=${
|
|
256
|
+
file.adjunctId || file.response.adjunctId
|
|
257
|
+
}&fullfilename=${file.originalName}`
|
|
258
|
+
)
|
|
259
|
+
);
|
|
260
|
+
location.href = `${this.kkfileview}?url=${url}`;
|
|
261
|
+
},
|
|
262
|
+
handlePreview(res) {
|
|
263
|
+
console.log('res', res);
|
|
264
|
+
if (this.onPreview) {
|
|
265
|
+
this.onPreview(res);
|
|
266
|
+
} else {
|
|
267
|
+
let file = res.response ? res.response : res;
|
|
268
|
+
let url =
|
|
269
|
+
typeof this.preview === 'string'
|
|
270
|
+
? this.preview
|
|
271
|
+
: typeof this.preview === 'function'
|
|
272
|
+
? this.preview(file)
|
|
273
|
+
: null;
|
|
274
|
+
if (res.status === 'success' || res.status == 0) {
|
|
275
|
+
let suffix = file.suffix;
|
|
276
|
+
suffix = suffix.toLowerCase();
|
|
277
|
+
if (this.dochubConfig.previewDocumentUrl) {
|
|
278
|
+
if (
|
|
279
|
+
suffix.includes('jpeg') ||
|
|
280
|
+
suffix.includes('jpg') ||
|
|
281
|
+
suffix.includes('gif') ||
|
|
282
|
+
suffix.includes('png')
|
|
283
|
+
) {
|
|
284
|
+
this.imgUrl =
|
|
285
|
+
res.url && util.startWith(url, ['http', '/', true])
|
|
286
|
+
? res.url
|
|
287
|
+
: this.host +
|
|
288
|
+
(url
|
|
289
|
+
? url
|
|
290
|
+
: `${this.dochubConfig.downloadDocumentUrl}?documentId=${file.adjunctId}`);
|
|
291
|
+
this.title = file.originalName;
|
|
292
|
+
this.showImg = true;
|
|
293
|
+
this.$nextTick(() => {
|
|
294
|
+
this.loadImage();
|
|
295
|
+
});
|
|
296
|
+
} else if (suffix.includes('mp4')) {
|
|
297
|
+
this.source = {
|
|
298
|
+
src:
|
|
299
|
+
this.host +
|
|
300
|
+
(url
|
|
301
|
+
? url
|
|
302
|
+
: `${this.dochubConfig.downloadDocumentUrl}?documentId=${file.adjunctId}`)
|
|
303
|
+
};
|
|
304
|
+
this.title = file.originalName;
|
|
305
|
+
this.showVideo = true;
|
|
306
|
+
} else {
|
|
307
|
+
location.href =
|
|
308
|
+
this.host +
|
|
309
|
+
(url
|
|
310
|
+
? url
|
|
311
|
+
: `${this.dochubConfig.previewDocumentUrl}?documentId=${file.adjunctId}&action=附件预览`);
|
|
312
|
+
}
|
|
313
|
+
} else {
|
|
314
|
+
if (
|
|
315
|
+
suffix.includes('doc') ||
|
|
316
|
+
suffix.includes('docx') ||
|
|
317
|
+
suffix.includes('xls') ||
|
|
318
|
+
suffix.includes('xlsx') ||
|
|
319
|
+
suffix.includes('ppt')
|
|
320
|
+
) {
|
|
321
|
+
if (this.kkfileview) {
|
|
322
|
+
this.openKkfileview(file);
|
|
323
|
+
} else {
|
|
324
|
+
location.href =
|
|
325
|
+
this.host +
|
|
326
|
+
(url ? url : previewAdjunctOffice) +
|
|
327
|
+
'?cmd=view&bucketName=' +
|
|
328
|
+
file.absolutePath +
|
|
329
|
+
'&fileId=' +
|
|
330
|
+
file.adjunctId +
|
|
331
|
+
'&fileName=' +
|
|
332
|
+
file.newName;
|
|
333
|
+
}
|
|
334
|
+
} else if (suffix.includes('pdf')) {
|
|
335
|
+
if (this.kkfileview) {
|
|
336
|
+
this.openKkfileview(file);
|
|
337
|
+
} else {
|
|
338
|
+
location.href =
|
|
339
|
+
this.host +
|
|
340
|
+
(url ? url : previewAdjunct2) +
|
|
341
|
+
'/' +
|
|
342
|
+
file.originalName +
|
|
343
|
+
'?adjunctId=' +
|
|
344
|
+
file.adjunctId;
|
|
345
|
+
}
|
|
346
|
+
} else if (
|
|
347
|
+
suffix.includes('jpeg') ||
|
|
348
|
+
suffix.includes('jpg') ||
|
|
349
|
+
suffix.includes('gif') ||
|
|
350
|
+
suffix.includes('png')
|
|
351
|
+
) {
|
|
352
|
+
let imgUrl =
|
|
353
|
+
res.url && util.startWith(url, ['http', '/', true])
|
|
354
|
+
? res.url
|
|
355
|
+
: this.host +
|
|
356
|
+
(url ? url : previewAdjunct) +
|
|
357
|
+
'?adjunctId=' +
|
|
358
|
+
file.adjunctId;
|
|
359
|
+
this.title = file.originalName;
|
|
360
|
+
this.images = [imgUrl];
|
|
361
|
+
console.log('this.images', this.images);
|
|
362
|
+
ImagePreview({ iamges: this.images, closeable: true });
|
|
363
|
+
} else if (suffix.includes('mp4')) {
|
|
364
|
+
this.source = {
|
|
365
|
+
src:
|
|
366
|
+
this.host +
|
|
367
|
+
(url ? url : this.previewAdjunct) +
|
|
368
|
+
'?adjunctId=' +
|
|
369
|
+
file.adjunctId
|
|
370
|
+
};
|
|
371
|
+
this.title = file.originalName;
|
|
372
|
+
this.showVideo = true;
|
|
373
|
+
} else {
|
|
374
|
+
if (this.kkfileview) {
|
|
375
|
+
this.openKkfileview(file);
|
|
376
|
+
} else {
|
|
377
|
+
location.href =
|
|
378
|
+
this.host +
|
|
379
|
+
(url ? url : this.previewAdjunct) +
|
|
380
|
+
'?adjunctId=' +
|
|
381
|
+
file.adjunctId;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
} else {
|
|
386
|
+
location.href = URL.createObjectURL(file.raw);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
handleBeforeRemove(file) {
|
|
391
|
+
if (file && (file.status === 'success' || file.status == 0)) {
|
|
392
|
+
return this.$confirm('确定删除文件吗?', '提示', {
|
|
393
|
+
confirmButtonText: '确定',
|
|
394
|
+
cancelButtonText: '取消',
|
|
395
|
+
type: 'warning'
|
|
396
|
+
})
|
|
397
|
+
.then(() => {
|
|
398
|
+
if (file.status === 'success' || file.status == 0) {
|
|
399
|
+
let userName =
|
|
400
|
+
file.userName ||
|
|
401
|
+
(file.response && file.response.userName) ||
|
|
402
|
+
util.getStorage('userName');
|
|
403
|
+
// eslint-disable-next-line no-undef
|
|
404
|
+
return new Promise((resolve, reject) => {
|
|
405
|
+
let url =
|
|
406
|
+
typeof this.deleted === 'string'
|
|
407
|
+
? this.deleted
|
|
408
|
+
: this.remove === 'string'
|
|
409
|
+
? this.remove
|
|
410
|
+
: this.dochubConfig.deleteDocumentUrl || delAdjunct;
|
|
411
|
+
request({
|
|
412
|
+
method: 'get',
|
|
413
|
+
url: url,
|
|
414
|
+
data: {
|
|
415
|
+
userName: userName,
|
|
416
|
+
documentId: file.adjunctId || file.response.adjunctId,
|
|
417
|
+
id: file.adjunctId || file.response.adjunctId
|
|
418
|
+
},
|
|
419
|
+
params: {
|
|
420
|
+
userName: userName,
|
|
421
|
+
documentId: file.adjunctId || file.response.adjunctId,
|
|
422
|
+
id: file.adjunctId || file.response.adjunctId
|
|
423
|
+
}
|
|
424
|
+
})
|
|
425
|
+
.then((res) => {
|
|
426
|
+
if (res.rCode === 0) {
|
|
427
|
+
let se =
|
|
428
|
+
this.filesTotalSize -
|
|
429
|
+
Math.round((file.size / 1024) * 10) / 10;
|
|
430
|
+
this.filesTotalSize = se;
|
|
431
|
+
this.$message.success(res.msg);
|
|
432
|
+
resolve();
|
|
433
|
+
} else {
|
|
434
|
+
let msg = res.msg || '系统错误,请联系管理员!';
|
|
435
|
+
this.$message.error(msg);
|
|
436
|
+
reject();
|
|
437
|
+
}
|
|
438
|
+
})
|
|
439
|
+
.catch((err) => {
|
|
440
|
+
if (err.message && err.message !== 'canceled') {
|
|
441
|
+
this.$message.error(err.message);
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
return true;
|
|
447
|
+
})
|
|
448
|
+
.catch(() => {
|
|
449
|
+
return flag;
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
},
|
|
453
|
+
isLt(file) {
|
|
454
|
+
let flag = false;
|
|
455
|
+
let flieArr = file.name.split('.');
|
|
456
|
+
let suffix = '.' + flieArr[flieArr.length - 1].toLowerCase();
|
|
457
|
+
if (this.accepts) {
|
|
458
|
+
let accepts = this.accepts.toLowerCase().split(',');
|
|
459
|
+
flag = accepts.includes(suffix);
|
|
460
|
+
if (!flag) {
|
|
461
|
+
this.$message.error(`文件类型错误,请上传${this.accepts}类型文件!`);
|
|
462
|
+
return flag;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
let size = this._size;
|
|
466
|
+
let text = '单个附件';
|
|
467
|
+
let se = Math.round((file.size / 1024) * 10) / 10;
|
|
468
|
+
if (this._size === 0 && this._totalSize === 0) {
|
|
469
|
+
flag = true;
|
|
470
|
+
} else if (this._size > 0 && this._totalSize === 0) {
|
|
471
|
+
flag = se < this._size;
|
|
472
|
+
size = this._size;
|
|
473
|
+
text = '单个附件';
|
|
474
|
+
} else if (this._size === 0 && this._totalSize > 0) {
|
|
475
|
+
flag = this.filesTotalSize + se < this._totalSize;
|
|
476
|
+
size = this._totalSize;
|
|
477
|
+
text = '附件总';
|
|
478
|
+
} else {
|
|
479
|
+
flag = se < this._size && this.filesTotalSize + se < this._totalSize;
|
|
480
|
+
if (se < this._size) {
|
|
481
|
+
size = this._size;
|
|
482
|
+
text = '单个附件';
|
|
483
|
+
} else {
|
|
484
|
+
size = this._totalSize;
|
|
485
|
+
text = '附件总';
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
if (!flag) {
|
|
489
|
+
this.$message.error(`上传${text}大小不能超过${size}KB!`);
|
|
490
|
+
return flag;
|
|
491
|
+
}
|
|
492
|
+
return flag;
|
|
493
|
+
},
|
|
494
|
+
// 处理文件上传
|
|
495
|
+
async handleFileUpload(file) {
|
|
496
|
+
const formData = new FormData();
|
|
497
|
+
formData.append('file', file.file);
|
|
498
|
+
formData.append('businessId', this.ownId);
|
|
499
|
+
formData.append('ownId', this.ownId);
|
|
500
|
+
formData.append('bucketCode', this.code);
|
|
501
|
+
formData.append('code', this.code);
|
|
502
|
+
|
|
503
|
+
let headers = {
|
|
504
|
+
authorization: util.getStorage('token'),
|
|
505
|
+
deviceId: util.getStorage('deviceId') || 'ceshi',
|
|
506
|
+
accept: '*/*'
|
|
507
|
+
};
|
|
508
|
+
await axios
|
|
509
|
+
.post(this.uploadUrl, formData, {
|
|
510
|
+
headers,
|
|
511
|
+
withCredentials: true
|
|
512
|
+
})
|
|
513
|
+
.then((response) => {
|
|
514
|
+
if (response.data.rCode == 0) {
|
|
515
|
+
console.log('response.data.rCode', response.data.rCode);
|
|
516
|
+
file.status = 'done';
|
|
517
|
+
file.message = '上传成功';
|
|
518
|
+
// 更新文件信息
|
|
519
|
+
this.$message({
|
|
520
|
+
type: 'success',
|
|
521
|
+
message: '文件上传成功!'
|
|
522
|
+
});
|
|
523
|
+
} else {
|
|
524
|
+
file.status = 'failed';
|
|
525
|
+
file.message = res.msg || '文件上传失败!';
|
|
526
|
+
this.$message({
|
|
527
|
+
type: 'error',
|
|
528
|
+
message: res.msg || '文件上传失败!'
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
})
|
|
532
|
+
.catch((error) => {
|
|
533
|
+
file.status = 'failed';
|
|
534
|
+
file.message = error.msg || '文件上传失败!';
|
|
535
|
+
this.$message({
|
|
536
|
+
type: 'error',
|
|
537
|
+
message: '文件上传过程中发生错误!'
|
|
538
|
+
});
|
|
539
|
+
});
|
|
540
|
+
|
|
541
|
+
// 使用原生fetch API上传文件
|
|
542
|
+
// await fetch(this.uploadUrl, {
|
|
543
|
+
// method: 'POST',
|
|
544
|
+
// body: formData,
|
|
545
|
+
// credentials: 'include', // 包含cookies
|
|
546
|
+
// headers: {
|
|
547
|
+
// authorization: util.getStorage('token'),
|
|
548
|
+
// deviceUnique:
|
|
549
|
+
// util.getStorage('deviceUnique') ||
|
|
550
|
+
// window.deviceUnique ||
|
|
551
|
+
// '0ab1e29ea40d4ffea15702acf22a9104'
|
|
552
|
+
// }
|
|
553
|
+
// })
|
|
554
|
+
// // .then((response) => response.json())
|
|
555
|
+
// .then((res) => {
|
|
556
|
+
// console.log('res', res);
|
|
557
|
+
// if (res.rCode == 0 && res.results) {
|
|
558
|
+
// // 更新文件信息
|
|
559
|
+
// this.$message({
|
|
560
|
+
// type: 'success',
|
|
561
|
+
// message: '文件上传成功!'
|
|
562
|
+
// });
|
|
563
|
+
// } else {
|
|
564
|
+
// file.status = 'failed';
|
|
565
|
+
// file.message = res.msg || '文件上传失败!';
|
|
566
|
+
// this.$message({
|
|
567
|
+
// type: 'error',
|
|
568
|
+
// message: res.msg || '文件上传失败!'
|
|
569
|
+
// });
|
|
570
|
+
// }
|
|
571
|
+
// })
|
|
572
|
+
// .catch((error) => {
|
|
573
|
+
// console.error('文件上传错误:', error);
|
|
574
|
+
// file.status = 'failed';
|
|
575
|
+
// file.message = res.msg || '文件上传失败!';
|
|
576
|
+
// this.$message({
|
|
577
|
+
// type: 'error',
|
|
578
|
+
// message: '文件上传过程中发生错误!'
|
|
579
|
+
// });
|
|
580
|
+
// });
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
</script>
|
|
585
|
+
|
|
586
|
+
<style></style>
|
package/src/config/api.js
CHANGED
|
@@ -170,3 +170,21 @@ export const saveCommonOpinion =
|
|
|
170
170
|
export const addCommonOpion = '/bpm/commonOpinionsManager/add';
|
|
171
171
|
// 直接办结
|
|
172
172
|
export const endFlowHtml = flowPendingPrefix + '/task/taskHandle/endFlow.dhtml';
|
|
173
|
+
// 附件相关
|
|
174
|
+
export const getAdjunctProperties =
|
|
175
|
+
'/main2/mecpfileManagement/getAdjunctProperties'; // 获取附件扩展类型大小
|
|
176
|
+
export const uploads = '/main2/mecpfileManagement/upload'; // 上传接口
|
|
177
|
+
export const uploadOnlyOne = '/main2/mecpfileManagement/uploadOnlyOne'; // 上传接口(覆盖之前文件)
|
|
178
|
+
export const getAdjunctFileInfos =
|
|
179
|
+
'/main2/mecpfileManagement/getAdjunctFileInfos'; // 附件列表
|
|
180
|
+
export const uploadSort = '/main2/mecpfileManagement/sort'; // 根据附件的ids排序附件
|
|
181
|
+
export const downloadByAdjunctId =
|
|
182
|
+
'/main2/mecpfileManagement/downloadByAdjunctId'; // 下载附件
|
|
183
|
+
export const uploadDownloads = '/main2/mecpfileManagement/uploadDownloads'; // 批量下载//
|
|
184
|
+
export const previewAdjunct = '/main2/mecpfileManagement/previewAdjunct'; // 预览附件
|
|
185
|
+
export const previewAdjunct2 = '/main2/mecpfileManagement/previewAdjunct2/'; // 预览附件(带文件名)
|
|
186
|
+
export const previewAdjunctOffice = '/document/webDocument/documentIndex.dhtml'; // 预览附件word excel ppt
|
|
187
|
+
export const delAdjunct = '/main2/mecpfileManagement/delAdjunct'; // 删除附件
|
|
188
|
+
export const upload_updateClassify = '/main2/mecpfileManagement/updateClassify'; // 根据附件id保存该附件的分类信息
|
|
189
|
+
export const getDeleteAdjunctFileInfos =
|
|
190
|
+
'/main2/mecpfileManagement/getDeleteAdjunctFileInfos'; // 根据业务id和附件code获取相关已删除附件的元数据列表
|