audit.php
2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
$this->breadcrumbs=array(
'审核管理',
);
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="grid-view">
<tr>
<td width="8" background="images/tab_12.gif"> </td>
<td class="tabler">
<?php $columns = require_once Yii::app()->basePath. '/config/auditConfig.php';?>
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'audit-grid',
'dataProvider'=>$dataProvider,
//'filter'=>$model,
'columns'=>$columns[$item]
)); ?>
<div id="load" style="display: none; text-align:right; width:100%; padding-top:10px"></div>
</td>
<td width="8" background="images/tab_15.gif"> </td>
</tr>
</table>
<script type="text/javascript">
/**
* 请求处理
*/
function request(isAccept)
{
var data = new Array();
var message = null;
var reqUri = null;
var error = null;
var call = null;
// 获取选择的值
$("input:checkbox[name='id[]']").each(function()
{
if ($(this).attr("checked")==true)
{
data.push($(this).val());
}
});
reqUri = window.location.href;
reqUri = decodeURIComponent(reqUri);
call = reqUri.substr(reqUri.indexOf('&CALL=')+6, reqUri.length);
call = call.replace('}','') + ',"id":"' + data.join(',') +'"}';
// 判断是否有选择
if (data.length > 0)
{
reqUri = reqUri.substr(0, reqUri.indexOf('?r='));
// 判断是批准还是拒绝
switch (isAccept)
{
case false:
reqUri += '?r=audit/reject';
message = '<span>审核批量批准操作成功。</span>';
error = '<span class="wrong_text">审核操作批量批准失败。请重试!</span>';
break;
case true:
reqUri += '?r=audit/accept';
message = '<span>审核批量拒绝操作成功。</span>';
error = '<span class="wrong_text">审核操作批量批准失败。请重试!</span>';
break;
}
// 提交请求
$.post(reqUri,{'CALL':call}, function (data) {
var success = $.parseJSON(data);
if (success)
{
$("#load").html(message);
$.fn.yiiGridView.update('audit-grid');
}
else
{
$("#load").html(error);
}
$("#load").show();
});
}
else
{
error = '<span class="wrong_text">请先在需要批量操作的应用前面点击打勾选择!</span>';
$("#load").html(error);
$("#load").show();
}
}
</script>