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 CHANGED
@@ -1,6 +1,8 @@
1
1
  ## 历史更新
2
2
 
3
3
  ```js
4
+ 1.7.8
5
+ 1、导入组件3中优化单选文件的时候覆盖文件逻辑
4
6
  1.7.7
5
7
  1、新增导入组件3(可以选择归属公司)
6
8
  1.7.6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ci-plus",
3
- "version": "1.7.7",
3
+ "version": "1.7.8",
4
4
  "description": "ci组件库",
5
5
  "main": "./index.ts",
6
6
  "scripts": {
@@ -61,7 +61,7 @@
61
61
  </template>
62
62
 
63
63
  <script setup lang="ts">
64
- defineOptions({ name: 'ci-uploadV2' })
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 { onMounted, ref } from 'vue'
104
- import { ElMessage, ElLoading, ElButton, ElPopover, ElUpload, ElSelectV2 } from 'element-plus'
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 type { AxiosRequestConfig } from 'axios'
113
- import axios from 'axios'
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('超出限制: ', files)
178
- ElMessage.warning(`超出最大文件数:${mylimit?.value}个文件,请重新选择`)
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
  // 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用