更新sysConfig的新增和修改接口

pull/65/head
fengshuonan 2021-03-03 22:24:59 +08:00
parent 584583fa58
commit 55e8e47a0d
3 changed files with 15 additions and 2 deletions

View File

@ -7,8 +7,20 @@ layui.use(['form', 'admin', 'HttpRequest'], function () {
// 获取详情信息,填充表单 // 获取详情信息,填充表单
var httpRequest = new HttpRequest(Feng.ctxPath + "/sysConfig/detail?configId=" + Feng.getUrlParam("configId"), 'get'); var httpRequest = new HttpRequest(Feng.ctxPath + "/sysConfig/detail?configId=" + Feng.getUrlParam("configId"), 'get');
var result = httpRequest.start(); var result = httpRequest.start();
// 获取checkbox值
var checkboxValue = result.data.sysFlag;
// checkbox特殊处理
result.data.sysFlag = checkboxValue === 'Y';
// 表单赋值
form.val('sysConfigForm', result.data); form.val('sysConfigForm', result.data);
// 修改系统配置状态
form.on('switch(sysFlag)', function (obj) {
checkboxValue = obj.elem.checked ? 'Y' : 'N';
});
//表单提交事件 //表单提交事件
form.on('submit(btnSubmit)', function (data) { form.on('submit(btnSubmit)', function (data) {
@ -21,6 +33,7 @@ layui.use(['form', 'admin', 'HttpRequest'], function () {
admin.closeThisDialog(); admin.closeThisDialog();
Feng.error("修改失败!" + data.message) Feng.error("修改失败!" + data.message)
}); });
data.field.sysFlag = checkboxValue;
httpRequest.set(data.field); httpRequest.set(data.field);
httpRequest.start(true); httpRequest.start(true);
}); });

View File

@ -20,7 +20,7 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label layui-form-required"></label> <label class="layui-form-label layui-form-required"></label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="checkbox" lay-filter="sysFlag" name="sysFlag" lay-skin="switch" lay-text="是|否" value="Y" checked> <input type="checkbox" name="sysFlag" lay-filter="sysFlag" lay-skin="switch" lay-text="是|否" value="Y" checked>
</div> </div>
</div> </div>
<!-- --> <!-- -->

View File

@ -24,7 +24,7 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label layui-form-required"></label> <label class="layui-form-label layui-form-required"></label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="checkbox" name="sysFlag" lay-skin="switch" lay-text="是|否" value="Y" checked> <input type="checkbox" name="sysFlag" lay-filter="sysFlag" lay-skin="switch" lay-text="是|否">
</div> </div>
</div> </div>
<!-- --> <!-- -->