mirror of
https://gitee.com/hhyykk/ipms-sjy-ui.git
synced 2025-07-15 11:25:07 +08:00
Merge branch 'master' of https://gitee.com/meibe/yudao-ui-admin-vue3
This commit is contained in:
@ -6,7 +6,15 @@ const { t } = useI18n() // 国际化
|
||||
export const rules = reactive({
|
||||
name: [required],
|
||||
sort: [required],
|
||||
email: [required],
|
||||
// email: [required],
|
||||
email: [
|
||||
{ required: true, message: t('profile.rules.mail'), trigger: 'blur' },
|
||||
{
|
||||
type: 'email',
|
||||
message: t('profile.rules.truemail'),
|
||||
trigger: ['blur', 'change']
|
||||
}
|
||||
],
|
||||
phone: [
|
||||
{
|
||||
len: 11,
|
||||
|
@ -1,8 +1,18 @@
|
||||
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
// 表单校验
|
||||
export const rules = reactive({
|
||||
mail: [required],
|
||||
// mail: [required],
|
||||
mail: [
|
||||
{ required: true, message: t('profile.rules.mail'), trigger: 'blur' },
|
||||
{
|
||||
type: 'email',
|
||||
message: t('profile.rules.truemail'),
|
||||
trigger: ['blur', 'change']
|
||||
}
|
||||
],
|
||||
username: [required],
|
||||
password: [required],
|
||||
host: [required],
|
||||
|
@ -131,7 +131,6 @@
|
||||
ref="treeRef"
|
||||
node-key="id"
|
||||
show-checkbox
|
||||
:default-checked-keys="defaultCheckedKeys"
|
||||
:check-strictly="!checkStrictly"
|
||||
:props="defaultProps"
|
||||
:data="treeOptions"
|
||||
@ -255,7 +254,6 @@ const dialogScopeVisible = ref(false)
|
||||
const dialogScopeTitle = ref('数据权限')
|
||||
const actionScopeType = ref('')
|
||||
const dataScopeDictDatas = ref()
|
||||
const defaultCheckedKeys = ref()
|
||||
// 选项
|
||||
const checkStrictly = ref(true)
|
||||
const treeNodeAll = ref(false)
|
||||
@ -268,13 +266,16 @@ const handleScope = async (type: string, row: RoleApi.RoleVO) => {
|
||||
dataScopeForm.id = row.id
|
||||
dataScopeForm.name = row.name
|
||||
dataScopeForm.code = row.code
|
||||
actionScopeType.value = type
|
||||
dialogScopeVisible.value = true
|
||||
if (type === 'menu') {
|
||||
const menuRes = await listSimpleMenusApi()
|
||||
treeOptions.value = handleTree(menuRes)
|
||||
const role = await PermissionApi.listRoleMenusApi(row.id)
|
||||
if (role) {
|
||||
// treeRef.value!.setCheckedKeys(role as unknown as Array<number>)
|
||||
defaultCheckedKeys.value = role
|
||||
role?.forEach((item: any) => {
|
||||
unref(treeRef)?.setChecked(item, true, false)
|
||||
})
|
||||
}
|
||||
} else if (type === 'data') {
|
||||
const deptRes = await listSimpleDeptApi()
|
||||
@ -282,12 +283,11 @@ const handleScope = async (type: string, row: RoleApi.RoleVO) => {
|
||||
const role = await RoleApi.getRoleApi(row.id)
|
||||
dataScopeForm.dataScope = role.dataScope
|
||||
if (role.dataScopeDeptIds) {
|
||||
// treeRef.value!.setCheckedKeys(role.dataScopeDeptIds as unknown as Array<number>, false)
|
||||
defaultCheckedKeys.value = role.dataScopeDeptIds
|
||||
role.dataScopeDeptIds?.forEach((item: any) => {
|
||||
unref(treeRef)?.setChecked(item, true, false)
|
||||
})
|
||||
}
|
||||
}
|
||||
actionScopeType.value = type
|
||||
dialogScopeVisible.value = true
|
||||
}
|
||||
// 保存权限
|
||||
const submitScope = async () => {
|
||||
|
@ -9,12 +9,19 @@ export const rules = reactive({
|
||||
})
|
||||
// CrudSchema
|
||||
const crudSchemas = reactive<VxeCrudSchema>({
|
||||
primaryKey: 'id',
|
||||
primaryTitle: '角色编号',
|
||||
primaryType: 'seq',
|
||||
// primaryKey: 'id',
|
||||
// primaryTitle: '角色编号',
|
||||
// primaryType: 'seq',
|
||||
action: true,
|
||||
actionWidth: '400px',
|
||||
columns: [
|
||||
{
|
||||
title: '角色编号',
|
||||
field: 'id',
|
||||
table: {
|
||||
width: 200
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '角色名称',
|
||||
field: 'name',
|
||||
|
@ -27,6 +27,24 @@ export const rules = reactive({
|
||||
contactMobile: [required],
|
||||
accountCount: [required],
|
||||
expireTime: [required],
|
||||
username: [
|
||||
required,
|
||||
{
|
||||
min: 4,
|
||||
max: 30,
|
||||
trigger: 'blur',
|
||||
message: '用户名称长度为 4-30 个字符'
|
||||
}
|
||||
],
|
||||
password: [
|
||||
required,
|
||||
{
|
||||
min: 4,
|
||||
max: 16,
|
||||
trigger: 'blur',
|
||||
message: '密码长度为 4-16 位'
|
||||
}
|
||||
],
|
||||
domain: [required],
|
||||
status: [required]
|
||||
})
|
||||
|
@ -135,7 +135,9 @@ const handleUpdate = async (rowId: number) => {
|
||||
const res = await TenantPackageApi.getTenantPackageApi(rowId)
|
||||
unref(formRef)?.setValues(res)
|
||||
// 设置选中
|
||||
unref(treeRef)?.setCheckedKeys(res.menuIds)
|
||||
res.menuIds?.forEach((item: any) => {
|
||||
unref(treeRef)?.setChecked(item, true, false)
|
||||
})
|
||||
}
|
||||
|
||||
// 提交按钮
|
||||
|
@ -332,7 +332,6 @@ const getPostOptions = async () => {
|
||||
const res = await listSimplePostsApi()
|
||||
postOptions.value.push(...res)
|
||||
}
|
||||
|
||||
const dataFormater = (val) => {
|
||||
return deptFormater(deptOptions.value, val)
|
||||
}
|
||||
@ -409,24 +408,31 @@ const handleDetail = async (rowId: number) => {
|
||||
|
||||
// 提交按钮
|
||||
const submitForm = async () => {
|
||||
loading.value = true
|
||||
// 提交请求
|
||||
try {
|
||||
const data = unref(formRef)?.formModel as UserApi.UserVO
|
||||
if (actionType.value === 'create') {
|
||||
await UserApi.createUserApi(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await UserApi.updateUserApi(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
const elForm = unref(formRef)?.getElFormRef()
|
||||
if (!elForm) return
|
||||
elForm.validate(async (valid) => {
|
||||
if (valid) {
|
||||
try {
|
||||
const data = unref(formRef)?.formModel as UserApi.UserVO
|
||||
if (actionType.value === 'create') {
|
||||
await UserApi.createUserApi(data)
|
||||
loading.value = true
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await UserApi.updateUserApi(data)
|
||||
loading.value = true
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
} finally {
|
||||
// unref(formRef)?.setSchema(allSchemas.formSchema)
|
||||
// 刷新列表
|
||||
await reload()
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
dialogVisible.value = false
|
||||
} finally {
|
||||
// unref(formRef)?.setSchema(allSchemas.formSchema)
|
||||
// 刷新列表
|
||||
await reload()
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
// 改变用户状态操作
|
||||
const handleStatusChange = async (row: UserApi.UserVO) => {
|
||||
|
@ -5,6 +5,8 @@ const { t } = useI18n()
|
||||
export const rules = reactive({
|
||||
username: [required],
|
||||
nickname: [required],
|
||||
password: [required],
|
||||
deptId: [required],
|
||||
email: [
|
||||
{ required: true, message: t('profile.rules.mail'), trigger: 'blur' },
|
||||
{
|
||||
|
Reference in New Issue
Block a user