@xizs/nuxt-antui 0.0.8 → 0.0.9

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.
@@ -12,18 +12,23 @@ type TableFormItemType = {
12
12
  }
13
13
 
14
14
  export type TablePropsType = {
15
- form?: TableFormItemType[]
16
- table: {
15
+ form?: TableFormItemType[],
16
+ formOptions: {
17
+ search: boolean,
18
+ reset: boolean,
19
+ export: boolean,
20
+ },
21
+ table: {
22
+ 'v-slots'?:any
23
+ enableSelection?: boolean
24
+ columns: TableColumnType[]
25
+ rowKey: (row: any) => any
26
+ data: (params:any) => any
27
+ },
28
+ footerOptions?: {
29
+ show: boolean
30
+ },
17
31
  'v-slots'?:any
18
- enableSelection?: boolean
19
- columns: TableColumnType[]
20
- rowKey: (row: any) => any
21
- data: (params:any) => any
22
- },
23
- footerOptions?: {
24
- show: boolean
25
- },
26
- 'v-slots'?:any
27
32
  }
28
33
 
29
34
  export type AttributeType = {
@@ -51,13 +56,18 @@ let dateRange = defineComponent({
51
56
  let {t:$t} = useI18n()
52
57
 
53
58
  let value = watchRef(ref([]),(nv,ov)=>{
54
- if(nv?.length>0){
55
- props.form[props.item.key[0] as string] = nv[0].format('YYYY-MM-DD 00:00:00')
56
- props.form[props.item.key[1] as string] = nv[1].format('YYYY-MM-DD 23:59:59')
57
- }else{
58
- props.form[props.item.key[0] as string] = ''
59
- props.form[props.item.key[1] as string] = ''
60
- }
59
+ if(nv?.length>0){
60
+ props.form[props.item.key[0] as string] = nv[0].format('YYYY-MM-DD 00:00:00')
61
+ props.form[props.item.key[1] as string] = nv[1].format('YYYY-MM-DD 23:59:59')
62
+ }else{
63
+ props.form[props.item.key[0] as string] = ''
64
+ props.form[props.item.key[1] as string] = ''
65
+ }
66
+ })
67
+ watch([() => props.form[props.item.key[0] as string],()=>props.form[props.item.key[1] as string]], (nv) => {
68
+ console.log(nv)
69
+ value.value[0]=nv[0]
70
+ value.value[1]=nv[1]
61
71
  })
62
72
  const rangePresets = ref([
63
73
  { label: $t('今天'), value: [dayjs(), dayjs()] },
@@ -80,8 +90,16 @@ const FormItems:Record<string, (form: any, item: TableFormItemType) => any> = {
80
90
  let {t:$t} = useI18n()
81
91
  return <ASelect allowClear class="min-w-[150px]" v-model:value={form[item.key]} options={item.bind?.options} placeholder={$t(`请选择{label}`,{label:$t(item.label)})}></ASelect>
82
92
  },
93
+ selectTenant: (form: any, item: TableFormItemType) => {
94
+ let { t: $t } = useI18n()
95
+ watch(Const.TenantSelectList(), (nv) => {
96
+ console.log(nv)
97
+ }, {
98
+ once: true
99
+ })
100
+ return <ASelect allowClear class="min-w-[150px]" v-model:value={form[item.key]} options={Const.TenantSelectList().value} placeholder={$t(`请选择{label}`,{label:$t(item.label)})}></ASelect>
101
+ },
83
102
  dateRange:(form:any,item:TableFormItemType)=>{
84
-
85
103
  return h(dateRange,{form,item})
86
104
  }
87
105
  }
@@ -93,12 +111,7 @@ export const FormTableProps = {
93
111
  required: false
94
112
  },
95
113
  formOptions:{
96
- type:Object as () => {
97
- search:boolean,
98
- reset:boolean,
99
- export:boolean,
100
- opther?:()=>any
101
- },
114
+ type:Object as ()=> TablePropsType['formOptions'],
102
115
  default:()=>({
103
116
  search:true,
104
117
  reset:true,
@@ -143,7 +156,14 @@ export default defineComponent({
143
156
  const form = ref<any>({})
144
157
  props.form?.forEach((item) => {
145
158
 
146
- form.value[item.key] = item.value
159
+ if (Array.isArray(item.key)) {
160
+ item.key.forEach((key,index) => {
161
+ form.value[key] = item.value?.[index]??''
162
+ })
163
+
164
+ } else {
165
+ form.value[item.key] = item.value??''
166
+ }
147
167
  })
148
168
  props.attribute.form = form.value
149
169
  const metaForm = JSON.parse(JSON.stringify(form.value))
@@ -195,6 +215,7 @@ export default defineComponent({
195
215
 
196
216
  return () => (
197
217
  <div class="flex flex-col gap-2 h-full ">
218
+ {/* {JSON.stringify(form.value)} */}
198
219
  {props.form&&<AForm layout="inline gap-2">
199
220
  {props.form?.map((item: TableFormItemType) => {
200
221
  return (
@@ -205,7 +226,7 @@ export default defineComponent({
205
226
  })}
206
227
  <div class="flex gap-2">
207
228
  {props.formOptions.search && <AButton type="primary" onClick={()=>tableData.load()}>{$t('搜索')}</AButton>}
208
- {props.formOptions.reset && <AButton onClick={() => patch(metaForm,form.value)}>{$t('重置')}</AButton>}
229
+ {props.formOptions.reset && <AButton onClick={() => patch(metaForm,form.value,true)}>{$t('重置')}</AButton>}
209
230
  {props.formOptions.export && <AButton type="primary">{$t('导出')}</AButton>}
210
231
  </div>
211
232
  </AForm>}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xizs/nuxt-antui",
3
3
  "type": "module",
4
- "version": "0.0.8",
4
+ "version": "0.0.9",
5
5
  "main": "./nuxt.config.ts",
6
6
  "scripts": {
7
7
  "dev": "nuxi dev .playground",