ci-plus 1.1.0 → 1.1.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ci-plus",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "ci组件库",
5
5
  "main": "./index.ts",
6
6
  "scripts": {
@@ -17,6 +17,7 @@
17
17
  :props="props.prop"
18
18
  :height="200"
19
19
  :disabled="props.disabled"
20
+ :loading="select_loading"
20
21
  v-bind="$attrs"
21
22
  >
22
23
  <template #prefix>
@@ -26,6 +27,11 @@
26
27
  </el-icon>
27
28
  </span>
28
29
  </template>
30
+ <template #loading>
31
+ <svg class="circular" viewBox="0 0 50 50">
32
+ <circle class="path" cx="25" cy="25" r="20" fill="none" />
33
+ </svg>
34
+ </template>
29
35
  </el-select-v2>
30
36
  <el-dialog
31
37
  class="L-dialog"
@@ -160,6 +166,7 @@ const basic = reactive<Basic>({
160
166
  is_dialogTable: false,
161
167
  search: ''
162
168
  })
169
+ const select_loading = ref(false)
163
170
  const is_aim = ref(false)
164
171
  const tagLabel = ref('')
165
172
  const tableData = ref<AnyO[]>([])
@@ -242,7 +249,8 @@ const getTableData = (obj = {}, page1 = false) => {
242
249
  getAxios(obj, page1).then((res) => {
243
250
  if (res.code !== 200) return ElMessage.warning(res.msg)
244
251
  basic.count = res.count
245
- tableData.value = res.data
252
+ if (props.getData) tableData.value = props.getData(res.data) || []
253
+ else tableData.value = res.data || []
246
254
  setCurrent()
247
255
  })
248
256
  }
@@ -291,6 +299,7 @@ const getAxios = async (obj = {}, page1 = false): Promise<any> => {
291
299
  }
292
300
  const getOptions = (val: string) => {
293
301
  if (!val) return
302
+ select_loading.value = true
294
303
  let searchObj: AnyO = {}
295
304
  searchObj[props.searchKey ? props.searchKey : 'search'] = val
296
305
  axios({
@@ -303,10 +312,14 @@ const getOptions = (val: string) => {
303
312
  })
304
313
  .then((res_) => {
305
314
  let res = res_.data
315
+ select_loading.value = false
306
316
  if (res.code !== 200) return ElMessage.warning(res.msg)
317
+ if (props.getData) temporary_options.value = props.getData(res.data) || []
318
+ else temporary_options.value = res.data || []
307
319
  temporary_options.value = res.data
308
320
  })
309
321
  .catch((err) => {
322
+ select_loading.value = false
310
323
  ElMessage.error(err.code)
311
324
  })
312
325
  }
@@ -332,4 +345,21 @@ const getOptions = (val: string) => {
332
345
  .el-table .success-row {
333
346
  --el-table-tr-bg-color: #cdedff;
334
347
  }
348
+
349
+ .circular {
350
+ margin-top: 5px;
351
+ display: inline;
352
+ height: 30px;
353
+ width: 30px;
354
+ animation: loading-rotate 2s linear infinite;
355
+ }
356
+
357
+ .path {
358
+ animation: loading-dash 1.5s ease-in-out infinite;
359
+ stroke-dasharray: 90, 150;
360
+ stroke-dashoffset: 0;
361
+ stroke-width: 2;
362
+ stroke: var(--el-color-primary);
363
+ stroke-linecap: round;
364
+ }
335
365
  </style>
@@ -3,43 +3,44 @@ import { TableColumnInstance, ColumnCls } from 'element-plus'
3
3
  import { AxiosRequestConfig } from 'axios';
4
4
  export type Props<T> = Partial<Omit<T, `$${string}` | `_${string}` | '$' | '_'>>
5
5
  export interface Scope<T> {
6
- row: T,
7
- $index: number,
8
- column: ColumnCls<T>
6
+ row: T,
7
+ $index: number,
8
+ column: ColumnCls<T>
9
9
  }
10
10
  export interface AnyO {
11
- [key: string]: any
11
+ [key: string]: any
12
12
  }
13
13
  export interface SelectColumn {
14
- col: Props<TableColumnInstance>
15
- scope?(props: any): string
16
- component?: (createVNode: typeof h, data: Scope<any>) => ComponentIns
14
+ col: Props<TableColumnInstance>
15
+ scope?(props: any): string
16
+ component?: (createVNode: typeof h, data: Scope<any>) => ComponentIns
17
17
  }
18
18
  export interface SelectSuffix {
19
- title?: string //弹出层标题
20
- modelValue?: string | string[] //下拉框value
21
- columns: SelectColumn[] // 表格列配置
22
- mul?: boolean //多选
23
- aim?: boolean
24
- disabled?: boolean
25
- size?: "" | "default" | "small" | "large"
26
- prop: { //下拉框字段
27
- label: string
28
- value: string
29
- }
30
- where?: { //弹出层打开需要展示Label的请求的params
31
- [key: string]: string
32
- }
33
- axiosConfig: AxiosRequestConfig //Axios请求配置
34
- isExist?: boolean // 是否选中关闭,单选默认true,多选默认false
35
- searchKey?: string // 模糊搜索字段,默认search,
36
- // selectConfig?:Props<ISelectV2Props>
19
+ title?: string //弹出层标题
20
+ modelValue?: string | string[] //下拉框value
21
+ columns: SelectColumn[] // 表格列配置
22
+ mul?: boolean //多选
23
+ aim?: boolean
24
+ disabled?: boolean
25
+ size?: "" | "default" | "small" | "large"
26
+ prop: { //下拉框字段
27
+ label: string
28
+ value: string
29
+ }
30
+ where?: { //弹出层打开需要展示Label的请求的params
31
+ [key: string]: string
32
+ }
33
+ axiosConfig: AxiosRequestConfig //Axios请求配置
34
+ isExist?: boolean // 是否选中关闭,单选默认true,多选默认false
35
+ searchKey?: string // 模糊搜索字段,默认search,
36
+ // selectConfig?:Props<ISelectV2Props>
37
+ getData?: (params: any) => any[] // 获取数据的方法::getData="(data: any) => data.data"
37
38
  }
38
39
  export interface Basic {
39
- page: number
40
- limit: number
41
- count: number
42
- is_dialogTable: boolean
43
- loading: boolean
44
- search: string
40
+ page: number
41
+ limit: number
42
+ count: number
43
+ is_dialogTable: boolean
44
+ loading: boolean
45
+ search: string
45
46
  }
@@ -15,7 +15,7 @@ export type Props<T> = Mutable<
15
15
  >
16
16
  export type anyObj = { [key: string | number | symbol]: any }
17
17
  export interface SortColumn {
18
- hide?: boolean
18
+ hide?: boolean //是否显示列
19
19
  ban?: boolean
20
20
  id?: number
21
21
  key?: string
@@ -47,6 +47,6 @@ export interface SortableTableIns
47
47
  export interface SortableTableDialog {
48
48
  config?: /* @vue-ignore */
49
49
  | Props<InstanceType<typeof ElDialog>>
50
- | /* @vue-ignore */ Ref<Props<InstanceType<typeof ElDialog>>>['value']
50
+ | /* @vue-ignore */ Ref<Props<InstanceType<typeof ElDialog>>>['value']
51
51
  modelValue: SortColumn[] | Ref<SortColumn[]>['value']
52
52
  }