update 优化 执行eslint:fix优化代码

This commit is contained in:
疯狂的狮子Li 2025-05-15 14:52:31 +08:00
parent 7b48bd44a2
commit 7f15f0e15a
39 changed files with 117 additions and 124 deletions

View File

@ -44,7 +44,7 @@ const findPathNum = (str, char = '/') => {
return str.split(char).length - 1; return str.split(char).length - 1;
}; };
const getMatched = (pathList, routeList, matched) => { const getMatched = (pathList, routeList, matched) => {
let data = routeList.find((item) => item.path == pathList[0] || (item.name += '').toLowerCase() == pathList[0]); const data = routeList.find((item) => item.path == pathList[0] || (item.name += '').toLowerCase() == pathList[0]);
if (data) { if (data) {
matched.push(data); matched.push(data);
if (data.children && pathList.length) { if (data.children && pathList.length) {

View File

@ -95,7 +95,7 @@ const options = ref<any>({
}); });
const styles = computed(() => { const styles = computed(() => {
let style: any = {}; const style: any = {};
if (props.minHeight) { if (props.minHeight) {
style.minHeight = `${props.minHeight}px`; style.minHeight = `${props.minHeight}px`;
} }
@ -121,9 +121,9 @@ const handleUploadSuccess = (res: any) => {
// //
if (res.code === 200) { if (res.code === 200) {
// //
let quill = toRaw(quillEditorRef.value).getQuill(); const quill = toRaw(quillEditorRef.value).getQuill();
// //
let length = quill.selection.savedRange.index; const length = quill.selection.savedRange.index;
// res // res
quill.insertEmbed(length, 'image', res.data.url); quill.insertEmbed(length, 'image', res.data.url);
// //

View File

@ -176,7 +176,7 @@ const handleUploadSuccess = (res: any, file: UploadFile) => {
// //
const handleDelete = (index: number) => { const handleDelete = (index: number) => {
let ossId = fileList.value[index].ossId; const ossId = fileList.value[index].ossId;
delOss(ossId); delOss(ossId);
fileList.value.splice(index, 1); fileList.value.splice(index, 1);
emit('update:modelValue', listToString(fileList.value)); emit('update:modelValue', listToString(fileList.value));

View File

@ -27,7 +27,7 @@ const realSrc = computed(() => {
if (!props.src) { if (!props.src) {
return; return;
} }
let real_src = props.src.split(',')[0]; const real_src = props.src.split(',')[0];
return real_src; return real_src;
}); });
@ -35,8 +35,8 @@ const realSrcList = computed(() => {
if (!props.src) { if (!props.src) {
return []; return [];
} }
let real_src_list = props.src.split(','); const real_src_list = props.src.split(',');
let srcList: string[] = []; const srcList: string[] = [];
real_src_list.forEach((item: string) => { real_src_list.forEach((item: string) => {
if (item.trim() === '') { if (item.trim() === '') {
return; return;

View File

@ -189,7 +189,7 @@ const handleUploadSuccess = (res: any, file: UploadFile) => {
const handleDelete = (file: UploadFile): boolean => { const handleDelete = (file: UploadFile): boolean => {
const findex = fileList.value.map((f) => f.name).indexOf(file.name); const findex = fileList.value.map((f) => f.name).indexOf(file.name);
if (findex > -1 && uploadList.value.length === number.value) { if (findex > -1 && uploadList.value.length === number.value) {
let ossId = fileList.value[findex].ossId; const ossId = fileList.value[findex].ossId;
delOss(ossId); delOss(ossId);
fileList.value.splice(findex, 1); fileList.value.splice(findex, 1);
emit('update:modelValue', listToString(fileList.value)); emit('update:modelValue', listToString(fileList.value));
@ -225,7 +225,7 @@ const handlePictureCardPreview = (file: any) => {
const listToString = (list: any[], separator?: string) => { const listToString = (list: any[], separator?: string) => {
let strs = ''; let strs = '';
separator = separator || ','; separator = separator || ',';
for (let i in list) { for (const i in list) {
if (undefined !== list[i].ossId && list[i].url.indexOf('blob:') !== 0) { if (undefined !== list[i].ossId && list[i].url.indexOf('blob:') !== 0) {
strs += list[i].ossId + separator; strs += list[i].ossId + separator;
} }

View File

@ -47,7 +47,7 @@ const routers = computed(() => permissionStore.getTopbarRoutes());
// //
const topMenus = computed(() => { const topMenus = computed(() => {
let topMenus: RouteRecordRaw[] = []; const topMenus: RouteRecordRaw[] = [];
routers.value.map((menu) => { routers.value.map((menu) => {
if (menu.hidden !== true) { if (menu.hidden !== true) {
// //
@ -63,7 +63,7 @@ const topMenus = computed(() => {
// //
const childrenMenus = computed(() => { const childrenMenus = computed(() => {
let childrenMenus: RouteRecordRaw[] = []; const childrenMenus: RouteRecordRaw[] = [];
routers.value.map((router) => { routers.value.map((router) => {
router.children?.forEach((item) => { router.children?.forEach((item) => {
if (item.parentPath === undefined) { if (item.parentPath === undefined) {
@ -118,7 +118,7 @@ const handleSelect = (key: string) => {
// //
const routeMenu = childrenMenus.value.find((item) => item.path === key); const routeMenu = childrenMenus.value.find((item) => item.path === key);
if (routeMenu && routeMenu.query) { if (routeMenu && routeMenu.query) {
let query = JSON.parse(routeMenu.query); const query = JSON.parse(routeMenu.query);
router.push({ path: key, query: query }); router.push({ path: key, query: query });
} else { } else {
router.push({ path: key }); router.push({ path: key });
@ -132,7 +132,7 @@ const handleSelect = (key: string) => {
}; };
const activeRoutes = (key: string) => { const activeRoutes = (key: string) => {
let routes: RouteRecordRaw[] = []; const routes: RouteRecordRaw[] = [];
if (childrenMenus.value && childrenMenus.value.length > 0) { if (childrenMenus.value && childrenMenus.value.length > 0) {
childrenMenus.value.map((item) => { childrenMenus.value.map((item) => {
if (key == item.parentPath || (key == 'index' && '' == item.path)) { if (key == item.parentPath || (key == 'index' && '' == item.path)) {

View File

@ -40,16 +40,16 @@ watch(
); );
onMounted(() => { onMounted(() => {
addIframe() addIframe();
}) });
watchEffect(() => { watchEffect(() => {
addIframe() addIframe();
}) });
function addIframe() { function addIframe() {
if (route.meta.link) { if (route.meta.link) {
useTagsViewStore().addIframeView(route) useTagsViewStore().addIframeView(route);
} }
} }
</script> </script>

View File

@ -18,7 +18,7 @@ const tagsViewStore = useTagsViewStore();
function iframeUrl(url: string | undefined, query: any) { function iframeUrl(url: string | undefined, query: any) {
if (Object.keys(query).length > 0) { if (Object.keys(query).length > 0) {
let params = Object.keys(query) const params = Object.keys(query)
.map((key) => key + '=' + query[key]) .map((key) => key + '=' + query[key])
.join('&'); .join('&');
return url + '?' + params; return url + '?' + params;

View File

@ -98,7 +98,7 @@ import { dynamicClear, dynamicTenant } from '@/api/system/tenant';
import { TenantVO } from '@/api/types'; import { TenantVO } from '@/api/types';
import notice from './notice/index.vue'; import notice from './notice/index.vue';
import router from '@/router'; import router from '@/router';
import {ElMessageBoxOptions} from "element-plus/es/components/message-box/src/message-box.type"; import { ElMessageBoxOptions } from 'element-plus/es/components/message-box/src/message-box.type';
const appStore = useAppStore(); const appStore = useAppStore();
const userStore = useUserStore(); const userStore = useUserStore();

View File

@ -86,7 +86,7 @@ const resolvePath = (routePath: string, routeQuery?: string): any => {
return props.basePath; return props.basePath;
} }
if (routeQuery) { if (routeQuery) {
let query = JSON.parse(routeQuery); const query = JSON.parse(routeQuery);
return { path: getNormalPath(props.basePath + '/' + routePath), query: query }; return { path: getNormalPath(props.basePath + '/' + routePath), query: query };
} }
return getNormalPath(props.basePath + '/' + routePath); return getNormalPath(props.basePath + '/' + routePath);

View File

@ -63,9 +63,9 @@ const loginByCode = async (data: LoginData) => {
const init = async () => { const init = async () => {
// //
let host = window.location.host; const host = window.location.host;
if (domain !== host) { if (domain !== host) {
let urlFull = new URL(window.location.href); const urlFull = new URL(window.location.href);
urlFull.host = domain; urlFull.host = domain;
window.location.href = urlFull.toString(); window.location.href = urlFull.toString();
return; return;

View File

@ -67,7 +67,7 @@ const closeSearch = () => {
}; };
// //
const menuSearch = (queryString: string, cb: (options: any[]) => void) => { const menuSearch = (queryString: string, cb: (options: any[]) => void) => {
let options = state.menuList.filter((item) => { const options = state.menuList.filter((item) => {
return item.title.indexOf(queryString) > -1; return item.title.indexOf(queryString) > -1;
}); });
cb(options); cb(options);

View File

@ -14,8 +14,8 @@ NProgress.configure({ showSpinner: false });
const whiteList = ['/login', '/register', '/social-callback', '/register*', '/register/*']; const whiteList = ['/login', '/register', '/social-callback', '/register*', '/register/*'];
const isWhiteList = (path: string) => { const isWhiteList = (path: string) => {
return whiteList.some(pattern => isPathMatch(pattern, path)) return whiteList.some((pattern) => isPathMatch(pattern, path));
} };
router.beforeEach(async (to, from, next) => { router.beforeEach(async (to, from, next) => {
NProgress.start(); NProgress.start();

View File

@ -1,4 +1,4 @@
import { createPinia } from "pinia"; import { createPinia } from 'pinia';
const store = createPinia(); const store = createPinia();

View File

@ -99,14 +99,14 @@ export const usePermissionStore = defineStore('permission', () => {
}; };
const filterChildren = (childrenMap: RouteRecordRaw[], lastRouter?: RouteRecordRaw): RouteRecordRaw[] => { const filterChildren = (childrenMap: RouteRecordRaw[], lastRouter?: RouteRecordRaw): RouteRecordRaw[] => {
let children: RouteRecordRaw[] = []; let children: RouteRecordRaw[] = [];
childrenMap.forEach(el => { childrenMap.forEach((el) => {
el.path = lastRouter ? lastRouter.path + '/' + el.path : el.path; el.path = lastRouter ? lastRouter.path + '/' + el.path : el.path;
if (el.children && el.children.length && el.component?.toString() === 'ParentView') { if (el.children && el.children.length && el.component?.toString() === 'ParentView') {
children = children.concat(filterChildren(el.children, el)); children = children.concat(filterChildren(el.children, el));
} else { } else {
children.push(el); children.push(el);
} }
}) });
return children; return children;
}; };
return { return {

View File

@ -5,7 +5,6 @@ import { useStorage } from '@vueuse/core';
import { ref } from 'vue'; import { ref } from 'vue';
export const useSettingsStore = defineStore('setting', () => { export const useSettingsStore = defineStore('setting', () => {
// @ts-ignore
const storageSetting = useStorage<LayoutSetting>('layout-setting', { const storageSetting = useStorage<LayoutSetting>('layout-setting', {
topNav: defaultSettings.topNav, topNav: defaultSettings.topNav,
tagsView: defaultSettings.tagsView, tagsView: defaultSettings.tagsView,

View File

@ -48,4 +48,3 @@ export type ObjKeysToUnion<T, P extends string = ''> = T extends object
[K in keyof T]: ObjKeysToUnion<T[K], P extends '' ? `${K & string}` : `${P}.${K & string}`>; [K in keyof T]: ObjKeysToUnion<T[K], P extends '' ? `${K & string}` : `${P}.${K & string}`>;
}[keyof T] }[keyof T]
: P; : P;

View File

@ -178,11 +178,11 @@ export const handleTree = <T>(data: any[], id?: string, parentId?: string, child
for (const d of data) { for (const d of data) {
const parentId = d[config.parentId]; const parentId = d[config.parentId];
const parentObj = childrenListMap[parentId] const parentObj = childrenListMap[parentId];
if (!parentObj) { if (!parentObj) {
tree.push(d); tree.push(d);
} else { } else {
parentObj[config.childrenList].push(d) parentObj[config.childrenList].push(d);
} }
} }
return tree; return tree;

View File

@ -22,7 +22,7 @@
<script setup lang="ts"> <script setup lang="ts">
import errImage from '@/assets/401_images/401.gif'; import errImage from '@/assets/401_images/401.gif';
let { proxy } = getCurrentInstance() as ComponentInternalInstance; const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const errGif = ref(errImage + '?' + +new Date()); const errGif = ref(errImage + '?' + +new Date());

View File

@ -22,7 +22,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
let message = computed(() => { const message = computed(() => {
return '找不到网页!'; return '找不到网页!';
}); });
</script> </script>

View File

@ -203,7 +203,6 @@ onMounted(() => {
line-height: 0; line-height: 0;
color: #7483a3; color: #7483a3;
} }
} }
.register-form { .register-form {

View File

@ -300,7 +300,7 @@ const handleExport = () => {
/** 状态修改 */ /** 状态修改 */
const handleStatusChange = async (row: ClientVO) => { const handleStatusChange = async (row: ClientVO) => {
let text = row.status === '0' ? '启用' : '停用'; const text = row.status === '0' ? '启用' : '停用';
try { try {
await proxy?.$modal.confirm('确认要"' + text + '"吗?'); await proxy?.$modal.confirm('确认要"' + text + '"吗?');
await changeStatus(row.clientId, row.status); await changeStatus(row.clientId, row.status);

View File

@ -89,14 +89,14 @@
<el-form-item label="访问站点" prop="endpoint"> <el-form-item label="访问站点" prop="endpoint">
<el-input v-model="form.endpoint" placeholder="请输入访问站点"> <el-input v-model="form.endpoint" placeholder="请输入访问站点">
<template #prefix> <template #prefix>
<span style="color: #999;">{{ protocol }}</span> <span style="color: #999">{{ protocol }}</span>
</template> </template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="自定义域名" prop="domain"> <el-form-item label="自定义域名" prop="domain">
<el-input v-model="form.domain" placeholder="请输入自定义域名"> <el-input v-model="form.domain" placeholder="请输入自定义域名">
<template #prefix> <template #prefix>
<span style="color: #999;">{{ protocol }}</span> <span style="color: #999">{{ protocol }}</span>
</template> </template>
</el-input> </el-input>
</el-form-item> </el-form-item>
@ -316,7 +316,7 @@ const submitForm = () => {
}; };
/** 状态修改 */ /** 状态修改 */
const handleStatusChange = async (row: OssConfigVO) => { const handleStatusChange = async (row: OssConfigVO) => {
let text = row.status === '0' ? '启用' : '停用'; const text = row.status === '0' ? '启用' : '停用';
try { try {
await proxy?.$modal.confirm('确认要"' + text + '""' + row.configKey + '"配置吗?'); await proxy?.$modal.confirm('确认要"' + text + '""' + row.configKey + '"配置吗?');
await changeOssConfigStatus(row.ossConfigId, row.status, row.configKey); await changeOssConfigStatus(row.ossConfigId, row.status, row.configKey);

View File

@ -255,9 +255,9 @@ const handleHeaderCLick = (column: any) => {
handleOrderChange(column.property, column.multiOrder); handleOrderChange(column.property, column.multiOrder);
}; };
const handleOrderChange = (prop: string, order: string) => { const handleOrderChange = (prop: string, order: string) => {
let orderByArr = queryParams.value.orderByColumn ? queryParams.value.orderByColumn.split(',') : []; const orderByArr = queryParams.value.orderByColumn ? queryParams.value.orderByColumn.split(',') : [];
let isAscArr = queryParams.value.isAsc ? queryParams.value.isAsc.split(',') : []; const isAscArr = queryParams.value.isAsc ? queryParams.value.isAsc.split(',') : [];
let propIndex = orderByArr.indexOf(prop); const propIndex = orderByArr.indexOf(prop);
if (propIndex !== -1) { if (propIndex !== -1) {
if (order) { if (order) {
// //
@ -306,7 +306,7 @@ const handleDownload = (row: OssVO) => {
}; };
/** 预览开关按钮 */ /** 预览开关按钮 */
const handlePreviewListResource = async (preview: boolean) => { const handlePreviewListResource = async (preview: boolean) => {
let text = preview ? '启用' : '停用'; const text = preview ? '启用' : '停用';
try { try {
await proxy?.$modal.confirm('确认要"' + text + '""预览列表图片"配置吗?'); await proxy?.$modal.confirm('确认要"' + text + '""预览列表图片"配置吗?');
await proxy?.updateConfigByKey('sys.oss.previewListResource', preview); await proxy?.updateConfigByKey('sys.oss.previewListResource', preview);

View File

@ -323,7 +323,7 @@ const handleSelectionChange = (selection: RoleVO[]) => {
/** 角色状态修改 */ /** 角色状态修改 */
const handleStatusChange = async (row: RoleVO) => { const handleStatusChange = async (row: RoleVO) => {
let text = row.status === '0' ? '启用' : '停用'; const text = row.status === '0' ? '启用' : '停用';
try { try {
await proxy?.$modal.confirm('确认要"' + text + '""' + row.roleName + '"角色吗?'); await proxy?.$modal.confirm('确认要"' + text + '""' + row.roleName + '"角色吗?');
await changeRoleStatus(row.roleId, row.status); await changeRoleStatus(row.roleId, row.status);
@ -346,11 +346,11 @@ const getMenuTreeselect = async () => {
/** 所有部门节点数据 */ /** 所有部门节点数据 */
const getDeptAllCheckedKeys = (): any => { const getDeptAllCheckedKeys = (): any => {
// //
let checkedKeys = deptRef.value?.getCheckedKeys(); const checkedKeys = deptRef.value?.getCheckedKeys();
// //
let halfCheckedKeys = deptRef.value?.getHalfCheckedKeys(); const halfCheckedKeys = deptRef.value?.getHalfCheckedKeys();
if (halfCheckedKeys) { if (halfCheckedKeys) {
checkedKeys?.unshift.apply(checkedKeys, halfCheckedKeys); checkedKeys?.unshift(...halfCheckedKeys);
} }
return checkedKeys; return checkedKeys;
}; };
@ -404,14 +404,14 @@ const getRoleDeptTreeSelect = async (roleId: string | number) => {
/** 树权限(展开/折叠)*/ /** 树权限(展开/折叠)*/
const handleCheckedTreeExpand = (value: boolean, type: string) => { const handleCheckedTreeExpand = (value: boolean, type: string) => {
if (type == 'menu') { if (type == 'menu') {
let treeList = menuOptions.value; const treeList = menuOptions.value;
for (let i = 0; i < treeList.length; i++) { for (let i = 0; i < treeList.length; i++) {
if (menuRef.value) { if (menuRef.value) {
menuRef.value.store.nodesMap[treeList[i].id].expanded = value; menuRef.value.store.nodesMap[treeList[i].id].expanded = value;
} }
} }
} else if (type == 'dept') { } else if (type == 'dept') {
let treeList = deptOptions.value; const treeList = deptOptions.value;
for (let i = 0; i < treeList.length; i++) { for (let i = 0; i < treeList.length; i++) {
if (deptRef.value) { if (deptRef.value) {
deptRef.value.store.nodesMap[treeList[i].id].expanded = value; deptRef.value.store.nodesMap[treeList[i].id].expanded = value;
@ -438,11 +438,11 @@ const handleCheckedTreeConnect = (value: any, type: string) => {
/** 所有菜单节点数据 */ /** 所有菜单节点数据 */
const getMenuAllCheckedKeys = (): any => { const getMenuAllCheckedKeys = (): any => {
// //
let checkedKeys = menuRef.value?.getCheckedKeys(); const checkedKeys = menuRef.value?.getCheckedKeys();
// //
let halfCheckedKeys = menuRef.value?.getHalfCheckedKeys(); const halfCheckedKeys = menuRef.value?.getHalfCheckedKeys();
if (halfCheckedKeys) { if (halfCheckedKeys) {
checkedKeys?.unshift.apply(checkedKeys, halfCheckedKeys); checkedKeys?.unshift(...halfCheckedKeys);
} }
return checkedKeys; return checkedKeys;
}; };

View File

@ -245,7 +245,7 @@ const getList = async () => {
// //
const handleStatusChange = async (row: TenantVO) => { const handleStatusChange = async (row: TenantVO) => {
let text = row.status === '0' ? '启用' : '停用'; const text = row.status === '0' ? '启用' : '停用';
try { try {
await proxy?.$modal.confirm('确认要"' + text + '""' + row.companyName + '"租户吗?'); await proxy?.$modal.confirm('确认要"' + text + '""' + row.companyName + '"租户吗?');
await changeTenantStatus(row.id, row.tenantId, row.status); await changeTenantStatus(row.id, row.tenantId, row.status);
@ -361,7 +361,7 @@ const handleExport = () => {
/**同步租户字典*/ /**同步租户字典*/
const handleSyncTenantDict = async () => { const handleSyncTenantDict = async () => {
await proxy?.$modal.confirm('确认要同步所有租户字典吗?'); await proxy?.$modal.confirm('确认要同步所有租户字典吗?');
let res = await syncTenantDict(); const res = await syncTenantDict();
proxy?.$modal.msgSuccess(res.msg); proxy?.$modal.msgSuccess(res.msg);
}; };

View File

@ -167,11 +167,11 @@ const getMenuTreeselect = async () => {
// //
const getMenuAllCheckedKeys = (): any => { const getMenuAllCheckedKeys = (): any => {
// //
let checkedKeys = menuTreeRef.value?.getCheckedKeys(); const checkedKeys = menuTreeRef.value?.getCheckedKeys();
// //
let halfCheckedKeys = menuTreeRef.value?.getHalfCheckedKeys(); const halfCheckedKeys = menuTreeRef.value?.getHalfCheckedKeys();
if (halfCheckedKeys) { if (halfCheckedKeys) {
checkedKeys?.unshift.apply(checkedKeys, halfCheckedKeys); checkedKeys?.unshift(...halfCheckedKeys);
} }
return checkedKeys; return checkedKeys;
}; };
@ -194,7 +194,7 @@ const getList = async () => {
// //
const handleStatusChange = async (row: TenantPkgVO) => { const handleStatusChange = async (row: TenantPkgVO) => {
let text = row.status === '0' ? '启用' : '停用'; const text = row.status === '0' ? '启用' : '停用';
const [err] = await to(proxy?.$modal.confirm('确认要"' + text + '""' + row.packageName + '"套餐吗?') as Promise<any>); const [err] = await to(proxy?.$modal.confirm('确认要"' + text + '""' + row.packageName + '"套餐吗?') as Promise<any>);
if (err) { if (err) {
row.status = row.status === '0' ? '1' : '0'; row.status = row.status === '0' ? '1' : '0';
@ -241,7 +241,7 @@ const handleSelectionChange = (selection: TenantPkgVO[]) => {
// / // /
const handleCheckedTreeExpand = (value: CheckboxValueType, type: string) => { const handleCheckedTreeExpand = (value: CheckboxValueType, type: string) => {
if (type == 'menu') { if (type == 'menu') {
let treeList = menuOptions.value; const treeList = menuOptions.value;
for (let i = 0; i < treeList.length; i++) { for (let i = 0; i < treeList.length; i++) {
if (menuTreeRef.value) { if (menuTreeRef.value) {
menuTreeRef.value.store.nodesMap[treeList[i].id].expanded = value as boolean; menuTreeRef.value.store.nodesMap[treeList[i].id].expanded = value as boolean;

View File

@ -95,7 +95,7 @@ const getRowKey = (row: RoleVO): string => {
}; };
/** 检查角色状态 */ /** 检查角色状态 */
const checkSelectable = (row: RoleVO): boolean => { const checkSelectable = (row: RoleVO): boolean => {
return row.status === "0"; return row.status === '0';
}; };
/** 关闭按钮 */ /** 关闭按钮 */
const close = () => { const close = () => {

View File

@ -498,7 +498,7 @@ const handleDelete = async (row?: UserVO) => {
/** 用户状态修改 */ /** 用户状态修改 */
const handleStatusChange = async (row: UserVO) => { const handleStatusChange = async (row: UserVO) => {
let text = row.status === '0' ? '启用' : '停用'; const text = row.status === '0' ? '启用' : '停用';
try { try {
await proxy?.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?'); await proxy?.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?');
await api.changeUserStatus(row.userId, row.status); await api.changeUserStatus(row.userId, row.status);

View File

@ -134,7 +134,7 @@ const beforeUpload = (file: UploadRawFile): any => {
/** 上传图片 */ /** 上传图片 */
const uploadImg = async () => { const uploadImg = async () => {
cropper.value.getCropBlob(async (data: any) => { cropper.value.getCropBlob(async (data: any) => {
let formData = new FormData(); const formData = new FormData();
formData.append('avatarfile', data, options.fileName); formData.append('avatarfile', data, options.fileName);
const res = await uploadAvatar(formData); const res = await uploadAvatar(formData);
open.value = false; open.value = false;

View File

@ -88,17 +88,16 @@
</template> </template>
<script setup name="Category" lang="ts"> <script setup name="Category" lang="ts">
import { listCategory, getCategory, delCategory, addCategory, updateCategory } from "@/api/workflow/category"; import { listCategory, getCategory, delCategory, addCategory, updateCategory } from '@/api/workflow/category';
import { CategoryVO, CategoryQuery, CategoryForm } from '@/api/workflow/category/types'; import { CategoryVO, CategoryQuery, CategoryForm } from '@/api/workflow/category/types';
type CategoryOption = { type CategoryOption = {
categoryId: number; categoryId: number;
categoryName: string; categoryName: string;
children?: CategoryOption[]; children?: CategoryOption[];
} };
const { proxy } = getCurrentInstance() as ComponentInternalInstance;;
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const categoryList = ref<CategoryVO[]>([]); const categoryList = ref<CategoryVO[]>([]);
const categoryOptions = ref<CategoryOption[]>([]); const categoryOptions = ref<CategoryOption[]>([]);
@ -109,32 +108,29 @@ const loading = ref(false);
const queryFormRef = ref<ElFormInstance>(); const queryFormRef = ref<ElFormInstance>();
const categoryFormRef = ref<ElFormInstance>(); const categoryFormRef = ref<ElFormInstance>();
const categoryTableRef = ref<ElTableInstance>() const categoryTableRef = ref<ElTableInstance>();
const dialog = reactive<DialogOption>({ const dialog = reactive<DialogOption>({
visible: false, visible: false,
title: '' title: ''
}); });
const initFormData: CategoryForm = { const initFormData: CategoryForm = {
categoryId: undefined, categoryId: undefined,
categoryName: "", categoryName: '',
parentId: undefined, parentId: undefined,
orderNum: 0, orderNum: 0
} };
const data = reactive<PageData<CategoryForm, CategoryQuery>>({ const data = reactive<PageData<CategoryForm, CategoryQuery>>({
form: { ...initFormData }, form: { ...initFormData },
queryParams: { queryParams: {
categoryName: undefined, categoryName: undefined
}, },
rules: { rules: {
categoryId: [ categoryId: [{ required: true, message: '流程分类ID不能为空', trigger: 'blur' }],
{ required: true, message: "流程分类ID不能为空", trigger: "blur" } parentId: [{ required: true, message: '请选择上级分类', trigger: 'change' }],
], categoryName: [{ required: true, message: '请输入分类名称', trigger: 'blur' }]
parentId: [{ required: true, message: "请选择上级分类", trigger: "change" }],
categoryName: [{ required: true, message: "请输入分类名称", trigger: "blur" }]
} }
}); });
@ -144,19 +140,19 @@ const { queryParams, form, rules } = toRefs(data);
const getList = async () => { const getList = async () => {
loading.value = true; loading.value = true;
const res = await listCategory(queryParams.value); const res = await listCategory(queryParams.value);
const data = proxy?.handleTree<CategoryVO>(res.data, "categoryId", "parentId"); const data = proxy?.handleTree<CategoryVO>(res.data, 'categoryId', 'parentId');
if (data) { if (data) {
categoryList.value = data; categoryList.value = data;
loading.value = false; loading.value = false;
} }
} };
/** 查询流程分类下拉树结构 */ /** 查询流程分类下拉树结构 */
const getTreeselect = async () => { const getTreeselect = async () => {
const res = await listCategory(); const res = await listCategory();
categoryOptions.value = []; categoryOptions.value = [];
// //
const data = proxy?.handleTree<CategoryOption>(res.data, "categoryId", "parentId"); const data = proxy?.handleTree<CategoryOption>(res.data, 'categoryId', 'parentId');
if (data) { if (data) {
categoryOptions.value = data; // categoryOptions.value = data; //
} }
@ -166,24 +162,24 @@ const getTreeselect = async () => {
const cancel = () => { const cancel = () => {
reset(); reset();
dialog.visible = false; dialog.visible = false;
} };
// //
const reset = () => { const reset = () => {
form.value = {...initFormData} form.value = { ...initFormData };
categoryFormRef.value?.resetFields(); categoryFormRef.value?.resetFields();
} };
/** 搜索按钮操作 */ /** 搜索按钮操作 */
const handleQuery = () => { const handleQuery = () => {
getList(); getList();
} };
/** 重置按钮操作 */ /** 重置按钮操作 */
const resetQuery = () => { const resetQuery = () => {
queryFormRef.value?.resetFields(); queryFormRef.value?.resetFields();
handleQuery(); handleQuery();
} };
/** 新增按钮操作 */ /** 新增按钮操作 */
const handleAdd = (row?: CategoryVO) => { const handleAdd = (row?: CategoryVO) => {
@ -195,22 +191,22 @@ const handleAdd = (row?: CategoryVO) => {
form.value.parentId = undefined; form.value.parentId = undefined;
} }
dialog.visible = true; dialog.visible = true;
dialog.title = "添加流程分类"; dialog.title = '添加流程分类';
} };
/** 展开/折叠操作 */ /** 展开/折叠操作 */
const handleToggleExpandAll = () => { const handleToggleExpandAll = () => {
isExpandAll.value = !isExpandAll.value; isExpandAll.value = !isExpandAll.value;
toggleExpandAll(categoryList.value, isExpandAll.value) toggleExpandAll(categoryList.value, isExpandAll.value);
} };
/** 展开/折叠操作 */ /** 展开/折叠操作 */
const toggleExpandAll = (data: CategoryVO[], status: boolean) => { const toggleExpandAll = (data: CategoryVO[], status: boolean) => {
data.forEach((item) => { data.forEach((item) => {
categoryTableRef.value?.toggleRowExpansion(item, status) categoryTableRef.value?.toggleRowExpansion(item, status);
if (item.children && item.children.length > 0) toggleExpandAll(item.children, status) if (item.children && item.children.length > 0) toggleExpandAll(item.children, status);
}) });
} };
/** 修改按钮操作 */ /** 修改按钮操作 */
const handleUpdate = async (row: CategoryVO) => { const handleUpdate = async (row: CategoryVO) => {
@ -222,8 +218,8 @@ const handleUpdate = async (row: CategoryVO) => {
const res = await getCategory(row.categoryId); const res = await getCategory(row.categoryId);
Object.assign(form.value, res.data); Object.assign(form.value, res.data);
dialog.visible = true; dialog.visible = true;
dialog.title = "修改流程分类"; dialog.title = '修改流程分类';
} };
/** 提交按钮 */ /** 提交按钮 */
const submitForm = () => { const submitForm = () => {
@ -231,25 +227,25 @@ const submitForm = () => {
if (valid) { if (valid) {
buttonLoading.value = true; buttonLoading.value = true;
if (form.value.categoryId) { if (form.value.categoryId) {
await updateCategory(form.value).finally(() => buttonLoading.value = false); await updateCategory(form.value).finally(() => (buttonLoading.value = false));
} else { } else {
await addCategory(form.value).finally(() => buttonLoading.value = false); await addCategory(form.value).finally(() => (buttonLoading.value = false));
} }
proxy?.$modal.msgSuccess("操作成功"); proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false; dialog.visible = false;
getList(); getList();
} }
}); });
} };
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (row: CategoryVO) => { const handleDelete = async (row: CategoryVO) => {
await proxy?.$modal.confirm('是否确认删除"' + row.categoryName + '"的分类?'); await proxy?.$modal.confirm('是否确认删除"' + row.categoryName + '"的分类?');
loading.value = true; loading.value = true;
await delCategory(row.categoryId).finally(() => loading.value = false); await delCategory(row.categoryId).finally(() => (loading.value = false));
await getList(); await getList();
proxy?.$modal.msgSuccess("删除成功"); proxy?.$modal.msgSuccess('删除成功');
} };
onMounted(() => { onMounted(() => {
getList(); getList();

View File

@ -222,7 +222,7 @@ const handleExport = () => {
const handleCancelProcessApply = async (id: string) => { const handleCancelProcessApply = async (id: string) => {
await proxy?.$modal.confirm('是否确认撤销当前单据?'); await proxy?.$modal.confirm('是否确认撤销当前单据?');
loading.value = true; loading.value = true;
let data = { const data = {
businessId: id, businessId: id,
message: '申请人撤销流程!' message: '申请人撤销流程!'
}; };

View File

@ -4,7 +4,7 @@
</div> </div>
</template> </template>
<script setup name="WarmFlow"> <script setup name="WarmFlow" lang="ts">
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
import { onMounted } from 'vue'; import { onMounted } from 'vue';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
@ -24,7 +24,7 @@ const iframeLoaded = () => {
}; };
}; };
const open = async (definitionId, disabled) => { const open = async (definitionId, disabled) => {
let url = baseUrl + `/warm-flow-ui/index.html?id=${definitionId}&disabled=${disabled}`; const url = baseUrl + `/warm-flow-ui/index.html?id=${definitionId}&disabled=${disabled}`;
iframeUrl.value = url + '&Authorization=Bearer ' + getToken() + '&clientid=' + import.meta.env.VITE_APP_CLIENT_ID; iframeUrl.value = url + '&Authorization=Bearer ' + getToken() + '&clientid=' + import.meta.env.VITE_APP_CLIENT_ID;
}; };
/** 关闭按钮 */ /** 关闭按钮 */

View File

@ -197,7 +197,7 @@ import { categoryTree } from '@/api/workflow/category';
import { CategoryTreeVO } from '@/api/workflow/category/types'; import { CategoryTreeVO } from '@/api/workflow/category/types';
import { FlowDefinitionQuery, FlowDefinitionVo, FlowDefinitionForm } from '@/api/workflow/definition/types'; import { FlowDefinitionQuery, FlowDefinitionVo, FlowDefinitionForm } from '@/api/workflow/definition/types';
import { UploadRequestOptions, TabsPaneContext } from 'element-plus'; import { UploadRequestOptions, TabsPaneContext } from 'element-plus';
import { ElMessageBoxOptions } from "element-plus/es/components/message-box/src/message-box.type"; import { ElMessageBoxOptions } from 'element-plus/es/components/message-box/src/message-box.type';
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -326,7 +326,7 @@ const handleSelectionChange = (selection: any) => {
}; };
// //
const getPageList = async () => { const getPageList = async () => {
let query = proxy.$route.query; const query = proxy.$route.query;
if (query.activeName) { if (query.activeName) {
activeName.value = query.activeName; activeName.value = query.activeName;
} }
@ -411,7 +411,7 @@ const handlerBeforeUpload = () => {
}; };
// //
const handlerImportDefinition = (data: UploadRequestOptions): XMLHttpRequest => { const handlerImportDefinition = (data: UploadRequestOptions): XMLHttpRequest => {
let formData = new FormData(); const formData = new FormData();
uploadDialogLoading.value = true; uploadDialogLoading.value = true;
formData.append('file', data.file); formData.append('file', data.file);
formData.append('category', selectCategory.value); formData.append('category', selectCategory.value);
@ -467,7 +467,7 @@ const reset = () => {
const handleAdd = async () => { const handleAdd = async () => {
reset(); reset();
if (queryParams.value.category != '') { if (queryParams.value.category != '') {
form.value.category = queryParams.value.category form.value.category = queryParams.value.category;
} }
modelDialog.visible = true; modelDialog.visible = true;
modelDialog.title = '新增流程'; modelDialog.title = '新增流程';

View File

@ -352,7 +352,7 @@ const handleInvalid = async (row: FlowInstanceVO) => {
await proxy?.$modal.confirm('是否确认作废?'); await proxy?.$modal.confirm('是否确认作废?');
loading.value = true; loading.value = true;
if ('running' === tab.value) { if ('running' === tab.value) {
let param = { const param = {
id: row.id, id: row.id,
comment: deleteReason.value comment: deleteReason.value
}; };
@ -381,7 +381,7 @@ const handleInstanceVariable = async (row: FlowInstanceVO) => {
variableLoading.value = true; variableLoading.value = true;
variableVisible.value = true; variableVisible.value = true;
processDefinitionName.value = row.flowName; processDefinitionName.value = row.flowName;
let data = await instanceVariable(row.id); const data = await instanceVariable(row.id);
variables.value = data.data.variable; variables.value = data.data.variable;
variableLoading.value = false; variableLoading.value = false;
}; };

View File

@ -222,7 +222,7 @@ const handleCancelProcessApply = async (businessId: string) => {
await proxy?.$modal.confirm('是否确认撤销当前单据?'); await proxy?.$modal.confirm('是否确认撤销当前单据?');
loading.value = true; loading.value = true;
if ('running' === tab.value) { if ('running' === tab.value) {
let data = { const data = {
businessId: businessId, businessId: businessId,
message: '申请人撤销流程!' message: '申请人撤销流程!'
}; };