n20-common-lib 1.2.43 → 1.2.44
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/README.md +2 -2
- package/package.json +88 -88
- package/src/_qiankun/index.js +113 -113
- package/src/_qiankun/postMessage.js +48 -48
- package/src/assets/css/_coreLib.scss +35 -35
- package/src/assets/css/cl-anchor.scss +23 -23
- package/src/assets/css/cl-approve-card.scss +58 -58
- package/src/assets/css/cl-dialog.scss +99 -99
- package/src/assets/css/cl-drag-list.scss +22 -22
- package/src/assets/css/cl-empty.scss +10 -10
- package/src/assets/css/cl-expandable-pane.scss +26 -26
- package/src/assets/css/cl-expandable.scss +24 -24
- package/src/assets/css/cl-file-upload-table.scss +11 -11
- package/src/assets/css/cl-filter.scss +4 -4
- package/src/assets/css/cl-flow-step.scss +185 -185
- package/src/assets/css/cl-footer-box.scss +10 -10
- package/src/assets/css/cl-form-item.scss +612 -612
- package/src/assets/css/cl-general-card.scss +11 -11
- package/src/assets/css/cl-layout-aside.scss +92 -92
- package/src/assets/css/cl-layout-content.scss +16 -16
- package/src/assets/css/cl-layout-header.scss +73 -73
- package/src/assets/css/cl-layout-tabs.scss +87 -87
- package/src/assets/css/cl-layout.scss +97 -97
- package/src/assets/css/cl-login-temporary.scss +37 -37
- package/src/assets/css/cl-message.scss +75 -75
- package/src/assets/css/cl-more-tab.scss +98 -98
- package/src/assets/css/cl-nav-menu.scss +5 -5
- package/src/assets/css/cl-pagination.scss +128 -128
- package/src/assets/css/cl-secondary-tab.scss +53 -53
- package/src/assets/css/cl-showcolumn.scss +23 -23
- package/src/assets/css/cl-sifting.scss +51 -51
- package/src/assets/css/cl-statis.scss +42 -42
- package/src/assets/css/cl-step.scss +73 -73
- package/src/assets/css/cl-suspend.scss +19 -19
- package/src/assets/css/cl-tertiary-tab.scss +54 -54
- package/src/assets/css/cl-upload.scss +41 -41
- package/src/assets/css/cl-worn-pagination.scss +50 -50
- package/src/assets/css/el-button.scss +173 -173
- package/src/assets/css/el-table.scss +79 -79
- package/src/assets/css/element-variables.scss +1061 -1061
- package/src/assets/css/element.dev.scss +21 -21
- package/src/assets/css/font-icon.scss +27 -27
- package/src/assets/css/index.dev.scss +4 -4
- package/src/assets/css/index.scss +11 -11
- package/src/assets/css/normalize.scss +726 -726
- package/src/assets/css/rootvar.scss +139 -139
- package/src/assets/css/select.scss +25 -25
- package/src/assets/css/title-pop.scss +4 -4
- package/src/assets/getJsonc.js +50 -50
- package/src/assets/realUrl.js +12 -12
- package/src/components/.DS_Store +0 -0
- package/src/components/Anchor/AnchorItem.vue +29 -29
- package/src/components/Anchor/index.vue +185 -185
- package/src/components/ApprovalButtons/index.vue +233 -233
- package/src/components/ApprovalCard/index.vue +128 -128
- package/src/components/ApprovalRecord/approvalImg.vue +44 -44
- package/src/components/ApprovalRecord/flowDialog.vue +45 -45
- package/src/components/ApprovalRecord/index.vue +59 -59
- package/src/components/Button/button-group.vue +150 -150
- package/src/components/Button/icon-group-button.vue +61 -61
- package/src/components/Button/index.vue +56 -56
- package/src/components/CascaderArea/index.vue +103 -103
- package/src/components/ContentLoading/index.vue +41 -41
- package/src/components/ContentNull/index.vue +19 -19
- package/src/components/DatePicker/index.vue +27 -27
- package/src/components/DatePicker/por.vue +169 -169
- package/src/components/Dialog/index.vue +26 -26
- package/src/components/Dialog/indexO.vue +116 -116
- package/src/components/DragList/index.vue +75 -75
- package/src/components/Empty/.DS_Store +0 -0
- package/src/components/Empty/img/.DS_Store +0 -0
- package/src/components/Empty/img/abnormal.svg +108 -108
- package/src/components/Empty/img/dispose.svg +71 -71
- package/src/components/Empty/img/empty.svg +57 -57
- package/src/components/Empty/img/general.svg +58 -58
- package/src/components/Empty/img/lock.svg +57 -57
- package/src/components/Empty/img/network.svg +59 -59
- package/src/components/Empty/img/relevant.svg +68 -68
- package/src/components/Empty/img/search.svg +72 -72
- package/src/components/Empty/index.vue +92 -92
- package/src/components/Expandable/index.vue +49 -49
- package/src/components/Expandable/main.vue +52 -52
- package/src/components/FileExportAsync/index.vue +178 -178
- package/src/components/FileUploadTable/index.vue +484 -484
- package/src/components/Filters/index.vue +371 -371
- package/src/components/Filters/indexO.vue +104 -104
- package/src/components/FlowStep/index.vue +68 -68
- package/src/components/FooterBox/index.vue +21 -21
- package/src/components/GeneralCard/index.vue +15 -15
- package/src/components/InputNumber/index.vue +169 -169
- package/src/components/InputNumber/numberRange.vue +47 -47
- package/src/components/InputSearch/index.vue +75 -75
- package/src/components/Layout/.DS_Store +0 -0
- package/src/components/Layout/AsideNav/index.vue +120 -120
- package/src/components/Layout/AsideNav/menuItem.vue +34 -34
- package/src/components/Layout/AsideNav/submenuTitle.vue +26 -26
- package/src/components/Layout/HeaderWrap/changePwd.vue +215 -215
- package/src/components/Layout/HeaderWrap/index.vue +371 -371
- package/src/components/Layout/HeaderWrap/noticePop.vue +316 -316
- package/src/components/Layout/SubContent/index.vue +127 -127
- package/src/components/Layout/TabsNav/index.vue +170 -170
- package/src/components/Layout/index.vue +518 -518
- package/src/components/Layout/utils.js +12 -12
- package/src/components/LoginTemporary/form.vue +566 -566
- package/src/components/LoginTemporary/index.vue +139 -139
- package/src/components/LoginTemporary/qrcode.vue +90 -90
- package/src/components/LoginTemporary/retrievePw.vue +372 -372
- package/src/components/LoginTemporary/utils.js +73 -73
- package/src/components/MicroApp/index.js +67 -67
- package/src/components/MicroFrame/index.vue +95 -95
- package/src/components/MoreTab/index.vue +232 -232
- package/src/components/NavMenu/index.vue +60 -60
- package/src/components/NstcG6Components/.DS_Store +0 -0
- package/src/components/PageLayout/page.vue +15 -15
- package/src/components/Pagination/index.vue +165 -165
- package/src/components/SecondaryTab/index.vue +58 -58
- package/src/components/SelectLazy/index.vue +75 -75
- package/src/components/SelectTree/SelectTreeLazy.vue +241 -241
- package/src/components/SelectTree/index.vue +205 -205
- package/src/components/ShowColumn/index.vue +213 -213
- package/src/components/Sifting/index.vue +99 -99
- package/src/components/Statis/index.vue +97 -97
- package/src/components/Statis/statisItem.vue +54 -54
- package/src/components/Statis/statisPopover.vue +55 -55
- package/src/components/Step/index.vue +38 -38
- package/src/components/Suspend/index.vue +72 -72
- package/src/components/Table/index.vue +209 -209
- package/src/components/Table/indexO.vue +149 -149
- package/src/components/Task/index.vue +26 -26
- package/src/components/TertiaryTab/index.vue +63 -63
- package/src/components/TimePicker/index.vue +28 -28
- package/src/components/Upload/index.vue +242 -242
- package/src/components/WornPagination/index.vue +73 -73
- package/src/directives/VClickOutside/index.js +19 -19
- package/src/directives/VHas/index.js +58 -58
- package/src/directives/VMove/index.js +42 -42
- package/src/directives/VTitle/index.js +69 -69
- package/src/directives/VTitle/tooltip.vue +21 -21
- package/src/index.js +232 -232
- package/src/plugins/CompatibleOld/index.js +57 -57
- package/src/plugins/Print/index.js +4 -4
- package/src/plugins/Print/print-js/.babelrc +12 -12
- package/src/plugins/Print/print-js/LICENSE +21 -21
- package/src/plugins/Print/print-js/README.md +98 -98
- package/src/plugins/Print/print-js/dist/print.css +96 -96
- package/src/plugins/Print/print-js/dist/print.js +990 -990
- package/src/plugins/Print/print-js/package.json +60 -60
- package/src/plugins/Print/print-js/src/index.d.ts +45 -45
- package/src/plugins/Print/print-js/src/index.js +10 -10
- package/src/plugins/Print/print-js/src/js/browser.js +33 -33
- package/src/plugins/Print/print-js/src/js/functions.js +103 -103
- package/src/plugins/Print/print-js/src/js/html.js +70 -70
- package/src/plugins/Print/print-js/src/js/image.js +48 -48
- package/src/plugins/Print/print-js/src/js/init.js +168 -168
- package/src/plugins/Print/print-js/src/js/json.js +109 -109
- package/src/plugins/Print/print-js/src/js/modal.js +62 -62
- package/src/plugins/Print/print-js/src/js/pdf.js +62 -62
- package/src/plugins/Print/print-js/src/js/print.js +102 -102
- package/src/plugins/Print/print-js/src/js/raw-html.js +15 -15
- package/src/plugins/Print/print-js/src/sass/index.scss +13 -13
- package/src/plugins/Print/print-js/src/sass/modules/_colors.scss +9 -9
- package/src/plugins/Print/print-js/src/sass/partials/_modal.scss +40 -40
- package/src/plugins/Print/print-js/src/sass/partials/_spinner.scss +45 -45
- package/src/plugins/Print/print.js +2 -2
- package/src/plugins/Print/print.scss +1 -1
- package/src/plugins/SetMenuTree/index.vue +41 -41
- package/src/plugins/SetMenuTree/logoIcon.vue +37 -37
- package/src/plugins/SetMenuTree/setmenutree.vue +427 -427
- package/src/plugins/SetMenuTree/utils.js +74 -74
- package/src/plugins/Sign/InfosecNetSignCNGAgent.min.js +2000 -2000
- package/src/plugins/Sign/index.js +65 -65
- package/src/plugins/Sign/sign.js +1 -1
- package/src/plugins/setTabsForSub.js +2 -2
- package/src/utils/auth.js +53 -53
- package/src/utils/axios.js +203 -203
- package/src/utils/downloadBlob.js +19 -19
- package/src/utils/forEachs.js +16 -16
- package/src/utils/getScrollContainer.js +43 -43
- package/src/utils/i18n/cn2hk.json +1270 -1270
- package/src/utils/i18n/index.js +50 -50
- package/src/utils/list2tree.js +36 -36
- package/src/utils/msgboxPor.js +26 -26
- package/src/utils/print.js +161 -161
- package/src/utils/relaNo.js +72 -72
- package/src/utils/repairElementUI.js +95 -95
- package/src/utils/urlToGo.js +82 -82
- package/style/css/normalize.scss +0 -726
- package/style/fonts/element-icons.535877f5.woff +0 -0
- package/style/fonts/element-icons.732389de.ttf +0 -0
- package/style/fonts/iconfont.022f36c4.woff2 +0 -0
- package/style/fonts/iconfont.4a1b2c93.woff +0 -0
- package/style/fonts/iconfont.a9febaa2.ttf +0 -0
- package/style/index.css +0 -4
- package/style/index.css.map +0 -1
- package/style/index.umd.min.js +0 -2
- package/style/index.umd.min.js.map +0 -1
- package/style/pageDemo/demo-1.vue +0 -131
- package/style/pageDemo/demo-2.vue +0 -35
- package/style/pageDemo/demo-3.vue +0 -22
- package/style/pageDemo/seeCode.js +0 -20
- package/style/server-config.jsonc +0 -606
|
@@ -1,242 +1,242 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-upload
|
|
3
|
-
ref="upload"
|
|
4
|
-
:action="action"
|
|
5
|
-
:headers="headers"
|
|
6
|
-
:accept="accept"
|
|
7
|
-
:multiple="false"
|
|
8
|
-
:file-list="fileList"
|
|
9
|
-
:show-file-list="false"
|
|
10
|
-
v-bind="$attrs"
|
|
11
|
-
:on-success="successFn"
|
|
12
|
-
:on-error="errorFn"
|
|
13
|
-
:on-progress="progressFn"
|
|
14
|
-
:before-upload="beforeUploadFn"
|
|
15
|
-
v-on="$listeners"
|
|
16
|
-
>
|
|
17
|
-
<template slot="trigger">
|
|
18
|
-
<slot name="trigger">
|
|
19
|
-
<el-input
|
|
20
|
-
:value="fileNameC"
|
|
21
|
-
:placeholder="placeholder"
|
|
22
|
-
readonly
|
|
23
|
-
:disabled="$attrs.disabled"
|
|
24
|
-
>
|
|
25
|
-
<template slot="suffix">
|
|
26
|
-
<i
|
|
27
|
-
v-if="fileNameC && showClear"
|
|
28
|
-
class="el-input__icon upload-clear el-icon-close"
|
|
29
|
-
style="pointer-events: all"
|
|
30
|
-
@click.stop="clearFile"
|
|
31
|
-
></i>
|
|
32
|
-
<i v-else class="el-input__icon n20-icon-shangchuan"></i>
|
|
33
|
-
</template>
|
|
34
|
-
</el-input>
|
|
35
|
-
</slot>
|
|
36
|
-
</template>
|
|
37
|
-
<template slot="tip">
|
|
38
|
-
<slot name="tip"></slot>
|
|
39
|
-
</template>
|
|
40
|
-
<el-dialog :visible.sync="progressV" title="提示" append-to-body>
|
|
41
|
-
<p v-if="!percentType">系统处理中,请稍等......</p>
|
|
42
|
-
<p v-else>{{ percentMsg }}</p>
|
|
43
|
-
<el-progress class="m-b" :percentage="percent" :status="percentType" />
|
|
44
|
-
</el-dialog>
|
|
45
|
-
</el-upload>
|
|
46
|
-
</template>
|
|
47
|
-
|
|
48
|
-
<script>
|
|
49
|
-
export default {
|
|
50
|
-
name: 'Upload',
|
|
51
|
-
props: {
|
|
52
|
-
fileName: {
|
|
53
|
-
type: String,
|
|
54
|
-
default: ''
|
|
55
|
-
},
|
|
56
|
-
fileUrl: {
|
|
57
|
-
type: String,
|
|
58
|
-
default: ''
|
|
59
|
-
},
|
|
60
|
-
placeholder: {
|
|
61
|
-
type: String,
|
|
62
|
-
default: '请选择文件'
|
|
63
|
-
},
|
|
64
|
-
msgType: {
|
|
65
|
-
type: String,
|
|
66
|
-
default: 'dialog'
|
|
67
|
-
},
|
|
68
|
-
action: {
|
|
69
|
-
type: String,
|
|
70
|
-
default: '/bems/1.0/attach'
|
|
71
|
-
},
|
|
72
|
-
headers: {
|
|
73
|
-
type: Object,
|
|
74
|
-
default: () => ({
|
|
75
|
-
token: window.sessionStorage.getItem('token') || 'main-token'
|
|
76
|
-
})
|
|
77
|
-
},
|
|
78
|
-
size: {
|
|
79
|
-
type: [String, Number],
|
|
80
|
-
default: undefined
|
|
81
|
-
},
|
|
82
|
-
accept: {
|
|
83
|
-
type: String,
|
|
84
|
-
default: undefined
|
|
85
|
-
},
|
|
86
|
-
onRemove: {
|
|
87
|
-
type: Function,
|
|
88
|
-
default: undefined
|
|
89
|
-
},
|
|
90
|
-
onProgress: {
|
|
91
|
-
type: Function,
|
|
92
|
-
default: undefined
|
|
93
|
-
},
|
|
94
|
-
onSuccess: {
|
|
95
|
-
type: Function,
|
|
96
|
-
default: undefined
|
|
97
|
-
},
|
|
98
|
-
onError: {
|
|
99
|
-
type: Function,
|
|
100
|
-
default: undefined
|
|
101
|
-
},
|
|
102
|
-
beforeUpload: {
|
|
103
|
-
type: Function,
|
|
104
|
-
default: undefined
|
|
105
|
-
},
|
|
106
|
-
showClear: {
|
|
107
|
-
type: Boolean,
|
|
108
|
-
default: true
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
data() {
|
|
112
|
-
return {
|
|
113
|
-
fileList: [],
|
|
114
|
-
percent: 0,
|
|
115
|
-
percentMsg: '',
|
|
116
|
-
progressV: false,
|
|
117
|
-
percentType: undefined
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
computed: {
|
|
121
|
-
fileNameC: {
|
|
122
|
-
get() {
|
|
123
|
-
return this.fileName
|
|
124
|
-
},
|
|
125
|
-
set(v) {
|
|
126
|
-
this.$emit('update:fileName', v)
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
fileUrlC: {
|
|
130
|
-
get() {
|
|
131
|
-
return this.fileUrl
|
|
132
|
-
},
|
|
133
|
-
set(v) {
|
|
134
|
-
this.$emit('update:fileUrl', v)
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
methods: {
|
|
139
|
-
clearFile() {
|
|
140
|
-
if (this.onRemove) {
|
|
141
|
-
this.onRemove(this.fileList[0], this.fileList)
|
|
142
|
-
} else {
|
|
143
|
-
this.fileNameC = ''
|
|
144
|
-
this.fileUrlC = ''
|
|
145
|
-
this.fileList.pop()
|
|
146
|
-
console.log('删除上传')
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
beforeUploadFn(file) {
|
|
150
|
-
let size = this.size
|
|
151
|
-
let sizeNum
|
|
152
|
-
|
|
153
|
-
if (size) {
|
|
154
|
-
if (/kb/i.test(size)) {
|
|
155
|
-
sizeNum = parseFloat(size) * 1024
|
|
156
|
-
} else if (/mb/i.test(size)) {
|
|
157
|
-
sizeNum = parseFloat(size) * 1024 * 1024
|
|
158
|
-
} else {
|
|
159
|
-
sizeNum = parseFloat(size)
|
|
160
|
-
}
|
|
161
|
-
if (file.size > sizeNum) {
|
|
162
|
-
this.$message.error('文件大小不能超过 ' + size + ' !')
|
|
163
|
-
return false
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
let accept = this.accept
|
|
168
|
-
if (accept) {
|
|
169
|
-
let [ftB = '', ftA = ''] = file.type.split('/')
|
|
170
|
-
ftB = ftB + '/*'
|
|
171
|
-
ftA = file.name.match(/\.[^.]+$/)?.[0] || '.' + ftA
|
|
172
|
-
if (!(accept.includes(ftB) || accept.includes(ftA))) {
|
|
173
|
-
this.$message.error('文件格式错误 !')
|
|
174
|
-
return false
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
if (this.msgType === 'dialog') {
|
|
179
|
-
this.percent = 0
|
|
180
|
-
this.percentType = undefined
|
|
181
|
-
this.progressV = true
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
if (this.beforeUpload) {
|
|
185
|
-
return this.beforeUpload(file)
|
|
186
|
-
} else {
|
|
187
|
-
return
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
progressFn(event, file, fileList) {
|
|
191
|
-
if (this.onProgress) {
|
|
192
|
-
this.onProgress(event, file, fileList)
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
if (this.msgType === 'dialog') {
|
|
196
|
-
this.percent = event.percent <= 99 ? Math.round(event.percent) : 99
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
successFn(response, file, fileList) {
|
|
200
|
-
if (this.onSuccess) {
|
|
201
|
-
this.onSuccess(response, file, fileList)
|
|
202
|
-
} else {
|
|
203
|
-
this.fileNameC = file.name
|
|
204
|
-
this.fileUrlC = response.data
|
|
205
|
-
this.fileList = [file]
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
if (this.msgType === 'dialog') {
|
|
209
|
-
this.percent = 100
|
|
210
|
-
this.percentType = 'success'
|
|
211
|
-
this.percentMsg = response.msg || '上传成功!'
|
|
212
|
-
} else if (this.msgType === 'message') {
|
|
213
|
-
if (!this.onSuccess) {
|
|
214
|
-
this.$message({
|
|
215
|
-
type: 'success',
|
|
216
|
-
message: response.msg,
|
|
217
|
-
showClose: true
|
|
218
|
-
})
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
},
|
|
222
|
-
errorFn(err, file, fileList) {
|
|
223
|
-
if (this.onError) {
|
|
224
|
-
this.onError(err, file, fileList)
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
if (this.msgType === 'dialog') {
|
|
228
|
-
this.percentType = 'exception'
|
|
229
|
-
this.percentMsg = err?.msg || '上传失败!'
|
|
230
|
-
} else if (this.msgType === 'message') {
|
|
231
|
-
if (!this.onError) {
|
|
232
|
-
this.$message({
|
|
233
|
-
type: 'error',
|
|
234
|
-
message: err?.msg || '上传失败',
|
|
235
|
-
showClose: true
|
|
236
|
-
})
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<el-upload
|
|
3
|
+
ref="upload"
|
|
4
|
+
:action="action"
|
|
5
|
+
:headers="headers"
|
|
6
|
+
:accept="accept"
|
|
7
|
+
:multiple="false"
|
|
8
|
+
:file-list="fileList"
|
|
9
|
+
:show-file-list="false"
|
|
10
|
+
v-bind="$attrs"
|
|
11
|
+
:on-success="successFn"
|
|
12
|
+
:on-error="errorFn"
|
|
13
|
+
:on-progress="progressFn"
|
|
14
|
+
:before-upload="beforeUploadFn"
|
|
15
|
+
v-on="$listeners"
|
|
16
|
+
>
|
|
17
|
+
<template slot="trigger">
|
|
18
|
+
<slot name="trigger">
|
|
19
|
+
<el-input
|
|
20
|
+
:value="fileNameC"
|
|
21
|
+
:placeholder="placeholder"
|
|
22
|
+
readonly
|
|
23
|
+
:disabled="$attrs.disabled"
|
|
24
|
+
>
|
|
25
|
+
<template slot="suffix">
|
|
26
|
+
<i
|
|
27
|
+
v-if="fileNameC && showClear"
|
|
28
|
+
class="el-input__icon upload-clear el-icon-close"
|
|
29
|
+
style="pointer-events: all"
|
|
30
|
+
@click.stop="clearFile"
|
|
31
|
+
></i>
|
|
32
|
+
<i v-else class="el-input__icon n20-icon-shangchuan"></i>
|
|
33
|
+
</template>
|
|
34
|
+
</el-input>
|
|
35
|
+
</slot>
|
|
36
|
+
</template>
|
|
37
|
+
<template slot="tip">
|
|
38
|
+
<slot name="tip"></slot>
|
|
39
|
+
</template>
|
|
40
|
+
<el-dialog :visible.sync="progressV" title="提示" append-to-body>
|
|
41
|
+
<p v-if="!percentType">系统处理中,请稍等......</p>
|
|
42
|
+
<p v-else>{{ percentMsg }}</p>
|
|
43
|
+
<el-progress class="m-b" :percentage="percent" :status="percentType" />
|
|
44
|
+
</el-dialog>
|
|
45
|
+
</el-upload>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<script>
|
|
49
|
+
export default {
|
|
50
|
+
name: 'Upload',
|
|
51
|
+
props: {
|
|
52
|
+
fileName: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: ''
|
|
55
|
+
},
|
|
56
|
+
fileUrl: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: ''
|
|
59
|
+
},
|
|
60
|
+
placeholder: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: '请选择文件'
|
|
63
|
+
},
|
|
64
|
+
msgType: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: 'dialog'
|
|
67
|
+
},
|
|
68
|
+
action: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: '/bems/1.0/attach'
|
|
71
|
+
},
|
|
72
|
+
headers: {
|
|
73
|
+
type: Object,
|
|
74
|
+
default: () => ({
|
|
75
|
+
token: window.sessionStorage.getItem('token') || 'main-token'
|
|
76
|
+
})
|
|
77
|
+
},
|
|
78
|
+
size: {
|
|
79
|
+
type: [String, Number],
|
|
80
|
+
default: undefined
|
|
81
|
+
},
|
|
82
|
+
accept: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: undefined
|
|
85
|
+
},
|
|
86
|
+
onRemove: {
|
|
87
|
+
type: Function,
|
|
88
|
+
default: undefined
|
|
89
|
+
},
|
|
90
|
+
onProgress: {
|
|
91
|
+
type: Function,
|
|
92
|
+
default: undefined
|
|
93
|
+
},
|
|
94
|
+
onSuccess: {
|
|
95
|
+
type: Function,
|
|
96
|
+
default: undefined
|
|
97
|
+
},
|
|
98
|
+
onError: {
|
|
99
|
+
type: Function,
|
|
100
|
+
default: undefined
|
|
101
|
+
},
|
|
102
|
+
beforeUpload: {
|
|
103
|
+
type: Function,
|
|
104
|
+
default: undefined
|
|
105
|
+
},
|
|
106
|
+
showClear: {
|
|
107
|
+
type: Boolean,
|
|
108
|
+
default: true
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
data() {
|
|
112
|
+
return {
|
|
113
|
+
fileList: [],
|
|
114
|
+
percent: 0,
|
|
115
|
+
percentMsg: '',
|
|
116
|
+
progressV: false,
|
|
117
|
+
percentType: undefined
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
computed: {
|
|
121
|
+
fileNameC: {
|
|
122
|
+
get() {
|
|
123
|
+
return this.fileName
|
|
124
|
+
},
|
|
125
|
+
set(v) {
|
|
126
|
+
this.$emit('update:fileName', v)
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
fileUrlC: {
|
|
130
|
+
get() {
|
|
131
|
+
return this.fileUrl
|
|
132
|
+
},
|
|
133
|
+
set(v) {
|
|
134
|
+
this.$emit('update:fileUrl', v)
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
methods: {
|
|
139
|
+
clearFile() {
|
|
140
|
+
if (this.onRemove) {
|
|
141
|
+
this.onRemove(this.fileList[0], this.fileList)
|
|
142
|
+
} else {
|
|
143
|
+
this.fileNameC = ''
|
|
144
|
+
this.fileUrlC = ''
|
|
145
|
+
this.fileList.pop()
|
|
146
|
+
console.log('删除上传')
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
beforeUploadFn(file) {
|
|
150
|
+
let size = this.size
|
|
151
|
+
let sizeNum
|
|
152
|
+
|
|
153
|
+
if (size) {
|
|
154
|
+
if (/kb/i.test(size)) {
|
|
155
|
+
sizeNum = parseFloat(size) * 1024
|
|
156
|
+
} else if (/mb/i.test(size)) {
|
|
157
|
+
sizeNum = parseFloat(size) * 1024 * 1024
|
|
158
|
+
} else {
|
|
159
|
+
sizeNum = parseFloat(size)
|
|
160
|
+
}
|
|
161
|
+
if (file.size > sizeNum) {
|
|
162
|
+
this.$message.error('文件大小不能超过 ' + size + ' !')
|
|
163
|
+
return false
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
let accept = this.accept
|
|
168
|
+
if (accept) {
|
|
169
|
+
let [ftB = '', ftA = ''] = file.type.split('/')
|
|
170
|
+
ftB = ftB + '/*'
|
|
171
|
+
ftA = file.name.match(/\.[^.]+$/)?.[0] || '.' + ftA
|
|
172
|
+
if (!(accept.includes(ftB) || accept.includes(ftA))) {
|
|
173
|
+
this.$message.error('文件格式错误 !')
|
|
174
|
+
return false
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (this.msgType === 'dialog') {
|
|
179
|
+
this.percent = 0
|
|
180
|
+
this.percentType = undefined
|
|
181
|
+
this.progressV = true
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (this.beforeUpload) {
|
|
185
|
+
return this.beforeUpload(file)
|
|
186
|
+
} else {
|
|
187
|
+
return
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
progressFn(event, file, fileList) {
|
|
191
|
+
if (this.onProgress) {
|
|
192
|
+
this.onProgress(event, file, fileList)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (this.msgType === 'dialog') {
|
|
196
|
+
this.percent = event.percent <= 99 ? Math.round(event.percent) : 99
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
successFn(response, file, fileList) {
|
|
200
|
+
if (this.onSuccess) {
|
|
201
|
+
this.onSuccess(response, file, fileList)
|
|
202
|
+
} else {
|
|
203
|
+
this.fileNameC = file.name
|
|
204
|
+
this.fileUrlC = response.data
|
|
205
|
+
this.fileList = [file]
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (this.msgType === 'dialog') {
|
|
209
|
+
this.percent = 100
|
|
210
|
+
this.percentType = 'success'
|
|
211
|
+
this.percentMsg = response.msg || '上传成功!'
|
|
212
|
+
} else if (this.msgType === 'message') {
|
|
213
|
+
if (!this.onSuccess) {
|
|
214
|
+
this.$message({
|
|
215
|
+
type: 'success',
|
|
216
|
+
message: response.msg,
|
|
217
|
+
showClose: true
|
|
218
|
+
})
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
errorFn(err, file, fileList) {
|
|
223
|
+
if (this.onError) {
|
|
224
|
+
this.onError(err, file, fileList)
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (this.msgType === 'dialog') {
|
|
228
|
+
this.percentType = 'exception'
|
|
229
|
+
this.percentMsg = err?.msg || '上传失败!'
|
|
230
|
+
} else if (this.msgType === 'message') {
|
|
231
|
+
if (!this.onError) {
|
|
232
|
+
this.$message({
|
|
233
|
+
type: 'error',
|
|
234
|
+
message: err?.msg || '上传失败',
|
|
235
|
+
showClose: true
|
|
236
|
+
})
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
</script>
|
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="flex-box flex-r">
|
|
3
|
-
<Pagination :page-obj="pageObj" @change="pageChange" />
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script>
|
|
8
|
-
import Pagination from '../Pagination/index.vue'
|
|
9
|
-
export default {
|
|
10
|
-
name: 'WornPagination',
|
|
11
|
-
components: {
|
|
12
|
-
Pagination
|
|
13
|
-
},
|
|
14
|
-
props: {
|
|
15
|
-
page: {
|
|
16
|
-
type: Number,
|
|
17
|
-
default: 1
|
|
18
|
-
},
|
|
19
|
-
pageSize: {
|
|
20
|
-
type: Number,
|
|
21
|
-
default: 20
|
|
22
|
-
},
|
|
23
|
-
total: {
|
|
24
|
-
type: Number,
|
|
25
|
-
default: 0
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
data() {
|
|
29
|
-
return {
|
|
30
|
-
pageObj: {
|
|
31
|
-
no: 1,
|
|
32
|
-
size: 20,
|
|
33
|
-
total: 0
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
watch: {
|
|
38
|
-
page(v) {
|
|
39
|
-
this.pageObj.no = v
|
|
40
|
-
},
|
|
41
|
-
pageSize(v) {
|
|
42
|
-
this.pageObj.size = v
|
|
43
|
-
},
|
|
44
|
-
total(v) {
|
|
45
|
-
this.pageObj.total = v
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
created() {
|
|
49
|
-
this.pageObj = {
|
|
50
|
-
no: this.page,
|
|
51
|
-
size: this.pageSize,
|
|
52
|
-
total: this.total
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
mounted() {
|
|
56
|
-
console.warn('WornPagination组件已废弃,未来版本将剔除,请使用Pagination组件')
|
|
57
|
-
},
|
|
58
|
-
methods: {
|
|
59
|
-
pageChange(v) {
|
|
60
|
-
if (v.no !== this.page) {
|
|
61
|
-
this.$emit('update:page', v.no)
|
|
62
|
-
}
|
|
63
|
-
if (v.size !== this.pageSize) {
|
|
64
|
-
this.$emit('update:pageSize', v.size)
|
|
65
|
-
// 为修复bug而写的bug
|
|
66
|
-
this.$nextTick(() => {
|
|
67
|
-
this.$emit('update:page', v.no)
|
|
68
|
-
})
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex-box flex-r">
|
|
3
|
+
<Pagination :page-obj="pageObj" @change="pageChange" />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import Pagination from '../Pagination/index.vue'
|
|
9
|
+
export default {
|
|
10
|
+
name: 'WornPagination',
|
|
11
|
+
components: {
|
|
12
|
+
Pagination
|
|
13
|
+
},
|
|
14
|
+
props: {
|
|
15
|
+
page: {
|
|
16
|
+
type: Number,
|
|
17
|
+
default: 1
|
|
18
|
+
},
|
|
19
|
+
pageSize: {
|
|
20
|
+
type: Number,
|
|
21
|
+
default: 20
|
|
22
|
+
},
|
|
23
|
+
total: {
|
|
24
|
+
type: Number,
|
|
25
|
+
default: 0
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
data() {
|
|
29
|
+
return {
|
|
30
|
+
pageObj: {
|
|
31
|
+
no: 1,
|
|
32
|
+
size: 20,
|
|
33
|
+
total: 0
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
watch: {
|
|
38
|
+
page(v) {
|
|
39
|
+
this.pageObj.no = v
|
|
40
|
+
},
|
|
41
|
+
pageSize(v) {
|
|
42
|
+
this.pageObj.size = v
|
|
43
|
+
},
|
|
44
|
+
total(v) {
|
|
45
|
+
this.pageObj.total = v
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
created() {
|
|
49
|
+
this.pageObj = {
|
|
50
|
+
no: this.page,
|
|
51
|
+
size: this.pageSize,
|
|
52
|
+
total: this.total
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
mounted() {
|
|
56
|
+
console.warn('WornPagination组件已废弃,未来版本将剔除,请使用Pagination组件')
|
|
57
|
+
},
|
|
58
|
+
methods: {
|
|
59
|
+
pageChange(v) {
|
|
60
|
+
if (v.no !== this.page) {
|
|
61
|
+
this.$emit('update:page', v.no)
|
|
62
|
+
}
|
|
63
|
+
if (v.size !== this.pageSize) {
|
|
64
|
+
this.$emit('update:pageSize', v.size)
|
|
65
|
+
// 为修复bug而写的bug
|
|
66
|
+
this.$nextTick(() => {
|
|
67
|
+
this.$emit('update:page', v.no)
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
</script>
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
const directive = {}
|
|
2
|
-
|
|
3
|
-
directive.install = (Vue) => {
|
|
4
|
-
Vue.directive('click-outside', {
|
|
5
|
-
bind: function (el, binding, node) {
|
|
6
|
-
el.clickOutsideEvent = function (event) {
|
|
7
|
-
if (!(el === event.target || el.contains(event.target))) {
|
|
8
|
-
node.context[binding.expression](event)
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
document.body.addEventListener('click', el.clickOutsideEvent)
|
|
12
|
-
},
|
|
13
|
-
unbind: function (el) {
|
|
14
|
-
document.body.removeEventListener('click', el.clickOutsideEvent)
|
|
15
|
-
}
|
|
16
|
-
})
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export default directive
|
|
1
|
+
const directive = {}
|
|
2
|
+
|
|
3
|
+
directive.install = (Vue) => {
|
|
4
|
+
Vue.directive('click-outside', {
|
|
5
|
+
bind: function (el, binding, node) {
|
|
6
|
+
el.clickOutsideEvent = function (event) {
|
|
7
|
+
if (!(el === event.target || el.contains(event.target))) {
|
|
8
|
+
node.context[binding.expression](event)
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
document.body.addEventListener('click', el.clickOutsideEvent)
|
|
12
|
+
},
|
|
13
|
+
unbind: function (el) {
|
|
14
|
+
document.body.removeEventListener('click', el.clickOutsideEvent)
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default directive
|