ci-plus 1.1.3 → 1.1.6

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/index.ts CHANGED
@@ -2,8 +2,8 @@ import * as components from './src/index';
2
2
  export * from './src/index';
3
3
  import { App } from 'vue';
4
4
 
5
- import * as D from './src/utils';
6
- console.log('D: ', D);
5
+ import * as Fn from './src/utils';
6
+ console.log('D: ', Fn);
7
7
 
8
8
  export default {
9
9
  install: (app: App) => {
@@ -13,5 +13,5 @@ export default {
13
13
  app.use(components[c]);
14
14
  }
15
15
  },
16
- D,
16
+ Fn,
17
17
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ci-plus",
3
- "version": "1.1.3",
3
+ "version": "1.1.6",
4
4
  "description": "ci组件库",
5
5
  "main": "./index.ts",
6
6
  "scripts": {
@@ -31,23 +31,16 @@ defineOptions({ name: 'ci-seeFile' })
31
31
  import { ref, watch } from 'vue'
32
32
  import axios from 'axios'
33
33
  import { ElMessage } from 'element-plus'
34
- const props = defineProps<{
34
+
35
+ interface Props {
35
36
  url?: string[] // 传入要显示的附件地址数组
36
37
  baseUrl?: string // 图片展示的基础路径
37
- }>()
38
- /*
39
- 数据结构说明:
40
- props.url:[
41
- "media/material/3.1708222741.7763922.webp",
42
- "media/material/3号(number-3)_爱给网_aigei_com.1708222741.7783866.png"
43
- ]
38
+ }
44
39
 
45
- 基础路径
46
- props.baseUrl : http://10.20.72.231:9999/
47
- */
40
+ const props = defineProps<Props>()
48
41
 
49
42
  // 定义一个函数,用于处理字符串
50
- export const setFilePath = (arr: string[], url?: string) => {
43
+ const setFilePath = (arr: string[], url?: string) => {
51
44
  // console.log('重新渲染数据', arr);
52
45
  if (arr && arr.length > 0) {
53
46
  let newArr: { name: string; oldName: string }[] = []
@@ -66,7 +59,7 @@ export const setFilePath = (arr: string[], url?: string) => {
66
59
  }
67
60
 
68
61
  // 将路径处理成附件的参数
69
- export const fileArr = (url: string, pathArr: string[]) => {
62
+ const fileArr = (url: string, pathArr: string[]) => {
70
63
  if (pathArr && pathArr.length > 0) {
71
64
  let objArr: any = []
72
65
  if (pathArr.length > 0) {
@@ -85,9 +78,6 @@ export const fileArr = (url: string, pathArr: string[]) => {
85
78
  }
86
79
 
87
80
  const emits = defineEmits(['onClick'])
88
-
89
- // console.log('props', props.url)
90
-
91
81
  const pathArr = ref<any[]>([])
92
82
  // 对数组中的每个字符串应用处理函数
93
83
  // @ts-ignore
@@ -97,7 +87,6 @@ pathArr.value = setFilePath(props.url, props.baseUrl || 'http://10.20.72.231:999
97
87
  watch(
98
88
  () => props.url,
99
89
  (newVal) => {
100
- // console.log('newVal: ', newVal)
101
90
  // 对新值进行处理
102
91
  // @ts-ignore
103
92
  pathArr.value = setFilePath(newVal, props.baseUrl || 'http://10.20.72.231:9999/')
@@ -45,7 +45,7 @@
45
45
  <script setup lang="ts">
46
46
  defineOptions({ name: 'ci-uploadV2' })
47
47
  // 定义一个函数,用于处理字符串
48
- export const setFilePath = (arr: string[], url?: string) => {
48
+ const setFilePath = (arr: string[], url?: string) => {
49
49
  // console.log('重新渲染数据', arr);
50
50
  if (arr && arr.length > 0) {
51
51
  let newArr: { name: string; oldName: string }[] = []
@@ -64,7 +64,7 @@ export const setFilePath = (arr: string[], url?: string) => {
64
64
  }
65
65
 
66
66
  // 将路径处理成附件的参数
67
- export const fileArr = (url: string, pathArr: string[]) => {
67
+ const fileArr = (url: string, pathArr: string[]) => {
68
68
  if (pathArr && pathArr.length > 0) {
69
69
  let objArr: any = []
70
70
  if (pathArr.length > 0) {
@@ -95,18 +95,18 @@ import type {
95
95
  const upload = ref<UploadInstance>()
96
96
  const exporLoading = ref()
97
97
  const visible = ref(false)
98
- // const filelist = ref([])
99
98
 
100
- const props = defineProps<{
99
+ interface Props {
101
100
  url?: string // 上传和下载模板的接口(当需要将附件传递回父组件时不需要传递此属性)
102
- parameter?: () => {} // 模板下载的时候请求需要携带的参数:{state: 1}
103
- data?: () => {} //上传携带的其他数据对象:{userId: 1, userName: '张三'}
101
+ parameter?: () => void // 模板下载的时候请求需要携带的参数:{state: 1}
102
+ data?: () => void //上传携带的其他数据对象:{userId: 1, userName: '张三'}
104
103
  title?: string // 上传按钮的名称
105
104
  multiple?: boolean // 是否支持多文件
106
105
  limit?: number // 最大文件数量
107
106
  filePath?: UploadFile[] //UploadRawFile[] // 父组件传递的附件数据,用于显示附件列表和上传附件后传递给父组件附件数据
108
107
  RowIndex?: number // 父组件传递的行索引,用于父组件中删除了附件找到对应的行
109
- }>()
108
+ }
109
+ const props = defineProps<Props>()
110
110
  const emits = defineEmits<{
111
111
  (e: 'reloadTable'): void // 组件中上传附件后刷新父组件表格数据方法
112
112
  (e: 'getFile', files: UploadFiles, file?: UploadFile, rowindex?: number): void
@@ -133,22 +133,11 @@ console.log('fileList: ', fileList.value)
133
133
  const handleExceed: UploadProps['onExceed'] = (files) => {
134
134
  console.log('超出限制: ', files)
135
135
  ElMessage.warning(`超出最大文件数:${mylimit?.value}个文件,请重新选择`)
136
- // upload.value!.clearFiles()
137
- // const file = files[0] as UploadRawFile
138
- // file.uid = genFileId()
139
- // upload.value!.handleStart(file)
140
136
  }
141
137
 
142
138
  // 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用
143
139
  const handleChange = (file: any, fileLists: any) => {
144
- // console.log('file: ', file)
145
- // console.log('fileList: ', fileLists)
146
- // filelist.value = fileLists //更新文件列表数据
147
- // 如果没有url就将选中的附件文件流传递回父组件
148
140
  if (!props.url) {
149
- // const files: UploadRawFile[] = fileLists.map(
150
- // (item) => item.raw,
151
- // ) as UploadRawFile[]
152
141
  emits('getFile', fileLists) //将选中的文件传递回父组件
153
142
  emits('update:file', fileLists) //同步父组件绑定的附件字段,以便父组件提交表单的时候一起将附件提交
154
143
  }
@@ -159,9 +148,6 @@ const handleRemove: UploadProps['onRemove'] = (file, fileList) => {
159
148
  console.log('fileList: ', fileList)
160
149
  // 如果没有url时 在删除的时候将文件流同步回父组件
161
150
  if (!props.url) {
162
- // const files: UploadRawFile[] = fileList.map(
163
- // (item) => item.raw,
164
- // ) as UploadRawFile[]
165
151
  emits('getFile', fileList, file, props.RowIndex)
166
152
  emits('update:file', fileList)
167
153
  }