dev_oa/app/project/view/index/index.html

81 lines
2.6 KiB
HTML

{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<table class="layui-hide" id="projectList" lay-filter="project"></table>
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-sm" lay-event="add">+ 新建项目</button>
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table, form = layui.form, tool = layui.tool;
layui.pageTable = table.render({
elem: '#projectList',
toolbar: '#toolbarDemo',
defaultToolbar:['filter', {title:'导出EXCEL',layEvent: 'LAYTABLE_EXCEL',icon: 'layui-icon-export'}],
title: '项目列表',
cellMinWidth: 80,
page: true, //开启分页
limit: 20,
height: 'full-24',
url: "/project/index/index", //数据接口
cols: [[
{
field: 'id', title: '项目编号', width: 80, align: 'center', fixed: 'left', rowspan: 2, templet: function (d) {
return 'P' + d.id;
}
}
, {
field: 'status', title: '状态', align: 'center', width: 70, rowspan: 2, templet: function (d) {
var html = '<span class="layui-btn layui-btn-xs layui-bg-' + d.status + '">' + d.status_name + '</span>';
return html;
}
}
, {
field: 'name', title: '项目名称', rowspan: 2, templet: function (d) {
var html = '<a class="side-a" data-href="/project/index/view/id/' + d.id + '">' + d.name + '</a>';
return html;
}
}
, { field: 'plan_time', title: '项目周期', align: 'center', width: 190, rowspan: 2 }
,{field: 'step',title: '当前阶段及负责人',align: 'center',width: 140,rowspan: 2 }
, { align: 'center', title: '关联任务', colspan: 3 }
, { field: 'director_name', fixed: 'right', title: '负责人', align: 'center', width: 80, rowspan: 2 }
], [
{ field: 'tasks_unfinish', align: 'center', style: 'color: #91CC75;', width: 72, 'title': '进行中' }
, { field: 'tasks_finish', align: 'center', style: 'color: #FAC858;', width: 70, 'title': '已完成' }
, { field: 'tasks_pensent', align: 'center', style: 'color: #EE6666;', width: 72, 'title': '完成率' }
]]
});
//触发事件
table.on('toolbar(project)', function(obj){
if(obj.event === 'LAYTABLE_EXCEL'){
$.ajax({
url: '/project/index/index',
data: {limit:99999},
success:function(res){
table.exportFile('projectList', res.data,'xls');
}
});
return;
}
else if(obj.event === 'add'){
tool.side('/project/index/add');
return;
}
});
}
</script>
{/block}
<!-- /脚本 -->