@a2simcode/ui 0.0.75 → 0.0.76
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/dist/simcode-ui.es.js +1083 -1083
- package/dist/simcode-ui.umd.js +2 -2
- package/dist/stats.html +1 -1
- package/docs/components/meta/button.ts +99 -10
- package/docs/components/meta/buttons.ts +17 -2
- package/docs/components/meta/form.ts +10 -5
- package/docs/components/page.md +15 -0
- package/docs/examples/page/user-management.vue +312 -0
- package/package.json +1 -1
|
@@ -2,20 +2,20 @@ export default {
|
|
|
2
2
|
"props": [
|
|
3
3
|
{
|
|
4
4
|
"name": "type",
|
|
5
|
-
"description": "
|
|
6
|
-
"type": "
|
|
5
|
+
"description": "按钮的类型,分为五种:主要按钮、幽灵按钮、虚框按钮、链接按钮、文字按钮、次要按钮",
|
|
6
|
+
"type": "\"primary\" | \"dashed\" | \"link\" | \"text\" | \"default\"",
|
|
7
7
|
"default": "'default'"
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
10
|
"name": "size",
|
|
11
11
|
"description": "设置按钮大小",
|
|
12
|
-
"type": "
|
|
12
|
+
"type": "\"large\" | \"default\" | \"small\"",
|
|
13
13
|
"default": "'default'"
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
"name": "shape",
|
|
17
17
|
"description": "设置按钮形状",
|
|
18
|
-
"type": "
|
|
18
|
+
"type": "\"default\" | \"circle\" | \"round\"",
|
|
19
19
|
"default": "'default'"
|
|
20
20
|
},
|
|
21
21
|
{
|
|
@@ -26,7 +26,7 @@ export default {
|
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
"name": "disabled",
|
|
29
|
-
"description": "
|
|
29
|
+
"description": "按钮不可用状态",
|
|
30
30
|
"type": "boolean",
|
|
31
31
|
"default": "false"
|
|
32
32
|
},
|
|
@@ -46,7 +46,7 @@ export default {
|
|
|
46
46
|
"name": "loading",
|
|
47
47
|
"description": "设置按钮载入状态",
|
|
48
48
|
"type": "boolean | { delay?: number }",
|
|
49
|
-
"default": "
|
|
49
|
+
"default": "false"
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
52
|
"name": "icon",
|
|
@@ -81,17 +81,20 @@ export default {
|
|
|
81
81
|
{
|
|
82
82
|
"name": "compact",
|
|
83
83
|
"description": "是否紧凑模式",
|
|
84
|
-
"type": "boolean"
|
|
84
|
+
"type": "boolean",
|
|
85
|
+
"default": "false"
|
|
85
86
|
},
|
|
86
87
|
{
|
|
87
88
|
"name": "lastCompactItem",
|
|
88
89
|
"description": "",
|
|
89
|
-
"type": "boolean"
|
|
90
|
+
"type": "boolean",
|
|
91
|
+
"default": "false"
|
|
90
92
|
},
|
|
91
93
|
{
|
|
92
94
|
"name": "firstCompactItem",
|
|
93
95
|
"description": "",
|
|
94
|
-
"type": "boolean"
|
|
96
|
+
"type": "boolean",
|
|
97
|
+
"default": "false"
|
|
95
98
|
}
|
|
96
99
|
],
|
|
97
100
|
"events": [
|
|
@@ -119,5 +122,91 @@ export default {
|
|
|
119
122
|
"type": "() => void"
|
|
120
123
|
}
|
|
121
124
|
],
|
|
122
|
-
"types": [
|
|
125
|
+
"types": [
|
|
126
|
+
{
|
|
127
|
+
"name": "ButtonProps",
|
|
128
|
+
"properties": [
|
|
129
|
+
{
|
|
130
|
+
"name": "type",
|
|
131
|
+
"type": "'primary' | 'dashed' | 'link' | 'text' | 'default'",
|
|
132
|
+
"description": "按钮的类型,分为五种:主要按钮、幽灵按钮、虚框按钮、链接按钮、文字按钮、次要按钮"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"name": "size",
|
|
136
|
+
"type": "'large' | 'default' | 'small'",
|
|
137
|
+
"description": "设置按钮大小"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"name": "shape",
|
|
141
|
+
"type": "'default' | 'circle' | 'round'",
|
|
142
|
+
"description": "设置按钮形状"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"name": "ghost",
|
|
146
|
+
"type": "boolean",
|
|
147
|
+
"description": "幽灵属性,使按钮背景透明"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"name": "disabled",
|
|
151
|
+
"type": "boolean",
|
|
152
|
+
"description": "按钮不可用状态"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"name": "danger",
|
|
156
|
+
"type": "boolean",
|
|
157
|
+
"description": "设置危险按钮"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"name": "block",
|
|
161
|
+
"type": "boolean",
|
|
162
|
+
"description": "将按钮宽度调整为其父宽度的选项"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"name": "loading",
|
|
166
|
+
"type": "boolean | { delay?: number }",
|
|
167
|
+
"description": "设置按钮载入状态"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"name": "icon",
|
|
171
|
+
"type": "string",
|
|
172
|
+
"description": "图标"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"name": "href",
|
|
176
|
+
"type": "string",
|
|
177
|
+
"description": "点击跳转的地址,指定此属性 button 的行为和 a 链接一致"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"name": "target",
|
|
181
|
+
"type": "string",
|
|
182
|
+
"description": "相当于 a 链接的 target 属性,href 存在时生效"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"name": "label",
|
|
186
|
+
"type": "string",
|
|
187
|
+
"description": "按钮内容"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"name": "notLabel",
|
|
191
|
+
"type": "boolean",
|
|
192
|
+
"description": "是否不要文字"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"name": "compact",
|
|
196
|
+
"type": "boolean",
|
|
197
|
+
"description": "是否紧凑模式"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"name": "lastCompactItem",
|
|
201
|
+
"type": "boolean",
|
|
202
|
+
"description": ""
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"name": "firstCompactItem",
|
|
206
|
+
"type": "boolean",
|
|
207
|
+
"description": ""
|
|
208
|
+
}
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
]
|
|
123
212
|
}
|
|
@@ -22,17 +22,32 @@ export default {
|
|
|
22
22
|
"slots": [],
|
|
23
23
|
"methods": [],
|
|
24
24
|
"types": [
|
|
25
|
+
{
|
|
26
|
+
"name": "ButtonClickScope",
|
|
27
|
+
"properties": [
|
|
28
|
+
{
|
|
29
|
+
"name": "data",
|
|
30
|
+
"type": "Record<string, any>",
|
|
31
|
+
"description": ""
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "openLayer",
|
|
35
|
+
"type": "(options: LayerParamType) => void",
|
|
36
|
+
"description": ""
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
},
|
|
25
40
|
{
|
|
26
41
|
"name": "ButtonCompActionType",
|
|
27
42
|
"properties": [
|
|
28
43
|
{
|
|
29
44
|
"name": "config",
|
|
30
|
-
"type": "
|
|
45
|
+
"type": "ButtonProps",
|
|
31
46
|
"description": "按钮配置"
|
|
32
47
|
},
|
|
33
48
|
{
|
|
34
49
|
"name": "click",
|
|
35
|
-
"type": "(scope:
|
|
50
|
+
"type": "(scope: ButtonClickScope) => void",
|
|
36
51
|
"description": "按钮点击方法"
|
|
37
52
|
}
|
|
38
53
|
]
|
|
@@ -81,6 +81,16 @@ export default {
|
|
|
81
81
|
}
|
|
82
82
|
],
|
|
83
83
|
"types": [
|
|
84
|
+
{
|
|
85
|
+
"name": "FormSchemaCompConfig",
|
|
86
|
+
"properties": [
|
|
87
|
+
{
|
|
88
|
+
"name": "config",
|
|
89
|
+
"type": "{\n /**\n * @zh 绑定表\n */\n table?: string\n /**\n * @zh 绑定字段\n */\n field?: string\n /**\n * @zh 父级表格ID\n */\n parentTableId?: string\n /**\n * @zh 校验规则\n */\n rule?: RuleType[]\n } & BaseCompConfig",
|
|
90
|
+
"description": "配置信息"
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
},
|
|
84
94
|
{
|
|
85
95
|
"name": "FormSchemaConfig",
|
|
86
96
|
"properties": [
|
|
@@ -94,11 +104,6 @@ export default {
|
|
|
94
104
|
"type": "string",
|
|
95
105
|
"description": "组件类型"
|
|
96
106
|
},
|
|
97
|
-
{
|
|
98
|
-
"name": "config",
|
|
99
|
-
"type": "{\n /**\n * @zh 绑定表\n */\n table?: string\n /**\n * @zh 绑定字段\n */\n field?: string\n /**\n * @zh 父级表格ID\n */\n parentTableId?: string\n\n /**\n * @zh 数据类型\n */\n dataType?: string\n /**\n * @zh 数据编码\n */\n dataCode?: string\n /**\n * @zh 数据\n */\n options?: Record<string, any>\n /**\n * @zh 过滤数据id\n */\n dataFilterIds?: string[]\n /**\n * @zh 值键值\n */\n valueKey?: string\n /**\n * @zh 显示键值\n */\n labelKey?: string\n /**\n * @zh id键值\n */\n idKey?: string\n /**\n * @zh 父级键值\n */\n pidKey?: string\n /**\n * @zh 上级参数别名\n */\n upKeys?: string\n /**\n * @zh 数据源参数\n */\n params?: Record<string, any>\n /**\n * @zh 默认数据\n */\n defaultValue?: any\n /**\n * @zh 赋值字段名,实现不同组件使用同一个字段的值\n */\n inputValueKey?: string\n\n /**\n * @zh 校验规则\n */\n rule?: RuleType[]\n } & BaseCompConfig",
|
|
100
|
-
"description": "配置信息"
|
|
101
|
-
},
|
|
102
107
|
{
|
|
103
108
|
"name": "children",
|
|
104
109
|
"type": "FormSchemaConfig[]",
|
package/docs/components/page.md
CHANGED
|
@@ -41,6 +41,19 @@
|
|
|
41
41
|
</template>
|
|
42
42
|
</Demo>
|
|
43
43
|
|
|
44
|
+
## 用户管理页面示例
|
|
45
|
+
|
|
46
|
+
参考业务项目中的写法,展示了如何在 `j-page` 内嵌 `j-table-panel`,并完成“新增 / 编辑 / 重置密码 / 删除 / 状态开关”等常见交互。
|
|
47
|
+
|
|
48
|
+
<Demo :source-code="pageUserManagementCode">
|
|
49
|
+
<template #source>
|
|
50
|
+
<page-user-management />
|
|
51
|
+
</template>
|
|
52
|
+
<template #description>
|
|
53
|
+
示例使用 Mock 数据模拟分页接口,并通过 `openLayer` 打开表单弹窗;保存/删除后通过 `j-page.call('mainTable','refreshData')` 刷新表格。
|
|
54
|
+
</template>
|
|
55
|
+
</Demo>
|
|
56
|
+
|
|
44
57
|
## API
|
|
45
58
|
|
|
46
59
|
<ApiTable :data="pageApi" componentName="page" />
|
|
@@ -49,9 +62,11 @@
|
|
|
49
62
|
import PageBasic from '../examples/page/basic.vue'
|
|
50
63
|
import PageInit from '../examples/page/init.vue'
|
|
51
64
|
import PageLog from '../examples/page/log.vue'
|
|
65
|
+
import PageUserManagement from '../examples/page/user-management.vue'
|
|
52
66
|
import pageApi from './meta/page'
|
|
53
67
|
|
|
54
68
|
import pageBasicCode from '../examples/page/basic.vue?raw'
|
|
55
69
|
import pageInitCode from '../examples/page/init.vue?raw'
|
|
56
70
|
import pageLogCode from '../examples/page/log.vue?raw'
|
|
71
|
+
import pageUserManagementCode from '../examples/page/user-management.vue?raw'
|
|
57
72
|
</script>
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="j-block" style="height: 600px">
|
|
3
|
+
<j-page ref="pageRef" :noPadding="true" :schema="schema" />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import type { ButtonClickScope, TableColumnCompConfig } from '@a2simcode/ui'
|
|
9
|
+
|
|
10
|
+
import { ref, defineComponent, h } from 'vue'
|
|
11
|
+
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
12
|
+
|
|
13
|
+
interface UserRecord {
|
|
14
|
+
j_Id: number
|
|
15
|
+
j_Account: string
|
|
16
|
+
j_Name: string
|
|
17
|
+
j_EnabledMark: 0 | 1
|
|
18
|
+
j_CreateUserName: string
|
|
19
|
+
j_CreateDate: string
|
|
20
|
+
j_ModifyDate: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const randomFrom = <T,>(arr: T[]) => arr[Math.floor(Math.random() * arr.length)]
|
|
24
|
+
|
|
25
|
+
const createUsers = (count: number): UserRecord[] => {
|
|
26
|
+
const names = ['张三', '李四', '王五', '赵六', '孙七', '周八', '吴九', '郑十']
|
|
27
|
+
const creators = ['系统', '管理员', '运维', '审计']
|
|
28
|
+
const now = Date.now()
|
|
29
|
+
|
|
30
|
+
return Array.from({ length: count }).map((_, i) => {
|
|
31
|
+
const id = i + 1
|
|
32
|
+
const createTime = new Date(now - Math.floor(Math.random() * 20 * 24 * 60 * 60 * 1000))
|
|
33
|
+
const modifyTime = new Date(
|
|
34
|
+
createTime.getTime() + Math.floor(Math.random() * 5 * 24 * 60 * 60 * 1000)
|
|
35
|
+
)
|
|
36
|
+
return {
|
|
37
|
+
j_Id: id,
|
|
38
|
+
j_Account: `user_${String(id).padStart(3, '0')}`,
|
|
39
|
+
j_Name: randomFrom(names),
|
|
40
|
+
j_EnabledMark: Math.random() > 0.2 ? 1 : 0,
|
|
41
|
+
j_CreateUserName: randomFrom(creators),
|
|
42
|
+
j_CreateDate: createTime.toISOString(),
|
|
43
|
+
j_ModifyDate: modifyTime.toISOString(),
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const users = ref<UserRecord[]>(createUsers(57))
|
|
49
|
+
|
|
50
|
+
const api = {
|
|
51
|
+
getPage: async (params: Record<string, any>) => {
|
|
52
|
+
const keyword = String(params?.keyword?.value || '').trim()
|
|
53
|
+
const { pagination } = params || {}
|
|
54
|
+
const { rows = 10, page = 1 } = pagination || {}
|
|
55
|
+
|
|
56
|
+
let list = [...users.value]
|
|
57
|
+
if (keyword) {
|
|
58
|
+
list = list.filter((u) => u.j_Name.includes(keyword) || u.j_Account.includes(keyword))
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const start = (page - 1) * rows
|
|
62
|
+
const end = start + rows
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
rows: list.slice(start, end),
|
|
66
|
+
records: list.length,
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
updateState: async (id: number, enabled: 0 | 1) => {
|
|
70
|
+
const target = users.value.find((u) => u.j_Id === id)
|
|
71
|
+
if (!target) return false
|
|
72
|
+
target.j_EnabledMark = enabled
|
|
73
|
+
target.j_ModifyDate = new Date().toISOString()
|
|
74
|
+
return true
|
|
75
|
+
},
|
|
76
|
+
upsert: async (data: Pick<UserRecord, 'j_Account' | 'j_Name'> & { j_Id?: number }) => {
|
|
77
|
+
const now = new Date().toISOString()
|
|
78
|
+
if (!data.j_Id) {
|
|
79
|
+
const nextId = Math.max(0, ...users.value.map((u) => u.j_Id)) + 1
|
|
80
|
+
users.value.unshift({
|
|
81
|
+
j_Id: nextId,
|
|
82
|
+
j_Account: data.j_Account,
|
|
83
|
+
j_Name: data.j_Name,
|
|
84
|
+
j_EnabledMark: 1,
|
|
85
|
+
j_CreateUserName: '管理员',
|
|
86
|
+
j_CreateDate: now,
|
|
87
|
+
j_ModifyDate: now,
|
|
88
|
+
})
|
|
89
|
+
return true
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const target = users.value.find((u) => u.j_Id === data.j_Id)
|
|
93
|
+
if (!target) return false
|
|
94
|
+
target.j_Account = data.j_Account
|
|
95
|
+
target.j_Name = data.j_Name
|
|
96
|
+
target.j_ModifyDate = now
|
|
97
|
+
return true
|
|
98
|
+
},
|
|
99
|
+
resetPassword: async () => true,
|
|
100
|
+
remove: async (id: number) => {
|
|
101
|
+
const idx = users.value.findIndex((u) => u.j_Id === id)
|
|
102
|
+
if (idx < 0) return false
|
|
103
|
+
users.value.splice(idx, 1)
|
|
104
|
+
return true
|
|
105
|
+
},
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const UserFormLayer = defineComponent({
|
|
109
|
+
name: 'UserFormLayer',
|
|
110
|
+
setup(_, { expose }) {
|
|
111
|
+
const isEdit = ref(false)
|
|
112
|
+
const currentId = ref<number | undefined>(undefined)
|
|
113
|
+
const formData = ref({
|
|
114
|
+
j_Account: '',
|
|
115
|
+
j_Name: '',
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
const open = async (param: any) => {
|
|
119
|
+
isEdit.value = !!param?.isEdit
|
|
120
|
+
const record = param?.record as UserRecord | undefined
|
|
121
|
+
currentId.value = record?.j_Id
|
|
122
|
+
formData.value = {
|
|
123
|
+
j_Account: record?.j_Account || '',
|
|
124
|
+
j_Name: record?.j_Name || '',
|
|
125
|
+
}
|
|
126
|
+
return true
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const ok = async () => {
|
|
130
|
+
const account = formData.value.j_Account.trim()
|
|
131
|
+
const name = formData.value.j_Name.trim()
|
|
132
|
+
if (!account) {
|
|
133
|
+
ElMessage.warning('请输入账号')
|
|
134
|
+
return false
|
|
135
|
+
}
|
|
136
|
+
if (!name) {
|
|
137
|
+
ElMessage.warning('请输入姓名')
|
|
138
|
+
return false
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const res = await api.upsert({
|
|
142
|
+
j_Id: currentId.value,
|
|
143
|
+
j_Account: account,
|
|
144
|
+
j_Name: name,
|
|
145
|
+
})
|
|
146
|
+
if (!res) {
|
|
147
|
+
ElMessage.warning('保存失败')
|
|
148
|
+
}
|
|
149
|
+
return res
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
expose({ open, ok })
|
|
153
|
+
|
|
154
|
+
return () =>
|
|
155
|
+
h('div', { style: 'padding: 16px' }, [
|
|
156
|
+
h('div', { style: 'margin-bottom: 12px' }, [
|
|
157
|
+
h('div', { style: 'margin-bottom: 6px; color: var(--j-color-text-2)' }, '账号'),
|
|
158
|
+
h('input', {
|
|
159
|
+
value: formData.value.j_Account,
|
|
160
|
+
onInput: (e: any) => (formData.value.j_Account = e?.target?.value || ''),
|
|
161
|
+
placeholder: '请输入账号',
|
|
162
|
+
style:
|
|
163
|
+
'width: 100%; padding: 6px 10px; border: 1px solid var(--j-color-border); border-radius: 4px; outline: none;',
|
|
164
|
+
}),
|
|
165
|
+
]),
|
|
166
|
+
h('div', { style: 'margin-bottom: 12px' }, [
|
|
167
|
+
h('div', { style: 'margin-bottom: 6px; color: var(--j-color-text-2)' }, '姓名'),
|
|
168
|
+
h('input', {
|
|
169
|
+
value: formData.value.j_Name,
|
|
170
|
+
onInput: (e: any) => (formData.value.j_Name = e?.target?.value || ''),
|
|
171
|
+
placeholder: '请输入姓名',
|
|
172
|
+
style:
|
|
173
|
+
'width: 100%; padding: 6px 10px; border: 1px solid var(--j-color-border); border-radius: 4px; outline: none;',
|
|
174
|
+
}),
|
|
175
|
+
]),
|
|
176
|
+
h(
|
|
177
|
+
'div',
|
|
178
|
+
{ style: 'color: var(--j-color-text-3); font-size: 12px' },
|
|
179
|
+
isEdit.value ? '编辑模式:修改后点击确定保存' : '新增模式:填写后点击确定创建'
|
|
180
|
+
),
|
|
181
|
+
])
|
|
182
|
+
},
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
const pageRef = ref()
|
|
186
|
+
|
|
187
|
+
const refreshTable = () => {
|
|
188
|
+
pageRef.value?.call('mainTable', 'refreshData')
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const columnsConfig: Record<string, TableColumnCompConfig> = {
|
|
192
|
+
j_Name: { width: 120, filter: { isSearchKeyword: true } },
|
|
193
|
+
j_Account: { width: 140, filter: { isSearchKeyword: true } },
|
|
194
|
+
j_EnabledMark: {
|
|
195
|
+
type: 'j-switch',
|
|
196
|
+
activeValue: 1,
|
|
197
|
+
inactiveValue: 0,
|
|
198
|
+
width: 72,
|
|
199
|
+
change: async ({ row }: { row: UserRecord }) => {
|
|
200
|
+
const res = await api.updateState(row.j_Id, row.j_EnabledMark)
|
|
201
|
+
if (res) {
|
|
202
|
+
ElMessage.success('更新成功')
|
|
203
|
+
refreshTable()
|
|
204
|
+
} else {
|
|
205
|
+
ElMessage.warning('更新失败')
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
j_CreateUserName: { filter: { isSearchKeyword: true } },
|
|
210
|
+
j_CreateDate: { type: 'dateTime', width: 168 },
|
|
211
|
+
j_ModifyDate: { type: 'dateTime', width: 168 },
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const columns = [
|
|
215
|
+
{ id: 'j_Name', label: '姓名' },
|
|
216
|
+
{ id: 'j_Account', label: '账号' },
|
|
217
|
+
{ id: 'j_EnabledMark', label: '有效' },
|
|
218
|
+
{ id: 'j_CreateUserName', label: '创建用户' },
|
|
219
|
+
{ id: 'j_CreateDate', label: '创建时间' },
|
|
220
|
+
{ id: 'j_ModifyDate', label: '最后更新时间' },
|
|
221
|
+
].map((item) => {
|
|
222
|
+
const cfg = columnsConfig[item.id] || {}
|
|
223
|
+
return {
|
|
224
|
+
id: item.id,
|
|
225
|
+
type: cfg.type || '',
|
|
226
|
+
config: { ...cfg, label: item.label },
|
|
227
|
+
}
|
|
228
|
+
})
|
|
229
|
+
|
|
230
|
+
const buttons = [
|
|
231
|
+
{
|
|
232
|
+
id: 'add',
|
|
233
|
+
label: '新增',
|
|
234
|
+
config: { icon: 'mdi:add', type: 'primary' },
|
|
235
|
+
click: ({ openLayer }: ButtonClickScope) => {
|
|
236
|
+
openLayer({
|
|
237
|
+
title: '新增用户',
|
|
238
|
+
name: UserFormLayer,
|
|
239
|
+
width: 520,
|
|
240
|
+
height: 240,
|
|
241
|
+
param: { isEdit: false },
|
|
242
|
+
afterOk: refreshTable,
|
|
243
|
+
})
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
]
|
|
247
|
+
|
|
248
|
+
const actions = [
|
|
249
|
+
{
|
|
250
|
+
id: 'edit',
|
|
251
|
+
label: '编辑',
|
|
252
|
+
click: ({ openLayer, data }: ButtonClickScope) => {
|
|
253
|
+
openLayer({
|
|
254
|
+
title: '编辑用户',
|
|
255
|
+
name: UserFormLayer,
|
|
256
|
+
width: 520,
|
|
257
|
+
height: 240,
|
|
258
|
+
param: { isEdit: true, record: data },
|
|
259
|
+
afterOk: refreshTable,
|
|
260
|
+
})
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
id: 'resetPassword',
|
|
265
|
+
label: '重置密码',
|
|
266
|
+
click: async ({ data }: ButtonClickScope) => {
|
|
267
|
+
await ElMessageBox.confirm(`您确定重置【${data?.j_Name}】密码吗?`, '提示', {
|
|
268
|
+
type: 'warning',
|
|
269
|
+
confirmButtonText: '确定',
|
|
270
|
+
cancelButtonText: '取消',
|
|
271
|
+
})
|
|
272
|
+
const res = await api.resetPassword()
|
|
273
|
+
if (res) {
|
|
274
|
+
ElMessage.success('重置成功')
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
id: 'delete',
|
|
280
|
+
label: '删除',
|
|
281
|
+
config: { danger: true },
|
|
282
|
+
click: async ({ data }: ButtonClickScope) => {
|
|
283
|
+
await ElMessageBox.confirm(`您确定删除【${data?.j_Name}】吗?`, '提示', {
|
|
284
|
+
type: 'warning',
|
|
285
|
+
confirmButtonText: '确定',
|
|
286
|
+
cancelButtonText: '取消',
|
|
287
|
+
})
|
|
288
|
+
const res = await api.remove(data.j_Id)
|
|
289
|
+
if (res) {
|
|
290
|
+
ElMessage.success('删除成功')
|
|
291
|
+
refreshTable()
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
]
|
|
296
|
+
|
|
297
|
+
const schema = ref([
|
|
298
|
+
{
|
|
299
|
+
id: 'mainTable',
|
|
300
|
+
type: 'j-table-panel',
|
|
301
|
+
config: {
|
|
302
|
+
columns,
|
|
303
|
+
buttons,
|
|
304
|
+
actions,
|
|
305
|
+
rowKey: 'j_Id',
|
|
306
|
+
isPage: true,
|
|
307
|
+
sort: 'j_CreateDate DESC',
|
|
308
|
+
loadData: async (params: Record<string, any>) => api.getPage(params),
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
])
|
|
312
|
+
</script>
|