From 15ac1d9d8b08e17f6e282e8d493923f636004491 Mon Sep 17 00:00:00 2001 From: admin <> Date: Sun, 19 Mar 2023 13:04:59 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E9=87=87=E7=94=A8ep=E9=87=8D=E5=86=99dept?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/types/auto-components.d.ts | 14 -- src/views/system/dept/dept.data.ts | 84 -------- src/views/system/dept/form.vue | 195 ++++++++++++++++++ src/views/system/dept/index.vue | 308 +++++++++++++++-------------- 4 files changed, 352 insertions(+), 249 deletions(-) delete mode 100644 src/views/system/dept/dept.data.ts create mode 100644 src/views/system/dept/form.vue diff --git a/src/types/auto-components.d.ts b/src/types/auto-components.d.ts index be71517c..8452fba6 100644 --- a/src/types/auto-components.d.ts +++ b/src/types/auto-components.d.ts @@ -23,8 +23,6 @@ declare module '@vue/runtime-core' { DictTag: typeof import('./../components/DictTag/src/DictTag.vue')['default'] Echart: typeof import('./../components/Echart/src/Echart.vue')['default'] Editor: typeof import('./../components/Editor/src/Editor.vue')['default'] - ElAutoResizer: typeof import('element-plus/es')['ElAutoResizer'] - ElAvatar: typeof import('element-plus/es')['ElAvatar'] ElBadge: typeof import('element-plus/es')['ElBadge'] ElButton: typeof import('element-plus/es')['ElButton'] ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup'] @@ -35,7 +33,6 @@ declare module '@vue/runtime-core' { ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem'] ElCollapseTransition: typeof import('element-plus/es')['ElCollapseTransition'] ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider'] - ElDatePicker: typeof import('element-plus/es')['ElDatePicker'] ElDescriptions: typeof import('element-plus/es')['ElDescriptions'] ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem'] ElDialog: typeof import('element-plus/es')['ElDialog'] @@ -54,7 +51,6 @@ declare module '@vue/runtime-core' { ElForm: typeof import('element-plus/es')['ElForm'] ElFormItem: typeof import('element-plus/es')['ElFormItem'] ElIcon: typeof import('element-plus/es')['ElIcon'] - ElImage: typeof import('element-plus/es')['ElImage'] ElImageViewer: typeof import('element-plus/es')['ElImageViewer'] ElInput: typeof import('element-plus/es')['ElInput'] ElInputNumber: typeof import('element-plus/es')['ElInputNumber'] @@ -62,26 +58,16 @@ declare module '@vue/runtime-core' { ElOption: typeof import('element-plus/es')['ElOption'] ElPagination: typeof import('element-plus/es')['ElPagination'] ElPopover: typeof import('element-plus/es')['ElPopover'] - ElRadio: typeof import('element-plus/es')['ElRadio'] - ElRadioButton: typeof import('element-plus/es')['ElRadioButton'] - ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] ElRow: typeof import('element-plus/es')['ElRow'] ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] ElSelect: typeof import('element-plus/es')['ElSelect'] ElSkeleton: typeof import('element-plus/es')['ElSkeleton'] - ElSpace: typeof import('element-plus/es')['ElSpace'] ElSwitch: typeof import('element-plus/es')['ElSwitch'] ElTable: typeof import('element-plus/es')['ElTable'] ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] - ElTableV2: typeof import('element-plus/es')['ElTableV2'] ElTabPane: typeof import('element-plus/es')['ElTabPane'] ElTabs: typeof import('element-plus/es')['ElTabs'] - ElTag: typeof import('element-plus/es')['ElTag'] - ElTimeline: typeof import('element-plus/es')['ElTimeline'] - ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem'] ElTooltip: typeof import('element-plus/es')['ElTooltip'] - ElTransfer: typeof import('element-plus/es')['ElTransfer'] - ElTree: typeof import('element-plus/es')['ElTree'] ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect'] ElUpload: typeof import('element-plus/es')['ElUpload'] Error: typeof import('./../components/Error/src/Error.vue')['default'] diff --git a/src/views/system/dept/dept.data.ts b/src/views/system/dept/dept.data.ts deleted file mode 100644 index c6945841..00000000 --- a/src/views/system/dept/dept.data.ts +++ /dev/null @@ -1,84 +0,0 @@ -import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas' - -const { t } = useI18n() // 国际化 - -// 表单校验 -export const rules = reactive({ - name: [required], - sort: [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, - trigger: 'blur', - message: '请输入正确的手机号码' - } - ] -}) - -// CrudSchema -const crudSchemas = reactive({ - primaryKey: 'id', - primaryType: null, - action: true, - columns: [ - { - title: '上级部门', - field: 'parentId', - isTable: false - }, - { - title: '部门名称', - field: 'name', - isSearch: true, - table: { - treeNode: true, - align: 'left' - } - }, - { - title: '负责人', - field: 'leaderUserId', - table: { - slots: { - default: 'leaderUserId_default' - } - } - }, - { - title: '联系电话', - field: 'phone' - }, - { - title: '邮箱', - field: 'email', - isTable: false - }, - { - title: '显示排序', - field: 'sort' - }, - { - title: t('common.status'), - field: 'status', - dictType: DICT_TYPE.COMMON_STATUS, - dictClass: 'number', - isSearch: true - }, - { - title: t('common.createTime'), - field: 'createTime', - formatter: 'formatDate', - isForm: false - } - ] -}) -export const { allSchemas } = useVxeCrudSchemas(crudSchemas) diff --git a/src/views/system/dept/form.vue b/src/views/system/dept/form.vue new file mode 100644 index 00000000..fbbcab59 --- /dev/null +++ b/src/views/system/dept/form.vue @@ -0,0 +1,195 @@ + + + diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue index 3b182e2a..bfd12256 100644 --- a/src/views/system/dept/index.vue +++ b/src/views/system/dept/index.vue @@ -1,174 +1,180 @@ From 1846ba150ebbb98fa8e6db3b0439a5dcb7a93f20 Mon Sep 17 00:00:00 2001 From: admin <> Date: Sun, 19 Mar 2023 21:44:13 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E9=87=8D=E6=96=B0dept=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/dept/form.vue | 13 ++++--------- src/views/system/dept/index.vue | 21 +++++++++------------ 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/src/views/system/dept/form.vue b/src/views/system/dept/form.vue index fbbcab59..8d9405f3 100644 --- a/src/views/system/dept/form.vue +++ b/src/views/system/dept/form.vue @@ -33,7 +33,7 @@ style="width: 100%" > [] as UserVO[] - } -}) const formRules = reactive({ parentId: [{ required: true, message: '上级部门不能为空', trigger: 'blur' }], @@ -118,12 +113,12 @@ const formRules = reactive({ }) /** 打开弹窗 */ -const openModal = async (type: string, id?: number) => { +const openModal = async (type: string, id?: number, userOption?: UserVO[]) => { + userList.value = userOption modelVisible.value = true modelTitle.value = t('action.' + type) formType.value = type resetForm() - console.log(id) // 修改时,设置数据 if (id) { formLoading.value = true diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue index bfd12256..d5f54d19 100644 --- a/src/views/system/dept/index.vue +++ b/src/views/system/dept/index.vue @@ -85,7 +85,7 @@ - +