easybill-ui 1.0.7 → 1.0.8

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.
@@ -101,7 +101,7 @@ import STableDetail from "./STableDetail.vue"
101
101
  import { deepClone } from "../utils/common"
102
102
  import { exportExcel } from "../utils/tabelToExcel"
103
103
  import { Edit, Delete, Plus, ArrowDown, Document } from "@element-plus/icons-vue"
104
- import { ColumnItem, PropOption, TableAttr, FetchDataOpt, MenuEventKey, FormAttrs } from "./types"
104
+ import { ColumnItem, PropOption, TableAttr, FetchDataOpt, MenuEventKey, FormAttrs, FeachDataParam } from "./types"
105
105
  import { ListQuery } from "../../TableFilter"
106
106
  import FormDialog from "../../FormDialog"
107
107
  import { ElMessageBox, ElMessage, ElLoading, FormItemRule, ElTable } from "element-plus"
@@ -125,7 +125,7 @@ const props = defineProps({
125
125
  },
126
126
  },
127
127
  pageOptions: {
128
- type: Object,
128
+ type: Object as PropType<{ pageIndex?: number; pageSize?: number; total?: number } & Fields>,
129
129
  default() {
130
130
  return {
131
131
  pageIndex: 1,
@@ -135,27 +135,27 @@ const props = defineProps({
135
135
  },
136
136
  // 调用接口获取数据
137
137
  fetchData: {
138
- type: Function,
138
+ type: Function as PropType<(opt: FeachDataParam) => Promise<{ total?: number; list?: any[] } | void>>,
139
139
  default: null,
140
140
  },
141
141
  // 自定义创建函数
142
142
  fetchCreate: {
143
- type: Function,
143
+ type: Function as PropType<(formModel: Fields) => Promise<void>>,
144
144
  default: null,
145
145
  },
146
146
  // 自定义编辑函数
147
147
  fetchEdit: {
148
- type: Function,
148
+ type: Function as PropType<(row: any, formItem: any) => Promise<void>>,
149
149
  default: null,
150
150
  },
151
151
  // 自定义删除函数
152
152
  fetchRemove: {
153
- type: Function,
153
+ type: Function as PropType<(row: any, index: number) => Promise<void>>,
154
154
  default: null,
155
155
  },
156
156
  // 专门配置一些公共的参数
157
157
  option: {
158
- type: Object as PropType<PropOption>,
158
+ type: Object as PropType<Partial<PropOption>>,
159
159
  default() {
160
160
  return {}
161
161
  },
@@ -240,7 +240,7 @@ const fetchData = async (opt?: FetchDataOpt) => {
240
240
  sTableFilter.value?.setItem(i)
241
241
  tableItemRefs.value[i]?.search && tableItemRefs.value[i].search({ listQuery: search })
242
242
  }
243
- const params: Fields = { ...listQuery, ...search }
243
+ const params: Fields & { pageIndex: number; pageSize: number } = { ...listQuery, ...search }
244
244
  const fetchDataRes = await props.fetchData({ listQuery: params }).finally(() => {
245
245
  loading.value = false
246
246
  })
@@ -311,7 +311,7 @@ const onMenuOption = (optionKey: MenuEventKey, val: string) => {
311
311
  break
312
312
  }
313
313
  case "export": {
314
- const getTableValue = (val: string, schema: ColumnItem, row: any, i: number) => {
314
+ const getTableValue = (val: any, schema: ColumnItem, row: any, i: number) => {
315
315
  if (schema.options) {
316
316
  const vals = String(val).split(",")
317
317
  const curs = vals.map((item) => {
@@ -323,7 +323,8 @@ const onMenuOption = (optionKey: MenuEventKey, val: string) => {
323
323
  if (schema.formatter) {
324
324
  let result = schema.formatter(row, schema, val, i) as string
325
325
  if (/^[0-9\.,+-]+\.[0-9]{2}$/.test(String(result))) {
326
- result = +parseFloat(String(result).replace(/,|$|¥/g, ""))
326
+ const resultNum = +parseFloat(String(result).replace(/,|$|¥/g, ""))
327
+ return resultNum
327
328
  }
328
329
  return result === "--" ? "" : result
329
330
  }
@@ -4,7 +4,7 @@ import { FormItem as FormItemType, Fields, TooltipProps } from "../../CurdForm"
4
4
  import { OptionItem } from "../../ConstantStatus"
5
5
  import { TableProps } from "element-plus/es/components/table/src/table/defaults"
6
6
  // import { TableColumnCtx } from "element-plus"
7
- import { FormProps } from "element-plus"
7
+
8
8
  import type { VNode } from "vue"
9
9
  import { FormDialogOptions } from "../../FormDialog/src/types"
10
10
 
@@ -118,7 +118,7 @@ export interface PropOption {
118
118
  createOptions: FormDialogOptions
119
119
  }
120
120
  export type MenuEventKey = "refresh" | "searchToggle" | "size" | "export" | "operation"
121
- export type FormAttrs = Partial<FormSchema> & { width: string }
121
+ export type FormAttrs = Partial<FormSchema> & { width?: string | number }
122
122
  export interface ColumnItemFilter extends Partial<ParamsItem> {
123
123
  inner?: boolean
124
124
  }
@@ -134,9 +134,8 @@ export interface TableAttr {
134
134
  }
135
135
 
136
136
  export interface TableListQuery {
137
- pageIndex?: number
138
- pageSize?: number
139
- total?: number
137
+ pageIndex: number
138
+ pageSize: number
140
139
 
141
140
  [key: string]: any
142
141
  }
@@ -54,7 +54,7 @@ import { ElImage } from "element-plus"
54
54
 
55
55
  const props = defineProps({
56
56
  data: {
57
- type: Array as PropType<Array<DetailDataItem>>,
57
+ type: Array as PropType<DetailDataItem[]>,
58
58
  default: () => [],
59
59
  },
60
60
  title: {
@@ -11,7 +11,7 @@ export interface DetailDataItem extends Record<string, any> {
11
11
  options?: Array<OptionItem>
12
12
  /** type为image时,会把value当做image的url来显示图片 */
13
13
  type?: string | ReturnType<typeof defineComponent>
14
- labelWidth?: number
14
+ labelWidth?: number | string
15
15
  props?: Record<string, string>
16
16
  slot?: string
17
17
  tooltip?: string | import("element-plus/es/components/tooltip").ElTooltipProps
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easybill-ui",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "A component library for easybill",
5
5
  "author": "tuchongyang <779311998@qq.com>",
6
6
  "private": false,
@@ -14,5 +14,5 @@
14
14
  "publishConfig": {
15
15
  "access": "public"
16
16
  },
17
- "gitHead": "a3838ee69ecaaa6fed08316fcb814fa8fb62899d"
17
+ "gitHead": "f59e65d7ab9053e070926c62a783dcc7f1154f77"
18
18
  }