mirror of
https://gitee.com/hhyykk/ipms-sjy-ui.git
synced 2025-07-17 12:25:07 +08:00
Merge branch 'master' of https://gitee.com/yudaocode/yudao-ui-admin-vue3 into dev
Conflicts: src/types/auto-components.d.ts
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,
|
||||
|
@ -179,6 +179,7 @@ const tableTypeSelect = ref(false)
|
||||
const cellClickEvent: VxeTableEvents.CellClick = async ({ row }) => {
|
||||
tableTypeSelect.value = true
|
||||
queryParams.dictType = row['type']
|
||||
await nextTick()
|
||||
await dataGetList()
|
||||
parentType.value = row['type']
|
||||
}
|
||||
@ -197,6 +198,11 @@ const setDialogTile = (type: string) => {
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
// 同步dictTypeValue到form 否则导致表单验证不通过
|
||||
watch(dictTypeValue, (val) => {
|
||||
unref(typeFormRef)?.setValues({ type: val })
|
||||
})
|
||||
|
||||
// 提交按钮
|
||||
const submitTypeForm = async () => {
|
||||
const elForm = unref(typeFormRef)?.getElFormRef()
|
||||
|
@ -11,7 +11,7 @@ export const rules = reactive({
|
||||
// 新增 + 修改
|
||||
const crudSchemas = reactive<VxeCrudSchema>({
|
||||
primaryKey: 'id',
|
||||
primaryType: 'seq',
|
||||
primaryType: 'id',
|
||||
primaryTitle: '编号',
|
||||
action: true,
|
||||
columns: [
|
||||
|
@ -3,7 +3,7 @@ import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
|
||||
// CrudSchema
|
||||
const crudSchemas = reactive<VxeCrudSchema>({
|
||||
primaryKey: 'id',
|
||||
primaryType: 'seq',
|
||||
primaryType: 'id',
|
||||
primaryTitle: '日志编号',
|
||||
action: true,
|
||||
actionWidth: '100px',
|
||||
|
@ -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],
|
||||
|
@ -59,6 +59,7 @@ const queryParams = reactive({
|
||||
})
|
||||
const [registerTable] = useXTable({
|
||||
allSchemas: allSchemas,
|
||||
topActionSlots: false,
|
||||
params: queryParams,
|
||||
getListApi: MailLogApi.getMailLogPageApi
|
||||
})
|
||||
|
@ -37,6 +37,7 @@ const { t } = useI18n() // 国际化
|
||||
// 列表相关的变量
|
||||
const [registerTable] = useXTable({
|
||||
allSchemas: allSchemas,
|
||||
topActionSlots: false,
|
||||
getListApi: NotifyMessageApi.getNotifyMessagePageApi
|
||||
})
|
||||
|
||||
|
@ -4,7 +4,7 @@ import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
|
||||
const crudSchemas = reactive<VxeCrudSchema>({
|
||||
primaryKey: 'id', // 默认的主键ID
|
||||
primaryTitle: '编号', // 默认显示的值
|
||||
primaryType: 'seq', // 默认为seq,序号模式
|
||||
primaryType: 'id', // 默认为seq,序号模式
|
||||
action: true,
|
||||
actionWidth: '200', // 3个按钮默认200,如有删减对应增减即可
|
||||
columns: [
|
||||
|
@ -35,7 +35,7 @@ const [registerTable, { reload, getCheckboxRecords }] = useXTable({
|
||||
})
|
||||
|
||||
const handleUpdateList = async () => {
|
||||
const list = getCheckboxRecords()
|
||||
const list = getCheckboxRecords() as any as any[]
|
||||
if (list.length === 0) {
|
||||
return
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ const { t } = useI18n() // 国际化
|
||||
|
||||
const crudSchemas = reactive<VxeCrudSchema>({
|
||||
primaryKey: 'id',
|
||||
primaryType: 'seq',
|
||||
primaryType: 'id',
|
||||
primaryTitle: '日志编号',
|
||||
action: true,
|
||||
actionWidth: '80px',
|
||||
|
@ -99,37 +99,46 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- 分配角色的菜单权限对话框 -->
|
||||
<el-form-item
|
||||
label="权限范围"
|
||||
v-if="
|
||||
actionScopeType === 'menu' || dataScopeForm.dataScope === SystemDataScopeEnum.DEPT_CUSTOM
|
||||
"
|
||||
>
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
父子联动(选中父节点,自动选择子节点):
|
||||
<el-switch v-model="checkStrictly" inline-prompt active-text="是" inactive-text="否" />
|
||||
全选/全不选:
|
||||
<el-switch
|
||||
v-model="treeNodeAll"
|
||||
inline-prompt
|
||||
active-text="是"
|
||||
inactive-text="否"
|
||||
@change="handleCheckedTreeNodeAll()"
|
||||
/>
|
||||
</template>
|
||||
<el-tree
|
||||
ref="treeRef"
|
||||
node-key="id"
|
||||
show-checkbox
|
||||
:default-checked-keys="defaultCheckedKeys"
|
||||
:check-strictly="!checkStrictly"
|
||||
:props="defaultProps"
|
||||
:data="treeOptions"
|
||||
empty-text="加载中,请稍后"
|
||||
/>
|
||||
</el-card>
|
||||
</el-form-item>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item
|
||||
label="权限范围"
|
||||
v-if="
|
||||
actionScopeType === 'menu' ||
|
||||
dataScopeForm.dataScope === SystemDataScopeEnum.DEPT_CUSTOM
|
||||
"
|
||||
style="display: flex"
|
||||
>
|
||||
<el-card class="card" shadow="never">
|
||||
<template #header>
|
||||
父子联动(选中父节点,自动选择子节点):
|
||||
<el-switch
|
||||
v-model="checkStrictly"
|
||||
inline-prompt
|
||||
active-text="是"
|
||||
inactive-text="否"
|
||||
/>
|
||||
全选/全不选:
|
||||
<el-switch
|
||||
v-model="treeNodeAll"
|
||||
inline-prompt
|
||||
active-text="是"
|
||||
inactive-text="否"
|
||||
@change="handleCheckedTreeNodeAll()"
|
||||
/>
|
||||
</template>
|
||||
<el-tree
|
||||
ref="treeRef"
|
||||
node-key="id"
|
||||
show-checkbox
|
||||
:check-strictly="!checkStrictly"
|
||||
:props="defaultProps"
|
||||
:data="treeOptions"
|
||||
empty-text="加载中,请稍后"
|
||||
/>
|
||||
</el-card>
|
||||
</el-form-item> </el-col
|
||||
></el-row>
|
||||
</el-form>
|
||||
<!-- 操作按钮 -->
|
||||
<template #footer>
|
||||
@ -245,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)
|
||||
@ -258,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()
|
||||
@ -272,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 () => {
|
||||
@ -312,3 +322,10 @@ onMounted(() => {
|
||||
init()
|
||||
})
|
||||
</script>
|
||||
<style scoped>
|
||||
.card {
|
||||
width: 100%;
|
||||
max-height: 400px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
</style>
|
||||
|
@ -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',
|
||||
|
@ -10,7 +10,7 @@ export const rules = reactive({
|
||||
// CrudSchema
|
||||
const crudSchemas = reactive<VxeCrudSchema>({
|
||||
primaryKey: 'id',
|
||||
primaryType: 'seq',
|
||||
primaryType: 'id',
|
||||
primaryTitle: '敏感词编号',
|
||||
action: true,
|
||||
columns: [
|
||||
|
@ -12,7 +12,7 @@ export const rules = reactive({
|
||||
// CrudSchema
|
||||
const crudSchemas = reactive<VxeCrudSchema>({
|
||||
primaryKey: 'id',
|
||||
primaryType: 'seq',
|
||||
primaryType: 'id',
|
||||
primaryTitle: '渠道编号',
|
||||
action: true,
|
||||
columns: [
|
||||
|
@ -4,7 +4,7 @@ const { t } = useI18n() // 国际化
|
||||
// CrudSchema
|
||||
const crudSchemas = reactive<VxeCrudSchema>({
|
||||
primaryKey: 'id',
|
||||
primaryType: 'seq',
|
||||
primaryType: 'id',
|
||||
primaryTitle: '日志编号',
|
||||
action: true,
|
||||
columns: [
|
||||
|
@ -15,7 +15,7 @@ export const rules = reactive({
|
||||
// CrudSchema
|
||||
const crudSchemas = reactive<VxeCrudSchema>({
|
||||
primaryKey: 'id',
|
||||
primaryType: 'seq',
|
||||
primaryType: 'id',
|
||||
primaryTitle: '模板编号',
|
||||
action: true,
|
||||
actionWidth: '280',
|
||||
|
@ -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]
|
||||
})
|
||||
@ -35,7 +53,7 @@ export const rules = reactive({
|
||||
const crudSchemas = reactive<VxeCrudSchema>({
|
||||
primaryKey: 'id',
|
||||
primaryTitle: '租户编号',
|
||||
primaryType: 'seq',
|
||||
primaryType: 'id',
|
||||
action: true,
|
||||
columns: [
|
||||
{
|
||||
|
@ -25,7 +25,7 @@
|
||||
ref="formRef"
|
||||
>
|
||||
<template #menuIds>
|
||||
<el-card class="w-120">
|
||||
<el-card>
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
全选/全不选:
|
||||
@ -91,6 +91,16 @@ const dialogTitle = ref('edit') // 弹出层标题
|
||||
const handleCheckedTreeNodeAll = () => {
|
||||
treeRef.value!.setCheckedNodes(treeNodeAll.value ? menuOptions.value : [])
|
||||
}
|
||||
|
||||
const validateCategory = (rule: any, value: any, callback: any) => {
|
||||
if (!treeRef.value!.getCheckedKeys().length) {
|
||||
callback(new Error('该项为必填项'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
rules.menuIds = [{ required: true, validator: validateCategory, trigger: 'blur' }]
|
||||
|
||||
const getTree = async () => {
|
||||
const res = await listSimpleMenusApi()
|
||||
menuOptions.value = handleTree(res)
|
||||
@ -125,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)
|
||||
})
|
||||
}
|
||||
|
||||
// 提交按钮
|
||||
@ -166,3 +178,10 @@ onMounted(async () => {
|
||||
})
|
||||
// getList()
|
||||
</script>
|
||||
<style scoped>
|
||||
.el-card {
|
||||
width: 100%;
|
||||
max-height: 400px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
</style>
|
||||
|
@ -14,7 +14,7 @@ export const rules = reactive({
|
||||
// CrudSchema
|
||||
const crudSchemas = reactive<VxeCrudSchema>({
|
||||
primaryKey: 'id',
|
||||
primaryType: 'seq',
|
||||
primaryType: 'id',
|
||||
primaryTitle: '套餐编号',
|
||||
action: true,
|
||||
columns: [
|
||||
@ -33,7 +33,12 @@ const crudSchemas = reactive<VxeCrudSchema>({
|
||||
{
|
||||
title: '菜单权限',
|
||||
field: 'menuIds',
|
||||
isTable: false
|
||||
isTable: false,
|
||||
form: {
|
||||
colProps: {
|
||||
span: 24
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: t('form.remark'),
|
||||
|
@ -159,7 +159,7 @@
|
||||
:data="detailData"
|
||||
>
|
||||
<template #deptId="{ row }">
|
||||
<span>{{ row.dept?.name }}</span>
|
||||
<el-tag>{{ dataFormater(row.deptId) }}</el-tag>
|
||||
</template>
|
||||
<template #postIds="{ row }">
|
||||
<template v-if="row.postIds !== ''">
|
||||
@ -332,6 +332,28 @@ const getPostOptions = async () => {
|
||||
const res = await listSimplePostsApi()
|
||||
postOptions.value.push(...res)
|
||||
}
|
||||
const dataFormater = (val) => {
|
||||
return deptFormater(deptOptions.value, val)
|
||||
}
|
||||
//部门回显
|
||||
const deptFormater = (ary, val: any) => {
|
||||
var o = ''
|
||||
if (ary && val) {
|
||||
for (const v of ary) {
|
||||
if (v.id == val) {
|
||||
o = v.name
|
||||
if (o) return o
|
||||
} else if (v.children?.length) {
|
||||
o = deptFormater(v.children, val)
|
||||
if (o) return o
|
||||
}
|
||||
}
|
||||
return o
|
||||
} else {
|
||||
return val
|
||||
}
|
||||
}
|
||||
|
||||
// 设置标题
|
||||
const setDialogTile = async (type: string) => {
|
||||
dialogTitle.value = t('action.' + type)
|
||||
@ -386,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') {
|
||||
loading.value = true
|
||||
await UserApi.createUserApi(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
loading.value = true
|
||||
await UserApi.updateUserApi(data)
|
||||
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,10 +5,20 @@ const { t } = useI18n()
|
||||
export const rules = reactive({
|
||||
username: [required],
|
||||
nickname: [required],
|
||||
email: [required],
|
||||
password: [required],
|
||||
deptId: [required],
|
||||
email: [
|
||||
{ required: true, message: t('profile.rules.mail'), trigger: 'blur' },
|
||||
{
|
||||
type: 'email',
|
||||
message: t('profile.rules.truemail'),
|
||||
trigger: ['blur', 'change']
|
||||
}
|
||||
],
|
||||
status: [required],
|
||||
mobile: [
|
||||
{
|
||||
required: true,
|
||||
len: 11,
|
||||
trigger: 'blur',
|
||||
message: '请输入正确的手机号码'
|
||||
@ -18,7 +28,7 @@ export const rules = reactive({
|
||||
// crudSchemas
|
||||
const crudSchemas = reactive<VxeCrudSchema>({
|
||||
primaryKey: 'id',
|
||||
primaryType: 'seq',
|
||||
primaryType: 'id',
|
||||
primaryTitle: '用户编号',
|
||||
action: true,
|
||||
actionWidth: '200px',
|
||||
|
Reference in New Issue
Block a user