| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- var cur_status;
- function initTaskPage() {
- initQueryParams();
- initTableRowBtn();
- queryTask();
- }
- function initQueryParams() {
- // 仅选择日期
- $("#start-time").datetimepicker(
- {
- language: "zh-CN",
- weekStart: 1,
- todayBtn: 1,
- autoclose: 1,
- todayHighlight: 1,
- startView: 2,
- minView: 2,
- forceParse: 0,
- format: "yyyy-mm-dd"
- });
- // 仅选择日期
- $("#end-time").datetimepicker(
- {
- language: "zh-CN",
- weekStart: 1,
- todayBtn: 1,
- autoclose: 1,
- todayHighlight: 1,
- startView: 2,
- minView: 2,
- forceParse: 0,
- format: "yyyy-mm-dd"
- });
- setFeSelect("#fsList");
- //获取页面参数
- var page_params = $.zui.store.get("page_params");
- if(page_params && page_params.status) {
- cur_status = page_params.status;
- }
- }
- //初始化表行按钮
- function initTableRowBtn() {
- $.zui.store.set("task_table_btn_2",[{func:'showCheck',text:'开始稽查',icon_class:'icon-eye-open'}]);
- $.zui.store.set("task_table_btn_3",[{func:'showContinueCheck',text:'继续稽查',icon_class:'icon-eye-open'}]);
- $.zui.store.set("task_table_btn_4",[{func:'showTaskDetail',text:'详情',icon_class:'icon-tasks'},
- {func:'dispatchTaskById',text:'下发',icon_class:'icon-signin'}]);
- $.zui.store.set("task_table_btn_5",[{func:'showTaskDetail',text:'详情',icon_class:'icon-tasks'}]);
- $.zui.store.set("task_table_btn_6",[{func:'showTaskDetail',text:'详情',icon_class:'icon-tasks'}]);
- $.zui.store.set("task_table_btn_21",[{func:'showApplyDetail',text:'处理',icon_class:'icon-hand-up'}]);
- }
- //查询任务
- function queryTask(){
- var data = {
- "start_time": $("#start_time").val(),
- "end_time": $("#end_time").val(),
- "checked_dept": $("#fsList").val(),
- "check_status":cur_status
- }
- var hide = false;
- if(hasRole(ROLE_STATION_ADMIN) || hasRole(ROLE_STATION)) {
- hide = true;
- }
- var cols = [
- {width: 80, text: '序号', type: 'number', flex: true, colClass: 'text-center',field: 'num'},
- {width: 160, text: '任务名称', type: 'string', flex: true, sort: 'down',field: 'name'},
- {width: 80, text: '考核人员', type: 'string', flex: true, colClass: '',field: 'checked_person_name'},
- {width: 160, text: '考核部门', type: 'string', flex: true, sort: 'down',field: 'checked_dept_name'},
- {width: 80, text: '稽查人员', type: 'string', flex: true, hide:true,colClass: '',field: 'checkman_name'},
- {width: 160, text: '稽查时间段', type: 'string', flex: true, sort: 'down',field: 'check_period'},
- // {width: 120, text: '状态', type: 'string', flex: true, colClass: '',field: 'check_status_name'}
- ];
- var colFunc = {width: 120, text: '操作', type: 'string', flex: true, field: 'id'};
- colFunc.oper = $.zui.store.get("task_table_btn_"+cur_status);
- cols.push(colFunc);
- // var pager = {
- // page_size:10
- // }
- $('.datatable').mytable({'cols':cols,
- 'url':"/task/getTaskList/",
- 'param':data}
- );
- }
- //进入稽查页面
- function showCheck(id){
- // $('#myModal').modal({name:"dd"});
- $.checkTask =getItemByIdFromArr(id,$('.datatable').mytable('getTableData'));
- no_return_common_service('/task/update', {"id":id,"check_status":3})
- changePage("/view/mytask/check.html");
- }
- //进入继续稽查页面
- function showContinueCheck(id){
- // $('#myModal').modal({name:"dd"});
- $.checkTask =getItemByIdFromArr(id,$('.datatable').mytable('getTableData'));
- changePage("/view/mytask/check.html");
- }
- //处置无效任务申请
- function showApplyDetail(id){
- layer.open({
- type: 1,
- area: ['400px','500px'],
- title: '申请处理',
- closeBtn: 1,
- shadeClose: true,
- skin: 'layui-layer-lan',
- content: $('#apply_detail_div'),
- btn: ['同意', '拒绝'],
- btnAlign: 'c', //按钮居中
- shade: 0 ,//不显示遮罩
- yes: function(index){
- aggreeApply(id);
- layer.close(index);
- },
- btn2: function(index){
- refuseApply(id)
- layer.close(index);
- }
- });
- var param = {
- 'id':id
- };
- post_common_service('/checkApply/getByTaskId', param, function(data) {
- $('#apply_man').val(data.apply_man);
- $('#apply_time').val(data.apply_time);
- $('#apply_reason').val(data.apply_reason);
- $('#apply_id').val(data.id);
- });
- }
- //同意申请
- function aggreeApply(taskId){
- var param = {
- 'id':$('#apply_id').val(),
- 'task_id':taskId
- };
- addOrUpdateItem4Common(param,'/checkApply/agree',queryTask);
- }
- //拒绝申请
- function refuseApply(taskId){
- var param = {
- 'id':$('#apply_id').val(),
- 'task_id':taskId
- };
- addOrUpdateItem4Common(param,'/checkApply/refuse',queryTask);
- }
- //任务详情页面
- function showTaskDetail(id){
- var rowData=getItemByIdFromArr(id,$('.datatable').mytable('getTableData'));
- $.checkTask = rowData;
- changePage("/view/mytask/taskDetail.html");
- }
- //下发所有任务
- function dispatchTaskPatch(){
- layer.confirm('确定下发全部任务?', {
- btn: ['确定','取消'] //按钮
- }, function(){
- var param = {
- "start_time": $("#start_time").val(),
- "end_time": $("#end_time").val(),
- "checked_dept": $("#dept").val(),
- "check_status":4
- }
- no_return_common_service('/task/dispatch', param, function(data){
- queryTask();
- layer.msg(data, {
- time: 2000//20s后自动关闭
- });
- });
- }, function(index){
- layer.close(index);
- });
-
- }
- //下发单条任务
- function dispatchTaskById(id){
- layer.confirm('确定下发任务?', {
- btn: ['确定','取消'] //按钮
- }, function(){
- var param = {
- "id": id,
- "check_status":5
- }
- no_return_common_service('/task/dispatchById', param, function(data){
- queryTask();
- layer.msg(data, {
- time: 2000//20s后自动关闭
- });
- });
- }, function(index){
- layer.close(index);
- });
-
- }
|