WebTM/views/ÏîÄ¿¹ÜÀí/±¨±í·ÖÎö/PM_WorkTaskReportMonthSumReport.html
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>月度汇报统计报表</title>
@@ -22,6 +23,7 @@
        }
    </style>
</head>
<body>
    <div class="layui-fluid">
        <div class="layui-col-md12">
@@ -39,7 +41,8 @@
                                <div class="layui-inline">
                                    <label class="layui-form-label">职员</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" name="HEmpName" id="HEmpName" style="width:190px;">
                                        <input type="text" class="layui-input" name="HEmpName" id="HEmpName"
                                            style="width:190px;">
                                    </div>
                                </div>
                                <div class="layui-inline">
@@ -50,7 +53,8 @@
                                        </select>
                                    </div>
                                </div>
                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnReSearch" id="btnReSearch" style="padding:0 5px">重置</button>
                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit=""
                                    lay-filter="btnReSearch" id="btnReSearch" style="padding:0 5px">重置</button>
                            </div>
                        </div>
                        <table class="" id="mainTable" lay-filter="mainTable"></table>
@@ -69,6 +73,8 @@
            </div>
        </div>
    </div>
    </script>
    <script>
        //#region æŠ˜å æ³¨é‡Š
        //#endregion
@@ -76,9 +82,9 @@
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index', //主入口模块
        }).use(['index', 'form', 'table', 'element', 'laypage','laydate'], function () {
        //#region å…¬å…±å˜é‡
        }).use(['index', 'form', 'table', 'element', 'laypage', 'laydate'], function () {
            //#region å…¬å…±å˜é‡
            var $ = layui.$
                , admin = layui.admin
                , layer = layui.layer
@@ -87,6 +93,7 @@
                , element = layui.element
                , laypage = layui.laypage
                , laydate = layui.laydate
                , util = layui.util
            var sDate = Format(new Date(), "yyyy-MM-dd")
            var sWhere = "";
            var option = [];
@@ -94,9 +101,9 @@
            var columns = "";
            var HModName = "PM_ProjectWorkDaysSumReport";
            var titleData = [];     //不需要显示的字段
        //#endregion
            //#endregion
        //#region è¿›å…¥é¡µé¢å³åŠ è½½
            //#region è¿›å…¥é¡µé¢å³åŠ è½½
            //初始化界面
            set_ClearBill();
@@ -106,7 +113,7 @@
                //获取组织
                Organ();
                //初始化表单时间
                set_InitDate();
                set_InitDate();
                //初始化表格
                set_InitGrid();
                //查询
@@ -129,7 +136,7 @@
                        });
                    }
                    //选择月份即选中关闭  å¹´ä»½æ‰”可以左右点击选择
                    ,change: function (value, date, endDate) { //监听日期被切换
                    , change: function (value, date, endDate) { //监听日期被切换
                        lay('#HDate').val(value);
                        sDate = Format($("#HDate").val() + "-01", "yyyy-MM-dd");
                        $('.laydate-month-list').on('click', 'li', function () {//利用的事件委托
@@ -285,9 +292,9 @@
            }
            //#endregion
        //#endregion
            //#endregion
        //#region æœ¬é¡µé¢æ‰€æœ‰è¢«è°ƒç”¨çš„æ–¹æ³•
            //#region æœ¬é¡µé¢æ‰€æœ‰è¢«è°ƒç”¨çš„æ–¹æ³•
            //#region å·¥å…·æ äº‹ä»¶
            table.on('toolbar(mainTable)', function (obj) {
@@ -314,11 +321,45 @@
            });
            //#endregion
            //#region å•元格单击事件
            table.on('tool(mainTable)', function (obj) {
                let index = obj.index
                let $elem = $(this) // èŽ·å–ç‚¹å‡»çš„å…ƒç´ 
                if (obj.event === "workTimeClickHandler") {
                    debugger
                    let dateInfo = $elem.data('value')
                    get_WorkTaskList(obj.data['职员'], dateInfo)
                }
            })
            //#endregion
            //#region å¯¼å‡ºExecel
            function get_Export() {
                table.exportFile(ins.config.id, option.data, "xls");
            }
            //#endregion
            function get_WorkTaskList(Employee, DateInfo) {
                let EmployeeEncode = encodeURIComponent(Employee)
                layer.open({
                    type: 2
                    , skin: "layui-layer-rim" //加上边框
                    , title: "工作任务"  //标题
                    , closeBtn: 1  //窗体右上角关闭 çš„ æ ·å¼
                    , shift: 2 //弹出动画
                    , area: ["90%", "90%"] //窗体大小
                    , maxmin: true //设置最大最小按钮是否显示
                    , content: ['../../项目管理/工作任务/PM_WorkTaskReportBillList.html?openType=&HOrgID=' + sessionStorage["OrganizationID"] + '&Employee=' + EmployeeEncode + '&DateInfo=' + DateInfo, "yes"]
                    , btn: ["确定", "取消"]
                    , btn1: function (index, laero) {
                        //刷新表格数据
                        get_Display();
                        //更新表格缓存的数据
                        layer.close(index);//关闭弹窗
                    }
                })
            }
            //#region æŸ¥è¯¢
            function get_Display() {
@@ -326,7 +367,6 @@
                var HEmpName = $("#HEmpName").val();    //职员
                sWhere = "'" + HDate + "','" + HEmpName + "'";
                var ajaxLoad = layer.load();
                $.ajax({
                    type: "GET",
@@ -358,8 +398,38 @@
                                    switch (data[i].Type) {
                                        //int
                                        case 'DateTime':
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, templet: "<div>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd')}}</div>", width: 200 });
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, templet: "<div'>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd')}}</div>", width: 200 });
                                            break;
                                        //每日工作时长
                                        case 'Decimal':
                                            let date = util.toDateString(HDate, "yyyy-MM")
                                            let prefix = data[i].name.split("_").reverse()[1]
                                            console.log(typeof prefix)
                                            if (typeof prefix == "undefined") {
                                            }
                                            else if (prefix.length < 2) {
                                                prefix = '-0' + prefix
                                            }
                                            else {
                                                prefix = '-' + prefix
                                            }
                                            prefix = prefix || ''
                                            col.push({
                                                field: data[i].id, title: data[i].name, align: 'center', sort: true, templet: ((d) => {
                                                    let node = document.createElement("div")
                                                    let node_sub = document.createElement("div")
                                                    node_sub.setAttribute("data-value", date + prefix)
                                                    node_sub.setAttribute("lay-event", "workTimeClickHandler")
                                                    node_sub.style.color = "blue";
                                                    node_sub.innerHTML = "{{= d['" + data[i].name + "']==0? '0' : d['" + data[i].name + "'] }}"
                                                    node.appendChild(node_sub)
                                                    return node.outerHTML
                                                })()
                                                , width: 200
                                            });
                                            break
                                        default:
                                            if (data[i].name == '本月合计') {
                                                col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, totalRow: true });
@@ -533,8 +603,7 @@
            }
            //#endregion
        //#endregion
            //#endregion
        });
@@ -544,4 +613,5 @@
    </script>
</body>
</html>
</html>