diff --git a/yudao-ui-admin-vue3/src/utils/auth.ts b/yudao-ui-admin-vue3/src/utils/auth.ts index 63f7c34bd..47cfa7321 100644 --- a/yudao-ui-admin-vue3/src/utils/auth.ts +++ b/yudao-ui-admin-vue3/src/utils/auth.ts @@ -1,32 +1,36 @@ -import { useCache } from '@/hooks/web/useCache' +import Cookies from 'js-cookie' import { TokenType } from '@/api/login/types' import { decrypt, encrypt } from '@/utils/jsencrypt' -const { wsCache } = useCache() const AccessTokenKey = 'ACCESS_TOKEN' const RefreshTokenKey = 'REFRESH_TOKEN' // 获取token export const getAccessToken = () => { // 此处与TokenKey相同,此写法解决初始化时Cookies中不存在TokenKey报错 - return wsCache.get('ACCESS_TOKEN') + return Cookies.get(AccessTokenKey) ? Cookies.get(AccessTokenKey) : Cookies.get('ACCESS_TOKEN') } // 刷新token export const getRefreshToken = () => { - return wsCache.get(RefreshTokenKey) + return Cookies.get(RefreshTokenKey) } // 设置token export const setToken = (token: TokenType) => { - wsCache.set(RefreshTokenKey, token.refreshToken, { exp: token.expiresTime }) - wsCache.set(AccessTokenKey, token.accessToken) + Cookies.set(RefreshTokenKey, token.refreshToken, token.expiresTime) + Cookies.set(AccessTokenKey, token.accessToken) } // 删除token export const removeToken = () => { - wsCache.delete(AccessTokenKey) - wsCache.delete(RefreshTokenKey) + Cookies.remove(AccessTokenKey) + Cookies.remove(RefreshTokenKey) +} + +/** 格式化token(jwt格式) */ +export const formatToken = (token: string): string => { + return 'Bearer ' + token } // ========== 账号相关 ========== @@ -35,40 +39,40 @@ const PasswordKey = 'PASSWORD' const RememberMeKey = 'REMEMBER_ME' export const getUsername = () => { - return wsCache.get(UsernameKey) + return Cookies.get(UsernameKey) } export const setUsername = (username: string) => { - wsCache.set(UsernameKey, username) + Cookies.set(UsernameKey, username) } export const removeUsername = () => { - wsCache.delete(UsernameKey) + Cookies.remove(UsernameKey) } export const getPassword = () => { - const password = wsCache.get(PasswordKey) + const password = Cookies.get(PasswordKey) return password ? decrypt(password) : undefined } export const setPassword = (password: string) => { - wsCache.set(PasswordKey, encrypt(password)) + Cookies.set(PasswordKey, encrypt(password)) } export const removePassword = () => { - wsCache.delete(PasswordKey) + Cookies.remove(PasswordKey) } export const getRememberMe = () => { - return wsCache.get(RememberMeKey) === 'true' + return Cookies.get(RememberMeKey) === 'true' } export const setRememberMe = (rememberMe: string) => { - wsCache.set(RememberMeKey, rememberMe) + Cookies.set(RememberMeKey, rememberMe) } export const removeRememberMe = () => { - wsCache.delete(RememberMeKey) + Cookies.remove(RememberMeKey) } // ========== 租户相关 ========== @@ -77,25 +81,25 @@ const TenantIdKey = 'TENANT_ID' const TenantNameKey = 'TENANT_NAME' export const getTenantName = () => { - return wsCache.get(TenantNameKey) + return Cookies.get(TenantNameKey) } export const setTenantName = (username: string) => { - wsCache.set(TenantNameKey, username) + Cookies.set(TenantNameKey, username) } export const removeTenantName = () => { - wsCache.delete(TenantNameKey) + Cookies.remove(TenantNameKey) } export const getTenantId = () => { - return wsCache.get(TenantIdKey) + return Cookies.get(TenantIdKey) } export const setTenantId = (username: string) => { - wsCache.set(TenantIdKey, username) + Cookies.set(TenantIdKey, username) } export const removeTenantId = () => { - wsCache.delete(TenantIdKey) + Cookies.remove(TenantIdKey) } diff --git a/yudao-ui-admin-vue3/src/views/bpm/form/index.vue b/yudao-ui-admin-vue3/src/views/bpm/form/index.vue index 7a4b8a00c..4774e31ca 100644 --- a/yudao-ui-admin-vue3/src/views/bpm/form/index.vue +++ b/yudao-ui-admin-vue3/src/views/bpm/form/index.vue @@ -94,7 +94,7 @@ getList() <ContentWrap> <!-- 操作工具栏 --> <div class="mb-10px"> - <el-button type="primary" v-hasPermi="['bpm:form:create']" @click="handleCreate"> + <el-button type="primary" v-hasPermi="['bpm:form:create']" @click="handleCreate()"> <Icon icon="ep:zoom-in" class="mr-5px" /> {{ t('action.add') }} </el-button> </div> @@ -152,15 +152,16 @@ getList() /> <!-- 操作按钮 --> <template #footer> - <el-button + <!-- 按钮:保存 --> + <XButton v-if="['create', 'update'].includes(actionType)" type="primary" + :title="t('action.save')" :loading="actionLoading" - @click="submitForm" - > - {{ t('action.save') }} - </el-button> - <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button> + @click="submitForm()" + /> + <!-- 按钮:关闭 --> + <XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" /> </template> </XModal> </template> diff --git a/yudao-ui-admin-vue3/src/views/bpm/group/index.vue b/yudao-ui-admin-vue3/src/views/bpm/group/index.vue index 83dc33b06..06ef59b83 100644 --- a/yudao-ui-admin-vue3/src/views/bpm/group/index.vue +++ b/yudao-ui-admin-vue3/src/views/bpm/group/index.vue @@ -118,7 +118,7 @@ onMounted(async () => { <ContentWrap> <!-- 操作工具栏 --> <div class="mb-10px"> - <el-button type="primary" v-hasPermi="['bpm:user-group:create']" @click="handleCreate"> + <el-button type="primary" v-hasPermi="['bpm:user-group:create']" @click="handleCreate()"> <Icon icon="ep:zoom-in" class="mr-5px" /> {{ t('action.add') }} </el-button> </div> @@ -206,17 +206,17 @@ onMounted(async () => { </span> </template> </Descriptions> - <!-- 操作按钮 --> <template #footer> - <el-button + <!-- 按钮:保存 --> + <XButton v-if="['create', 'update'].includes(actionType)" type="primary" + :title="t('action.save')" :loading="actionLoading" - @click="submitForm" - > - {{ t('action.save') }} - </el-button> - <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button> + @click="submitForm()" + /> + <!-- 按钮:关闭 --> + <XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" /> </template> </XModal> </template> diff --git a/yudao-ui-admin-vue3/src/views/bpm/model/index.vue b/yudao-ui-admin-vue3/src/views/bpm/model/index.vue index 38569d867..a61d262d5 100644 --- a/yudao-ui-admin-vue3/src/views/bpm/model/index.vue +++ b/yudao-ui-admin-vue3/src/views/bpm/model/index.vue @@ -113,7 +113,7 @@ getList() <ContentWrap> <!-- 操作工具栏 --> <div class="mb-10px"> - <el-button type="primary" v-hasPermi="['bpm:model:create']" @click="handleCreate"> + <el-button type="primary" v-hasPermi="['bpm:model:create']" @click="handleCreate()"> <Icon icon="ep:zoom-in" class="mr-5px" /> {{ t('action.add') }} </el-button> </div> @@ -202,15 +202,16 @@ getList() /> <!-- 操作按钮 --> <template #footer> - <el-button + <!-- 按钮:保存 --> + <XButton v-if="['create', 'update'].includes(actionType)" type="primary" + :title="t('action.save')" :loading="actionLoading" - @click="submitForm" - > - {{ t('action.save') }} - </el-button> - <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button> + @click="submitForm()" + /> + <!-- 按钮:关闭 --> + <XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" /> </template> </XModal> </template> diff --git a/yudao-ui-admin-vue3/src/views/infra/codegen/EditTable.vue b/yudao-ui-admin-vue3/src/views/infra/codegen/EditTable.vue index 91bf847d0..02a2dc1a1 100644 --- a/yudao-ui-admin-vue3/src/views/infra/codegen/EditTable.vue +++ b/yudao-ui-admin-vue3/src/views/infra/codegen/EditTable.vue @@ -2,7 +2,7 @@ import { ref, unref, onMounted } from 'vue' import { ContentDetailWrap } from '@/components/ContentDetailWrap' import { BasicInfoForm, CloumInfoForm, GenInfoForm } from './components' -import { ElTabs, ElTabPane, ElButton, ElMessage } from 'element-plus' +import { ElTabs, ElTabPane, ElMessage } from 'element-plus' import { getCodegenTableApi, updateCodegenTableApi } from '@/api/infra/codegen' import { useRouter, useRoute } from 'vue-router' import { useI18n } from '@/hooks/web/useI18n' @@ -70,9 +70,7 @@ onMounted(() => { </el-tab-pane> </el-tabs> <template #right> - <el-button type="primary" :loading="loading" @click="submitForm"> - {{ t('action.save') }} - </el-button> + <XButton type="primary" :title="t('action.save')" :loading="loading" @click="submitForm()" /> </template> </ContentDetailWrap> </template> diff --git a/yudao-ui-admin-vue3/src/views/infra/config/index.vue b/yudao-ui-admin-vue3/src/views/infra/config/index.vue index 23f0f80a4..687448e1e 100644 --- a/yudao-ui-admin-vue3/src/views/infra/config/index.vue +++ b/yudao-ui-admin-vue3/src/views/infra/config/index.vue @@ -178,15 +178,16 @@ getList() </Descriptions> <!-- 操作按钮 --> <template #footer> - <el-button + <!-- 按钮:保存 --> + <XButton v-if="['create', 'update'].includes(actionType)" type="primary" + :title="t('action.save')" :loading="actionLoading" - @click="submitForm" - > - {{ t('action.save') }} - </el-button> - <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button> + @click="submitForm()" + /> + <!-- 按钮:关闭 --> + <XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" /> </template> </XModal> </template> diff --git a/yudao-ui-admin-vue3/src/views/infra/dataSourceConfig/index.vue b/yudao-ui-admin-vue3/src/views/infra/dataSourceConfig/index.vue index d93efb281..509582db7 100644 --- a/yudao-ui-admin-vue3/src/views/infra/dataSourceConfig/index.vue +++ b/yudao-ui-admin-vue3/src/views/infra/dataSourceConfig/index.vue @@ -147,15 +147,16 @@ onMounted(async () => { /> <!-- 操作按钮 --> <template #footer> - <el-button + <!-- 按钮:保存 --> + <XButton v-if="['create', 'update'].includes(actionType)" type="primary" + :title="t('action.save')" :loading="loading" - @click="submitForm" - > - {{ t('action.save') }} - </el-button> - <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button> + @click="submitForm()" + /> + <!-- 按钮:关闭 --> + <XButton :loading="loading" :title="t('dialog.close')" @click="dialogVisible = false" /> </template> </XModal> </template> diff --git a/yudao-ui-admin-vue3/src/views/infra/fileConfig/index.vue b/yudao-ui-admin-vue3/src/views/infra/fileConfig/index.vue index 8e93c9d2c..dd72c2c4d 100644 --- a/yudao-ui-admin-vue3/src/views/infra/fileConfig/index.vue +++ b/yudao-ui-admin-vue3/src/views/infra/fileConfig/index.vue @@ -192,15 +192,16 @@ getList() /> <!-- 操作按钮 --> <template #footer> - <el-button + <!-- 按钮:保存 --> + <XButton v-if="['create', 'update'].includes(actionType)" type="primary" + :title="t('action.save')" :loading="actionLoading" - @click="submitForm" - > - {{ t('action.save') }} - </el-button> - <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button> + @click="submitForm()" + /> + <!-- 按钮:关闭 --> + <XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" /> </template> </XModal> </template> diff --git a/yudao-ui-admin-vue3/src/views/infra/job/index.vue b/yudao-ui-admin-vue3/src/views/infra/job/index.vue index 5c3e72ab9..32e9e9eda 100644 --- a/yudao-ui-admin-vue3/src/views/infra/job/index.vue +++ b/yudao-ui-admin-vue3/src/views/infra/job/index.vue @@ -235,15 +235,16 @@ getList() </Descriptions> <!-- 操作按钮 --> <template #footer> - <el-button + <!-- 按钮:保存 --> + <XButton v-if="['create', 'update'].includes(actionType)" type="primary" + :title="t('action.save')" :loading="actionLoading" - @click="submitForm" - > - {{ t('action.save') }} - </el-button> - <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button> + @click="submitForm()" + /> + <!-- 按钮:关闭 --> + <XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" /> </template> </XModal> </template> diff --git a/yudao-ui-admin-vue3/src/views/pay/app/index.vue b/yudao-ui-admin-vue3/src/views/pay/app/index.vue index e5ec83383..fb663e265 100644 --- a/yudao-ui-admin-vue3/src/views/pay/app/index.vue +++ b/yudao-ui-admin-vue3/src/views/pay/app/index.vue @@ -171,15 +171,16 @@ getList() /> <!-- 操作按钮 --> <template #footer> - <el-button + <!-- 按钮:保存 --> + <XButton v-if="['create', 'update'].includes(actionType)" type="primary" + :title="t('action.save')" :loading="actionLoading" - @click="submitForm" - > - {{ t('action.save') }} - </el-button> - <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button> + @click="submitForm()" + /> + <!-- 按钮:关闭 --> + <XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" /> </template> </XModal> </template> diff --git a/yudao-ui-admin-vue3/src/views/pay/merchant/index.vue b/yudao-ui-admin-vue3/src/views/pay/merchant/index.vue index e2e1ee728..1986cd03e 100644 --- a/yudao-ui-admin-vue3/src/views/pay/merchant/index.vue +++ b/yudao-ui-admin-vue3/src/views/pay/merchant/index.vue @@ -171,15 +171,16 @@ getList() /> <!-- 操作按钮 --> <template #footer> - <el-button + <!-- 按钮:保存 --> + <XButton v-if="['create', 'update'].includes(actionType)" type="primary" + :title="t('action.save')" :loading="actionLoading" - @click="submitForm" - > - {{ t('action.save') }} - </el-button> - <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button> + @click="submitForm()" + /> + <!-- 按钮:关闭 --> + <XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" /> </template> </XModal> </template> diff --git a/yudao-ui-admin-vue3/src/views/pay/order/index.vue b/yudao-ui-admin-vue3/src/views/pay/order/index.vue index d0c49f8b1..9e2c71a10 100644 --- a/yudao-ui-admin-vue3/src/views/pay/order/index.vue +++ b/yudao-ui-admin-vue3/src/views/pay/order/index.vue @@ -155,15 +155,16 @@ getList() /> <!-- 操作按钮 --> <template #footer> - <el-button + <!-- 按钮:保存 --> + <XButton v-if="['create', 'update'].includes(actionType)" type="primary" + :title="t('action.save')" :loading="actionLoading" - @click="submitForm" - > - {{ t('action.save') }} - </el-button> - <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button> + @click="submitForm()" + /> + <!-- 按钮:关闭 --> + <XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" /> </template> </XModal> </template> diff --git a/yudao-ui-admin-vue3/src/views/system/dept/index.vue b/yudao-ui-admin-vue3/src/views/system/dept/index.vue index 5d1b90b6f..7276107a6 100644 --- a/yudao-ui-admin-vue3/src/views/system/dept/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/dept/index.vue @@ -48,7 +48,7 @@ const getUserList = async () => { userOption.value = res } // 新增 -const handleAdd = (data: { id: number }) => { +const handleCreate = (data: { id: number }) => { // 重置表单 deptParentId.value = data.id formTitle.value = '新增部门' @@ -110,9 +110,13 @@ onMounted(async () => { <template #header> <div class="card-header"> <span>部门列表</span> - <el-button type="primary" v-hasPermi="['system:dept:create']" @click="handleAdd"> - 新增根节点 - </el-button> + <XButton + type="primary" + preIcon="ep:zoom-in" + title="新增根节点" + v-hasPermi="['system:dept:create']" + @click="handleCreate" + /> </div> </template> <div class="custom-tree-container"> @@ -133,30 +137,24 @@ onMounted(async () => { <span class="custom-tree-node"> <span>{{ node.label }}</span> <span> - <el-button - link - type="primary" + <XTextButton + preIcon="ep:zoom-in" + :title="t('action.add')" v-hasPermi="['system:dept:create']" - @click="handleAdd(data)" - > - <Icon icon="ep:zoom-in" class="mr-5px" /> {{ t('action.add') }} - </el-button> - <el-button - link - type="primary" + @click="handleCreate(data)" + /> + <XTextButton + preIcon="ep:edit" + :title="t('action.edit')" v-hasPermi="['system:dept:update']" @click="handleUpdate(data)" - > - <Icon icon="ep:edit" class="mr-1px" /> {{ t('action.edit') }} - </el-button> - <el-button - link - type="primary" + /> + <XTextButton + preIcon="ep:delete" + :title="t('action.del')" v-hasPermi="['system:dept:delete']" @click="handleDelete(data)" - > - <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} - </el-button> + /> </span> </span> </template> @@ -195,16 +193,16 @@ onMounted(async () => { </el-select> </template> </Form> - <!-- 操作按钮 --> - <el-button + <!-- 按钮:保存 --> + <XButton type="primary" + :title="t('action.save')" v-hasPermi="['system:dept:update']" :loading="loading" - @click="submitForm" - > - {{ t('action.save') }} - </el-button> - <el-button type="danger" @click="showForm = false">{{ t('common.cancel') }}</el-button> + @click="submitForm()" + /> + <!-- 按钮:关闭 --> + <XButton :loading="loading" :title="t('dialog.close')" @click="showForm = false" /> </div> </el-card> </div> diff --git a/yudao-ui-admin-vue3/src/views/system/errorCode/index.vue b/yudao-ui-admin-vue3/src/views/system/errorCode/index.vue index 5dcff9156..dc7eeaca4 100644 --- a/yudao-ui-admin-vue3/src/views/system/errorCode/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/errorCode/index.vue @@ -59,7 +59,7 @@ type="primary" :title="t('action.save')" :loading="actionLoading" - @click="submitForm" + @click="submitForm()" /> <!-- 按钮:关闭 --> <XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" /> diff --git a/yudao-ui-admin-vue3/src/views/system/menu/index.vue b/yudao-ui-admin-vue3/src/views/system/menu/index.vue index d6bf85603..6a67cabc4 100644 --- a/yudao-ui-admin-vue3/src/views/system/menu/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/menu/index.vue @@ -234,7 +234,7 @@ v-if="['create', 'update'].includes(actionType)" type="primary" :loading="actionLoading" - @click="submitForm" + @click="submitForm()" :title="t('action.save')" /> <!-- 按钮:关闭 --> diff --git a/yudao-ui-admin-vue3/src/views/system/notice/index.vue b/yudao-ui-admin-vue3/src/views/system/notice/index.vue index a7d5a3546..406a1a434 100644 --- a/yudao-ui-admin-vue3/src/views/system/notice/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/notice/index.vue @@ -59,7 +59,7 @@ type="primary" :title="t('action.save')" :loading="actionLoading" - @click="submitForm" + @click="submitForm()" /> <!-- 按钮:关闭 --> <XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" /> diff --git a/yudao-ui-admin-vue3/src/views/system/oauth2/client/index.vue b/yudao-ui-admin-vue3/src/views/system/oauth2/client/index.vue index 33599c117..298b45fe9 100644 --- a/yudao-ui-admin-vue3/src/views/system/oauth2/client/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/oauth2/client/index.vue @@ -69,7 +69,7 @@ type="primary" :title="t('action.save')" :loading="actionLoading" - @click="submitForm" + @click="submitForm()" /> <!-- 按钮:关闭 --> <XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" /> diff --git a/yudao-ui-admin-vue3/src/views/system/oauth2/token/index.vue b/yudao-ui-admin-vue3/src/views/system/oauth2/token/index.vue index f7bfff4c4..ee556608a 100644 --- a/yudao-ui-admin-vue3/src/views/system/oauth2/token/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/oauth2/token/index.vue @@ -20,7 +20,7 @@ <Descriptions :schema="allSchemas.detailSchema" :data="detailRef" /> <!-- 操作按钮 --> <template #footer> - <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button> + <XButton :title="t('dialog.close')" @click="dialogVisible = false" /> </template> </XModal> </template> diff --git a/yudao-ui-admin-vue3/src/views/system/post/index.vue b/yudao-ui-admin-vue3/src/views/system/post/index.vue index 189607422..7c4b3dfef 100644 --- a/yudao-ui-admin-vue3/src/views/system/post/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/post/index.vue @@ -66,7 +66,7 @@ type="primary" :title="t('action.save')" :loading="actionLoading" - @click="submitForm" + @click="submitForm()" /> <!-- 按钮:关闭 --> <XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" /> diff --git a/yudao-ui-admin-vue3/src/views/system/role/index.vue b/yudao-ui-admin-vue3/src/views/system/role/index.vue index b46a00bda..fffd79444 100644 --- a/yudao-ui-admin-vue3/src/views/system/role/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/role/index.vue @@ -1,3 +1,161 @@ +<template> + <!-- 搜索工作区 --> + <ContentWrap> + <Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> + </ContentWrap> + <ContentWrap> + <!-- 操作工具栏 --> + <div class="mb-10px"> + <XButton + type="primary" + preIcon="ep:zoom-in" + :title="t('action.add')" + v-hasPermi="['system:role:create']" + @click="handleCreate()" + /> + </div> + <!-- 列表 --> + <Table + :columns="allSchemas.tableColumns" + :selection="false" + :data="tableObject.tableList" + :loading="tableObject.loading" + :pagination="{ + total: tableObject.total + }" + v-model:pageSize="tableObject.pageSize" + v-model:currentPage="tableObject.currentPage" + @register="register" + > + <template #type="{ row }"> + <DictTag :type="DICT_TYPE.SYSTEM_ROLE_TYPE" :value="row.type" /> + </template> + <template #status="{ row }"> + <DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" /> + </template> + <template #createTime="{ row }"> + <span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span> + </template> + <template #action="{ row }"> + <XTextButton + preIcon="ep:edit" + :title="t('action.edit')" + v-hasPermi="['system:role:update']" + @click="handleUpdate(row.id)" + /> + <XTextButton + preIcon="ep:view" + :title="t('action.detail')" + v-hasPermi="['system:role:update']" + @click="handleDetail(row.id)" + /> + <XTextButton + preIcon="ep:basketball" + title="菜单权限" + v-hasPermi="['system:permission:assign-role-menu']" + @click="handleScope('menu', row)" + /> + <XTextButton + preIcon="ep:coin" + title="数据权限" + v-hasPermi="['system:permission:assign-role-data-scope']" + @click="handleScope('data', row)" + /> + <XTextButton + preIcon="ep:delete" + :title="t('action.del')" + v-hasPermi="['system:role:delete']" + @click="delList(row.id, false)" + /> + </template> + </Table> + </ContentWrap> + + <XModal v-model="dialogVisible" :title="dialogTitle"> + <!-- 对话框(添加 / 修改) --> + <Form + v-if="['create', 'update'].includes(actionType)" + :schema="allSchemas.formSchema" + :rules="rules" + ref="formRef" + /> + <!-- 对话框(详情) --> + <Descriptions + v-if="actionType === 'detail'" + :schema="allSchemas.detailSchema" + :data="detailRef" + /> + <!-- 操作按钮 --> + <template #footer> + <XButton + v-if="['create', 'update'].includes(actionType)" + type="primary" + :title="t('action.save')" + :loading="loading" + @click="submitForm()" + /> + <XButton :loading="loading" :title="t('dialog.close')" @click="dialogVisible = false" /> + </template> + </XModal> + <XModal v-model="dialogScopeVisible" :title="dialogScopeTitle"> + <el-form :model="dataScopeForm"> + <el-form-item label="角色名称"> + <el-input v-model="dataScopeForm.name" :disabled="true" /> + </el-form-item> + <el-form-item label="角色标识"> + <el-input v-model="dataScopeForm.code" :disabled="true" /> + </el-form-item> + <!-- 分配角色的数据权限对话框 --> + <el-form-item label="权限范围" v-if="actionScopeType === 'data'"> + <el-select v-model="dataScopeForm.dataScope"> + <el-option + v-for="item in dataScopeDictDatas" + :key="parseInt(item.value)" + :label="item.label" + :value="parseInt(item.value)" + /> + </el-select> + </el-form-item> + <!-- 分配角色的菜单权限对话框 --> + <el-form-item + label="权限范围" + v-if=" + actionScopeType === 'menu' || dataScopeForm.dataScope === SystemDataScopeEnum.DEPT_CUSTOM + " + > + <el-card class="box-card"> + <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-form> + <!-- 操作按钮 --> + <template #footer> + <XButton type="primary" :title="t('action.save')" :loading="loading" @click="submitScope()" /> + <XButton :loading="loading" :title="t('dialog.close')" @click="dialogScopeVisible = false" /> + </template> + </XModal> +</template> <script setup lang="ts"> import { onMounted, reactive, ref, unref } from 'vue' import dayjs from 'dayjs' @@ -57,10 +215,10 @@ const handleCreate = () => { } // 修改操作 -const handleUpdate = async (row: RoleVO) => { +const handleUpdate = async (rowId: number) => { setDialogTile('update') // 设置数据 - const res = await RoleApi.getRoleApi(row.id) + const res = await RoleApi.getRoleApi(rowId) unref(formRef)?.setValues(res) } @@ -183,171 +341,3 @@ onMounted(() => { init() }) </script> - -<template> - <!-- 搜索工作区 --> - <ContentWrap> - <Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> - </ContentWrap> - <ContentWrap> - <!-- 操作工具栏 --> - <div class="mb-10px"> - <el-button type="primary" v-hasPermi="['system:role:create']" @click="handleCreate"> - <Icon icon="ep:zoom-in" class="mr-5px" /> {{ t('action.add') }} - </el-button> - </div> - <!-- 列表 --> - <Table - :columns="allSchemas.tableColumns" - :selection="false" - :data="tableObject.tableList" - :loading="tableObject.loading" - :pagination="{ - total: tableObject.total - }" - v-model:pageSize="tableObject.pageSize" - v-model:currentPage="tableObject.currentPage" - @register="register" - > - <template #type="{ row }"> - <DictTag :type="DICT_TYPE.SYSTEM_ROLE_TYPE" :value="row.type" /> - </template> - <template #status="{ row }"> - <DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" /> - </template> - <template #createTime="{ row }"> - <span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span> - </template> - <template #action="{ row }"> - <el-button - link - type="primary" - v-hasPermi="['system:role:update']" - @click="handleUpdate(row)" - > - <Icon icon="ep:edit" class="mr-1px" /> {{ t('action.edit') }} - </el-button> - <el-button - link - type="primary" - v-hasPermi="['system:role:update']" - @click="handleDetail(row)" - > - <Icon icon="ep:view" class="mr-1px" /> {{ t('action.detail') }} - </el-button> - <el-button - link - type="primary" - v-hasPermi="['system:permission:assign-role-menu']" - @click="handleScope('menu', row)" - > - <Icon icon="ep:basketball" class="mr-1px" /> 菜单权限 - </el-button> - <el-button - link - type="primary" - v-hasPermi="['system:permission:assign-role-data-scope']" - @click="handleScope('data', row)" - > - <Icon icon="ep:coin" class="mr-1px" /> 数据权限 - </el-button> - <el-button - link - type="primary" - v-hasPermi="['system:role:delete']" - @click="delList(row.id, false)" - > - <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} - </el-button> - </template> - </Table> - </ContentWrap> - - <XModal v-model="dialogVisible" :title="dialogTitle"> - <!-- 对话框(添加 / 修改) --> - <Form - v-if="['create', 'update'].includes(actionType)" - :schema="allSchemas.formSchema" - :rules="rules" - ref="formRef" - /> - <!-- 对话框(详情) --> - <Descriptions - v-if="actionType === 'detail'" - :schema="allSchemas.detailSchema" - :data="detailRef" - /> - <!-- 操作按钮 --> - <template #footer> - <el-button - v-if="['create', 'update'].includes(actionType)" - type="primary" - :loading="loading" - @click="submitForm" - > - {{ t('action.save') }} - </el-button> - <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button> - </template> - </XModal> - <XModal v-model="dialogScopeVisible" :title="dialogScopeTitle"> - <el-form :model="dataScopeForm"> - <el-form-item label="角色名称"> - <el-input v-model="dataScopeForm.name" :disabled="true" /> - </el-form-item> - <el-form-item label="角色标识"> - <el-input v-model="dataScopeForm.code" :disabled="true" /> - </el-form-item> - <!-- 分配角色的数据权限对话框 --> - <el-form-item label="权限范围" v-if="actionScopeType === 'data'"> - <el-select v-model="dataScopeForm.dataScope"> - <el-option - v-for="item in dataScopeDictDatas" - :key="parseInt(item.value)" - :label="item.label" - :value="parseInt(item.value)" - /> - </el-select> - </el-form-item> - <!-- 分配角色的菜单权限对话框 --> - <el-form-item - label="权限范围" - v-if=" - actionScopeType === 'menu' || dataScopeForm.dataScope === SystemDataScopeEnum.DEPT_CUSTOM - " - > - <el-card class="box-card"> - <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-form> - <!-- 操作按钮 --> - <template #footer> - <el-button type="primary" :loading="loading" @click="submitScope"> - {{ t('action.save') }} - </el-button> - <el-button @click="dialogScopeVisible = false">{{ t('dialog.close') }}</el-button> - </template> - </XModal> -</template> diff --git a/yudao-ui-admin-vue3/src/views/system/sensitiveWord/index.vue b/yudao-ui-admin-vue3/src/views/system/sensitiveWord/index.vue index 1a1902208..f76c6ce46 100644 --- a/yudao-ui-admin-vue3/src/views/system/sensitiveWord/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/sensitiveWord/index.vue @@ -1,3 +1,116 @@ +<template> + <!-- 搜索工作区 --> + <ContentWrap> + <Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> + </ContentWrap> + <ContentWrap> + <!-- 操作工具栏 --> + <div class="mb-10px"> + <XButton + type="primary" + preIcon="ep:zoom-in" + :title="t('action.add')" + v-hasPermi="['system:sensitive-word:create']" + @click="handleCreate()" + /> + <XButton + type="warning" + preIcon="ep:download" + :title="t('action.export')" + v-hasPermi="['system:sensitive-word:export']" + @click="exportList('敏感词数据.xls')" + /> + </div> + <!-- 列表 --> + <Table + :columns="allSchemas.tableColumns" + :selection="false" + :data="tableObject.tableList" + :loading="tableObject.loading" + :pagination="{ + total: tableObject.total + }" + v-model:pageSize="tableObject.pageSize" + v-model:currentPage="tableObject.currentPage" + @register="register" + > + <template #tags="{ row }"> + <el-tag + :disable-transitions="true" + :key="index" + v-for="(tag, index) in row.tags" + :index="index" + > + {{ tag }} + </el-tag> + </template> + <template #status="{ row }"> + <DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" /> + </template> + <template #createTime="{ row }"> + <span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span> + </template> + <template #action="{ row }"> + <!-- 操作:修改 --> + <XTextButton + preIcon="ep:edit" + :title="t('action.edit')" + v-hasPermi="['system:sensitive-word:update']" + @click="handleUpdate(row.id)" + /> + <!-- 操作:详情 --> + <XTextButton + preIcon="ep:view" + :title="t('action.detail')" + v-hasPermi="['system:sensitive-word:update']" + @click="handleDetail(row)" + /> + <!-- 操作:删除 --> + <XTextButton + preIcon="ep:delete" + :title="t('action.del')" + v-hasPermi="['system:sensitive-word:delete']" + @click="delList(row.id, false)" + /> + </template> + </Table> + </ContentWrap> + + <XModal v-model="dialogVisible" :title="dialogTitle"> + <!-- 对话框(添加 / 修改) --> + <Form + v-if="['create', 'update'].includes(actionType)" + :schema="allSchemas.formSchema" + :rules="rules" + ref="formRef" + > + <template #tags> + <el-select v-model="tags" multiple placeholder="请选择"> + <el-option v-for="item in tagsOptions" :key="item" :label="item" :value="item" /> + </el-select> + </template> + </Form> + <!-- 对话框(详情) --> + <Descriptions + v-if="actionType === 'detail'" + :schema="allSchemas.detailSchema" + :data="detailRef" + /> + <!-- 操作按钮 --> + <template #footer> + <!-- 按钮:保存 --> + <XButton + v-if="['create', 'update'].includes(actionType)" + type="primary" + :title="t('action.save')" + :loading="actionLoading" + @click="submitForm()" + /> + <!-- 按钮:关闭 --> + <XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" /> + </template> + </XModal> +</template> <script setup lang="ts"> import { onMounted, ref, unref } from 'vue' import dayjs from 'dayjs' @@ -45,10 +158,10 @@ const handleCreate = () => { } // 修改操作 -const handleUpdate = async (row: SensitiveWordVO) => { +const handleUpdate = async (rowId: number) => { setDialogTile('update') // 设置数据 - const res = await SensitiveWordApi.getSensitiveWordApi(row.id) + const res = await SensitiveWordApi.getSensitiveWordApi(rowId) unref(formRef)?.setValues(res) } @@ -95,116 +208,3 @@ onMounted(async () => { await getList() }) </script> - -<template> - <!-- 搜索工作区 --> - <ContentWrap> - <Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> - </ContentWrap> - <ContentWrap> - <!-- 操作工具栏 --> - <div class="mb-10px"> - <el-button type="primary" v-hasPermi="['system:post:create']" @click="handleCreate"> - <Icon icon="ep:zoom-in" class="mr-5px" /> {{ t('action.add') }} - </el-button> - <el-button - type="warning" - v-hasPermi="['system:post:export']" - :loading="tableObject.exportLoading" - @click="exportList('敏感词数据.xls')" - > - <Icon icon="ep:download" class="mr-5px" /> {{ t('action.export') }} - </el-button> - </div> - <!-- 列表 --> - <Table - :columns="allSchemas.tableColumns" - :selection="false" - :data="tableObject.tableList" - :loading="tableObject.loading" - :pagination="{ - total: tableObject.total - }" - v-model:pageSize="tableObject.pageSize" - v-model:currentPage="tableObject.currentPage" - @register="register" - > - <template #tags="{ row }"> - <el-tag - :disable-transitions="true" - :key="index" - v-for="(tag, index) in row.tags" - :index="index" - > - {{ tag }} - </el-tag> - </template> - <template #status="{ row }"> - <DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" /> - </template> - <template #createTime="{ row }"> - <span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span> - </template> - <template #action="{ row }"> - <el-button - link - type="primary" - v-hasPermi="['system:post:update']" - @click="handleUpdate(row)" - > - <Icon icon="ep:edit" class="mr-1px" /> {{ t('action.edit') }} - </el-button> - <el-button - link - type="primary" - v-hasPermi="['system:post:update']" - @click="handleDetail(row)" - > - <Icon icon="ep:view" class="mr-1px" /> {{ t('action.detail') }} - </el-button> - <el-button - link - type="primary" - v-hasPermi="['system:post:delete']" - @click="delList(row.id, false)" - > - <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} - </el-button> - </template> - </Table> - </ContentWrap> - - <XModal v-model="dialogVisible" :title="dialogTitle"> - <!-- 对话框(添加 / 修改) --> - <Form - v-if="['create', 'update'].includes(actionType)" - :schema="allSchemas.formSchema" - :rules="rules" - ref="formRef" - > - <template #tags> - <el-select v-model="tags" multiple placeholder="请选择"> - <el-option v-for="item in tagsOptions" :key="item" :label="item" :value="item" /> - </el-select> - </template> - </Form> - <!-- 对话框(详情) --> - <Descriptions - v-if="actionType === 'detail'" - :schema="allSchemas.detailSchema" - :data="detailRef" - /> - <!-- 操作按钮 --> - <template #footer> - <el-button - v-if="['create', 'update'].includes(actionType)" - type="primary" - :loading="actionLoading" - @click="submitForm" - > - {{ t('action.save') }} - </el-button> - <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button> - </template> - </XModal> -</template> diff --git a/yudao-ui-admin-vue3/src/views/system/sms/smsChannel/index.vue b/yudao-ui-admin-vue3/src/views/system/sms/smsChannel/index.vue index 42dd723bf..1b3d9c0dd 100644 --- a/yudao-ui-admin-vue3/src/views/system/sms/smsChannel/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/sms/smsChannel/index.vue @@ -1,3 +1,97 @@ +<template> + <!-- 搜索工作区 --> + <ContentWrap> + <Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> + </ContentWrap> + <ContentWrap> + <!-- 操作工具栏 --> + <div class="mb-10px"> + <XButton + type="primary" + preIcon="ep:zoom-in" + :title="t('action.add')" + v-hasPermi="['system:sms-channel:create']" + @click="handleCreate()" + /> + </div> + <!-- 列表 --> + <Table + :columns="allSchemas.tableColumns" + :selection="false" + :data="tableObject.tableList" + :loading="tableObject.loading" + :pagination="{ + total: tableObject.total + }" + v-model:pageSize="tableObject.pageSize" + v-model:currentPage="tableObject.currentPage" + @register="register" + > + <template #code="{ row }"> + <DictTag :type="DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE" :value="row.code" /> + </template> + <template #status="{ row }"> + <DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" /> + </template> + <template #createTime="{ row }"> + <span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span> + </template> + <template #action="{ row }"> + <!-- 操作:修改 --> + <XTextButton + preIcon="ep:edit" + :title="t('action.edit')" + v-hasPermi="['system:sms-channel:update']" + @click="handleUpdate(row.id)" + /> + <!-- 操作:详情 --> + <XTextButton + preIcon="ep:view" + :title="t('action.detail')" + v-hasPermi="['system:sms-channel:update']" + @click="handleDetail(row)" + /> + <!-- 操作:删除 --> + <XTextButton + preIcon="ep:delete" + :title="t('action.del')" + v-hasPermi="['system:sms-channel:delete']" + @click="delList(row.id, false)" + /> + </template> + </Table> + </ContentWrap> + + <XModal v-model="dialogVisible" :title="dialogTitle"> + <!-- 对话框(添加 / 修改) --> + <Form + v-if="['create', 'update'].includes(actionType)" + :schema="allSchemas.formSchema" + :rules="rules" + ref="formRef" + /> + <!-- 对话框(详情) --> + <Descriptions + v-if="actionType === 'detail'" + :schema="allSchemas.detailSchema" + :data="detailRef" + /> + <!-- 操作按钮 --> + <template #footer> + <!-- 按钮:保存 --> + <XButton + v-if="['create', 'update'].includes(actionType)" + type="primary" + :title="t('action.save')" + :loading="loading" + @click="submitForm()" + /> + <!-- 按钮:关闭 --> + <XButton :loading="loading" :title="t('dialog.close')" @click="dialogVisible = false" /> + </template> + </XModal> +</template> + <script setup lang="ts"> import { ref, unref } from 'vue' import dayjs from 'dayjs' @@ -38,10 +132,10 @@ const handleCreate = () => { } // 修改操作 -const handleUpdate = async (row: SmsChannelVO) => { +const handleUpdate = async (rowId: number) => { setDialogTile('update') // 设置数据 - const res = await SmsChannelApi.getSmsChannelApi(row.id) + const res = await SmsChannelApi.getSmsChannelApi(rowId) unref(formRef)?.setValues(res) } @@ -85,95 +179,3 @@ const handleDetail = async (row: SmsChannelVO) => { // ========== 初始化 ========== getList() </script> - -<template> - <!-- 搜索工作区 --> - <ContentWrap> - <Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> - </ContentWrap> - <ContentWrap> - <!-- 操作工具栏 --> - <div class="mb-10px"> - <el-button type="primary" v-hasPermi="['system:sms-channel:create']" @click="handleCreate"> - <Icon icon="ep:zoom-in" class="mr-5px" /> {{ t('action.add') }} - </el-button> - </div> - <!-- 列表 --> - <Table - :columns="allSchemas.tableColumns" - :selection="false" - :data="tableObject.tableList" - :loading="tableObject.loading" - :pagination="{ - total: tableObject.total - }" - v-model:pageSize="tableObject.pageSize" - v-model:currentPage="tableObject.currentPage" - @register="register" - > - <template #code="{ row }"> - <DictTag :type="DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE" :value="row.code" /> - </template> - <template #status="{ row }"> - <DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" /> - </template> - <template #createTime="{ row }"> - <span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span> - </template> - <template #action="{ row }"> - <el-button - link - type="primary" - v-hasPermi="['system:sms-channel:update']" - @click="handleUpdate(row)" - > - <Icon icon="ep:edit" class="mr-1px" /> {{ t('action.edit') }} - </el-button> - <el-button - link - type="primary" - v-hasPermi="['system:sms-channel:update']" - @click="handleDetail(row)" - > - <Icon icon="ep:view" class="mr-1px" /> {{ t('action.detail') }} - </el-button> - <el-button - link - type="primary" - v-hasPermi="['system:sms-channel:delete']" - @click="delList(row.id, false)" - > - <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} - </el-button> - </template> - </Table> - </ContentWrap> - - <XModal v-model="dialogVisible" :title="dialogTitle"> - <!-- 对话框(添加 / 修改) --> - <Form - v-if="['create', 'update'].includes(actionType)" - :schema="allSchemas.formSchema" - :rules="rules" - ref="formRef" - /> - <!-- 对话框(详情) --> - <Descriptions - v-if="actionType === 'detail'" - :schema="allSchemas.detailSchema" - :data="detailRef" - /> - <!-- 操作按钮 --> - <template #footer> - <el-button - v-if="['create', 'update'].includes(actionType)" - type="primary" - :loading="loading" - @click="submitForm" - > - {{ t('action.save') }} - </el-button> - <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button> - </template> - </XModal> -</template> diff --git a/yudao-ui-admin-vue3/src/views/system/sms/smsLog/index.vue b/yudao-ui-admin-vue3/src/views/system/sms/smsLog/index.vue index aadf84972..26e3654d5 100644 --- a/yudao-ui-admin-vue3/src/views/system/sms/smsLog/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/sms/smsLog/index.vue @@ -1,35 +1,3 @@ -<script setup lang="ts"> -import { ref } from 'vue' -import dayjs from 'dayjs' -import { DICT_TYPE } from '@/utils/dict' -import { useTable } from '@/hooks/web/useTable' -import { useI18n } from '@/hooks/web/useI18n' -import type { SmsLogVO } from '@/api/system/sms/smsLog/types' -import { allSchemas } from './sms.log.data' -import * as SmsLoglApi from '@/api/system/sms/smsLog' -const { t } = useI18n() // 国际化 - -// ========== 列表相关 ========== -const { register, tableObject, methods } = useTable<SmsLogVO>({ - getListApi: SmsLoglApi.getSmsLogPageApi -}) -const { getList, setSearchParams } = methods - -// ========== CRUD 相关 ========== -const actionType = ref('') // 操作按钮的类型 -const dialogVisible = ref(false) // 是否显示弹出层 -const dialogTitle = ref(t('action.detail')) // 弹出层标题 -// ========== 详情相关 ========== -const detailRef = ref() // 详情 Ref -const handleDetail = (row: SmsLogVO) => { - // 设置数据 - detailRef.value = row - dialogVisible.value = true -} -// ========== 初始化 ========== -getList() -</script> - <template> <!-- 搜索工作区 --> <ContentWrap> @@ -62,14 +30,7 @@ getList() <span>{{ dayjs(row.receiveTime).format('YYYY-MM-DD HH:mm:ss') }}</span> </template> <template #action="{ row }"> - <el-button - link - type="primary" - v-hasPermi="['system:sms-channel:update']" - @click="handleDetail(row)" - > - <Icon icon="ep:view" class="mr-1px" /> {{ t('action.detail') }} - </el-button> + <XTextButton preIcon="ep:view" :title="t('action.detail')" @click="handleDetail(row)" /> </template> </Table> </ContentWrap> @@ -83,7 +44,39 @@ getList() /> <!-- 操作按钮 --> <template #footer> - <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button> + <XButton :title="t('dialog.close')" @click="dialogVisible = false" /> </template> </XModal> </template> + +<script setup lang="ts"> +import { ref } from 'vue' +import dayjs from 'dayjs' +import { DICT_TYPE } from '@/utils/dict' +import { useTable } from '@/hooks/web/useTable' +import { useI18n } from '@/hooks/web/useI18n' +import type { SmsLogVO } from '@/api/system/sms/smsLog/types' +import { allSchemas } from './sms.log.data' +import * as SmsLoglApi from '@/api/system/sms/smsLog' +const { t } = useI18n() // 国际化 + +// ========== 列表相关 ========== +const { register, tableObject, methods } = useTable<SmsLogVO>({ + getListApi: SmsLoglApi.getSmsLogPageApi +}) +const { getList, setSearchParams } = methods + +// ========== CRUD 相关 ========== +const actionType = ref('') // 操作按钮的类型 +const dialogVisible = ref(false) // 是否显示弹出层 +const dialogTitle = ref(t('action.detail')) // 弹出层标题 +// ========== 详情相关 ========== +const detailRef = ref() // 详情 Ref +const handleDetail = (row: SmsLogVO) => { + // 设置数据 + detailRef.value = row + dialogVisible.value = true +} +// ========== 初始化 ========== +getList() +</script> diff --git a/yudao-ui-admin-vue3/src/views/system/sms/smsTemplate/index.vue b/yudao-ui-admin-vue3/src/views/system/sms/smsTemplate/index.vue index 61b7ec37d..d1417e255 100644 --- a/yudao-ui-admin-vue3/src/views/system/sms/smsTemplate/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/sms/smsTemplate/index.vue @@ -1,3 +1,130 @@ +<template> + <!-- 搜索工作区 --> + <ContentWrap> + <Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> + </ContentWrap> + <ContentWrap> + <!-- 操作工具栏 --> + <div class="mb-10px"> + <el-button type="primary" v-hasPermi="['system:sms-channel:create']" @click="handleCreate"> + <Icon icon="ep:zoom-in" class="mr-5px" /> {{ t('action.add') }} + </el-button> + </div> + <!-- 列表 --> + <Table + :columns="allSchemas.tableColumns" + :selection="false" + :data="tableObject.tableList" + :loading="tableObject.loading" + :pagination="{ + total: tableObject.total + }" + v-model:pageSize="tableObject.pageSize" + v-model:currentPage="tableObject.currentPage" + @register="register" + > + <template #type="{ row }"> + <DictTag :type="DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE" :value="row.type" /> + </template> + <template #status="{ row }"> + <DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" /> + </template> + <template #createTime="{ row }"> + <span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span> + </template> + <template #action="{ row }"> + <XTextButton + preIcon="ep:cpu" + :title="t('action.test')" + v-hasPermi="['system:sms-template:send-sms']" + @click="handleSendSms(row)" + /> + <!-- 操作:修改 --> + <XTextButton + preIcon="ep:edit" + :title="t('action.edit')" + v-hasPermi="['system:sms-template:update']" + @click="handleUpdate(row.id)" + /> + <!-- 操作:详情 --> + <XTextButton + preIcon="ep:view" + :title="t('action.detail')" + v-hasPermi="['system:sms-template:update']" + @click="handleDetail(row)" + /> + <!-- 操作:删除 --> + <XTextButton + preIcon="ep:delete" + :title="t('action.del')" + v-hasPermi="['system:sms-template:delete']" + @click="delList(row.id, false)" + /> + </template> + </Table> + </ContentWrap> + + <XModal v-model="dialogVisible" :title="dialogTitle"> + <!-- 对话框(添加 / 修改) --> + <Form + v-if="['create', 'update'].includes(actionType)" + :schema="allSchemas.formSchema" + :rules="rules" + ref="formRef" + /> + <!-- 对话框(详情) --> + <Descriptions + v-if="actionType === 'detail'" + :schema="allSchemas.detailSchema" + :data="detailRef" + /> + <!-- 操作按钮 --> + <template #footer> + <!-- 按钮:保存 --> + <XButton + v-if="['create', 'update'].includes(actionType)" + type="primary" + :title="t('action.save')" + :loading="loading" + @click="submitForm()" + /> + <!-- 按钮:关闭 --> + <XButton :loading="loading" :title="t('dialog.close')" @click="dialogVisible = false" /> + </template> + </XModal> + <XModal v-model="sendVisible" title="测试"> + <el-form :model="sendSmsForm" :rules="sendSmsRules" label-width="140px"> + <el-form-item label="模板内容" prop="content"> + <el-input + v-model="sendSmsForm.content" + type="textarea" + placeholder="请输入模板内容" + readonly + /> + </el-form-item> + <el-form-item label="手机号" prop="mobile"> + <el-input v-model="sendSmsForm.mobile" placeholder="请输入手机号" /> + </el-form-item> + <el-form-item + v-for="param in sendSmsForm.params" + :key="param" + :label="'参数 {' + param + '}'" + :prop="'templateParams.' + param" + > + <el-input + v-model="sendSmsForm.templateParams[param]" + :placeholder="'请输入 ' + param + ' 参数'" + /> + </el-form-item> + </el-form> + <!-- 操作按钮 --> + <template #footer> + <XButton type="primary" :title="t('action.test')" :loading="loading" @click="sendSmsTest()" /> + <XButton :title="t('dialog.close')" @click="dialogVisible = false" /> + </template> + </XModal> +</template> + <script setup lang="ts"> import { ref, unref } from 'vue' import dayjs from 'dayjs' @@ -38,10 +165,10 @@ const handleCreate = () => { } // 修改操作 -const handleUpdate = async (row: SmsTemplateVO) => { +const handleUpdate = async (rowId: number) => { setDialogTile('update') // 设置数据 - const res = await SmsTemplateApi.getSmsTemplateApi(row.id) + const res = await SmsTemplateApi.getSmsTemplateApi(rowId) unref(formRef)?.setValues(res) } @@ -125,136 +252,3 @@ const sendSmsTest = () => { // ========== 初始化 ========== getList() </script> - -<template> - <!-- 搜索工作区 --> - <ContentWrap> - <Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> - </ContentWrap> - <ContentWrap> - <!-- 操作工具栏 --> - <div class="mb-10px"> - <el-button type="primary" v-hasPermi="['system:sms-channel:create']" @click="handleCreate"> - <Icon icon="ep:zoom-in" class="mr-5px" /> {{ t('action.add') }} - </el-button> - </div> - <!-- 列表 --> - <Table - :columns="allSchemas.tableColumns" - :selection="false" - :data="tableObject.tableList" - :loading="tableObject.loading" - :pagination="{ - total: tableObject.total - }" - v-model:pageSize="tableObject.pageSize" - v-model:currentPage="tableObject.currentPage" - @register="register" - > - <template #type="{ row }"> - <DictTag :type="DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE" :value="row.type" /> - </template> - <template #status="{ row }"> - <DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" /> - </template> - <template #createTime="{ row }"> - <span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span> - </template> - <template #action="{ row }"> - <el-button - link - type="primary" - v-hasPermi="['system:sms-template:send-sms']" - @click="handleSendSms(row)" - > - <Icon icon="ep:cpu" class="mr-1px" /> {{ t('action.test') }} - </el-button> - <el-button - link - type="primary" - v-hasPermi="['system:sms-template:update']" - @click="handleUpdate(row)" - > - <Icon icon="ep:edit" class="mr-1px" /> {{ t('action.edit') }} - </el-button> - <el-button - link - type="primary" - v-hasPermi="['system:sms-template:update']" - @click="handleDetail(row)" - > - <Icon icon="ep:view" class="mr-1px" /> {{ t('action.detail') }} - </el-button> - <el-button - link - type="primary" - v-hasPermi="['system:sms-template:delete']" - @click="delList(row.id, false)" - > - <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} - </el-button> - </template> - </Table> - </ContentWrap> - - <XModal v-model="dialogVisible" :title="dialogTitle"> - <!-- 对话框(添加 / 修改) --> - <Form - v-if="['create', 'update'].includes(actionType)" - :schema="allSchemas.formSchema" - :rules="rules" - ref="formRef" - /> - <!-- 对话框(详情) --> - <Descriptions - v-if="actionType === 'detail'" - :schema="allSchemas.detailSchema" - :data="detailRef" - /> - <!-- 操作按钮 --> - <template #footer> - <el-button - v-if="['create', 'update'].includes(actionType)" - type="primary" - :loading="loading" - @click="submitForm" - > - {{ t('action.save') }} - </el-button> - <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button> - </template> - </XModal> - <XModal v-model="sendVisible" title="测试"> - <el-form :model="sendSmsForm" :rules="sendSmsRules" label-width="140px"> - <el-form-item label="模板内容" prop="content"> - <el-input - v-model="sendSmsForm.content" - type="textarea" - placeholder="请输入模板内容" - readonly - /> - </el-form-item> - <el-form-item label="手机号" prop="mobile"> - <el-input v-model="sendSmsForm.mobile" placeholder="请输入手机号" /> - </el-form-item> - <el-form-item - v-for="param in sendSmsForm.params" - :key="param" - :label="'参数 {' + param + '}'" - :prop="'templateParams.' + param" - > - <el-input - v-model="sendSmsForm.templateParams[param]" - :placeholder="'请输入 ' + param + ' 参数'" - /> - </el-form-item> - </el-form> - <!-- 操作按钮 --> - <template #footer> - <el-button type="primary" :loading="loading" @click="sendSmsTest"> - {{ t('action.test') }} - </el-button> - <el-button @click="sendVisible = false">{{ t('dialog.close') }}</el-button> - </template> - </XModal> -</template> diff --git a/yudao-ui-admin-vue3/src/views/system/tenant/index.vue b/yudao-ui-admin-vue3/src/views/system/tenant/index.vue index 4f3032ab3..7cc758727 100644 --- a/yudao-ui-admin-vue3/src/views/system/tenant/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/tenant/index.vue @@ -1,3 +1,126 @@ +<template> + <!-- 搜索工作区 --> + <ContentWrap> + <Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> + </ContentWrap> + <ContentWrap> + <!-- 操作工具栏 --> + <div class="mb-10px"> + <XButton + type="primary" + preIcon="ep:zoom-in" + :title="t('action.add')" + v-hasPermi="['system:tenant:create']" + @click="handleCreate()" + /> + <XButton + type="warning" + preIcon="ep:download" + :title="t('action.export')" + v-hasPermi="['system:tenant:export']" + @click="exportList('租户数据.xls')" + /> + </div> + <!-- 列表 --> + <Table + :columns="allSchemas.tableColumns" + :selection="false" + :data="tableObject.tableList" + :loading="tableObject.loading" + :pagination="{ + total: tableObject.total + }" + v-model:pageSize="tableObject.pageSize" + v-model:currentPage="tableObject.currentPage" + @register="register" + > + <template #accountCount="{ row }"> + <el-tag> {{ row.accountCount }} </el-tag> + </template> + <template #status="{ row }"> + <DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" /> + </template> + <template #packageId="{ row }"> + <el-tag v-if="row.packageId === 0" type="danger">系统租户</el-tag> + <el-tag v-else type="success"> {{ getPackageName(row.packageId) }} </el-tag> + </template> + <template #expireTime="{ row }"> + <span>{{ dayjs(row.expireTime).format('YYYY-MM-DD HH:mm:ss') }}</span> + </template> + <template #createTime="{ row }"> + <span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span> + </template> + <template #action="{ row }"> + <!-- 操作:修改 --> + <XTextButton + preIcon="ep:edit" + :title="t('action.edit')" + v-hasPermi="['system:tenant:update']" + @click="handleUpdate(row)" + /> + <!-- 操作:详情 --> + <XTextButton + preIcon="ep:view" + :title="t('action.detail')" + v-hasPermi="['system:tenant:update']" + @click="handleDetail(row)" + /> + <!-- 操作:删除 --> + <XTextButton + preIcon="ep:delete" + :title="t('action.del')" + v-hasPermi="['system:tenant:delete']" + @click="delList(row.id, false)" + /> + </template> + </Table> + </ContentWrap> + + <XModal v-model="dialogVisible" :title="dialogTitle"> + <!-- 对话框(添加 / 修改) --> + <Form + v-if="['create', 'update'].includes(actionType)" + :schema="allSchemas.formSchema" + :rules="rules" + ref="formRef" + > + <template #packageId> + <el-select v-model="tenantPackageId"> + <el-option + v-for="item in tenantPackageOptions" + :key="item.id" + :label="item.name" + :value="item.id" + /> + </el-select> + </template> + </Form> + <!-- 对话框(详情) --> + <Descriptions + v-if="actionType === 'detail'" + :schema="allSchemas.detailSchema" + :data="detailRef" + > + <template #packageId="{ row }"> + <el-tag v-if="row.packageId === 0" type="danger">系统租户</el-tag> + <el-tag v-else type="success"> {{ getPackageName(row.packageId) }} </el-tag> + </template> + </Descriptions> + <!-- 操作按钮 --> + <template #footer> + <!-- 按钮:保存 --> + <XButton + v-if="['create', 'update'].includes(actionType)" + type="primary" + :title="t('action.save')" + :loading="actionLoading" + @click="submitForm()" + /> + <!-- 按钮:关闭 --> + <XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" /> + </template> + </XModal> +</template> <script setup lang="ts"> import { ref, unref, onMounted } from 'vue' import dayjs from 'dayjs' @@ -114,126 +237,3 @@ onMounted(async () => { await getTenantPackageOptions() }) </script> - -<template> - <!-- 搜索工作区 --> - <ContentWrap> - <Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> - </ContentWrap> - <ContentWrap> - <!-- 操作工具栏 --> - <div class="mb-10px"> - <el-button type="primary" v-hasPermi="['system:tenant:create']" @click="handleCreate"> - <Icon icon="ep:zoom-in" class="mr-5px" /> {{ t('action.add') }} - </el-button> - <el-button - type="warning" - v-hasPermi="['system:tenant:export']" - :loading="tableObject.exportLoading" - @click="exportList('租户数据.xls')" - > - <Icon icon="ep:download" class="mr-5px" /> {{ t('action.export') }} - </el-button> - </div> - <!-- 列表 --> - <Table - :columns="allSchemas.tableColumns" - :selection="false" - :data="tableObject.tableList" - :loading="tableObject.loading" - :pagination="{ - total: tableObject.total - }" - v-model:pageSize="tableObject.pageSize" - v-model:currentPage="tableObject.currentPage" - @register="register" - > - <template #accountCount="{ row }"> - <el-tag> {{ row.accountCount }} </el-tag> - </template> - <template #status="{ row }"> - <DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" /> - </template> - <template #packageId="{ row }"> - <el-tag v-if="row.packageId === 0" type="danger">系统租户</el-tag> - <el-tag v-else type="success"> {{ getPackageName(row.packageId) }} </el-tag> - </template> - <template #expireTime="{ row }"> - <span>{{ dayjs(row.expireTime).format('YYYY-MM-DD HH:mm:ss') }}</span> - </template> - <template #createTime="{ row }"> - <span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span> - </template> - <template #action="{ row }"> - <el-button - link - type="primary" - v-hasPermi="['system:tenant:update']" - @click="handleUpdate(row)" - > - <Icon icon="ep:edit" class="mr-1px" /> {{ t('action.edit') }} - </el-button> - <el-button - link - type="primary" - v-hasPermi="['system:tenant:update']" - @click="handleDetail(row)" - > - <Icon icon="ep:view" class="mr-1px" /> {{ t('action.detail') }} - </el-button> - <el-button - link - type="primary" - v-hasPermi="['system:tenant:delete']" - @click="delList(row.id, false)" - > - <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} - </el-button> - </template> - </Table> - </ContentWrap> - - <XModal v-model="dialogVisible" :title="dialogTitle"> - <!-- 对话框(添加 / 修改) --> - <Form - v-if="['create', 'update'].includes(actionType)" - :schema="allSchemas.formSchema" - :rules="rules" - ref="formRef" - > - <template #packageId> - <el-select v-model="tenantPackageId"> - <el-option - v-for="item in tenantPackageOptions" - :key="item.id" - :label="item.name" - :value="item.id" - /> - </el-select> - </template> - </Form> - <!-- 对话框(详情) --> - <Descriptions - v-if="actionType === 'detail'" - :schema="allSchemas.detailSchema" - :data="detailRef" - > - <template #packageId="{ row }"> - <el-tag v-if="row.packageId === 0" type="danger">系统租户</el-tag> - <el-tag v-else type="success"> {{ getPackageName(row.packageId) }} </el-tag> - </template> - </Descriptions> - <!-- 操作按钮 --> - <template #footer> - <el-button - v-if="['create', 'update'].includes(actionType)" - type="primary" - :loading="actionLoading" - @click="submitForm" - > - {{ t('action.save') }} - </el-button> - <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button> - </template> - </XModal> -</template> diff --git a/yudao-ui-admin-vue3/src/views/system/tenantPackage/index.vue b/yudao-ui-admin-vue3/src/views/system/tenantPackage/index.vue index 63b2eddf3..147f06197 100644 --- a/yudao-ui-admin-vue3/src/views/system/tenantPackage/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/tenantPackage/index.vue @@ -185,15 +185,16 @@ onMounted(async () => { </Form> <!-- 操作按钮 --> <template #footer> - <el-button + <!-- 按钮:保存 --> + <XButton v-if="['create', 'update'].includes(actionType)" type="primary" + :title="t('action.save')" :loading="loading" - @click="submitForm" - > - {{ t('action.save') }} - </el-button> - <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button> + @click="submitForm()" + /> + <!-- 按钮:关闭 --> + <XButton :loading="loading" :title="t('dialog.close')" @click="dialogVisible = false" /> </template> </XModal> </template> diff --git a/yudao-ui-admin-vue3/src/views/system/user/index.vue b/yudao-ui-admin-vue3/src/views/system/user/index.vue index f51de1184..b22bb4cb1 100644 --- a/yudao-ui-admin-vue3/src/views/system/user/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/user/index.vue @@ -459,15 +459,16 @@ onMounted(async () => { </Descriptions> <!-- 操作按钮 --> <template #footer> - <el-button + <!-- 按钮:保存 --> + <XButton v-if="['create', 'update'].includes(actionType)" type="primary" + :title="t('action.save')" :loading="loading" - @click="submitForm" - > - {{ t('action.save') }} - </el-button> - <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button> + @click="submitForm()" + /> + <!-- 按钮:关闭 --> + <XButton :loading="loading" :title="t('dialog.close')" @click="dialogVisible = false" /> </template> </XModal> <!-- 分配用户角色 -->