123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- <template>
- <el-drawer v-model="drawerVisible" :destroy-on-close="true" size="950px" :title="drawerProps.title">
- <el-tabs v-model="activeName">
- <el-tab-pane label="导入日志" name="1">
- <div class="drawer-table-box">
- <ProTable
- :columns="iColumns"
- :height="400"
- :tool-button="false"
- row-key="id"
- :init-param="{ type: '0' }"
- :request-api="listImportExportApi"
- >
- <template #status="scope">
- <div class="i-text">
- <span v-show="scope.row.status == 1" style="margin-right: 8px">
- <i class="dot-class" style="background-color: #67c23a"></i>
- </span>
- <span v-show="scope.row.status == 0" style="margin-right: 8px">
- <i class="dot-class" style="background-color: #f56c6c"></i>
- </span>
- <span v-show="scope.row.status == 2" style="margin-right: 8px">
- <i class="dot-class" style="background-color: #e6a23c"></i>
- </span>
- <span> </span>
- </div>
- </template>
- <!-- 表格操作 -->
- <template #operation="scope">
- <el-button type="primary" link @click="handleDownload(scope.row)"> 下载 </el-button>
- <el-button type="primary" link @click="handleLog(scope.row)"> 日志 </el-button>
- </template>
- </ProTable>
- </div>
- </el-tab-pane>
- <el-tab-pane label="导出日志" name="second">
- <div class="drawer-table-box">
- <ProTable
- :columns="eColumns"
- :height="400"
- :tool-button="false"
- row-key="id"
- :init-param="{ type: '1' }"
- :request-api="listImportExportApi"
- >
- <!-- 表格操作 -->
- <template #operation="scope">
- <el-button type="primary" link @click="handleDownload(scope.row)"> 下载 </el-button>
- <el-button type="primary" link @click="handleLog(scope.row)"> 日志 </el-button>
- </template>
- </ProTable>
- </div>
- </el-tab-pane>
- </el-tabs>
- </el-drawer>
- </template>
- <script setup lang="ts" name="IEDrawer">
- import { ColumnProps } from '@/components/ProTable/interface'
- import { listImportExportApi } from '@/api/modules/system/importExport'
- import useDownload from '@/hooks/useDownload'
- import { ImportExportVO } from '@/api/interface/system/importExport'
- import { ElMessageBox } from 'element-plus'
- const { proxy } = getCurrentInstance() as ComponentInternalInstance
- const { excel_status } = toRefs<any>(proxy?.useDict('excel_status'))
- const activeName = ref('1')
- interface DrawerProps {
- title: string
- }
- const drawerVisible = ref(false)
- const drawerProps = ref<DrawerProps>({
- title: '我的导入导出'
- })
- // const tableData = [
- // {
- // id: 11,
- // name: 'Tom',
- // status: '1',
- // createBy: 'wanggaokun',
- // updateTime: '2024-06-21 17:25:33'
- // }
- // ]
- /** 下载按钮操作 */
- const handleDownload = (row: ImportExportVO) => {
- useDownload.oss(row.ossId)
- }
- const handleLog = (row: ImportExportVO) => {
- ElMessageBox.alert(row.logInfo, '日志信息', {
- dangerouslyUseHTMLString: true
- })
- }
- // 导入信息表格配置项
- const iColumns = reactive<ColumnProps<any>[]>([
- {
- type: 'index',
- label: '序号',
- width: 60
- },
- {
- prop: 'name',
- label: '文件名称',
- search: {
- el: 'input'
- }
- },
- {
- prop: 'status',
- label: '状态',
- enum: excel_status,
- search: {
- el: 'select'
- },
- width: 120
- },
- {
- prop: 'createBy',
- label: '操作人',
- search: {
- el: 'input'
- },
- width: 220
- },
- {
- prop: 'updateTime',
- label: '操作时间',
- search: {
- el: 'date-picker',
- props: { type: 'datetimerange', valueFormat: 'YYYY-MM-DD HH:mm:ss' }
- },
- width: 220
- },
- { prop: 'operation', label: '操作' }
- ])
- // 导出信息表格配置项
- const eColumns = reactive<ColumnProps<any>[]>([
- {
- type: 'index',
- label: '序号',
- width: 60
- },
- {
- prop: 'name',
- label: '文件名称',
- search: {
- el: 'input'
- }
- },
- {
- prop: 'createBy',
- label: '操作人',
- width: 220
- },
- {
- prop: 'updateTime',
- label: '操作时间',
- width: 220
- },
- {
- prop: 'status',
- label: '状态',
- tag: true,
- enum: excel_status,
- search: {
- el: 'select'
- },
- width: 120
- },
- { prop: 'operation', label: '操作' }
- ])
- // 接收父组件传过来的参数
- const acceptParams = () => {
- drawerVisible.value = true
- }
- defineExpose({
- acceptParams
- })
- </script>
- <style scoped lang="scss">
- .dot-class {
- display: block;
- width: 10px;
- height: 10px;
- margin-left: 10px; // 这个用于圆点居中
- border-radius: 50%;
- }
- .i-text {
- display: flex;
- align-items: center;
- justify-content: center;
- }
- </style>
|