ci-plus 1.8.5 → 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,8 @@
1
1
  ## 历史更新
2
2
 
3
3
  ```js
4
+ 1.8.6
5
+ 1、修改 ciuploadV4 组件中的一个bug
4
6
  1.8.5
5
7
  1、新增 ciuploadV4 组件
6
8
  2、一些导出小优化
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ci-plus",
3
- "version": "1.8.5",
3
+ "version": "1.8.6",
4
4
  "description": "ci组件库",
5
5
  "main": "./index.ts",
6
6
  "scripts": {
@@ -167,7 +167,7 @@ interface Props {
167
167
  url?: string // 上传和下载模板的接口(当需要将附件传递回父组件时不需要传递此属性)
168
168
  uploadUrl?: string // 上传附件的接口
169
169
  parameter?: Object // 模板下载的时候请求需要携带的参数:{state: 1}
170
- data?: Object //上传携带的其他数据对象:{userId: 1, userName: '张三'}
170
+ data?: any //上传携带的其他数据对象:{userId: 1, userName: '张三'}
171
171
  title?: string // 上传按钮的名称
172
172
  multiple?: boolean // 是否支持多文件
173
173
  limit?: number // 最大文件数量
@@ -409,7 +409,11 @@ const formwork = () => {
409
409
  onMounted(async () => {
410
410
  if (props.url) {
411
411
  affiliationOptions.value = await getAffiliationOptions()
412
- warehouseOptions.value = await getWarehouseList()
412
+ if (props.data) {
413
+ warehouseOptions.value = await getWarehouseList({
414
+ storage_type: props.data?.storage_type || 'CAILIAO'
415
+ })
416
+ }
413
417
  } else {
414
418
  affiliationOptions.value = []
415
419
  warehouseOptions.value = []
@@ -2,7 +2,6 @@ import apis from './baseApi'
2
2
  import axios from 'axios'
3
3
  const { produceModule } = apis
4
4
 
5
-
6
5
  export interface User {
7
6
  user_code: string // 登录名:'148128'
8
7
  user_name: string // 用户名:'方卿'
@@ -20,12 +19,12 @@ let users = {
20
19
  user_code: UserData.loginName,
21
20
  user_name: UserData.name,
22
21
  dept_id: UserData.deptId,
23
- dept_name: UserData.deptName,
22
+ dept_name: UserData.deptName
24
23
  }
25
24
  let user = JSON.parse(JSON.stringify(users))
26
25
 
27
26
  const cardPrintAxios = axios.create({
28
- withCredentials: true,
27
+ withCredentials: true
29
28
  })
30
29
 
31
30
  cardPrintAxios.interceptors.request.use(
@@ -44,7 +43,7 @@ cardPrintAxios.interceptors.request.use(
44
43
  }
45
44
  return config
46
45
  },
47
- (error) => Promise.reject(error),
46
+ (error) => Promise.reject(error)
48
47
  )
49
48
 
50
49
  interface AffiliationRES {
@@ -75,7 +74,7 @@ interface AffiliationRES {
75
74
  const getAffiliationOptions = async (
76
75
  list?: any[],
77
76
  keys: string[] = ['label', 'value'],
78
- val: string[] = ['name', 'id'],
77
+ val: string[] = ['name', 'id']
79
78
  ) => {
80
79
  let url = produceModule + 'company_optional_scope_get/'
81
80
  let options: { [key: string]: any }[] = []
@@ -83,8 +82,8 @@ const getAffiliationOptions = async (
83
82
  const res = await cardPrintAxios.get(url, {
84
83
  params: {
85
84
  page: 1,
86
- pageSize: 100000,
87
- },
85
+ pageSize: 100000
86
+ }
88
87
  })
89
88
  console.log('%c Line:360 🍊🍤 res666', 'color:#7f2b82', res)
90
89
 
@@ -116,13 +115,21 @@ const getAffiliationOptions = async (
116
115
  }
117
116
 
118
117
  // 获取仓库列表数据 warehouse_get
119
- const getWarehouseList = async (
120
- list?: any[],
121
- keys: string[] = ['label', 'value'],
122
- val: string[] = ['name', 'id'],
123
- storage_type: string = 'CAILIAO', // 仓库类型
124
- search?: string, // 搜索条件,
125
- ) => {
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
+
126
133
  let url = produceModule + 'warehouse_get/'
127
134
  let options: { [key: string]: any }[] = []
128
135
  try {
@@ -131,8 +138,8 @@ const getWarehouseList = async (
131
138
  page: 1,
132
139
  pageSize: 100000,
133
140
  warehouse_type_codes: storage_type,
134
- name: search,
135
- },
141
+ name: search
142
+ }
136
143
  })
137
144
  console.log('%c Line:360 🍊 res', 'color:#7f2b82', res)
138
145
  if (
@@ -141,6 +148,7 @@ const getWarehouseList = async (
141
148
  Array.isArray(res.data?.data) &&
142
149
  res.data.data.length > 0
143
150
  ) {
151
+ list = res.data.data
144
152
  res.data.data.forEach((item: AffiliationRES) => {
145
153
  const obj: { [key: string]: any } = {}
146
154
  keys.forEach((key, index) => {
@@ -151,14 +159,15 @@ const getWarehouseList = async (
151
159
  })
152
160
  } else {
153
161
  console.error('请求失败:', res.data.msg)
162
+ list = []
154
163
  options = []
155
164
  }
156
165
  } catch (error) {
157
166
  console.error('请求失败:', error)
167
+ list = []
158
168
  options = []
159
169
  }
160
170
  console.log('%c Line:1338 🥝 result', 'color:#ea7e5c', options)
161
- list = options
162
171
  return options
163
172
  }
164
173