haiwei-module-common 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -8
- package/vue.config.js +9 -0
- package/src/api/components/attachment.js +0 -30
- package/src/api/components/mediaType.js +0 -10
- package/src/components/attachment-download/index.vue +0 -70
- package/src/components/attachment-img/index.vue +0 -58
- package/src/components/attachment-upload-img/index.vue +0 -244
- package/src/components/attachment-upload-single/index.vue +0 -143
- package/src/components/ccdieet-upload/index_.vue +0 -51
- package/src/components/upload-mixins.js +0 -118
- package/src/views/attachment/index/cols.js +0 -59
- package/src/views/attachment/index/index.vue +0 -60
- package/src/views/attachment/index/page.js +0 -36
- package/src/views/mediaType/components/save/index.vue +0 -45
- package/src/views/mediaType/index/cols.js +0 -16
- package/src/views/mediaType/index/index.vue +0 -55
- package/src/views/mediaType/index/page.js +0 -42
package/package.json
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": 1,
|
|
3
3
|
"name": "haiwei-module-common",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"code": "common",
|
|
6
6
|
"title": "通用模块",
|
|
7
7
|
"description": "通用模块",
|
|
8
8
|
"main": "src/index.js",
|
|
9
9
|
"scripts": {
|
|
10
|
-
"serve": "vue-cli-service serve",
|
|
11
|
-
"build": "vue-cli-service build",
|
|
12
|
-
"lint": "vue-cli-service lint",
|
|
10
|
+
"serve": "vue-cli-service lint --fit && vue-cli-service serve",
|
|
11
|
+
"build": "vue-cli-service lint && vue-cli-service build",
|
|
12
|
+
"lint": "vue-cli-service lint --fit",
|
|
13
13
|
"dev": "cd ../../WebHost && dotnet watch run",
|
|
14
14
|
"cm": "rimraf node_modules",
|
|
15
15
|
"cc": "rimraf node_modules/.cache",
|
|
16
|
-
|
|
16
|
+
"i": "cd ./script && npm_install.bat",
|
|
17
17
|
"up": "cd ./script && npm_update.bat",
|
|
18
18
|
"pub": "cd ./script && npm_publish.bat"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"haiwei-module-admin": "^1.
|
|
22
|
-
"haiwei-ui": "^1.
|
|
21
|
+
"haiwei-module-admin": "^1.2.1",
|
|
22
|
+
"haiwei-ui": "^1.4.7"
|
|
23
|
+
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"@vue/cli-plugin-babel": "^4.4.1",
|
|
@@ -38,4 +39,4 @@
|
|
|
38
39
|
"sass-loader": "^8.0.2",
|
|
39
40
|
"vue-template-compiler": "^2.6.11"
|
|
40
41
|
}
|
|
41
|
-
}
|
|
42
|
+
}
|
package/vue.config.js
CHANGED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import module from '../../module'
|
|
2
|
-
|
|
3
|
-
export default name => {
|
|
4
|
-
const root = `${module.code}/${name}/`
|
|
5
|
-
const crud = $http.crud(root)
|
|
6
|
-
const urls = {
|
|
7
|
-
upload: root + 'Upload',
|
|
8
|
-
download: root + 'Download/'
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const getUploadUrl = () => {
|
|
12
|
-
return $http.axios.defaults.baseURL + urls.upload
|
|
13
|
-
}
|
|
14
|
-
// 下载
|
|
15
|
-
const download = id => {
|
|
16
|
-
return $http.download(urls.download + id)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// 预览
|
|
20
|
-
const preview = id => {
|
|
21
|
-
return $http.preview(urls.download + id)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return {
|
|
25
|
-
...crud,
|
|
26
|
-
getUploadUrl,
|
|
27
|
-
download,
|
|
28
|
-
preview
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-button
|
|
3
|
-
class="nm-button"
|
|
4
|
-
:type="type"
|
|
5
|
-
:size="size || fontSize"
|
|
6
|
-
:plain="plain"
|
|
7
|
-
:round="round"
|
|
8
|
-
:circle="circle"
|
|
9
|
-
:loading="loading"
|
|
10
|
-
:disabled="disabled"
|
|
11
|
-
:autofocus="autofocus"
|
|
12
|
-
:native-type="nativeType"
|
|
13
|
-
v-nm-has="code"
|
|
14
|
-
@click="onClick"
|
|
15
|
-
>
|
|
16
|
-
<nm-icon v-if="!loading && icon" :name="icon" />
|
|
17
|
-
<slot>
|
|
18
|
-
<span v-if="!circle && text" class="nm-button-text" v-html="text" />
|
|
19
|
-
</slot>
|
|
20
|
-
</el-button>
|
|
21
|
-
</template>
|
|
22
|
-
<script>
|
|
23
|
-
const { download } = $api.common.attachment
|
|
24
|
-
|
|
25
|
-
export default {
|
|
26
|
-
name: 'Button',
|
|
27
|
-
props: {
|
|
28
|
-
/** 尺寸,默认按照框架的字号设置 */
|
|
29
|
-
size: String,
|
|
30
|
-
/** 类型 primary/success/warning/danger/info/text */
|
|
31
|
-
type: String,
|
|
32
|
-
/** 是否朴素按钮 */
|
|
33
|
-
plain: Boolean,
|
|
34
|
-
/** 是否圆角按钮 */
|
|
35
|
-
round: Boolean,
|
|
36
|
-
/** 是否圆形按钮 */
|
|
37
|
-
circle: Boolean,
|
|
38
|
-
/** 是否加载中状态 */
|
|
39
|
-
loading: Boolean,
|
|
40
|
-
/** 是否禁用状态 */
|
|
41
|
-
disabled: Boolean,
|
|
42
|
-
/** 是否默认聚焦 */
|
|
43
|
-
autofocus: Boolean,
|
|
44
|
-
/** 原生 type 属性 button/submit/reset */
|
|
45
|
-
nativeType: String,
|
|
46
|
-
/** 图标 */
|
|
47
|
-
icon: {
|
|
48
|
-
type: String,
|
|
49
|
-
default: 'download'
|
|
50
|
-
},
|
|
51
|
-
// 文本
|
|
52
|
-
text: {
|
|
53
|
-
type: String,
|
|
54
|
-
default: '下载'
|
|
55
|
-
},
|
|
56
|
-
// 按钮编码,用于按钮权限控制
|
|
57
|
-
code: String,
|
|
58
|
-
//附件ID
|
|
59
|
-
id: {
|
|
60
|
-
type: String,
|
|
61
|
-
required: true
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
methods: {
|
|
65
|
-
onClick() {
|
|
66
|
-
download(this.id)
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
</script>
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :style="{ width, height }" class="nm-attachment-img-preview">
|
|
3
|
-
<img v-if="url" :src="url" />
|
|
4
|
-
<nm-icon class="no-picture" v-else name="photo" />
|
|
5
|
-
</div>
|
|
6
|
-
</template>
|
|
7
|
-
<script>
|
|
8
|
-
// 接口
|
|
9
|
-
const api = $api.common.attachment
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
data() {
|
|
13
|
-
return {
|
|
14
|
-
url: ''
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
props: {
|
|
18
|
-
id: {
|
|
19
|
-
type: String
|
|
20
|
-
},
|
|
21
|
-
width: {
|
|
22
|
-
type: String,
|
|
23
|
-
default: 'auto'
|
|
24
|
-
},
|
|
25
|
-
height: {
|
|
26
|
-
type: String,
|
|
27
|
-
default: 'auto'
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
methods: {
|
|
31
|
-
get() {
|
|
32
|
-
if (this.id) {
|
|
33
|
-
api.preview(this.id).then(url => {
|
|
34
|
-
this.url = url
|
|
35
|
-
})
|
|
36
|
-
} else {
|
|
37
|
-
this.url = ''
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
mounted() {
|
|
42
|
-
this.get()
|
|
43
|
-
},
|
|
44
|
-
watch: {
|
|
45
|
-
id() {
|
|
46
|
-
this.get()
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
</script>
|
|
51
|
-
<style lang="scss">
|
|
52
|
-
.nm-attachment-img-preview {
|
|
53
|
-
display: block;
|
|
54
|
-
img {
|
|
55
|
-
width: 100%;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
</style>
|
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="['nm-attachment-upload-img', disabled ? 'disabled' : '']" :style="style" v-loading="loading">
|
|
3
|
-
<div v-if="disabled" class="disabled-bg"></div>
|
|
4
|
-
<el-upload v-bind="uploadOptions">
|
|
5
|
-
<nm-attachment-img v-show="id" :id="id" class="preview" />
|
|
6
|
-
<div v-show="!id" class="text-box">
|
|
7
|
-
<i class="el-icon-upload" :style="{ fontSize: iconSize }"></i>
|
|
8
|
-
<div class="text">
|
|
9
|
-
<slot name="text">
|
|
10
|
-
将文件拖到此处,或
|
|
11
|
-
<em>点击上传</em>
|
|
12
|
-
</slot>
|
|
13
|
-
</div>
|
|
14
|
-
<div class="tip">
|
|
15
|
-
<slot name="tip">{{ tip }}</slot>
|
|
16
|
-
</div>
|
|
17
|
-
</div>
|
|
18
|
-
</el-upload>
|
|
19
|
-
<span v-show="id" class="remove" @click="reset">
|
|
20
|
-
<nm-icon name="close" />
|
|
21
|
-
</span>
|
|
22
|
-
</div>
|
|
23
|
-
</template>
|
|
24
|
-
<script>
|
|
25
|
-
import mixins from '../upload-mixins'
|
|
26
|
-
|
|
27
|
-
// 接口
|
|
28
|
-
const api = $api.common.attachment
|
|
29
|
-
|
|
30
|
-
export default {
|
|
31
|
-
mixins: [mixins],
|
|
32
|
-
props: {
|
|
33
|
-
/** 宽度 */
|
|
34
|
-
width: {
|
|
35
|
-
type: String,
|
|
36
|
-
default: '100px'
|
|
37
|
-
},
|
|
38
|
-
/** 高度 */
|
|
39
|
-
height: {
|
|
40
|
-
type: String,
|
|
41
|
-
default: '150px'
|
|
42
|
-
},
|
|
43
|
-
/** 文章说明 */
|
|
44
|
-
text: String,
|
|
45
|
-
/** 底部提示语 */
|
|
46
|
-
tip: String,
|
|
47
|
-
/** 接受上传的文件类型 */
|
|
48
|
-
accept: {
|
|
49
|
-
type: String,
|
|
50
|
-
default: 'image/jpeg,image/png'
|
|
51
|
-
},
|
|
52
|
-
/** 可接受文件类型 */
|
|
53
|
-
fileType: {
|
|
54
|
-
type: Array,
|
|
55
|
-
default() {
|
|
56
|
-
return ['jpg', 'jpeg', 'png']
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
/** 图标大小 */
|
|
60
|
-
iconSize: {
|
|
61
|
-
type: String,
|
|
62
|
-
default: '5em'
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
computed: {
|
|
66
|
-
uploadOptions() {
|
|
67
|
-
return {
|
|
68
|
-
action: api.getUploadUrl(),
|
|
69
|
-
headers: {
|
|
70
|
-
Authorization: 'Bearer ' + this.accessToken
|
|
71
|
-
},
|
|
72
|
-
data: {
|
|
73
|
-
module: this.module,
|
|
74
|
-
group: this.group,
|
|
75
|
-
name: this.name,
|
|
76
|
-
auth: this.auth
|
|
77
|
-
},
|
|
78
|
-
accept: this.accept,
|
|
79
|
-
drag: this.drag,
|
|
80
|
-
autoUpload: true,
|
|
81
|
-
showFileList: false,
|
|
82
|
-
beforeUpload: this.onBeforeUpload,
|
|
83
|
-
onSuccess: this.onSuccess,
|
|
84
|
-
onError: this.onError,
|
|
85
|
-
disabled: this.disabled
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
style() {
|
|
89
|
-
return { width: this.width, height: this.height }
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
methods: {
|
|
93
|
-
onBeforeUpload(file) {
|
|
94
|
-
// 文件格式验证
|
|
95
|
-
if (!this.verifyFileType(file)) {
|
|
96
|
-
return false
|
|
97
|
-
}
|
|
98
|
-
// 验证是否超出最大上传数
|
|
99
|
-
if (this.maxSizeBytes && file.size > this.maxSizeBytes) {
|
|
100
|
-
this._error(`文件大小${this.getSizeUnit(file.size)}超过了最大允许值${this.maxSize}`)
|
|
101
|
-
return false
|
|
102
|
-
}
|
|
103
|
-
if (this.beforeUpload && typeof this.beforeUpload === 'function' && !this.beforeUpload(file)) {
|
|
104
|
-
return false
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
this.loading = true
|
|
108
|
-
return true
|
|
109
|
-
},
|
|
110
|
-
onSuccess(res, file) {
|
|
111
|
-
const data = res.data
|
|
112
|
-
if (data.code === 1) {
|
|
113
|
-
this.id = data.data.id
|
|
114
|
-
this.$emit('input', this.id)
|
|
115
|
-
this.$emit('success', res, file)
|
|
116
|
-
} else {
|
|
117
|
-
this.$emit('error')
|
|
118
|
-
}
|
|
119
|
-
this.loading = false
|
|
120
|
-
},
|
|
121
|
-
reset() {
|
|
122
|
-
this.id = ''
|
|
123
|
-
this.$emit('input', this.id)
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
</script>
|
|
128
|
-
|
|
129
|
-
<style lang="scss">
|
|
130
|
-
.nm-attachment-upload-img {
|
|
131
|
-
position: relative;
|
|
132
|
-
display: inline-block;
|
|
133
|
-
box-sizing: border-box;
|
|
134
|
-
border: 1px dashed #ccc;
|
|
135
|
-
background-color: #fff;
|
|
136
|
-
text-align: center;
|
|
137
|
-
color: #8c939d;
|
|
138
|
-
cursor: pointer;
|
|
139
|
-
border-radius: 5px;
|
|
140
|
-
overflow: hidden;
|
|
141
|
-
|
|
142
|
-
> div {
|
|
143
|
-
width: 100%;
|
|
144
|
-
height: 100%;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.preview {
|
|
148
|
-
width: 100%;
|
|
149
|
-
height: 100%;
|
|
150
|
-
line-height: 100%;
|
|
151
|
-
text-align: center;
|
|
152
|
-
img {
|
|
153
|
-
max-width: 100%;
|
|
154
|
-
max-height: 100%;
|
|
155
|
-
}
|
|
156
|
-
.no-picture {
|
|
157
|
-
font-size: 2em;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
.el-upload {
|
|
162
|
-
width: 100%;
|
|
163
|
-
height: 100%;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.el-upload-dragger {
|
|
167
|
-
position: relative;
|
|
168
|
-
top: 50%;
|
|
169
|
-
border: none;
|
|
170
|
-
margin-top: -50%;
|
|
171
|
-
width: 100%;
|
|
172
|
-
height: auto;
|
|
173
|
-
.text-box {
|
|
174
|
-
font-size: 14px;
|
|
175
|
-
|
|
176
|
-
.el-icon-upload {
|
|
177
|
-
margin: auto;
|
|
178
|
-
font-size: 5em;
|
|
179
|
-
color: #c0c4cc !important;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
em {
|
|
183
|
-
color: #409eff;
|
|
184
|
-
font-style: normal;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
.text {
|
|
188
|
-
font-size: 13px;
|
|
189
|
-
line-height: 130%;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
.el-loading-spinner {
|
|
195
|
-
line-height: 100%;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.remove {
|
|
199
|
-
position: absolute;
|
|
200
|
-
display: none;
|
|
201
|
-
top: 0;
|
|
202
|
-
right: 0;
|
|
203
|
-
width: 30px;
|
|
204
|
-
height: 30px;
|
|
205
|
-
line-height: 27px;
|
|
206
|
-
border-radius: 15px;
|
|
207
|
-
background-color: #f56c6c;
|
|
208
|
-
color: #ccc;
|
|
209
|
-
font-size: 16px;
|
|
210
|
-
|
|
211
|
-
&:hover {
|
|
212
|
-
color: #fff;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
&:hover {
|
|
217
|
-
border-color: #409eff;
|
|
218
|
-
|
|
219
|
-
.remove {
|
|
220
|
-
display: inline-block;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
&.disabled:hover {
|
|
225
|
-
border: 1px dashed #ccc;
|
|
226
|
-
|
|
227
|
-
.remove {
|
|
228
|
-
display: none;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
.disabled-bg {
|
|
233
|
-
position: absolute;
|
|
234
|
-
top: 0;
|
|
235
|
-
left: 0;
|
|
236
|
-
width: 100%;
|
|
237
|
-
height: 100%;
|
|
238
|
-
background-color: #f5f7fa;
|
|
239
|
-
z-index: 999;
|
|
240
|
-
opacity: 0.5;
|
|
241
|
-
cursor: not-allowed;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
</style>
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="nm-attachment-upload-single">
|
|
3
|
-
<div class="input">
|
|
4
|
-
<el-input :value="fileName" readonly :disabled="disabled" />
|
|
5
|
-
</div>
|
|
6
|
-
<div class="button">
|
|
7
|
-
<el-upload ref="upload" v-bind="uploadOptions">
|
|
8
|
-
<nm-button :type="btnType" text="上传" :icon="icon_" @click="onClick" :loading="loading" />
|
|
9
|
-
</el-upload>
|
|
10
|
-
</div>
|
|
11
|
-
</div>
|
|
12
|
-
</template>
|
|
13
|
-
<script>
|
|
14
|
-
import mixins from '../upload-mixins'
|
|
15
|
-
|
|
16
|
-
// 接口
|
|
17
|
-
const api = $api.common.attachment
|
|
18
|
-
|
|
19
|
-
export default {
|
|
20
|
-
mixins: [mixins],
|
|
21
|
-
data() {
|
|
22
|
-
return {
|
|
23
|
-
fileName: ''
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
props: {
|
|
27
|
-
/** 按钮类型 */
|
|
28
|
-
btnType: {
|
|
29
|
-
type: String,
|
|
30
|
-
default: 'primary'
|
|
31
|
-
},
|
|
32
|
-
/** 不显示按钮图标 */
|
|
33
|
-
noIcon: Boolean
|
|
34
|
-
},
|
|
35
|
-
computed: {
|
|
36
|
-
uploadOptions() {
|
|
37
|
-
return {
|
|
38
|
-
action: api.getUploadUrl(),
|
|
39
|
-
headers: {
|
|
40
|
-
Authorization: 'Bearer ' + this.accessToken
|
|
41
|
-
},
|
|
42
|
-
data: {
|
|
43
|
-
module: this.module,
|
|
44
|
-
group: this.group,
|
|
45
|
-
name: this.name,
|
|
46
|
-
auth: this.auth
|
|
47
|
-
},
|
|
48
|
-
accept: this.accept,
|
|
49
|
-
drag: false,
|
|
50
|
-
autoUpload: true,
|
|
51
|
-
showFileList: false,
|
|
52
|
-
beforeUpload: this.onBeforeUpload,
|
|
53
|
-
onSuccess: this.onSuccess,
|
|
54
|
-
onError: this.onError,
|
|
55
|
-
disabled: this.disabled
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
icon_() {
|
|
59
|
-
return this.loading ? 'loading' : this.noIcon ? '' : 'upload'
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
methods: {
|
|
63
|
-
onBeforeUpload(file) {
|
|
64
|
-
// 文件格式验证
|
|
65
|
-
if (!this.verifyFileType(file)) {
|
|
66
|
-
return false
|
|
67
|
-
}
|
|
68
|
-
// 验证是否超出最大上传数
|
|
69
|
-
if (this.maxSizeBytes && file.size > this.maxSizeBytes) {
|
|
70
|
-
this._error(`文件大小${this.getSizeUnit(file.size)}超过了最大允许值${this.maxSize}`)
|
|
71
|
-
return false
|
|
72
|
-
}
|
|
73
|
-
if (this.beforeUpload && typeof this.beforeUpload === 'function' && !this.beforeUpload(file)) {
|
|
74
|
-
return false
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
this.loading = true
|
|
78
|
-
return true
|
|
79
|
-
},
|
|
80
|
-
onSuccess(res, file) {
|
|
81
|
-
const data = res.data
|
|
82
|
-
if (data.code === 1) {
|
|
83
|
-
this.id = data.data.id
|
|
84
|
-
this.fileName = file.name
|
|
85
|
-
this.$emit('input', this.id)
|
|
86
|
-
this.$emit('success', res, file)
|
|
87
|
-
} else {
|
|
88
|
-
this.$emit('error')
|
|
89
|
-
}
|
|
90
|
-
this.loading = false
|
|
91
|
-
},
|
|
92
|
-
reset() {
|
|
93
|
-
this.id = ''
|
|
94
|
-
this.fileName = ''
|
|
95
|
-
this.$emit('input', this.id)
|
|
96
|
-
},
|
|
97
|
-
onClick() {
|
|
98
|
-
if (this.loading) {
|
|
99
|
-
return
|
|
100
|
-
}
|
|
101
|
-
this.$refs.upload.clearFiles()
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
watch: {
|
|
105
|
-
name(val) {
|
|
106
|
-
this.fileName = val
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
</script>
|
|
111
|
-
|
|
112
|
-
<style lang="scss">
|
|
113
|
-
.nm-attachment-upload-single {
|
|
114
|
-
position: relative;
|
|
115
|
-
padding-right: 80px;
|
|
116
|
-
width: 100%;
|
|
117
|
-
box-sizing: border-box;
|
|
118
|
-
.input {
|
|
119
|
-
.el-input__inner {
|
|
120
|
-
border-top-right-radius: 0;
|
|
121
|
-
border-bottom-right-radius: 0;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
.button {
|
|
125
|
-
position: absolute;
|
|
126
|
-
right: 0;
|
|
127
|
-
top: 0;
|
|
128
|
-
width: 80px;
|
|
129
|
-
height: 100%;
|
|
130
|
-
|
|
131
|
-
> div,
|
|
132
|
-
.el-upload,
|
|
133
|
-
.nm-button {
|
|
134
|
-
height: 100%;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.nm-button {
|
|
138
|
-
border-top-left-radius: 0;
|
|
139
|
-
border-bottom-left-radius: 0;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
</style>
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<nm-button icon="upload" @click="visible = true" />
|
|
4
|
-
<nm-dialog title="上传图片" icon="upload" height="400px" footer :visible.sync="visible">
|
|
5
|
-
<div style="margin:20px;text-algin:center;">
|
|
6
|
-
<nm-attachment-upload-img v-bind="options" @success="onUploadSuccess">
|
|
7
|
-
<template v-slot:text>请选择文件</template>
|
|
8
|
-
</nm-attachment-upload-img>
|
|
9
|
-
</div>
|
|
10
|
-
<template v-slot:footer>
|
|
11
|
-
<nm-button type="success" text="确定" @click="onClick" />
|
|
12
|
-
</template>
|
|
13
|
-
</nm-dialog>
|
|
14
|
-
</div>
|
|
15
|
-
</template>
|
|
16
|
-
<script>
|
|
17
|
-
export default {
|
|
18
|
-
data() {
|
|
19
|
-
return {
|
|
20
|
-
value_: this.value,
|
|
21
|
-
visible: false,
|
|
22
|
-
options: {
|
|
23
|
-
module: 'Common',
|
|
24
|
-
group: 'DictTest',
|
|
25
|
-
maxSize: '500kb',
|
|
26
|
-
width: '100px',
|
|
27
|
-
height: '120px',
|
|
28
|
-
iconSize: '3em'
|
|
29
|
-
},
|
|
30
|
-
url: ''
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
props: {
|
|
34
|
-
value: String
|
|
35
|
-
},
|
|
36
|
-
methods: {
|
|
37
|
-
onUploadSuccess(res) {
|
|
38
|
-
this.url = res.data.data.url
|
|
39
|
-
},
|
|
40
|
-
onClick() {
|
|
41
|
-
this.$emit('success', this.url)
|
|
42
|
-
this.visible = false
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
watch: {
|
|
46
|
-
value(val) {
|
|
47
|
-
if (val !== this.value_) this.value_ = val
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
</script>
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { mapState } from 'vuex'
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
data() {
|
|
5
|
-
return {
|
|
6
|
-
id: this.value,
|
|
7
|
-
loading: false
|
|
8
|
-
}
|
|
9
|
-
},
|
|
10
|
-
props: {
|
|
11
|
-
value: {
|
|
12
|
-
type: String
|
|
13
|
-
},
|
|
14
|
-
/** 模块 */
|
|
15
|
-
module: {
|
|
16
|
-
type: String,
|
|
17
|
-
required: true
|
|
18
|
-
},
|
|
19
|
-
/** 分组 */
|
|
20
|
-
group: {
|
|
21
|
-
type: String,
|
|
22
|
-
required: true
|
|
23
|
-
},
|
|
24
|
-
/** 文件名 */
|
|
25
|
-
name: {
|
|
26
|
-
type: String,
|
|
27
|
-
default: ''
|
|
28
|
-
},
|
|
29
|
-
/** 是否需要授权访问 */
|
|
30
|
-
auth: {
|
|
31
|
-
type: Boolean,
|
|
32
|
-
default: false
|
|
33
|
-
},
|
|
34
|
-
/** 上传前函数 */
|
|
35
|
-
beforeUpload: Function,
|
|
36
|
-
/** 接受上传的文件类型 */
|
|
37
|
-
accept: String,
|
|
38
|
-
/** 文件最大大小 */
|
|
39
|
-
maxSize: String,
|
|
40
|
-
/** 是否可拖拽上传 */
|
|
41
|
-
drag: {
|
|
42
|
-
type: Boolean,
|
|
43
|
-
default: true
|
|
44
|
-
},
|
|
45
|
-
/** 可接受文件类型 */
|
|
46
|
-
fileType: {
|
|
47
|
-
type: Array
|
|
48
|
-
},
|
|
49
|
-
//禁用
|
|
50
|
-
disabled: Boolean
|
|
51
|
-
},
|
|
52
|
-
computed: {
|
|
53
|
-
...mapState('app/token', ['accessToken']),
|
|
54
|
-
maxSizeBytes() {
|
|
55
|
-
if (this.maxSize) {
|
|
56
|
-
const max = this.maxSize.toLowerCase()
|
|
57
|
-
if (max.endsWith('kb')) {
|
|
58
|
-
return parseFloat(max.replace('kb', '')) * 1024
|
|
59
|
-
} else if (max.endsWith('mb')) {
|
|
60
|
-
return parseFloat(max.replace('mb', '')) * 1024 * 1024
|
|
61
|
-
} else if (max.endsWith('gb')) {
|
|
62
|
-
return parseFloat(max.replace('gb', '')) * 1024 * 1024 * 1024
|
|
63
|
-
} else if (max.endsWith('tb')) {
|
|
64
|
-
return parseFloat(max.replace('tb', '')) * 1024 * 1024 * 1024 * 1024
|
|
65
|
-
} else if (max.endsWith('b')) {
|
|
66
|
-
return parseFloat(max.replace('b', ''))
|
|
67
|
-
} else {
|
|
68
|
-
return parseFloat(max)
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return ''
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
methods: {
|
|
75
|
-
onError() {
|
|
76
|
-
this._error('上传失败')
|
|
77
|
-
this.$emit('error')
|
|
78
|
-
this.loading = false
|
|
79
|
-
},
|
|
80
|
-
getSizeUnit(size) {
|
|
81
|
-
if (size === null || size === '') {
|
|
82
|
-
return '0 B'
|
|
83
|
-
}
|
|
84
|
-
var unitArr = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
|
|
85
|
-
var index = 0
|
|
86
|
-
var srcsize = parseFloat(size)
|
|
87
|
-
index = Math.floor(Math.log(srcsize) / Math.log(1024))
|
|
88
|
-
var s = srcsize / Math.pow(1024, index)
|
|
89
|
-
s = s.toFixed(2)
|
|
90
|
-
return s + unitArr[index]
|
|
91
|
-
},
|
|
92
|
-
/** 获取文件后缀名 */
|
|
93
|
-
getFileExt(name) {
|
|
94
|
-
let ext = ''
|
|
95
|
-
const arr = name.split('.')
|
|
96
|
-
if (arr.length > 1) {
|
|
97
|
-
ext = arr[arr.length - 1]
|
|
98
|
-
}
|
|
99
|
-
return ext
|
|
100
|
-
},
|
|
101
|
-
/** 验证文件类型 */
|
|
102
|
-
verifyFileType(file) {
|
|
103
|
-
if (this.fileType && this.fileType.length > 0) {
|
|
104
|
-
var ext = this.getFileExt(file.name)
|
|
105
|
-
if (this.fileType.every(m => m.toLowerCase() !== ext)) {
|
|
106
|
-
this._error(`.${ext} 文件类型不支持!`)
|
|
107
|
-
return false
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return true
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
watch: {
|
|
114
|
-
value(val) {
|
|
115
|
-
this.id = val
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
export default [
|
|
2
|
-
{
|
|
3
|
-
name: 'id',
|
|
4
|
-
label: '编号',
|
|
5
|
-
width: 250,
|
|
6
|
-
show: false
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
name: 'fileName',
|
|
10
|
-
label: '名称'
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
name: 'saveName',
|
|
14
|
-
label: '存储名称',
|
|
15
|
-
show: false
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
name: 'module',
|
|
19
|
-
label: '所属模块',
|
|
20
|
-
width: 120
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
name: 'group',
|
|
24
|
-
label: '分组',
|
|
25
|
-
width: 120
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
name: 'ext',
|
|
29
|
-
label: '扩展名',
|
|
30
|
-
width: 120
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: 'sizeCn',
|
|
34
|
-
label: '大小',
|
|
35
|
-
width: 150
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
name: 'md5',
|
|
39
|
-
label: 'MD5',
|
|
40
|
-
show: false
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
name: 'fullPath',
|
|
44
|
-
label: '路径',
|
|
45
|
-
show: false
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
name: 'creator',
|
|
49
|
-
label: '创建人',
|
|
50
|
-
width: 100,
|
|
51
|
-
show: false
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
name: 'createdTime',
|
|
55
|
-
label: '创建时间',
|
|
56
|
-
width: 150,
|
|
57
|
-
show: false
|
|
58
|
-
}
|
|
59
|
-
]
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<nm-container>
|
|
3
|
-
<nm-list ref="list" v-bind="list">
|
|
4
|
-
<!--查询条件-->
|
|
5
|
-
<template v-slot:querybar>
|
|
6
|
-
<el-form-item label="名称:" prop="name">
|
|
7
|
-
<el-input v-model="list.model.name" clearable />
|
|
8
|
-
</el-form-item>
|
|
9
|
-
</template>
|
|
10
|
-
|
|
11
|
-
<!--操作列-->
|
|
12
|
-
<template v-slot:col-operation="{ row }">
|
|
13
|
-
<nm-button v-bind="buttons.export" @click="onDownload(row)" />
|
|
14
|
-
<nm-button-delete v-bind="buttons.del" :id="row.id" :action="removeAction" @success="refresh" />
|
|
15
|
-
</template>
|
|
16
|
-
</nm-list>
|
|
17
|
-
</nm-container>
|
|
18
|
-
</template>
|
|
19
|
-
<script>
|
|
20
|
-
import page from './page'
|
|
21
|
-
import cols from './cols'
|
|
22
|
-
|
|
23
|
-
// 接口
|
|
24
|
-
const api = $api.common.attachment
|
|
25
|
-
|
|
26
|
-
export default {
|
|
27
|
-
name: page.name,
|
|
28
|
-
data() {
|
|
29
|
-
return {
|
|
30
|
-
curr: { id: '' },
|
|
31
|
-
list: {
|
|
32
|
-
title: page.title,
|
|
33
|
-
operationWidth: '150',
|
|
34
|
-
cols,
|
|
35
|
-
action: api.query,
|
|
36
|
-
model: {
|
|
37
|
-
/** 名称 */
|
|
38
|
-
name: ''
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
removeAction: api.remove,
|
|
42
|
-
buttons: page.buttons,
|
|
43
|
-
dialog: {
|
|
44
|
-
upload: false
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
methods: {
|
|
49
|
-
refresh() {
|
|
50
|
-
this.$refs.list.refresh()
|
|
51
|
-
},
|
|
52
|
-
upload() {
|
|
53
|
-
this.dialog.upload = true
|
|
54
|
-
},
|
|
55
|
-
onDownload(row) {
|
|
56
|
-
api.download(row.id)
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
</script>
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/** 页面信息 */
|
|
2
|
-
const page = new (function() {
|
|
3
|
-
this.title = '附件管理'
|
|
4
|
-
this.icon = 'attachment'
|
|
5
|
-
this.name = 'common_attachment'
|
|
6
|
-
this.path = '/common/attachment'
|
|
7
|
-
|
|
8
|
-
// 关联权限
|
|
9
|
-
this.permissions = [`${this.name}_query_get`]
|
|
10
|
-
|
|
11
|
-
// 按钮
|
|
12
|
-
this.buttons = {
|
|
13
|
-
del: {
|
|
14
|
-
text: '删除',
|
|
15
|
-
type: 'text',
|
|
16
|
-
icon: 'delete',
|
|
17
|
-
code: `${this.name}_del`,
|
|
18
|
-
permissions: [`${this.name}_delete_delete`]
|
|
19
|
-
},
|
|
20
|
-
export: {
|
|
21
|
-
text: '导出',
|
|
22
|
-
type: 'text',
|
|
23
|
-
icon: 'export',
|
|
24
|
-
code: `${this.name}_export`,
|
|
25
|
-
permissions: [`${this.name}_export_get`]
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
})()
|
|
29
|
-
|
|
30
|
-
/** 路由信息 */
|
|
31
|
-
export const route = {
|
|
32
|
-
page,
|
|
33
|
-
component: () => import(/* webpackChunkName: "Common.Attachment" */ './index')
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export default page
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<nm-form-dialog ref="form" v-bind="form" v-on="on" :visible.sync="visible_">
|
|
3
|
-
<el-row>
|
|
4
|
-
<el-col :span="20" :offset="1">
|
|
5
|
-
<el-form-item label="扩展名:" prop="ext">
|
|
6
|
-
<el-input v-model="form.model.ext" clearable />
|
|
7
|
-
</el-form-item>
|
|
8
|
-
<el-form-item label="值:" prop="value">
|
|
9
|
-
<el-input v-model="form.model.value" clearable />
|
|
10
|
-
</el-form-item>
|
|
11
|
-
</el-col>
|
|
12
|
-
</el-row>
|
|
13
|
-
</nm-form-dialog>
|
|
14
|
-
</template>
|
|
15
|
-
<script>
|
|
16
|
-
import { mixins } from 'haiwei-ui'
|
|
17
|
-
|
|
18
|
-
// 接口
|
|
19
|
-
const { add, edit, update } = $api.common.mediaType
|
|
20
|
-
|
|
21
|
-
export default {
|
|
22
|
-
mixins: [mixins.formSave],
|
|
23
|
-
data() {
|
|
24
|
-
return {
|
|
25
|
-
title: '多媒体',
|
|
26
|
-
actions: {
|
|
27
|
-
add,
|
|
28
|
-
edit,
|
|
29
|
-
update
|
|
30
|
-
},
|
|
31
|
-
form: {
|
|
32
|
-
width: '40%',
|
|
33
|
-
model: {
|
|
34
|
-
ext: '',
|
|
35
|
-
value: ''
|
|
36
|
-
},
|
|
37
|
-
rules: {
|
|
38
|
-
ext: [{ required: true, message: '请输入扩展名' }],
|
|
39
|
-
value: [{ required: true, message: '请输入值' }]
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
</script>
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<nm-container>
|
|
3
|
-
<nm-list ref="list" v-bind="list">
|
|
4
|
-
<!--查询条件-->
|
|
5
|
-
<template v-slot:querybar>
|
|
6
|
-
<el-form-item label="扩展名:" prop="ext">
|
|
7
|
-
<el-input v-model="list.model.ext" clearable />
|
|
8
|
-
</el-form-item>
|
|
9
|
-
</template>
|
|
10
|
-
|
|
11
|
-
<!--按钮-->
|
|
12
|
-
<template v-slot:querybar-buttons>
|
|
13
|
-
<nm-button v-bind="buttons.add" @click="add" />
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<!--操作列-->
|
|
17
|
-
<template v-slot:col-operation="{ row }">
|
|
18
|
-
<nm-button v-bind="buttons.edit" @click="edit(row)" />
|
|
19
|
-
<nm-button-delete v-bind="buttons.del" :id="row.id" :action="removeAction" @success="refresh" />
|
|
20
|
-
</template>
|
|
21
|
-
</nm-list>
|
|
22
|
-
|
|
23
|
-
<!--编辑-->
|
|
24
|
-
<save-page :id="curr.id" :visible.sync="dialog.save" @success="refresh" />
|
|
25
|
-
</nm-container>
|
|
26
|
-
</template>
|
|
27
|
-
<script>
|
|
28
|
-
import { mixins } from 'haiwei-ui'
|
|
29
|
-
import page from './page'
|
|
30
|
-
import cols from './cols'
|
|
31
|
-
import SavePage from '../components/save'
|
|
32
|
-
|
|
33
|
-
// 接口
|
|
34
|
-
const api = $api.common.mediaType
|
|
35
|
-
|
|
36
|
-
export default {
|
|
37
|
-
name: page.name,
|
|
38
|
-
mixins: [mixins.list],
|
|
39
|
-
components: { SavePage },
|
|
40
|
-
data() {
|
|
41
|
-
return {
|
|
42
|
-
list: {
|
|
43
|
-
title: page.title,
|
|
44
|
-
cols,
|
|
45
|
-
action: api.query,
|
|
46
|
-
model: {
|
|
47
|
-
ext: ''
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
removeAction: api.remove,
|
|
51
|
-
buttons: page.buttons
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
</script>
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/** 页面信息 */
|
|
2
|
-
const page = new (function() {
|
|
3
|
-
this.title = '多媒体'
|
|
4
|
-
this.icon = 'media'
|
|
5
|
-
this.name = 'common_mediatype'
|
|
6
|
-
this.path = '/common/mediatype'
|
|
7
|
-
|
|
8
|
-
// 关联权限
|
|
9
|
-
this.permissions = [`${this.name}_query_get`]
|
|
10
|
-
|
|
11
|
-
this.buttons = {
|
|
12
|
-
add: {
|
|
13
|
-
text: '添加',
|
|
14
|
-
type: 'success',
|
|
15
|
-
code: `${this.name}_add`,
|
|
16
|
-
icon: 'add',
|
|
17
|
-
permissions: [`${this.name}_add_post`]
|
|
18
|
-
},
|
|
19
|
-
edit: {
|
|
20
|
-
text: '编辑',
|
|
21
|
-
type: 'text',
|
|
22
|
-
icon: 'edit',
|
|
23
|
-
code: `${this.name}_edit`,
|
|
24
|
-
permissions: [`${this.name}_edit_get`, `${this.name}_update_post`]
|
|
25
|
-
},
|
|
26
|
-
del: {
|
|
27
|
-
text: '删除',
|
|
28
|
-
type: 'text',
|
|
29
|
-
icon: 'delete',
|
|
30
|
-
code: `${this.name}_del`,
|
|
31
|
-
permissions: [`${this.name}_delete_delete`]
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
})()
|
|
35
|
-
|
|
36
|
-
/** 路由信息 */
|
|
37
|
-
export const route = {
|
|
38
|
-
page,
|
|
39
|
-
component: () => import(/* webpackChunkName: "Common.MediaType" */ './index')
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export default page
|