fix(系统设置): 修改查看插件脚本的请求方式

This commit is contained in:
shiziyuan9527 2022-10-20 15:33:46 +08:00 committed by lyh
parent 8a99d9eec0
commit 70020244d1
2 changed files with 9 additions and 3 deletions

View File

@ -12,6 +12,10 @@ export function delPluginById(pluginId) {
return get(`/plugin/delete/${pluginId}`); return get(`/plugin/delete/${pluginId}`);
} }
export function getPluginById(pluginId) {
return get(`/plugin/get/${pluginId}`);
}
export function addPlugin(file) { export function addPlugin(file) {
let formData = new FormData(); let formData = new FormData();
if (file) { if (file) {

View File

@ -1,6 +1,6 @@
<template> <template>
<div v-if="!loading"> <div v-if="!loading">
<el-dialog :title="$t('plugin.script_view')" :visible.sync="dialogVisible" @close="close"> <el-dialog :title="$t('plugin.script_view')" :visible.sync="dialogVisible" @close="close" v-loading="dialogLoading">
<el-tabs v-model="activeName" @tab-click="handleClick"> <el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane :label="$t('commons.form_config')" name="formOption"> <el-tab-pane :label="$t('commons.form_config')" name="formOption">
<ms-code-edit <ms-code-edit
@ -26,6 +26,7 @@
<script> <script>
import MsCodeEdit from "metersphere-frontend/src/components/MsCodeEdit"; import MsCodeEdit from "metersphere-frontend/src/components/MsCodeEdit";
import {getPluginById} from "@/api/plugin";
export default { export default {
name: "ScriptView", name: "ScriptView",
@ -39,19 +40,20 @@ export default {
modes: ['text', 'json', 'xml', 'html'], modes: ['text', 'json', 'xml', 'html'],
plugin: {}, plugin: {},
loading: false, loading: false,
dialogLoading: false
} }
}, },
methods: { methods: {
getPlugin(id) { getPlugin(id) {
if (id) { if (id) {
this.$get('/plugin/get/' + id, response => { this.dialogLoading = getPluginById(id).then(response => {
if (response.data) { if (response.data) {
this.plugin = response.data; this.plugin = response.data;
this.reload(); this.reload();
} else { } else {
this.$warning(this.$t('plugin.warning_tip')); this.$warning(this.$t('plugin.warning_tip'));
} }
}); })
} }
}, },
open(id) { open(id) {