123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654 |
- {extend name="common/base"/}
- <!-- 主体 -->
- {block name="body"}
- <div class="p-3">
- <form class="layui-form gg-form-bar border-t border-x">
- <div class="layui-input-inline" style="width:300px;">
- <input type="text" name="keywords" placeholder="请输入关键字" class="layui-input" autocomplete="off"/>
- </div>
- <div class="layui-input-inline">
- <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searchform">提交搜索</button>
- </div>
- </form>
- <table class="layui-hide" id="cost_project" lay-filter="cost_project"></table>
- </div>
- <div id="selectBox" style="display: none;">
- <div id="companySelect"></div>
- <button id="c">1111</button>
- </div>
- <!--tow-->
- <div id="selectBox2" style="display: none;">
- <div id="financialSelect2"></div>
- <div id="companySelect2"></div>
- <button id="cc">1111</button>
- </div>
- <script type="text/html" id="toolbarDemo">
- <div class="layui-btn-container">
- </div>
- </script>
- {/block}
- <!-- /主体 -->
- <!-- 脚本 -->
- {block name="script"}
- <script>
- const moduleInit = ['tool'];
- function gouguInit() {
- var num = 0;
- var table = layui.table, tool = layui.tool, form = layui.form;
- var allcount;
- layui.pageTable = table.render({
- elem: '#cost_project',
- title: '造价项目列表',
- toolbar: '#toolbarDemo',
- url: '/admin/project.audit/datalist_company',
- page: true,
- limit: 20,
-
- parseData: function(res) { // 数据解析回调函数
- // 在这里可以获取数据总数
- allcount = res.count;
- return {
- code: res.code, // 数据状态码
- msg: res.msg, // 状态信息
- count: res.count, // 数据总数
- data: res.data // 当前页数据
- };
- },
- cols: [
- [
- {fixed: 'left', field: 'id', title: '编号', align: 'center', width: 80,
- templet: function(d){
- return allcount - (d.LAY_NUM-1);
- }
- }, {
- field: 'audit_status',
- title: '审批状态',
- align: 'center',
- width: 100,
- templet: function (item) {
- var html = '';
- if (item.audit_status === 1) {
- num += 1;
- html = '<span class="layui-badge layui-bg-blue">待审核</span> ';
- } else if (item.audit_status === 2) {
- html = '<span class="layui-badge layui-bg-green">已通过</span> ';
- } else if (item.audit_status === 3) {
- html = '<span class="layui-badge layui-bg-red">已拒绝</span> ';
- } else if (item.audit_status === 4) {
- html = '<span class="layui-badge layui-bg-gray">作废</span> ';
- }
- return html;
- }
- }, {
- field: 'else_name',
- title: '审批项目',
- align: 'center',
- width: 200,
- templet: function (d) {
- return '<div style="text-align:left">' + d.else_name + '</div>'
- }
- }, {
- field: 'project_name',
- title: '关联项目名称',
- align: 'center',
- width: 300,
- templet: function (d) {
- return '<div style="text-align:left">' + d.project_name + '</div>'
- }
- }, {
- field: 'audit_name',
- title: '流程名称',
- align: 'center',
- width: 150
- }, {
- field: 'sponsor',
- title: '发起人',
- align: 'center',
- width: 150
- }, {
- field: 'sponsor_unit',
- title: '发起单位/部门',
- align: 'center',
- width: 100
- }, {
- field: 'create_time',
- title: '发起时间',
- align: 'center',
- width: 150,
- templet: function (d) {
- if (d.create_time) {
- return layui.util.toDateString(d.create_time * 1000, "yyyy-MM-dd")
- } else {
- return "";
- }
- }
- }, {
- field: 'approver_name',
- title: '审批人',
- align: 'center',
- width: 150
- }, {
- field: 'audit_time',
- title: '审批时间',
- align: 'center',
- width: 100,
- templet: function (d) {
- if (d.audit_time) {
- return layui.util.toDateString(d.audit_time * 1000, "yyyy-MM-dd")
- } else {
- return "";
- }
- }
- }, {
- field: 'remark',
- title: '申请原因',
- align: 'center',
- }, {
- field: 'audit_remark',
- title: '审批回执',
- align: 'center',
- }, {
- fixed: 'right',
- field: 'right',
- title: '操作',
- width: 136,
- align: 'center',
- templet: function (item) {
- var h = '';
- if (item.audit_status === 1) {
- h = '<div class="layui-btn-group"> <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a> <a class="layui-btn layui-btn-xs" lay-event="edit">通过</a> <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="overrule">拒绝</a> </div>'
- } else {
- h = '<div class="layui-btn-group"> <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a></div>'
- }
- return h;
- }
- }
- ]
- ],
- done:function () {
- if(num === 0){
- parent.showhongdian()
- console.log('2执行了')
- }
- }
- });
- window.addEventListener('message', function (e) {
- select_Data = e.data;
- console.log(select_Data, 111)
- }, false);
- let abc = 0;
- //监听表格行工具事件
- table.on('tool(cost_project)', function (obj) {
- var data = obj.data;
- if (obj.event === 'read') {
- //这个包含了项目概览和请款
- let arrayData = [4,5,6,14,15];
- if (arrayData.indexOf(data.audit_type) !== -1) {
- tool.side('/admin/project.report/view_company?id=' + data.else_id);
- } else if (7 <= data.audit_type && data.audit_type <= 9) {
- tool.side('/admin/project.contact/view_company?id=' + data.else_id);
- } else if (10 <= data.audit_type && data.audit_type <= 12) {
- tool.side('/admin/project.audit/read_company?id=' + obj.data.project_id + '&type=' + obj.data.audit_type + '&project_id=' + obj.data.project_id);
- } else {
- layer.msg("审核内容不存在")
- }
- } else if (obj.event === 'edit') {
- var companySelect, financialSelect2, companySelect2;
- layer.confirm("确认是否审批通过?", function (index) {
- if (abc == 0) {
- let callback = function (e) {
- abc = 0
- select_Data = []
- layer.msg(e.msg);
- setTimeout(function () {
- window.location.reload()
- layer.close(index);
- }, 2000)
- }
- if (data.audit_type == 4) {
- //报告新建一审
- tool.post("/admin/project.audit/report_agree_first", {
- id: data.id,
- else_name: data.else_name,
- else_id: data.else_id,
- audit_type: data.audit_type,
- project_id: data.project_id,
- project_status: data.project_status,
- }, callback);
- } else if (data.audit_type == 5) {
- //报告新建二审
- tool.post("/admin/project.audit/report_agree_second", {
- id: data.id,
- else_name: data.else_name,
- else_id: data.else_id,
- audit_type: data.audit_type,
- project_id: data.project_id,
- project_status: data.project_status,
- }, callback);
- } else if (data.audit_type == 6) {
- //报告三审
- tool.post("/admin/project.audit/report_agree_third", {
- id: data.id,
- else_name: data.else_name,
- else_id: data.else_id,
- audit_type: data.audit_type,
- project_id: data.project_id,
- project_status: data.project_status,
- }, callback);
- } else if (data.audit_type == 7) {
- //联系函新建一审
- tool.post("/admin/project.audit/contact_agree_first", {
- id: data.id,
- else_name: data.else_name,
- else_id: data.else_id,
- audit_type: data.audit_type,
- project_id: data.project_id,
- project_status: data.project_status,
- }, callback);
- } else if (data.audit_type == 8) {
- //联系函二审
- tool.post("/admin/project.audit/contact_agree_second", {
- id: data.id,
- else_name: data.else_name,
- else_id: data.else_id,
- audit_type: data.audit_type,
- project_id: data.project_id,
- project_status: data.project_status,
- }, callback);
- } else if (data.audit_type == 9) {
- //联系函三审
- tool.post("/admin/project.audit/contact_agree_third", {
- id: data.id,
- else_name: data.else_name,
- else_id: data.else_id,
- audit_type: data.audit_type,
- project_id: data.project_id,
- project_status: data.project_status,
- }, callback);
- } else if (data.audit_type == 10) {
- //请款一审
- tool.post("/admin/project.audit/appropriation_agree_first", {
- id: data.id,
- else_name: data.else_name,
- else_id: data.else_id,
- audit_type: data.audit_type,
- project_id: data.project_id,
- project_status: data.project_status,
- }, callback);
- } else if (data.audit_type == 11) {
- //请款二审
- tool.post("/admin/project.audit/appropriation_agree_second", {
- id: data.id,
- else_name: data.else_name,
- else_id: data.else_id,
- audit_type: data.audit_type,
- project_id: data.project_id,
- project_status: data.project_status,
- }, callback);
- } else if (data.audit_type == 12) {
- //请款三审
- tool.post("/admin/project.audit/appropriation_agree_third", {
- id: data.id,
- else_name: data.else_name,
- else_id: data.else_id,
- audit_type: data.audit_type,
- project_id: data.project_id,
- project_status: data.project_status,
- }, callback);
- } else if (data.audit_type == 14) {
- //报告三审
- tool.post("/admin/project.audit/report_agree_fourth", {
- id: data.id,
- else_name: data.else_name,
- else_id: data.else_id,
- audit_type: data.audit_type,
- project_id: data.project_id,
- project_status: data.project_status,
- }, callback);
- } else if (data.audit_type == 15) {
- //报告三审
- tool.post("/admin/project.audit/report_agree_fifth", {
- id: data.id,
- else_name: data.else_name,
- else_id: data.else_id,
- audit_type: data.audit_type,
- project_id: data.project_id,
- project_status: data.project_status,
- }, callback);
- }else {
- layer.alert("意外问题,请联系管理员")
- }
- }
- abc = 1;
- }, function () {
- abc = 0
- })
- } else if (obj.event === 'overrule') {
- var ttxx = layer.prompt({
- title: '请输入<span style="color: red">拒绝</span>原因',
- formType: 2,
- area: ['35vw', '15vw']
- }, function (text, index) {
- if (text == '') {
- layer.msg('请先完善拒绝原因');
- return false;
- } else {
- let callback = function (e) {
- layer.msg(e.msg);
- setTimeout(function () {
- window.location.reload()
- layer.close(index);
- }, 2000)
- }
- if (data.audit_type == 4) {
- //报告新建一审
- tool.post("/admin/project.audit/report_disagree_first", {
- id: data.id,
- else_name: data.else_name,
- else_id: data.else_id,
- audit_type: data.audit_type,
- project_id: data.project_id,
- project_status: data.project_status,
- audit_remark: text,
- }, callback);
- } else if (data.audit_type == 5) {
- //报告新建二审
- tool.post("/admin/project.audit/report_disagree_second", {
- id: data.id,
- else_name: data.else_name,
- else_id: data.else_id,
- audit_type: data.audit_type,
- project_id: data.project_id,
- project_status: data.project_status,
- audit_remark: text,
- }, callback);
- } else if (data.audit_type == 6) {
- //报告新建三审
- tool.post("/admin/project.audit/report_disagree_third", {
- id: data.id,
- else_name: data.else_name,
- else_id: data.else_id,
- audit_type: data.audit_type,
- project_id: data.project_id,
- project_status: data.project_status,
- audit_remark: text,
- }, callback);
- } else if (data.audit_type == 7) {
- //联系函一审
- tool.post("/admin/project.audit/contact_disagree_first", {
- id: data.id,
- else_name: data.else_name,
- else_id: data.else_id,
- audit_type: data.audit_type,
- project_id: data.project_id,
- project_status: data.project_status,
- audit_remark: text,
- }, callback);
- } else if (data.audit_type == 8) {
- //联系函二审
- tool.post("/admin/project.audit/contact_disagree_second", {
- id: data.id,
- else_name: data.else_name,
- else_id: data.else_id,
- audit_type: data.audit_type,
- project_id: data.project_id,
- project_status: data.project_status,
- audit_remark: text,
- }, callback);
- } else if (data.audit_type == 9) {
- //联系函三审
- tool.post("/admin/project.audit/contact_disagree_third", {
- id: data.id,
- else_name: data.else_name,
- else_id: data.else_id,
- audit_type: data.audit_type,
- project_id: data.project_id,
- project_status: data.project_status,
- audit_remark: text,
- }, callback);
- } else if (data.audit_type == 10) {
- //请款一审
- tool.post("/admin/project.audit/appropriation_disagree_first", {
- id: data.id,
- else_name: data.else_name,
- else_id: data.else_id,
- audit_type: data.audit_type,
- project_id: data.project_id,
- project_status: data.project_status,
- audit_remark: text,
- }, callback);
- } else if (data.audit_type == 11) {
- //请款二审
- tool.post("/admin/project.audit/appropriation_disagree_second", {
- id: data.id,
- else_name: data.else_name,
- else_id: data.else_id,
- audit_type: data.audit_type,
- project_id: data.project_id,
- project_status: data.project_status,
- audit_remark: text,
- }, callback);
- } else if (data.audit_type == 12) {
- //请款三审
- tool.post("/admin/project.audit/appropriation_disagree_third", {
- id: data.id,
- else_name: data.else_name,
- else_id: data.else_id,
- audit_type: data.audit_type,
- project_id: data.project_id,
- project_status: data.project_status,
- audit_remark: text,
- }, callback);
- } else if (data.audit_type == 14) {
- //报告新建三审
- tool.post("/admin/project.audit/report_disagree_fourth", {
- id: data.id,
- else_name: data.else_name,
- else_id: data.else_id,
- audit_type: data.audit_type,
- project_id: data.project_id,
- project_status: data.project_status,
- audit_remark: text,
- }, callback);
- } else if (data.audit_type == 15) {
- //报告新建三审
- tool.post("/admin/project.audit/report_disagree_fifth", {
- id: data.id,
- else_name: data.else_name,
- else_id: data.else_id,
- audit_type: data.audit_type,
- project_id: data.project_id,
- project_status: data.project_status,
- audit_remark: text,
- }, callback);
- }else {
- layer.alert("意外问题,请联系管理员")
- }
- }
- })
- }
- return false;
- }
- )
- //监听搜索提交
- form.on('submit(searchform)', function (data) {
- layui.pageTable.reload({
- where: {
- keywords: data.field.keywords
- },
- page: {
- curr: 1
- }
- });
- return false;
- });
- // setTimeout(()=>{
- // console.log(num ,'我是数量')
- // if(num === 0){
- // parent.showhongdian()
- // console.log('2执行了')
- // }
- // },1500)
- }
- </script>
- {/block}
- <!-- /脚本 -->
|