feat: add message hook
parent
0cb6dd585b
commit
1179ca1a8a
|
@ -0,0 +1,71 @@
|
||||||
|
import { ElMessage, ElMessageBox, ElNotification } from 'element-plus'
|
||||||
|
import { useI18n } from './useI18n'
|
||||||
|
export const useMessage = () => {
|
||||||
|
const { t } = useI18n()
|
||||||
|
return {
|
||||||
|
// 消息提示
|
||||||
|
info(content: string) {
|
||||||
|
ElMessage.info(content)
|
||||||
|
},
|
||||||
|
// 错误消息
|
||||||
|
error(content: string) {
|
||||||
|
ElMessage.error(content)
|
||||||
|
},
|
||||||
|
// 成功消息
|
||||||
|
success(content: string) {
|
||||||
|
ElMessage.success(content)
|
||||||
|
},
|
||||||
|
// 警告消息
|
||||||
|
warning(content: string) {
|
||||||
|
ElMessage.warning(content)
|
||||||
|
},
|
||||||
|
// 弹出提示
|
||||||
|
alert(content: string) {
|
||||||
|
ElMessageBox.alert(content, t('common.confirmTitle'))
|
||||||
|
},
|
||||||
|
// 错误提示
|
||||||
|
alertError(content: string) {
|
||||||
|
ElMessageBox.alert(content, t('common.confirmTitle'), { type: 'error' })
|
||||||
|
},
|
||||||
|
// 成功提示
|
||||||
|
alertSuccess(content: string) {
|
||||||
|
ElMessageBox.alert(content, t('common.confirmTitle'), { type: 'success' })
|
||||||
|
},
|
||||||
|
// 警告提示
|
||||||
|
alertWarning(content: string) {
|
||||||
|
ElMessageBox.alert(content, t('common.confirmTitle'), { type: 'warning' })
|
||||||
|
},
|
||||||
|
// 通知提示
|
||||||
|
notify(content: string) {
|
||||||
|
ElNotification.info(content)
|
||||||
|
},
|
||||||
|
// 错误通知
|
||||||
|
notifyError(content: string) {
|
||||||
|
ElNotification.error(content)
|
||||||
|
},
|
||||||
|
// 成功通知
|
||||||
|
notifySuccess(content: string) {
|
||||||
|
ElNotification.success(content)
|
||||||
|
},
|
||||||
|
// 警告通知
|
||||||
|
notifyWarning(content: string) {
|
||||||
|
ElNotification.warning(content)
|
||||||
|
},
|
||||||
|
// 确认窗体
|
||||||
|
confirm(content: string, tip: string) {
|
||||||
|
return ElMessageBox.confirm(content, tip, {
|
||||||
|
confirmButtonText: t('common.ok'),
|
||||||
|
cancelButtonText: t('common.cancel'),
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 提交内容
|
||||||
|
prompt(content: string, tip: string) {
|
||||||
|
return ElMessageBox.prompt(content, tip, {
|
||||||
|
confirmButtonText: t('common.ok'),
|
||||||
|
cancelButtonText: t('common.cancel'),
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,7 +8,8 @@ import type { ApiErrorLogVO } from '@/api/infra/apiErrorLog/types'
|
||||||
import { allSchemas } from './apiErrorLog.data'
|
import { allSchemas } from './apiErrorLog.data'
|
||||||
import * as ApiErrorLogApi from '@/api/infra/apiErrorLog'
|
import * as ApiErrorLogApi from '@/api/infra/apiErrorLog'
|
||||||
import { InfraApiErrorLogProcessStatusEnum } from '@/utils/constants'
|
import { InfraApiErrorLogProcessStatusEnum } from '@/utils/constants'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
|
const message = useMessage()
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
|
|
||||||
// ========== 列表相关 ==========
|
// ========== 列表相关 ==========
|
||||||
|
@ -36,14 +37,11 @@ const handleDetail = (row: ApiErrorLogVO) => {
|
||||||
}
|
}
|
||||||
// 异常处理操作
|
// 异常处理操作
|
||||||
const handleProcessClick = (row: ApiErrorLogVO, processSttatus: number, type: string) => {
|
const handleProcessClick = (row: ApiErrorLogVO, processSttatus: number, type: string) => {
|
||||||
ElMessageBox.confirm('确认标记为' + type + '?', t('common.reminder'), {
|
message
|
||||||
confirmButtonText: t('common.ok'),
|
.confirm('确认标记为' + type + '?', t('common.reminder'))
|
||||||
cancelButtonText: t('common.cancel'),
|
|
||||||
type: 'warning'
|
|
||||||
})
|
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
ApiErrorLogApi.updateApiErrorLogPageApi(row.id, processSttatus).then(() => {
|
ApiErrorLogApi.updateApiErrorLogPageApi(row.id, processSttatus).then(() => {
|
||||||
ElMessage.success(t('common.updateSuccess'))
|
message.success(t('common.updateSuccess'))
|
||||||
getList()
|
getList()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -10,7 +10,8 @@ import ImportTable from './components/ImportTable.vue'
|
||||||
import Preview from './components/Preview.vue'
|
import Preview from './components/Preview.vue'
|
||||||
import download from '@/utils/download'
|
import download from '@/utils/download'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
|
const message = useMessage()
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
const { push } = useRouter()
|
const { push } = useRouter()
|
||||||
// ========== 列表相关 ==========
|
// ========== 列表相关 ==========
|
||||||
|
@ -37,13 +38,11 @@ const handleEditTable = (row: CodegenTableVO) => {
|
||||||
const handleSynchDb = (row: CodegenTableVO) => {
|
const handleSynchDb = (row: CodegenTableVO) => {
|
||||||
// 基于 DB 同步
|
// 基于 DB 同步
|
||||||
const tableName = row.tableName
|
const tableName = row.tableName
|
||||||
ElMessageBox.confirm('确认要强制同步' + tableName + '表结构吗?', t('common.reminder'), {
|
message
|
||||||
confirmButtonText: t('common.ok'),
|
.confirm('确认要强制同步' + tableName + '表结构吗?', t('common.reminder'))
|
||||||
cancelButtonText: t('common.cancel'),
|
.then(async () => {
|
||||||
type: 'warning'
|
|
||||||
}).then(async () => {
|
|
||||||
await CodegenApi.syncCodegenFromDBApi(row.id)
|
await CodegenApi.syncCodegenFromDBApi(row.id)
|
||||||
ElMessage.success('同步成功')
|
message.success('同步成功')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 生成代码操作
|
// 生成代码操作
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, unref } from 'vue'
|
import { ref, unref } from 'vue'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
||||||
import { DICT_TYPE } from '@/utils/dict'
|
import { DICT_TYPE } from '@/utils/dict'
|
||||||
import { useTable } from '@/hooks/web/useTable'
|
import { useTable } from '@/hooks/web/useTable'
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
|
@ -9,6 +8,8 @@ import { FormExpose } from '@/components/Form'
|
||||||
import type { FileConfigVO } from '@/api/infra/fileConfig/types'
|
import type { FileConfigVO } from '@/api/infra/fileConfig/types'
|
||||||
import { rules, allSchemas } from './fileConfig.data'
|
import { rules, allSchemas } from './fileConfig.data'
|
||||||
import * as FileConfigApi from '@/api/infra/fileConfig'
|
import * as FileConfigApi from '@/api/infra/fileConfig'
|
||||||
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
|
const message = useMessage()
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
|
|
||||||
// ========== 列表相关 ==========
|
// ========== 列表相关 ==========
|
||||||
|
@ -49,16 +50,12 @@ const handleUpdate = async (row: FileConfigVO) => {
|
||||||
|
|
||||||
// 主配置操作
|
// 主配置操作
|
||||||
const handleMaster = (row: FileConfigVO) => {
|
const handleMaster = (row: FileConfigVO) => {
|
||||||
ElMessageBox.confirm('是否确认修改配置【 ' + row.name + ' 】为主配置?', t('common.reminder'), {
|
message
|
||||||
confirmButtonText: t('common.ok'),
|
.confirm('是否确认修改配置【 ' + row.name + ' 】为主配置?', t('common.reminder'))
|
||||||
cancelButtonText: t('common.cancel'),
|
|
||||||
type: 'warning'
|
|
||||||
})
|
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
await FileConfigApi.updateFileConfigMasterApi(row.id)
|
await FileConfigApi.updateFileConfigMasterApi(row.id)
|
||||||
await getList()
|
await getList()
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提交按钮
|
// 提交按钮
|
||||||
|
@ -69,10 +66,10 @@ const submitForm = async () => {
|
||||||
const data = unref(formRef)?.formModel as FileConfigVO
|
const data = unref(formRef)?.formModel as FileConfigVO
|
||||||
if (actionType.value === 'create') {
|
if (actionType.value === 'create') {
|
||||||
await FileConfigApi.createFileConfigApi(data)
|
await FileConfigApi.createFileConfigApi(data)
|
||||||
ElMessage.success(t('common.createSuccess'))
|
message.success(t('common.createSuccess'))
|
||||||
} else {
|
} else {
|
||||||
await FileConfigApi.updateFileConfigApi(data)
|
await FileConfigApi.updateFileConfigApi(data)
|
||||||
ElMessage.success(t('common.updateSuccess'))
|
message.success(t('common.updateSuccess'))
|
||||||
}
|
}
|
||||||
// 操作成功,重新加载列表
|
// 操作成功,重新加载列表
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
|
|
|
@ -9,8 +9,9 @@ import { useTable } from '@/hooks/web/useTable'
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import { FormExpose } from '@/components/Form'
|
import { FormExpose } from '@/components/Form'
|
||||||
import { rules, allSchemas } from './job.data'
|
import { rules, allSchemas } from './job.data'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
|
const message = useMessage()
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
const { push } = useRouter()
|
const { push } = useRouter()
|
||||||
// ========== 列表相关 ==========
|
// ========== 列表相关 ==========
|
||||||
|
@ -64,18 +65,11 @@ const handleJobLog = (row: JobVO) => {
|
||||||
}
|
}
|
||||||
// 执行一次
|
// 执行一次
|
||||||
const handleRun = (row: JobVO) => {
|
const handleRun = (row: JobVO) => {
|
||||||
ElMessageBox.confirm('确认要立即执行一次' + row.name + '?', t('common.reminder'), {
|
message.confirm('确认要立即执行一次' + row.name + '?', t('common.reminder')).then(async () => {
|
||||||
confirmButtonText: t('common.ok'),
|
await JobApi.runJobApi(row.id)
|
||||||
cancelButtonText: t('common.cancel'),
|
message.success('执行成功')
|
||||||
type: 'warning'
|
|
||||||
})
|
|
||||||
.then(async () => {
|
|
||||||
JobApi.runJobApi(row.id).then(() => {
|
|
||||||
ElMessage.success('执行成功')
|
|
||||||
getList()
|
getList()
|
||||||
})
|
})
|
||||||
})
|
|
||||||
.catch(() => {})
|
|
||||||
}
|
}
|
||||||
// 提交按钮
|
// 提交按钮
|
||||||
const submitForm = async () => {
|
const submitForm = async () => {
|
||||||
|
@ -85,10 +79,10 @@ const submitForm = async () => {
|
||||||
const data = unref(formRef)?.formModel as JobVO
|
const data = unref(formRef)?.formModel as JobVO
|
||||||
if (actionType.value === 'create') {
|
if (actionType.value === 'create') {
|
||||||
await JobApi.createJobApi(data)
|
await JobApi.createJobApi(data)
|
||||||
ElMessage.success(t('common.createSuccess'))
|
message.success(t('common.createSuccess'))
|
||||||
} else {
|
} else {
|
||||||
await JobApi.updateJobApi(data)
|
await JobApi.updateJobApi(data)
|
||||||
ElMessage.success(t('common.updateSuccess'))
|
message.success(t('common.updateSuccess'))
|
||||||
}
|
}
|
||||||
// 操作成功,重新加载列表
|
// 操作成功,重新加载列表
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import { ElInput, ElCard, ElTree, ElTreeSelect, ElMessage, ElMessageBox } from 'element-plus'
|
import { ElInput, ElCard, ElTree, ElTreeSelect } from 'element-plus'
|
||||||
import { handleTree } from '@/utils/tree'
|
import { handleTree } from '@/utils/tree'
|
||||||
import { onMounted, ref, unref, watch } from 'vue'
|
import { onMounted, ref, unref, watch } from 'vue'
|
||||||
import * as DeptApi from '@/api/system/dept'
|
import * as DeptApi from '@/api/system/dept'
|
||||||
import { Form, FormExpose } from '@/components/Form'
|
import { Form, FormExpose } from '@/components/Form'
|
||||||
import { modelSchema } from './dept.data'
|
import { modelSchema } from './dept.data'
|
||||||
import { DeptVO } from '@/api/system/dept/types'
|
import { DeptVO } from '@/api/system/dept/types'
|
||||||
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
|
const message = useMessage()
|
||||||
interface Tree {
|
interface Tree {
|
||||||
id: number
|
id: number
|
||||||
name: string
|
name: string
|
||||||
|
@ -60,14 +62,11 @@ const handleUpdate = async (data: { id: number }) => {
|
||||||
}
|
}
|
||||||
// 删除
|
// 删除
|
||||||
const handleDelete = async (data: { id: number }) => {
|
const handleDelete = async (data: { id: number }) => {
|
||||||
ElMessageBox.confirm(t('common.delDataMessage'), t('common.confirmTitle'), {
|
message
|
||||||
confirmButtonText: t('common.ok'),
|
.confirm(t('common.delDataMessage'), t('common.confirmTitle'))
|
||||||
cancelButtonText: t('common.cancel'),
|
|
||||||
type: 'warning'
|
|
||||||
})
|
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
await DeptApi.deleteDeptApi(data.id)
|
await DeptApi.deleteDeptApi(data.id)
|
||||||
ElMessage.success(t('common.delSuccess'))
|
message.success(t('common.delSuccess'))
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
await getTree()
|
await getTree()
|
||||||
|
|
|
@ -18,14 +18,14 @@ import {
|
||||||
ElSelect,
|
ElSelect,
|
||||||
ElTreeSelect,
|
ElTreeSelect,
|
||||||
ElOption,
|
ElOption,
|
||||||
ElMessageBox,
|
|
||||||
ElMessage,
|
|
||||||
ElRadioGroup,
|
ElRadioGroup,
|
||||||
ElRadioButton
|
ElRadioButton
|
||||||
} from 'element-plus'
|
} from 'element-plus'
|
||||||
import { MenuVO } from '@/api/system/menu/types'
|
import { MenuVO } from '@/api/system/menu/types'
|
||||||
import { SystemMenuTypeEnum, CommonStatusEnum } from '@/utils/constants'
|
import { SystemMenuTypeEnum, CommonStatusEnum } from '@/utils/constants'
|
||||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||||
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
|
const message = useMessage()
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
// ========== 创建菜单树结构 ==========
|
// ========== 创建菜单树结构 ==========
|
||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
|
@ -111,14 +111,11 @@ const handleUpdate = async (row: MenuVO) => {
|
||||||
}
|
}
|
||||||
// 删除操作
|
// 删除操作
|
||||||
const handleDelete = async (row: MenuVO) => {
|
const handleDelete = async (row: MenuVO) => {
|
||||||
ElMessageBox.confirm(t('common.delDataMessage'), t('common.confirmTitle'), {
|
message
|
||||||
confirmButtonText: t('common.ok'),
|
.confirm(t('common.delDataMessage'), t('common.confirmTitle'))
|
||||||
cancelButtonText: t('common.cancel'),
|
|
||||||
type: 'warning'
|
|
||||||
})
|
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
await MenuApi.deleteMenuApi(row.id)
|
await MenuApi.deleteMenuApi(row.id)
|
||||||
ElMessage.success(t('common.delSuccess'))
|
message.success(t('common.delSuccess'))
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
await getList()
|
await getList()
|
||||||
|
@ -137,20 +134,20 @@ const submitForm = async () => {
|
||||||
) {
|
) {
|
||||||
if (!isExternal(menuForm.value.path)) {
|
if (!isExternal(menuForm.value.path)) {
|
||||||
if (menuForm.value.parentId === 0 && menuForm.value.path.charAt(0) !== '/') {
|
if (menuForm.value.parentId === 0 && menuForm.value.path.charAt(0) !== '/') {
|
||||||
ElMessage.error('路径必须以 / 开头')
|
message.error('路径必须以 / 开头')
|
||||||
return
|
return
|
||||||
} else if (menuForm.value.parentId !== 0 && menuForm.value.path.charAt(0) === '/') {
|
} else if (menuForm.value.parentId !== 0 && menuForm.value.path.charAt(0) === '/') {
|
||||||
ElMessage.error('路径不能以 / 开头')
|
message.error('路径不能以 / 开头')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (actionType.value === 'create') {
|
if (actionType.value === 'create') {
|
||||||
await MenuApi.createMenuApi(menuForm.value)
|
await MenuApi.createMenuApi(menuForm.value)
|
||||||
ElMessage.success(t('common.createSuccess'))
|
message.success(t('common.createSuccess'))
|
||||||
} else {
|
} else {
|
||||||
await MenuApi.updateMenuApi(menuForm.value)
|
await MenuApi.updateMenuApi(menuForm.value)
|
||||||
ElMessage.success(t('common.updateSuccess'))
|
message.success(t('common.updateSuccess'))
|
||||||
}
|
}
|
||||||
// 操作成功,重新加载列表
|
// 操作成功,重新加载列表
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { onMounted, ref, unref, watch } from 'vue'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import {
|
import {
|
||||||
ElInput,
|
ElInput,
|
||||||
ElMessage,
|
|
||||||
ElCard,
|
ElCard,
|
||||||
ElTree,
|
ElTree,
|
||||||
ElTreeSelect,
|
ElTreeSelect,
|
||||||
|
@ -14,7 +13,6 @@ import {
|
||||||
ElUpload,
|
ElUpload,
|
||||||
ElSwitch,
|
ElSwitch,
|
||||||
ElCheckbox,
|
ElCheckbox,
|
||||||
ElMessageBox,
|
|
||||||
UploadInstance,
|
UploadInstance,
|
||||||
UploadRawFile
|
UploadRawFile
|
||||||
} from 'element-plus'
|
} from 'element-plus'
|
||||||
|
@ -32,6 +30,8 @@ import * as UserApi from '@/api/system/user'
|
||||||
import download from '@/utils/download'
|
import download from '@/utils/download'
|
||||||
import { CommonStatusEnum } from '@/utils/constants'
|
import { CommonStatusEnum } from '@/utils/constants'
|
||||||
import { getAccessToken, getTenantId } from '@/utils/auth'
|
import { getAccessToken, getTenantId } from '@/utils/auth'
|
||||||
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
|
const message = useMessage()
|
||||||
interface Tree {
|
interface Tree {
|
||||||
id: number
|
id: number
|
||||||
name: string
|
name: string
|
||||||
|
@ -127,10 +127,10 @@ const submitForm = async () => {
|
||||||
data.postIds = postIds.value
|
data.postIds = postIds.value
|
||||||
if (actionType.value === 'create') {
|
if (actionType.value === 'create') {
|
||||||
await UserApi.createUserApi(data)
|
await UserApi.createUserApi(data)
|
||||||
ElMessage.success(t('common.createSuccess'))
|
message.success(t('common.createSuccess'))
|
||||||
} else {
|
} else {
|
||||||
await UserApi.updateUserApi(data)
|
await UserApi.updateUserApi(data)
|
||||||
ElMessage.success(t('common.updateSuccess'))
|
message.success(t('common.updateSuccess'))
|
||||||
}
|
}
|
||||||
// 操作成功,重新加载列表
|
// 操作成功,重新加载列表
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
|
@ -142,16 +142,13 @@ const submitForm = async () => {
|
||||||
// 改变用户状态操作
|
// 改变用户状态操作
|
||||||
const handleStatusChange = async (row: UserVO) => {
|
const handleStatusChange = async (row: UserVO) => {
|
||||||
const text = row.status === CommonStatusEnum.ENABLE ? '启用' : '停用'
|
const text = row.status === CommonStatusEnum.ENABLE ? '启用' : '停用'
|
||||||
ElMessageBox.confirm('确认要"' + text + '""' + row.username + '"用户吗?', t('common.reminder'), {
|
message
|
||||||
confirmButtonText: t('common.ok'),
|
.confirm('确认要"' + text + '""' + row.username + '"用户吗?', t('common.reminder'))
|
||||||
cancelButtonText: t('common.cancel'),
|
|
||||||
type: 'warning'
|
|
||||||
})
|
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
row.status =
|
row.status =
|
||||||
row.status === CommonStatusEnum.ENABLE ? CommonStatusEnum.ENABLE : CommonStatusEnum.DISABLE
|
row.status === CommonStatusEnum.ENABLE ? CommonStatusEnum.ENABLE : CommonStatusEnum.DISABLE
|
||||||
await UserApi.updateUserStatusApi(row.id, row.status)
|
await UserApi.updateUserStatusApi(row.id, row.status)
|
||||||
ElMessage.success(text + '成功')
|
message.success(text + '成功')
|
||||||
await getList()
|
await getList()
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
@ -161,12 +158,9 @@ const handleStatusChange = async (row: UserVO) => {
|
||||||
}
|
}
|
||||||
// 重置密码
|
// 重置密码
|
||||||
const handleResetPwd = (row: UserVO) => {
|
const handleResetPwd = (row: UserVO) => {
|
||||||
ElMessageBox.prompt('请输入"' + row.username + '"的新密码', t('common.reminder'), {
|
message.prompt('请输入"' + row.username + '"的新密码', t('common.reminder')).then(({ value }) => {
|
||||||
confirmButtonText: t('common.ok'),
|
|
||||||
cancelButtonText: t('common.cancel')
|
|
||||||
}).then(({ value }) => {
|
|
||||||
UserApi.resetUserPwdApi(row.id, value).then(() => {
|
UserApi.resetUserPwdApi(row.id, value).then(() => {
|
||||||
ElMessage.success('修改成功,新密码是:' + value)
|
message.success('修改成功,新密码是:' + value)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -207,8 +201,8 @@ const beforeExcelUpload = (file: UploadRawFile) => {
|
||||||
file.type === 'application/vnd.ms-excel' ||
|
file.type === 'application/vnd.ms-excel' ||
|
||||||
file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||||
const isLt5M = file.size / 1024 / 1024 < 5
|
const isLt5M = file.size / 1024 / 1024 < 5
|
||||||
if (!isExcel) ElMessage.error('上传文件只能是 xls / xlsx 格式!')
|
if (!isExcel) message.error('上传文件只能是 xls / xlsx 格式!')
|
||||||
if (!isLt5M) ElMessage.error('上传文件大小不能超过 5MB!')
|
if (!isLt5M) message.error('上传文件大小不能超过 5MB!')
|
||||||
return isExcel && isLt5M
|
return isExcel && isLt5M
|
||||||
}
|
}
|
||||||
// 文件上传
|
// 文件上传
|
||||||
|
@ -224,7 +218,7 @@ const submitFileForm = () => {
|
||||||
// 文件上传成功
|
// 文件上传成功
|
||||||
const handleFileSuccess = (response: any): void => {
|
const handleFileSuccess = (response: any): void => {
|
||||||
if (response.code !== 0) {
|
if (response.code !== 0) {
|
||||||
ElMessage.error(response.msg)
|
message.error(response.msg)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
importDialogVisible.value = false
|
importDialogVisible.value = false
|
||||||
|
@ -242,15 +236,15 @@ const handleFileSuccess = (response: any): void => {
|
||||||
for (const username in data.failureUsernames) {
|
for (const username in data.failureUsernames) {
|
||||||
text += '< ' + username + ': ' + data.failureUsernames[username] + ' >'
|
text += '< ' + username + ': ' + data.failureUsernames[username] + ' >'
|
||||||
}
|
}
|
||||||
ElMessageBox.alert(text)
|
message.alert(text)
|
||||||
}
|
}
|
||||||
// 文件数超出提示
|
// 文件数超出提示
|
||||||
const handleExceed = (): void => {
|
const handleExceed = (): void => {
|
||||||
ElMessage.error('最多只能上传一个文件!')
|
message.error('最多只能上传一个文件!')
|
||||||
}
|
}
|
||||||
// 上传错误提示
|
// 上传错误提示
|
||||||
const excelUploadError = (): void => {
|
const excelUploadError = (): void => {
|
||||||
ElMessage.error('导入数据失败,请您重新上传!')
|
message.error('导入数据失败,请您重新上传!')
|
||||||
}
|
}
|
||||||
// ========== 初始化 ==========
|
// ========== 初始化 ==========
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
|
Loading…
Reference in New Issue