典型案例编辑功能

This commit is contained in:
丁瑞超 2020-11-01 15:19:10 +08:00
parent e2e6fadd87
commit 5e89d1a5f6
2 changed files with 26 additions and 12 deletions

View File

@ -30,7 +30,7 @@
<label class="col-sm-3 control-label is-required">案例类型(来至于字典表)</label>
<div class="col-sm-8">
<select name="type" class="form-control m-b" required>
<option value="">所有</option>
<option value="11">所有</option>
</select>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
</div>
@ -48,21 +48,20 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">状态:</label>
<label class="col-sm-3 control-label is-required">状态:</label>
<div class="col-sm-8">
<div class="radio-box">
<input type="radio" name="status" value="">
<label th:for="status" th:text="未知"></label>
</div>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
<label class="toggle-switch switch-solid">
<input type="checkbox" id="status" checked>
<span></span>
</label>
</div>
</div>
<div class="form-group">
<!-- <div class="form-group">
<label class="col-sm-3 control-label">删除标志:</label>
<div class="col-sm-8">
<input name="delFlag" class="form-control" type="text">
</div>
</div>
</div>-->
</form>
</div>
<th:block th:include="include :: footer" />
@ -75,7 +74,10 @@
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-cases-add').serialize());
var data = $("#form-cases-add").serializeArray();
var status = $("input[id='status']").is(':checked') == true ? 0 : 1;
data.push({"name": "status", "value": status});
$.operate.save(prefix + "/add", data);
}
}

View File

@ -112,7 +112,10 @@
},
{
field: 'status',
title: '状态'
title: '状态',
formatter: function (value, row, index) {
return statusTools(row);
}
},
{
title: '操作',
@ -127,6 +130,15 @@
};
$.table.init(options);
});
/* 用户状态显示 */
function statusTools(row) {
if (row.status == 1) {
return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.id + '\')"></i> ';
} else {
return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.id + '\')"></i> ';
}
}
</script>
</body>
</html>