From f38f5e51bee02087bd11de42de902d2e7ab16c93 Mon Sep 17 00:00:00 2001 From: zhaocheng <578322713@qq.com> Date: Sat, 12 Oct 2019 10:31:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BB=B4=E4=BF=AE=E6=98=8E?= =?UTF-8?q?=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/controllers/FixCarController.php | 14 ++--- frontend/views/fix-car/my-list-edit.php | 67 ++++++++++++++++++++--- 2 files changed, 67 insertions(+), 14 deletions(-) diff --git a/frontend/controllers/FixCarController.php b/frontend/controllers/FixCarController.php index 076a074..c34e720 100644 --- a/frontend/controllers/FixCarController.php +++ b/frontend/controllers/FixCarController.php @@ -578,13 +578,13 @@ class FixCarController extends BaseController ->asArray() ->all(); - return [ - 'type1_items' => $type1_items, - 'type2_items' => $type2_items, - 'type3_items' => $type3_items, - 'type4_items' => $type4_items, - 'type5_items' => $type5_items - ]; + return MyLib::ok3([ + 'type1' => ['更换清单', $type1_items], + 'type2' => ['维修清单', $type2_items], + 'type3' => ['待定清单', $type3_items], + 'type4' => ['配件清单', $type4_items], + 'type5' => ['工时清单', $type5_items] + ], '操作成功'); } public function actionStep1List() diff --git a/frontend/views/fix-car/my-list-edit.php b/frontend/views/fix-car/my-list-edit.php index 6f79f32..525b16a 100644 --- a/frontend/views/fix-car/my-list-edit.php +++ b/frontend/views/fix-car/my-list-edit.php @@ -498,18 +498,71 @@ use \common\libs\MyLib; // 动态加载html function reloadItems() { var id = $('#id').val(); + var lists = { + 'list3': '/fix-car/ajax-item-list?fix_id=' + id + '&big_type_id=1', + 'list4': '/fix-car/ajax-item-list?fix_id=' + id + '&big_type_id=2', + 'list5': '/fix-car/ajax-item-list?fix_id=' + id + '&big_type_id=3', + 'list6': '/fix-car/ajax-item-list?fix_id=' + id + '&big_type_id=4', + }; if(id > 0) { - getPage('/fix-car/ajax-item-list?fix_id=' + id + '&big_type_id=1','list3'); - getPage('/fix-car/ajax-item-list?fix_id=' + id + '&big_type_id=2','list4'); - getPage('/fix-car/ajax-item-list?fix_id=' + id + '&big_type_id=3','list5'); - getPage('/fix-car/ajax-item-list?fix_id=' + id + '&big_type_id=4','list6'); + $.each(lists,function(i,d){ + $.get(d,{},function(res){ + console.log(res); + if(res.code == 200){ + renderData(res.data, i); + }else { + alert(res.msg) + } + },'json'); + }) } } - function getPage(url,idname) { - $.get(url,{},function(html){ - html&&$('#' + idname).html(html); + function renderData(data, id) { + var html = ''; + var table_data = []; + $.each(data,function(name,item){ + if (item[1].length) { + table_data.push(item[1]); + html += '
' + + '
' + + '
'+ item[0] +'
' + + '
' + + '
' + + '
' + + '
' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '
ID名称价格数量合计结算方式实收分类维修人备注
' + + '
' + + '
' + + '
' + + '
'; + } }); + $('#'+ id).html(html).find('table').each(function(i,target){ + $(target).bootstrapTable("destroy"); + $(target).bootstrapTable({ + data: table_data[i], + pagination: false, + queryParams: function (params) { + return params; + } + }); + }).show(); } // 保存维修信息