完善任务下派详情

This commit is contained in:
wanggeng888 2021-01-09 22:05:03 +08:00
parent 6b71f2bac8
commit 807ac8a792
3 changed files with 222 additions and 77 deletions

View File

@ -0,0 +1,111 @@
<!doctype html>
<html lang="en">
<head>
<base href="/inspection/">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
</head>
<body>
<div class="layui-anim layui-anim-fadein">
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
</div>
</div>
</div>
</div>
</div>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/'
}).extend({
index: 'lib/index',
treeTable: 'treeTable/treeTable',
}).use(['index', 'treeTable'], function() {
var $ = layui.$;
var $win = $(window);
var admin = layui.admin;
var form = layui.form;
var treeTable = layui.treeTable;
var resizeTimeout = null;
var taskEnterpriseId = top.restAjax.params(window.location.href).taskEnterpriseId;
var checkItemListType = top.restAjax.params(window.location.href).checkItemListType;
var tableUrl = 'api/taskcheck/v2/listcheckitem/{checkItemListType}/{taskEnterpriseId}';
var treeTableObj;
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
function initData() {}
function initTable() {
top.restAjax.get(top.restAjax.path(tableUrl, [checkItemListType, taskEnterpriseId]), {}, null, function(code, data) {
treeTableObj = treeTable.render({
elem: '#dataTable',
data: data,
width: admin.screen() > 1 ? '100%' : '',
height: ($win.height() - 80) +'px',
tree: {
iconIndex: 2,
isPidData: true,
idName: 'checkItemId',
pidName: 'checkItemParentId',
},
cols: [
{type: 'numbers'},
{type: 'checkbox'},
{field: 'checkItemName', title: '名称', width: 600},
{field: 'checkItemType', title: '类型', width: 100,
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null) {
return '-';
}
if(rowData == 1) {
return '目录';
} else if(rowData == 2) {
return '检查项';
}
}
},
]
});
treeTableObj.expandAll();
initData();
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 重载表格
function reloadTable() {
treeTableObj.reload({
width: admin.screen() > 1 ? '100%' : '',
height: ($win.height() - 80) +'px',
});
treeTableObj.expandAll();
initData();
}
initTable();
// 事件 - 页面变化
$win.on('resize', function() {
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(function() {
reloadTable();
}, 500);
});
});
</script>
</body>
</html>

View File

@ -39,10 +39,102 @@
var laytpl = layui.laytpl;
var resizeTimeout = null;
var taskId = top.restAjax.params(window.location.href).taskId;
var checkItemListType = top.restAjax.params(window.location.href).checkItemListType;
var tableUrl = 'api/taskcheck/v2/listpagetaskenterprise/{taskId}';
// 初始化表格
function initTable() {
function addContactOption(col) {
col.push({field: 'contactOption', width: 120, title: '行业检查项', align:'center', fixed: 'right',
templet: function(row) {
return '<button type="button" class="layui-btn layui-btn-sm" lay-event="contactOptionEvent">行业检查项</button>';
}
})
}
function addCustomOption(col) {
col.push({field: 'customOption', width: 120, title: '企业检查项', align:'center', fixed: 'right',
templet: function(row) {
return '<button type="button" class="layui-btn layui-btn-sm" lay-event="customOptionEvent">企业检查项</button>';
}
})
}
var cols = [[
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
{field: 'enterpriseName', width: 240, title: '企业名称', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'enterpriseAddress', width: 400, title: '详细地址', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'enterpriseLegalPerson', width: 120, title: '企业法人', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'isChecked', width: 90, title: '是否检查', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null) {
return '-';
}
if(rowData == 0) {
return '否';
}
if(rowData == 1) {
return '是';
}
return '错误';
}
},
{field: 'isCompleted', width: 90, title: '是否完成', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null) {
return '-';
}
if(rowData == 0) {
return '否';
}
if(rowData == 1) {
return '是';
}
return '错误';
}
},
{field: 'checkUserName', width: 120, title: '企业检查人', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
]];
if(checkItemListType && checkItemListType == '2') {
addContactOption(cols[0]);
} else if(checkItemListType && checkItemListType == '3') {
addCustomOption(cols[0]);
} else {
addContactOption(cols[0]);
addCustomOption(cols[0]);
}
table.render({
elem: '#dataTable',
id: 'dataTable',
@ -55,80 +147,7 @@
pageName: 'page',
limitName: 'rows'
},
cols: [[
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
{field: 'enterpriseName', width: 240, title: '企业名称', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'enterpriseAddress', width: 400, title: '详细地址', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'enterpriseLegalPerson', width: 120, title: '企业法人', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'isChecked', width: 90, title: '是否检查', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null) {
return '-';
}
if(rowData == 0) {
return '否';
}
if(rowData == 1) {
return '是';
}
return '错误';
}
},
{field: 'isCompleted', width: 90, title: '是否完成', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null) {
return '-';
}
if(rowData == 0) {
return '否';
}
if(rowData == 1) {
return '是';
}
return '错误';
}
},
{field: 'checkUserName', width: 120, title: '企业检查人', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'operation', width: 90, title: '操作', fixed: 'right', align:'center',
templet: function(row) {
return '<button type="button" class="layui-btn layui-btn-sm" lay-event="checkItemEvent">检查项</button>';
}
},
]],
cols: cols,
page: true,
parseData: function(data) {
return {
@ -148,14 +167,29 @@
page: {
curr: currentPage
},
height: $win.height() - 90,
height: $win.height() - 22,
});
}
initTable();
table.on('tool(dataTable)', function(obj) {
var data = obj.data;
var event = obj.event;
if(event === 'pollutionEvent') {
if(event === 'contactOptionEvent') {
top.dialog.open({
url: top.restAjax.path('route/taskcheck/v2/list-task-checkitem.html?taskEnterpriseId={taskEnterpriseId}&checkItemListType={checkItemListType}', [data.taskEnterpriseId, 1]),
title: '行业检查项',
width: '840px',
height: '80%',
onClose: function () {}
});
} else if(event === 'customOptionEvent') {
top.dialog.open({
url: top.restAjax.path('route/taskcheck/v2/list-task-checkitem.html?taskEnterpriseId={taskEnterpriseId}&checkItemListType={checkItemListType}', [data.taskEnterpriseId, 2]),
title: '企业检查项',
width: '840px',
height: '80%',
onClose: function () {}
});
}
});
});

View File

@ -368,7 +368,7 @@
});
} else if(event === 'taskEnterpriseEvent') {
top.dialog.open({
url: top.restAjax.path('route/taskcheck/v2/list-task-enterprise.html?taskId={taskId}', [data.taskId]),
url: top.restAjax.path('route/taskcheck/v2/list-task-enterprise.html?taskId={taskId}&checkItemListType={checkItemListType}', [data.taskId, data.checkItemListType]),
title: '检查企业列表',
width: '70%',
height: '80%',