File tree 10 files changed +185
-277
lines changed
10 files changed +185
-277
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ export default (
56
56
// 可访问 this(组件实例)
57
57
// this 判空原因:只有表单没有列表时,openForm 会在 setup 时执行
58
58
getElFormRefOfFormData = function ( ) {
59
- return this ?. $refs . formRef
59
+ return this ?. $refs . faFormDialogRef . $refs . elFormRef
60
60
} ,
61
61
62
62
// 校验详情表单
@@ -104,7 +104,7 @@ export default (
104
104
// 列表筛选项的 ref
105
105
const listFilterRef = ref ( )
106
106
// 详情的 ref
107
- const formRef = ref ( )
107
+ const faFormDialogRef = ref ( )
108
108
109
109
// 初始化 admate
110
110
const { list, form } = useAdmate (
@@ -376,7 +376,7 @@ export default (
376
376
// 表单
377
377
form,
378
378
// 详情的 ref
379
- formRef ,
379
+ faFormDialogRef ,
380
380
// 表单标题
381
381
formTitle : computed ( ( ) => formTitleMap [ form . status ] ) ,
382
382
// 表单标题字典
Original file line number Diff line number Diff line change @@ -6,73 +6,53 @@ const {
6
6
list ,
7
7
listFilterRef ,
8
8
queryList ,
9
+ resetList ,
9
10
form ,
10
- formRef ,
11
+ faFormDialogRef ,
11
12
formTitle ,
12
13
} = useAdmateAdapter ({
13
14
axiosConfig: {
14
15
urlPrefix,
15
16
},
16
- list: {
17
- filter: {
18
- name: ' 123' ,
19
- },
20
- },
21
- }, {
22
- getElFormRefOfFormData () {
23
- return formRef .value
24
- },
25
17
})
26
18
</script >
27
19
28
20
<template >
29
- <div class = " p-20px" >
21
+ <div p-20px >
30
22
<el-form
31
23
ref =" listFilterRef"
32
24
:model =" list.filter"
33
25
inline
34
26
>
35
- <el-form-item
36
- prop =" name"
37
- required
38
- >
27
+ <el-form-item prop =" name" >
39
28
<el-input
40
29
v-model =" list.filter.name"
41
30
placeholder =" 姓名"
42
31
/>
43
32
</el-form-item >
44
33
<el-form-item prop =" status" >
45
- <el-select
34
+ <FaSelect
46
35
v-model =" list.filter.status"
36
+ w =" 180px!"
47
37
placeholder =" 状态"
48
- >
49
- <el-option
50
- v-for =" (v, i) of ['停用', '启用']"
51
- :key =" i"
52
- :label =" v"
53
- :value =" v"
54
- />
55
- </el-select >
38
+ :options =" ['停用', '启用']"
39
+ />
56
40
</el-form-item >
57
41
<el-form-item >
58
42
<el-button
59
43
v-if =" !list.watchFilter"
60
44
type =" primary"
61
- @click =" queryList"
45
+ @click =" queryList() "
62
46
>
63
47
查询
64
48
</el-button >
65
- <el-button
66
- @click =" () => {
67
- listFilterRef.resetFields()
68
- }"
69
- >
49
+ <el-button @click =" resetList()" >
70
50
重置
71
51
</el-button >
72
52
</el-form-item >
73
53
</el-form >
74
54
75
- <div class = " flex justify-between my-10px" >
55
+ <div flex justify-between my-10px >
76
56
<div >
77
57
<el-button
78
58
type =" primary"
@@ -123,35 +103,22 @@ const {
123
103
</el-table-column >
124
104
</el-table >
125
105
126
- <el-dialog
106
+ <FaFormDialog
107
+ ref =" faFormDialogRef"
108
+ v-model =" form.data"
109
+ :readonly =" form.status === 'read'"
110
+ :show.sync =" form.show"
127
111
:title =" formTitle"
128
- :visible.sync =" form.show"
112
+ :retrieving =" form.loading"
113
+ :confirm =" form.submit"
129
114
>
130
- <el-form
131
- ref =" formRef"
132
- v-loading =" form.loading"
133
- :model =" form.data"
134
- :disabled =" form.status === 'read' || form.submitting"
115
+ <el-form-item
116
+ label =" 姓名"
117
+ prop =" name"
118
+ required
135
119
>
136
- <el-form-item
137
- label =" 姓名"
138
- prop =" name"
139
- required
140
- >
141
- <el-input v-model =" form.data.name" />
142
- </el-form-item >
143
- </el-form >
144
- <template #footer >
145
- <el-button @click =" form.show = false" >取 消</el-button >
146
- <el-button
147
- v-if =" form.status !== 'read' && !form.loading"
148
- type =" primary"
149
- :loading =" form.submitting"
150
- @click =" form.submit()"
151
- >
152
- 确 定
153
- </el-button >
154
- </template >
155
- </el-dialog >
120
+ <el-input v-model =" form.data.name" />
121
+ </el-form-item >
122
+ </FaFormDialog >
156
123
</div >
157
124
</template >
Original file line number Diff line number Diff line change @@ -4,15 +4,15 @@ import 'uno.css'
4
4
5
5
import 'element-ui/lib/theme-chalk/index.css'
6
6
import ElementUI from 'element-ui'
7
-
8
7
import { FaFormDialog , FaSelect } from 'faim'
8
+ import FaimLocale from 'faim/dist/locale/zh-cn.mjs'
9
9
10
10
import App from './index.vue'
11
11
import router from './router'
12
12
13
13
Vue . use ( ElementUI )
14
- Vue . use ( FaFormDialog )
15
- Vue . use ( FaSelect )
14
+ Vue . use ( FaFormDialog , { locale : FaimLocale . FaFormDialog } )
15
+ Vue . use ( FaSelect , { locale : FaimLocale . FaSelect } )
16
16
17
17
new Vue ( {
18
18
render : h => h ( App ) ,
Original file line number Diff line number Diff line change @@ -6,73 +6,53 @@ const {
6
6
list ,
7
7
listFilterRef ,
8
8
queryList ,
9
+ resetList ,
9
10
form ,
10
- formRef ,
11
+ faFormDialogRef ,
11
12
formTitle ,
12
13
} = useAdmateAdapter ({
13
14
axiosConfig: {
14
15
urlPrefix,
15
16
},
16
- list: {
17
- filter: {
18
- name: ' 123' ,
19
- },
20
- },
21
- }, {
22
- getElFormRefOfFormData () {
23
- return formRef .value
24
- },
25
17
})
26
18
</script >
27
19
28
20
<template >
29
- <div class = " p-20px" >
21
+ <div p-20px >
30
22
<el-form
31
23
ref =" listFilterRef"
32
24
:model =" list.filter"
33
25
inline
34
26
>
35
- <el-form-item
36
- prop =" name"
37
- required
38
- >
27
+ <el-form-item prop =" name" >
39
28
<el-input
40
29
v-model =" list.filter.name"
41
30
placeholder =" 姓名"
42
31
/>
43
32
</el-form-item >
44
33
<el-form-item prop =" status" >
45
- <el-select
34
+ <FaSelect
46
35
v-model =" list.filter.status"
36
+ w =" 180px!"
47
37
placeholder =" 状态"
48
- >
49
- <el-option
50
- v-for =" (v, i) of ['停用', '启用']"
51
- :key =" i"
52
- :label =" v"
53
- :value =" v"
54
- />
55
- </el-select >
38
+ :options =" ['停用', '启用']"
39
+ />
56
40
</el-form-item >
57
41
<el-form-item >
58
42
<el-button
59
43
v-if =" !list.watchFilter"
60
44
type =" primary"
61
- @click =" queryList"
45
+ @click =" queryList() "
62
46
>
63
47
查询
64
48
</el-button >
65
- <el-button
66
- @click =" () => {
67
- listFilterRef.resetFields()
68
- }"
69
- >
49
+ <el-button @click =" resetList()" >
70
50
重置
71
51
</el-button >
72
52
</el-form-item >
73
53
</el-form >
74
54
75
- <div class = " flex justify-between my-10px" >
55
+ <div flex justify-between my-10px >
76
56
<div >
77
57
<el-button
78
58
type =" primary"
@@ -123,35 +103,22 @@ const {
123
103
</el-table-column >
124
104
</el-table >
125
105
126
- <el-dialog
106
+ <FaFormDialog
107
+ ref =" faFormDialogRef"
108
+ v-model =" form.data"
109
+ :readonly =" form.status === 'read'"
110
+ :show.sync =" form.show"
127
111
:title =" formTitle"
128
- :visible.sync =" form.show"
112
+ :retrieving =" form.loading"
113
+ :confirm =" form.submit"
129
114
>
130
- <el-form
131
- ref =" formRef"
132
- v-loading =" form.loading"
133
- :model =" form.data"
134
- :disabled =" form.status === 'read' || form.submitting"
115
+ <el-form-item
116
+ label =" 姓名"
117
+ prop =" name"
118
+ required
135
119
>
136
- <el-form-item
137
- label =" 姓名"
138
- prop =" name"
139
- required
140
- >
141
- <el-input v-model =" form.data.name" />
142
- </el-form-item >
143
- </el-form >
144
- <template #footer >
145
- <el-button @click =" form.show = false" >取 消</el-button >
146
- <el-button
147
- v-if =" form.status !== 'read' && !form.loading"
148
- type =" primary"
149
- :loading =" form.submitting"
150
- @click =" form.submit()"
151
- >
152
- 确 定
153
- </el-button >
154
- </template >
155
- </el-dialog >
120
+ <el-input v-model =" form.data.name" />
121
+ </el-form-item >
122
+ </FaFormDialog >
156
123
</div >
157
124
</template >
Original file line number Diff line number Diff line change @@ -5,13 +5,14 @@ import 'uno.css'
5
5
import 'element-ui/lib/theme-chalk/index.css'
6
6
import ElementUI from 'element-ui'
7
7
import { FaFormDialog , FaSelect } from 'faim'
8
+ import FaimLocale from 'faim/dist/locale/zh-cn.mjs'
8
9
9
10
import App from './index.vue'
10
11
import router from './router'
11
12
12
13
Vue . use ( ElementUI )
13
- Vue . use ( FaFormDialog )
14
- Vue . use ( FaSelect )
14
+ Vue . use ( FaFormDialog , { locale : FaimLocale . FaFormDialog } )
15
+ Vue . use ( FaSelect , { locale : FaimLocale . FaSelect } )
15
16
16
17
new Vue ( {
17
18
render : h => h ( App ) ,
You can’t perform that action at this time.
0 commit comments