添加维修明细

dev
zhaocheng 5 years ago
parent dbfb9a369d
commit f38f5e51be
  1. 14
      frontend/controllers/FixCarController.php
  2. 67
      frontend/views/fix-car/my-list-edit.php

@ -578,13 +578,13 @@ class FixCarController extends BaseController
->asArray() ->asArray()
->all(); ->all();
return [ return MyLib::ok3([
'type1_items' => $type1_items, 'type1' => ['更换清单', $type1_items],
'type2_items' => $type2_items, 'type2' => ['维修清单', $type2_items],
'type3_items' => $type3_items, 'type3' => ['待定清单', $type3_items],
'type4_items' => $type4_items, 'type4' => ['配件清单', $type4_items],
'type5_items' => $type5_items 'type5' => ['工时清单', $type5_items]
]; ], '操作成功');
} }
public function actionStep1List() public function actionStep1List()

@ -498,18 +498,71 @@ use \common\libs\MyLib;
// 动态加载html // 动态加载html
function reloadItems() { function reloadItems() {
var id = $('#id').val(); 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) { if(id > 0) {
getPage('/fix-car/ajax-item-list?fix_id=' + id + '&big_type_id=1','list3'); $.each(lists,function(i,d){
getPage('/fix-car/ajax-item-list?fix_id=' + id + '&big_type_id=2','list4'); $.get(d,{},function(res){
getPage('/fix-car/ajax-item-list?fix_id=' + id + '&big_type_id=3','list5'); console.log(res);
getPage('/fix-car/ajax-item-list?fix_id=' + id + '&big_type_id=4','list6'); if(res.code == 200){
renderData(res.data, i);
}else {
alert(res.msg)
}
},'json');
})
} }
} }
function getPage(url,idname) { function renderData(data, id) {
$.get(url,{},function(html){ var html = '';
html&&$('#' + idname).html(html); var table_data = [];
$.each(data,function(name,item){
if (item[1].length) {
table_data.push(item[1]);
html += '<div class="ibox float-e-margins">' +
' <div class="ibox-title">' +
' <h5>'+ item[0] +'</h5>' +
' </div>' +
' <div class="ibox-content">' +
' <div class="row">' +
' <div class="col-md-12">' +
' <table id="'+ id + '_' + name +'_table">' +
' <thead>' +
' <tr>' +
' <th data-field="id">ID</th>' +
' <th data-field="name">名称</th>' +
' <th data-field="price">价格</th>' +
' <th data-field="count">数量</th>' +
' <th data-field="total">合计</th>' +
' <th data-field="">结算方式</th>' +
' <th data-field="">实收</th>' +
' <th data-field="type">分类</th>' +
' <th data-field="">维修人</th>' +
' <th data-field="fix_remark">备注</th>' +
' </tr>' +
' </thead>' +
' </table>' +
' </div>' +
' </div>' +
' </div>' +
'</div>';
}
}); });
$('#'+ 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();
} }
// 保存维修信息 // 保存维修信息

Loading…
Cancel
Save