处理插件列表右键显示问题

This commit is contained in:
icssoa 2021-03-15 15:30:23 +08:00
parent 1790897400
commit 3f64f92fda

View File

@ -1,5 +1,5 @@
<template> <template>
<div> <div class="view-plugin">
<cl-crud ref="crud" :on-refresh="onRefresh" @load="onLoad"> <cl-crud ref="crud" :on-refresh="onRefresh" @load="onLoad">
<el-row type="flex" align="middle"> <el-row type="flex" align="middle">
<!-- 刷新按钮 --> <!-- 刷新按钮 -->
@ -28,7 +28,7 @@
<el-row type="flex"> <el-row type="flex">
<cl-flex1 /> <cl-flex1 />
<!-- 分页控件 --> <!-- 分页控件 -->
<cl-pagination :props="{ layout: 'total' }" /> <cl-pagination layout="total" />
</el-row> </el-row>
</cl-crud> </cl-crud>
@ -67,7 +67,7 @@ export default {
scope => { scope => {
return { return {
label: "配置", label: "配置",
hidden: !perms.edit, hidden: !perms.edit || !scope.view,
callback: (_, done) => { callback: (_, done) => {
this.openConf(scope); this.openConf(scope);
done(); done();
@ -148,6 +148,7 @@ export default {
}, },
{ {
type: "op", type: "op",
width: 120,
buttons: [ buttons: [
({ scope }) => { ({ scope }) => {
return ( return (
@ -181,6 +182,8 @@ export default {
.done(); .done();
app.refresh(); app.refresh();
}, },
//
onRefresh(params, { next, render }) { onRefresh(params, { next, render }) {
next(params).then(res => { next(params).then(res => {
render(res, { render(res, {
@ -188,6 +191,8 @@ export default {
}); });
}); });
}, },
//
onEnableChange(val, item) { onEnableChange(val, item) {
this.$service.plugin.info this.$service.plugin.info
.enable({ .enable({
@ -201,29 +206,30 @@ export default {
this.$message.error(err); this.$message.error(err);
}); });
}, },
async openConf(item) {
//
async openConf({ name, namespace, view }) {
const form = await this.$service.plugin.info.getConfig({ const form = await this.$service.plugin.info.getConfig({
namespace: item.namespace namespace
}); });
let items = []; let items = [];
try { try {
items = JSON.parse(item.view); items = JSON.parse(view);
} catch (e) { } catch (e) {
items = []; items = [];
console.error(e);
} }
this.$refs.form.open({ this.$refs.form.open({
title: `${item.name}配置`, title: `${name}配置`,
items, items,
form, form,
on: { on: {
submit: (data, { close, done }) => { submit: (data, { close, done }) => {
this.$service.plugin.info this.$service.plugin.info
.config({ .config({
namespace: item.namespace, namespace,
config: data config: data
}) })
.then(() => { .then(() => {