@idooel/components 0.0.2-beta.14 → 0.0.2-beta.16
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
CHANGED
|
@@ -19,9 +19,14 @@
|
|
|
19
19
|
</div>
|
|
20
20
|
</div>
|
|
21
21
|
<div v-if="!isFileEmpty && statusList.length > 0 && mode === 'sync'" class="ele-modal-import__errors">
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
<template v-if="statusList.length > 0">
|
|
23
|
+
<div v-for="(value, idx) in statusList" :key="idx">
|
|
24
|
+
{{ value.message }}
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
<template v-else>
|
|
28
|
+
<ele-alert :type="hooks.uploaded.messages.type" :message="hooks.uploaded.messages.message"></ele-alert>
|
|
29
|
+
</template>
|
|
25
30
|
</div>
|
|
26
31
|
</ele-modal>
|
|
27
32
|
</template>
|
|
@@ -56,9 +61,17 @@ export default {
|
|
|
56
61
|
url: '',
|
|
57
62
|
requestType: 'POST',
|
|
58
63
|
params: {},
|
|
59
|
-
fieldMap: {}
|
|
64
|
+
fieldMap: {},
|
|
65
|
+
messages: {
|
|
66
|
+
type: 'success',
|
|
67
|
+
message: '文件上传成功'
|
|
68
|
+
}
|
|
60
69
|
}
|
|
61
70
|
})
|
|
71
|
+
},
|
|
72
|
+
errorList: {
|
|
73
|
+
type: Array,
|
|
74
|
+
default: () => []
|
|
62
75
|
}
|
|
63
76
|
},
|
|
64
77
|
data() {
|
|
@@ -84,6 +97,9 @@ export default {
|
|
|
84
97
|
},
|
|
85
98
|
statusList () {
|
|
86
99
|
// 0 default
|
|
100
|
+
if (this.errorList.length > 0) {
|
|
101
|
+
return this.buildErrorList(this.errorList)
|
|
102
|
+
}
|
|
87
103
|
return this.innerErrorList
|
|
88
104
|
}
|
|
89
105
|
},
|
|
@@ -110,6 +126,20 @@ export default {
|
|
|
110
126
|
const ctx = { _route: this.$route.query, route: this.$route, ...payloads }
|
|
111
127
|
return parseFieldMap(fieldMap, ctx)
|
|
112
128
|
},
|
|
129
|
+
buildErrorList (dataSrouce = []) {
|
|
130
|
+
const ret = dataSrouce.map(item => {
|
|
131
|
+
if (type.isStr(item)) {
|
|
132
|
+
return {
|
|
133
|
+
statusCode: '0',
|
|
134
|
+
message: item
|
|
135
|
+
}
|
|
136
|
+
} else {
|
|
137
|
+
// TODO
|
|
138
|
+
console.warn('not support error list type', item)
|
|
139
|
+
}
|
|
140
|
+
})
|
|
141
|
+
return ret
|
|
142
|
+
},
|
|
113
143
|
uploadFileSuccess (props) {
|
|
114
144
|
const { uploaded } = this.hooks
|
|
115
145
|
const { url, requestType = 'POST', params = {}, fieldMap = {} } = uploaded
|
|
@@ -124,16 +154,7 @@ export default {
|
|
|
124
154
|
net[requestType.toLowerCase()](url, formData , { headers: { 'Content-Type': 'multipart/form-data' } }).then(resp => {
|
|
125
155
|
const { code, data } = resp
|
|
126
156
|
if (code !== '2000') {
|
|
127
|
-
this.innerErrorList =
|
|
128
|
-
if (type.isStr(item)) {
|
|
129
|
-
return {
|
|
130
|
-
statusCode: '0',
|
|
131
|
-
message: item
|
|
132
|
-
}
|
|
133
|
-
} else {
|
|
134
|
-
// TODO
|
|
135
|
-
}
|
|
136
|
-
})
|
|
157
|
+
this.innerErrorList = this.buildErrorList(data)
|
|
137
158
|
} else {
|
|
138
159
|
this.innerErrorList = []
|
|
139
160
|
}
|
|
@@ -737,6 +737,25 @@ export default {
|
|
|
737
737
|
this.model.cleanup()
|
|
738
738
|
}
|
|
739
739
|
}
|
|
740
|
+
},
|
|
741
|
+
async activated () {
|
|
742
|
+
// 重新计算表格高度(应对窗口大小变化)
|
|
743
|
+
this.$nextTick(() => {
|
|
744
|
+
this.calculateTableHeight()
|
|
745
|
+
if (this.showTree) {
|
|
746
|
+
this.calculateTreeHeight()
|
|
747
|
+
}
|
|
748
|
+
})
|
|
749
|
+
|
|
750
|
+
// 刷新列表数据
|
|
751
|
+
const { overrideInit = false } = this.tableMeta
|
|
752
|
+
if (overrideInit) {
|
|
753
|
+
// 如果使用自定义初始化模式,触发 INIT 事件
|
|
754
|
+
this.$emit(RESERVE_EVENT_NAMES.INIT, { ...this.exposed })
|
|
755
|
+
} else {
|
|
756
|
+
// 使用当前查询参数刷新表格数据
|
|
757
|
+
await this.requestTableData()
|
|
758
|
+
}
|
|
740
759
|
}
|
|
741
760
|
}
|
|
742
761
|
</script>
|
package/vitest.config.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { defineConfig } from 'vitest/config'
|
|
2
|
-
import vue from '@vitejs/plugin-vue2'
|
|
3
|
-
import path from 'path'
|
|
4
|
-
|
|
5
|
-
export default defineConfig({
|
|
6
|
-
plugins: [vue()],
|
|
7
|
-
resolve: {
|
|
8
|
-
alias: {
|
|
9
|
-
'@': path.resolve(__dirname, 'packages')
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
test: {
|
|
13
|
-
environment: 'jsdom',
|
|
14
|
-
globals: true,
|
|
15
|
-
setupFiles: ['__tests__/setup.js']
|
|
16
|
-
}
|
|
17
|
-
})
|
|
1
|
+
import { defineConfig } from 'vitest/config'
|
|
2
|
+
import vue from '@vitejs/plugin-vue2'
|
|
3
|
+
import path from 'path'
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
plugins: [vue()],
|
|
7
|
+
resolve: {
|
|
8
|
+
alias: {
|
|
9
|
+
'@': path.resolve(__dirname, 'packages')
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
test: {
|
|
13
|
+
environment: 'jsdom',
|
|
14
|
+
globals: true,
|
|
15
|
+
setupFiles: ['__tests__/setup.js']
|
|
16
|
+
}
|
|
17
|
+
})
|