From fa705507ba574c857b1667553737d23b1b7ff495 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期四, 12 五月 2022 12:06:31 +0800 Subject: [PATCH] 后端模板代码优化 --- src/main/resources/code/service/app/src/main/resources/static/config/system_config_list.html | 91 ++++++++++++++++++++++++++------------------- 1 files changed, 52 insertions(+), 39 deletions(-) diff --git a/src/main/resources/code/service/app/src/main/resources/static/config/system_config_list.html b/src/main/resources/code/service/app/src/main/resources/static/config/system_config_list.html index 54dc460..ea3a04d 100644 --- a/src/main/resources/code/service/app/src/main/resources/static/config/system_config_list.html +++ b/src/main/resources/code/service/app/src/main/resources/static/config/system_config_list.html @@ -43,7 +43,7 @@ <form class="layui-form layui-col-space5"> <div class="layui-inline layui-show-xs-block"> - <input type="text" name="kw" lay-verify="" placeholder="璇疯緭鍏ュ悕绉�" autocomplete="off" + <input type="text" name="kw" lay-verify="" placeholder="璇疯緭鍏ュ悕绉�" autocomplete="off" class="layui-input"> </div> @@ -64,7 +64,7 @@ </body> <script type="text/html" id="toolbar"> <div class="layui-btn-container"> - <button class="layui-btn" onclick="xadmin.open('娣诲姞绯荤粺閰嶇疆淇℃伅','system_config_add.html',500,580)"><i + <button class="layui-btn" onclick="xadmin.open('娣诲姞绯荤粺閰嶇疆淇℃伅','system_config_add.html?type='+ ksapp.getQueryParam('type'),500,580)"><i class="layui-icon">顦�</i>娣诲姞 </button> </div> @@ -72,7 +72,8 @@ <script type="text/html" id="optContainer"> <div class="layui-btn-container"> - <a title="淇敼" onclick="xadmin.open('淇敼绯荤粺閰嶇疆淇℃伅','system_config_update.html?id={{d.id}}',500,580)" href="javascript:;"> + <a title="淇敼" onclick="xadmin.open('淇敼绯荤粺閰嶇疆淇℃伅','system_config_update.html?id={{d.id}}',500,580)" + href="javascript:;"> <i class="layui-icon"></i> </a> </div> @@ -101,7 +102,7 @@ <script type="text/html" id="imgshow"> <!-- 杩欓噷鐨刢hecked鐨勭姸鎬佸彧鏄紨绀� --> - <img src="{{d.}}"/> + <img src="{{d.}}"/> <input type="checkbox" name="sex" value="{{d.id}}" lay-skin="switch" lay-text="濂硘鐢�" lay-filter="sexDemo" {{ d.id== 10003 ? 'checked': ''}} > </script> @@ -138,8 +139,8 @@ //鍒濆鍖� layui.use(['laydate', 'form', 'table'], function () { var laydate = layui.laydate, - form = layui.form, - table = layui.table; + form = layui.form, + table = layui.table; //娓叉煋鏃ユ湡杈撳叆妗� //鎼滅储鏉′欢 form.on('submit(search)', function (data) { @@ -153,19 +154,21 @@ toolbar: "#toolbar", totalRow: true, cols: [[{type: 'checkbox', title: "ID"}, - {field: 'name', width: 200, sort: false, title: "鍚嶇О"}, - {field: 'key', width: 120, sort: false, title: "鍏抽敭瀛�"}, - {field: 'value', width: 400, sort: false, title: "鍐呭",templet:function(res){ - if("object"== typeof res.value){ + {field: 'name', width: 200, sort: false, title: "鍚嶇О"}, + {field: 'key', width: 120, sort: false, title: "鍏抽敭瀛�"}, + { + field: 'value', width: 400, sort: false, title: "鍐呭", templet: function (res) { + if ("object" == typeof res.value) { return JSON.stringify(res.value); - }else{ + } else { return res.value; } - }}, - {field: 'remarks', width: 120, sort: false, title: "澶囨敞"}, - {field: 'createTime', width: 120, sort: false, title: "鍒涘缓鏃堕棿"}, - {field: 'updateTime', width: 120, sort: false, title: "淇敼鏃堕棿"}, + } + }, + {field: 'remarks', width: 120, sort: false, title: "澶囨敞"}, + {field: 'createTime', width: 120, sort: false, title: "鍒涘缓鏃堕棿"}, + {field: 'updateTime', width: 120, sort: false, title: "淇敼鏃堕棿"}, {fixed: 'right', width: 80, title: "鎿嶄綔", toolbar: '#optContainer'}]], page: true, parseData: function (res) { //res 鍗充负鍘熷杩斿洖鐨勬暟鎹� @@ -189,31 +192,32 @@ //澶村伐鍏锋爮浜嬩欢 table.on('toolbar(app)', - function (obj) { - var checkStatus = table.checkStatus(obj.config.id); - switch (obj.event) { - case 'delete': - var data = checkStatus.data; - if (data == null || data.length == 0) { - layer.msg("鏈�夋嫨閫夐」"); - return; - } - var ids = new Array(); - for (var i = 0; i < data.length; i++) - ids.push(data[i].id); - layer.confirm('纭瑕佸垹闄ゅ悧锛�', function (index) { - //鍙戝紓姝ュ垹闄ゆ暟鎹� - app.deleteList(ids, function () { - layer.msg("鍒犻櫎鎴愬姛"); - $("form").submit(); - }); + function (obj) { + var checkStatus = table.checkStatus(obj.config.id); + switch (obj.event) { + case 'delete': + var data = checkStatus.data; + if (data == null || data.length == 0) { + layer.msg("鏈�夋嫨閫夐」"); + return; + } + var ids = new Array(); + for (var i = 0; i < data.length; i++) + ids.push(data[i].id); + layer.confirm('纭瑕佸垹闄ゅ悧锛�', function (index) { + //鍙戝紓姝ュ垹闄ゆ暟鎹� + app.deleteList(ids, function () { + layer.msg("鍒犻櫎鎴愬姛"); + $("form").submit(); }); + }); - break; - }; - }); + break; + } + ; + }); //璇锋眰鎼滅储琛ㄥ崟涓渶瑕佺殑鏁版嵁 - $('#search').trigger("click"); + $('#search').trigger("click"); }); }, @@ -236,6 +240,15 @@ }); }, search: function (params) { + params["type"] = ksapp.getQueryParam("type"); + var ps = {}; + for (var key in params) { + if (params[key] != null && params[key].length > 0) { + ps[key] = params[key]; + } + } + + //鏁版嵁閲嶈浇 tableIns.reload({ where: params, @@ -245,8 +258,8 @@ }); }, } - }); - app.init(); + }); + app.init(); }); </script> -- Gitblit v1.8.0