@xizs/nuxt-antui 0.0.20 → 0.0.22
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.
|
@@ -9,7 +9,8 @@ type TableFormLabelsItemType = {
|
|
|
9
9
|
key: string | string[],
|
|
10
10
|
is: string,
|
|
11
11
|
bind?: any,
|
|
12
|
-
value?:any
|
|
12
|
+
value?:any,
|
|
13
|
+
filter?:()=>boolean
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export type TableParamsType = {
|
|
@@ -42,6 +43,7 @@ export type AttributeType = {
|
|
|
42
43
|
selectKeys:any[],
|
|
43
44
|
page:number,
|
|
44
45
|
pageSize: number,
|
|
46
|
+
reqData:any,
|
|
45
47
|
tableData: any[],
|
|
46
48
|
metaTableData:any[],
|
|
47
49
|
form:any
|
|
@@ -164,7 +166,7 @@ export default defineComponent({
|
|
|
164
166
|
|
|
165
167
|
//form 初始化
|
|
166
168
|
const form = ref<any>({})
|
|
167
|
-
props.form?.labels?.forEach((item) => {
|
|
169
|
+
props.form?.labels?.filter(item=>item.filter==null||item.filter(item)).forEach((item) => {
|
|
168
170
|
|
|
169
171
|
if (Array.isArray(item.key)) {
|
|
170
172
|
item.key.forEach((key,index) => {
|
|
@@ -214,11 +216,16 @@ export default defineComponent({
|
|
|
214
216
|
pagination.total = res.meta.pagination.total
|
|
215
217
|
pagination.pageSize = res.meta.pagination.per_page
|
|
216
218
|
pagination.page = res.meta.pagination.current_page
|
|
219
|
+
props.attribute.reqData = res
|
|
217
220
|
props.attribute.metaTableData = JSON.parse(JSON.stringify(res.list))
|
|
218
221
|
props.attribute.tableData = res.list
|
|
219
222
|
return res.list
|
|
220
223
|
},[])
|
|
221
224
|
|
|
225
|
+
watch(()=>tableData.loading,(nv)=>{
|
|
226
|
+
props.attribute.loading = nv
|
|
227
|
+
})
|
|
228
|
+
|
|
222
229
|
|
|
223
230
|
const rowSelection = {
|
|
224
231
|
selectedRowKeys: props.attribute?.selectKeys,
|
|
@@ -244,7 +251,9 @@ export default defineComponent({
|
|
|
244
251
|
<div class="flex gap-2">
|
|
245
252
|
{props.form?.option?.search !== false && <AButton type="primary" onClick={()=>tableData.load()}>{$t('搜索')}</AButton>}
|
|
246
253
|
{props.form?.option?.reset !== false && <AButton onClick={() => patch(metaForm,form.value,true)}>{$t('重置')}</AButton>}
|
|
247
|
-
{props.form?.option?.export === true && <AButton type="primary"
|
|
254
|
+
{props.form?.option?.export === true && <AButton type="primary" onClick={()=>{
|
|
255
|
+
props.form.export?.(form.value)
|
|
256
|
+
}}>{$t('导出')}</AButton>}
|
|
248
257
|
</div>
|
|
249
258
|
|
|
250
259
|
<div class="flex ml-auto">
|
|
@@ -255,24 +264,26 @@ export default defineComponent({
|
|
|
255
264
|
<div class="flex-1 relative overflow-scroll flex flex-col">
|
|
256
265
|
{slots.content?.(tableData.value) ??< div class="absolute inset-0 ">
|
|
257
266
|
<ATable
|
|
267
|
+
bordered
|
|
258
268
|
row-selection={props.table.enableSelection ? rowSelection : null}
|
|
259
269
|
rowKey={props.table.rowKey ?? ((row) => row.id)}
|
|
260
270
|
loading={tableData.loading}
|
|
261
|
-
scroll={{ x: true,}}
|
|
262
271
|
columns={props.table.columns}
|
|
263
272
|
pagination={false}
|
|
264
|
-
sticky={tableData.value.length>0}
|
|
265
273
|
v-slots={{
|
|
266
|
-
headerCell: (
|
|
267
|
-
|
|
268
|
-
|
|
274
|
+
headerCell: (row) => {
|
|
275
|
+
if (row.column?.customHeaderCell != null) {
|
|
276
|
+
return row.column.customHeaderCell()
|
|
277
|
+
}
|
|
278
|
+
return <div style={{ 'white-space': 'nowrap',}}>
|
|
279
|
+
{row.title}
|
|
269
280
|
</div>
|
|
270
|
-
|
|
281
|
+
},
|
|
271
282
|
bodyCell: (row: any) => {
|
|
272
283
|
if (row.column?.customRender != null) {
|
|
273
284
|
return row.column.customRender(row)
|
|
274
285
|
}
|
|
275
|
-
return <div class="whitespace-nowrap"
|
|
286
|
+
return <div class="whitespace-nowrap" >{row.text}</div>
|
|
276
287
|
},
|
|
277
288
|
...props.table['v-slots']
|
|
278
289
|
}}
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
</div>
|
|
69
69
|
</div> -->
|
|
70
70
|
<a-layout-content :style="{ }" class="relative m-4">
|
|
71
|
-
<div class="absolute top-0 left-0 right-0 bottom-0 overflow-scroll">
|
|
71
|
+
<div class="absolute top-0 left-0 right-0 bottom-0 overflow-scroll scrollbar-hide">
|
|
72
72
|
<slot ></slot>
|
|
73
73
|
</div>
|
|
74
74
|
</a-layout-content>
|
package/app/composables/table.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xizs/nuxt-antui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.22",
|
|
5
5
|
"main": "./nuxt.config.ts",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "nuxi dev .playground",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@ant-design-vue/nuxt": "1.4.6",
|
|
16
16
|
"@nuxtjs/i18n": "9.5.4",
|
|
17
17
|
"@tailwindcss/vite": "^4.1.3",
|
|
18
|
-
"@xizs/nuxt-base": "0.0.
|
|
18
|
+
"@xizs/nuxt-base": "0.0.5",
|
|
19
19
|
"ant-design-vue": ">=4",
|
|
20
20
|
"nuxt": "^3.16.2",
|
|
21
21
|
"tailwindcss": "^4.0.14",
|