ci-plus 1.5.2 → 1.5.4
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/package.json +2 -2
- package/src/fileRelated/uploadV2.vue +153 -39
- package/src/utils/ajaxBox.ts +144 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ci-plus",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.4",
|
|
4
4
|
"description": "ci组件库",
|
|
5
5
|
"main": "./index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"vue",
|
|
13
13
|
"element-plus",
|
|
14
14
|
"ui组件库二次封装",
|
|
15
|
-
"
|
|
15
|
+
"更新附件上传组件uploadV2.vue"
|
|
16
16
|
],
|
|
17
17
|
"type": "module",
|
|
18
18
|
"author": {
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<el-popover
|
|
2
|
+
<el-popover
|
|
3
|
+
placement="bottom"
|
|
4
|
+
:width="300"
|
|
5
|
+
:trigger="props.otherConfig?.trigger || 'hover'"
|
|
6
|
+
>
|
|
3
7
|
<el-upload
|
|
4
8
|
ref="upload"
|
|
5
9
|
class="upload-demo"
|
|
@@ -16,7 +20,14 @@
|
|
|
16
20
|
v-model:file-list="fileList"
|
|
17
21
|
>
|
|
18
22
|
<template #trigger>
|
|
19
|
-
<el-button
|
|
23
|
+
<el-button
|
|
24
|
+
size="small"
|
|
25
|
+
type="primary"
|
|
26
|
+
style="width: 100%"
|
|
27
|
+
plain
|
|
28
|
+
>
|
|
29
|
+
选择文件
|
|
30
|
+
</el-button>
|
|
20
31
|
</template>
|
|
21
32
|
<el-button
|
|
22
33
|
size="small"
|
|
@@ -28,14 +39,32 @@
|
|
|
28
39
|
</el-button>
|
|
29
40
|
</el-upload>
|
|
30
41
|
|
|
31
|
-
<div
|
|
32
|
-
|
|
33
|
-
|
|
42
|
+
<div
|
|
43
|
+
style="width: 100%; display: flex"
|
|
44
|
+
v-if="url"
|
|
45
|
+
>
|
|
46
|
+
<el-button
|
|
47
|
+
size="small"
|
|
48
|
+
@click="visible = false"
|
|
49
|
+
style="flex: 1"
|
|
50
|
+
>
|
|
51
|
+
取消
|
|
52
|
+
</el-button>
|
|
53
|
+
<el-button
|
|
54
|
+
size="small"
|
|
55
|
+
type="primary"
|
|
56
|
+
@click="submitUpload"
|
|
57
|
+
style="flex: 2"
|
|
58
|
+
>
|
|
34
59
|
上传
|
|
35
60
|
</el-button>
|
|
36
61
|
</div>
|
|
37
62
|
<template #reference>
|
|
38
|
-
<el-button
|
|
63
|
+
<el-button
|
|
64
|
+
type="success"
|
|
65
|
+
@click="visible = true"
|
|
66
|
+
:size="props.otherConfig?.size || 'small'"
|
|
67
|
+
>
|
|
39
68
|
{{ props.title || '附件上传' }}
|
|
40
69
|
</el-button>
|
|
41
70
|
</template>
|
|
@@ -72,7 +101,7 @@ const fileArr = (url: string, pathArr: string[]) => {
|
|
|
72
101
|
objArr.push({
|
|
73
102
|
name: item.name,
|
|
74
103
|
oldName: item.oldName,
|
|
75
|
-
url: url + item.oldName
|
|
104
|
+
url: url + item.oldName,
|
|
76
105
|
})
|
|
77
106
|
})
|
|
78
107
|
return objArr
|
|
@@ -87,35 +116,53 @@ import {
|
|
|
87
116
|
ElMessage,
|
|
88
117
|
ElLoading,
|
|
89
118
|
ElButton,
|
|
90
|
-
ElPopover
|
|
119
|
+
ElPopover,
|
|
120
|
+
ElUpload,
|
|
91
121
|
} from 'element-plus'
|
|
92
|
-
import axios from 'axios'
|
|
93
122
|
import type {
|
|
94
123
|
UploadFile,
|
|
95
124
|
UploadFiles,
|
|
96
125
|
UploadInstance,
|
|
97
126
|
UploadProps,
|
|
98
|
-
UploadUserFile
|
|
127
|
+
UploadUserFile,
|
|
99
128
|
} from 'element-plus'
|
|
129
|
+
import type { AxiosRequestConfig } from 'axios'
|
|
130
|
+
import ajaxBox from '../utils/ajaxBox'
|
|
100
131
|
const upload = ref<UploadInstance>()
|
|
101
132
|
const exporLoading = ref()
|
|
102
133
|
const visible = ref(false)
|
|
103
134
|
|
|
104
135
|
interface Props {
|
|
105
136
|
url?: string // 上传和下载模板的接口(当需要将附件传递回父组件时不需要传递此属性)
|
|
106
|
-
parameter?:
|
|
107
|
-
data?:
|
|
137
|
+
parameter?: Object // 模板下载的时候请求需要携带的参数:{state: 1}
|
|
138
|
+
data?: Object //上传携带的其他数据对象:{userId: 1, userName: '张三'}
|
|
108
139
|
title?: string // 上传按钮的名称
|
|
109
140
|
multiple?: boolean // 是否支持多文件
|
|
110
141
|
limit?: number // 最大文件数量
|
|
111
142
|
filePath?: UploadFile[] //UploadRawFile[] // 父组件传递的附件数据,用于显示附件列表和上传附件后传递给父组件附件数据
|
|
112
|
-
RowIndex?: number // 父组件传递的行索引,用于父组件中删除了附件找到对应的行
|
|
143
|
+
RowIndex?: number // 父组件传递的行索引,用于父组件中删除了附件找到对应的行(用于表格表单中上传附件)
|
|
144
|
+
templateName?: string //模板名称
|
|
145
|
+
timeOn?: boolean // 是否开启耗时任务 默认不开启
|
|
146
|
+
// 其他的一些配置:请求的baseurl地址,有耗时任务的时候耗时任务的配置,模板下载的一些配置等
|
|
147
|
+
otherConfig: {
|
|
148
|
+
size?: 'large' | 'default' | 'small' // 按钮大小
|
|
149
|
+
trigger?: 'click' | 'focus' | 'hover' | 'contextmenu' // 按钮触发方式 默认 hover
|
|
150
|
+
baseUrl?: string // 上请求的baseurl地址
|
|
151
|
+
datakey: string // 耗时请求的参数key值
|
|
152
|
+
// 耗时任务的配置
|
|
153
|
+
timeConfig: {
|
|
154
|
+
url: string
|
|
155
|
+
method: 'put' | 'post' | 'get' | 'PUT' | 'POST' | 'GET'
|
|
156
|
+
data?: object // 可选属性
|
|
157
|
+
params?: object // 可选属性
|
|
158
|
+
}
|
|
159
|
+
}
|
|
113
160
|
}
|
|
114
161
|
const props = defineProps<Props>()
|
|
115
162
|
const emits = defineEmits<{
|
|
116
163
|
(e: 'reloadTable'): void // 组件中上传附件后刷新父组件表格数据方法
|
|
117
|
-
(e: 'getFile', files: UploadFiles, file?: UploadFile, rowindex?: number): void
|
|
118
|
-
(e: 'update:file', files: UploadFiles): void
|
|
164
|
+
(e: 'getFile', files: UploadFiles, file?: UploadFile, rowindex?: number): void // 编辑表单的时候回显附件用到
|
|
165
|
+
(e: 'update:file', files: UploadFiles): void // 编辑表单的时候回显附件用到
|
|
119
166
|
}>()
|
|
120
167
|
console.log('附件props: ', props)
|
|
121
168
|
const datas = ref(props.data)
|
|
@@ -167,38 +214,105 @@ const submitUpload = () => {
|
|
|
167
214
|
visible.value = false
|
|
168
215
|
}
|
|
169
216
|
//文件上传成功回调
|
|
170
|
-
const onSuccess = (res: any, file: any, fileList: any) => {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
217
|
+
const onSuccess = async (res: any, file: any, fileList: any) => {
|
|
218
|
+
console.log('fileList: ', fileList)
|
|
219
|
+
console.log('file: ', file)
|
|
220
|
+
console.log('上传成功回调: ', res)
|
|
221
|
+
// exporLoading.value.close() // 关闭加载动画
|
|
222
|
+
if (res.code !== 200) {
|
|
223
|
+
upload.value!.clearFiles() // 清空文件列表
|
|
224
|
+
exporLoading.value.close() // 关闭加载动画
|
|
225
|
+
return ElMessage.warning(res.msg)
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// 判断是否要走耗时逻辑
|
|
229
|
+
if (!props.timeOn || !res.data) {
|
|
230
|
+
upload.value!.clearFiles() // 清空文件列表
|
|
231
|
+
visible.value = false // 关闭上传面板
|
|
232
|
+
exporLoading.value.close() // 关闭加载动画
|
|
233
|
+
ElMessage.success(res.msg)
|
|
234
|
+
emits('reloadTable')
|
|
235
|
+
return
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// 处理耗时请求的参数
|
|
239
|
+
let datas = {}
|
|
240
|
+
datas[props.otherConfig?.datakey] = res.data.task_id
|
|
241
|
+
// 耗时轮训
|
|
242
|
+
const data = await askForTask(datas)
|
|
243
|
+
console.log('data: ', data)
|
|
244
|
+
if (data.code === 200) {
|
|
245
|
+
// fileList.value.length = 0 // 清空文件列表
|
|
246
|
+
upload.value!.clearFiles() // 清空文件列表
|
|
247
|
+
visible.value = false // 关闭上传面板
|
|
248
|
+
exporLoading.value.close() // 关闭加载动画
|
|
249
|
+
ElMessage.success(data.msg)
|
|
250
|
+
emits('reloadTable')
|
|
251
|
+
} else if (data.code === 0) {
|
|
252
|
+
exporLoading.value.close() // 关闭加载动画
|
|
253
|
+
ElMessage.success(data.msg || '导入失败')
|
|
254
|
+
} else {
|
|
255
|
+
ElMessage.success(data.msg || '请求超时或者其他错误,请联系管理员.')
|
|
256
|
+
}
|
|
175
257
|
}
|
|
176
258
|
//文件上传失败回调
|
|
177
259
|
const onError = (response: any, file: any, fileList: any) => {
|
|
178
|
-
|
|
260
|
+
console.log('上传失败回调: ', response)
|
|
261
|
+
ElMessage.error(file.name + '上传失败')
|
|
262
|
+
// fileList.value.length = 0 // 清空文件列表
|
|
263
|
+
upload.value!.clearFiles() // 清空文件列表
|
|
264
|
+
visible.value = false // 关闭上传面板
|
|
265
|
+
exporLoading.value.close() // 关闭加载动画
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// 耗时请求函数
|
|
269
|
+
const askForTask: (task_info: any) => Promise<any> = async (task_info: any) => {
|
|
270
|
+
// 处理父组件传递的配置
|
|
271
|
+
const axiosConfig: AxiosRequestConfig = {
|
|
272
|
+
...props.otherConfig?.timeConfig,
|
|
273
|
+
}
|
|
274
|
+
// 处理请求的参数
|
|
275
|
+
if (
|
|
276
|
+
props.otherConfig?.timeConfig?.method === 'get' ||
|
|
277
|
+
props.otherConfig?.timeConfig?.method === 'GET'
|
|
278
|
+
) {
|
|
279
|
+
axiosConfig.params = {
|
|
280
|
+
...props.otherConfig?.timeConfig.params,
|
|
281
|
+
...task_info,
|
|
282
|
+
}
|
|
283
|
+
} else {
|
|
284
|
+
axiosConfig.data = {
|
|
285
|
+
...props.otherConfig?.timeConfig.data,
|
|
286
|
+
...task_info,
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
try {
|
|
290
|
+
const res = await axios(axiosConfig)
|
|
291
|
+
// 如果返回的code是50001 就继续轮询,直到返回的code不是50001
|
|
292
|
+
if (res.data.code === 50001)
|
|
293
|
+
return await new Promise((resolve) => {
|
|
294
|
+
setTimeout(() => resolve(askForTask(task_info)), 2000)
|
|
295
|
+
})
|
|
296
|
+
return res.data
|
|
297
|
+
} catch (error) {
|
|
298
|
+
console.error('Error fetching task:', error)
|
|
299
|
+
throw error
|
|
300
|
+
}
|
|
179
301
|
}
|
|
180
302
|
|
|
181
303
|
//下载模板
|
|
182
304
|
const formwork = () => {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
305
|
+
const url = props.url + '_get/'
|
|
306
|
+
const params = props.parameter
|
|
307
|
+
ajaxBox.downFileFetchV2(url, params, {
|
|
308
|
+
method: 'GET',
|
|
309
|
+
fileName: props.templateName || '模板.xlsx',
|
|
188
310
|
})
|
|
189
|
-
.then((res) => {
|
|
190
|
-
const url = URL.createObjectURL(new Blob([res.data]))
|
|
191
|
-
let link: HTMLAnchorElement | null = document.createElement('a')
|
|
192
|
-
link.href = url
|
|
193
|
-
link.setAttribute('download', '模板.xlsx')
|
|
194
|
-
document.body.appendChild(link)
|
|
195
|
-
link.click()
|
|
196
|
-
link = null
|
|
197
|
-
})
|
|
198
|
-
.catch((error) => {
|
|
199
|
-
console.log(error)
|
|
200
|
-
})
|
|
201
311
|
}
|
|
202
312
|
</script>
|
|
203
313
|
|
|
204
|
-
<style scoped
|
|
314
|
+
<style scoped lang="scss">
|
|
315
|
+
:deep(.el-upload) {
|
|
316
|
+
width: calc(100% - 110px);
|
|
317
|
+
}
|
|
318
|
+
</style>
|
package/src/utils/ajaxBox.ts
CHANGED
|
@@ -62,6 +62,14 @@ const downFileFn = function (blob: Blob | BlobPart, fileName: string) {
|
|
|
62
62
|
type Obj = {
|
|
63
63
|
[key: string]: any
|
|
64
64
|
}
|
|
65
|
+
|
|
66
|
+
interface Config {
|
|
67
|
+
method?: string, // 请求方法,默认为 GET | POST
|
|
68
|
+
headers?: Object, // 请求头
|
|
69
|
+
cbpercentage?: Function // 获取下载进度的回调函数
|
|
70
|
+
fileName?: string, // 下载后的文件名
|
|
71
|
+
chunkSize?: number, // 每次下载的块大小,默认为 10KB
|
|
72
|
+
}
|
|
65
73
|
const ajaxBox = {
|
|
66
74
|
downFile: function (blob: Blob | BlobPart, fileName: string) {
|
|
67
75
|
downFileFn(blob, fileName);
|
|
@@ -80,18 +88,28 @@ const ajaxBox = {
|
|
|
80
88
|
* 如果解析失败,则直接以原始格式下载blob对象。
|
|
81
89
|
*/
|
|
82
90
|
|
|
83
|
-
|
|
84
|
-
downFileFetch: function (fillAddress: string, fileName: string, method: string, headers: Obj, params: Obj, cbpercentage: Function) {
|
|
91
|
+
downFileFetch: function (fillAddress: string, fileName: string, method?: string, headers?: Obj, params?: Obj, cbpercentage?: Function) {
|
|
85
92
|
let options = {
|
|
86
93
|
method: method || 'GET',
|
|
87
94
|
}
|
|
95
|
+
let _headers
|
|
96
|
+
if (options.method === 'GET' || method === 'get') {
|
|
97
|
+
_headers = {
|
|
98
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
} else if (options.method === 'POST' || method === 'post') {
|
|
102
|
+
_headers = {
|
|
103
|
+
'Content-Type': 'application/json', //设置为json格式
|
|
104
|
+
}
|
|
105
|
+
}
|
|
88
106
|
// 判断请求是否为get请求,若是get请求,则将params参数拼接在url后面
|
|
89
107
|
if (method === 'GET') {
|
|
90
108
|
const queryString = new URLSearchParams(params).toString()
|
|
91
109
|
fillAddress = fillAddress + '?' + queryString
|
|
92
110
|
}
|
|
93
111
|
if (headers) {
|
|
94
|
-
options['headers'] = headers
|
|
112
|
+
options['headers'] = headers || _headers
|
|
95
113
|
}
|
|
96
114
|
if ((method === 'post' || method === 'POST') && params) {
|
|
97
115
|
options['body'] = JSON.stringify(params)
|
|
@@ -151,10 +169,111 @@ const ajaxBox = {
|
|
|
151
169
|
}
|
|
152
170
|
}
|
|
153
171
|
|
|
172
|
+
readBlobInChunks()
|
|
173
|
+
})
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
// 下载文件:2.0版本
|
|
177
|
+
/**
|
|
178
|
+
* 下载文件函数
|
|
179
|
+
* @param url string 必传 表示服务端接口url地址
|
|
180
|
+
* @param params Obj 可选 请求参数
|
|
181
|
+
* @param config Config 可选 请求配置
|
|
182
|
+
* Config Config {
|
|
183
|
+
method?: string, // 请求方法,默认为 GET | POST
|
|
184
|
+
headers?: Object, // 请求头,默认值根据method方法判断
|
|
185
|
+
cbpercentage?: Function // 获取下载进度的回调函数
|
|
186
|
+
fileName?: string, // 下载后的文件名默认:'附件'
|
|
187
|
+
chunkSize?: number, // 每次下载的块大小,默认为 10KB
|
|
188
|
+
}
|
|
189
|
+
* 将给定的blob对象转换为文件,并提供一个下载链接以供用户下载。
|
|
190
|
+
* 如果blob对象是JSON格式,则尝试解析为JavaScript对象,并显示相应的错误消息。
|
|
191
|
+
* 如果解析失败,则直接以原始格式下载blob对象。
|
|
192
|
+
*/
|
|
193
|
+
|
|
194
|
+
downFileFetchV2: function (url: string, params?: Obj, config?: Config) {
|
|
195
|
+
let options = {
|
|
196
|
+
method: config?.method || 'GET',
|
|
197
|
+
}
|
|
198
|
+
let _headers
|
|
199
|
+
let _fileName = config?.fileName || '附件'
|
|
200
|
+
if (options.method === 'GET' || options.method === 'get') {
|
|
201
|
+
_headers = {
|
|
202
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
} else if (options.method === 'POST' || options.method === 'post') {
|
|
206
|
+
_headers = {
|
|
207
|
+
'Content-Type': 'application/json', // 设置为json格式
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
// 数组请求头: 优先使用传递的请求头,如果没有传递,则使用默认的请求头
|
|
211
|
+
options['headers'] = config?.headers || _headers
|
|
212
|
+
|
|
213
|
+
// 判断请求是否为get请求,若是get请求,则将params参数拼接在url后面
|
|
214
|
+
if (options.method === 'GET') {
|
|
215
|
+
const queryString = new URLSearchParams(params).toString()
|
|
216
|
+
url = url + '?' + queryString
|
|
217
|
+
}
|
|
218
|
+
// 处理post请求的参数
|
|
219
|
+
if ((options.method === 'post' || options.method === 'POST') && params) {
|
|
220
|
+
options['body'] = JSON.stringify(params)
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// 定义每次读取的数据块大小(字节)
|
|
224
|
+
let chunkSize = config?.chunkSize || 10240 // 例如,10KB
|
|
225
|
+
|
|
226
|
+
// 初始化已下载的字节数
|
|
227
|
+
let downloaded = 0
|
|
228
|
+
// 初始化 Blob 切片起始点
|
|
229
|
+
let start = 0
|
|
230
|
+
|
|
231
|
+
fetch(url, options)
|
|
232
|
+
.then((res) => {
|
|
233
|
+
// console.log('resssssss: ', res)
|
|
234
|
+
if (!res.ok) {
|
|
235
|
+
throw new Error('Network response was not ok')
|
|
236
|
+
}
|
|
237
|
+
return res.blob()
|
|
238
|
+
})
|
|
239
|
+
.then((blob) => {
|
|
240
|
+
// console.log('blob: ', blob)
|
|
241
|
+
const reader = new FileReader() // 创建 FileReader 对象
|
|
242
|
+
const readBlobInChunks = () => {
|
|
243
|
+
// 创建一个 Blob 切片,大小为 chunkSize
|
|
244
|
+
const chunkBlob = blob.slice(start, start + chunkSize)
|
|
245
|
+
start += chunkSize // 更新起始点
|
|
246
|
+
// 读取 Blob 切片
|
|
247
|
+
reader.readAsArrayBuffer(chunkBlob)
|
|
248
|
+
reader.onload = () => {
|
|
249
|
+
// 累加已下载的字节数
|
|
250
|
+
// downloaded += reader.result.byteLength
|
|
251
|
+
if (typeof reader.result === 'string' || reader.result === null) {
|
|
252
|
+
console.log('reader.result不为 ArrayBuffer');
|
|
253
|
+
// 处理字符串的情况,可能需要转换为 ArrayBuffer 或者其他处理逻辑
|
|
254
|
+
} else {
|
|
255
|
+
downloaded += reader.result.byteLength;
|
|
256
|
+
}
|
|
257
|
+
// 计算下载进度百分比
|
|
258
|
+
const total = blob.size
|
|
259
|
+
const progress = ((downloaded / total) * 100).toFixed(2)
|
|
260
|
+
config?.cbpercentage && config?.cbpercentage(progress) // 如果传递了获取下载进度的回调函数,则调用回调函数传递进度百分比
|
|
261
|
+
console.log(`下载进度: ${progress}%`)
|
|
262
|
+
// 如果还有数据未读取,则继续读取
|
|
263
|
+
if (start < total) {
|
|
264
|
+
readBlobInChunks()
|
|
265
|
+
} else {
|
|
266
|
+
console.log('下载完成.')
|
|
267
|
+
// 处理下载完成的数据,例如将其保存或显示
|
|
268
|
+
downFileFn(blob, _fileName)
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
154
272
|
readBlobInChunks()
|
|
155
273
|
})
|
|
156
274
|
}
|
|
157
275
|
|
|
276
|
+
|
|
158
277
|
/*
|
|
159
278
|
sendJSONP: function (url, callbackName, callback) {
|
|
160
279
|
const script = document.createElement('script');
|
|
@@ -182,10 +301,9 @@ export default ajaxBox;
|
|
|
182
301
|
|
|
183
302
|
|
|
184
303
|
/**
|
|
185
|
-
* 使用下载示例
|
|
304
|
+
* 使用下载示例 get
|
|
186
305
|
const exportFile = () => {
|
|
187
306
|
let rowData = InventoryTableRef.value!.getSelectionRows()
|
|
188
|
-
|
|
189
307
|
const url = storageModule + 'storage_standing_book_batch_export_get/'
|
|
190
308
|
const headers = {
|
|
191
309
|
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
|
|
@@ -204,5 +322,26 @@ const exportFile = () => {
|
|
|
204
322
|
headers,
|
|
205
323
|
params,
|
|
206
324
|
)
|
|
325
|
+
}
|
|
326
|
+
使用下载示例 post
|
|
327
|
+
const exportFile = () => {
|
|
328
|
+
let rowData = WeighingTableRef.value!.getSelectionRows()
|
|
329
|
+
const url = storageModule + 'weighing_record_batch_export_post/'
|
|
330
|
+
const headers = {
|
|
331
|
+
'Content-Type': 'application/json', //设置为json格式
|
|
332
|
+
}
|
|
333
|
+
const params = {
|
|
334
|
+
ids: rowData.map((v: { id: any }) => v.id), // 直接数组形式
|
|
335
|
+
state: 1,
|
|
336
|
+
org_id: UserData.orgId,
|
|
337
|
+
}
|
|
338
|
+
console.log('params', params)
|
|
339
|
+
CiPlus.Fn.ajaxBox.downFileFetch(
|
|
340
|
+
url,
|
|
341
|
+
'称重记录数据(批次).xlsx',
|
|
342
|
+
'POST',
|
|
343
|
+
headers,
|
|
344
|
+
params,
|
|
345
|
+
)
|
|
207
346
|
}
|
|
208
347
|
*/
|