Showing
5 changed files
with
54 additions
and
88 deletions
| @@ -69,6 +69,7 @@ export const NotificationTitleMaxLength: Rule[] = [ | @@ -69,6 +69,7 @@ export const NotificationTitleMaxLength: Rule[] = [ | ||
| 69 | if (String(value).length > 50) { | 69 | if (String(value).length > 50) { |
| 70 | return Promise.reject('标题长度不超过200字'); | 70 | return Promise.reject('标题长度不超过200字'); |
| 71 | } | 71 | } |
| 72 | + return Promise.resolve(); | ||
| 72 | }, | 73 | }, |
| 73 | validateTrigger: 'blur', | 74 | validateTrigger: 'blur', |
| 74 | }, | 75 | }, |
| @@ -86,18 +87,6 @@ export const NotificationContentMaxLength: Rule[] = [ | @@ -86,18 +87,6 @@ export const NotificationContentMaxLength: Rule[] = [ | ||
| 86 | validateTrigger: 'blur', | 87 | validateTrigger: 'blur', |
| 87 | }, | 88 | }, |
| 88 | ]; | 89 | ]; |
| 89 | -export const NotificationTypeMaxLength: Rule[] = [ | ||
| 90 | - { | ||
| 91 | - required: true, | ||
| 92 | - validator: (_, value: string) => { | ||
| 93 | - if (!value) { | ||
| 94 | - return Promise.reject('请选择类型'); | ||
| 95 | - } | ||
| 96 | - return Promise.resolve(); | ||
| 97 | - }, | ||
| 98 | - validateTrigger: 'blur', | ||
| 99 | - }, | ||
| 100 | -]; | ||
| 101 | 90 | ||
| 102 | export const DeviceNameMaxLength: Rule[] = [ | 91 | export const DeviceNameMaxLength: Rule[] = [ |
| 103 | { | 92 | { |
| @@ -35,13 +35,18 @@ | @@ -35,13 +35,18 @@ | ||
| 35 | </Card> | 35 | </Card> |
| 36 | <Card size="small" class="md:w-1/3 w-full !md:mt-0 !mt-4 !md:mr-4"> | 36 | <Card size="small" class="md:w-1/3 w-full !md:mt-0 !mt-4 !md:mr-4"> |
| 37 | <div class="flex" style="height: 100px"> | 37 | <div class="flex" style="height: 100px"> |
| 38 | - <div class="mr-4" | ||
| 39 | - ><img | ||
| 40 | - :src=" | ||
| 41 | - !isAdmin(role) ? '/src/assets/images/alarm-count.png' : '/src/assets/images/zh.png' | ||
| 42 | - " | 38 | + <div class="mr-4"> |
| 39 | + <img | ||
| 40 | + v-if="!isAdmin(role)" | ||
| 41 | + src="/src/assets/images/alarm-count.png" | ||
| 43 | style="width: 5rem; height: 5rem" | 42 | style="width: 5rem; height: 5rem" |
| 44 | - /></div> | 43 | + /> |
| 44 | + <img | ||
| 45 | + v-if="isAdmin(role)" | ||
| 46 | + src="/src/assets/images/zh.png" | ||
| 47 | + style="width: 5rem; height: 5rem" | ||
| 48 | + /> | ||
| 49 | + </div> | ||
| 45 | <div class="flex-auto"> | 50 | <div class="flex-auto"> |
| 46 | <div class="flex justify-between" style="align-items: center"> | 51 | <div class="flex justify-between" style="align-items: center"> |
| 47 | <div style="font-size: 1.625rem; color: #333">{{ | 52 | <div style="font-size: 1.625rem; color: #333">{{ |
| @@ -60,9 +65,15 @@ | @@ -60,9 +65,15 @@ | ||
| 60 | <div class="flex" style="height: 100px"> | 65 | <div class="flex" style="height: 100px"> |
| 61 | <div class="mr-4" | 66 | <div class="mr-4" |
| 62 | ><img | 67 | ><img |
| 63 | - :src="!isAdmin(role) ? '/src/assets/images/msg-count.png' : '/src/assets/images/kf.png'" | 68 | + v-if="!isAdmin(role)" |
| 69 | + src="/src/assets/images/msg-count.png" | ||
| 64 | style="width: 5rem; height: 5rem" | 70 | style="width: 5rem; height: 5rem" |
| 65 | - /></div> | 71 | + /><img |
| 72 | + v-if="isAdmin(role)" | ||
| 73 | + src="/src/assets/images/kf.png" | ||
| 74 | + style="width: 5rem; height: 5rem" | ||
| 75 | + /> | ||
| 76 | + </div> | ||
| 66 | <div class="flex-auto"> | 77 | <div class="flex-auto"> |
| 67 | <div class="flex justify-between" style="align-items: center"> | 78 | <div class="flex justify-between" style="align-items: center"> |
| 68 | <div style="font-size: 1.625rem; color: #333">{{ | 79 | <div style="font-size: 1.625rem; color: #333">{{ |
| @@ -5,7 +5,7 @@ import { Tinymce } from '/@/components/Tinymce/index'; | @@ -5,7 +5,7 @@ import { Tinymce } from '/@/components/Tinymce/index'; | ||
| 5 | import { getOrganizationList } from '/@/api/system/system'; | 5 | import { getOrganizationList } from '/@/api/system/system'; |
| 6 | import { copyTransFun } from '/@/utils/fnUtils'; | 6 | import { copyTransFun } from '/@/utils/fnUtils'; |
| 7 | import { Tag } from 'ant-design-vue'; | 7 | import { Tag } from 'ant-design-vue'; |
| 8 | -import { NotificationTitleMaxLength, NotificationTypeMaxLength } from '/@/utils/rules'; | 8 | +import { NotificationTitleMaxLength } from '/@/utils/rules'; |
| 9 | 9 | ||
| 10 | export enum IsOrgEnum { | 10 | export enum IsOrgEnum { |
| 11 | IS_ORG_ENUM = '1', | 11 | IS_ORG_ENUM = '1', |
| @@ -87,7 +87,6 @@ export const formSchema: FormSchema[] = [ | @@ -87,7 +87,6 @@ export const formSchema: FormSchema[] = [ | ||
| 87 | }, | 87 | }, |
| 88 | ], | 88 | ], |
| 89 | }, | 89 | }, |
| 90 | - rules: NotificationTypeMaxLength, | ||
| 91 | }, | 90 | }, |
| 92 | { | 91 | { |
| 93 | field: 'title', | 92 | field: 'title', |
| 1 | <template> | 1 | <template> |
| 2 | <div> | 2 | <div> |
| 3 | - <BasicModal | ||
| 4 | - width="650px" | ||
| 5 | - v-bind="$attrs" | ||
| 6 | - @register="registerModal" | ||
| 7 | - :title="getTitle" | ||
| 8 | - @ok="handleSubmit" | ||
| 9 | - > | ||
| 10 | - <PageWrapper :title="`用户资料`" contentBackground @back="goBack"> | ||
| 11 | - <Description size="middle" @register="register" /> | ||
| 12 | - </PageWrapper> | ||
| 13 | - </BasicModal> | 3 | + <PageWrapper :title="`用户资料`" contentBackground @back="goBack"> |
| 4 | + <Description size="middle" @register="register" /> | ||
| 5 | + </PageWrapper> | ||
| 14 | </div> | 6 | </div> |
| 15 | </template> | 7 | </template> |
| 16 | 8 | ||
| 17 | <script> | 9 | <script> |
| 18 | - import { defineComponent, ref } from 'vue'; | ||
| 19 | - // import { useRoute } from 'vue-router'; | 10 | + import { defineComponent } from 'vue'; |
| 11 | + import { useRoute } from 'vue-router'; | ||
| 20 | import { PageWrapper } from '/@/components/Page'; | 12 | import { PageWrapper } from '/@/components/Page'; |
| 21 | import { useGo } from '/@/hooks/web/usePage'; | 13 | import { useGo } from '/@/hooks/web/usePage'; |
| 22 | import { Description } from '../../../components/Description'; | 14 | import { Description } from '../../../components/Description'; |
| 23 | - import { useTabs } from '/@/hooks/web/useTabs'; | ||
| 24 | import { getAccountInfo } from '../../../api/system/system'; | 15 | import { getAccountInfo } from '../../../api/system/system'; |
| 25 | import { accountSchema } from './account.detail.data'; | 16 | import { accountSchema } from './account.detail.data'; |
| 26 | import { useDescription } from '../../../components/Description'; | 17 | import { useDescription } from '../../../components/Description'; |
| 27 | - import { BasicModal, useModalInner } from '/@/components/Modal'; | ||
| 28 | - | 18 | + import { useTabs } from '/@/hooks/web/useTabs'; |
| 29 | const accountData = {}; | 19 | const accountData = {}; |
| 30 | export default defineComponent({ | 20 | export default defineComponent({ |
| 31 | name: 'AccountDetail', | 21 | name: 'AccountDetail', |
| 32 | - components: { PageWrapper, Description, BasicModal }, | 22 | + components: { PageWrapper, Description }, |
| 33 | setup() { | 23 | setup() { |
| 34 | - // const route = useRoute(); | 24 | + const route = useRoute(); |
| 35 | const go = useGo(); | 25 | const go = useGo(); |
| 36 | - const { setTitle } = useTabs(); | ||
| 37 | - const getId = ref(''); | ||
| 38 | - const getTitle = ref(''); | 26 | + const { setTitle, close } = useTabs(); |
| 39 | const [register, methods] = useDescription({ | 27 | const [register, methods] = useDescription({ |
| 40 | title: '账号基础信息', | 28 | title: '账号基础信息', |
| 41 | data: accountData, | 29 | data: accountData, |
| 42 | - bordered: false, | ||
| 43 | schema: accountSchema, | 30 | schema: accountSchema, |
| 44 | column: 3, | 31 | column: 3, |
| 45 | }); | 32 | }); |
| 46 | - | ||
| 47 | - const [registerModal] = useModalInner(async (data) => { | ||
| 48 | - getId.value = await data.record.id; | ||
| 49 | - getAccountInfo(getId.value).then((result) => { | ||
| 50 | - Reflect.set(accountData, 'realName', result.realName); | ||
| 51 | - Reflect.set(accountData, 'phoneNumber', result.phoneNumber); | ||
| 52 | - Reflect.set(accountData, 'email', result.email); | ||
| 53 | - Reflect.set(accountData, 'username', result.username); | ||
| 54 | - Reflect.set( | ||
| 55 | - accountData, | ||
| 56 | - 'enabled', | ||
| 57 | - result.enabled ? '正常' : !result.enabled ? '禁用' : '已过期' | ||
| 58 | - ); | ||
| 59 | - Reflect.set(accountData, 'accountExpireTime', result.accountExpireTime); | ||
| 60 | - Reflect.set(accountData, 'createTime', result.createTime); | ||
| 61 | - Reflect.set(accountData, 'updateTime', result.updateTime); | ||
| 62 | - Reflect.set(accountData, 'deptId', result.deptId); | ||
| 63 | - // 设置Tab的标题(不会影响页面标题) | ||
| 64 | - setTitle('详情:用户' + result.realName); | ||
| 65 | - getTitle.value = '详情:用户' + result.realName; | ||
| 66 | - methods.setDescProps(accountData); | ||
| 67 | - }); | 33 | + getAccountInfo(route.params?.id).then((result) => { |
| 34 | + Reflect.set(accountData, 'realName', result.realName); | ||
| 35 | + Reflect.set(accountData, 'phoneNumber', result.phoneNumber); | ||
| 36 | + Reflect.set(accountData, 'email', result.email); | ||
| 37 | + Reflect.set(accountData, 'username', result.username); | ||
| 38 | + Reflect.set( | ||
| 39 | + accountData, | ||
| 40 | + 'enabled', | ||
| 41 | + result.enabled ? '正常' : !result.enabled ? '禁用' : '已过期' | ||
| 42 | + ); | ||
| 43 | + Reflect.set(accountData, 'accountExpireTime', result.accountExpireTime); | ||
| 44 | + Reflect.set(accountData, 'createTime', result.createTime); | ||
| 45 | + Reflect.set(accountData, 'updateTime', result.updateTime); | ||
| 46 | + Reflect.set(accountData, 'deptId', result.deptId); | ||
| 47 | + // 设置Tab的标题(不会影响页面标题) | ||
| 48 | + setTitle('详情:用户' + result.realName); | ||
| 49 | + methods.setDescProps(accountData); | ||
| 68 | }); | 50 | }); |
| 69 | // 页面左侧点击返回链接时的操作 | 51 | // 页面左侧点击返回链接时的操作 |
| 70 | function goBack() { | 52 | function goBack() { |
| 71 | // 本例的效果时点击返回始终跳转到账号列表页,实际应用时可返回上一页 | 53 | // 本例的效果时点击返回始终跳转到账号列表页,实际应用时可返回上一页 |
| 54 | + close(); | ||
| 72 | go('/system/account'); | 55 | go('/system/account'); |
| 73 | } | 56 | } |
| 74 | - return { goBack, accountSchema, accountData, register, registerModal, getTitle }; | 57 | + return { goBack, accountSchema, accountData, register }; |
| 75 | }, | 58 | }, |
| 76 | }); | 59 | }); |
| 77 | </script> | 60 | </script> |
| 78 | - | ||
| 79 | -<style></style> |
| @@ -62,7 +62,6 @@ | @@ -62,7 +62,6 @@ | ||
| 62 | </template> | 62 | </template> |
| 63 | </BasicTable> | 63 | </BasicTable> |
| 64 | <AccountModal @register="registerModal" @success="handleSuccess" /> | 64 | <AccountModal @register="registerModal" @success="handleSuccess" /> |
| 65 | - <AccountDetail @register="registerDetailModal" @success="handleSuccess" /> | ||
| 66 | </PageWrapper> | 65 | </PageWrapper> |
| 67 | </div> | 66 | </div> |
| 68 | </template> | 67 | </template> |
| @@ -75,26 +74,17 @@ | @@ -75,26 +74,17 @@ | ||
| 75 | import { Tag } from 'ant-design-vue'; | 74 | import { Tag } from 'ant-design-vue'; |
| 76 | import { useModal } from '/@/components/Modal'; | 75 | import { useModal } from '/@/components/Modal'; |
| 77 | import AccountModal from './AccountModal.vue'; | 76 | import AccountModal from './AccountModal.vue'; |
| 78 | - import AccountDetail from './AccountDetail.vue'; | 77 | + |
| 79 | import { columns, searchFormSchema } from './account.data'; | 78 | import { columns, searchFormSchema } from './account.data'; |
| 80 | - // import { useGo } from '/@/hooks/web/usePage'; | 79 | + import { useGo } from '/@/hooks/web/usePage'; |
| 81 | import { useMessage } from '/@/hooks/web/useMessage'; | 80 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 82 | 81 | ||
| 83 | export default defineComponent({ | 82 | export default defineComponent({ |
| 84 | name: 'AccountManagement', | 83 | name: 'AccountManagement', |
| 85 | - components: { | ||
| 86 | - BasicTable, | ||
| 87 | - PageWrapper, | ||
| 88 | - OrganizationIdTree, | ||
| 89 | - AccountModal, | ||
| 90 | - TableAction, | ||
| 91 | - Tag, | ||
| 92 | - AccountDetail, | ||
| 93 | - }, | 84 | + components: { BasicTable, PageWrapper, OrganizationIdTree, AccountModal, TableAction, Tag }, |
| 94 | setup() { | 85 | setup() { |
| 95 | - // const go = useGo(); | 86 | + const go = useGo(); |
| 96 | const [registerModal, { openModal }] = useModal(); | 87 | const [registerModal, { openModal }] = useModal(); |
| 97 | - const [registerDetailModal, { openModal: openDetailModal }] = useModal(); | ||
| 98 | const { createMessage } = useMessage(); | 88 | const { createMessage } = useMessage(); |
| 99 | let searchInfo = reactive<Recordable>({}); | 89 | let searchInfo = reactive<Recordable>({}); |
| 100 | const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo); | 90 | const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo); |
| @@ -157,14 +147,10 @@ | @@ -157,14 +147,10 @@ | ||
| 157 | } | 147 | } |
| 158 | 148 | ||
| 159 | function handleView(record: Recordable) { | 149 | function handleView(record: Recordable) { |
| 160 | - openDetailModal(true, { | ||
| 161 | - record, | ||
| 162 | - }); | ||
| 163 | - // go('/system/account_detail/' + record.id); | 150 | + go('/system/account_detail/' + record.id); |
| 164 | } | 151 | } |
| 165 | 152 | ||
| 166 | return { | 153 | return { |
| 167 | - registerDetailModal, | ||
| 168 | registerTable, | 154 | registerTable, |
| 169 | registerModal, | 155 | registerModal, |
| 170 | handleCreate, | 156 | handleCreate, |