Conflicts:
	src/types/auto-components.d.ts
This commit is contained in:
YunaiV
2023-03-07 20:30:32 +08:00
86 changed files with 703 additions and 284 deletions

View File

@ -17,23 +17,29 @@ const crudSchemas = reactive<VxeCrudSchema>({
title: '定义名称',
field: 'name',
table: {
width: 120,
// width: 120,
slots: {
default: 'name_default'
}
}
},
{
title: '流程分类',
title: '定义分类',
field: 'category',
dictType: DICT_TYPE.BPM_MODEL_CATEGORY,
dictClass: 'number'
// dictType: DICT_TYPE.BPM_MODEL_CATEGORY,
// dictClass: 'number',
table: {
// width: 120,
slots: {
default: 'category_default'
}
}
},
{
title: '表单信息',
field: 'formId',
table: {
width: 120,
// width: 200,
slots: {
default: 'formId_default'
}
@ -43,7 +49,7 @@ const crudSchemas = reactive<VxeCrudSchema>({
title: '流程版本',
field: 'version',
table: {
width: 80,
// width: 80,
slots: {
default: 'version_default'
}
@ -53,7 +59,7 @@ const crudSchemas = reactive<VxeCrudSchema>({
title: '激活状态',
field: 'suspensionState',
table: {
width: 80,
// width: 80,
slots: {
default: 'suspensionState_default'
}
@ -63,10 +69,10 @@ const crudSchemas = reactive<VxeCrudSchema>({
title: '部署时间',
field: 'deploymentTime',
isForm: false,
formatter: 'formatDate',
table: {
width: 180
}
formatter: 'formatDate'
// table: {
// width: 180
// }
}
]
})

View File

@ -6,6 +6,10 @@
<template #name_default="{ row }">
<XTextButton :title="row.name" @click="handleBpmnDetail(row.id)" />
</template>
<!-- 流程分类 -->
<template #category_default="{ row }">
<DictTag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="Number(row?.category)" />
</template>
<!-- 表单信息 -->
<template #formId_default="{ row }">
<XTextButton
@ -43,6 +47,16 @@
v-if="formDetailVisible"
/>
</XModal>
<!-- 流程模型图的预览 -->
<XModal title="流程图" v-model="showBpmnOpen" width="80%" height="90%">
<my-process-viewer
key="designer"
v-model="bpmnXML"
:value="bpmnXML"
v-bind="bpmnControlForm"
:prefix="bpmnControlForm.prefix"
/>
</XModal>
</ContentWrap>
</template>
<script setup lang="ts">
@ -51,8 +65,14 @@ import * as DefinitionApi from '@/api/bpm/definition'
// import * as ModelApi from '@/api/bpm/model'
import { allSchemas } from './definition.data'
import { setConfAndFields2 } from '@/utils/formCreate'
import { DICT_TYPE } from '@/utils/dict'
const message = useMessage() // 消息弹窗
const bpmnXML = ref(null)
const showBpmnOpen = ref(false)
const bpmnControlForm = ref({
prefix: 'flowable'
})
// const message = useMessage() // 消息弹窗
const router = useRouter() // 路由
const { query } = useRoute() // 查询参数
@ -89,7 +109,13 @@ const handleFormDetail = async (row) => {
const handleBpmnDetail = (row) => {
// TODO 芋艿:流程组件开发中
console.log(row)
message.success('流程组件开发中,预计 2 月底完成')
DefinitionApi.getProcessDefinitionBpmnXMLApi(row).then((response) => {
console.log(response, 'response')
bpmnXML.value = response
// 弹窗打开
showBpmnOpen.value = true
})
// message.success('流程组件开发中,预计 2 月底完成')
}
// 点击任务分配按钮
@ -97,7 +123,7 @@ const handleAssignRule = (row) => {
router.push({
name: 'BpmTaskAssignRuleList',
query: {
modelId: row.id
processDefinitionId: row.id
}
})
}

View File

@ -3,9 +3,21 @@
<!-- 表单设计器 -->
<fc-designer ref="designer" height="780px">
<template #handle>
<XButton type="primary" title="生成JSON" @click="showJson" />
<XButton type="primary" title="生成Options" @click="showOption" />
<XButton type="primary" :title="t('action.save')" @click="handleSave" />
</template>
</fc-designer>
<Dialog :title="dialogTitle" v-model="dialogVisible1" maxHeight="600">
<div ref="editor" v-if="dialogVisible1">
<XTextButton style="float: right" :title="t('common.copy')" @click="copy(formValue)" />
<el-scrollbar height="580">
<pre>
{{ formValue }}
</pre>
</el-scrollbar>
</div>
</Dialog>
<!-- 表单保存的弹窗 -->
<XModal v-model="dialogVisible" title="保存表单">
<el-form ref="formRef" :model="formValues" :rules="formRules" label-width="80px">
@ -48,13 +60,18 @@ import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { CommonStatusEnum } from '@/utils/constants'
import * as FormApi from '@/api/bpm/form'
import { encodeConf, encodeFields, setConfAndFields } from '@/utils/formCreate'
import { useClipboard } from '@vueuse/core'
const { t } = useI18n() // 国际化
const message = useMessage() // 消息
const { query } = useRoute() // 路由
const designer = ref() // 表单设计器
const type = ref(-1)
const formValue = ref('')
const dialogTitle = ref('')
const dialogVisible = ref(false) // 弹窗是否展示
const dialogVisible1 = ref(false) // 弹窗是否展示
const dialogLoading = ref(false) // 弹窗的加载中
const formRef = ref<FormInstance>()
const formRules = reactive({
@ -98,7 +115,32 @@ const submitForm = async () => {
dialogLoading.value = false
}
}
const showJson = () => {
openModel('生成JSON')
type.value = 0
formValue.value = designer.value.getRule()
}
const showOption = () => {
openModel('生成Options')
type.value = 1
formValue.value = designer.value.getOption()
}
const openModel = (title: string) => {
dialogVisible1.value = true
dialogTitle.value = title
}
/** 复制 **/
const copy = async (text: string) => {
const { copy, copied, isSupported } = useClipboard({ source: text })
if (!isSupported) {
message.error(t('common.copyError'))
} else {
await copy()
if (unref(copied)) {
message.success(t('common.copySuccess'))
}
}
}
// ========== 初始化 ==========
onMounted(() => {
// 场景一:新增表单

View File

@ -16,6 +16,7 @@ const crudSchemas = reactive<VxeCrudSchema>({
primaryType: 'id',
primaryTitle: '编号',
action: true,
searchSpan: 8,
columns: [
{
title: '组名',

View File

@ -43,7 +43,7 @@
</XTable>
</ContentWrap>
<XModal v-model="dialogVisible" :title="dialogTitle">
<XModal v-model="dialogVisible" :title="dialogTitle" :mask-closable="false">
<!-- 对话框(添加 / 修改) -->
<Form
v-if="['create', 'update'].includes(actionType)"

View File

@ -24,6 +24,10 @@
<template #name_default="{ row }">
<XTextButton :title="row.name" @click="handleBpmnDetail(row.id)" />
</template>
<!-- 流程分类 -->
<template #category_default="{ row }">
<DictTag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="Number(row?.category)" />
</template>
<!-- 表单信息 -->
<template #formId_default="{ row }">
<XTextButton
@ -429,6 +433,11 @@ const handleUpdate = async (rowId: number) => {
await setDialogTile('edit')
// 设置数据
saveForm.value = await ModelApi.getModelApi(rowId)
if (saveForm.value.category == null) {
saveForm.value.category = 1
} else {
saveForm.value.category = Number(saveForm.value.category)
}
}
// 提交按钮

View File

@ -44,7 +44,12 @@ const crudSchemas = reactive<VxeCrudSchema>({
field: 'category',
dictType: DICT_TYPE.BPM_MODEL_CATEGORY,
dictClass: 'number',
isSearch: true
isSearch: true,
table: {
slots: {
default: 'category_default'
}
}
},
{
title: '表单信息',

View File

@ -108,7 +108,7 @@ const initModeler = (item) => {
const save = (bpmnXml) => {
const data: ModelVO = {
...model.value,
...(model.value ?? ({} as ModelVO)),
bpmnXml: bpmnXml // bpmnXml 只是初始化流程图,后续修改无法通过它获得
}
console.log(data, 'data')

View File

@ -2,6 +2,7 @@
<ContentWrap>
<!-- 详情 -->
<Descriptions :schema="allSchemas.detailSchema" :data="formData" />
<el-button @click="routerReturn" type="primary">返回</el-button>
</ContentWrap>
</template>
@ -9,7 +10,8 @@
// 业务相关的 import
import * as LeaveApi from '@/api/bpm/leave'
import { allSchemas } from '@/views/bpm/oa/leave/leave.data'
import { useRouter } from 'vue-router'
const router = useRouter()
const { query } = useRoute() // 查询参数
const message = useMessage() // 消息弹窗
@ -22,6 +24,10 @@ const formData = ref({
reason: undefined
})
const routerReturn = () => {
router.back()
}
onMounted(() => {
id.value = query.id
if (!id.value) {

View File

@ -16,6 +16,7 @@ const crudSchemas = reactive<VxeCrudSchema>({
primaryTitle: '申请编号',
action: true,
actionWidth: '260',
searchSpan: 8,
columns: [
{
title: t('common.status'),

View File

@ -3,6 +3,10 @@
<!-- 第一步通过流程定义的列表选择对应的流程 -->
<div v-if="!selectProcessInstance">
<XTable @register="registerTable">
<!-- 流程分类 -->
<template #category_default="{ row }">
<DictTag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="Number(row?.category)" />
</template>
<template #version_default="{ row }">
<el-tag v-if="row">v{{ row.version }}</el-tag>
</template>
@ -55,7 +59,8 @@ import { allSchemas } from './process.create'
import * as DefinitionApi from '@/api/bpm/definition'
import * as ProcessInstanceApi from '@/api/bpm/processInstance'
import { setConfAndFields2 } from '@/utils/formCreate'
import { ApiAttrs } from '@form-create/element-ui/types/config'
import type { ApiAttrs } from '@form-create/element-ui/types/config'
import { DICT_TYPE } from '@/utils/dict'
const router = useRouter() // 路由
const message = useMessage() // 消息

View File

@ -404,9 +404,9 @@ const getDetail = () => {
data.formVariables
)
nextTick().then(() => {
fApi.value?.btn.show(false)
fApi.value?.resetBtn.show(false)
fApi.value?.disabled(true)
fApi.value?.fapi?.btn.show(false)
fApi.value?.fapi?.resetBtn.show(false)
fApi.value?.fapi?.disabled(true)
})
}

View File

@ -7,11 +7,15 @@
<XButton
type="primary"
preIcon="ep:zoom-in"
title="新建流程"
title="发起流程"
v-hasPermi="['bpm:process-instance:query']"
@click="handleCreate"
/>
</template>
<!-- 流程分类 -->
<template #category_default="{ row }">
<DictTag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="Number(row?.category)" />
</template>
<!-- 当前审批任务 -->
<template #tasks_default="{ row }">
<el-button v-for="task in row.tasks" :key="task.id" link>
@ -40,6 +44,7 @@
<script setup lang="ts">
// 全局相关的 import
import { ElMessageBox } from 'element-plus'
import { DICT_TYPE } from '@/utils/dict'
// 业务相关的 import
import * as ProcessInstanceApi from '@/api/bpm/processInstance'

View File

@ -14,7 +14,12 @@ const crudSchemas = reactive<VxeCrudSchema>({
title: '流程分类',
field: 'category',
dictType: DICT_TYPE.BPM_MODEL_CATEGORY,
dictClass: 'number'
dictClass: 'number',
table: {
slots: {
default: 'category_default'
}
}
},
{
title: '流程版本',

View File

@ -33,7 +33,12 @@ const crudSchemas = reactive<VxeCrudSchema>({
field: 'category',
dictType: DICT_TYPE.BPM_MODEL_CATEGORY,
dictClass: 'number',
isSearch: true
isSearch: true,
table: {
slots: {
default: 'category_default'
}
}
},
{
title: '当前审批任务',

View File

@ -21,6 +21,7 @@ const { push } = useRouter() // 路由
const [registerTable] = useXTable({
allSchemas: allSchemas,
topActionSlots: false,
getListApi: TaskApi.getDoneTaskPage
})

View File

@ -22,6 +22,7 @@ const { push } = useRouter() // 路由
const [registerTable] = useXTable({
allSchemas: allSchemas,
topActionSlots: false,
getListApi: TaskApi.getTodoTaskPage
})

View File

@ -7,6 +7,7 @@ const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id',
primaryType: null,
action: true,
searchSpan: 8,
columns: [
{
title: '任务编号',

View File

@ -1,7 +1,7 @@
<template>
<ContentWrap>
<!-- 列表 -->
<XTable @register="registerTable">
<XTable @register="registerTable" ref="xGrid">
<template #options_default="{ row }">
<span :key="option" v-for="option in row.options">
<el-tag>
@ -45,9 +45,9 @@
<el-select v-model="formData.roleIds" multiple clearable style="width: 100%">
<el-option
v-for="item in roleOptions"
:key="parseInt(item.id)"
:key="item.id"
:label="item.name"
:value="parseInt(item.id)"
:value="item.id"
/>
</el-select>
</el-form-item>
@ -145,11 +145,12 @@ import { listSimpleUserGroupsApi } from '@/api/bpm/userGroup'
import { listSimpleDeptApi } from '@/api/system/dept'
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
import { handleTree, defaultProps } from '@/utils/tree'
import { allSchemas, rules } from './taskAssignRule.data'
import { allSchemas, rules, idShowActionClick } from './taskAssignRule.data'
const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗
const { query } = useRoute()
const xGrid = ref()
// ========== 列表相关 ==========
@ -165,6 +166,8 @@ const taskAssignScriptDictDatas = getDictOptions(DICT_TYPE.BPM_TASK_ASSIGN_SCRIP
const modelId = query.modelId
// 流程定义的编号。如果 processDefinitionId 非空,则用于流程定义的查看,不支持配置
const processDefinitionId = query.processDefinitionId
let isShow = idShowActionClick(modelId)
// 查询参数
const queryParams = reactive({
modelId: modelId,
@ -346,5 +349,10 @@ onMounted(() => {
listSimpleUserGroupsApi().then((data) => {
userGroupOptions.value.push(...data)
})
if (!isShow) {
setTimeout(() => {
xGrid.value.Ref.hideColumn('actionbtns')
}, 100)
}
})
</script>

View File

@ -43,4 +43,12 @@ const crudSchemas = reactive<VxeCrudSchema>({
}
]
})
export const idShowActionClick = (modelId?: any) => {
if (modelId) {
return true
} else {
return false
}
}
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)

View File

@ -3,7 +3,7 @@
<IFrame :src="src" />
</ContentWrap>
</template>
<script setup lang="ts" name="Server">
<script setup lang="ts" name="AdminServer">
const BASE_URL = import.meta.env.VITE_BASE_URL
const src = ref(BASE_URL + '/admin/applications')
</script>

View File

@ -3,7 +3,7 @@
<IFrame :src="src" />
</ContentWrap>
</template>
<script setup lang="ts" name="Jmreport">
<script setup lang="ts" name="JimuReport">
import { getAccessToken } from '@/utils/auth'
const BASE_URL = import.meta.env.VITE_BASE_URL

View File

@ -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,

View File

@ -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()

View File

@ -11,7 +11,7 @@ export const rules = reactive({
// 新增 + 修改
const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id',
primaryType: 'seq',
primaryType: 'id',
primaryTitle: '编号',
action: true,
columns: [

View File

@ -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',

View File

@ -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],

View File

@ -59,6 +59,7 @@ const queryParams = reactive({
})
const [registerTable] = useXTable({
allSchemas: allSchemas,
topActionSlots: false,
params: queryParams,
getListApi: MailLogApi.getMailLogPageApi
})

View File

@ -37,6 +37,7 @@ const { t } = useI18n() // 国际化
// 列表相关的变量
const [registerTable] = useXTable({
allSchemas: allSchemas,
topActionSlots: false,
getListApi: NotifyMessageApi.getNotifyMessagePageApi
})

View File

@ -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: [

View File

@ -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
}

View File

@ -4,7 +4,7 @@ const { t } = useI18n() // 国际化
const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id',
primaryType: 'seq',
primaryType: 'id',
primaryTitle: '日志编号',
action: true,
actionWidth: '80px',

View File

@ -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>

View File

@ -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',

View File

@ -10,7 +10,7 @@ export const rules = reactive({
// CrudSchema
const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id',
primaryType: 'seq',
primaryType: 'id',
primaryTitle: '敏感词编号',
action: true,
columns: [

View File

@ -12,7 +12,7 @@ export const rules = reactive({
// CrudSchema
const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id',
primaryType: 'seq',
primaryType: 'id',
primaryTitle: '渠道编号',
action: true,
columns: [

View File

@ -4,7 +4,7 @@ const { t } = useI18n() // 国际化
// CrudSchema
const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id',
primaryType: 'seq',
primaryType: 'id',
primaryTitle: '日志编号',
action: true,
columns: [

View File

@ -15,7 +15,7 @@ export const rules = reactive({
// CrudSchema
const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id',
primaryType: 'seq',
primaryType: 'id',
primaryTitle: '模板编号',
action: true,
actionWidth: '280',

View File

@ -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: [
{

View File

@ -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>

View File

@ -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'),

View File

@ -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) => {

View File

@ -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',