Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
admin
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
华润手术跟台
admin
Commits
b4344dca
提交
b4344dca
authored
11月 01, 2022
作者:
leon
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix用户编辑修改
上级
3f4f5512
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
39 行增加
和
28 行删除
+39
-28
BasicForm.vue
src/components/Form/src/BasicForm.vue
+7
-13
drawer.vue
src/views/system/user/drawer.vue
+27
-10
schema.ts
src/views/system/user/schema.ts
+5
-5
没有找到文件。
src/components/Form/src/BasicForm.vue
浏览文件 @
b4344dca
...
...
@@ -25,10 +25,7 @@
</template>
<FormAction
v-bind=
"getFormActionBindProps"
@
toggle-advanced=
"handleToggleAdvanced"
>
<
template
#[
item
]="
data
"
v-for=
"item in ['resetBefore', 'submitBefore', 'advanceBefore', 'advanceAfter']"
>
<
template
#[
item
]="
data
"
v-for=
"item in ['resetBefore', 'submitBefore', 'advanceBefore', 'advanceAfter']"
>
<slot
:name=
"item"
v-bind=
"data ||
{}">
</slot>
</
template
>
</FormAction>
...
...
@@ -111,9 +108,7 @@
};
});
const
getBindValue
=
computed
(
()
=>
({
...
attrs
,
...
props
,
...
unref
(
getProps
)
}
as
Recordable
),
);
const
getBindValue
=
computed
(()
=>
({
...
attrs
,
...
props
,
...
unref
(
getProps
)
}
as
Recordable
));
const
getSchema
=
computed
(():
FormSchema
[]
=>
{
const
schemas
:
FormSchema
[]
=
unref
(
schemaRef
)
||
(
unref
(
getProps
).
schemas
as
any
);
...
...
@@ -133,9 +128,7 @@
}
}
if
(
unref
(
getProps
).
showAdvancedButton
)
{
return
cloneDeep
(
schemas
.
filter
((
schema
)
=>
schema
.
component
!==
'Divider'
)
as
FormSchema
[],
);
return
cloneDeep
(
schemas
.
filter
((
schema
)
=>
schema
.
component
!==
'Divider'
)
as
FormSchema
[]);
}
else
{
return
cloneDeep
(
schemas
as
FormSchema
[]);
}
...
...
@@ -210,6 +203,9 @@
(
schemas
)
=>
{
resetSchema
(
schemas
??
[]);
},
{
deep
:
true
,
},
);
watch
(
...
...
@@ -296,9 +292,7 @@
formActionType
:
formActionType
as
any
,
setFormModel
,
getFormClass
,
getFormActionBindProps
:
computed
(
():
Recordable
=>
({
...
getProps
.
value
,
...
advanceState
}),
),
getFormActionBindProps
:
computed
(():
Recordable
=>
({
...
getProps
.
value
,
...
advanceState
})),
...
formActionType
,
};
},
...
...
src/views/system/user/drawer.vue
浏览文件 @
b4344dca
...
...
@@ -16,7 +16,7 @@
<
script
lang=
"ts"
setup
name=
"UserDrawer"
>
import
{
defineEmits
,
ref
,
computed
,
unref
}
from
'vue'
;
import
{
BasicForm
,
useForm
}
from
'/@/components/Form/index'
;
import
{
formSchema
,
StatusValEnum
}
from
'./schema'
;
import
{
formSchema
,
StatusValEnum
,
PASSWORD
}
from
'./schema'
;
import
{
BasicDrawer
,
useDrawerInner
}
from
'/@/components/Drawer'
;
import
*
as
UserApi
from
'/@/api/system/userApi'
;
import
{
useAsyncState
}
from
'@vueuse/core'
;
...
...
@@ -27,12 +27,25 @@
const
isUpdate
=
ref
(
true
);
const
entityId
=
ref
(
0
);
const
[
registerForm
,
{
resetFields
,
setFieldsValue
,
validate
}]
=
useForm
({
const
useFormProps
:
any
=
ref
({
labelWidth
:
120
,
schemas
:
formSchema
,
showActionButtonGroup
:
false
,
});
const
[
registerForm
,
{
resetFields
,
setFieldsValue
,
validate
}]
=
useForm
(
useFormProps
.
value
);
/**
* @description: 编辑时候影藏密码表单项 , 创建时候显示
*/
const
handlePwdFiled
=
()
=>
{
useFormProps
.
value
.
schemas
?.
forEach
((
item
:
any
)
=>
{
if
(
item
.
field
===
PASSWORD
)
{
item
.
show
=
!
unref
(
isUpdate
);
}
});
};
// id 查询
const
{
state
:
detail
,
...
...
@@ -55,6 +68,8 @@
isUpdate
.
value
=
!!
data
?.
isUpdate
;
entityId
.
value
=
data
?.
record
?.
id
;
handlePwdFiled
();
if
(
unref
(
isUpdate
))
{
await
execute
();
if
(
detail
.
value
)
{
...
...
@@ -63,14 +78,16 @@
label
:
data
.
record
.
distributor
?.
name
||
getDistributorText
(
data
.
record
.
distributorId
),
value
:
data
.
record
.
distributorId
,
};
formData
.
roleList
=
formData
.
roleList
?.
map
((
item
:
any
)
=>
{
return
{
label
:
item
.
remark
,
value
:
item
.
id
,
};
})
||
[];
console
.
log
(
'formData'
,
formData
);
// 因为角色是单选。所以这里要把数组转换成单个对象
let
roleObj
=
{};
if
(
formData
.
roleList
&&
formData
.
roleList
[
0
])
{
const
item
=
formData
.
roleList
[
0
];
roleObj
=
{
label
:
item
.
remark
,
value
:
item
.
id
,
};
}
formData
.
roleList
=
roleObj
;
await
setFieldsValue
(
formData
);
}
}
...
...
src/views/system/user/schema.ts
浏览文件 @
b4344dca
...
...
@@ -96,6 +96,8 @@ for (const key in YesNoEnum) {
const
colProps
=
{
xs
:
{
span
:
24
},
sm
:
{
span
:
24
},
lg
:
{
span
:
8
}
};
const
colPropsInDrawer
=
{
span
:
24
};
export
const
PASSWORD
=
'password'
;
export
const
schema
=
{
model
:
'User'
,
viewInPage
:
true
,
...
...
@@ -132,7 +134,7 @@ export const schema = {
table
:
{},
},
{
field
:
'password'
,
field
:
PASSWORD
,
label
:
'密码'
,
defaultValue
:
undefined
,
form
:
{
...
...
@@ -191,11 +193,10 @@ export const schema = {
valueField
:
'id'
,
allowClear
:
false
,
placeholder
:
'角色'
,
mode
:
'multiple'
,
},
colProps
,
component
:
'ApiSelect'
,
rules
:
[{
required
:
true
,
type
:
'
array
'
,
message
:
'请选择角色'
}],
rules
:
[{
required
:
true
,
type
:
'
object
'
,
message
:
'请选择角色'
}],
},
table
:
{
customRender
:
({
text
})
=>
{
...
...
@@ -325,7 +326,7 @@ export const schema = {
};
const
queryFields
=
[
'distributorId'
,
'username'
,
'realName'
,
'mobile'
,
'status'
,
'deleteStatus'
,
'createTime'
];
const
editFields
=
[
'distributorId'
,
'username'
,
'realName'
,
'mobile'
,
'roleList'
,
'deleteStatus'
];
const
editFields
=
[
'distributorId'
,
'username'
,
PASSWORD
,
'realName'
,
'mobile'
,
'roleList'
,
'deleteStatus'
];
const
tableFields
=
[
'distributorId'
,
'username'
,
...
...
@@ -341,7 +342,6 @@ const descriptionFields = [
'id'
,
'distributorId'
,
'username'
,
'password'
,
'realName'
,
'mobile'
,
'status'
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论