10 changed files with 251 additions and 16 deletions
@ -0,0 +1,113 @@ |
|||||
|
<template> |
||||
|
<div v-if="lists && lists.length"> |
||||
|
<el-table :data="lists" class="bg-title" style="width: 100%"> |
||||
|
<el-table-column prop="name" label="插件名称"> </el-table-column> |
||||
|
<el-table-column prop="appId" label="APPID"> </el-table-column> |
||||
|
<el-table-column prop="startUsing" label="状态" key="slot" sortable> |
||||
|
<template #default="scope"> |
||||
|
<div class="flex flex-row items-center" @click="change(scope.row)"> |
||||
|
<div :class="scope.row.startUsing ? 'point bg-green-500' : 'point bg-red-500'"></div> |
||||
|
<span style="margin-left: 10px">{{ scope.row.startUsing ? '启动' : '禁用' }}</span> |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column prop="pub" label="公开" sortable key="slot"> |
||||
|
<template #default="scope"> |
||||
|
<div class="flex flex-row items-center" @click="change(scope.row)"> |
||||
|
<div :class="scope.row.pub ? 'point bg-green-500' : 'point bg-red-500'"></div> |
||||
|
<span style="margin-left: 10px">{{ scope.row.pub ? '公开' : '非公开' }}</span> |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column prop="createTime" :formatter="changeCreateDate" label="创建日期" sortable></el-table-column> |
||||
|
<el-table-column prop="updateTime" :formatter="changeUpdateDate" label="更新日期" sortable></el-table-column> |
||||
|
<el-table-column label="操作" key="slot"> |
||||
|
<template #default="scope"> |
||||
|
<el-popconfirm |
||||
|
title="确定删除这条业务吗?" |
||||
|
confirm-button-text="确定" |
||||
|
cancel-button-text="再想想" |
||||
|
@confirm="deletePlugin(scope.row)" |
||||
|
> |
||||
|
<template #reference> |
||||
|
<el-button type="text" size="small">删除</el-button> |
||||
|
</template> |
||||
|
</el-popconfirm> |
||||
|
<el-button type="text" size="small" disabled>配置</el-button>.. |
||||
|
<el-button type="text" size="small" disabled>查看</el-button> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<template slot="empty"> |
||||
|
<p>没有记录哦~</p> |
||||
|
</template> |
||||
|
</el-table> |
||||
|
</div> |
||||
|
<el-empty v-else description="暂无业务信息"></el-empty> |
||||
|
</template> |
||||
|
|
||||
|
<script setup> |
||||
|
import { defineProps, defineEmits } from 'vue'; |
||||
|
import time from 'utils/time'; |
||||
|
import { ElMessage } from 'element-plus'; |
||||
|
import { delPlugin } from '@/apis/plugin.js'; |
||||
|
|
||||
|
defineProps({ |
||||
|
lists: { default: () => [], type: Array }, |
||||
|
currentPage: { default: 1, type: Number }, |
||||
|
pageSize: { default: 10, type: Number }, |
||||
|
total: { default: 0, type: Number }, |
||||
|
showConfig: { default: false, type: Boolean }, |
||||
|
}); |
||||
|
|
||||
|
const emit = defineEmits(['handleQueryPlugins']); |
||||
|
|
||||
|
function change(row) { |
||||
|
console.log('row: ', row); |
||||
|
} |
||||
|
|
||||
|
function changeCreateDate(row) { |
||||
|
const value = row && row.createTime ? row.createTime : ''; |
||||
|
return time.dateFormat(value); |
||||
|
} |
||||
|
|
||||
|
function changeUpdateDate(row) { |
||||
|
const value = row && row.updateTime ? row.updateTime : ''; |
||||
|
return time.dateFormat(value); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除插件 |
||||
|
* @param {String} businessId |
||||
|
*/ |
||||
|
async function deletePlugin(row) { |
||||
|
try { |
||||
|
const params = { param: { id: row.id } }; |
||||
|
await delPlugin(params); |
||||
|
ElMessage.success('删除成功'); |
||||
|
emit('handleQueryPlugins'); |
||||
|
} catch (error) { |
||||
|
console.error('error: ', error); |
||||
|
ElMessage.error(error || '删除失败'); |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped> |
||||
|
.bg-title >>> thead tr th { |
||||
|
color: #333; |
||||
|
background: #fafafa; |
||||
|
border-top: 1px solid #e8e8e8; |
||||
|
} |
||||
|
.bg-title >>> thead tr th:first-child { |
||||
|
border-left: 1px solid #e8e8e8; |
||||
|
} |
||||
|
.bg-title >>> thead tr th:last-child { |
||||
|
border-right: 1px solid #e8e8e8; |
||||
|
} |
||||
|
|
||||
|
.point { |
||||
|
width: 6px; |
||||
|
height: 6px; |
||||
|
border-radius: 50%; |
||||
|
} |
||||
|
</style> |
Loading…
Reference in new issue