|
@@ -1,3 +1,59 @@
|
|
|
<template>
|
|
|
- <div>文件</div>
|
|
|
+ <div class="table-box">
|
|
|
+ <ProTable ref="proTableRef" title="参数配置" row-key="filesId" :columns="columns" :search-columns="searchColumns" :request-api="getTableList">
|
|
|
+ <!-- 表格 header 按钮 -->
|
|
|
+ <template #tableHeader="scope">
|
|
|
+ <el-button type="primary" icon="CirclePlus" @click="upload()"> 上传 </el-button>
|
|
|
+ <el-button type="danger" icon="Delete" plain :disabled="!scope.isSelected" @click="batchDelete(scope.selectedListIds)"> 批量删除 </el-button>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template #operation="{ row }">
|
|
|
+ <el-button v-if="row.isLock !== '1'" type="primary" link icon="Delete" @click="deleteRow(row)"> 删除 </el-button>
|
|
|
+ </template>
|
|
|
+ </ProTable>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
+<script lang="tsx" setup name="FilesManage">
|
|
|
+import FilesApi from '@/api/module/system/files'
|
|
|
+import { ColumnProps, ProTableInstance, SearchProps } from '@/components/ProTable/interface'
|
|
|
+import { useHandleData } from '@/hooks'
|
|
|
+import { FilesQuery, FilesVO } from '@/api/interface/system/files'
|
|
|
+const proTableRef = ref<ProTableInstance>()
|
|
|
+
|
|
|
+// 表格配置项
|
|
|
+const columns: ColumnProps<FilesVO>[] = [
|
|
|
+ { type: 'selection', width: 60 },
|
|
|
+ { type: 'index', width: 60 },
|
|
|
+ { prop: 'originalName', label: '文件名称' },
|
|
|
+ { prop: 'fileName', label: '文件ID', tag: true },
|
|
|
+ { prop: 'sizeInfo', label: '文件大小' },
|
|
|
+ { prop: 'fileSuffix', label: '文件类型' },
|
|
|
+ { prop: 'createByName', label: '创建人' },
|
|
|
+ { prop: 'createTime', label: '创建时间' },
|
|
|
+ { prop: 'operation', label: '操作', width: 250, fixed: 'right' }
|
|
|
+]
|
|
|
+
|
|
|
+// 表格配置项
|
|
|
+const searchColumns: SearchProps[] = [
|
|
|
+ { prop: 'originalName', label: '文件名称', el: 'input' },
|
|
|
+ { prop: 'fileSuffix', label: '文件类型', el: 'input' }
|
|
|
+]
|
|
|
+
|
|
|
+// 获取table列表
|
|
|
+const getTableList = (params: FilesQuery) => FilesApi.page(params)
|
|
|
+
|
|
|
+// 单行删除
|
|
|
+const deleteRow = async (row: FilesVO) => {
|
|
|
+ await useHandleData(FilesApi.delete, [row.fileId], `删除【${row.originalName}】文件`)
|
|
|
+ proTableRef.value?.getTableList()
|
|
|
+}
|
|
|
+
|
|
|
+// 批量删除信息
|
|
|
+const batchDelete = async (ids: (string | number)[]) => {
|
|
|
+ await useHandleData(FilesApi.delete, ids, '删除所选数据')
|
|
|
+ proTableRef.value?.clearSelection()
|
|
|
+ proTableRef.value?.getTableList()
|
|
|
+}
|
|
|
+
|
|
|
+const upload = () => {}
|
|
|
+</script>
|