ci-plus 1.7.7 → 1.7.8
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 +21 -11
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
</template>
|
|
62
62
|
|
|
63
63
|
<script setup lang="ts">
|
|
64
|
-
defineOptions({ name: 'ci-
|
|
64
|
+
defineOptions({ name: 'ci-uploadV3' })
|
|
65
65
|
// 定义一个函数,用于处理字符串
|
|
66
66
|
const setFilePath = (arr: string[], url?: string) => {
|
|
67
67
|
// console.log('重新渲染数据', arr);
|
|
@@ -100,19 +100,19 @@ const fileArr = (url: string, pathArr: string[]) => {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
import {
|
|
104
|
-
import
|
|
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
|
-
import
|
|
114
|
-
import ajaxBox from '../utils/ajaxBox'
|
|
115
|
-
import getAffiliationOptions from '../utils/getAffiliationOptions.ts'
|
|
111
|
+
} from 'element-plus';
|
|
112
|
+
import { ElButton, ElLoading, ElMessage, ElPopover, ElSelectV2, ElUpload, genFileId, UploadRawFile } from 'element-plus';
|
|
113
|
+
import { onMounted, ref } from 'vue';
|
|
114
|
+
import ajaxBox from '../utils/ajaxBox';
|
|
115
|
+
import getAffiliationOptions from '../utils/getAffiliationOptions.ts';
|
|
116
116
|
const upload = ref<UploadInstance>()
|
|
117
117
|
const exporLoading = ref()
|
|
118
118
|
const visible = ref(false)
|
|
@@ -154,7 +154,7 @@ const emits = defineEmits<{
|
|
|
154
154
|
console.log('附件props: ', props)
|
|
155
155
|
const datas: any = ref(props.data)
|
|
156
156
|
const mymultiple = ref<boolean>(props.multiple)
|
|
157
|
-
const mylimit = ref<number>(props.limit as number)
|
|
157
|
+
const mylimit = ref<number>(props.limit as number ||1)
|
|
158
158
|
const myfilePath = ref<any>(props.filePath || [])
|
|
159
159
|
console.log('myfilePath: ', props.filePath)
|
|
160
160
|
|
|
@@ -174,8 +174,18 @@ console.log('fileList: ', fileList.value)
|
|
|
174
174
|
|
|
175
175
|
//当超出限制时,执行的钩子函数
|
|
176
176
|
const handleExceed: UploadProps['onExceed'] = (files) => {
|
|
177
|
-
console.log(
|
|
178
|
-
|
|
177
|
+
console.log("%c Line:177 🥝 files", "color:#e41a6a", files);
|
|
178
|
+
|
|
179
|
+
if(mylimit?.value === 1){
|
|
180
|
+
upload.value!.clearFiles()
|
|
181
|
+
const file = files[0] as UploadRawFile
|
|
182
|
+
file.uid = genFileId()
|
|
183
|
+
upload.value!.handleStart(file)
|
|
184
|
+
}
|
|
185
|
+
if( mylimit?.value > 1){
|
|
186
|
+
console.log('超出限制: ', files)
|
|
187
|
+
ElMessage.warning(`超出最大文件数:${mylimit?.value}个文件,请重新选择`)
|
|
188
|
+
}
|
|
179
189
|
}
|
|
180
190
|
|
|
181
191
|
// 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用
|