n20-common-lib 1.3.1 → 1.3.4
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/g6.js +5 -5
- package/package.json +1 -1
- package/src/components/ECharts/mixins/resize.js +1 -1
- package/src/components/FileImport/index.vue +1 -1
- package/src/components/NstcG6Components/Form/DatepickerCustom/index.vue +32 -32
- package/src/components/NstcG6Components/NstcBranchLazyLoad/NstcBranchLazyLoad.vue +37 -33
- package/src/components/NstcG6Components/NstcCharts/mixins/resize.js +1 -1
- package/src/components/NstcG6Components/NstcDropdownTree/NstcDropdownTree.vue +141 -137
- package/src/components/NstcG6Components/NstcExcelExport/NstcExcelExport.vue +47 -47
- package/src/components/NstcG6Components/NstcExcelImport/NstcExcelImport.vue +1 -1
- package/src/components/NstcG6Components/NstcExcelImportN/NstcExcelImportN.vue +186 -188
- package/src/components/NstcG6Components/NstcFileUpload/NstcFileUpload.vue +429 -451
- package/src/components/NstcG6Components/NstcForm/BusinessSpecific/InputMultiple.vue +66 -68
- package/src/components/NstcG6Components/NstcForm/CascaderCustom/index.vue +7 -7
- package/src/components/NstcG6Components/NstcForm/DatepickerCustom/index.vue +32 -32
- package/src/components/NstcG6Components/NstcForm/InputAndDialog/NstcInputAndDialog.vue +1 -1
- package/src/components/NstcG6Components/NstcForm/InputCustom/index.vue +1 -1
- package/src/components/NstcG6Components/NstcForm/SelectAccount/NstcSelectAccount.vue +1 -1
- package/src/components/NstcG6Components/NstcForm/SelectAndDialog/NstcSelectAndDialog.vue +1 -1
- package/src/components/NstcG6Components/NstcForm/SelectCustom/index.vue +1 -1
- package/src/components/NstcG6Components/NstcForm/SelectindialogCustom/index.vue +1 -1
- package/src/components/NstcG6Components/NstcForm/UploadCustom/index.vue +1 -1
- package/src/components/NstcG6Components/NstcSelectTree/NstcSelectTree.vue +172 -172
- package/src/components/NstcG6Components/NstcSelectTreeList/NstcSelectTreeList.vue +1 -1
- package/src/components/NstcG6Components/NstcSvgIcon/NstcSvgIcon.vue +7 -12
- package/src/components/NstcG6Components/NstcTable/NstcTable.vue +145 -145
- package/src/components/NstcG6Components/NstcTableSet/NstcTableSet.vue +4 -4
- package/src/components/NstcG6Components/NstcWorkBench/NstcWorkBench.vue +45 -36
- package/src/components/NstcG6Components/Search/NstcSearch.vue +6 -6
- package/src/components/NstcG6Components/approvelTwo/main.vue +1 -1
- package/src/components/NstcG6Components/approvelTwo/progress.vue +1 -1
- package/src/components/Search/index.vue +8 -8
- package/src/index.js +3 -3
- package/style/css/normalize.scss +726 -0
- package/style/pageDemo/demo-1.vue +131 -0
- package/style/pageDemo/demo-2.vue +35 -0
- package/style/pageDemo/demo-3.vue +22 -0
- package/style/pageDemo/seeCode.js +20 -0
- package/style/server-config.jsonc +723 -0
|
@@ -5,207 +5,186 @@
|
|
|
5
5
|
-->
|
|
6
6
|
<template>
|
|
7
7
|
<div class="nstc-file-upload">
|
|
8
|
-
<div
|
|
8
|
+
<div v-if="pattern !== 'text'" class="nstc-file-upload-head">
|
|
9
9
|
<el-button
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
v-if="!views"
|
|
11
|
+
type="primary"
|
|
12
|
+
class="nstc-g6-common-btn-1 nstc-g6-common-btn-size-s"
|
|
13
|
+
:disabled="isDisabled"
|
|
14
|
+
@click="add"
|
|
15
15
|
>
|
|
16
16
|
新增
|
|
17
17
|
</el-button>
|
|
18
18
|
<el-button
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
v-if="tableData.length !== 0 && !views"
|
|
20
|
+
class="nstc-g6-common-btn-1 nstc-g6-common-btn-size-s"
|
|
21
|
+
@click="batchDownload"
|
|
22
|
+
>下载
|
|
23
23
|
</el-button>
|
|
24
24
|
<el-button
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
v-if="tableData.length !== 0 && !views"
|
|
26
|
+
class="nstc-g6-common-btn-4 nstc-g6-common-btn-size-s"
|
|
27
|
+
:disabled="isDisabled"
|
|
28
|
+
@click="batchDelete"
|
|
29
29
|
>
|
|
30
30
|
删除
|
|
31
31
|
</el-button>
|
|
32
32
|
</div>
|
|
33
|
-
<div class="nstc-file-upload-head"
|
|
33
|
+
<div v-else class="nstc-file-upload-head">
|
|
34
34
|
<el-button
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
</el-button
|
|
40
|
-
>
|
|
35
|
+
v-if="tableData.length !== 0 && !views"
|
|
36
|
+
class="nstc-g6-common-btn-1 nstc-g6-common-btn-size-s"
|
|
37
|
+
@click="batchDownload"
|
|
38
|
+
>下载
|
|
39
|
+
</el-button>
|
|
41
40
|
</div>
|
|
42
41
|
<div class="nstc-file-upload-table">
|
|
43
|
-
<el-form :rules="model.rules" :model="model"
|
|
42
|
+
<el-form ref="form" :rules="model.rules" :model="model">
|
|
44
43
|
<el-table :data="tableData" @selection-change="handleSelectionChange">
|
|
45
|
-
<el-table-column type="selection" width="50" align="center"/>
|
|
46
|
-
<el-table-column
|
|
47
|
-
label="附件类型"
|
|
48
|
-
align="left"
|
|
49
|
-
min-width="180"
|
|
50
|
-
>
|
|
44
|
+
<el-table-column type="selection" width="50" align="center" />
|
|
45
|
+
<el-table-column label="附件类型" align="left" min-width="180">
|
|
51
46
|
<template slot-scope="scope">
|
|
52
47
|
<!-- !textFlag(scope.row.uuid,scope.row.filePath) -->
|
|
53
48
|
<el-select
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
v-if="!textFlag(scope.row.uuid, scope.row.filePath) && !views"
|
|
50
|
+
v-model="scope.row.fileType"
|
|
56
51
|
>
|
|
57
52
|
<el-option
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
53
|
+
v-for="(item, index) in fileTypeList"
|
|
54
|
+
:key="index"
|
|
55
|
+
:label="item.label"
|
|
56
|
+
:value="item.value"
|
|
62
57
|
/>
|
|
63
58
|
</el-select>
|
|
64
59
|
<span v-else>{{
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
getFileTypeLabel(scope.row.fileType) || '--'
|
|
61
|
+
}}</span>
|
|
67
62
|
</template>
|
|
68
63
|
</el-table-column>
|
|
69
|
-
<el-table-column
|
|
70
|
-
label="附件名称"
|
|
71
|
-
align="left"
|
|
72
|
-
min-width="180"
|
|
73
|
-
>
|
|
64
|
+
<el-table-column label="附件名称" align="left" min-width="180">
|
|
74
65
|
<template slot-scope="scope">
|
|
75
66
|
<el-form-item
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
67
|
+
v-if="!textFlag(scope.row.uuid, scope.row.filePath) && !views"
|
|
68
|
+
:prop="'tableData.' + scope.$index + '.attachmentName'"
|
|
69
|
+
:rules="model.rules.attachmentName"
|
|
79
70
|
>
|
|
80
71
|
<el-input
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
72
|
+
v-model.trim="scope.row.attachmentName"
|
|
73
|
+
placeholder="请输入附件名称"
|
|
74
|
+
clearable
|
|
75
|
+
:maxlength="attachmentMaxlength"
|
|
76
|
+
/>
|
|
86
77
|
</el-form-item>
|
|
87
78
|
|
|
88
|
-
<span v-else>{{ scope.row.attachmentName ||
|
|
79
|
+
<span v-else>{{ scope.row.attachmentName || '--' }}</span>
|
|
89
80
|
</template>
|
|
90
81
|
</el-table-column>
|
|
91
|
-
<el-table-column
|
|
92
|
-
label="附件上传"
|
|
93
|
-
align="left"
|
|
94
|
-
min-width="180"
|
|
95
|
-
>
|
|
82
|
+
<el-table-column label="附件上传" align="left" min-width="180">
|
|
96
83
|
<template slot-scope="scope">
|
|
97
84
|
<el-upload
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
85
|
+
v-if="pattern !== 'text' && !views"
|
|
86
|
+
:ref="`nstc_g6_common_upload_index_${scope.$index}`"
|
|
87
|
+
action=""
|
|
88
|
+
v-bind="$attrs"
|
|
89
|
+
:auto-upload="false"
|
|
90
|
+
:before-upload="
|
|
104
91
|
function (file) {
|
|
105
|
-
return beforeUpload(file, scope.row)
|
|
92
|
+
return beforeUpload(file, scope.row)
|
|
106
93
|
}
|
|
107
94
|
"
|
|
108
|
-
|
|
109
|
-
|
|
95
|
+
:on-exceed="handleExceed"
|
|
96
|
+
:on-change="
|
|
110
97
|
(file, fileLists) => {
|
|
111
|
-
handleChange(file, fileLists, scope.$index, scope.row)
|
|
98
|
+
handleChange(file, fileLists, scope.$index, scope.row)
|
|
112
99
|
}
|
|
113
100
|
"
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
101
|
+
:file-list="fileList"
|
|
102
|
+
:show-file-list="false"
|
|
103
|
+
:http-request="httpRequest"
|
|
104
|
+
v-on="$listeners"
|
|
118
105
|
>
|
|
119
106
|
<el-input
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
107
|
+
v-model="scope.row.fileName"
|
|
108
|
+
placeholder="请选择附件"
|
|
109
|
+
readonly
|
|
110
|
+
@click="getUploadIndex(scope.$index)"
|
|
124
111
|
>
|
|
125
112
|
<div slot="suffix" class="input-upload">
|
|
126
|
-
<img :src="inputUploadSvg" alt=""/>
|
|
113
|
+
<img :src="inputUploadSvg" alt="" />
|
|
127
114
|
</div>
|
|
128
115
|
</el-input>
|
|
129
116
|
</el-upload>
|
|
130
|
-
<span v-else>{{ scope.row.fileName ||
|
|
117
|
+
<span v-else>{{ scope.row.fileName || '--' }}</span>
|
|
131
118
|
</template>
|
|
132
|
-
<el-input/>
|
|
119
|
+
<el-input />
|
|
133
120
|
</el-table-column>
|
|
134
121
|
<el-table-column
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
122
|
+
label="上传时间"
|
|
123
|
+
prop="time"
|
|
124
|
+
align="left"
|
|
125
|
+
width="220px"
|
|
139
126
|
>
|
|
140
127
|
<template slot-scope="scope">
|
|
141
128
|
<span>{{
|
|
142
|
-
|
|
143
|
-
|
|
129
|
+
(scope.row.time || scope.row.createTime) | parseTimeFormat
|
|
130
|
+
}}</span>
|
|
144
131
|
</template>
|
|
145
132
|
</el-table-column>
|
|
146
|
-
<el-table-column
|
|
147
|
-
label="上传人"
|
|
148
|
-
prop="user"
|
|
149
|
-
align="left"
|
|
150
|
-
>
|
|
133
|
+
<el-table-column label="上传人" prop="user" align="left">
|
|
151
134
|
<template slot-scope="scope">
|
|
152
135
|
<span>{{ scope.row.user || scope.row.creator }}</span>
|
|
153
136
|
</template>
|
|
154
137
|
</el-table-column>
|
|
155
138
|
<el-table-column
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
139
|
+
v-if="pattern !== 'text'"
|
|
140
|
+
label="上传进度"
|
|
141
|
+
align="left"
|
|
142
|
+
width="300px"
|
|
160
143
|
>
|
|
161
144
|
<template slot-scope="scope">
|
|
162
145
|
<div class="nstc-el-progress-box">
|
|
163
146
|
<el-progress
|
|
164
|
-
|
|
165
|
-
|
|
147
|
+
v-show="showProgress"
|
|
148
|
+
:percentage="
|
|
166
149
|
(scope.row.uuid || scope.row.filePath) &&
|
|
167
150
|
scope.row.status !== 'exception'
|
|
168
151
|
? 100
|
|
169
152
|
: scope.row.percentage
|
|
170
153
|
"
|
|
171
|
-
|
|
154
|
+
:status="
|
|
172
155
|
scope.row.uuid || scope.row.filePath
|
|
173
156
|
? 'success'
|
|
174
157
|
: scope.row.status
|
|
175
158
|
"
|
|
176
|
-
|
|
159
|
+
:width="100"
|
|
177
160
|
/>
|
|
178
161
|
</div>
|
|
179
162
|
<span
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
163
|
+
v-if="scope.row.status === 'exception'"
|
|
164
|
+
class="nstc-file-reload"
|
|
165
|
+
@click="reUploadAction(scope.$index)"
|
|
166
|
+
>重新上传</span
|
|
184
167
|
>
|
|
185
168
|
</template>
|
|
186
169
|
</el-table-column>
|
|
187
|
-
<el-table-column
|
|
188
|
-
label="操作"
|
|
189
|
-
align="left"
|
|
190
|
-
width="100px"
|
|
191
|
-
>
|
|
170
|
+
<el-table-column label="操作" align="left" width="100px">
|
|
192
171
|
<template slot-scope="scope">
|
|
193
172
|
<div class="nstc-file-upload-opt">
|
|
194
173
|
<!-- v-if="false" -->
|
|
195
174
|
<!-- -->
|
|
196
175
|
<img
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
176
|
+
v-if="showViews"
|
|
177
|
+
:src="lookDiabled"
|
|
178
|
+
alt=""
|
|
179
|
+
@click="lookFile(scope.$index)"
|
|
201
180
|
/>
|
|
202
181
|
<img
|
|
203
|
-
|
|
182
|
+
v-if="
|
|
204
183
|
(scope.row.uuid || scope.row.filePath) && pattern === 'text'
|
|
205
184
|
"
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
185
|
+
:src="downloadSvg"
|
|
186
|
+
alt=""
|
|
187
|
+
@click="downLoadFile(scope.row)"
|
|
209
188
|
/>
|
|
210
189
|
<!-- <img
|
|
211
190
|
v-if="pattern !== 'text'"
|
|
@@ -220,10 +199,10 @@
|
|
|
220
199
|
</el-form>
|
|
221
200
|
</div>
|
|
222
201
|
<DialogCustom
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
202
|
+
v-model="dialogShowFlag"
|
|
203
|
+
:show-footer="false"
|
|
204
|
+
:title="dialogTitle"
|
|
205
|
+
@confirm="handleConfirm"
|
|
227
206
|
>
|
|
228
207
|
<span>查看文件</span>
|
|
229
208
|
</DialogCustom>
|
|
@@ -231,67 +210,76 @@
|
|
|
231
210
|
</template>
|
|
232
211
|
|
|
233
212
|
<script>
|
|
234
|
-
import lookSvg from
|
|
235
|
-
import lookDiabled from
|
|
236
|
-
import downloadSvg from
|
|
237
|
-
import deleteSvg from
|
|
238
|
-
import inputUploadSvg from
|
|
239
|
-
import addFile from
|
|
240
|
-
import deleteFileSvg from
|
|
241
|
-
import DialogCustom from
|
|
213
|
+
import lookSvg from './img/look.svg'
|
|
214
|
+
import lookDiabled from './img/look-diabled.svg'
|
|
215
|
+
import downloadSvg from './img/download.svg'
|
|
216
|
+
import deleteSvg from './img/delete.svg'
|
|
217
|
+
import inputUploadSvg from './img/inputUpload.svg'
|
|
218
|
+
import addFile from './img/addFile.svg'
|
|
219
|
+
import deleteFileSvg from './img/deleteFile.svg'
|
|
220
|
+
import DialogCustom from '../NstcDialog/NstcDialog'
|
|
242
221
|
// fileDownloadGdt
|
|
243
222
|
|
|
244
|
-
import {parseTime} from
|
|
245
|
-
import auth from
|
|
246
|
-
import axios from
|
|
223
|
+
import { parseTime } from '../../../utils/parseTime'
|
|
224
|
+
import auth from '../../../utils/auth'
|
|
225
|
+
import axios from 'axios'
|
|
247
226
|
|
|
248
227
|
export default {
|
|
249
|
-
name:
|
|
228
|
+
name: 'NstcFileUpload',
|
|
250
229
|
components: {
|
|
251
|
-
DialogCustom
|
|
230
|
+
DialogCustom
|
|
231
|
+
},
|
|
232
|
+
filters: {
|
|
233
|
+
parseTimeFormat: function (val) {
|
|
234
|
+
if (val !== '' && val) {
|
|
235
|
+
return parseTime(new Date(val), '{y}-{m}-{d}')
|
|
236
|
+
} else {
|
|
237
|
+
return ''
|
|
238
|
+
}
|
|
239
|
+
}
|
|
252
240
|
},
|
|
253
241
|
props: {
|
|
254
242
|
attachmentMaxlength: {
|
|
255
243
|
type: String,
|
|
256
|
-
default:
|
|
244
|
+
default: '64'
|
|
257
245
|
},
|
|
258
246
|
views: {
|
|
259
247
|
//是否浏览模式
|
|
260
248
|
type: Boolean,
|
|
261
|
-
default: false
|
|
249
|
+
default: false
|
|
262
250
|
},
|
|
263
251
|
value: {
|
|
264
252
|
type: Array,
|
|
265
253
|
default: () => {
|
|
266
|
-
return []
|
|
267
|
-
}
|
|
254
|
+
return []
|
|
255
|
+
}
|
|
268
256
|
},
|
|
269
257
|
pattern: {
|
|
270
258
|
type: String,
|
|
271
259
|
default: () => {
|
|
272
|
-
return
|
|
273
|
-
}
|
|
260
|
+
return 'normal'
|
|
261
|
+
}
|
|
274
262
|
},
|
|
275
263
|
url: {
|
|
276
264
|
type: String,
|
|
277
|
-
default: null
|
|
265
|
+
default: null
|
|
278
266
|
},
|
|
279
267
|
batchDownloadUrl: {
|
|
280
268
|
type: String,
|
|
281
|
-
default: null
|
|
269
|
+
default: null
|
|
282
270
|
},
|
|
283
271
|
httpMethod: {
|
|
284
272
|
type: String,
|
|
285
|
-
default:
|
|
273
|
+
default: 'post'
|
|
286
274
|
},
|
|
287
275
|
showLength: {
|
|
288
276
|
type: Boolean,
|
|
289
|
-
default: true
|
|
277
|
+
default: true
|
|
290
278
|
},
|
|
291
279
|
isDisabled: {
|
|
292
280
|
type: Boolean,
|
|
293
|
-
default: false
|
|
294
|
-
}
|
|
281
|
+
default: false
|
|
282
|
+
}
|
|
295
283
|
},
|
|
296
284
|
data() {
|
|
297
285
|
return {
|
|
@@ -306,73 +294,72 @@ export default {
|
|
|
306
294
|
model: {
|
|
307
295
|
rules: {
|
|
308
296
|
attachmentName: {
|
|
309
|
-
type:
|
|
297
|
+
type: 'string',
|
|
310
298
|
required: true,
|
|
311
|
-
message:
|
|
312
|
-
trigger:
|
|
313
|
-
}
|
|
299
|
+
message: '必填字段',
|
|
300
|
+
trigger: 'change'
|
|
301
|
+
}
|
|
314
302
|
},
|
|
315
|
-
tableData: []
|
|
303
|
+
tableData: []
|
|
316
304
|
},
|
|
317
305
|
fileList: [],
|
|
318
306
|
tableSelectionData: [],
|
|
319
307
|
tableSelectionData2: [],
|
|
320
|
-
fileTypeList: [{label: '附件', value: 1}],
|
|
308
|
+
fileTypeList: [{ label: '附件', value: 1 }],
|
|
321
309
|
tempFile: {
|
|
322
|
-
id:
|
|
323
|
-
attachmentName:
|
|
324
|
-
fileName:
|
|
310
|
+
id: '',
|
|
311
|
+
attachmentName: '',
|
|
312
|
+
fileName: '',
|
|
325
313
|
remark: null,
|
|
326
314
|
fileType: 1,
|
|
327
|
-
type:
|
|
328
|
-
time:
|
|
329
|
-
user:
|
|
315
|
+
type: '',
|
|
316
|
+
time: '',
|
|
317
|
+
user: '',
|
|
330
318
|
progress: 0,
|
|
331
|
-
uuid:
|
|
319
|
+
uuid: '',
|
|
332
320
|
status: null,
|
|
333
|
-
fileObj:
|
|
334
|
-
percentage: 0
|
|
321
|
+
fileObj: '',
|
|
322
|
+
percentage: 0
|
|
335
323
|
},
|
|
336
324
|
dialogTitle: '查看',
|
|
337
325
|
dialogShowFlag: false,
|
|
338
326
|
currentUploadIndex: null,
|
|
339
327
|
showProgress: true,
|
|
340
328
|
dialogShowDelete: false,
|
|
341
|
-
dialogDeleteTitle:
|
|
342
|
-
}
|
|
329
|
+
dialogDeleteTitle: '提示'
|
|
330
|
+
}
|
|
343
331
|
},
|
|
344
332
|
computed: {
|
|
345
333
|
tableData: {
|
|
346
334
|
get() {
|
|
347
335
|
this.value.map((item) => {
|
|
348
|
-
item.fileType = item.fileType ==
|
|
349
|
-
item.status == null ? (item.status = 0) :
|
|
350
|
-
return item
|
|
351
|
-
})
|
|
352
|
-
this.model.tableData = this.value
|
|
353
|
-
console.log(
|
|
354
|
-
return this.value
|
|
336
|
+
item.fileType = item.fileType == '' ? '' : Number(item.fileType)
|
|
337
|
+
item.status == null ? (item.status = 0) : ''
|
|
338
|
+
return item
|
|
339
|
+
})
|
|
340
|
+
this.model.tableData = this.value
|
|
341
|
+
console.log('this.model=====', this.model.tableData)
|
|
342
|
+
return this.value
|
|
355
343
|
},
|
|
356
344
|
set(val) {
|
|
357
|
-
this.$emit(
|
|
358
|
-
}
|
|
345
|
+
this.$emit('input', val)
|
|
346
|
+
}
|
|
359
347
|
},
|
|
360
348
|
uploadFlag() {
|
|
361
|
-
return this.tableData.filter((i) => i.uuid).length !== 0
|
|
362
|
-
}
|
|
349
|
+
return this.tableData.filter((i) => i.uuid).length !== 0
|
|
350
|
+
}
|
|
363
351
|
},
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
},
|
|
352
|
+
beforeUpdate() {
|
|
353
|
+
this.showProgress = false
|
|
354
|
+
},
|
|
355
|
+
updated() {
|
|
356
|
+
setTimeout(() => {
|
|
357
|
+
this.showProgress = true
|
|
358
|
+
}, 1)
|
|
372
359
|
},
|
|
373
360
|
methods: {
|
|
374
361
|
beforeUpload(file, row) {
|
|
375
|
-
console.log(file, row)
|
|
362
|
+
console.log(file, row)
|
|
376
363
|
// if(!row.attachmentName) {
|
|
377
364
|
// this.$message({
|
|
378
365
|
// type: "warning",
|
|
@@ -382,13 +369,13 @@ export default {
|
|
|
382
369
|
// }
|
|
383
370
|
},
|
|
384
371
|
checkValidate() {
|
|
385
|
-
this.$refs[
|
|
386
|
-
return res
|
|
387
|
-
})
|
|
372
|
+
this.$refs['form'].validate((res) => {
|
|
373
|
+
return res
|
|
374
|
+
})
|
|
388
375
|
},
|
|
389
376
|
cancel(i) {
|
|
390
|
-
this.tableData[i].percentage = 0
|
|
391
|
-
console.log(
|
|
377
|
+
this.tableData[i].percentage = 0
|
|
378
|
+
console.log('111')
|
|
392
379
|
},
|
|
393
380
|
/**
|
|
394
381
|
* 判断当前是不是文档模式
|
|
@@ -396,11 +383,11 @@ export default {
|
|
|
396
383
|
* 2 上传成功
|
|
397
384
|
*/
|
|
398
385
|
textFlag(uuid, filePath) {
|
|
399
|
-
console.log(uuid, filePath)
|
|
400
|
-
if (this.pattern ===
|
|
401
|
-
return true
|
|
386
|
+
console.log(uuid, filePath)
|
|
387
|
+
if (this.pattern === 'text') {
|
|
388
|
+
return true
|
|
402
389
|
} else {
|
|
403
|
-
return !!uuid || !!filePath
|
|
390
|
+
return !!uuid || !!filePath
|
|
404
391
|
}
|
|
405
392
|
},
|
|
406
393
|
|
|
@@ -409,31 +396,31 @@ export default {
|
|
|
409
396
|
*/
|
|
410
397
|
add() {
|
|
411
398
|
this.tableData.unshift(
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
)
|
|
399
|
+
JSON.parse(
|
|
400
|
+
JSON.stringify({
|
|
401
|
+
id: new Date().getTime(),
|
|
402
|
+
attachmentName: '',
|
|
403
|
+
fileName: '',
|
|
404
|
+
remark: null,
|
|
405
|
+
fileType: 1,
|
|
406
|
+
type: '',
|
|
407
|
+
time: '',
|
|
408
|
+
user: '',
|
|
409
|
+
progress: 0,
|
|
410
|
+
uuid: '',
|
|
411
|
+
status: null,
|
|
412
|
+
fileObj: '',
|
|
413
|
+
percentage: 0
|
|
414
|
+
})
|
|
415
|
+
)
|
|
416
|
+
)
|
|
430
417
|
},
|
|
431
418
|
|
|
432
419
|
/**
|
|
433
420
|
* 表格选择变化
|
|
434
421
|
*/
|
|
435
422
|
handleSelectionChange(data) {
|
|
436
|
-
this.tableSelectionData = data
|
|
423
|
+
this.tableSelectionData = data
|
|
437
424
|
},
|
|
438
425
|
|
|
439
426
|
/**
|
|
@@ -447,50 +434,50 @@ export default {
|
|
|
447
434
|
* 下载文件
|
|
448
435
|
*/
|
|
449
436
|
downLoadFile(data) {
|
|
450
|
-
console.log(data)
|
|
437
|
+
console.log(data)
|
|
451
438
|
// const aEl = document.createElement('a')
|
|
452
|
-
let uuid = data.uuid || data.filePath
|
|
453
|
-
const p = encodeURIComponent(uuid)
|
|
454
|
-
const n = encodeURIComponent(data.fileName)
|
|
439
|
+
let uuid = data.uuid || data.filePath
|
|
440
|
+
const p = encodeURIComponent(uuid)
|
|
441
|
+
const n = encodeURIComponent(data.fileName)
|
|
455
442
|
|
|
456
443
|
axios({
|
|
457
444
|
method: this.httpMethod,
|
|
458
445
|
url: `${this.url}/download/${p}/${n}`,
|
|
459
446
|
// 这里可以在header中加一些东西,比如token
|
|
460
447
|
headers: {
|
|
461
|
-
|
|
448
|
+
'Content-Type': 'application/json',
|
|
462
449
|
Authorization: `Bearer ${auth.getCookieToken()}`,
|
|
463
450
|
timestamp: Date.now(),
|
|
464
|
-
OperationDesc:
|
|
465
|
-
requestKey: Math.round(Math.random() * 1000000000)
|
|
451
|
+
OperationDesc: 'yYarJp',
|
|
452
|
+
requestKey: Math.round(Math.random() * 1000000000)
|
|
466
453
|
},
|
|
467
|
-
responseType:
|
|
454
|
+
responseType: 'blob'
|
|
468
455
|
})
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
});
|
|
474
|
-
let fileName = decodeURI(
|
|
475
|
-
res.headers["content-disposition"].split(";")[1].split("=")[1]
|
|
476
|
-
);
|
|
477
|
-
if (window.navigator.msSaveBlob) {
|
|
478
|
-
// ie
|
|
479
|
-
window.navigator.msSaveOrOpenBlob(blob, fileName);
|
|
480
|
-
return;
|
|
481
|
-
}
|
|
482
|
-
let elink = document.createElement("a");
|
|
483
|
-
elink.style.display = "none";
|
|
484
|
-
elink.href = window.URL.createObjectURL(blob);
|
|
485
|
-
elink.download = data.fileName;
|
|
486
|
-
document.body.appendChild(elink);
|
|
487
|
-
elink.click();
|
|
488
|
-
URL.revokeObjectURL(elink.href);
|
|
489
|
-
document.body.removeChild(elink);
|
|
456
|
+
.then((res) => {
|
|
457
|
+
console.log('response: ', res)
|
|
458
|
+
let blob = new Blob([res.data], {
|
|
459
|
+
type: 'application/octet-stream;charset=UTF-8'
|
|
490
460
|
})
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
461
|
+
let fileName = decodeURI(
|
|
462
|
+
res.headers['content-disposition'].split(';')[1].split('=')[1]
|
|
463
|
+
)
|
|
464
|
+
if (window.navigator.msSaveBlob) {
|
|
465
|
+
// ie
|
|
466
|
+
window.navigator.msSaveOrOpenBlob(blob, fileName)
|
|
467
|
+
return
|
|
468
|
+
}
|
|
469
|
+
let elink = document.createElement('a')
|
|
470
|
+
elink.style.display = 'none'
|
|
471
|
+
elink.href = window.URL.createObjectURL(blob)
|
|
472
|
+
elink.download = data.fileName
|
|
473
|
+
document.body.appendChild(elink)
|
|
474
|
+
elink.click()
|
|
475
|
+
URL.revokeObjectURL(elink.href)
|
|
476
|
+
document.body.removeChild(elink)
|
|
477
|
+
})
|
|
478
|
+
.catch((error) => {
|
|
479
|
+
console.log('response: ', error)
|
|
480
|
+
})
|
|
494
481
|
},
|
|
495
482
|
|
|
496
483
|
/**
|
|
@@ -498,27 +485,26 @@ export default {
|
|
|
498
485
|
*/
|
|
499
486
|
deleteFile(index) {
|
|
500
487
|
this.$confirmTip({
|
|
501
|
-
type:
|
|
502
|
-
title:
|
|
503
|
-
info:
|
|
488
|
+
type: 'info',
|
|
489
|
+
title: '确认删除该文件?',
|
|
490
|
+
info: '',
|
|
504
491
|
button: {
|
|
505
|
-
ok:
|
|
506
|
-
cancel:
|
|
507
|
-
}
|
|
492
|
+
ok: '提交',
|
|
493
|
+
cancel: '取消'
|
|
494
|
+
}
|
|
508
495
|
}).then(() => {
|
|
509
|
-
this.tableData.splice(index, 1)
|
|
496
|
+
this.tableData.splice(index, 1)
|
|
510
497
|
this.$message({
|
|
511
|
-
type:
|
|
512
|
-
message:
|
|
513
|
-
})
|
|
514
|
-
})
|
|
498
|
+
type: 'success',
|
|
499
|
+
message: '删除成功!'
|
|
500
|
+
})
|
|
501
|
+
})
|
|
515
502
|
},
|
|
516
503
|
|
|
517
504
|
/**
|
|
518
505
|
* 弹框确认事件
|
|
519
506
|
*/
|
|
520
|
-
handleConfirm() {
|
|
521
|
-
},
|
|
507
|
+
handleConfirm() {},
|
|
522
508
|
|
|
523
509
|
/**
|
|
524
510
|
* 批量下载
|
|
@@ -526,72 +512,72 @@ export default {
|
|
|
526
512
|
batchDownload() {
|
|
527
513
|
if (this.tableSelectionData.length === 1) {
|
|
528
514
|
// 单条下载
|
|
529
|
-
this.downLoadFile(this.tableSelectionData[0])
|
|
515
|
+
this.downLoadFile(this.tableSelectionData[0])
|
|
530
516
|
} else if (this.tableSelectionData.length > 1) {
|
|
531
|
-
const files = []
|
|
517
|
+
const files = []
|
|
532
518
|
// 判断是否有文件未上传
|
|
533
|
-
console.log(
|
|
519
|
+
console.log('this.tableSelectionData====', this.tableSelectionData)
|
|
534
520
|
let isNoUpload = this.tableSelectionData.some((item) => {
|
|
535
|
-
!item.uuid == true
|
|
536
|
-
})
|
|
537
|
-
console.log(
|
|
521
|
+
!item.uuid == true
|
|
522
|
+
})
|
|
523
|
+
console.log('文件判断=======', isNoUpload)
|
|
538
524
|
if (isNoUpload) {
|
|
539
525
|
// 阻断下载
|
|
540
526
|
this.$message({
|
|
541
|
-
type:
|
|
542
|
-
message:
|
|
543
|
-
})
|
|
544
|
-
return
|
|
527
|
+
type: 'warning',
|
|
528
|
+
message: '勾选文件中有文件未上传'
|
|
529
|
+
})
|
|
530
|
+
return
|
|
545
531
|
}
|
|
546
532
|
this.tableSelectionData.map((item) => {
|
|
547
533
|
files.push({
|
|
548
534
|
uuid: item.uuid || item.filePath,
|
|
549
|
-
fileName: item.fileName
|
|
550
|
-
})
|
|
551
|
-
})
|
|
535
|
+
fileName: item.fileName
|
|
536
|
+
})
|
|
537
|
+
})
|
|
552
538
|
|
|
553
539
|
axios({
|
|
554
540
|
url: this.batchDownloadUrl,
|
|
555
|
-
method:
|
|
541
|
+
method: 'POST',
|
|
556
542
|
data: JSON.stringify(files),
|
|
557
543
|
headers: {
|
|
558
|
-
|
|
544
|
+
'Content-Type': 'application/json',
|
|
559
545
|
Authorization: `Bearer ${auth.getCookieToken()}`,
|
|
560
546
|
timestamp: Date.now(),
|
|
561
|
-
OperationDesc:
|
|
562
|
-
requestKey: Math.round(Math.random() * 1000000000)
|
|
547
|
+
OperationDesc: 'yYarJp',
|
|
548
|
+
requestKey: Math.round(Math.random() * 1000000000)
|
|
563
549
|
},
|
|
564
|
-
responseType:
|
|
550
|
+
responseType: 'blob'
|
|
565
551
|
})
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
});
|
|
570
|
-
let fileName = decodeURI(
|
|
571
|
-
res.headers["content-disposition"].split(";")[1].split("=")[1]
|
|
572
|
-
);
|
|
573
|
-
if (window.navigator.msSaveBlob) {
|
|
574
|
-
// ie
|
|
575
|
-
window.navigator.msSaveOrOpenBlob(blob, fileName);
|
|
576
|
-
return;
|
|
577
|
-
}
|
|
578
|
-
let elink = document.createElement("a");
|
|
579
|
-
elink.style.display = "none";
|
|
580
|
-
elink.href = window.URL.createObjectURL(blob);
|
|
581
|
-
elink.download = "批量下载.zip";
|
|
582
|
-
document.body.appendChild(elink);
|
|
583
|
-
elink.click();
|
|
584
|
-
URL.revokeObjectURL(elink.href);
|
|
585
|
-
document.body.removeChild(elink);
|
|
552
|
+
.then((res) => {
|
|
553
|
+
let blob = new Blob([res.data], {
|
|
554
|
+
type: 'application/octet-stream;charset=UTF-8'
|
|
586
555
|
})
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
556
|
+
let fileName = decodeURI(
|
|
557
|
+
res.headers['content-disposition'].split(';')[1].split('=')[1]
|
|
558
|
+
)
|
|
559
|
+
if (window.navigator.msSaveBlob) {
|
|
560
|
+
// ie
|
|
561
|
+
window.navigator.msSaveOrOpenBlob(blob, fileName)
|
|
562
|
+
return
|
|
563
|
+
}
|
|
564
|
+
let elink = document.createElement('a')
|
|
565
|
+
elink.style.display = 'none'
|
|
566
|
+
elink.href = window.URL.createObjectURL(blob)
|
|
567
|
+
elink.download = '批量下载.zip'
|
|
568
|
+
document.body.appendChild(elink)
|
|
569
|
+
elink.click()
|
|
570
|
+
URL.revokeObjectURL(elink.href)
|
|
571
|
+
document.body.removeChild(elink)
|
|
572
|
+
})
|
|
573
|
+
.catch((error) => {
|
|
574
|
+
console.log('response: ', error)
|
|
575
|
+
})
|
|
590
576
|
} else {
|
|
591
577
|
this.$message({
|
|
592
|
-
type:
|
|
593
|
-
message:
|
|
594
|
-
})
|
|
578
|
+
type: 'warning',
|
|
579
|
+
message: '请选择要下载的附件'
|
|
580
|
+
})
|
|
595
581
|
}
|
|
596
582
|
},
|
|
597
583
|
|
|
@@ -600,46 +586,46 @@ export default {
|
|
|
600
586
|
*/
|
|
601
587
|
batchDelete() {
|
|
602
588
|
if (this.tableSelectionData.length !== 0) {
|
|
603
|
-
this.dialogShowDelete = true
|
|
589
|
+
this.dialogShowDelete = true
|
|
604
590
|
this.$confirmTip({
|
|
605
|
-
type:
|
|
606
|
-
title:
|
|
607
|
-
info:
|
|
591
|
+
type: 'error',
|
|
592
|
+
title: '确认要删除所选附件吗?',
|
|
593
|
+
info: '删除后数据不可恢复',
|
|
608
594
|
button: {
|
|
609
|
-
ok:
|
|
610
|
-
cancel:
|
|
611
|
-
}
|
|
595
|
+
ok: '提交',
|
|
596
|
+
cancel: '取消'
|
|
597
|
+
}
|
|
612
598
|
}).then(() => {
|
|
613
599
|
this.tableData = this.tableData.filter((i) => {
|
|
614
|
-
return !this.tableSelectionData.includes(i)
|
|
615
|
-
})
|
|
600
|
+
return !this.tableSelectionData.includes(i)
|
|
601
|
+
})
|
|
616
602
|
setTimeout(() => {
|
|
617
|
-
this.tableSelectionData = []
|
|
618
|
-
}, 30)
|
|
603
|
+
this.tableSelectionData = []
|
|
604
|
+
}, 30)
|
|
619
605
|
this.$message({
|
|
620
|
-
type:
|
|
621
|
-
message:
|
|
622
|
-
})
|
|
623
|
-
})
|
|
606
|
+
type: 'success',
|
|
607
|
+
message: '删除成功!'
|
|
608
|
+
})
|
|
609
|
+
})
|
|
624
610
|
} else {
|
|
625
611
|
this.$message({
|
|
626
|
-
type:
|
|
627
|
-
message:
|
|
628
|
-
})
|
|
612
|
+
type: 'warning',
|
|
613
|
+
message: '请选择要删除的附件'
|
|
614
|
+
})
|
|
629
615
|
}
|
|
630
616
|
},
|
|
631
617
|
handleConfirmDelete() {
|
|
632
618
|
this.tableData = this.tableData.filter((i) => {
|
|
633
|
-
return !this.tableSelectionData.includes(i)
|
|
634
|
-
})
|
|
619
|
+
return !this.tableSelectionData.includes(i)
|
|
620
|
+
})
|
|
635
621
|
setTimeout(() => {
|
|
636
|
-
this.tableSelectionData = []
|
|
637
|
-
}, 30)
|
|
638
|
-
this.dialogShowDelete = false
|
|
622
|
+
this.tableSelectionData = []
|
|
623
|
+
}, 30)
|
|
624
|
+
this.dialogShowDelete = false
|
|
639
625
|
this.$message({
|
|
640
|
-
type:
|
|
641
|
-
message:
|
|
642
|
-
})
|
|
626
|
+
type: 'success',
|
|
627
|
+
message: '删除成功!'
|
|
628
|
+
})
|
|
643
629
|
},
|
|
644
630
|
|
|
645
631
|
/**
|
|
@@ -647,12 +633,12 @@ export default {
|
|
|
647
633
|
*/
|
|
648
634
|
getFileTypeLabel(type) {
|
|
649
635
|
const t = this.fileTypeList.filter((i) => {
|
|
650
|
-
return Number(type) === Number(i.value)
|
|
651
|
-
})
|
|
636
|
+
return Number(type) === Number(i.value)
|
|
637
|
+
})
|
|
652
638
|
if (t.length === 1) {
|
|
653
|
-
return t[0].label
|
|
639
|
+
return t[0].label
|
|
654
640
|
} else {
|
|
655
|
-
return type
|
|
641
|
+
return type
|
|
656
642
|
}
|
|
657
643
|
},
|
|
658
644
|
|
|
@@ -660,57 +646,58 @@ export default {
|
|
|
660
646
|
* 附件上传
|
|
661
647
|
*/
|
|
662
648
|
httpRequest(fileObj) {
|
|
663
|
-
const isLt2M = fileObj.file.size / 1024 / 1024 < 20
|
|
649
|
+
const isLt2M = fileObj.file.size / 1024 / 1024 < 20
|
|
664
650
|
if (!isLt2M) {
|
|
665
651
|
this.$message({
|
|
666
|
-
message:
|
|
667
|
-
type:
|
|
668
|
-
})
|
|
669
|
-
this.tableData[this.currentUploadIndex].percentage = 75
|
|
670
|
-
this.tableData[this.currentUploadIndex].status =
|
|
671
|
-
this.$emit(
|
|
672
|
-
return
|
|
652
|
+
message: '上传文件大小不能超过 20MB!',
|
|
653
|
+
type: 'warning'
|
|
654
|
+
})
|
|
655
|
+
this.tableData[this.currentUploadIndex].percentage = 75
|
|
656
|
+
this.tableData[this.currentUploadIndex].status = 'exception'
|
|
657
|
+
this.$emit('upload_over', {})
|
|
658
|
+
return
|
|
673
659
|
}
|
|
674
|
-
const that = this
|
|
675
|
-
const formData = new FormData()
|
|
676
|
-
this.tableData[this.currentUploadIndex].fileSize = fileObj.file.size
|
|
660
|
+
const that = this
|
|
661
|
+
const formData = new FormData()
|
|
662
|
+
this.tableData[this.currentUploadIndex].fileSize = fileObj.file.size
|
|
677
663
|
// this.tableData[this.currentUploadIndex].fileName = fileObj.file.name
|
|
678
|
-
this.tableData[this.currentUploadIndex].type = fileObj.file.type
|
|
664
|
+
this.tableData[this.currentUploadIndex].type = fileObj.file.type
|
|
679
665
|
|
|
680
|
-
formData.append(
|
|
666
|
+
formData.append('file', fileObj.file)
|
|
681
667
|
axios(`${this.url}/upload`, formData, {
|
|
682
|
-
onUploadProgress: progressEvent => {
|
|
683
|
-
let percent = (progressEvent.loaded / progressEvent.total * 100) | 0
|
|
668
|
+
onUploadProgress: (progressEvent) => {
|
|
669
|
+
let percent = ((progressEvent.loaded / progressEvent.total) * 100) | 0
|
|
684
670
|
// 调用onProgress方法来显示进度条,需要传递个对象 percent为进度值
|
|
685
|
-
that.tableData[this.currentUploadIndex].percentage = percent
|
|
671
|
+
that.tableData[this.currentUploadIndex].percentage = percent
|
|
686
672
|
}
|
|
687
|
-
})
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
})
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
})
|
|
673
|
+
})
|
|
674
|
+
.then((res) => {
|
|
675
|
+
// 上传成功
|
|
676
|
+
// that.tableData[this.currentUploadIndex].percentage = 100
|
|
677
|
+
console.log('上传文件1111', res)
|
|
678
|
+
this.tableData[this.currentUploadIndex].time = parseTime(
|
|
679
|
+
res[0][`time`],
|
|
680
|
+
'{y}-{m}-{d} {h}:{i}:{s}'
|
|
681
|
+
)
|
|
682
|
+
this.tableData[this.currentUploadIndex].uuid = res[0][`uuid`]
|
|
683
|
+
this.tableData[this.currentUploadIndex].status = 'success'
|
|
684
|
+
this.tableData[this.currentUploadIndex].user = res[0][`user`]
|
|
685
|
+
this.tableData[this.currentUploadIndex].creator = res[0][`creator`]
|
|
686
|
+
res[0][`createTime`] = parseTime(
|
|
687
|
+
res[0][`createTime`],
|
|
688
|
+
'{y}-{m}-{d} {h}:{i}:{s}'
|
|
689
|
+
)
|
|
690
|
+
this.tableData[this.currentUploadIndex].createTime =
|
|
691
|
+
res[0][`createTime`]
|
|
692
|
+
this.$emit('upload_over', {})
|
|
693
|
+
})
|
|
694
|
+
.catch(() => {
|
|
695
|
+
// 上传失败
|
|
696
|
+
// this.resetUpload(this.currentUploadIndex)
|
|
697
|
+
that.tableData[this.currentUploadIndex].percentage = 75
|
|
698
|
+
this.tableData[this.currentUploadIndex].status = 'exception'
|
|
699
|
+
this.$emit('upload_over', {})
|
|
700
|
+
})
|
|
714
701
|
// setTimeout(function () {
|
|
715
702
|
// //去调用了这个cancel()方法,没有完成请求的接口便会停止请求
|
|
716
703
|
// self.cancel()
|
|
@@ -722,9 +709,9 @@ export default {
|
|
|
722
709
|
*/
|
|
723
710
|
handleExceed() {
|
|
724
711
|
this.$message({
|
|
725
|
-
type:
|
|
726
|
-
message:
|
|
727
|
-
})
|
|
712
|
+
type: 'error',
|
|
713
|
+
message: '最多只能选择一个文件'
|
|
714
|
+
})
|
|
728
715
|
},
|
|
729
716
|
|
|
730
717
|
/**
|
|
@@ -739,39 +726,39 @@ export default {
|
|
|
739
726
|
// });
|
|
740
727
|
// return false
|
|
741
728
|
// }
|
|
742
|
-
this.tableData[index].fileObj = file
|
|
743
|
-
this.tableData[index].fileName = file.name
|
|
744
|
-
this.tableData[index].user =
|
|
745
|
-
this.tableData[index].percentage = 0
|
|
746
|
-
this.tableData[index].uuid =
|
|
729
|
+
this.tableData[index].fileObj = file
|
|
730
|
+
this.tableData[index].fileName = file.name
|
|
731
|
+
this.tableData[index].user = ''
|
|
732
|
+
this.tableData[index].percentage = 0
|
|
733
|
+
this.tableData[index].uuid = ''
|
|
747
734
|
if (fileLists.length > 1) {
|
|
748
|
-
fileLists.splice(0, 1)
|
|
735
|
+
fileLists.splice(0, 1)
|
|
749
736
|
}
|
|
750
737
|
|
|
751
|
-
this.tableSelectionData2 = []
|
|
752
|
-
this.tableSelectionData2.push(this.tableData[index])
|
|
753
|
-
this.validFile(index)
|
|
738
|
+
this.tableSelectionData2 = []
|
|
739
|
+
this.tableSelectionData2.push(this.tableData[index])
|
|
740
|
+
this.validFile(index)
|
|
754
741
|
},
|
|
755
742
|
|
|
756
743
|
/**
|
|
757
744
|
* 获取当前上传的文件的index
|
|
758
745
|
*/
|
|
759
746
|
getUploadIndex(index) {
|
|
760
|
-
this.currentUploadIndex = index
|
|
747
|
+
this.currentUploadIndex = index
|
|
761
748
|
},
|
|
762
749
|
|
|
763
750
|
strLen(str) {
|
|
764
|
-
let len = 0
|
|
751
|
+
let len = 0
|
|
765
752
|
for (let i = 0; i < str.length; i++) {
|
|
766
|
-
let c = str.charCodeAt(i)
|
|
753
|
+
let c = str.charCodeAt(i)
|
|
767
754
|
//单字节加1
|
|
768
|
-
if ((c >= 0x0001 && c <= 0x007e) || (
|
|
769
|
-
len
|
|
755
|
+
if ((c >= 0x0001 && c <= 0x007e) || (c >= 0xff60 && c <= 0xff9f)) {
|
|
756
|
+
len++
|
|
770
757
|
} else {
|
|
771
|
-
len += 3
|
|
758
|
+
len += 3
|
|
772
759
|
}
|
|
773
760
|
}
|
|
774
|
-
return len
|
|
761
|
+
return len
|
|
775
762
|
},
|
|
776
763
|
|
|
777
764
|
/**
|
|
@@ -783,31 +770,31 @@ export default {
|
|
|
783
770
|
// }
|
|
784
771
|
let t = this.tableSelectionData2.filter((item) => {
|
|
785
772
|
// return this.strLen(item.fileName) > 60;
|
|
786
|
-
return item.fileName.length > 60
|
|
787
|
-
})
|
|
773
|
+
return item.fileName.length > 60
|
|
774
|
+
})
|
|
788
775
|
if (t.length) {
|
|
789
776
|
this.$message({
|
|
790
|
-
type:
|
|
791
|
-
message:
|
|
792
|
-
})
|
|
777
|
+
type: 'error',
|
|
778
|
+
message: '文件名不能超过64个字,请重新上传!'
|
|
779
|
+
})
|
|
793
780
|
// this.tableData[index].status = 'exception';
|
|
794
|
-
return null
|
|
781
|
+
return null
|
|
795
782
|
}
|
|
796
783
|
let temp = this.tableSelectionData2.filter((item) => {
|
|
797
|
-
const names = item.fileName ? item.fileName.split(
|
|
798
|
-
let nameType = names.length ? names[names.length - 1] :
|
|
799
|
-
return [
|
|
800
|
-
})
|
|
784
|
+
const names = item.fileName ? item.fileName.split('.') : []
|
|
785
|
+
let nameType = names.length ? names[names.length - 1] : ''
|
|
786
|
+
return ['exe', 'bin'].includes(nameType)
|
|
787
|
+
})
|
|
801
788
|
if (temp.length) {
|
|
802
789
|
this.$message({
|
|
803
|
-
type:
|
|
804
|
-
message:
|
|
805
|
-
})
|
|
806
|
-
this.tableData[index].fileName =
|
|
807
|
-
return null
|
|
790
|
+
type: 'error',
|
|
791
|
+
message: '暂不支持 .exe, .bin等格式文件格式上传!'
|
|
792
|
+
})
|
|
793
|
+
this.tableData[index].fileName = ''
|
|
794
|
+
return null
|
|
808
795
|
}
|
|
809
|
-
this.tableData[index].percentage = 50
|
|
810
|
-
this.submitFile()
|
|
796
|
+
this.tableData[index].percentage = 50
|
|
797
|
+
this.submitFile()
|
|
811
798
|
},
|
|
812
799
|
|
|
813
800
|
/**
|
|
@@ -815,92 +802,83 @@ export default {
|
|
|
815
802
|
*/
|
|
816
803
|
submitFile() {
|
|
817
804
|
// 获得将要上传的文件
|
|
818
|
-
const uploadFileArr = []
|
|
805
|
+
const uploadFileArr = []
|
|
819
806
|
this.tableSelectionData2.map((item) => {
|
|
820
807
|
// 没有上传文件 并且选择了文件
|
|
821
808
|
if (!item.uuid && item.fileObj) {
|
|
822
809
|
uploadFileArr.push({
|
|
823
810
|
ref_index: this.tableData.findIndex(
|
|
824
|
-
|
|
811
|
+
(objitem) => objitem.id === item.id
|
|
825
812
|
),
|
|
826
|
-
data: item
|
|
827
|
-
})
|
|
813
|
+
data: item
|
|
814
|
+
})
|
|
828
815
|
}
|
|
829
|
-
})
|
|
816
|
+
})
|
|
830
817
|
// 执行
|
|
831
818
|
uploadFileArr.length &&
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
819
|
+
this.uploadAction(uploadFileArr).then(() => {
|
|
820
|
+
console.log('上传文件完成')
|
|
821
|
+
})
|
|
835
822
|
},
|
|
836
823
|
|
|
837
824
|
/**
|
|
838
825
|
* 文件上传动作
|
|
839
826
|
*/
|
|
840
827
|
uploadAction(fileArr) {
|
|
841
|
-
let uploadedLength = 0
|
|
828
|
+
let uploadedLength = 0
|
|
842
829
|
return new Promise((resolve) => {
|
|
843
830
|
// 启动上传
|
|
844
|
-
uploadedLength
|
|
845
|
-
this.currentUploadIndex = fileArr[0].ref_index
|
|
831
|
+
uploadedLength++
|
|
832
|
+
this.currentUploadIndex = fileArr[0].ref_index
|
|
846
833
|
this.$refs[
|
|
847
|
-
|
|
848
|
-
|
|
834
|
+
`nstc_g6_common_upload_index_${this.currentUploadIndex}`
|
|
835
|
+
].submit()
|
|
849
836
|
|
|
850
837
|
// 监听上传完毕
|
|
851
|
-
this.$on(
|
|
838
|
+
this.$on('upload_over', () => {
|
|
852
839
|
if (uploadedLength === fileArr.length) {
|
|
853
|
-
resolve()
|
|
840
|
+
resolve()
|
|
854
841
|
} else {
|
|
855
|
-
uploadedLength
|
|
856
|
-
this.currentUploadIndex = fileArr[uploadedLength - 1].ref_index
|
|
842
|
+
uploadedLength++
|
|
843
|
+
this.currentUploadIndex = fileArr[uploadedLength - 1].ref_index
|
|
857
844
|
this.$refs[
|
|
858
|
-
|
|
859
|
-
|
|
845
|
+
`nstc_g6_common_upload_index_${this.currentUploadIndex}`
|
|
846
|
+
].submit()
|
|
860
847
|
}
|
|
861
|
-
})
|
|
862
|
-
})
|
|
848
|
+
})
|
|
849
|
+
})
|
|
863
850
|
},
|
|
864
851
|
|
|
865
852
|
/**
|
|
866
853
|
* 重置
|
|
867
854
|
*/
|
|
868
855
|
resetUpload(index) {
|
|
869
|
-
this.$refs[`nstc_upload_index_${index}`].clearFiles()
|
|
870
|
-
this.tableData[index].fileName =
|
|
871
|
-
this.tableData[index].fileSize =
|
|
872
|
-
this.tableData[index].percentage = 0
|
|
873
|
-
this.tableData[index].fileType = 1
|
|
874
|
-
this.tableData[index].fileFormat =
|
|
875
|
-
this.tableData[index].remark =
|
|
876
|
-
this.tableData[index].state =
|
|
877
|
-
this.tableData[index].createTime =
|
|
878
|
-
this.tableData[index].uuid =
|
|
856
|
+
this.$refs[`nstc_upload_index_${index}`].clearFiles()
|
|
857
|
+
this.tableData[index].fileName = ''
|
|
858
|
+
this.tableData[index].fileSize = ''
|
|
859
|
+
this.tableData[index].percentage = 0
|
|
860
|
+
this.tableData[index].fileType = 1
|
|
861
|
+
this.tableData[index].fileFormat = ''
|
|
862
|
+
this.tableData[index].remark = ''
|
|
863
|
+
this.tableData[index].state = '1'
|
|
864
|
+
this.tableData[index].createTime = ''
|
|
865
|
+
this.tableData[index].uuid = ''
|
|
879
866
|
},
|
|
880
867
|
|
|
881
868
|
/**
|
|
882
869
|
* 发生错误重新上传
|
|
883
870
|
*/
|
|
884
871
|
reUploadAction(index) {
|
|
885
|
-
console.log(
|
|
872
|
+
console.log('附件上传', index)
|
|
886
873
|
// this.tableData[index].percentage = 0;
|
|
887
874
|
// this.tableData[index].percentage = 50;
|
|
888
|
-
this.$refs[`nstc_g6_common_upload_index_${index}`].submit()
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
this.showProgress = false;
|
|
893
|
-
},
|
|
894
|
-
updated() {
|
|
895
|
-
setTimeout(() => {
|
|
896
|
-
this.showProgress = true;
|
|
897
|
-
}, 1);
|
|
898
|
-
},
|
|
899
|
-
};
|
|
875
|
+
this.$refs[`nstc_g6_common_upload_index_${index}`].submit()
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
}
|
|
900
879
|
</script>
|
|
901
880
|
|
|
902
881
|
<style lang="scss">
|
|
903
|
-
|
|
904
882
|
.nstc-file-upload {
|
|
905
883
|
.input-upload {
|
|
906
884
|
height: 100%;
|
|
@@ -927,7 +905,7 @@ export default {
|
|
|
927
905
|
.is-success {
|
|
928
906
|
.el-icon-circle-check {
|
|
929
907
|
&:before {
|
|
930
|
-
content:
|
|
908
|
+
content: '\e79c';
|
|
931
909
|
}
|
|
932
910
|
}
|
|
933
911
|
}
|
|
@@ -935,7 +913,7 @@ export default {
|
|
|
935
913
|
.is-exception {
|
|
936
914
|
.el-icon-circle-close {
|
|
937
915
|
&:before {
|
|
938
|
-
content:
|
|
916
|
+
content: '\e79d';
|
|
939
917
|
}
|
|
940
918
|
}
|
|
941
919
|
}
|