You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
simple-yewu/frontend/views/car/allocation.php

174 lines
7.7 KiB

<div id="car-allocation-search-panel" class="easyui-panel" title="搜索条件及分配" data-options="closable:false,collapsible:false,minimizable:false,maximizable:false" style="padding:10px;">
<form id="carAllocationSearchFrm" method="post">
<table cellpadding="5">
<tr>
<td>初登日期:</td>
<td>
<input class="easyui-datebox" type="text" name="register_begin" style="width: 100%;" value="" />
<input class="easyui-datebox" type="text" name="register_end" style="width: 100%;" value="" />
</td>
<td>保险日期:</td>
<td>
<input class="easyui-datebox" type="text" name="resurer_begin" style="width: 100%;" value="" />
<input class="easyui-datebox" type="text" name="resurer_end" style="width: 100%;" value="" />
</td>
<td>查询类型:</td>
<td>
<select class="easyui-combo" name="type">
<option value="0"></option>
<option value="1">未分配</option>
<option value="2">已分配</option>
<option value="3">续保未分配</option>
<option value="4">续保已分配</option>
</select>
</td>
<td>工号:</td>
<td>
<input class="easyui-textbox" type="text" name="username" style="width: 100px;" value="" />
</td>
</tr>
</table>
<table cellpadding="5">
<tr>
<td>车牌:</td>
<td>
<input class="easyui-textbox" type="text" name="car_no" style="width: 100px;" value="" />
</td>
<td>发动机号:</td>
<td>
<input class="easyui-textbox" type="text" name="engine_no" style="width: 100px;" value="" />
</td>
<td>车架号:</td>
<td>
<input class="easyui-textbox" type="text" name="car_frame_no" style="width: 100px;" value="" />
</td>
<td>
<a id="car-allocation-search-btn" href="javascript:" class="easyui-linkbutton" data-options="iconCls:'icon-search'">搜索</a>
</td>
</tr>
</table>
</form>
<table cellpadding="5">
<tr>
<td>
分配给:
<select class="easyui-combo" name="user_id" id="user_id">
<option value="0"></option>
<?php
foreach($user_items as $item) {
echo '<option value="'.$item->id.'">'.$item->getShowName().'</option>';
}
?>
</select>
<a id="car-allocation-push-btn" href="javascript:" class="easyui-linkbutton" data-options="iconCls:'icon-redo'">分配</a>
<a id="car-allocation-get-btn" href="javascript:" class="easyui-linkbutton" data-options="iconCls:'icon-undo'">回收</a>
</td>
</tr>
</table>
</div>
<div id="car-allocation-panel" class="easyui-panel" title="车辆列表" data-options="closable:false,collapsible:false,minimizable:false,maximizable:false">
<table id="car-allocation-grid" ></table>
</div>
<script>
$(function(){
//表格列表
$('#car-allocation-grid').datagrid({
url: '/car/allocation-json-data',
method:'GET',
idField: 'id',
rownumbers: true,
pagination: true,
singleSelect: false,
pageSize: 20,
pageList: [20,30,50],
fitColumns: true,
striped: true,
columns: [[
{ title: 'ID', field: 'id',checkbox:true},
{ field: 'car_no', title: '车牌号',width:120 },
{ field: 'car_man', title: '车主',width:300 },
{ field: 'phone', title: '联系电话',width:120 },
{ field: 'engine_no', title: '发动机号',width:120 },
{ field: 'car_frame_no', title: '车架号',width:200 },
{ field: 'register_date', title: '初登日期',width:100 },
{ field: 'seats', title: '座位数',align:'center' },
{ field: 'user', title: '业务员'}
]]
});
$('#car-allocation-search-btn').click(function(){
var data = $('#carAllocationSearchFrm').serializeArray();
var params = {
register_begin: data[0].value,
register_end: data[1].value,
resurer_begin: data[2].value,
resurer_end: data[3].value,
type: data[4].value,
username: data[5].value,
car_no: data[6].value,
engine_no: data[7].value,
car_frame_no: data[8].value
};
$('#car-allocation-grid').datagrid('uncheckAll');
$('#car-allocation-grid').datagrid('load',params);
});
$('#car-allocation-push-btn').click(function(){
var csrf = '<?=Yii::$app->request->csrfToken ?>';
var items = $('#car-allocation-grid').datagrid('getChecked');
var len = items.length;
if(len == 0) {
$.messager.alert('警告','请先选择记录','warning');
} else {
$.messager.confirm('确认', '是否确认分配选择车辆?', function(r){
if (r){
var user_id = $('#user_id').val();
var params = [];
for(var i=0; i < len; i++) {
params.push(items[i].id);
}
$.post('/car/allocation',{car_ids:params,op:'push',user_id:user_id,_csrf:csrf},function(obj){
if(obj.success) {
$.messager.alert('成功',obj.msg,'info',function(){
$('#car-allocation-grid').datagrid('uncheckAll');
$('#car-allocation-grid').datagrid('reload');
});
} else {
$.messager.alert('警告',obj.msg,'warning');
}
},'json');
}
});
}
});
$('#car-allocation-get-btn').click(function(){
var csrf = '<?=Yii::$app->request->csrfToken ?>';
var items = $('#car-allocation-grid').datagrid('getChecked');
var len = items.length;
if(len == 0) {
$.messager.alert('警告','请先选择记录','warning');
} else {
$.messager.confirm('确认', '是否确认回收选择车辆?', function(r){
if (r){
var params = [];
for(var i=0; i < len; i++) {
params.push(items[i].id);
}
$.post('/car/allocation',{car_ids:params,op:'get',_csrf:csrf},function(obj){
if(obj.success) {
$.messager.alert('成功',obj.msg,'info',function(){
$('#car-allocation-grid').datagrid('uncheckAll');
$('#car-allocation-grid').datagrid('reload');
});
} else {
$.messager.alert('警告',obj.msg,'warning');
}
},'json');
}
});
}
});
});
</script>