From b323c0b96c5a0c9ab32662bd13cfac20ab3b8feb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E5=9C=A3=E5=8D=8E?= <752718920@qq.com> Date: Mon, 13 Apr 2020 00:09:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=8F=92=E4=BB=B6=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- erp_web/pages/manage/plugin.html | 184 +++++++++++++++++++------------ 1 file changed, 116 insertions(+), 68 deletions(-) diff --git a/erp_web/pages/manage/plugin.html b/erp_web/pages/manage/plugin.html index 94bf0ea8..e3cd9b4f 100644 --- a/erp_web/pages/manage/plugin.html +++ b/erp_web/pages/manage/plugin.html @@ -11,19 +11,21 @@ + +
- +
- +
@@ -33,49 +35,26 @@
-
- + - + - - - - - - - -
车牌号码插件包 - +
驾驶员 - -
车辆状态 - -
车辆归属 - + (扩展名必须为jar)
- 保存 取消
@@ -108,29 +87,35 @@ columns: [[ {field: 'id', width: 35, align: "center", checkbox: true}, { - title: '操作', field: 'op', align: "center", width: 60, + title: '操作', field: 'op', align: "center", width: 120, formatter: function (value, rec, index) { var str = ''; + str += '   '; str += '   '; - str += ''; + str += '   '; + str += ''; return str; } }, - {title: '插件Id', field: 'pluginId', width: 150, + {title: '标识', field: 'pluginId', width: 120, formatter: function(value, rec) { if (rec) { return rec.pluginDescriptor.pluginId; } } }, - {title: '插件描述', field: 'pluginDescription', width: 150, + {title: '名称', field: 'pluginName', width: 120, formatter: function(value, rec) { if (rec) { - return rec.pluginDescriptor.pluginDescription; + var desc = rec.pluginDescriptor.pluginDescription; + if(desc.indexOf("|")){ + var arr = desc.split("|"); + return arr[0]; + } } } }, - {title: '版本', field: 'pluginVersion', width: 150, + {title: '版本', field: 'pluginVersion', width: 120, formatter: function(value, rec) { if (rec) { return rec.pluginDescriptor.version; @@ -144,14 +129,24 @@ } } }, - {title: '插件路径', field: 'path', width: 400}, - {title: '插件状态', field: 'pluginState', width: 100, + {title: '页面链接', field: 'pluginUrl', width: 250, + formatter: function(value, rec) { + if (rec) { + var desc = rec.pluginDescriptor.pluginDescription; + if(desc.indexOf("|")){ + var arr = desc.split("|"); + return "" + arr[1] + ""; + } + } + } + }, + {title: '状态', field: 'pluginState', width: 100, formatter: function(value, rec) { if (rec) { if(rec.pluginState == "STARTED") { return "开启"; } else if(rec.pluginState == "STOPPED") { - return "关闭"; + return "停止"; } } } @@ -160,19 +155,11 @@ toolbar: [ { id: 'addPlugin', - text: '增加', + text: '上传插件包', iconCls: 'icon-add', handler: function () { addPlugin(); } - },'-', - { - id: 'deletePlugin', - text: '删除', - iconCls: 'icon-remove', - handler: function () { - batDeletePlugin(); - } } ], onLoadError: function () { @@ -231,6 +218,31 @@ }); } + //卸载插件 + function uninstallPlugin(pluginId) { + $.messager.confirm('卸载确认', '确定要卸载该插件吗?', function (r) { + if (r) { + $.ajax({ + type: "post", + url: "/plugin/uninstall/" + pluginId, + dataType: "json", + success: function (res) { + if(res && res.code == 200) { + $("#searchBtn").click(); + } else { + $.messager.alert('停止提示', '卸载插件失败,请稍后再试!', 'error'); + } + }, + //此处添加错误处理 + error: function () { + $.messager.alert('停止提示', '卸载插件异常,请稍后再试!', 'error'); + return; + } + }); + } + }); + } + //增加 var url; var pluginId = 0; @@ -238,31 +250,66 @@ var oldPluginNumber = ""; function addPlugin() { - $('#pluginDlg').dialog('open').dialog('setTitle', ' 增加车辆信息'); + $('#pluginDlg').dialog('open').dialog('setTitle', ' 上传插件包'); $(".window-mask").css({width: webW, height: webH}); $('#pluginFM').form('clear'); - oldPluginNumber = ""; - pluginId = 0; - url = '/api/plugin/plugin-plugin/plugin/insert'; + fileUpload(); + } + + //文件上传 + function fileUpload() { + $('#pluginFile').empty().Huploadify({ + auto:true, + fileTypeExts:'*.jar', + maxFileNumber:1, + fileSizeLimit:10240, + showUploadedPercent:true,//是否实时显示上传的百分比,如20% + showUploadedSize:true, + removeTimeout:9999999, + uploader:'/plugin/uploadInstallPluginJar', + onUploadStart:function(){ + //alert('开始上传'); + }, + onInit:function(){ + //alert('初始化'); + }, + onUploadComplete:function(){ + $("#searchBtn").click(); + alert('上传完成'); + }, + onDelete:function(file){ + console.log('删除的文件:'+file); + console.log(file); + } + }); + } + + //上传模板 + function uploadTemplate(pluginId) { + alert("上传模板"); } //开启插件 function startPlugin(pluginId) { - $.ajax({ - type: "post", - url: "/plugin/start/" + pluginId, - dataType: "json", - success: function (res) { - if(res && res.code == 200) { - $("#searchBtn").click(); - } else { - $.messager.alert('开启提示', '开启插件失败,请稍后再试!', 'error'); - } - }, - //此处添加错误处理 - error: function () { - $.messager.alert('开启提示', '开启插件异常,请稍后再试!', 'error'); - return; + $.messager.confirm('开启确认', '确定要开启该插件吗?', function (r) { + if (r) { + $.ajax({ + type: "post", + url: "/plugin/start/" + pluginId, + dataType: "json", + success: function (res) { + if(res && res.code == 200) { + $("#searchBtn").click(); + } else { + $.messager.alert('开启提示', '开启插件失败,请稍后再试!', 'error'); + } + }, + //此处添加错误处理 + error: function () { + $.messager.alert('开启提示', '开启插件异常,请稍后再试!', 'error'); + return; + } + }); } }); } @@ -288,6 +335,7 @@ url: "/plugin/list", dataType: "json", data: ({ + name: $("#searchPluginName").textbox("getValue"), currentPage: pageNo, pageSize: pageSize }), @@ -307,7 +355,7 @@ //重置按钮 $("#searchResetBtn").unbind().bind({ click: function () { - $("#searchPluginNumber").textbox("setValue",""); + $("#searchPluginName").textbox("setValue",""); //加载完以后重新初始化 $("#searchBtn").click(); }