| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490 | <% include ./sub_menu.ejs %><div class="panel-content">    <div class="panel-title">        <div class="title-main">            <h2>功能设置</h2>        </div>    </div>    <div class="content-wrap">        <div class="c-body">            <div class="sjs-height-0">                <div class="row m-0 mt-3">                    <div class="col-7">                        <div class="row">                            <div class="col-6">                                <div class="card mb-3">                                    <div class="card-body">                                        <h5 class="card-title">超计控制</h5>                                        <div class="form-group mb-4">                                            <div>                                                <div class="form-check">                                                    <input class="form-check-input" type="checkbox" id="ban_over" name="ban_over" <% if (funRela.banOver) { %>checked<% } %> onchange="updateSetting();">                                                    <label class="form-check-label" for="ban_over">超计时限制上报审批/审批通过</label>                                                </div>                                                <div class="form-check">                                                    <input class="form-check-input" type="checkbox" id="hint_over" name="hint_over" <% if (funRela.hintOver) { %>checked<% } %> onchange="updateSetting();">                                                    <label class="form-check-label" for="hint_over">超计时标红显示</label>                                                </div>                                            </div>                                        </div>                                    </div>                                </div>                            </div>                            <div class="col-6">                                <div class="card mb-3">                                    <div class="card-body">                                        <h5 class="card-title">变更令调用控制</h5>                                        <div class="form-group mb-4">                                            <div>                                                <div class="form-check form-check-inline">                                                    <input class="form-check-input" type="checkbox" id="ban_minus_cb" name="ban_minus_cb" <% if (funRela.banMinusChangeBills) { %>checked<% } %> onchange="updateSetting();">                                                    <label class="form-check-label" for="ban_minus_cb">强制调用负变更(限制上报审批/审批通过)</label>                                                </div>                                                <div class="alert-warning p-1"><i class="fa Example of exclamation-circle fa-exclamation-circle "></i> 变更令开始调用后,负变更清单必须在本期全部调用</div>                                            </div>                                            <div>                                                <div class="form-check form-check-inline">                                                    <input class="form-check-input" type="checkbox" id="minusNoValue" name="minusNoValue" <% if (funRela.minusNoValue) { %>checked<% } %> onchange="updateSetting();">                                                    <label class="form-check-label" for="minusNoValue">计量不计价</label>                                                </div>                                            </div>                                        </div>                                    </div>                                </div>                            </div>                        </div>                        <div class="card mb-3">                            <div class="card-body">                                <h5 class="card-title">合同支付</h5>                                <div class="form-group mb-4">                                    <div>                                        <div class="form-check form-check-inline">                                            <input class="form-check-input" type="checkbox" id="lockPayExpr" name="lockPayExpr" <% if (funRela.lockPayExpr) { %>checked<% } %> onchange="updateSetting();">                                            <label class="form-check-label" for="lockPayExpr">锁定往期带基数计算的合同支付项</label>                                        </div>                                    </div>                                </div>                            </div>                        </div>                        <div class="card mb-3 ">                            <div class="card-body pb-2">                                <div class="row m-0">                                    <h5 class="card-title">计量期上报</h5>                                    <div class="pull-right d-inline-block form-group form-check ml-auto">                                        <div class="custom-control custom-switch">                                            <input type="checkbox" class="custom-control-input" id="openStageStart" <% if(ctx.session.sessionProject.page_show.openStageStart) { %>checked<% } %> onchange="updateSetting();">                                            <label class="custom-control-label" for="openStageStart"></label>                                        </div>                                    </div>                                </div>                                <div class="form-group mb-1">                                    <div>                                        <div class="input-group input-group-sm mb-2">                                            <div class="input-group-prepend">                                                <span class="input-group-text">开始日期:</span>                                                <span class="input-group-text" style="width: 90px;padding-left: 12px;">每月</span>                                            </div>                                            <select class="form-control form-control-sm" id="start_day" style="width: 90px!important;flex: none;" <% if (ctx.session.sessionProject.page_show.openStageStart) { %>disabled<% } %>>                                                <option value="0">请选择日</option>                                                <% for (let i = 1; i <= 31;i++) { %>                                                    <option value="<%- i %>" <% if (funSet.stage_start.start_day === i) {%>selected<% } %>><%- i %></option>                                                <% } %>                                            </select>                                            <span class="text-danger mx-2"></span>                                        </div>                                        <div class="input-group input-group-sm mb-2">                                            <div class="input-group-prepend">                                                <span class="input-group-text">截止日期:</span>                                            </div>                                            <select class="form-control form-control-sm" id="end_month" style="width: 90px!important;flex: none;" <% if (ctx.session.sessionProject.page_show.openStageStart) { %>disabled<% } %>>                                                <option value="0">请选择月</option>                                                <% for (const i of endMonth) { %>                                                <option value="<%- i.val %>" <% if (funSet.stage_start.end_month === i.val) {%>selected<% } %> ><%- i.name %></option>                                                <% } %>                                            </select>                                            <select class="form-control form-control-sm" id="end_day" style="width: 90px!important;flex: none;" <% if (ctx.session.sessionProject.page_show.openStageStart) { %>disabled<% } %>>                                                <option value="0">请选择日</option>                                                <% for (let i = 1; i <= 31;i++) { %>                                                    <option value="<%- i %>" <% if (funSet.stage_start.end_day === i) {%>selected<% } %>><%- i %></option>                                                <% } %>                                            </select>                                            <span class="text-danger mx-2"></span>                                        </div>                                    </div>                                </div>                                <div class="mt-3">                                    <label class="form-text alert alert-danger">开启选项后,超出范围内的日期,则不允许上报期计量。</label>                                </div>                            </div>                        </div>                        <div class="card mb-3">                            <div class="card-body">                                <h5 class="card-title">中间计量模式设置</h5>                                <div class="form-group mb-4">                                    <div>                                        <% for (const i in imType) { %>                                            <div class="form-check form-check-inline">                                                <input class="form-check-input" type="radio" id="radio_<%- i %>" value="<%- imType[i].value %>" <% if (funRela.imType === imType[i].value) { %>checked<% } %> name="im_type" onchange="updateSetting();">                                                <label class="form-check-label" for="radio_<%- i %>" name="im_type"><%- imType[i].name %></label>                                            </div>                                        <% } %>                                    </div>                                    <div class="mt-3">                                        <label class="form-text alert alert-danger">切换模式,仅对未开始第一期计量的标段生效。</label>                                    </div>                                </div>                            </div>                        </div>                        <div class="row">                            <div class="col-6">                                <div class="card mb-3">                                    <div class="card-body">                                        <h5 class="card-title">工程变更</h5>                                        <div class="alert alert-dark py-1 px-2 mb-2" role="alert">                                            页面显示                                        </div>                                        <div class="form-group mb-1">                                            <div class="form-check form-check-inline">                                                <input class="form-check-input" type="checkbox" id="openChangeProject" <% if(ctx.session.sessionProject.page_show.openChangeProject) { %>checked<% } %> onchange="updateSetting(1);">                                                <label class="form-check-label" for="openChangeProject">显示「变更立项」页面</label>                                            </div>                                        </div>                                        <div class="form-group mb-1">                                            <div class="form-check form-check-inline">                                                <input class="form-check-input" type="checkbox" id="openChangeApply" <% if(ctx.session.sessionProject.page_show.openChangeApply) { %>checked<% } %> onchange="updateSetting(2);">                                                <label class="form-check-label" for="openChangeApply">显示「变更申请」页面</label>                                            </div>                                        </div>                                        <div class="form-group mb-1">                                            <div class="form-check form-check-inline">                                                <input class="form-check-input" type="checkbox" id="openChangePlan" <% if(ctx.session.sessionProject.page_show.openChangePlan) { %>checked<% } %> onchange="updateSetting(3);">                                                <label class="form-check-label" for="openChangePlan">显示「变更方案」页面</label>                                            </div>                                        </div>                                        <div class="alert alert-dark py-1 px-2 mb-2" role="alert">                                            功能设置                                        </div>                                        <div class="mb-1">                                            <div class="form-check form-check-inline">                                                <input class="form-check-input" type="checkbox" id="inlineCheckbox11" checked disabled>                                                <label class="form-check-label" for="inlineCheckbox11">开启自定义变更类别</label>                                            </div>                                            <a class="pull-right mr-3"  href="#bgclass" data-toggle="modal" data-target="#bgclass">设置</a>                                        </div>                                        <div class="mb-1">                                            <div class="form-check form-check-inline">                                                <input class="form-check-input" type="checkbox" id="openChangeState" <% if (ctx.session.sessionProject.page_show.openChangeState) { %>checked<% } %> onchange="updateSetting();">                                                <label class="form-check-label" for="openChangeState">开启变更令状态功能 </label>                                                 <a href="javascript:void(0);"  data-toggle="tooltip" data-placement="bottom" title="" data-original-title="变更令提供临时、立项、批复状态,可设置计量上限"><i class="fa fa-question-circle "></i></a>                                            </div>                                            <a class="pull-right mr-3 <% if (!ctx.session.sessionProject.page_show.openChangeState) { %>text-secondary<% } %>" href="javascript:void(0);" id="openBgStatus">设置</a>                                        </div>                                        <div class="mb-1">                                            <div class="form-check form-check-inline">                                                <input class="form-check-input" type="checkbox" id="openChangeWhiteList" <% if (ctx.session.sessionProject.page_show.openChangeWhiteList) { %>checked<% } %> onchange="updateSetting();">                                                <label class="form-check-label" for="openChangeWhiteList">开启“添加空白清单”功能</label>                                            </div>                                        </div>                                    </div>                                </div>                            </div>                            <div class="col-6">                                <div class="card mb-3">                                    <div class="card-body">                                        <h5 class="card-title">材料调差</h5>                                        <div class="form-group mb-1">                                            <div class="form-check form-check-inline">                                                <input class="form-check-input" type="checkbox" id="openMaterialTax" <% if(ctx.session.sessionProject.page_show.openMaterialTax) { %>checked<% } %> onchange="updateSetting();">                                                <label class="form-check-label" for="openMaterialTax">使用材料税</label>                                            </div>                                        </div>                                        <div class="form-group mb-1">                                            <div class="form-check form-check-inline">                                                <input class="form-check-input" type="checkbox" id="openMaterialChecklist" <% if(ctx.session.sessionProject.page_show.openMaterialChecklist) { %>checked<% } %> onchange="updateSetting();">                                                <label class="form-check-label" for="openMaterialChecklist">开启「批量设置调差清单」添加调差工料功能</label>                                            </div>                                        </div>                                        <div class="form-group mb-1">                                            <div class="form-check form-check-inline">                                                <input class="form-check-input" type="checkbox" id="openMaterialSelf" <% if(ctx.session.sessionProject.page_show.openMaterialSelf) { %>checked<% } %> onchange="updateSetting();">                                                <label class="form-check-label" for="openMaterialSelf">开启调差清单-所属项目节「单独添加工料」功能                                                    <a href="javascript:void(0);"  data-toggle="tooltip" data-placement="bottom" title="" data-original-title="开启该选项,调差清单的所属项目节,允许单独添加工料"><i class="fa fa-question-circle "></i></a></label>                                            </div>                                        </div>                                        <div class="form-group mb-1">                                            <div class="form-check form-check-inline">                                                <input class="form-check-input" type="checkbox" id="openMaterialEditForAudit" <% if(ctx.session.sessionProject.page_show.openMaterialEditForAudit) { %>checked<% } %> onchange="updateSetting();">                                                <label class="form-check-label" for="openMaterialEditForAudit">开启「审核人修改数据」功能                                                    <a href="javascript:void(0);"  data-toggle="tooltip" data-placement="bottom" title="" data-original-title="开启该选项,审核人允许修改部分调差工料数据"><i class="fa fa-question-circle "></i></a></label>                                            </div>                                        </div>                                    </div>                                </div>                            </div>                        </div>                        <div class="card mb-3">                            <div class="card-body">                                <h5 class="card-title">动态决算</h5>                                <div class="form-group mb-4">                                    <div>                                        <div class="form-check form-check-inline">                                            <input class="form-check-input" type="checkbox" id="need_gcl" name="need_gcl" <% if (funRela.needGcl) { %>checked<% } %> onchange="updateSetting();">                                            <label class="form-check-label" for="need_gcl">显示清单信息</label>                                        </div>                                    </div>                                    <div class="mt-3">                                        <label class="form-text alert alert-danger">做施工图三级清单预算时,请进行勾选。</label>                                    </div>                                </div>                            </div>                        </div>                    </div>                </div>            </div>        </div>    </div></div><script src="/public/js/setting.js"></script><script>    let changeClass = JSON.parse(unescape('<%- escape(JSON.stringify(funSet.change_class)) %>'));    let changeState = JSON.parse(unescape('<%- escape(JSON.stringify(funSet.change_state)) %>'));    $(() => {        autoFlashHeight();        // 自定义变更类别        $('body').on('click', '#change_class_div input[type="checkbox"]', function () {            if ($(this).is(':checked')) {                $(this).parents('.input-group-prepend').siblings('input').removeAttr('readonly');            } else {                $(this).parents('.input-group-prepend').siblings('input').attr('readonly', true).val('');            }        });        $('body').on('change', '#change_class_div input[type="text"]', function () {            if ($(this).val().length > 8) {                toastr.error('类别名称不能超过8个字符');            }        });        $("#bgclass").on('show.bs.modal', function () {            let html = '';            for (const cc of changeClass) {                html += `<div class="input-group input-group-sm mb-1">                    <div class="input-group-prepend">                        <div class="input-group-text">                            <input type="checkbox" value="${cc.value}" aria-label="Checkbox for following text input" ${cc.checked ? 'checked' : ''}>                        </div>                        <span class="input-group-text">${cc.name}</span>                    </div>                    <input type="text" class="form-control" value="${cc.new_name}" ${!cc.checked ? 'readonly' : ''} aria-label="Text input with checkbox" placeholder="">                </div>`;            }            $('#change_class_div').html(html);        });        $('#set_change_class_btn').click(function () {            updateSetting(false, 1);        });        $('#openBgStatus').click(function () {            if ($('#openChangeState').is(':checked')) {                $('#bgstatus').modal('show');            }        });        $("#bgstatus").on('show.bs.modal', function () {            let html = '';            for (const cs of changeState) {                html += `<tr data-order="${cs.order}">                        <td>${cs.name}</td>                        <td>                            <div class="input-group input-group-sm" style="width:90px">                                <input type="number" class="form-control" max="100" min="0" step="1" value="${cs.value}">                                <div class="input-group-append">                                    <span class="input-group-text" id="set_change_state_btn">%</span>                                </div>                            </div>                        </td>                    </tr>`;            }            $('#change_state_table').html(html);        });        $('#set_change_state_btn').click(function () {            if ($('#openChangeState').is(':checked')) {                updateSetting(false, 2);            } else {                toastr.error('未开启变更令状态功能,不能设置计量上限默认值');            }        });    });    const updateSetting = function (tab = false, set_type = 0) {        if (!$('#openChangeApply')[0].checked && $('#openChangeProject')[0].checked && tab === 1) {            $('#openChangeApply').prop('checked', true);            $('#openChangePlan').prop('checked', true);        } else if (!$('#openChangeApply')[0].checked && $('#openChangeProject')[0].checked && tab === 2) {            $('#openChangeProject').prop('checked', false);        }        if (!$('#openChangePlan')[0].checked && $('#openChangeApply')[0].checked && tab === 2) {            $('#openChangePlan').prop('checked', true);        } else if (!$('#openChangePlan')[0].checked && $('#openChangeApply')[0].checked && tab === 3) {            $('#openChangeApply').prop('checked', false);            $('#openChangeProject').prop('checked', false);        }        const pushData = {};        if($('#openStageStart')[0].checked) {            // 判断是否已选开始日,截止月日            const startDay = parseInt($('#start_day').val());            const endMonth = parseInt($('#end_month').val());            const endDay = parseInt($('#end_day').val());            let flag = false;            if (startDay === 0) {                $('#start_day').siblings('span').text('请选择日');                flag = true;            } else {                $('#start_day').siblings('span').text('');            }            const endErrorMsg = [];            if (endMonth === 0) {                endErrorMsg.push('请选择月');                flag = true;            }            if (endDay === 0) {                endErrorMsg.push('请选择日');                flag = true;            }            if (endErrorMsg.length > 0) {                $('#end_day').siblings('span').text(endErrorMsg.join(' '));            } else {                // 本月截止日不允许小于开始日                if (endMonth === 1 && startDay > endDay) {                    $('#end_day').siblings('span').text('截止日期选择不正确,请重新选择');                    flag = true;                } else if (endMonth === 2 && startDay <= endDay){                    $('#end_day').siblings('span').text('次月截止日不允许大于开始日');                    flag = true;                } else {                    $('#end_day').siblings('span').text('');                }            }            if (flag) {                $('#openStageStart')[0].checked = 0;                $('#openStageStart').prop('checked', false);                return;            }            pushData.stage_start = {                start_day: startDay,                end_month: endMonth,                end_day: endDay,            }            $('#start_day').attr('disabled', true);            $('#end_month').attr('disabled', true);            $('#end_day').attr('disabled', true);        } else {            $('#start_day').removeAttr('disabled');            $('#end_month').removeAttr('disabled');            $('#end_day').removeAttr('disabled');        }        if (set_type === 1) {            // 自定义变更类别            const change_class = [];            let flag = false;            let allUnchecked = true;            $('#change_class_div .input-group').each(function () {                const one_class = _.find(changeClass, { value: parseInt($(this).find('input[type="checkbox"]').val())});                if ($(this).find('input[type="checkbox"]').is(':checked') && $(this).find('input[type="text"]').val().length > 8) {                    toastr.error(one_class.name + ' 类别名称字符不能超过8个');                    flag = true;                }                const new_name = $(this).find('input[type="checkbox"]').is(':checked') ? $(this).find('input[type="text"]').val() : '';                if (new_name) {                    const classInfo = _.find(changeClass, function(item) {                        return item.name === new_name && item.value !== one_class.value;                    })                    if (classInfo) {                        toastr.error(one_class.name + '的类别名称不能与其他变更名称相同');                        flag = true;                    }                    if (_.findIndex(change_class, { new_name }) !== -1) {                        toastr.error(one_class.name + '的类别名称不能与其他类别名称相同');                        flag = true;                    }                }                if ($(this).find('input[type="checkbox"]').is(':checked')) {                    allUnchecked = false;                }                const one_updateClass = {                    value: one_class.value,                    name: one_class.name,                    new_name,                    checked: $(this).find('input[type="checkbox"]').is(':checked'),                }                change_class.push(one_updateClass);            });            if (flag) {                return;            }            if (allUnchecked) {                toastr.error('至少保留一个变更类别');                return;            }            pushData.change_class = change_class;        } else if (set_type === 2) {            // 变更令状态功能-设置计量调用上限            const change_state = [];            let flag = false;            const reg = /^(\d{1,2}|100)$/;            $('#change_state_table tr').each(function () {                const one_state = _.find(changeState, { order: parseInt($(this).attr('data-order'))});                const value = parseFloat($(this).find('input[type="number"]').val());                if (!(_.isNumber(value) && reg.test(value))) {                    toastr.error(one_state.name + '的计量上限默认值只能输入0-100之间的整数');                    flag = true;                }                const one_updateState = {                    order: one_state.order,                    name: one_state.name,                    value: value,                }                change_state.push(one_updateState);            });            if (flag) {                return;            }            pushData.change_state = change_state;        }        postData('/setting/fun/update', {            imType: parseInt($('[name=im_type]:checked').val()),            banOver: $('[name=ban_over]')[0].checked,            hintOver: $('#hint_over')[0].checked,            banMinusChangeBills: $('[name=ban_minus_cb]')[0].checked,            minusNoValue: $('[name=minusNoValue]')[0].checked,            lockPayExpr: $('#lockPayExpr')[0].checked,            needGcl: $('#need_gcl')[0].checked,            openChangeProject: $('#openChangeProject')[0].checked,            openChangeApply: $('#openChangeApply')[0].checked,            openChangePlan: $('#openChangePlan')[0].checked,            openChangeWhiteList: $('#openChangeWhiteList')[0].checked,            openChangeState: $('#openChangeState')[0].checked,            openMaterialTax: $('#openMaterialTax')[0].checked,            openMaterialChecklist: $('#openMaterialChecklist')[0].checked,            openMaterialSelf: $('#openMaterialSelf')[0].checked,            openMaterialEditForAudit: $('#openMaterialEditForAudit')[0].checked,            openStageStart: $('#openStageStart')[0].checked,            addFunSet: _.size(pushData) !== 0 ? pushData : null,        }, function (result) {            if ($('#openChangeState').is(':checked')) {                $('#openBgStatus').removeClass('text-secondary');            } else {                $('#openBgStatus').addClass('text-secondary');            }            if (set_type === 1) {                changeClass = pushData.change_class;                toastr.success('设置成功');                $('#bgclass').modal('hide');            } else if (set_type === 2) {                changeState = pushData.change_state;                toastr.success('设置成功');                $('#bgstatus').modal('hide');            }        });    }</script>
 |