@ddwl/ddwl-ui 1.3.17 → 1.4.0
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/dist/index.common.js +1044 -979
- package/dist/index.umd.js +3721 -3656
- package/dist/index.umd.min.js +4 -4
- package/package.json +9 -7
- package/src/lib/install/index.js +48 -0
- package/src/main.js +0 -2
- package/src/packages/form-item/index.vue +1 -1
- package/src/packages/import-file/index.vue +29 -26
- package/src/packages/menu/menuItem.vue +3 -3
- package/src/packages/search-form/index.vue +4 -6
- package/src/packages/table/index.vue +4 -3
- package/src/packages/upload/index.vue +8 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ddwl/ddwl-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "dist/index.common.js",
|
|
6
6
|
"style": "dist/index.css",
|
|
@@ -22,20 +22,17 @@
|
|
|
22
22
|
"lint": "vue-cli-service lint",
|
|
23
23
|
"dev": "vue-cli-service lint && vue-cli-service serve",
|
|
24
24
|
"build": "vue-cli-service lint && vue-cli-service build --target lib --name index src/main.js",
|
|
25
|
-
"release": "npm run build && bumpp -r && npm publish --access=public"
|
|
25
|
+
"release": "npm run build && bumpp -r && npm publish --access=public",
|
|
26
|
+
"pub": "node scripts/publish.js"
|
|
26
27
|
},
|
|
27
28
|
"dependencies": {
|
|
28
|
-
"@vue/eslint-config-standard": "^8.0.1",
|
|
29
29
|
"core-js": "^3.8.3",
|
|
30
30
|
"crypto-js": "^4.2.0",
|
|
31
31
|
"dayjs": "^1.11.13",
|
|
32
32
|
"element-ui": "2.15.14",
|
|
33
33
|
"lodash": "^4.17.21",
|
|
34
|
-
"sass": "^1.22.10",
|
|
35
|
-
"sass-loader": "^7.2.0",
|
|
36
|
-
"sass-resources-loader": "^2.2.5",
|
|
37
34
|
"sortablejs": "^1.15.3",
|
|
38
|
-
"
|
|
35
|
+
"ssh2-sftp-client": "^12.0.1",
|
|
39
36
|
"vue": "^2.7.14"
|
|
40
37
|
},
|
|
41
38
|
"devDependencies": {
|
|
@@ -44,6 +41,7 @@
|
|
|
44
41
|
"@vue/cli-plugin-babel": "~5.0.0",
|
|
45
42
|
"@vue/cli-plugin-eslint": "~5.0.0",
|
|
46
43
|
"@vue/cli-service": "~5.0.0",
|
|
44
|
+
"@vue/eslint-config-standard": "^8.0.1",
|
|
47
45
|
"babel-eslint": "^10.1.0",
|
|
48
46
|
"bumpp": "^10.2.0",
|
|
49
47
|
"conventional-changelog-cli": "^5.0.0",
|
|
@@ -51,6 +49,10 @@
|
|
|
51
49
|
"eslint-config-prettier": "^10.1.8",
|
|
52
50
|
"eslint-plugin-prettier": "^5.5.4",
|
|
53
51
|
"eslint-plugin-vue": "^8.0.3",
|
|
52
|
+
"sass": "^1.22.10",
|
|
53
|
+
"sass-loader": "^7.2.0",
|
|
54
|
+
"sass-resources-loader": "^2.2.5",
|
|
55
|
+
"svg-sprite-loader": "^6.0.11",
|
|
54
56
|
"vue-template-compiler": "^2.6.14"
|
|
55
57
|
},
|
|
56
58
|
"eslintConfig": {
|
package/src/lib/install/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import previewVue from '../../packages/file-preview/index.vue'
|
|
2
|
+
import importVue from '../../packages/import-file/index.vue'
|
|
2
3
|
|
|
3
4
|
export default (Vue) => {
|
|
4
5
|
// 文件预览
|
|
@@ -10,4 +11,51 @@ export default (Vue) => {
|
|
|
10
11
|
instance.defaultIndex = defaultIndex
|
|
11
12
|
instance.list = list
|
|
12
13
|
}
|
|
14
|
+
|
|
15
|
+
// 文件导入
|
|
16
|
+
Vue.prototype.$importFile = ({
|
|
17
|
+
width = '520px',
|
|
18
|
+
title = '文件导入',
|
|
19
|
+
templateUrl = '',
|
|
20
|
+
token = '',
|
|
21
|
+
templateDownloadMethod = null,
|
|
22
|
+
fileType = ['xlsx', 'xls'],
|
|
23
|
+
fileSize = 5,
|
|
24
|
+
slotRender = null
|
|
25
|
+
}) => {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
const Import = Vue.extend(importVue)
|
|
28
|
+
const instance = new Import()
|
|
29
|
+
const el = instance.$mount().$el
|
|
30
|
+
document.body.appendChild(el)
|
|
31
|
+
|
|
32
|
+
instance.value = true
|
|
33
|
+
instance.width = width
|
|
34
|
+
instance.title = title
|
|
35
|
+
instance.templateUrl = templateUrl
|
|
36
|
+
instance.token = token
|
|
37
|
+
instance.templateDownloadMethod = templateDownloadMethod
|
|
38
|
+
instance.fileType = fileType
|
|
39
|
+
instance.fileSize = fileSize
|
|
40
|
+
instance.slotRender = slotRender
|
|
41
|
+
|
|
42
|
+
const destroy = () => {
|
|
43
|
+
instance.$destroy()
|
|
44
|
+
el.parentNode && el.parentNode.removeChild(el)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
instance.$on('submit', async (callback, file) => {
|
|
48
|
+
try {
|
|
49
|
+
resolve(callback, file)
|
|
50
|
+
} catch (e) {
|
|
51
|
+
callback(new Error(e))
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
instance.$on('close', () => {
|
|
56
|
+
reject(new Error('cancelled'))
|
|
57
|
+
Vue.nextTick(destroy)
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
}
|
|
13
61
|
}
|
package/src/main.js
CHANGED
|
@@ -6,7 +6,6 @@ import Drawer from './packages/drawer'
|
|
|
6
6
|
import FilterTree from './packages/filter-tree'
|
|
7
7
|
import Form from './packages/form'
|
|
8
8
|
import FormItem from './packages/form-item'
|
|
9
|
-
import ImportFile from './packages/import-file'
|
|
10
9
|
import Menu from './packages/menu'
|
|
11
10
|
import Popconfirm from './packages/popconfirm'
|
|
12
11
|
import Render from './packages/render'
|
|
@@ -31,7 +30,6 @@ const components = [
|
|
|
31
30
|
FilterTree,
|
|
32
31
|
Form,
|
|
33
32
|
FormItem,
|
|
34
|
-
ImportFile,
|
|
35
33
|
Menu,
|
|
36
34
|
Popconfirm,
|
|
37
35
|
Render,
|
|
@@ -39,28 +39,27 @@
|
|
|
39
39
|
模板下载
|
|
40
40
|
</el-button>
|
|
41
41
|
</el-form>
|
|
42
|
-
<
|
|
42
|
+
<div v-if="slotRender">
|
|
43
|
+
<d-render :render="slotRender" />
|
|
44
|
+
</div>
|
|
45
|
+
<div v-else>
|
|
43
46
|
<p>1. 支持导入格式为{{ fileType.join('、') }}的文件,且文件大小不可超过{{ fileSize }}M</p>
|
|
44
47
|
<p>2. 模板的表头不可更改,不可删除</p>
|
|
45
48
|
<p>3. 若导入数据存在编码一致的情况则会更新原有数据</p>
|
|
46
49
|
<p>4. 若导入过程中有问题,需调整模板内容后再重新导入</p>
|
|
47
|
-
</
|
|
50
|
+
</div>
|
|
48
51
|
</d-dialog>
|
|
49
52
|
</template>
|
|
50
53
|
|
|
51
54
|
<script>
|
|
52
|
-
import { template } from 'lodash'
|
|
53
55
|
import DDialog from '../dialog'
|
|
56
|
+
import DRender from '../render'
|
|
54
57
|
|
|
55
58
|
export default {
|
|
56
59
|
name: 'DImportFile',
|
|
57
|
-
components: { DDialog },
|
|
58
|
-
model: {
|
|
59
|
-
prop: 'modelValue',
|
|
60
|
-
event: 'change'
|
|
61
|
-
},
|
|
60
|
+
components: { DDialog, DRender },
|
|
62
61
|
props: {
|
|
63
|
-
|
|
62
|
+
value: {
|
|
64
63
|
default: false,
|
|
65
64
|
type: Boolean
|
|
66
65
|
},
|
|
@@ -76,6 +75,10 @@ export default {
|
|
|
76
75
|
default: '',
|
|
77
76
|
type: String
|
|
78
77
|
},
|
|
78
|
+
token: {
|
|
79
|
+
default: '',
|
|
80
|
+
type: String
|
|
81
|
+
},
|
|
79
82
|
templateDownloadMethod: {
|
|
80
83
|
type: Function,
|
|
81
84
|
default: null
|
|
@@ -87,26 +90,32 @@ export default {
|
|
|
87
90
|
fileSize: {
|
|
88
91
|
default: 5,
|
|
89
92
|
type: Number
|
|
93
|
+
},
|
|
94
|
+
slotRender: {
|
|
95
|
+
default: null,
|
|
96
|
+
type: Function
|
|
90
97
|
}
|
|
91
98
|
},
|
|
92
99
|
data() {
|
|
93
100
|
return {
|
|
101
|
+
visible: false,
|
|
94
102
|
fileList: [],
|
|
95
103
|
form: {
|
|
96
104
|
file: ''
|
|
97
105
|
}
|
|
98
106
|
}
|
|
99
107
|
},
|
|
100
|
-
|
|
108
|
+
watch: {
|
|
109
|
+
value: {
|
|
110
|
+
handler(value) {
|
|
111
|
+
this.visible = value
|
|
112
|
+
}
|
|
113
|
+
},
|
|
101
114
|
visible: {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
this.form.file = ''
|
|
107
|
-
this.fileList = []
|
|
108
|
-
this.$refs.importForm.clearValidate()
|
|
109
|
-
this.$emit('change', value)
|
|
115
|
+
handler(value) {
|
|
116
|
+
if (!value) {
|
|
117
|
+
this.$emit('close', value)
|
|
118
|
+
}
|
|
110
119
|
}
|
|
111
120
|
}
|
|
112
121
|
},
|
|
@@ -115,13 +124,7 @@ export default {
|
|
|
115
124
|
if (this.templateDownloadMethod) {
|
|
116
125
|
this.templateDownloadMethod()
|
|
117
126
|
} else {
|
|
118
|
-
|
|
119
|
-
try {
|
|
120
|
-
token = JSON.parse(window.localStorage.getItem('userInfo')).token
|
|
121
|
-
} catch (e) {
|
|
122
|
-
token = ''
|
|
123
|
-
}
|
|
124
|
-
window.location.href = `${this.templateUrl}?authToken=${token}`
|
|
127
|
+
window.location.href = `${this.templateUrl}?authToken=${this.token}`
|
|
125
128
|
}
|
|
126
129
|
},
|
|
127
130
|
uploadChange(file, fileList) {
|
|
@@ -147,7 +150,7 @@ export default {
|
|
|
147
150
|
return
|
|
148
151
|
}
|
|
149
152
|
try {
|
|
150
|
-
this.$emit('submit', this.form.file
|
|
153
|
+
this.$emit('submit', callback, this.form.file)
|
|
151
154
|
} catch (e) {
|
|
152
155
|
callback(new Error(false))
|
|
153
156
|
}
|
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
</el-submenu>
|
|
14
14
|
<el-menu-item v-else class="d-menu__submenu-item" :index="data.path">
|
|
15
15
|
<template slot="title">
|
|
16
|
-
<div v-if="data.meta.icon" class="d-menu-icon-box">
|
|
16
|
+
<div v-if="data.meta.icon" class="d-menu-icon-box mr6">
|
|
17
17
|
<img class="d-menu-icon" :src="data.meta.icon" />
|
|
18
18
|
</div>
|
|
19
19
|
<span
|
|
20
20
|
v-if="data.meta.isNewWindow"
|
|
21
|
-
class="
|
|
21
|
+
class="ellipsis flex-1"
|
|
22
22
|
@click.stop="openNewWindow(data)"
|
|
23
23
|
>{{ data.meta.title }}</span
|
|
24
24
|
>
|
|
25
|
-
<span v-else class="
|
|
25
|
+
<span v-else class="ellipsis flex-1">{{ data.meta.title }}</span>
|
|
26
26
|
</template>
|
|
27
27
|
</el-menu-item>
|
|
28
28
|
</template>
|
|
@@ -50,9 +50,6 @@
|
|
|
50
50
|
import FormItem from '../form-item'
|
|
51
51
|
import { cloneDeep } from 'lodash'
|
|
52
52
|
|
|
53
|
-
// 初始化表单
|
|
54
|
-
let initForm = {}
|
|
55
|
-
|
|
56
53
|
export default {
|
|
57
54
|
name: 'DSearchForm',
|
|
58
55
|
components: {
|
|
@@ -64,7 +61,7 @@ export default {
|
|
|
64
61
|
},
|
|
65
62
|
props: {
|
|
66
63
|
config: {
|
|
67
|
-
|
|
64
|
+
required: true,
|
|
68
65
|
default: () => [],
|
|
69
66
|
type: Array
|
|
70
67
|
},
|
|
@@ -91,6 +88,7 @@ export default {
|
|
|
91
88
|
},
|
|
92
89
|
data() {
|
|
93
90
|
return {
|
|
91
|
+
initForm: {},
|
|
94
92
|
list: [],
|
|
95
93
|
hiddenIndex: 0,
|
|
96
94
|
emptySpan: 0,
|
|
@@ -142,7 +140,7 @@ export default {
|
|
|
142
140
|
}
|
|
143
141
|
},
|
|
144
142
|
created() {
|
|
145
|
-
initForm = cloneDeep(this.value)
|
|
143
|
+
this.initForm = cloneDeep(this.value)
|
|
146
144
|
this.$nextTick(() => {
|
|
147
145
|
this.hasSlot = !!(this.$slots.default && this.$slots.default.length)
|
|
148
146
|
this.calcSpan()
|
|
@@ -168,7 +166,7 @@ export default {
|
|
|
168
166
|
* @description: 重置
|
|
169
167
|
*/
|
|
170
168
|
async reset() {
|
|
171
|
-
this.form = cloneDeep(initForm)
|
|
169
|
+
this.form = cloneDeep(this.initForm)
|
|
172
170
|
this.$emit('search')
|
|
173
171
|
if (this.searchData) {
|
|
174
172
|
this.resetLoading = true
|
|
@@ -96,7 +96,7 @@ export default {
|
|
|
96
96
|
// request config
|
|
97
97
|
requestConfig: {
|
|
98
98
|
type: Object,
|
|
99
|
-
|
|
99
|
+
required: false,
|
|
100
100
|
default: () => ({
|
|
101
101
|
api: () => {}, // 接口
|
|
102
102
|
params: {}, // 默认参数
|
|
@@ -242,8 +242,9 @@ export default {
|
|
|
242
242
|
})
|
|
243
243
|
this.total = total
|
|
244
244
|
this.handleRequestData(data)
|
|
245
|
-
|
|
246
|
-
|
|
245
|
+
} catch (e) {
|
|
246
|
+
console.error(e)
|
|
247
|
+
}
|
|
247
248
|
this.loading = false
|
|
248
249
|
},
|
|
249
250
|
async getData(params) {
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
</div>
|
|
96
96
|
<file-preview
|
|
97
97
|
v-if="previewVisible"
|
|
98
|
-
:default-index="
|
|
98
|
+
:default-index="previewIndex"
|
|
99
99
|
:list="imgOrVideoList.map((i) => i.fileUrl)"
|
|
100
100
|
@close="previewVisible = false"
|
|
101
101
|
/>
|
|
@@ -163,7 +163,7 @@ export default {
|
|
|
163
163
|
dialogVisible: false,
|
|
164
164
|
dialogImageUrl: '',
|
|
165
165
|
videoBg,
|
|
166
|
-
|
|
166
|
+
previewIndex: 0,
|
|
167
167
|
previewVisible: false
|
|
168
168
|
}
|
|
169
169
|
},
|
|
@@ -258,7 +258,7 @@ export default {
|
|
|
258
258
|
this.$parent.$emit('el.form.change')
|
|
259
259
|
},
|
|
260
260
|
picturePreview(index) {
|
|
261
|
-
this.
|
|
261
|
+
this.previewIndex = index
|
|
262
262
|
this.previewVisible = true
|
|
263
263
|
}
|
|
264
264
|
}
|
|
@@ -297,6 +297,11 @@ export default {
|
|
|
297
297
|
.img-part {
|
|
298
298
|
width: 80px;
|
|
299
299
|
height: 80px;
|
|
300
|
+
.el-upload--picture-card {
|
|
301
|
+
width: 80px;
|
|
302
|
+
height: 80px;
|
|
303
|
+
line-height: 80px;
|
|
304
|
+
}
|
|
300
305
|
}
|
|
301
306
|
}
|
|
302
307
|
.file-list {
|