前端操作界面

rgba(194, 233, 221, 0.5) 1%

<input type="text" readonly title="cccccccccccccccccccccccccccccdfdadsfsdfsdfsafsadfsdfsafsafasdfsd" 
    value="cccccccccccccccccccccccccccccdfdadsfsdfsdfsafsadfsdfsafsafasdfsd" 
    style="text-align: center;width: 100%;border: none;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;">
 function renderToLayDate(_this) {
        laydate.render({
            elem: _this, //指定元素  表示当前的元素
            type: 'date', //date日期  time时间  year年  month月份
            theme: '#428bca',  //主题  颜色改变
            format: 'yyyy-MM-dd',
            showBottom: false
        });
    }
    var digistJson = {2:/^([1-9]\d{0,18}|0)\.\d{2}$/,4:/^([1-9]\d{0,18}|0)\.\d{4}$/};
    const digist2 =  Number(0).toFixed(2);
    const digist4 =  Number(0).toFixed(4);

    function purchaseCostPropertionShowInit() {
        $("#purchaseCostPropertionShow").val("0%");
        $("#purchaseCostPropertion").val(0);
    }

    function getNeedFormatValue(value, digist) {
        if(isBlank(value)) {
            return Number(0).toFixed(digist);
        }
        value = value.toString();
        var numberRegex =  /^([1-9]\d{0,18}|0)$/;
        if(numberRegex.test(value)) {
            return Number(value).toFixed(digist);
        }
        var needRegex = digistJson[digist];
        if(needRegex.test(value)) {
            return Number(value).toFixed(digist);
        }
        var errorLongDigistRegex = /^([1-9]\d{0,18}|0)\.$/;
        var longDigistRegex = /^([1-9]\d{0,18}|0)\.\d+$/;
        if(errorLongDigistRegex.test(value)) {
            value = value.substring(0,value.length-1)
            return Number(value).toFixed(2);
        }
        if(longDigistRegex.test(value)) {
            return Number(value).toFixed(digist);
        }
       return Number(0).toFixed(digist);
    }


    //投标金额
    function bidAmountChange(_this) {
        var formatValue = getNeedFormatValue(_this.value,2);
        if(formatValue == digist2) {
            $(_this).val(digist2);
            purchaseCostPropertionShowInit();
        }
        $(_this).val(formatValue);
        purchaseCostPropertionShowByValue($(_this).val());
    }
 //合同日期时间选择器
    laydate.render({
        elem: '#bidDate' //指定元素
        , type: 'date' //默认,可不填
        , theme: '#428bca'
    });
    //开始日期时间选择器
    laydate.render({
        elem: '#proStartDate' //指定元素
        , type: 'date'
        , theme: '#428bca'
        , done: function (value) {
            judgeTime(value,$("#proEndDate").val(),1,"proStartDate");
        }
    });
    //结束日期时间选择器
    laydate.render({
        elem: '#proEndDate' //指定元素
        , type: 'date'
        , theme: '#428bca'
        , done: function (value) {
            judgeTime($("#proStartDate").val(),value,2,"proEndDate");
        }

    });
    /*type为1表示startDate肯定有值,否则endDate肯定有值*/
    function judgeTime(startDate,endDate,type,idName) {
        var bidDate = $("#bidDate").val();
        if(startDate < bidDate && type == 1) {
            window.parent.$.DU_showDialogWarning('提示', '开始时间不能小投标日期于结束时间!');
            $("#proStartDate").val("");
            return;
        }
        if(endDate < bidDate && type == 1) {
            window.parent.$.DU_showDialogWarning('提示', '结束时间不能小投标日期于结束时间!');
            $("#proEndDate").val("");
            return;
        }
        if (type == 1){
            if (endDate != null && endDate != "" && startDate > endDate){
                window.parent.$.DU_showDialogWarning('提示', '开始时间不能大于结束时间!');
                $("#"+idName).val("");
                return;
            }
        }else {
            if (startDate != null && startDate != "" && startDate > endDate){
                window.parent.$.DU_showDialogWarning('提示', '开始时间不能大于结束时间!');
                $("#"+idName).val("");
                return;
            }
        }
    }
 /**展示阴影,也可以禁用按钮解决**/
    function loading(text) {
        const html = '<div class="loading">' +
            '<i class="layui-icon layui-icon-loading">' +
            '<svg xmlns="http://www.w3.org/2000/svg" id="loading" viewBox="0 0 32 32" width="32" height="32" fill="white">' +
            '<path opacity=".1" d="M14 0 H18 V8 H14 z" transform="rotate(0 16 16)">' +
            '<animate attributeName="opacity" from="1" to=".1" dur="1s" repeatCount="indefinite" begin="0"/>' +
            '</path>' +
            '<path opacity=".1" d="M14 0 H18 V8 H14 z" transform="rotate(45 16 16)">' +
            ' <animate attributeName="opacity" from="1" to=".1" dur="1s" repeatCount="indefinite" begin="0.125s"/>' +
            '</path>' +
            '<path opacity=".1" d="M14 0 H18 V8 H14 z" transform="rotate(90 16 16)">' +
            '<animate attributeName="opacity" from="1" to=".1" dur="1s" repeatCount="indefinite" begin="0.25s"/>' +
            '</path>' +
            '<path opacity=".1" d="M14 0 H18 V8 H14 z" transform="rotate(135 16 16)">' +
            '<animate attributeName="opacity" from="1" to=".1" dur="1s" repeatCount="indefinite" begin="0.375s"/>' +
            '</path>' +
            '<path opacity=".1" d="M14 0 H18 V8 H14 z" transform="rotate(180 16 16)">' +
            '<animate attributeName="opacity" from="1" to=".1" dur="1s" repeatCount="indefinite" begin="0.5s"/>' +
            '</path>' +
            '<path opacity=".1" d="M14 0 H18 V8 H14 z" transform="rotate(225 16 16)">' +
            '<animate attributeName="opacity" from="1" to=".1" dur="1s" repeatCount="indefinite" begin="0.675s"/>' +
            '</path>' +
            '<path opacity=".1" d="M14 0 H18 V8 H14 z" transform="rotate(270 16 16)">' +
            '<animate attributeName="opacity" from="1" to=".1" dur="1s" repeatCount="indefinite" begin="0.75s"/>' +
            '</path>' +
            '<path opacity=".1" d="M14 0 H18 V8 H14 z" transform="rotate(315 16 16)">' +
            '<animate attributeName="opacity" from="1" to=".1" dur="1s" repeatCount="indefinite" begin="0.875s"/>' +
            '</path>' +
            '</svg>' +
            '<p>' + text + '</p>' +
            '</i>' +
            '</div>'
        if ($('.loading').length) return;
        $('body').append(html)
    }

    /**回调使用,关闭阴影**/
    function closeLoading() {
        $(".loading").remove();
    }

    /**提示信息**/
    function layerMsg(message, width, height) {
        layui.use('layer', function () {
            let layer = layui.layer;
            layer.msg(message, {
                area: [width, height],
                anim: 6
            });
        });
    }
 function calculateDay() {
        var minStartDate = "";
        var maxEndDate = "";
        $("#bizPlanDetailTable tr").each(function (index, tr) {
           var eachStartDate = $(tr).find("input[name$='planStartDate']").val();
           if(isNotBlank(eachStartDate)) {
               minStartDate = isBlank(minStartDate)?eachStartDate:(minStartDate<eachStartDate?minStartDate:eachStartDate);
           }
            var eachEndDate = $(tr).find("input[name$='planEndDate']").val();
            if(isNotBlank(eachEndDate)) {
                maxEndDate = isBlank(maxEndDate)?eachEndDate:(maxEndDate<eachEndDate?eachEndDate:maxEndDate);
            }
        });
        if(isNotBlank(minStartDate) && isNotBlank(maxEndDate)) {
            $("#planCircle").val(Math.floor(Math.abs(Date.parse(minStartDate) - Date.parse(maxEndDate)) / (24 * 3600 * 1000) + 1));
        }
    /** 弹出员工列表  type{0:公司,1部门, 2不需要}*/
    function openStaffList(_this, tabId) {
        $("#" + tabId).find("tr").removeClass("check");
        $(_this).parents('tr').addClass('check');
        var departmentId = $(_this).parents('td').attr("departmentId");
        if(isBlank(departmentId) ) {
            window.parent.$.DU_showDialogWarning('提示', "请先选择部门!");
            return;
        }
        window.parent.$.jDialog({
            ___title: "员工管理",
            ___content: "url:GET?${request.contextPath}/projectGroup/toStaffDialogPage/"+ tabId +"?type=1&departmentId=" + departmentId,
            ___width: "700",
            ___height: "610"
        });
    }

    //拿到职员信息
    function putStaffInfos(id, name, email, remark, tel, job, index, type) {
        let $checkedTr = $("#" + index +" .check");
        $checkedTr.find("input[name$='operatorId']").val(id);
        $checkedTr.find("input[name$='operatorId']").next("input").val(name);
    }

 

posted @ 2019-12-02 09:20  絵飛ヾ的魚  阅读(280)  评论(0编辑  收藏  举报