mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2025-09-08 22:57:11 +08:00
chore: 优化部分代码
This commit is contained in:
@@ -94,7 +94,7 @@ const columns: TableInstanceColumns[] = [
|
||||
},
|
||||
{ title: '标签', dataIndex: 'label', slotName: 'label', width: 100, align: 'center' },
|
||||
{ title: '值', dataIndex: 'value', width: 100, align: 'center', ellipsis: true, tooltip: true },
|
||||
{ title: '状态', slotName: 'status', width: 90, align: 'center' },
|
||||
{ title: '状态', slotName: 'status', width: 80, align: 'center' },
|
||||
{
|
||||
title: '排序',
|
||||
dataIndex: 'sort',
|
||||
|
@@ -13,9 +13,9 @@
|
||||
<a-trigger v-model:popup-visible="node.popupVisible" trigger="contextMenu" align-point
|
||||
animation-name="slide-dynamic-origin" auto-fit-transform-origin position="bl" scroll-to-close>
|
||||
<a-tooltip v-if="node.description" :content="node.description" background-color="rgb(var(--primary-6))" position="right">
|
||||
<div @contextmenu="onContextmenu(node)">{{ node.name }}({{ node.code }})</div>
|
||||
<div @contextmenu="onContextmenu(node)">{{ node.name }} ({{ node.code }})</div>
|
||||
</a-tooltip>
|
||||
<div v-else @contextmenu="onContextmenu(node)">{{ node.name }}({{ node.code }})</div>
|
||||
<div v-else @contextmenu="onContextmenu(node)">{{ node.name }} ({{ node.code }})</div>
|
||||
<template #content>
|
||||
<RightMenu v-if="has.hasPermOr(['system:dict:update', 'system:dict:delete'])" :data="node"
|
||||
@on-menu-item-click="onMenuItemClick" />
|
||||
|
@@ -85,7 +85,7 @@ import {
|
||||
import FileGrid from './FileGrid.vue'
|
||||
import useFileManage from './useFileManage'
|
||||
import { useTable } from '@/hooks'
|
||||
import { type FileItem, type FilePageQuery, type FileQuery, deleteFile, listFile, uploadFile } from '@/apis'
|
||||
import { type FileItem, type FileQuery, deleteFile, listFile, uploadFile } from '@/apis'
|
||||
import { ImageTypes } from '@/constant/file'
|
||||
import 'viewerjs/dist/viewer.css'
|
||||
import { downloadByUrl } from '@/utils/downloadFile'
|
||||
@@ -187,19 +187,19 @@ const handleMulDelete = () => {
|
||||
const handleUpload = (options: RequestOption) => {
|
||||
const controller = new AbortController()
|
||||
; (async function requestWrap() {
|
||||
const { onProgress, onError, onSuccess, fileItem, name = 'file' } = options
|
||||
onProgress(20)
|
||||
const formData = new FormData()
|
||||
formData.append(name as string, fileItem.file as Blob)
|
||||
try {
|
||||
const res = await uploadFile(formData)
|
||||
Message.success('上传成功')
|
||||
onSuccess(res)
|
||||
search()
|
||||
} catch (error) {
|
||||
onError(error)
|
||||
}
|
||||
})()
|
||||
const { onProgress, onError, onSuccess, fileItem, name = 'file' } = options
|
||||
onProgress(20)
|
||||
const formData = new FormData()
|
||||
formData.append(name as string, fileItem.file as Blob)
|
||||
try {
|
||||
const res = await uploadFile(formData)
|
||||
Message.success('上传成功')
|
||||
onSuccess(res)
|
||||
search()
|
||||
} catch (error) {
|
||||
onError(error)
|
||||
}
|
||||
})()
|
||||
return {
|
||||
abort() {
|
||||
controller.abort()
|
||||
@@ -243,7 +243,7 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
.pagination {
|
||||
margin: 10px 0;
|
||||
padding: 0 var(--padding) var(--padding);
|
||||
|
||||
:deep(.arco-pagination) {
|
||||
justify-content: end;
|
||||
|
@@ -71,7 +71,7 @@
|
||||
<template #action="{ record }">
|
||||
<a-space>
|
||||
<a-link v-permission="['system:menu:update']" @click="onUpdate(record)">修改</a-link>
|
||||
<a-link v-if="[1, 2].includes(record.type)" v-permission="['system:menu:add']" @click="onAdd(record.id)">
|
||||
<a-link v-permission="['system:menu:add']" :disabled="![1, 2].includes(record.type)" @click="onAdd(record.id)">
|
||||
新增
|
||||
</a-link>
|
||||
<a-link v-permission="['system:menu:delete']" status="danger" @click="onDelete(record)">删除</a-link>
|
||||
|
Reference in New Issue
Block a user