RuoYi/ruoyi-admin/src/main/resources/templates/template/tmplServer/edit.html

143 lines
5.1 KiB
HTML
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('修改服务器模板')"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-tmplServer-edit" th:object="${tmplServer}">
<input id="serverId" name="serverId" th:field="*{serverId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">服务器品牌:</label>
<div class="col-sm-8">
<input id="serverBrand" name="serverBrand" th:field="*{serverBrand}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">服务器型号:</label>
<div class="col-sm-8">
<input id="serverType" name="serverType" th:field="*{serverType}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">CPU主频</label>
<div class="col-sm-8">
<input id="cpuFreq" name="cpuFreq" th:field="*{cpuFreq}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">CPU数量</label>
<div class="col-sm-8">
<input id="cpuNum" name="cpuNum" th:field="*{cpuNum}" class="form-control" min=1 type="number">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">IPMI端口</label>
<div class="col-sm-8">
<input id="ipmiPort" name="ipmiPort" th:field="*{ipmiPort}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">服务器电源数量:</label>
<div class="col-sm-8">
<input id="powerNum" name="powerNum" th:field="*{powerNum}" class="form-control" min=1 type="number">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">服务器raid卡</label>
<div class="col-sm-8">
<input id="raidCard" name="raidCard" th:field="*{raidCard}" class="form-control" type="text">
</div>
</div>
<!--网卡类型字典-->
<div class="form-group" th:with="type=${@dict.getType('dict_netcard_type')}">
<div class="col-sm-6" th:each="dict : ${type}">
<div class="col-md-12">
<div class="form-group">
<label class="col-sm-6 control-label" th:text="${dict.dictLabel}"></label>
<div class="col-sm-5">
<input type="number" min="0" max="100" th:id="${dict.dictCode}"
class="form-control switchPort"
placeholder="单位(个)">
</div>
</div>
</div>
</div>
</div>
</form>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript" th:inline="javascript">
var prefix = ctx + "template/tmplServer";
$("#form-tmplServer-add").validate({
onkeyup: true,
rules: {
serverBrand: {
required: true,
minlength: 1,
maxlength: 20
},
serverType: {
required: true,
minlength: 1,
maxlength: 20
},
cpuFreq: {
required: true,
minlength: 1,
maxlength: 10
},
cpuNum: {
required: true,
minlength: 1,
maxlength: 2
},
ipmiPort: {
required: true,
minlength: 1,
maxlength: 2
},
powerNum: {
required: true,
minlength: 1,
maxlength: 2
},
raidCard: {
required: true,
minlength: 1,
maxlength: 2
},
},
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
var data = $('#form-tmplServer-edit').serializeArray();
var params = [];
$(".switchPort").each(function () {
params.push({"id": $(this).attr("id"), "value": $(this).val()});
});
var obj = {
"name": "foreignKeyInfo",
"value": JSON.stringify(params)
};
data.push(obj);
$.operate.save(prefix + "/edit", data);
}
}
/*
* 修改时手动回显ServerNetcardNum
*/
$(function () {
var serverNetcards = [[${tmplServer}]].serverNetcards;
$.each(serverNetcards, function (index, netcard) {
$("#" + netcard.serverNetcardType).val(netcard.serverNetcardNum);
});
});
</script>
</body>
</html>