ci-plus 1.7.8 → 1.7.9
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 -0
- package/package.json +1 -1
- package/src/fileRelated/uploadV3.vue +36 -23
- package/src/utils/lang/en.js +12 -0
- package/src/utils/lang/zh.js +13 -0
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
v-model:file-list="fileList"
|
|
22
22
|
>
|
|
23
23
|
<template #trigger>
|
|
24
|
-
<el-button size="small" type="primary" style="width: 100%" plain>
|
|
24
|
+
<el-button size="small" type="primary" style="width: 100%" plain> {{ t('fileRelated.selectFile')}} </el-button>
|
|
25
25
|
</template>
|
|
26
26
|
<el-button
|
|
27
27
|
size="small"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
style="float: left; margin: 0 12px 0 0; width: 95px"
|
|
30
30
|
v-if="url"
|
|
31
31
|
>
|
|
32
|
-
|
|
32
|
+
{{t('fileRelated.downloadTemplate')}}
|
|
33
33
|
</el-button>
|
|
34
34
|
</el-upload>
|
|
35
35
|
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
v-model="affiliationAll"
|
|
40
40
|
filterable
|
|
41
41
|
:options="affiliationOptions"
|
|
42
|
-
placeholder="
|
|
42
|
+
:placeholder="t('fileRelated.selectCompany')"
|
|
43
43
|
style="width: 180px; margin-right: 5px"
|
|
44
44
|
clearable
|
|
45
45
|
@change="changeAll"
|
|
46
46
|
/>
|
|
47
47
|
<el-button size="small" type="primary" @click="submitUpload" style="flex: 2">
|
|
48
|
-
|
|
48
|
+
{{t('fileRelated.upload')}}
|
|
49
49
|
</el-button>
|
|
50
50
|
</div>
|
|
51
51
|
<template #reference>
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
@click="visible = !visible"
|
|
55
55
|
:size="props.otherConfig?.size || 'small'"
|
|
56
56
|
>
|
|
57
|
-
{{ props.title || '
|
|
57
|
+
{{ props.title || t('fileRelated.attachmentUpload') }}
|
|
58
58
|
</el-button>
|
|
59
59
|
</template>
|
|
60
60
|
</el-popover>
|
|
@@ -99,20 +99,29 @@ const fileArr = (url: string, pathArr: string[]) => {
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
|
|
103
|
-
import type { AxiosRequestConfig } from 'axios'
|
|
104
|
-
import axios from 'axios'
|
|
102
|
+
import t from '../utils/lang/index'
|
|
103
|
+
import type { AxiosRequestConfig } from 'axios'
|
|
104
|
+
import axios from 'axios'
|
|
105
105
|
import type {
|
|
106
106
|
UploadFile,
|
|
107
107
|
UploadFiles,
|
|
108
108
|
UploadInstance,
|
|
109
109
|
UploadProps,
|
|
110
110
|
UploadUserFile
|
|
111
|
-
} from 'element-plus'
|
|
112
|
-
import {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
111
|
+
} from 'element-plus'
|
|
112
|
+
import {
|
|
113
|
+
ElButton,
|
|
114
|
+
ElLoading,
|
|
115
|
+
ElMessage,
|
|
116
|
+
ElPopover,
|
|
117
|
+
ElSelectV2,
|
|
118
|
+
ElUpload,
|
|
119
|
+
genFileId,
|
|
120
|
+
UploadRawFile
|
|
121
|
+
} from 'element-plus'
|
|
122
|
+
import { onMounted, ref } from 'vue'
|
|
123
|
+
import ajaxBox from '../utils/ajaxBox'
|
|
124
|
+
import getAffiliationOptions from '../utils/getAffiliationOptions.ts'
|
|
116
125
|
const upload = ref<UploadInstance>()
|
|
117
126
|
const exporLoading = ref()
|
|
118
127
|
const visible = ref(false)
|
|
@@ -154,7 +163,7 @@ const emits = defineEmits<{
|
|
|
154
163
|
console.log('附件props: ', props)
|
|
155
164
|
const datas: any = ref(props.data)
|
|
156
165
|
const mymultiple = ref<boolean>(props.multiple)
|
|
157
|
-
const mylimit = ref<number>(props.limit as number ||1)
|
|
166
|
+
const mylimit = ref<number>((props.limit as number) || 1)
|
|
158
167
|
const myfilePath = ref<any>(props.filePath || [])
|
|
159
168
|
console.log('myfilePath: ', props.filePath)
|
|
160
169
|
|
|
@@ -174,17 +183,17 @@ console.log('fileList: ', fileList.value)
|
|
|
174
183
|
|
|
175
184
|
//当超出限制时,执行的钩子函数
|
|
176
185
|
const handleExceed: UploadProps['onExceed'] = (files) => {
|
|
177
|
-
console.log(
|
|
186
|
+
console.log('%c Line:177 🥝 files', 'color:#e41a6a', files)
|
|
178
187
|
|
|
179
|
-
if(mylimit?.value === 1){
|
|
188
|
+
if (mylimit?.value === 1) {
|
|
180
189
|
upload.value!.clearFiles()
|
|
181
190
|
const file = files[0] as UploadRawFile
|
|
182
191
|
file.uid = genFileId()
|
|
183
192
|
upload.value!.handleStart(file)
|
|
184
193
|
}
|
|
185
|
-
if(
|
|
194
|
+
if (mylimit?.value > 1) {
|
|
186
195
|
console.log('超出限制: ', files)
|
|
187
|
-
ElMessage.warning(
|
|
196
|
+
ElMessage.warning(`${t('fileRelated.exceedFiles')} ${mylimit?.value} ${t('fileRelated.reselect')}`)
|
|
188
197
|
}
|
|
189
198
|
}
|
|
190
199
|
|
|
@@ -208,8 +217,8 @@ const handleRemove: UploadProps['onRemove'] = (file, fileList) => {
|
|
|
208
217
|
//上传文件
|
|
209
218
|
const submitUpload = () => {
|
|
210
219
|
console.log(fileList.value.length)
|
|
211
|
-
if (!fileList.value.length) return ElMessage.warning('
|
|
212
|
-
exporLoading.value = ElLoading.service({ text: '
|
|
220
|
+
if (!fileList.value.length) return ElMessage.warning(t('fileRelated.pleaseFile'))
|
|
221
|
+
exporLoading.value = ElLoading.service({ text: t('fileRelated.importing') })
|
|
213
222
|
console.log('upload.value', upload.value)
|
|
214
223
|
upload.value!.submit()
|
|
215
224
|
visible.value = false
|
|
@@ -259,7 +268,7 @@ const onSuccess = async (res: any, file: any, fileList: any) => {
|
|
|
259
268
|
//文件上传失败回调
|
|
260
269
|
const onError = (response: any, file: any, fileList: any) => {
|
|
261
270
|
console.log('上传失败回调: ', response)
|
|
262
|
-
ElMessage.error(file.name + '
|
|
271
|
+
ElMessage.error(file.name + t('fileRelated.uploadFailed'))
|
|
263
272
|
// fileList.value.length = 0 // 清空文件列表
|
|
264
273
|
upload.value!.clearFiles() // 清空文件列表
|
|
265
274
|
visible.value = false // 关闭上传面板
|
|
@@ -307,13 +316,17 @@ const formwork = () => {
|
|
|
307
316
|
const params = props.parameter
|
|
308
317
|
ajaxBox.downFileFetchV2(url, params, {
|
|
309
318
|
method: 'GET',
|
|
310
|
-
fileName: props.templateName || '
|
|
319
|
+
fileName: props.templateName || t('fileRelated.template')
|
|
311
320
|
})
|
|
312
321
|
}
|
|
313
322
|
|
|
314
323
|
//选择框
|
|
315
324
|
onMounted(async () => {
|
|
316
|
-
|
|
325
|
+
if (props.url) {
|
|
326
|
+
affiliationOptions.value = await getAffiliationOptions()
|
|
327
|
+
} else {
|
|
328
|
+
affiliationOptions.value = []
|
|
329
|
+
}
|
|
317
330
|
})
|
|
318
331
|
|
|
319
332
|
// const getAffiliationOptions = async (
|
package/src/utils/lang/en.js
CHANGED
|
@@ -21,6 +21,18 @@ const en = {
|
|
|
21
21
|
last3Month: 'Last 3 Month' // 最近3个月
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
+
fileRelated:{
|
|
25
|
+
selectFile:'SELECT FILE',
|
|
26
|
+
downloadTemplate:'Download Template',
|
|
27
|
+
selectCompany:'Choose a company to belong to',
|
|
28
|
+
upload:'Upload',
|
|
29
|
+
attachmentUpload:'Attachment upload',
|
|
30
|
+
exceedFiles:'Exceeded the maximum file count of ',
|
|
31
|
+
reselect:' files, please select again',
|
|
32
|
+
pleaseFile:'Please select the file before uploading!',
|
|
33
|
+
importing:'Importing in progress ···',
|
|
34
|
+
uploadFailed:'Upload failed',
|
|
35
|
+
},
|
|
24
36
|
public: {
|
|
25
37
|
placeholders: 'Please choose', // 请选择
|
|
26
38
|
placeholderi: 'Please fill in', // 请填写
|
package/src/utils/lang/zh.js
CHANGED
|
@@ -21,6 +21,19 @@ const zh = {
|
|
|
21
21
|
last3Month: '最近3个月'
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
+
fileRelated:{
|
|
25
|
+
selectFile:'选择文件',
|
|
26
|
+
downloadTemplate:'下载模板',
|
|
27
|
+
selectCompany:'选择归属公司',
|
|
28
|
+
upload:'上传',
|
|
29
|
+
attachmentUpload:'附件上传',
|
|
30
|
+
exceedFiles:'超出最大文件数 ',
|
|
31
|
+
reselect:' 个文件,请重新选择',
|
|
32
|
+
pleaseFile:'请选择文件后在上传!',
|
|
33
|
+
importing:'导入中···',
|
|
34
|
+
uploadFailed:'上传失败',
|
|
35
|
+
template:'模板.xlsx'
|
|
36
|
+
},
|
|
24
37
|
public: {
|
|
25
38
|
placeholders: '请选择',
|
|
26
39
|
placeholderi: '请填写',
|