From be51c67ce88a3b1fe0aee057f55883cb57b58be5 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期三, 07 四月 2021 09:40:05 +0800 Subject: [PATCH] # --- src/main/webapp/views/pda/selectMat.html | 140 ++++++++++++++++++++++++++++++++++++---------- 1 files changed, 109 insertions(+), 31 deletions(-) diff --git a/src/main/webapp/views/pda/selectMat.html b/src/main/webapp/views/pda/selectMat.html index 678f4c2..2f85405 100644 --- a/src/main/webapp/views/pda/selectMat.html +++ b/src/main/webapp/views/pda/selectMat.html @@ -40,7 +40,7 @@ background-color: white; box-shadow: 0 0 3px rgba(0,0,0,.3); height: 33px; - margin-left: 15px; + margin-left: 5px; border-radius: 20px; width: 15%; vertical-align: middle; @@ -49,8 +49,10 @@ background-color: #dedede; } - /* 涓讳綋鍗$墖 */ - .box-item { + /* 涓讳綋 */ + + /* 褰掔被鏍囩 */ + .box-tag-item { height: 100px; border-bottom: 1px solid #dedede; background-color: #fff; @@ -58,10 +60,28 @@ box-shadow: 0 0 3px rgba(0,0,0,.3); margin-top: 2px; } - .box-item:hover { + .box-tag-item:hover { background-color: #eaeaea; } - .box-item-label { + .box-tag-item-label { + font-size: x-large; + font-weight: bold; + padding: 10px 0 0 20px; + } + + /* 鍟嗗搧鏍囩 */ + .box-mat-item { + height: 100px; + border-bottom: 1px solid #dedede; + background-color: #fff; + border-radius: 5px; + box-shadow: 0 0 3px rgba(0,0,0,.3); + margin-top: 2px; + } + .box-mat-item:hover { + background-color: #eaeaea; + } + .box-mat-item-label { font-size: x-large; font-weight: bold; padding: 10px 0 0 20px; @@ -72,53 +92,111 @@ <header> <div class="search-box"> - <input type="text"> + <input type="text" placeholder="璇疯緭鍏ュ晢鍝佺紪鐮�/鍚嶇О"> <button> <i class="layui-icon"></i> </button> </div> </header> -<main> - <div class="box-item"> - <div class="box-item-label">灏奸緳澶磋灪涓濈洅瑁�</div> - </div> - <div class="box-item"> - <div class="box-item-label">灏奸緳澶磋灪涓濈洅瑁�</div> - </div> - <div class="box-item"> - <div class="box-item-label">灏奸緳澶磋灪涓濈洅瑁�</div> - </div> - <div class="box-item"> - <div class="box-item-label">灏奸緳澶磋灪涓濈洅瑁�</div> - </div> - <div class="box-item"> - <div class="box-item-label">灏奸緳澶磋灪涓濈洅瑁�</div> - </div> - <div class="box-item"> - <div class="box-item-label">灏奸緳澶磋灪涓濈洅瑁�</div> - </div> - +<main id="main-contain"> </main> </body> <script> $(function () { - - + showTag(); }) - $(document).on('click','.box-item', function () { + // 褰掔被鐐瑰嚮 + $(document).on('click','.box-tag-item', function () { + var tagId = $(this).children('input').get(0).value; + showTag(tagId); }) + + // 鍟嗗搧鐐瑰嚮 + $(document).on('click','.box-mat-item', function () { + parent.findBySelect($(this).children('input').get(0)) + }) + + // 灞曠ず褰掔被 + function showTag(parentId){ + $.ajax({ + url: baseUrl + "/tag/list/pda/auth", + headers: {'token': localStorage.getItem('token')}, + data: { + parentId: parentId + }, + method: 'POST', + success: function (res) { + if (res.code === 200) { + if (res.data != null && res.data.length > 0) { + var tplDom = $("#tagTpl"); + var tpl = tplDom.html(); + var template = Handlebars.compile(tpl); + var html = template(res); + $('#main-contain').html(html); + } else { + var tagId = parentId; + showMat(tagId); + } + } else if (res.code === 403) { + top.location.href = baseUrl + "/pda"; + } else { + parent.layer.msg(res.msg, {icon: 2}); + } + } + }) + } + + // 灞曠ず鍟嗗搧 + function showMat(tagId) { + if (isEmpty(tagId)) { + return; + } + $.ajax({ + url: baseUrl + "/mat/list/pda/auth", + headers: {'token': localStorage.getItem('token')}, + data: { + tagId: tagId + }, + method: 'POST', + success: function (res) { + if (res.code === 200) { + if (res.data != null && res.data.length > 0) { + var tplDom = $("#matTpl"); + var tpl = tplDom.html(); + var template = Handlebars.compile(tpl); + var html = template(res); + $('#main-contain').html(html); + } else { + $('#main-contain').html('<div style="text-align: center; margin-top: 15px"><span style="font-size: large">鏆傛棤鍟嗗搧</span></div>'); + } + } else if (res.code === 403) { + top.location.href = baseUrl + "/pda"; + } else { + parent.layer.msg(res.msg, {icon: 2}); + } + } + }) + } + + </script> <script type="text/template" id="tagTpl"> {{#each data}} - <option value="{{this}}">{{this}}</option> + <div class="box-tag-item"> + <input name="tagId" type="hidden" value="{{this.id}}"> + <div class="box-tag-item-label">{{this.name}}</div> + </div> {{/each}} </script> <script type="text/template" id="matTpl"> {{#each data}} - <option value="{{this}}">{{this}}</option> + <div class="box-mat-item"> + <input name="matnr" type="hidden" value="{{this.matnr}}"> + <div class="box-mat-item-label">{{this.maktx}}</div> + </div> {{/each}} </script> </html> -- Gitblit v1.9.1