123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855 |
- {extend name="common/base"/}
- <!-- 主体 -->
- {block name="body"}
- <div class="p-3">
- <div class="gg-form-bar border-t border-x">
- <form id="taskForm" class="layui-form" lay-filter="barsearchform">
- <div class="layui-input-inline" style="width:100px;">
- <select name="project_status" lay-filter="status">
- <option value="">项目状态</option>
- <option value="1">立项中</option>
- <option value="2">审批中</option>
- <option value="3">待接收</option>
- <option value="4">分配中</option>
- <option value="5">作业中</option>
- <option value="6">归档中</option>
- <option value="7">退审中</option>
- <option value="8">已归档</option>
- <option value="9">已退审</option>
- </select>
- </div>
- <div class="layui-input-inline" style="width:100px;">
- <select id="province" lay-filter="province" name="province">
- <option value="">省</option>
- </select>
- </div>
- <div class="layui-input-inline" style="width:100px;">
- <select id="city" lay-filter="city" name="city">
- <option value="">市</option>
- </select>
- </div>
- <div class="layui-input-inline" style="width:100px;">
- <select id="area" lay-filter="area" name="area">
- <option value="">县</option>
- </select>
- </div>
- <div id="time_date" class="layui-input-inline" style="margin: 0;">
- <div class="layui-input-inline" style="width:150px;">
- <input type="text" id="start_time" name="project_start_time" readonly placeholder="起始日期"
- class="layui-input" value="">
- </div>
- <div class="layui-input-inline">-</div>
- <div class="layui-input-inline" style="width:150px;">
- <input type="text" id="end_time" name="project_end_time" readonly placeholder="截止日期"
- class="layui-input" value="">
- </div>
- </div>
- <div class="layui-input-inline" style="width:200px;">
- <input type="text" name="sent_review_unit_name" placeholder="送审单位" class="layui-input"
- autocomplete="off"/>
- </div>
- <div class="layui-input-inline" style="width:200px;">
- <input type="text" name="entrust_unit_name" placeholder="委托单位" class="layui-input"
- autocomplete="off"/>
- </div>
- <div class="layui-input-inline" style="width:200px;">
- <input type="text" name="keyword" placeholder="项目名称关键字" class="layui-input" autocomplete="off"/>
- </div>
- <div class="layui-input-inline" style="width:150px;">
- <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform"><i
- class="layui-icon layui-icon-search mr-1"></i>搜索
- </button>
- <button class="layui-btn layui-btn-reset" lay-submit="" lay-filter="reset1">清空</button>
- </div>
- </form>
- </div>
- <table class="layui-hide" id="cost_project" lay-filter="cost_project"></table>
- </div>
- <script type="text/html" id="toolbarDemo">
- <div class="layui-btn-container">
- <span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加造价项目">+ 添加造价项目</span>
- </div>
- </script>
- <!--<script type="text/html" id="barDemo">-->
- <!-- <div class="layui-btn-group">-->
- <!-- <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>-->
- <!-- <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="finish">归档</a>-->
- <!-- <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="dismissal">退审</a>-->
- <!-- </div>-->
- <!--</script>-->
- <script type="text/html" id="barDemo">
- {{# if(d.project_status==4 || d.project_status==5){ }}
- <div class="layui-clear-space">
- <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
- <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="more">
- 更多
- <i class="layui-icon layui-icon-down"></i>
- </a>
- </div>
- {{# } else { }}
- <div class="layui-btn-group">
- </div>
- {{# } }}
- </script>
- {/block}
- <!-- /主体 -->
- <!-- 脚本 -->
- {block name="script"}
- <script>
- const moduleInit = ['tool'];
- const field = '<?=json_encode($field)?>';
- function gouguInit() {
- var table = layui.table, tool = layui.tool, form = layui.form;
- var dropdown = layui.dropdown;
- var allcount;
- layui.laydate.render({
- elem: '#time_date',
- range: ['#start_time', '#end_time'],
- rangeLinked: true
- });
- layui.pageTable = table.render({
- elem: '#cost_project',
- title: '造价项目',
- toolbar: '#toolbarDemo',
- url: '/admin/project.cost_company/datalist',
- 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);
- }
- },
- {
- fixed: 'left',
- field: 'project_status',
- title: '项目状态',
- align: 'center',
- width: 100,
- hide: field.project_status,
- templet: function (item) {
- var html;
- if (item.project_status === 5) {
- html = '<span class="layui-badge layui-bg-blue" style="background-color: #1e9fff !important">作业中</span> ';
- } else if (item.project_status === 4) {
- html = '<span class="layui-badge" style="background-color: #005fa8 !important">分配中</span> ';
- } else if (item.project_status === 6) {
- html = '<span class="layui-badge layui-bg-orange" style="background-color: #007244 !important">归档中</span> ';
- } else if (item.project_status === 8) {
- html = '<span class="layui-badge layui-bg-green" style="background-color: #16b777 !important">已归档</span> ';
- } else if (item.project_status === 7) {
- html = '<span class="layui-badge layui-bg-orange" style="background-color: #881f1f !important">退审中</span> ';
- } else if (item.project_status === 9) {
- html = '<span class="layui-badge layui-bg-green" style="background-color: #d81e06 !important">已退审</span> ';
- }
- return html;
- }
- },
- {
- fixed: 'left',
- field: 'report_status',
- title: '报告状态',
- align: 'center',
- width: 100,
- hide: false,
- templet: function (item) {
- var html;
- if (item.report_status === 0) {
- html = '<span>初稿中</span> ';
- } else if (item.report_status === 1) {
- html = '<span>对数中</span> ';
- } else if (item.report_status === 2) {
- html = '<span>审定中</span> ';
- } else if (item.report_status === 3) {
- html = '<span>已审定</span> ';
- }else {
- html = '<span >未知</span> ';
- }
- return html;
- }
- },
- {
- fixed: 'left',
- field: 'project_name',
- title: '项目名称',
- align: 'center',
- width: 400,
- hide: field.project_name,
- templet: function (d) {
- var html = "";
- if (d.red) {
- //判断是否有新消息,有就有new
- html = '<a class="side-a" lay-event="read" lay-event="read">' + d.project_name + ' <span class="layui-badge-dot hongdian"></span></a>';
- } else {
- html = '<a class="side-a" lay-event="read" lay-event="read">' + d.project_name + '</a>';
- }
- return '<div style="text-align:left">' + html + '</div>'
- }
- },
- {
- field: 'project_num',
- title: '项目编号',
- align: 'center',
- width: 150, hide: field.project_num,
- },
- {
- field: 'project_time',
- title: '项目周期',
- align: 'center',
- width: 270,
- hide: field.project_time,
- templet: function (item) {
- let outcome = Math.round(new Date().getTime() / 1000).toString();
- var advent_time = item.project_end_time - outcome
- var time = getDuration(advent_time);
- var timestr = "<span style='color: green'>" + "剩余" + time + "</span>";
- if (advent_time < 0) {
- advent_time = -advent_time
- time = getDuration(advent_time);
- timestr = "<span style='color: red'>" + "逾期" + time + "</span>";
- }
- var html;
- if (item.project_status == 8 || item.project_status == 9 ){
- html =
- "<div>" +
- layui.util.toDateString(item.project_start_time * 1000, 'yyyy-MM-dd') +
- "至" +
- layui.util.toDateString(item.project_end_time * 1000, 'yyyy-MM-dd') +
-
- "</div>";
- }else{
- html =
- "<div>" +
- layui.util.toDateString(item.project_start_time * 1000, 'yyyy-MM-dd') +
- "至" +
- layui.util.toDateString(item.project_end_time * 1000, 'yyyy-MM-dd') +
- " " + timestr +
- "</div>";
- }
- function getDuration(second) {
- var duration
- var days = Math.floor(second / 86400);
- var hours = Math.floor((second % 86400) / 3600);
- if (days > 0) duration = days + "天";
- else if (hours > 0) duration = "不足一天";
- else if (hours == 0) duration = "不足一天";
- return duration;
- }
- return html;
- }
- },
- {
- field: 'entrust_unit_name',
- title: '委托单位',
- align: 'center',
- width: 150,
- hide: field.entrust_unit,
- },
- {
- field: 'entrust_maker_name',
- title: '委托单位负责人',
- align: 'center',
- width: 150,
- hide: field.entrust_head,
- },
- {
- field: 'entrust_phone',
- title: '委托单位负责人电话',
- align: 'center',
- width: 150,
- hide: field.entrust_phone,
- },
- {
- field: 'sent_review_unit_name',
- title: '送审单位',
- align: 'center',
- width: 150,
- hide: field.sent_review_unit,
- },
- {
- field: 'sent_review_head_name',
- title: '送审单位负责人',
- align: 'center',
- width: 150,
- hide: field.sent_review_head,
- },
- {
- field: 'sent_review_phone',
- title: '送审单位负责人电话',
- align: 'center',
- width: 150,
- hide: field.sent_review_phone,
- },
- {
- field: 'project_scale',
- title: '项目规模',
- align: 'center',
- width: 150,
- hide: field.project_scale,
- },
- {
- field: 'engineering_category',
- title: '工程类别',
- align: 'center',
- width: 150,
- hide: field.engineering_category,
- },
- {
- field: 'engineering_type',
- title: '项目类型',
- align: 'center',
- width: 150,
- hide: field.engineering_type,
- },
- {
- field: 'project_region',
- title: '项目区域',
- align: 'center',
- width: 150,
- hide: field.project_region,
- },
- {
- field: 'fiscal_nature',
- title: '财政性质',
- align: 'center',
- width: 150,
- hide: field.fiscal_nature,
- },
- {
- field: 'sent_review_cost',
- title: '送审服务费',
- align: 'center',
- width: 100,
- hide: field.sent_review_cost,
- },
- {
- field: 'sent_review_amount',
- title: '送审金额',
- align: 'center',
- width: 150,
- hide: field.sent_review_amount,
- },
- {
- field: 'authorize_amount',
- title: '审定金额',
- align: 'center',
- width: 150,
- hide: field.authorize_amount,
- },
- {
- field: 'review_add_amount',
- title: '审增额',
- align: 'center',
- width: 150,
- hide: field.review_add_reduce_amount
- },
- {
- field: 'review_reduce_amount',
- title: '审减额',
- align: 'center',
- width: 150,
- hide: field.review_add_reduce_amount
- },
- {
- field: 'review_add_reduce_rate',
- title: '审增减率',
- align: 'center',
- width: 150,
- hide: field.review_add_reduce_rate,
- },
- {
- field: 'report_time',
- title: '报告时间',
- align: 'center',
- width: 150,
- hide: field.report_time,
- templet: function (d) {
- if (d.report_time) {
- return layui.util.toDateString(d.report_time * 1000, "yyyy-MM-dd")
- } else {
- return "";
- }
- }
- },
- {
- field: 'charge_standard',
- title: '收费标准',
- align: 'center',
- width: 150,
- hide: field.charge_standard,
- },
- {
- field: 'operate_head_name',
- title: '作业负责人',
- align: 'center',
- width: 150,
- hide: field.operate_name,
- },
- {
- field: 'operate_team_names',
- title: '作业成员',
- align: 'center',
- width: 300,
- hide: field.operate_team_names
- },
-
- {
- field: 'creator',
- title: '创建人',
- align: 'center',
- width: 150,
- },
- {
- field: 'create_time',
- title: '项目创建日期',
- align: 'center',
- width: 180,
- hide: field.create_time,
-
- },
- {
- field: 'project_dead_time',
- title: '项目归档日期',
- align: 'center',
- width: 120,
- hide: field.project_dead_time,
- templet: function (d) {
- if (d.project_dead_time) {
- return layui.util.toDateString(d.project_dead_time * 1000, "yyyy-MM-dd")
- } else {
- return "";
- }
- }
- },
- {fixed: 'right', title: '操作', align: 'center', width: 170, toolbar: '#barDemo'},
- ]
- ]
- });
- //监听表头工具栏事件
- table.on('toolbar(cost_project)', function (obj) {
- if (obj.event === 'add') {
- tool.side("/admin/project.cost_company/add");
- return false;
- }
- });
- //监听表格行工具事件
- table.on('tool(cost_project)', function (obj) {
- var data = obj.data;
- if (obj.event === 'read') {
- tool.side('/admin/project.cost_company/read?id=' + obj.data.id);
- } else if (obj.event === 'edit') {
- if (obj.data.project_status < 6) {
- tool.side('/admin/project.cost_company/edit?id=' + obj.data.id);
- } else {
- layer.msg("已归档/已退审")
- }
- } else if (obj.event === 'finish') {
- if (obj.data.project_status == 5 || obj.data.project_status == 4) {
- var ttxx = 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)
- }
- if (text !== "") {
- tool.post("/admin/project.cost_company/finish", {
- id: data.id,
- finish_reason: text
- }, callback);
- } else {
- layer.msg("归档原因不能为空")
- }
- });
- } else {
- layer.msg("已归档/已退审")
- }
- } else if (obj.event === 'dismissal') {
- if (obj.data.project_status == 5 || obj.data.project_status == 4) {
- var ttxx = 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)
- }
- if (text !== "") {
- tool.post("/admin/project.cost_company/dismissal", {
- id: data.id,
- dismissal_reason: text,
- }, callback);
- } else {
- layer.msg("退审原因不能为空")
- }
- });
- } else {
- layer.msg("已归档/已退审")
- }
- } else if (obj.event === 'more') {
- // 更多 - 下拉菜单
- dropdown.render({
- elem: this, // 触发事件的 DOM 对象
- show: true, // 外部事件触发即显示
- data: [
- {
- title: '状态',
- id: 'set_status',
- templet: function () {
- return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="set_status" class="dropbtn">状态</button>';
- }
- },{
- title: '归档',
- id: 'finish',
- templet: function () {
- return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="finish" class="dropbtn">归档</button>';
- }
- }, {
- title: '退审',
- id: 'dismissal',
- templet: function () {
- return '<button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="dismissal" class="dropbtn">退审</button>';
- }
- }
- ],
- click: function (menudata) {
- if (menudata.id === 'finish') {
- if (obj.data.project_status == 5 || obj.data.project_status == 4) {
- var ttxx = 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)
- }
- if (text !== "") {
- tool.post("/admin/project.cost_company/finish", {
- id: data.id,
- finish_reason: text
- }, callback);
- } else {
- layer.msg("归档原因不能为空")
- }
- });
- } else {
- layer.msg("已归档/已退审")
- }
- } else if (menudata.id === 'dismissal') {
- if (obj.data.project_status == 5 || obj.data.project_status == 4) {
- var ttxx = 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)
- }
- if (text !== "") {
- tool.post("/admin/project.cost_company/dismissal", {
- id: data.id,
- dismissal_reason: text,
- }, callback);
- } else {
- layer.msg("退审原因不能为空")
- }
- });
- } else {
- layer.msg("已归档/已退审")
- }
- }else if (menudata.id === 'set_status') {
- setStatus(data.id);
- }
- },
- align: 'center', // 右对齐弹出
- style: 'min-width: 0px' // 设置额外样式
- })
- }
- return false;
- });
- function setStatus(project_id) {
- layer.open({
- title: '选择状态',
- type:1,
- area: ['480px', '336px'],
- content: '<div class="picker-table"><div id="boxselect"></div></div>',
- success: function() {
- table_a = table.render({
- elem: '#boxselect',
- cols: [
- [{
- type: 'radio',
- title: '选择',
- width: 100
- }, {
- field: 'title',
- title: '状态'
- }]
- ],
- data: [{
- "type": "0",
- "title": "初稿中"
- },{
- "type": "1",
- "title": "对数中"
- }, {
- "type": "2",
- "title": "审定中"
- }]
- });
- },
- btn:['确定'],
- yes: function(index) {
- var checkStatus = table.checkStatus(table_a.config.id);
- var data = checkStatus.data;
- console.log(checkStatus,data);
- if (data.length > 0) {
- let callbacl = function (e) {
- layui.pageTable.reload();
- layer.msg(e.msg)
- }
- data = {project_id:project_id,report_status:data[0].type}
- tool.post("/admin/project.api/set_status",data,callbacl);
- layer.close(index);
- }
- else{
- layer.msg('选择合同性质');
- }
- }
- })
- }
- //监听搜索提交
- form.on('submit(webform)', function (data) {
- console.log(data.field)
- layui.pageTable.reload({where: data.field});
- return false;
- });
- form.on('submit(reset1)', function () {
- $(".layui-form").reset();
- layui.pageTable.reload();
- return false;
- });
- layui.use(['form', 'jquery'], function () {
- var form = layui.form;
- const $ = layui.jquery;
- let adress;
- $.ajax({
- type: "get", //使用get方式
- url: "/static/assets/layui/adress.json", //json文件相对于这个HTML的路径
- dataType: "json",
- async: false,
- success: function (data) {
- //这个data就是json数据
- adress = data
- var province = Object.keys(adress)
- var proStrs = '<option value="">省</option>';
- for (var i = 0; i < province.length; i++) {
- proStrs += '<option value="' + province[i] + '">' + province[i] + '</option>';
- }
- $("#province").html(proStrs);
- layui.form.render("select")
- },
- error: function () {
- layui.alert("地址请求失败!! ");
- }
- });
- function getFirstAttr(obj) {
- for (var k in obj) return k;
- }
- function selectOption(selectedProvince, selectedCity = '', selectedArea = '') {
- var proStr = '<option value="">省</option>', cityStr = '<option value="">市</option>',
- areaStr = '<option value="">县</option>';
- var pro = adress[selectedProvince], ci = adress[selectedProvince][selectedCity];
- for (var province in adress) {
- if (province == selectedProvince) proStr += '<option value="' + province + '" selected>' + province + '</option>';
- else proStr += '<option value="' + province + '">' + province + '</option>';
- }
- $("#province").html(proStr);
- for (var city in pro) {
- if (city == selectedCity) cityStr += '<option value="' + city + '" selected>' + city + '</option>';
- else cityStr += '<option value="' + city + '">' + city + '</option>';
- }
- $("#city").html(cityStr);
- for (var area in ci) {
- if (area == "remove") {
- continue;
- }
- if (ci[area] == selectedArea) areaStr += '<option value="' + ci[area] + '" selected>' + ci[area] + '</option>';
- else areaStr += '<option value="' + ci[area] + '">' + ci[area] + '</option>';
- }
- $("#area").html(areaStr);
- form.render();
- }
- /*selectOption(1,2, 3);*/
- form.on('select(province)', function (data) {
- let thisProvince = data.value;
- let thisCity = getFirstAttr(adress[thisProvince]);
- selectOption(data.value);
- });
- form.on('select(city)', function (data) {
- selectOption($("#province").val(), data.value, getFirstAttr(data.value));
- });
- window.hongdianselect = function () {
- let num = $(document).find('.hongdian').length
- console.log(num, '我是数量')
- if (num === 0) {
- parent.showhongdian()
- console.log('2执行了')
- }
- }
- })
- }
- </script>
- {/block}
- <!-- /脚本 -->
|