update 重构 彻底删除proxy用法 改为vue3官方推荐写法

This commit is contained in:
疯狂的狮子Li
2026-04-10 13:07:37 +08:00
parent eb62402423
commit 9acf52e8a7
144 changed files with 1264 additions and 1082 deletions

View File

@@ -213,11 +213,13 @@
<script setup name="Client" lang="ts">
import { listClient, getClient, delClient, addClient, updateClient, changeStatus } from '@/api/system/client';
import { ClientVO, ClientQuery, ClientForm } from '@/api/system/client/types';
import modal from '@/plugins/modal';
import { useDict } from '@/utils/dict';
import { download as requestDownload } from '@/utils/request';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_normal_disable'));
const { sys_grant_type } = toRefs<any>(proxy?.useDict('sys_grant_type'));
const { sys_device_type } = toRefs<any>(proxy?.useDict('sys_device_type'));
const { sys_normal_disable } = toRefs<any>(useDict('sys_normal_disable'));
const { sys_grant_type } = toRefs<any>(useDict('sys_grant_type'));
const { sys_device_type } = toRefs<any>(useDict('sys_device_type'));
const clientList = ref<ClientVO[]>([]);
const buttonLoading = ref(false);
@@ -340,7 +342,7 @@ const submitForm = () => {
} else {
await addClient(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('修改成功');
modal.msgSuccess('修改成功');
dialog.visible = false;
await getList();
}
@@ -350,17 +352,15 @@ const submitForm = () => {
/** 删除按钮操作 */
const handleDelete = async (row?: ClientVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal
.confirm('是否确认删除客户端管理编号为"' + _ids + '"的数据项?')
.finally(() => (loading.value = false));
await modal.confirm('是否确认删除客户端管理编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
await delClient(_ids);
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
await getList();
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
requestDownload(
'system/client/export',
{
...queryParams.value
@@ -373,9 +373,9 @@ const handleExport = () => {
const handleStatusChange = async (row: ClientVO) => {
const text = row.status === '0' ? '启用' : '停用';
try {
await proxy?.$modal.confirm('确认要"' + text + '"吗?');
await modal.confirm('确认要"' + text + '"吗?');
await changeStatus(row.clientId, row.status);
proxy?.$modal.msgSuccess(text + '成功');
modal.msgSuccess(text + '成功');
} catch (err) {
row.status = row.status === '0' ? '1' : '0';
}

View File

@@ -120,7 +120,7 @@
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="150" class-name="small-padding fixed-width">
@@ -189,9 +189,12 @@
<script setup name="Config" lang="ts">
import { listConfig, getConfig, delConfig, addConfig, updateConfig, refreshCache } from '@/api/system/config';
import { ConfigForm, ConfigQuery, ConfigVO } from '@/api/system/config/types';
import modal from '@/plugins/modal';
import { useDict } from '@/utils/dict';
import { download as requestDownload } from '@/utils/request';
import { parseTime, addDateRange } from '@/utils/ruoyi';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_yes_no } = toRefs<any>(proxy?.useDict('sys_yes_no'));
const { sys_yes_no } = toRefs<any>(useDict('sys_yes_no'));
const configList = ref<ConfigVO[]>([]);
const loading = ref(true);
@@ -200,7 +203,7 @@ const ids = ref<Array<number | string>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const dateRange = ref<[DateModelType, DateModelType]>(['', '']);
const dateRange = ref<any>(['', '']);
const queryFormRef = ref<ElFormInstance>();
const configFormRef = ref<ElFormInstance>();
@@ -237,7 +240,7 @@ const { queryParams, form, rules } = toRefs(data);
/** 查询参数列表 */
const getList = async () => {
loading.value = true;
const res = await listConfig(proxy?.addDateRange(queryParams.value, dateRange.value));
const res = await listConfig(addDateRange(queryParams.value, dateRange.value));
configList.value = res.data?.rows;
total.value = res.data?.total;
loading.value = false;
@@ -289,7 +292,7 @@ const submitForm = () => {
configFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
form.value.configId ? await updateConfig(form.value) : await addConfig(form.value);
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
@@ -298,14 +301,14 @@ const submitForm = () => {
/** 删除按钮操作 */
const handleDelete = async (row?: ConfigVO) => {
const configIds = row?.configId || ids.value;
await proxy?.$modal.confirm('是否确认删除参数编号为"' + configIds + '"的数据项?');
await modal.confirm('是否确认删除参数编号为"' + configIds + '"的数据项?');
await delConfig(configIds);
await getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
requestDownload(
'system/config/export',
{
...queryParams.value
@@ -316,7 +319,7 @@ const handleExport = () => {
/** 刷新缓存按钮操作 */
const handleRefreshCache = async () => {
await refreshCache();
proxy?.$modal.msgSuccess('刷新缓存成功');
modal.msgSuccess('刷新缓存成功');
};
onMounted(() => {

View File

@@ -79,7 +79,7 @@
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="200">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column fixed="right" align="center" label="操作">
@@ -192,8 +192,11 @@
<script setup name="Dept" lang="ts">
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from '@/api/system/dept';
import { DeptForm, DeptQuery, DeptVO } from '@/api/system/dept/types';
import { UserVO } from '@/api/system/user/types';
import { listUserByDeptId } from '@/api/system/user';
import { UserVO } from '@/api/system/user/types';
import modal from '@/plugins/modal';
import { useDict } from '@/utils/dict';
import { handleTree, parseTime } from '@/utils/ruoyi';
interface DeptOptionsType {
deptId: number | string;
@@ -201,8 +204,7 @@ interface DeptOptionsType {
children: DeptOptionsType[];
}
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_normal_disable'));
const { sys_normal_disable } = toRefs<any>(useDict('sys_normal_disable'));
const deptList = ref<DeptVO[]>([]);
const loading = ref(true);
@@ -244,8 +246,20 @@ const initData: PageData<DeptForm, DeptQuery> = {
parentId: [{ required: true, message: '上级部门不能为空', trigger: 'blur' }],
deptName: [{ required: true, message: '部门名称不能为空', trigger: 'blur' }],
orderNum: [{ required: true, message: '显示排序不能为空', trigger: 'blur' }],
email: [{ type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }],
phone: [{ pattern: /^1[3456789][0-9]\d{8}$/, message: '请输入正确的手机号码', trigger: 'blur' }]
email: [
{
type: 'email',
message: '请输入正确的邮箱地址',
trigger: ['blur', 'change']
}
],
phone: [
{
pattern: /^1[3456789][0-9]\d{8}$/,
message: '请输入正确的手机号码',
trigger: 'blur'
}
]
}
};
const data = reactive<PageData<DeptForm, DeptQuery>>(initData);
@@ -256,7 +270,7 @@ const { queryParams, form, rules } = toRefs<PageData<DeptForm, DeptQuery>>(data)
const getList = async () => {
loading.value = true;
const res = await listDept(queryParams.value);
const data = proxy?.handleTree<DeptVO>(res.data, 'deptId');
const data = handleTree<DeptVO>(res.data, 'deptId');
if (data) {
deptList.value = data;
}
@@ -309,7 +323,7 @@ const toggleExpandAll = (data: DeptVO[], status: boolean) => {
const handleAdd = async (row?: DeptVO) => {
reset();
const res = await listDept();
const data = proxy?.handleTree<DeptOptionsType>(res.data, 'deptId');
const data = handleTree<DeptOptionsType>(res.data, 'deptId');
if (data) {
deptOptions.value = data;
if (row && row.deptId) {
@@ -328,7 +342,7 @@ const handleUpdate = async (row: DeptVO) => {
const res = await getDept(row.deptId);
form.value = res.data;
const response = await listDeptExcludeChild(row.deptId);
const data = proxy?.handleTree<DeptOptionsType>(response.data, 'deptId');
const data = handleTree<DeptOptionsType>(response.data, 'deptId');
if (data) {
deptOptions.value = data;
if (data.length === 0) {
@@ -348,7 +362,7 @@ const submitForm = () => {
deptFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
form.value.deptId ? await updateDept(form.value) : await addDept(form.value);
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
@@ -356,10 +370,10 @@ const submitForm = () => {
};
/** 删除按钮操作 */
const handleDelete = async (row: DeptVO) => {
await proxy?.$modal.confirm('是否确认删除名称为"' + row.deptName + '"的数据项?');
await modal.confirm('是否确认删除名称为"' + row.deptName + '"的数据项?');
await delDept(row.deptId);
await getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
onMounted(() => {

View File

@@ -113,7 +113,7 @@
<el-table-column label="备注" align="center" prop="remark" width="160" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column
@@ -280,7 +280,7 @@
<el-table-column label="备注" align="center" prop="remark" width="100" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column
@@ -397,13 +397,14 @@
</template>
<script setup name="Dict" lang="ts">
import { useDictStore } from '@/store/modules/dict';
import { listType, getType, delType, addType, updateType, refreshCache } from '@/api/system/dict/type';
import { listData, getData, delData, addData, updateData } from '@/api/system/dict/data';
import { DictTypeForm, DictTypeQuery, DictTypeVO } from '@/api/system/dict/type/types';
import { DictDataForm, DictDataQuery, DictDataVO } from '@/api/system/dict/data/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
import { listType, getType, delType, addType, updateType, refreshCache } from '@/api/system/dict/type';
import { DictTypeForm, DictTypeQuery, DictTypeVO } from '@/api/system/dict/type/types';
import modal from '@/plugins/modal';
import { useDictStore } from '@/store/modules/dict';
import { download as requestDownload } from '@/utils/request';
import { parseTime } from '@/utils/ruoyi';
const typeList = ref<DictTypeVO[]>([]);
const typeLoading = ref(true);
@@ -587,7 +588,7 @@ const submitTypeForm = () => {
typeFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
typeForm.value.dictId ? await updateType(typeForm.value) : await addType(typeForm.value);
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
typeDialog.visible = false;
getTypeList();
}
@@ -596,14 +597,14 @@ const submitTypeForm = () => {
const handleTypeDelete = async (row?: DictTypeVO) => {
const dictIds = row?.dictId || typeIds.value;
await proxy?.$modal.confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?');
await modal.confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?');
await delType(dictIds);
getTypeList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
const handleTypeExport = () => {
proxy?.download(
requestDownload(
'system/dict/type/export',
{
...typeQueryParams.value
@@ -614,7 +615,7 @@ const handleTypeExport = () => {
const handleRefreshCache = async () => {
await refreshCache();
proxy?.$modal.msgSuccess('刷新成功');
modal.msgSuccess('刷新成功');
useDictStore().cleanDict();
};
@@ -656,7 +657,7 @@ const handleDataResetQuery = () => {
const handleDataAdd = () => {
if (!currentDict.value) {
proxy?.$modal.msgWarning('请先选择字典');
modal.msgWarning('请先选择字典');
return;
}
resetDataForm();
@@ -673,7 +674,7 @@ const handleDataSelectionChange = (selection: DictDataVO[]) => {
const handleDataUpdate = async (row?: DictDataVO) => {
if (!currentDict.value) {
proxy?.$modal.msgWarning('请先选择字典');
modal.msgWarning('请先选择字典');
return;
}
resetDataForm();
@@ -689,7 +690,7 @@ const submitDataForm = () => {
if (valid) {
dataForm.value.dictCode ? await updateData(dataForm.value) : await addData(dataForm.value);
useDictStore().removeDict(dataQueryParams.value.dictType);
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
dataDialog.visible = false;
await getDataList();
}
@@ -698,23 +699,23 @@ const submitDataForm = () => {
const handleDataDelete = async (row?: DictDataVO) => {
if (!currentDict.value) {
proxy?.$modal.msgWarning('请先选择字典');
modal.msgWarning('请先选择字典');
return;
}
const dictCodes = row?.dictCode || dataIds.value;
await proxy?.$modal.confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?');
await modal.confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?');
await delData(dictCodes);
await getDataList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
useDictStore().removeDict(dataQueryParams.value.dictType);
};
const handleDataExport = () => {
if (!currentDict.value) {
proxy?.$modal.msgWarning('请先选择字典');
modal.msgWarning('请先选择字典');
return;
}
proxy?.download(
requestDownload(
'system/dict/data/export',
{
...dataQueryParams.value

View File

@@ -368,6 +368,9 @@
import { addMenu, cascadeDelMenu, delMenu, getMenu, listMenu, updateMenu } from '@/api/system/menu';
import { MenuForm, MenuQuery, MenuVO } from '@/api/system/menu/types';
import { MenuTypeEnum } from '@/enums/MenuTypeEnum';
import modal from '@/plugins/modal';
import { useDict } from '@/utils/dict';
import { handleTree } from '@/utils/ruoyi';
interface MenuOptionsType {
menuId: number;
@@ -375,8 +378,7 @@ interface MenuOptionsType {
children: MenuOptionsType[] | undefined;
}
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_show_hide, sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_show_hide', 'sys_normal_disable'));
const { sys_show_hide, sys_normal_disable } = toRefs<any>(useDict('sys_show_hide', 'sys_normal_disable'));
const menuList = ref<MenuVO[]>([]);
const menuChildrenListMap = ref({});
@@ -512,7 +514,7 @@ const getTreeselect = async () => {
menuOptions.value = [];
const response = await listMenu();
const menu: MenuOptionsType = { menuId: 0, menuName: '主类目', children: [] };
menu.children = proxy?.handleTree<MenuOptionsType>(response.data, 'menuId');
menu.children = handleTree<MenuOptionsType>(response.data, 'menuId');
menuOptions.value.push(menu);
};
/** 取消按钮 */
@@ -559,7 +561,7 @@ const submitForm = () => {
menuFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
form.value.menuId ? await updateMenu(form.value) : await addMenu(form.value);
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
@@ -567,10 +569,10 @@ const submitForm = () => {
};
/** 删除按钮操作 */
const handleDelete = async (row: MenuVO) => {
await proxy?.$modal.confirm('是否确认删除名称为"' + row.menuName + '"的数据项?');
await modal.confirm('是否确认删除名称为"' + row.menuName + '"的数据项?');
await delMenu(row.menuId);
await getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
const deleteLoading = ref<boolean>(false);
@@ -598,14 +600,14 @@ const cancelCascade = () => {
const submitDeleteForm = async () => {
const menuIds = menuTreeRef.value?.getCheckedKeys();
if (menuIds.length < 0) {
proxy?.$modal.msgWarning('请选择要删除的菜单');
modal.msgWarning('请选择要删除的菜单');
return;
}
deleteLoading.value = true;
await cascadeDelMenu(menuIds).finally(() => (deleteLoading.value = false));
await getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
deleteDialog.visible = false;
};

View File

@@ -100,7 +100,7 @@
<el-table-column label="创建者" align="center" prop="createByName" width="100" />
<el-table-column label="创建时间" align="center" prop="createTime" width="100">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@@ -215,7 +215,7 @@
</div>
<div class="notice-detail__meta-item">
<span class="notice-detail__meta-label">创建时间:</span>
<span>{{ proxy.parseTime(detailForm.createTime, '{y}-{m}-{d} {h}:{i}:{s}') || '-' }}</span>
<span>{{ parseTime(detailForm.createTime, '{y}-{m}-{d} {h}:{i}:{s}') || '-' }}</span>
</div>
</div>
</div>
@@ -227,13 +227,16 @@
</template>
<script setup name="Notice" lang="ts">
import { useRoute, useRouter } from 'vue-router';
import { listNotice, getNotice, delNotice, addNotice, updateNotice } from '@/api/system/notice';
import { NoticeForm, NoticeQuery, NoticeVO } from '@/api/system/notice/types';
import { sanitizeHtml } from '@/utils/sanitize';
import modal from '@/plugins/modal';
import { useDict } from '@/utils/dict';
import { resolveOssContent } from '@/utils/ossContent';
import { parseTime } from '@/utils/ruoyi';
import { sanitizeHtml } from '@/utils/sanitize';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_notice_status, sys_notice_type } = toRefs<any>(proxy?.useDict('sys_notice_status', 'sys_notice_type'));
const { sys_notice_status, sys_notice_type } = toRefs<any>(useDict('sys_notice_status', 'sys_notice_type'));
const route = useRoute();
const router = useRouter();
@@ -370,7 +373,7 @@ const submitForm = () => {
noticeFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
form.value.noticeId ? await updateNotice(form.value) : await addNotice(form.value);
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
@@ -379,10 +382,10 @@ const submitForm = () => {
/** 删除按钮操作 */
const handleDelete = async (row?: NoticeVO) => {
const noticeIds = row?.noticeId || ids.value;
await proxy?.$modal.confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?');
await modal.confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?');
await delNotice(noticeIds);
await getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
onMounted(() => {

View File

@@ -208,10 +208,10 @@ import {
changeOssConfigStatus
} from '@/api/system/ossConfig';
import { OssConfigForm, OssConfigQuery, OssConfigVO } from '@/api/system/ossConfig/types';
import modal from '@/plugins/modal';
import { useDict } from '@/utils/dict';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_yes_no } = toRefs<any>(proxy?.useDict('sys_yes_no'));
const { sys_yes_no } = toRefs<any>(useDict('sys_yes_no'));
const ossConfigList = ref<OssConfigVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
@@ -372,7 +372,7 @@ const submitForm = () => {
} else {
await addOssConfig(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('新增成功');
modal.msgSuccess('新增成功');
dialog.visible = false;
await getList();
}
@@ -382,10 +382,10 @@ const submitForm = () => {
const handleStatusChange = async (row: OssConfigVO) => {
const text = row.status === 'Y' ? '启用' : '停用';
try {
await proxy?.$modal.confirm('确认要"' + text + '""' + row.configKey + '"配置吗?');
await modal.confirm('确认要"' + text + '""' + row.configKey + '"配置吗?');
await changeOssConfigStatus(row.ossConfigId, row.status, row.configKey);
await getList();
proxy?.$modal.msgSuccess(text + '成功');
modal.msgSuccess(text + '成功');
} catch {
row.status = row.status === 'Y' ? 'N' : 'Y';
}
@@ -393,11 +393,11 @@ const handleStatusChange = async (row: OssConfigVO) => {
/** 删除按钮操作 */
const handleDelete = async (row?: OssConfigVO) => {
const ossConfigIds = row?.ossConfigId || ids.value;
await proxy?.$modal.confirm('是否确认删除OSS配置编号为"' + ossConfigIds + '"的数据项?');
await modal.confirm('是否确认删除OSS配置编号为"' + ossConfigIds + '"的数据项?');
loading.value = true;
await delOssConfig(ossConfigIds).finally(() => (loading.value = false));
await getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
onMounted(() => {

View File

@@ -128,7 +128,7 @@
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180" sortable="custom">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="上传人" align="center" prop="createByName" />
@@ -184,12 +184,16 @@
</template>
<script setup name="Oss" lang="ts">
import { useRouter } from 'vue-router';
import { getConfigKey, updateConfigByKey } from '@/api/system/config';
import { listOss, delOss } from '@/api/system/oss';
import ImagePreview from '@/components/ImagePreview/index.vue';
import { OssForm, OssQuery, OssVO } from '@/api/system/oss/types';
import ImagePreview from '@/components/ImagePreview/index.vue';
import download from '@/plugins/download';
import modal from '@/plugins/modal';
import { parseTime, addDateRange } from '@/utils/ruoyi';
const router = useRouter();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const ossList = ref<OssVO[]>([]);
const showTable = ref(true);
@@ -202,7 +206,7 @@ const multiple = ref(true);
const total = ref(0);
const type = ref(0);
const previewListResource = ref(true);
const dateRangeCreateTime = ref<[DateModelType, DateModelType]>(['', '']);
const dateRangeCreateTime = ref<any>(['', '']);
const dialog = reactive<DialogOption>({
visible: false,
@@ -242,9 +246,9 @@ const { queryParams, form, rules } = toRefs(data);
/** 查询OSS对象存储列表 */
const getList = async () => {
loading.value = true;
const res = await proxy?.getConfigKey('sys.oss.previewListResource');
const res = await getConfigKey('sys.oss.previewListResource');
previewListResource.value = res?.data === undefined ? true : res.data === 'true';
const response = await listOss(proxy?.addDateRange(queryParams.value, dateRangeCreateTime.value, 'CreateTime'));
const response = await listOss(addDateRange(queryParams.value, dateRangeCreateTime.value, 'CreateTime'));
ossList.value = response.data?.rows;
total.value = response.data?.total;
loading.value = false;
@@ -355,14 +359,14 @@ const submitForm = () => {
};
/** 下载按钮操作 */
const handleDownload = (row: OssVO) => {
proxy?.$download.oss(row.ossId);
download.oss(row.ossId);
};
/** 预览开关按钮 */
const handlePreviewListResource = async (preview: boolean) => {
try {
await proxy?.updateConfigByKey('sys.oss.previewListResource', preview);
await updateConfigByKey('sys.oss.previewListResource', preview);
await getList();
proxy?.$modal.msgSuccess((preview ? '启用' : '停用') + '成功');
modal.msgSuccess((preview ? '启用' : '停用') + '成功');
} catch {
return;
}
@@ -370,11 +374,11 @@ const handlePreviewListResource = async (preview: boolean) => {
/** 删除按钮操作 */
const handleDelete = async (row?: OssVO) => {
const ossIds = row?.ossId || ids.value;
await proxy?.$modal.confirm('是否确认删除OSS对象存储编号为"' + ossIds + '"的数据项?');
await modal.confirm('是否确认删除OSS对象存储编号为"' + ossIds + '"的数据项?');
loading.value = true;
await delOss(ossIds).finally(() => (loading.value = false));
await getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
onMounted(() => {

View File

@@ -146,7 +146,7 @@
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="180" align="center" class-name="small-padding fixed-width">
@@ -231,13 +231,16 @@
</template>
<script setup name="Post" lang="ts">
import TreePanel from '@/components/TreePanel/index.vue';
import { DeptTreeVO, DeptVO } from '@/api/system/dept/types';
import { listPost, addPost, delPost, getPost, updatePost, deptTreeSelect } from '@/api/system/post';
import { PostForm, PostQuery, PostVO } from '@/api/system/post/types';
import { DeptTreeVO, DeptVO } from '@/api/system/dept/types';
import TreePanel from '@/components/TreePanel/index.vue';
import modal from '@/plugins/modal';
import { useDict } from '@/utils/dict';
import { download as requestDownload } from '@/utils/request';
import { parseTime } from '@/utils/ruoyi';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_normal_disable'));
const { sys_normal_disable } = toRefs<any>(useDict('sys_normal_disable'));
const postList = ref<PostVO[]>([]);
const loading = ref(true);
@@ -373,7 +376,7 @@ const submitForm = () => {
postFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
form.value.postId ? await updatePost(form.value) : await addPost(form.value);
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
@@ -383,15 +386,15 @@ const submitForm = () => {
/** 删除按钮操作 */
const handleDelete = async (row?: PostVO) => {
const postIds = row?.postId || ids.value;
await proxy?.$modal.confirm('是否确认删除岗位编号为"' + postIds + '"的数据项?');
await modal.confirm('是否确认删除岗位编号为"' + postIds + '"的数据项?');
await delPost(postIds);
await getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
requestDownload(
'system/post/export',
{
...queryParams.value

View File

@@ -106,15 +106,17 @@
</template>
<script setup name="AuthUser" lang="ts">
import { RouteLocationNormalized } from 'vue-router';
import { allocatedUserList, authUserCancel, authUserCancelAll } from '@/api/system/role';
import { UserQuery } from '@/api/system/user/types';
import { UserVO } from '@/api/system/user/types';
import modal from '@/plugins/modal';
import tab from '@/plugins/tab';
import { useDict } from '@/utils/dict';
import SelectUser from './selectUser.vue';
import { RouteLocationNormalized } from 'vue-router';
const route = useRoute();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_normal_disable'));
const { sys_normal_disable } = toRefs<any>(useDict('sys_normal_disable'));
const userList = ref<UserVO[]>([]);
const loading = ref(true);
@@ -155,7 +157,7 @@ const handleClose = () => {
query: undefined,
redirectedFrom: undefined
};
proxy?.$tab.closeOpenPage(obj);
tab.closeOpenPage(obj as any);
};
/** 搜索按钮操作 */
const handleQuery = () => {
@@ -178,19 +180,19 @@ const openSelectUser = () => {
};
/** 取消授权按钮操作 */
const cancelAuthUser = async (row: UserVO) => {
await proxy?.$modal.confirm('确认要取消该用户"' + row.userName + '"角色吗?');
await modal.confirm('确认要取消该用户"' + row.userName + '"角色吗?');
await authUserCancel({ userId: row.userId, roleId: queryParams.roleId });
await getList();
proxy?.$modal.msgSuccess('取消授权成功');
modal.msgSuccess('取消授权成功');
};
/** 批量取消授权按钮操作 */
const cancelAuthUserAll = async () => {
const roleId = queryParams.roleId;
const uIds = userIds.value.join(',');
await proxy?.$modal.confirm('是否取消选中用户授权数据项?');
await modal.confirm('是否取消选中用户授权数据项?');
await authUserCancelAll({ roleId: roleId, userIds: uIds });
await getList();
proxy?.$modal.msgSuccess('取消授权成功');
modal.msgSuccess('取消授权成功');
};
onMounted(() => {

View File

@@ -112,7 +112,7 @@
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
@@ -275,6 +275,9 @@
</template>
<script setup name="Role" lang="ts">
import { useRouter } from 'vue-router';
import { roleMenuTreeselect, treeselect as menuTreeselect } from '@/api/system/menu/index';
import { MenuTreeOption, RoleMenuTree } from '@/api/system/menu/types';
import {
addRole,
changeRoleStatus,
@@ -285,13 +288,14 @@ import {
updateRole,
deptTreeSelect
} from '@/api/system/role';
import { roleMenuTreeselect, treeselect as menuTreeselect } from '@/api/system/menu/index';
import { RoleVO, RoleForm, RoleQuery, DeptTreeOption } from '@/api/system/role/types';
import { MenuTreeOption, RoleMenuTree } from '@/api/system/menu/types';
import modal from '@/plugins/modal';
import { useDict } from '@/utils/dict';
import { download as requestDownload } from '@/utils/request';
import { parseTime, addDateRange } from '@/utils/ruoyi';
const router = useRouter();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_normal_disable'));
const { sys_normal_disable } = toRefs<any>(useDict('sys_normal_disable'));
const roleList = ref<RoleVO[]>();
const loading = ref(true);
@@ -300,7 +304,7 @@ const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const dateRange = ref<[DateModelType, DateModelType]>(['', '']);
const dateRange = ref<any>(['', '']);
const menuOptions = ref<MenuTreeOption[]>([]);
const menuExpand = ref(false);
const menuNodeAll = ref(false);
@@ -366,7 +370,7 @@ const dialog = reactive<DialogOption>({
*/
const getList = () => {
loading.value = true;
listRole(proxy?.addDateRange(queryParams.value, dateRange.value)).then(res => {
listRole(addDateRange(queryParams.value, dateRange.value)).then(res => {
roleList.value = res.data?.rows;
total.value = res.data?.total;
loading.value = false;
@@ -390,15 +394,15 @@ const resetQuery = () => {
/**删除按钮操作 */
const handleDelete = async (row?: RoleVO) => {
const roleids = row?.roleId || ids.value;
await proxy?.$modal.confirm('是否确认删除角色编号为' + roleids + '数据项目');
await modal.confirm('是否确认删除角色编号为' + roleids + '数据项目');
await delRole(roleids);
getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
requestDownload(
'system/role/export',
{
...queryParams.value
@@ -417,9 +421,9 @@ const handleSelectionChange = (selection: RoleVO[]) => {
const handleStatusChange = async (row: RoleVO) => {
const text = row.status === '0' ? '启用' : '停用';
try {
await proxy?.$modal.confirm('确认要"' + text + '""' + row.roleName + '"角色吗?');
await modal.confirm('确认要"' + text + '""' + row.roleName + '"角色吗?');
await changeRoleStatus(row.roleId, row.status);
proxy?.$modal.msgSuccess(text + '成功');
modal.msgSuccess(text + '成功');
} catch {
row.status = row.status === '0' ? '1' : '0';
}
@@ -494,19 +498,20 @@ const getRoleDeptTreeSelect = async (roleId: string | number) => {
return res.data;
};
/** 树权限(展开/折叠)*/
const handleCheckedTreeExpand = (value: boolean, type: string) => {
const handleCheckedTreeExpand = (value: unknown, type: string) => {
const expanded = Boolean(value);
if (type == 'menu') {
const treeList = menuOptions.value;
for (let i = 0; i < treeList.length; i++) {
if (menuRef.value) {
menuRef.value.store.nodesMap[treeList[i].id].expanded = value;
menuRef.value.store.nodesMap[treeList[i].id].expanded = expanded;
}
}
} else if (type == 'dept') {
const treeList = deptOptions.value;
for (let i = 0; i < treeList.length; i++) {
if (deptRef.value) {
deptRef.value.store.nodesMap[treeList[i].id].expanded = value;
deptRef.value.store.nodesMap[treeList[i].id].expanded = expanded;
}
}
}
@@ -544,7 +549,7 @@ const submitForm = () => {
if (valid) {
form.value.menuIds = getMenuAllCheckedKeys();
form.value.roleId ? await updateRole(form.value) : await addRole(form.value);
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
dialog.visible = false;
getList();
}
@@ -577,7 +582,7 @@ const submitDataScope = async () => {
if (form.value.roleId) {
form.value.deptIds = getDeptAllCheckedKeys();
await dataScope(form.value);
proxy?.$modal.msgSuccess('修改成功');
modal.msgSuccess('修改成功');
openDataScope.value = false;
getList();
}

View File

@@ -49,7 +49,7 @@
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
</el-table>
@@ -76,6 +76,9 @@
import { authUserSelectAll, unallocatedUserList } from '@/api/system/role';
import { UserVO } from '@/api/system/user/types';
import { UserQuery } from '@/api/system/user/types';
import modal from '@/plugins/modal';
import { useDict } from '@/utils/dict';
import { parseTime } from '@/utils/ruoyi';
const props = defineProps({
roleId: {
@@ -84,8 +87,7 @@ const props = defineProps({
}
});
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_normal_disable'));
const { sys_normal_disable } = toRefs<any>(useDict('sys_normal_disable'));
const userList = ref<UserVO[]>([]);
const visible = ref(false);
@@ -144,11 +146,11 @@ const handleSelectUser = async () => {
const roleId = queryParams.roleId;
const ids = userIds.value.join(',');
if (ids == '') {
proxy?.$modal.msgError('请选择要分配的用户');
modal.msgError('请选择要分配的用户');
return;
}
await authUserSelectAll({ roleId, userIds: ids });
proxy?.$modal.msgSuccess('分配成功');
modal.msgSuccess('分配成功');
emit('ok');
visible.value = false;
};

View File

@@ -54,7 +54,7 @@
<el-table-column label="权限字符" align="center" prop="roleKey" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
</el-table>
@@ -64,14 +64,15 @@
</template>
<script setup name="AuthRole" lang="ts">
import { RouteLocationNormalized } from 'vue-router';
import { RoleVO } from '@/api/system/role/types';
import { getAuthRole, updateAuthRole } from '@/api/system/user';
import { UserForm } from '@/api/system/user/types';
import { RouteLocationNormalized } from 'vue-router';
import modal from '@/plugins/modal';
import tab from '@/plugins/tab';
import { parseTime } from '@/utils/ruoyi';
const route = useRoute();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const loading = ref(true);
const total = ref(0);
@@ -119,14 +120,14 @@ const close = () => {
redirectedFrom: undefined,
path: '/system/user'
};
proxy?.$tab.closeOpenPage(obj);
tab.closeOpenPage(obj as any);
};
/** 提交按钮 */
const submitForm = async () => {
const userId = form.value.userId;
const rIds = roleIds.value.join(',');
await updateAuthRole({ userId: userId as string, roleIds: rIds });
proxy?.$modal.msgSuccess('授权成功');
modal.msgSuccess('授权成功');
close();
};

View File

@@ -451,22 +451,27 @@
</template>
<script setup name="User" lang="ts">
import TreePanel from '@/components/TreePanel/index.vue';
import { to } from 'await-to-js';
import { useRouter } from 'vue-router';
import { getConfigKey } from '@/api/system/config';
import { DeptTreeVO, DeptVO } from '@/api/system/dept/types';
import { optionselect } from '@/api/system/post';
import { PostVO } from '@/api/system/post/types';
import { RoleVO } from '@/api/system/role/types';
import api from '@/api/system/user';
import { UserForm, UserQuery, UserVO } from '@/api/system/user/types';
import { DeptTreeVO, DeptVO } from '@/api/system/dept/types';
import { RoleVO } from '@/api/system/role/types';
import { PostVO } from '@/api/system/post/types';
import { globalHeaders } from '@/utils/request';
import { to } from 'await-to-js';
import { optionselect } from '@/api/system/post';
import { checkPermi } from '@/utils/permission';
import TreePanel from '@/components/TreePanel/index.vue';
import modal from '@/plugins/modal';
import { useUserStore } from '@/store/modules/user';
import { useDict } from '@/utils/dict';
import { checkPermi } from '@/utils/permission';
import { globalHeaders } from '@/utils/request';
import { download as requestDownload } from '@/utils/request';
import { addDateRange } from '@/utils/ruoyi';
import UserViewDrawer from './view.vue';
const router = useRouter();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_normal_disable, sys_user_gender } = toRefs<any>(proxy?.useDict('sys_normal_disable', 'sys_user_gender'));
const { sys_normal_disable, sys_user_gender } = toRefs<any>(useDict('sys_normal_disable', 'sys_user_gender'));
const userList = ref<UserVO[]>();
const loading = ref(true);
const showSearch = ref(true);
@@ -474,7 +479,7 @@ const ids = ref<Array<number | string>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const dateRange = ref<[DateModelType, DateModelType]>(['', '']);
const dateRange = ref<any>(['', '']);
const treeCollapsed = ref(false);
const deptOptions = ref<DeptTreeVO[]>([]);
const enabledDeptOptions = ref<DeptTreeVO[]>([]);
@@ -564,7 +569,11 @@ const initData: PageData<UserForm, UserQuery> = {
message: '用户密码长度必须介于 5 和 20 之间',
trigger: 'blur'
},
{ pattern: /^[^<>"'|\\]+$/, message: '不能包含非法字符:< > " \' \\ |', trigger: 'blur' }
{
pattern: /^[^<>"'|\\]+$/,
message: '不能包含非法字符:< > " \' \\ |',
trigger: 'blur'
}
],
email: [
{
@@ -590,7 +599,7 @@ const { queryParams, form, rules } = toRefs<PageData<UserForm, UserQuery>>(data)
/** 查询用户列表 */
const getList = async () => {
loading.value = true;
const res = await api.listUser(proxy?.addDateRange(queryParams.value, dateRange.value));
const res = await api.listUser(addDateRange(queryParams.value, dateRange.value));
loading.value = false;
userList.value = res.data?.rows;
total.value = res.data?.total;
@@ -640,21 +649,21 @@ const resetQuery = () => {
/** 删除按钮操作 */
const handleDelete = async (row?: UserVO) => {
const userIds = row?.userId || ids.value;
const [err] = await to(proxy?.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?') as any);
const [err] = await to(modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?') as any);
if (!err) {
await api.delUser(userIds);
await getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
}
};
/** 解锁按钮操作 */
const handleUnlock = async () => {
const userId = ids.value[0];
const [err] = await to(proxy?.$modal.confirm('是否确认解锁用户编号为"' + userId + '"的数据项?') as any);
const [err] = await to(modal.confirm('是否确认解锁用户编号为"' + userId + '"的数据项?') as any);
if (!err) {
await api.unlockUser(userId);
proxy?.$modal.msgSuccess('用户编号"' + userId + '"解锁成功');
modal.msgSuccess('用户编号"' + userId + '"解锁成功');
}
};
@@ -662,9 +671,9 @@ const handleUnlock = async () => {
const handleStatusChange = async (row: UserVO) => {
const text = row.status === '0' ? '启用' : '停用';
try {
await proxy?.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?');
await modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?');
await api.changeUserStatus(row.userId, row.status);
proxy?.$modal.msgSuccess(text + '成功');
modal.msgSuccess(text + '成功');
} catch (err) {
row.status = row.status === '0' ? '1' : '0';
}
@@ -693,7 +702,7 @@ const handleResetPwd = async (row: UserVO) => {
);
if (!err && res) {
await api.resetUserPwd(row.userId, res.value);
proxy?.$modal.msgSuccess('修改成功,新密码是:' + res.value);
modal.msgSuccess('修改成功,新密码是:' + res.value);
}
};
@@ -716,7 +725,7 @@ const handleImport = () => {
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
requestDownload(
'system/user/export',
{
...queryParams.value
@@ -726,7 +735,7 @@ const handleExport = () => {
};
/** 下载模板操作 */
const importTemplate = () => {
proxy?.download('system/user/importTemplate', {}, `user_template_${new Date().getTime()}.xlsx`);
requestDownload('system/user/importTemplate', {}, `user_template_${new Date().getTime()}.xlsx`);
};
/**文件上传中处理 */
@@ -811,7 +820,7 @@ const submitForm = () => {
} else {
await api.addUser(form.value);
}
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
@@ -839,7 +848,7 @@ const resetForm = () => {
onMounted(() => {
getDeptTree(); // 初始化部门数据
getList(); // 初始化列表数据
proxy?.getConfigKey('sys.user.initPassword').then(response => {
getConfigKey('sys.user.initPassword').then(response => {
initPassword.value = response.data;
});
});

View File

@@ -93,15 +93,15 @@
</template>
<script setup name="Profile" lang="ts">
import UserAvatar from './userAvatar.vue';
import UserInfo from './userInfo.vue';
import ResetPwd from './resetPwd.vue';
import ThirdParty from './thirdParty.vue';
import OnlineDevice from './onlineDevice.vue';
import { getOnline } from '@/api/monitor/online';
import { getAuthList } from '@/api/system/social/auth';
import { getUserProfile } from '@/api/system/user';
import { getOnline } from '@/api/monitor/online';
import { UserVO } from '@/api/system/user/types';
import OnlineDevice from './onlineDevice.vue';
import ResetPwd from './resetPwd.vue';
import ThirdParty from './thirdParty.vue';
import UserAvatar from './userAvatar.vue';
import UserInfo from './userInfo.vue';
const activeTab = ref('userinfo');
interface State {

View File

@@ -12,7 +12,7 @@
<el-table-column label="浏览器" align="center" prop="browser" :show-overflow-tooltip="true" />
<el-table-column label="登录时间" align="center" prop="loginTime" width="180">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.loginTime) }}</span>
<span>{{ parseTime(scope.row.loginTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@@ -28,10 +28,13 @@
<script setup name="Online" lang="ts">
import { delOnline } from '@/api/monitor/online';
import modal from '@/plugins/modal';
import tab from '@/plugins/tab';
import { useDict } from '@/utils/dict';
import { propTypes } from '@/utils/propTypes';
import { parseTime } from '@/utils/ruoyi';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_device_type } = toRefs<any>(proxy?.useDict('sys_device_type'));
const { sys_device_type } = toRefs<any>(useDict('sys_device_type'));
const props = defineProps({
devices: propTypes.any.isRequired
@@ -46,10 +49,10 @@ const handldDelOnline = (row: any) => {
})
.then((res: any) => {
if (res.code === 200) {
proxy?.$modal.msgSuccess('删除成功');
proxy?.$tab.refreshPage();
modal.msgSuccess('删除成功');
tab.refreshPage();
} else {
proxy?.$modal.msgError(res.msg);
modal.msgError(res.msg);
}
})
.catch(() => {});

View File

@@ -17,10 +17,11 @@
</template>
<script setup lang="ts">
import { updateUserPwd } from '@/api/system/user';
import type { ResetPwdForm } from '@/api/system/user/types';
import { updateUserPwd } from '@/api/system/user';
import modal from '@/plugins/modal';
import tab from '@/plugins/tab';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const pwdRef = ref<ElFormInstance>();
const user = ref<ResetPwdForm>({
oldPassword: '',
@@ -45,7 +46,11 @@ const rules = ref({
message: '长度在 6 到 20 个字符',
trigger: 'blur'
},
{ pattern: /^[^<>"'|\\]+$/, message: '不能包含非法字符:< > " \' \\ |', trigger: 'blur' }
{
pattern: /^[^<>"'|\\]+$/,
message: '不能包含非法字符:< > " \' \\ |',
trigger: 'blur'
}
],
confirmPassword: [
{ required: true, message: '确认密码不能为空', trigger: 'blur' },
@@ -62,13 +67,13 @@ const submit = () => {
pwdRef.value?.validate(async (valid: boolean) => {
if (valid) {
await updateUserPwd(user.value.oldPassword, user.value.newPassword);
proxy?.$modal.msgSuccess('修改成功');
modal.msgSuccess('修改成功');
}
});
};
/** 关闭按钮 */
const close = () => {
proxy?.$tab.closePage();
tab.closePage();
};
</script>

View File

@@ -62,10 +62,10 @@
<script setup lang="ts">
import { authUnlock, authRouterUrl } from '@/api/system/social/auth';
import modal from '@/plugins/modal';
import tab from '@/plugins/tab';
import { propTypes } from '@/utils/propTypes';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const props = defineProps({
auths: propTypes.any.isRequired
});
@@ -78,10 +78,10 @@ const unlockAuth = (row: any) => {
})
.then((res: any) => {
if (res.code === 200) {
proxy?.$modal.msgSuccess('解绑成功');
proxy?.$tab.refreshPage();
modal.msgSuccess('解绑成功');
tab.refreshPage();
} else {
proxy?.$modal.msgError(res.msg);
modal.msgError(res.msg);
}
})
.catch(() => {});
@@ -92,7 +92,7 @@ const authUrl = (source: string) => {
if (res.code === 200) {
window.location.href = res.data;
} else {
proxy?.$modal.msgError(res.msg);
modal.msgError(res.msg);
}
});
};

View File

@@ -57,10 +57,11 @@
<script setup lang="ts">
import 'vue-cropper/dist/index.css';
import { UploadRawFile } from 'element-plus';
import { VueCropper } from 'vue-cropper';
import { uploadAvatar } from '@/api/system/user';
import modal from '@/plugins/modal';
import { useUserStore } from '@/store/modules/user';
import { UploadRawFile } from 'element-plus';
interface Options {
img: string | any; // 裁剪图片的地址
@@ -75,7 +76,6 @@ interface Options {
}
const userStore = useUserStore();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const open = ref(false);
const visible = ref(false);
@@ -121,7 +121,7 @@ const changeScale = (num: number) => {
/** 上传预处理 */
const beforeUpload = (file: UploadRawFile): any => {
if (file.type.indexOf('image/') == -1) {
proxy?.$modal.msgError('文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。');
modal.msgError('文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。');
} else {
const reader = new FileReader();
reader.readAsDataURL(file);
@@ -140,7 +140,7 @@ const uploadImg = async () => {
open.value = false;
options.img = res.data.imgUrl;
userStore.setAvatar(options.img);
proxy?.$modal.msgSuccess('修改成功');
modal.msgSuccess('修改成功');
visible.value = false;
});
};

View File

@@ -24,13 +24,14 @@
<script setup lang="ts">
import { updateUserProfile } from '@/api/system/user';
import modal from '@/plugins/modal';
import tab from '@/plugins/tab';
import { propTypes } from '@/utils/propTypes';
const props = defineProps({
user: propTypes.any.isRequired
});
const userForm = computed(() => props.user);
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const userRef = ref<ElFormInstance>();
const rule: ElFormRules = {
nickName: [{ required: true, message: '用户昵称不能为空', trigger: 'blur' }],
@@ -48,7 +49,11 @@ const rule: ElFormRules = {
message: '手机号码不能为空',
trigger: 'blur'
},
{ pattern: /^1[3456789][0-9]\d{8}$/, message: '请输入正确的手机号码', trigger: 'blur' }
{
pattern: /^1[3456789][0-9]\d{8}$/,
message: '请输入正确的手机号码',
trigger: 'blur'
}
]
};
const rules = ref<ElFormRules>(rule);
@@ -58,13 +63,13 @@ const submit = () => {
userRef.value?.validate(async (valid: boolean) => {
if (valid) {
await updateUserProfile(props.user);
proxy?.$modal.msgSuccess('修改成功');
modal.msgSuccess('修改成功');
}
});
};
/** 关闭按钮 */
const close = () => {
proxy?.$tab.closePage();
tab.closePage();
};
</script>

View File

@@ -1,18 +1,29 @@
<template>
<el-drawer v-model="visible" title="用户信息详情" :size="680" append-to-body :close-on-click-modal="true" @closed="info = null">
<el-drawer
v-model="visible"
title="用户信息详情"
:size="680"
append-to-body
:close-on-click-modal="true"
@closed="info = null"
>
<el-descriptions v-if="info" v-loading="loading" :column="2" border>
<el-descriptions-item label="用户名称">{{ info.nickName }}</el-descriptions-item>
<el-descriptions-item label="归属部门">{{ info.deptName || (info.dept && info.dept.deptName) || '-' }}</el-descriptions-item>
<el-descriptions-item label="归属部门">
{{ info.deptName || (info.dept && info.dept.deptName) || '-' }}
</el-descriptions-item>
<el-descriptions-item label="手机号码">{{ info.phoneNumber || '-' }}</el-descriptions-item>
<el-descriptions-item label="邮箱">{{ info.email || '-' }}</el-descriptions-item>
<el-descriptions-item label="登录账号">{{ info.userName }}</el-descriptions-item>
<el-descriptions-item label="用户状态">
<el-tag :type="info.status === '0' ? 'success' : 'danger'">
{{ proxy?.selectDictLabel(sys_normal_disable, info.status) }}
{{ selectDictLabel(sys_normal_disable, info.status) }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="岗位">{{ postNames || '-' }}</el-descriptions-item>
<el-descriptions-item label="用户性别">{{ proxy?.selectDictLabel(sys_user_gender, info.gender) || '-' }}</el-descriptions-item>
<el-descriptions-item label="用户性别">
{{ selectDictLabel(sys_user_gender, info.gender) || '-' }}
</el-descriptions-item>
<el-descriptions-item label="角色" :span="2">{{ roleNames || '-' }}</el-descriptions-item>
</el-descriptions>
@@ -29,13 +40,14 @@
</template>
<script setup lang="ts">
import api from '@/api/system/user';
import type { UserVO } from '@/api/system/user/types';
import type { PostVO } from '@/api/system/post/types';
import type { RoleVO } from '@/api/system/role/types';
import type { UserVO } from '@/api/system/user/types';
import api from '@/api/system/user';
import { useDict } from '@/utils/dict';
import { selectDictLabel } from '@/utils/ruoyi';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_normal_disable, sys_user_gender } = toRefs<any>(proxy?.useDict('sys_normal_disable', 'sys_user_gender'));
const { sys_normal_disable, sys_user_gender } = toRefs<any>(useDict('sys_normal_disable', 'sys_user_gender'));
const visible = ref(false);
const loading = ref(false);
@@ -48,16 +60,16 @@ const roleIds = ref<string[]>([]);
const postNames = computed(() => {
if (!postOptions.value.length || !postIds.value.length) return '';
return postOptions.value
.filter((p) => postIds.value.includes(String(p.postId)))
.map((p) => p.postName)
.filter(p => postIds.value.includes(String(p.postId)))
.map(p => p.postName)
.join('、');
});
const roleNames = computed(() => {
if (!roleOptions.value.length || !roleIds.value.length) return '';
return roleOptions.value
.filter((r) => roleIds.value.includes(String(r.roleId)))
.map((r) => r.roleName)
.filter(r => roleIds.value.includes(String(r.roleId)))
.map(r => r.roleName)
.join('、');
});