123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- <div class="p-3 bg-white">
- <table class="layui-hide" id="report" lay-filter="report"></table>
- </div>
- <script>
- function report() {
- if ($('#projectTab').find('li').eq(2).data('load') == 'true') {
- return false;
- }
- $('#projectTab').find('li').eq(2).data('load', 'true');
- let tool = layui.tool, table = layui.table;
- //项目任务
- parent.layui.reportTable = table.render({
- elem: '#report',
- title: '文档列表',
- toolbar: '#toolbarreport',
- cellMinWidth: 80,
- url: "/admin/project.report/datalist",
- where: {'project_id': project_id},
- page: true, //开启分页
- limit: 20,
- cols: [[
- {field: 'id', title: '序号', width: 80, align: 'center'},
- {field: 'title', title: '报告名称',align: 'center',
- templet: function (d) {
- var html = "";
- if(d.status == 1){
- html = '<a class="side-a" lay-event="detail" lay-event="detail">' + d.title + '</a>';
- }else{
- html = '<a class="side-a" lay-event="detail" style="color: grey;text-decoration:line-through" lay-event="detail">' + d.title + '</a>';
- }
- return '<div style="text-align:left">' + html + '</div>'
- }
- },
- {field: 'type', title: '报告类型', align: 'center', width: 100,templet:function (item){
- var html = '';
- if(item.type === 0){
- html = "<span>初审报告</span>";
- }else if(item.type === 1){
- html = "<span>对数报告</span>";
- }else if(item.type === 2){
- html = "<span>审定报告</span>";
- }
- return html;
- }},
- {field: 'create_time', title: '创建时间', align: 'center', width: 150},
- {field: 'admin_name', title: '创建人', align: 'center', width: 100},
- {field: 'right', fixed: 'right', title: '操作', width: 100, align: 'center',
- templet: function (d) {
- var html = '<div class="layui-btn-group">';
- var btn1 = `<a class="layui-btn layui-btn-xs" href=${d.filepath} download=${d.name} lay-event="">下载</a>`;
- return html + btn1 + '</div>';
- }
- }
- ]]
- });
- //触发事件
- table.on('toolbar(report)', function (obj) {
- var checkStatus = table.checkStatus(obj.config.id);
- switch (obj.event) {
- case 'add':
- parent.layui.tool.side('/admin/project.report/add?project_id=' + project_id); // 项目id
- break;
- }
- });
- table.on('tool(report)', function (obj) {
- var data = obj.data; //获得当前行数据
- if (obj.event === 'detail') { //查看
- let url = '/admin/project.report/view?id=' + data.id;// 项目id
- parent.layui.tool.side(url);
- }
- if (obj.event === 'del') {
- layer.prompt({title: '请输入<span style="color: red">删除</span>原因', formType: 2,area: ['35vw', '15vw']}, function(text, index){
- let callback = function (e) {
- window.location.reload()
- layer.msg(e.msg);
- setTimeout(function (){
- layer.close(index);
- },2000)
- }
- tool.post("/admin/project.report/delete", {id: data.id ,remark:text}, callback);// 项目id
- });
- }
- })
- }
- </script>
|