123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- <div class="p-3 bg-white">
- <table class="layui-hide" id="contact" lay-filter="contact"></table>
- </div>
- <div id="selectBox2" style="display: none;">
- <div id="companySelect2"></div>
- <button id="cc">1111</button>
- </div>
- <!-- <script type="text/html" id="toolbarcontact">
- <div class="layui-btn-container">
- <button class="layui-btn layui-btn-sm" lay-event="add">+ 新增联系函</button>
- </div>
- </script> -->
- <script>
- function contact() {
- let tool = layui.tool, table = layui.table;
- //项目任务
- var allcount;
- parent.layui.contactTable = table.render({
- elem: '#contact',
- title: '文档列表',
- toolbar: '#toolbarcontact',
- cellMinWidth: 80,
- parseData: function (res) { // 数据解析回调函数
- // 在这里可以获取数据总数
- allcount = res.data.length;
- return {
- code: res.code, // 数据状态码
- msg: res.msg, // 状态信息
- count: res.count, // 数据总数
- data: res.data // 当前页数据
- };
- },
- url: "/admin/project.contact/conlist",
- where: {'project_id': project_id},
- page: true, //开启分页
- limit: 20,
- cols: [[
- {field: 'id', title: '序号', width: 80, align: 'center',
- templet: function (d) {
- console.log(allcount,d.LAY_NUM)
- return allcount - (d.LAY_NUM - 1);
-
- }
- },
- {field: 'title', title: '联系函名称',align: 'center',
- templet: function (d) {
- var html = "";
- if (d.status == 5) {
- html = '<a class="side-a" lay-event="detail" style="color: grey;text-decoration:line-through" lay-event="detail">' + d.title + '</a>';
- } else {
- html = '<a class="side-a" lay-event="detail" lay-event="detail">' + d.title + '</a>';
- }
- return '<div style="text-align:left">' + html + '</div>'
- }
- },
- {
- field: 'audit_status',
- title: '审批状态',
- align: 'center',
- width: 150,
- templet: function (d) {
- var abc = '';
- if (d.status == 0) {
- abc = "<span>未审核(新建)</span>";
- } else if (d.status == 1) {
- abc = "<span>已通过(新建)</span>";
- } else if (d.status == 2) {
- abc = "<span>已拒绝(新建)</span>";
- } else if (d.status == 3) {
- abc = "<span>未审核(删除)</span>";
- } else if (d.status == 4) {
- abc = "<span>已通过(删除)</span>";
- } else if (d.status == 5) {
- abc = "<span>已拒绝(删除)</span>";
- } else if (d.status == 8) {
- abc = "<span>回复</span>";
- }
- return abc;
- }
-
- },
- {field: 'create_time', title: '创建时间', align: 'center', width: 150},
- {field: 'admin_name', title: '创建人', align: 'center', width: 100},
- {field: 'approver', 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 layui-bg-blue" href=${d.filepath} download=${d.name} lay-event="">下载</a>`;
- var btn2 = '';
- if (d.status == 0) {
- btn2 = '<span class="layui-btn layui-btn-xs" lay-event="agree_contact">同意</span><span class="layui-btn layui-btn-danger layui-btn-xs" lay-event="un_contact">拒绝</span>';
- } else if (d.status == 3) {
- btn2 = '<span class="layui-btn layui-btn-xs" lay-event="agree_del">同意</span><span class="layui-btn layui-btn-danger layui-btn-xs" lay-event="unagree_del">拒绝</span>';
- }
- return html + btn1 + btn2 + '</div>';
- }
- }
- ]]
- });
- //触发事件
- table.on('toolbar(contact)', function (obj) {
- var checkStatus = table.checkStatus(obj.config.id);
- switch (obj.event) {
- case 'add':
- parent.layui.tool.side('/admin/project.contact/add?project_id=' + project_id); // 项目id
- break;
- }
- });
- table.on('tool(contact)', function (obj) {
- var data = obj.data; //获得当前行数据
-
- if (obj.event === 'detail') { //查看
- let url = '/admin/project.contact/view?id=' + data.id;// 项目id
- parent.layui.tool.side(url);
- }
- if (obj.event === 'agree_contact') {
- let callback = function (e) {
- layer.msg(e.msg)
- parent.layui.reportTable.reload();
- }
- tool.post('/admin/project.contact/agree_contact', {id: data.id,else_id:data.else_id}, callback);
- }
- if (obj.event === 'un_contact') {
- var ttxx = layer.prompt({
- title: '请输入<span style="color: red">拒绝</span>原因',
- formType: 2,
- area: ['35vw', '15vw']
- }, function (text, index) {
-
- let callback = function (e) {
- layer.msg(e.msg)
- parent.layui.reportTable.reload();
- setTimeout(layer.close(index),1000);
- }
- tool.post('/admin/project.contact/un_contact', {id: data.id,else_id:data.else_id,audit_remark:text}, callback);
- });
- }
- if (obj.event === 'agree_del') {
- let callback = function (e) {
- layer.msg(e.msg)
- parent.layui.reportTable.reload();
- }
- tool.post('/admin/project.contact/agree_delete', {id: data.id,else_id:data.else_id}, callback);
- }
- if (obj.event === 'unagree_del') {
- var ttxx = layer.prompt({
- title: '请输入<span style="color: red">拒绝</span>原因',
- formType: 2,
- area: ['35vw', '15vw']
- }, function (text, index) {
-
- let callback = function (e) {
- layer.msg(e.msg)
- parent.layui.reportTable.reload();
- setTimeout(layer.close(index),1000);
- }
- tool.post('/admin/project.contact/un_delete', {id: data.id,else_id:data.else_id,audit_remark:text}, callback);
- });
- }
- })
- }
- </script>
|