|
|
@@ -12,21 +12,77 @@
|
|
|
</div><% } %>
|
|
|
<script>
|
|
|
function pushConfig(id) {
|
|
|
- var ver = prompt('配置版本号');
|
|
|
- if (ver === null) return;
|
|
|
- var jar = prompt('目标JAR版本(留空不升级)');
|
|
|
- if (jar === null) return;
|
|
|
- var json = prompt('配置JSON(留空不修改配置)');
|
|
|
- if (json === null) return;
|
|
|
- $.post('${ctx}/mes/clientRuntime/command', {
|
|
|
- id: id,
|
|
|
- desiredJarVersion: jar === '' ? null : jar,
|
|
|
- desiredConfigVersion: ver === '' ? null : ver,
|
|
|
- desiredConfigJson: json
|
|
|
- }, function (d) {
|
|
|
- js.showMessage(d.message || '已下发');
|
|
|
- $('#dataGrid').trigger('reloadGrid');
|
|
|
- }, 'json');
|
|
|
+ $.getJSON('${ctx}/mes/clientRuntime/get', {id: id}, function(resp) {
|
|
|
+ if (!resp || resp.result !== 'true' || !resp.data) {
|
|
|
+ js.showMessage('未找到该客户端');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var row = resp.data;
|
|
|
+
|
|
|
+ var html = ''
|
|
|
+ + '<div style="padding:18px 24px">'
|
|
|
+ + '<div class="form-group">'
|
|
|
+ + '<label>客户端:</label> '
|
|
|
+ + '<b>' + (row.clientType || '') + ' / ' + (row.stationCode || '') + ' / ' + (row.hostIp || '') + '</b>'
|
|
|
+ + ' <span style="color:#888">(当前 JAR v' + (row.jarVersion || 0) + ',配置 v' + (row.configVersion || 0) + ')</span>'
|
|
|
+ + '</div>'
|
|
|
+ + '<hr style="margin:10px 0">'
|
|
|
+ + '<div class="form-group">'
|
|
|
+ + '<label>目标 JAR 版本</label>'
|
|
|
+ + '<input type="number" id="dlgJarVer" class="form-control" placeholder="留空不升级" value="">'
|
|
|
+ + '<small style="color:#888">填写目标版本号,留空则不升级 JAR</small>'
|
|
|
+ + '</div>'
|
|
|
+ + '<div class="form-group">'
|
|
|
+ + '<label>配置内容 '
|
|
|
+ + '<button type="button" id="btnGetCurrentCfg" class="btn btn-xs btn-default">'
|
|
|
+ + '<i class="fa fa-download"></i> 获取当前配置'
|
|
|
+ + '</button>'
|
|
|
+ + '</label>'
|
|
|
+ + '<textarea id="dlgCfgJson" class="form-control" rows="8" style="font-family:Consolas,monospace;font-size:12px" placeholder="留空不修改配置"></textarea>'
|
|
|
+ + '<small style="color:#888">留空表示不修改配置。填写后客户端会覆盖本地配置文件并重启。</small>'
|
|
|
+ + '</div>'
|
|
|
+ + '</div>';
|
|
|
+
|
|
|
+ top.layer.open({
|
|
|
+ type: 1,
|
|
|
+ title: '配置 / 升级客户端',
|
|
|
+ area: ['620px', '480px'],
|
|
|
+ content: html,
|
|
|
+ btn: ['下发', '关闭'],
|
|
|
+ success: function(layero, index) {
|
|
|
+ // 绑定"获取当前配置"按钮
|
|
|
+ $(layero).find('#btnGetCurrentCfg').on('click', function() {
|
|
|
+ var cfg = row.currentConfigJson || '';
|
|
|
+ if (!cfg) {
|
|
|
+ top.layer.msg('客户端尚未上报配置(等待首次心跳)');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ $(layero).find('#dlgCfgJson').val(cfg);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ yes: function(index, layero) {
|
|
|
+ var jar = $.trim($(layero).find('#dlgJarVer').val());
|
|
|
+ var cfg = $.trim($(layero).find('#dlgCfgJson').val());
|
|
|
+ var cv = null;
|
|
|
+
|
|
|
+ if (cfg) {
|
|
|
+ // 配置版本自动 +1
|
|
|
+ cv = (row.configVersion || 0) + 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ $.post('${ctx}/mes/clientRuntime/command', {
|
|
|
+ id: id,
|
|
|
+ desiredJarVersion: jar === '' ? null : jar,
|
|
|
+ desiredConfigVersion: cv,
|
|
|
+ desiredConfigJson: cfg === '' ? null : cfg
|
|
|
+ }, function(d) {
|
|
|
+ top.layer.msg(d.message || '已下发');
|
|
|
+ top.layer.close(index);
|
|
|
+ $('#dataGrid').trigger('reloadGrid');
|
|
|
+ }, 'json');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
$('#dataGrid').dataGrid({
|