典型案例编辑功能

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> <label class="col-sm-3 control-label is-required">案例类型(来至于字典表)</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select name="type" class="form-control m-b" required> <select name="type" class="form-control m-b" required>
<option value="">所有</option> <option value="11">所有</option>
</select> </select>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span> <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
</div> </div>
@ -47,22 +47,21 @@
<textarea name="pictureUrl" class="form-control" required></textarea> <textarea name="pictureUrl" class="form-control" required></textarea>
</div> </div>
</div> </div>
<div class="form-group"> <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="col-sm-8">
<div class="radio-box"> <label class="toggle-switch switch-solid">
<input type="radio" name="status" value=""> <input type="checkbox" id="status" checked>
<label th:for="status" th:text="未知"></label> <span></span>
</div> </label>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
</div> </div>
</div> </div>
<div class="form-group"> <!-- <div class="form-group">
<label class="col-sm-3 control-label">删除标志:</label> <label class="col-sm-3 control-label">删除标志:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="delFlag" class="form-control" type="text"> <input name="delFlag" class="form-control" type="text">
</div> </div>
</div> </div>-->
</form> </form>
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
@ -75,7 +74,10 @@
function submitHandler() { function submitHandler() {
if ($.validate.form()) { 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', field: 'status',
title: '状态' title: '状态',
formatter: function (value, row, index) {
return statusTools(row);
}
}, },
{ {
title: '操作', title: '操作',
@ -127,6 +130,15 @@
}; };
$.table.init(options); $.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> </script>
</body> </body>
</html> </html>