ci-plus 1.8.4 → 1.8.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/README.md CHANGED
@@ -1,6 +1,11 @@
1
1
  ## 历史更新
2
2
 
3
3
  ```js
4
+ 1.8.6
5
+ 1、修改 ciuploadV4 组件中的一个bug
6
+ 1.8.5
7
+ 1、新增 ciuploadV4 组件
8
+ 2、一些导出小优化
4
9
  1.8.4
5
10
  1、优化弹窗组件,使其样式不污染全局
6
11
  1.8.3
package/index.ts CHANGED
@@ -5,7 +5,7 @@ import { default as Fn } from './src/utils'
5
5
  export default {
6
6
  install: (app: App) => {
7
7
  // 注册所有组件
8
- console.log('注册所有ci-plus组件1.8.2: ', components)
8
+ console.log('注册所有ci-plus组件1.8.5: ', components)
9
9
  for (const c in components) {
10
10
  app.use(components[c])
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ci-plus",
3
- "version": "1.8.4",
3
+ "version": "1.8.6",
4
4
  "description": "ci组件库",
5
5
  "main": "./index.ts",
6
6
  "scripts": {
@@ -25,6 +25,8 @@ declare module '@vue/runtime-core' {
25
25
  CiSeeFile: typeof components.SeeFile
26
26
  CiUpload: typeof components.Upload
27
27
  CiUploadV2: typeof components.UploadV2
28
+ CiUploadV3: typeof components.UploadV3
29
+ CiUploadV4: typeof components.UploadV4
28
30
 
29
31
  CiSelect: typeof components.Select
30
32
  CiSelectTable: typeof components.SelectTable
@@ -0,0 +1,4 @@
1
+ import _UploadV4 from '../uploadV4.vue'
2
+ import { withInstall } from '../../utils/index'
3
+ export const UploadV4 = withInstall(_UploadV4)
4
+ export default UploadV4
@@ -121,7 +121,7 @@ import {
121
121
  } from 'element-plus'
122
122
  import { onMounted, ref } from 'vue'
123
123
  import ajaxBox from '../utils/ajaxBox'
124
- import getAffiliationOptions from '../utils/getAffiliationOptions.ts'
124
+ import {getAffiliationOptions} from '../utils/getAffiliationOptions.ts'
125
125
  const upload = ref<UploadInstance>()
126
126
  const exporLoading = ref()
127
127
  const visible = ref(false)
@@ -0,0 +1,428 @@
1
+ <!-- /**
2
+ * @module uploadV4
3
+ * @author : 卖女孩的小火柴
4
+ * !description : 其它入库 导入组件
5
+ * @version : 1.0.0
6
+ * @since : 创建时间 2025-08-14 14:36:38
7
+ */ -->
8
+
9
+ <template>
10
+ <el-popover
11
+ placement="bottom"
12
+ :width="300"
13
+ :trigger="props.otherConfig?.trigger || 'hover'"
14
+ :visible="visible"
15
+ >
16
+ <el-upload
17
+ ref="upload"
18
+ class="upload-demo"
19
+ :action="uploadUrl"
20
+ :limit="mylimit || 1"
21
+ :on-exceed="handleExceed"
22
+ :auto-upload="false"
23
+ :on-success="onSuccess"
24
+ :on-error="onError"
25
+ :on-change="handleChange"
26
+ :on-remove="handleRemove"
27
+ :data="datas"
28
+ :multiple="mymultiple || false"
29
+ v-model:file-list="fileList"
30
+ >
31
+ <template #trigger>
32
+ <el-button size="small" type="primary" style="width: 100%" plain>
33
+ {{ t('fileRelated.selectFile') }}
34
+ </el-button>
35
+ </template>
36
+ <el-button
37
+ size="small"
38
+ @click="formwork"
39
+ style="float: left; margin: 0 12px 0 0; width: 95px"
40
+ v-if="url"
41
+ >
42
+ {{ t('fileRelated.downloadTemplate') }}
43
+ </el-button>
44
+ </el-upload>
45
+
46
+ <div class="slot" style="display: flex; flex-direction: column; align-items: flex-end">
47
+ <div style="width: 100%; margin: 4px 2px" v-if="ifShowAffiliation">
48
+ <el-select-v2
49
+ size="small"
50
+ v-model="affiliationAll"
51
+ filterable
52
+ :options="affiliationOptions"
53
+ :placeholder="t('fileRelated.selectCompany')"
54
+ style="width: 100%; margin-right: 5px"
55
+ clearable
56
+ @change="changeAll"
57
+ />
58
+ </div>
59
+ <div style="width: 100%; margin: 4px 2px" v-if="ifShowWarehouse">
60
+ <el-select-v2
61
+ size="small"
62
+ v-model="warehouseAll"
63
+ filterable
64
+ :options="warehouseOptions"
65
+ :placeholder="t('fileRelated.selectWarehouse')"
66
+ style="width: 100%; margin-right: 5px"
67
+ clearable
68
+ @change="changeWarehouseAll"
69
+ />
70
+ </div>
71
+ <!-- 添加一个插槽 -->
72
+ <slot></slot>
73
+ <div>
74
+ <el-button size="small" type="primary" @click="submitUpload" style="flex: 2">
75
+ {{ t('fileRelated.upload') }}
76
+ </el-button>
77
+ </div>
78
+ </div>
79
+
80
+ <template #reference>
81
+ <el-button
82
+ :type="exporLoading ? 'danger' : 'success'"
83
+ @click="visible = !visible"
84
+ :size="props.otherConfig?.size || 'small'"
85
+ :loading="exporLoading"
86
+ >
87
+ {{ props.title || t('fileRelated.attachmentUpload') }}
88
+ </el-button>
89
+ </template>
90
+ </el-popover>
91
+ </template>
92
+
93
+ <script setup lang="ts">
94
+ defineOptions({ name: 'ci-uploadV3' })
95
+
96
+ // 定义一个函数,用于处理字符串
97
+
98
+ const setFilePath = (arr: string[], url?: string) => {
99
+ // console.log('重新渲染数据', arr);
100
+ if (arr && arr.length > 0) {
101
+ let newArr: { name: string; oldName: string }[] = []
102
+ arr.forEach((item, i) => {
103
+ let segments = item.split('.')
104
+ let parts = segments[0].split('/') // 获取每名称
105
+ let name = parts[parts.length - 1] + '.' + segments[segments.length - 1]
106
+ let oldName = url ? url + item : item //原来的名称
107
+ // let url = segments[0] + '.' + segments[segments.length - 1]
108
+ newArr.push({ name, oldName })
109
+ })
110
+ return newArr
111
+ } else {
112
+ return [] // 如果数组为空,则返回空数组
113
+ }
114
+ }
115
+
116
+ // 将路径处理成附件的参数
117
+ const fileArr = (url: string, pathArr: string[]) => {
118
+ if (pathArr && pathArr.length > 0) {
119
+ let objArr: any = []
120
+ if (pathArr.length > 0) {
121
+ pathArr.map((item: any) => {
122
+ objArr.push({
123
+ name: item.name,
124
+ oldName: item.oldName,
125
+ url: url + item.oldName
126
+ })
127
+ })
128
+ return objArr
129
+ } else {
130
+ return []
131
+ }
132
+ }
133
+ }
134
+ import t from '../utils/lang/index'
135
+ import type { AxiosRequestConfig } from 'axios'
136
+ import { computed, onMounted, ref } from 'vue'
137
+ import ajaxBox from '../utils/ajaxBox'
138
+ import { getAffiliationOptions, getWarehouseList, axios } from '../utils/getAffiliationOptions.ts'
139
+
140
+ import type {
141
+ UploadFile,
142
+ UploadFiles,
143
+ UploadInstance,
144
+ UploadProps,
145
+ UploadUserFile
146
+ } from 'element-plus'
147
+ import {
148
+ ElButton,
149
+ ElLoading,
150
+ ElMessage,
151
+ ElPopover,
152
+ ElSelectV2,
153
+ ElUpload,
154
+ genFileId,
155
+ UploadRawFile
156
+ } from 'element-plus'
157
+
158
+ const upload = ref<UploadInstance>()
159
+ const exporLoading = ref(false)
160
+ const visible = ref(false)
161
+ const affiliationAll = ref() // 选择的归属公司
162
+ const warehouseAll = ref() // 选择的仓库
163
+ const affiliationOptions = ref<any[]>([]) // 获取归属公司列表数据
164
+ const warehouseOptions = ref<any[]>([]) // 获取仓库列表数据
165
+
166
+ interface Props {
167
+ url?: string // 上传和下载模板的接口(当需要将附件传递回父组件时不需要传递此属性)
168
+ uploadUrl?: string // 上传附件的接口
169
+ parameter?: Object // 模板下载的时候请求需要携带的参数:{state: 1}
170
+ data?: any //上传携带的其他数据对象:{userId: 1, userName: '张三'}
171
+ title?: string // 上传按钮的名称
172
+ multiple?: boolean // 是否支持多文件
173
+ limit?: number // 最大文件数量
174
+ ifShowAffiliation?: boolean // 是否显示归属公司
175
+ requiredAffiliation?: boolean // 是否必选归属公司
176
+ ifShowWarehouse?: boolean // 是否显示仓库
177
+ requiredWarehouse?: boolean // 是否必选仓库
178
+ filePath?: UploadFile[] //UploadRawFile[] // 父组件传递的附件数据,用于显示附件列表和上传附件后传递给父组件附件数据
179
+ RowIndex?: number // 父组件传递的行索引,用于父组件中删除了附件找到对应的行(用于表格表单中上传附件)
180
+ templateName?: string //模板名称
181
+ timeOn?: boolean // 是否开启耗时任务 默认不开启
182
+ // 其他的一些配置:请求的baseurl地址,有耗时任务的时候耗时任务的配置,模板下载的一些配置等
183
+ otherConfig: {
184
+ size?: 'large' | 'default' | 'small' // 按钮大小
185
+ trigger?: 'click' | 'focus' | 'hover' | 'contextmenu' // 按钮触发方式 默认 hover
186
+ baseUrl?: string // 上请求的baseurl地址
187
+ datakey: string // 耗时请求的参数key值
188
+ // 耗时任务的配置
189
+ timeConfig: {
190
+ url: string // 查询耗时任务地址
191
+ method: 'put' | 'post' | 'get' | 'PUT' | 'POST' | 'GET'
192
+ data?: object // 可选属性
193
+ params?: object // 可选属性
194
+ }
195
+ }
196
+ }
197
+ const props = defineProps<Props>()
198
+
199
+ // 默认值:是否显示归属公司
200
+ const ifShowAffiliation = computed(() => {
201
+ return props.ifShowAffiliation || true
202
+ })
203
+ // 默认值:是否显示仓库
204
+ const ifShowWarehouse = computed(() => {
205
+ return props.ifShowWarehouse || false
206
+ })
207
+ // 默认值:是否必选归属公司
208
+ const requiredAffiliation = computed(() => {
209
+ return props.requiredAffiliation || false
210
+ })
211
+ // 默认值:是否必选仓库
212
+ const requiredWarehouse = computed(() => {
213
+ return props.requiredWarehouse || false
214
+ })
215
+
216
+ const emits = defineEmits<{
217
+ (e: 'reloadTable'): void // 组件中上传附件后刷新父组件表格数据方法
218
+ (e: 'getFile', files: UploadFiles, file?: UploadFile, rowindex?: number): void // 编辑表单的时候回显附件用到
219
+ (e: 'update:file', files: UploadFiles): void // 编辑表单的时候回显附件用到
220
+ }>()
221
+ console.log('附件props: ', props)
222
+ const datas: any = ref(props.data)
223
+ const mymultiple = ref<boolean>(props.multiple)
224
+ const mylimit = ref<number>((props.limit as number) || 1)
225
+ const myfilePath = ref<any>(props.filePath || [])
226
+ console.log('myfilePath: ', props.filePath)
227
+
228
+ const changeAll = (val: string) => {
229
+ datas.value.factory_affiliation_id = val
230
+ datas.value.factory_affiliation_name = affiliationOptions.value.find(
231
+ (item: any) => item.value === val
232
+ )?.label
233
+ }
234
+
235
+ const changeWarehouseAll = (val: string) => {
236
+ datas.value.warehouse_id = val
237
+ datas.value.warehouse_name = warehouseOptions.value.find((item: any) => item.value === val)?.label
238
+
239
+ console.log('%c Line:236 🍐 datas.value', 'color:#ea7e5c', datas.value)
240
+ }
241
+
242
+ // 对数组中的每个字符串应用处理函数
243
+ let pathArr = setFilePath(myfilePath.value)
244
+
245
+ // 打印处理后的数组
246
+ // 将父组件中传递过来的名称,处理成el-upload需要的格式
247
+ let pathUrlArr = fileArr(import.meta.env.VITE_BASE_URL9999, pathArr)
248
+ console.log('fileObj(): ', pathUrlArr)
249
+ const fileList = ref<UploadUserFile[]>(pathUrlArr)
250
+ console.log('fileList: ', fileList.value)
251
+
252
+ //当超出限制时,执行的钩子函数
253
+ const handleExceed: UploadProps['onExceed'] = (files) => {
254
+ console.log('%c Line:177 🥝 files', 'color:#e41a6a', files)
255
+
256
+ if (mylimit?.value === 1) {
257
+ upload.value!.clearFiles()
258
+ const file = files[0] as UploadRawFile
259
+ file.uid = genFileId()
260
+ upload.value!.handleStart(file)
261
+ }
262
+ if (mylimit?.value > 1) {
263
+ console.log('超出限制: ', files)
264
+ ElMessage.warning(
265
+ `${t('fileRelated.exceedFiles')} ${mylimit?.value} ${t('fileRelated.reselect')}`
266
+ )
267
+ }
268
+ }
269
+
270
+ // 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用
271
+ const handleChange = (file: any, fileLists: any) => {
272
+ if (!props.url) {
273
+ emits('getFile', fileLists) //将选中的文件传递回父组件
274
+ emits('update:file', fileLists) //同步父组件绑定的附件字段,以便父组件提交表单的时候一起将附件提交
275
+ }
276
+ }
277
+ // 文件列表删除时
278
+ const handleRemove: UploadProps['onRemove'] = (file, fileList) => {
279
+ console.log('file: ', file)
280
+ console.log('fileList: ', fileList)
281
+ // 如果没有url时 在删除的时候将文件流同步回父组件
282
+ if (!props.url) {
283
+ emits('getFile', fileList, file, props.RowIndex)
284
+ emits('update:file', fileList)
285
+ }
286
+ }
287
+ //上传文件
288
+ const submitUpload = () => {
289
+ if (!fileList.value || !fileList.value.length) {
290
+ return ElMessage.warning(t('fileRelated.pleaseFile'))
291
+ }
292
+ console.log(fileList.value.length)
293
+ if (!datas.value.warehouse_id && requiredWarehouse.value) {
294
+ return ElMessage.warning(t('fileRelated.pleaseSelectWarehouse'))
295
+ }
296
+ if (!datas.value.factory_affiliation_id && requiredAffiliation.value) {
297
+ return ElMessage.warning(t('fileRelated.selectCompany'))
298
+ }
299
+ // exporLoading.value = ElLoading.service({ text: t('fileRelated.importing') })
300
+ exporLoading.value = true
301
+ console.log('upload.value', upload.value)
302
+ upload.value!.submit()
303
+ visible.value = false
304
+ }
305
+ //文件上传成功回调
306
+ const onSuccess = async (res: any, file: any, fileList: any) => {
307
+ console.log('fileList: ', fileList)
308
+ console.log('file: ', file)
309
+ console.log('上传成功回调: ', res)
310
+ // exporLoading.value.close() // 关闭加载动画
311
+ if (res.code !== 200) {
312
+ upload.value!.clearFiles() // 清空文件列表
313
+ // exporLoading.value.close() // 关闭加载动画
314
+ exporLoading.value = false
315
+ return ElMessage.warning(res.msg)
316
+ }
317
+
318
+ // 判断是否要走耗时逻辑
319
+ if (!props.timeOn || !res.data) {
320
+ upload.value!.clearFiles() // 清空文件列表
321
+ visible.value = false // 关闭上传面板
322
+ // exporLoading.value.close() // 关闭加载动画
323
+ exporLoading.value = false
324
+ ElMessage.success(res.msg)
325
+ emits('reloadTable')
326
+ return
327
+ }
328
+
329
+ // 处理耗时请求的参数
330
+ let datas = {}
331
+ datas[props.otherConfig?.datakey] = res.data.task_id
332
+ // 耗时轮训
333
+ const data = await askForTask(datas)
334
+ console.log('data: ', data)
335
+ if (data.code === 200) {
336
+ // fileList.value.length = 0 // 清空文件列表
337
+ upload.value!.clearFiles() // 清空文件列表
338
+ visible.value = false // 关闭上传面板
339
+ // exporLoading.value.close() // 关闭加载动画
340
+ exporLoading.value = false
341
+ ElMessage.success(data.msg)
342
+ emits('reloadTable')
343
+ } else if (data.code === 0) {
344
+ upload.value!.clearFiles() // 清空文件列表
345
+ exporLoading.value = false
346
+ ElMessage.error(data.msg || '导入失败')
347
+ // exporLoading.value.close() // 关闭加载动画
348
+ } else {
349
+ ElMessage.error(data.msg || '请求超时或者其他错误,请联系管理员.')
350
+ }
351
+ }
352
+ //文件上传失败回调
353
+ const onError = (response: any, file: any, fileList: any) => {
354
+ console.log('上传失败回调: ', response)
355
+ ElMessage.error(file.name + t('fileRelated.uploadFailed'))
356
+ // fileList.value.length = 0 // 清空文件列表
357
+ upload.value!.clearFiles() // 清空文件列表
358
+ visible.value = false // 关闭上传面板
359
+ // exporLoading.value.close() // 关闭加载动画
360
+ exporLoading.value = false
361
+ }
362
+
363
+ // 耗时请求函数
364
+ const askForTask: (task_info: any) => Promise<any> = async (task_info: any) => {
365
+ // 处理父组件传递的配置
366
+ const axiosConfig: AxiosRequestConfig = {
367
+ ...props.otherConfig?.timeConfig
368
+ }
369
+ // 处理请求的参数
370
+ if (
371
+ props.otherConfig?.timeConfig?.method === 'get' ||
372
+ props.otherConfig?.timeConfig?.method === 'GET'
373
+ ) {
374
+ axiosConfig.params = {
375
+ ...props.otherConfig?.timeConfig.params,
376
+ ...task_info
377
+ }
378
+ } else {
379
+ axiosConfig.data = {
380
+ ...props.otherConfig?.timeConfig.data,
381
+ ...task_info
382
+ }
383
+ }
384
+ try {
385
+ const res = await axios(axiosConfig)
386
+ // 如果返回的code是50001 就继续轮询,直到返回的code不是50001
387
+ if (res.data.code === 50001)
388
+ return await new Promise((resolve) => {
389
+ setTimeout(() => resolve(askForTask(task_info)), 2000)
390
+ })
391
+ return res.data
392
+ } catch (error) {
393
+ console.error('Error fetching task:', error)
394
+ throw error
395
+ }
396
+ }
397
+
398
+ //下载模板
399
+ const formwork = () => {
400
+ const url = props.url as string
401
+ const params = props.parameter
402
+ ajaxBox.downFileFetchV2(url, params, {
403
+ method: 'GET',
404
+ fileName: props.templateName || t('fileRelated.template')
405
+ })
406
+ }
407
+
408
+ //选择框
409
+ onMounted(async () => {
410
+ if (props.url) {
411
+ affiliationOptions.value = await getAffiliationOptions()
412
+ if (props.data) {
413
+ warehouseOptions.value = await getWarehouseList({
414
+ storage_type: props.data?.storage_type || 'CAILIAO'
415
+ })
416
+ }
417
+ } else {
418
+ affiliationOptions.value = []
419
+ warehouseOptions.value = []
420
+ }
421
+ })
422
+ </script>
423
+
424
+ <style scoped lang="scss">
425
+ :deep(.el-upload) {
426
+ width: calc(100% - 110px);
427
+ }
428
+ </style>
package/src/index.ts CHANGED
@@ -18,6 +18,7 @@ export * from './fileRelated/index/ciseeFile' // 导出附件查看组件
18
18
  export * from './fileRelated/index/ciupload' // 导出附件上传组件
19
19
  export * from './fileRelated/index/ciuploadV2' // 导出附件上传v2组件
20
20
  export * from './fileRelated/index/ciuploadV3' // 导出附件上传v3组件
21
+ export * from './fileRelated/index/ciuploadV4' // 导出附件上传v4组件
21
22
 
22
23
  export * from './select' // 导出select组件
23
24
  export * from './selectTable' // 导出selectTable组件
@@ -2,6 +2,50 @@ import apis from './baseApi'
2
2
  import axios from 'axios'
3
3
  const { produceModule } = apis
4
4
 
5
+ export interface User {
6
+ user_code: string // 登录名:'148128'
7
+ user_name: string // 用户名:'方卿'
8
+ org_id: string // 公司ID:'1780861656362131456'
9
+ org_name: string // 公司名称:'杭州人本轴承有限公司动力分厂'
10
+ dept_id: string // 团队ID:'1712341581808545792'
11
+ dept_name: string // 团队名称:'质控4团队'
12
+ tenantId: string // 租户id:'1739466802218676224'
13
+ }
14
+ // 在pc端获取用户信息
15
+ const UserData = JSON.parse(localStorage.getItem('UserData') || '{}')
16
+ let users = {
17
+ org_id: UserData.orgId,
18
+ org_name: UserData.orgName,
19
+ user_code: UserData.loginName,
20
+ user_name: UserData.name,
21
+ dept_id: UserData.deptId,
22
+ dept_name: UserData.deptName
23
+ }
24
+ let user = JSON.parse(JSON.stringify(users))
25
+
26
+ const cardPrintAxios = axios.create({
27
+ withCredentials: true
28
+ })
29
+
30
+ cardPrintAxios.interceptors.request.use(
31
+ (config) => {
32
+ // if (userInfo.accessToken)
33
+ // config.headers['Authorization'] = userInfo.accessToken
34
+ if (config.method == 'get' && config.params) {
35
+ Object.assign(config.params, user)
36
+ } else if (config.method !== 'get') {
37
+ if (config.data instanceof FormData) {
38
+ let data: FormData = config.data
39
+ Object.keys(user).forEach((k) => {
40
+ if (!data.has(k)) data.append(k, user[k as keyof User])
41
+ })
42
+ } else Object.assign(config.data, user)
43
+ }
44
+ return config
45
+ },
46
+ (error) => Promise.reject(error)
47
+ )
48
+
5
49
  interface AffiliationRES {
6
50
  id: string // 归属公司 id
7
51
  name: string // 归属公司 名称
@@ -35,8 +79,14 @@ const getAffiliationOptions = async (
35
79
  let url = produceModule + 'company_optional_scope_get/'
36
80
  let options: { [key: string]: any }[] = []
37
81
  try {
38
- const res = await axios.get(url)
39
- console.log('%c Line:360 🍊 res', 'color:#7f2b82', res)
82
+ const res = await cardPrintAxios.get(url, {
83
+ params: {
84
+ page: 1,
85
+ pageSize: 100000
86
+ }
87
+ })
88
+ console.log('%c Line:360 🍊🍤 res666', 'color:#7f2b82', res)
89
+
40
90
  if (
41
91
  res.status === 200 &&
42
92
  res.data.code === 200 &&
@@ -64,4 +114,63 @@ const getAffiliationOptions = async (
64
114
  return options
65
115
  }
66
116
 
67
- export default getAffiliationOptions
117
+ // 获取仓库列表数据 warehouse_get
118
+ const getWarehouseList = async (par: {
119
+ list?: any[]
120
+ keys?: string[]
121
+ val?: string[]
122
+ storage_type?: string // 仓库类型
123
+ search?: string // 搜索条件,
124
+ }) => {
125
+ let {
126
+ list = [], // 存储接口返回的源数据
127
+ keys = ['label', 'value'],
128
+ val = ['name', 'id'],
129
+ storage_type = 'CAILIAO',
130
+ search // 搜索参数
131
+ } = par
132
+
133
+ let url = produceModule + 'warehouse_get/'
134
+ let options: { [key: string]: any }[] = []
135
+ try {
136
+ const res = await cardPrintAxios.get(url, {
137
+ params: {
138
+ page: 1,
139
+ pageSize: 100000,
140
+ warehouse_type_codes: storage_type,
141
+ name: search
142
+ }
143
+ })
144
+ console.log('%c Line:360 🍊 res', 'color:#7f2b82', res)
145
+ if (
146
+ res.status === 200 &&
147
+ res.data.code === 200 &&
148
+ Array.isArray(res.data?.data) &&
149
+ res.data.data.length > 0
150
+ ) {
151
+ list = res.data.data
152
+ res.data.data.forEach((item: AffiliationRES) => {
153
+ const obj: { [key: string]: any } = {}
154
+ keys.forEach((key, index) => {
155
+ const valueKey = val[index]
156
+ obj[key] = item[valueKey as keyof AffiliationRES]
157
+ })
158
+ options.push(obj)
159
+ })
160
+ } else {
161
+ console.error('请求失败:', res.data.msg)
162
+ list = []
163
+ options = []
164
+ }
165
+ } catch (error) {
166
+ console.error('请求失败:', error)
167
+ list = []
168
+ options = []
169
+ }
170
+ console.log('%c Line:1338 🥝 result', 'color:#ea7e5c', options)
171
+ return options
172
+ }
173
+
174
+ // 导出独立实例
175
+ export { cardPrintAxios as axios, getAffiliationOptions, getWarehouseList }
176
+ export default cardPrintAxios
@@ -7,7 +7,14 @@ import { cardPrint, setCardList } from './cardPrint'
7
7
  import apis from './baseApi'
8
8
  import { dayjs, setDate, setDateTime } from './Dayjs'
9
9
  import ajaxBox from './ajaxBox' // 处理文件下载方法
10
- import getAffiliationOptions from './getAffiliationOptions' // 处理文件下载方法
10
+ import cardPrintAxios, {
11
+ getAffiliationOptions,
12
+ getWarehouseList,
13
+ axios
14
+ } from './getAffiliationOptions' // 处理文件下载方法
15
+
16
+ // 表头组件的一些方法
17
+ import { setId, getSend, sort } from '../sortableTable/utils/dataOpt'
11
18
 
12
19
  let func = {
13
20
  cardPrint,
@@ -16,9 +23,15 @@ let func = {
16
23
  setDate,
17
24
  setDateTime,
18
25
  getAffiliationOptions,
26
+ getWarehouseList,
27
+ cardPrintAxios, // 一个简易的axios
28
+ axios,
19
29
  apis,
20
30
  ajaxBox,
21
- dayjs
31
+ dayjs,
32
+ setId,
33
+ getSend,
34
+ sort
22
35
  }
23
36
  // 导出 所有方法
24
37
  export default func
@@ -25,11 +25,13 @@ const en = {
25
25
  selectFile:'SELECT FILE',
26
26
  downloadTemplate:'Download Template',
27
27
  selectCompany:'Choose a company to belong to',
28
+ selectWarehouse: 'Select warehouse',
28
29
  upload:'Upload',
29
30
  attachmentUpload:'Attachment upload',
30
31
  exceedFiles:'Exceeded the maximum file count of ',
31
32
  reselect:' files, please select again',
32
33
  pleaseFile:'Please select the file before uploading!',
34
+ pleaseSelectWarehouse: 'Please select the warehouse',
33
35
  importing:'Importing in progress ···',
34
36
  uploadFailed:'Upload failed',
35
37
  },
@@ -25,11 +25,13 @@ const zh = {
25
25
  selectFile:'选择文件',
26
26
  downloadTemplate:'下载模板',
27
27
  selectCompany:'选择归属公司',
28
+ selectWarehouse: '选择仓库',
28
29
  upload:'上传',
29
30
  attachmentUpload:'附件上传',
30
31
  exceedFiles:'超出最大文件数 ',
31
32
  reselect:' 个文件,请重新选择',
32
33
  pleaseFile:'请选择文件后在上传!',
34
+ pleaseSelectWarehouse: '请选择仓库',
33
35
  importing:'导入中···',
34
36
  uploadFailed:'上传失败',
35
37
  template:'模板.xlsx'