ci-plus 1.1.2 → 1.1.5
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 +6 -3
- package/package.json +1 -1
- package/src/components.d.ts +4 -1
- package/src/fileRelated/ciupload.vue +1 -0
- package/src/fileRelated/index/ciseeFile.ts +4 -0
- package/src/fileRelated/index/ciuploadV2.ts +4 -0
- package/src/fileRelated/seeFile.vue +5 -15
- package/src/fileRelated/uploadV2.vue +6 -19
- package/src/index.ts +6 -2
- package/src/utils/index.ts +3 -1
package/index.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
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
7
|
|
|
6
8
|
export default {
|
|
7
9
|
install: (app: App) => {
|
|
8
10
|
// 注册所有组件
|
|
9
|
-
console.log('注册所有ci-plus
|
|
11
|
+
console.log('注册所有ci-plus组件1.1.3: ');
|
|
10
12
|
for (const c in components) {
|
|
11
13
|
app.use(components[c]);
|
|
12
14
|
}
|
|
13
|
-
}
|
|
15
|
+
},
|
|
16
|
+
D,
|
|
14
17
|
};
|
package/package.json
CHANGED
package/src/components.d.ts
CHANGED
|
@@ -19,8 +19,11 @@ declare module '@vue/runtime-core' {
|
|
|
19
19
|
CiHeaderInput: typeof components.HeaderInput
|
|
20
20
|
CiSdialog: typeof components.Sdialog
|
|
21
21
|
CiColumncell: typeof components.Columncell
|
|
22
|
-
CiUpload: typeof components.Upload
|
|
23
22
|
CiIdentificationCard: typeof components.IdentificationCard
|
|
23
|
+
|
|
24
|
+
CiSeeFile: typeof components.SeeFile
|
|
25
|
+
CiUpload: typeof components.Upload
|
|
26
|
+
CiUploadV2: typeof components.UploadV2
|
|
24
27
|
}
|
|
25
28
|
}
|
|
26
29
|
export { };
|
|
@@ -27,23 +27,17 @@
|
|
|
27
27
|
</template>
|
|
28
28
|
|
|
29
29
|
<script setup lang="ts">
|
|
30
|
+
defineOptions({ name: 'ci-seeFile' })
|
|
30
31
|
import { ref, watch } from 'vue'
|
|
31
32
|
import axios from 'axios'
|
|
32
33
|
import { ElMessage } from 'element-plus'
|
|
33
|
-
|
|
34
|
+
|
|
35
|
+
interface Props {
|
|
34
36
|
url?: string[] // 传入要显示的附件地址数组
|
|
35
37
|
baseUrl?: string // 图片展示的基础路径
|
|
36
|
-
}
|
|
37
|
-
/*
|
|
38
|
-
数据结构说明:
|
|
39
|
-
props.url:[
|
|
40
|
-
"media/material/3.1708222741.7763922.webp",
|
|
41
|
-
"media/material/3号(number-3)_爱给网_aigei_com.1708222741.7783866.png"
|
|
42
|
-
]
|
|
38
|
+
}
|
|
43
39
|
|
|
44
|
-
|
|
45
|
-
props.baseUrl : http://10.20.72.231:9999/
|
|
46
|
-
*/
|
|
40
|
+
const props = defineProps<Props>()
|
|
47
41
|
|
|
48
42
|
// 定义一个函数,用于处理字符串
|
|
49
43
|
export const setFilePath = (arr: string[], url?: string) => {
|
|
@@ -84,9 +78,6 @@ export const fileArr = (url: string, pathArr: string[]) => {
|
|
|
84
78
|
}
|
|
85
79
|
|
|
86
80
|
const emits = defineEmits(['onClick'])
|
|
87
|
-
|
|
88
|
-
// console.log('props', props.url)
|
|
89
|
-
|
|
90
81
|
const pathArr = ref<any[]>([])
|
|
91
82
|
// 对数组中的每个字符串应用处理函数
|
|
92
83
|
// @ts-ignore
|
|
@@ -96,7 +87,6 @@ pathArr.value = setFilePath(props.url, props.baseUrl || 'http://10.20.72.231:999
|
|
|
96
87
|
watch(
|
|
97
88
|
() => props.url,
|
|
98
89
|
(newVal) => {
|
|
99
|
-
// console.log('newVal: ', newVal)
|
|
100
90
|
// 对新值进行处理
|
|
101
91
|
// @ts-ignore
|
|
102
92
|
pathArr.value = setFilePath(newVal, props.baseUrl || 'http://10.20.72.231:9999/')
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
</template>
|
|
44
44
|
|
|
45
45
|
<script setup lang="ts">
|
|
46
|
+
defineOptions({ name: 'ci-uploadV2' })
|
|
46
47
|
// 定义一个函数,用于处理字符串
|
|
47
48
|
export const setFilePath = (arr: string[], url?: string) => {
|
|
48
49
|
// console.log('重新渲染数据', arr);
|
|
@@ -94,18 +95,18 @@ import type {
|
|
|
94
95
|
const upload = ref<UploadInstance>()
|
|
95
96
|
const exporLoading = ref()
|
|
96
97
|
const visible = ref(false)
|
|
97
|
-
// const filelist = ref([])
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
interface Props {
|
|
100
100
|
url?: string // 上传和下载模板的接口(当需要将附件传递回父组件时不需要传递此属性)
|
|
101
|
-
parameter?: () =>
|
|
102
|
-
data?: () =>
|
|
101
|
+
parameter?: () => void // 模板下载的时候请求需要携带的参数:{state: 1}
|
|
102
|
+
data?: () => void //上传携带的其他数据对象:{userId: 1, userName: '张三'}
|
|
103
103
|
title?: string // 上传按钮的名称
|
|
104
104
|
multiple?: boolean // 是否支持多文件
|
|
105
105
|
limit?: number // 最大文件数量
|
|
106
106
|
filePath?: UploadFile[] //UploadRawFile[] // 父组件传递的附件数据,用于显示附件列表和上传附件后传递给父组件附件数据
|
|
107
107
|
RowIndex?: number // 父组件传递的行索引,用于父组件中删除了附件找到对应的行
|
|
108
|
-
}
|
|
108
|
+
}
|
|
109
|
+
const props = defineProps<Props>()
|
|
109
110
|
const emits = defineEmits<{
|
|
110
111
|
(e: 'reloadTable'): void // 组件中上传附件后刷新父组件表格数据方法
|
|
111
112
|
(e: 'getFile', files: UploadFiles, file?: UploadFile, rowindex?: number): void
|
|
@@ -132,22 +133,11 @@ console.log('fileList: ', fileList.value)
|
|
|
132
133
|
const handleExceed: UploadProps['onExceed'] = (files) => {
|
|
133
134
|
console.log('超出限制: ', files)
|
|
134
135
|
ElMessage.warning(`超出最大文件数:${mylimit?.value}个文件,请重新选择`)
|
|
135
|
-
// upload.value!.clearFiles()
|
|
136
|
-
// const file = files[0] as UploadRawFile
|
|
137
|
-
// file.uid = genFileId()
|
|
138
|
-
// upload.value!.handleStart(file)
|
|
139
136
|
}
|
|
140
137
|
|
|
141
138
|
// 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用
|
|
142
139
|
const handleChange = (file: any, fileLists: any) => {
|
|
143
|
-
// console.log('file: ', file)
|
|
144
|
-
// console.log('fileList: ', fileLists)
|
|
145
|
-
// filelist.value = fileLists //更新文件列表数据
|
|
146
|
-
// 如果没有url就将选中的附件文件流传递回父组件
|
|
147
140
|
if (!props.url) {
|
|
148
|
-
// const files: UploadRawFile[] = fileLists.map(
|
|
149
|
-
// (item) => item.raw,
|
|
150
|
-
// ) as UploadRawFile[]
|
|
151
141
|
emits('getFile', fileLists) //将选中的文件传递回父组件
|
|
152
142
|
emits('update:file', fileLists) //同步父组件绑定的附件字段,以便父组件提交表单的时候一起将附件提交
|
|
153
143
|
}
|
|
@@ -158,9 +148,6 @@ const handleRemove: UploadProps['onRemove'] = (file, fileList) => {
|
|
|
158
148
|
console.log('fileList: ', fileList)
|
|
159
149
|
// 如果没有url时 在删除的时候将文件流同步回父组件
|
|
160
150
|
if (!props.url) {
|
|
161
|
-
// const files: UploadRawFile[] = fileList.map(
|
|
162
|
-
// (item) => item.raw,
|
|
163
|
-
// ) as UploadRawFile[]
|
|
164
151
|
emits('getFile', fileList, file, props.RowIndex)
|
|
165
152
|
emits('update:file', fileList)
|
|
166
153
|
}
|
package/src/index.ts
CHANGED
|
@@ -10,5 +10,9 @@ export * from './sortableTable/index/headerInput'; // 导出筛选面板
|
|
|
10
10
|
export * from './sortableTable/index/sortableTable'; // 导出排序表格
|
|
11
11
|
export * from './sortableTable/index/sortableTableDialog'; // 导出表排序组件
|
|
12
12
|
export * from './sortableTable/index/sortableTableColumnCell'; // 导出表列组件
|
|
13
|
-
|
|
14
|
-
export * from './identificationCard'; // 导出标识卡模板组件
|
|
13
|
+
|
|
14
|
+
export * from './identificationCard'; // 导出标识卡模板组件
|
|
15
|
+
|
|
16
|
+
export * from './fileRelated/index/ciseeFile'; // 导出附件查看组件
|
|
17
|
+
export * from './fileRelated/index/ciupload'; // 导出附件上传组件
|
|
18
|
+
export * from './fileRelated/index/ciuploadV2'; // 导出附件上传v2组件
|
package/src/utils/index.ts
CHANGED