1
duhe
2024-03-15 be7d738131c8cf9c8e00c6abfde469f2d82cbfb0
WebTM/views/ÖÊÁ¿¹ÜÀí/¼ìÑé·½°¸µ¥/QC_CheckProjectList.html
@@ -9,6 +9,8 @@
    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
    <script src="../../../layuiadmin/layui/layui.js"></script>
    <script src="../../../layuiadmin/soulTable.slim.js"></script>
</head>
<body>
@@ -65,7 +67,7 @@
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Add" id="btn-Add" ><i class="layui-icon layui-icon-add-1"></i>新增</button>
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Edit" id="btn-Edit"><i class="layui-icon layui-icon-edit"></i>编辑</button>
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Delete" id="btn-Delete"><i class="layui-icon layui-icon-delete"></i>删除</button>
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="set_HideColumn"><i class="layui-icon layui-icon-form"></i>列设置</button>
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn_Exit" ><i class="layui-icon layui-icon-return"></i>退出</button>
                        </div>
                    </script>
@@ -91,7 +93,7 @@
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'laydate', 'code', 'table', 'element', 'layer'], function () {
        }).use(['index', 'form', 'laydate', 'code', 'table', 'element', 'layer','soulTable'], function () {
            //#region å…¬ç”¨å˜é‡
            var $ = layui.$
                , admin = layui.admin
@@ -99,12 +101,19 @@
                , laydate = layui.laydate
                , table = layui.table
                , form = layui.form
                , soulTable = layui.soulTable
                , element = layui.element;
            var sWhere = "";
            var option = [];
            var HModName = "QC_CheckProjectList";
            //#endregion
            //初始化表格
            set_InitGrid();
            DisPlay_HideColumn();
            //#region è¿›å…¥é¡µé¢å³åŠ è½½
            //判断操作类型
@@ -137,6 +146,9 @@
                        break;
                    //反审核按钮
                    case 'btn-DeAudit': set_AbandonCheck();
                        break;
                    //列设置
                    case 'set_HideColumn': get_HideColumn();
                        break;
                    //退出按钮
                    case 'btn_Exit': Pub_Close(1);
@@ -174,37 +186,41 @@
                    , cellMinWidth: 100
                    , height: 'full-50'
                    , page: true
                    , totalRow: true
                    , limit: 50
                    , limits: [50, 500, 5000, 20000]
                    , done: function (res, curr, count) {
                        soulTable.render(this);
                    }
                    , cols: [[
                        { type: 'checkbox', fixed: 'left' }
                        { type: 'checkbox', fixed: 'left', totalRowText: '合计行'}
                        , { field: 'hmainid', title: 'hmainid', sort: true, fixed: true, hide: true }
                        , { field: 'hsubid', title: 'hsubid', hide: true }
                        , { field: '日期', title: '日期', sort: true, width: 120, templet: "<div>{{d.日期 ==null ?'':layui.util.toDateString(d.日期, 'yyyy-MM-dd')}}</div>" }
                        , { field: '单据号', title: '单据号', sort: true, width: 170 }
                        , { field: '表头备注 ', title: '表头备注', width: 105 }
                        , { field: '物料', title: '物料' }
                        , { field: '物料代码', title: '物料代码' }
                        , { field: '物料名称', title: '物料名称' }
                        , { field: '物料大类代码', title: '物料大类代码' }
                        , { field: '物料大类名称', title: '物料大类名称', width: 115 }
                        , { field: '单位代码', title: '单位代码', width: 115 }
                        , { field: '单位名称', title: '单位名称' }
                        , { field: '工序代码', title: '工序代码', width: 160 }
                        , { field: '工序名称', title: '工序名称', width: 160 }
                        , { field: '部门代码', title: '部门代码', width: 160 }
                        , { field: '部门名称', title: '部门名称', width: 160 }
                        , { field: '制单人', title: '制单人', width: 160 }
                        , { field: '制单日期', title: '制单日期', width: 160, templet: "<div>{{d.制单日期 ==null ?'':layui.util.toDateString(d.制单日期, 'yyyy-MM-dd')}}</div>" }
                        , { field: '审核人', title: '审核人', width: 160 }
                        , { field: '审核日期', title: '审核日期', width: 160, templet: "<div>{{d.审核日期 ==null ?'':layui.util.toDateString(d.审核日期, 'yyyy-MM-dd')}}</div>" }
                        , { field: '修改人 ', title: '修改人', width: 215 }
                        , { field: '修改日期 ', title: '修改日期 ', width: 115, templet: "<div>{{d.修改日期 ==null ?'':layui.util.toDateString(d.修改日期, 'yyyy-MM-dd')}}</div>" }
                        , { field: '关闭人', title: '关闭人' }
                        , { field: '关闭日期   ', title: '关闭日期', width: 100, templet: "<div>{{d.关闭日期 ==null ?'':layui.util.toDateString(d.关闭日期, 'yyyy-MM-dd')}}</div>" }
                        , { field: '作废人', title: '作废人' }
                        , { field: '作废日期', title: '作废日期', templet: "<div>{{d.作废日期 ==null ?'':layui.util.toDateString(d.作废日期, 'yyyy-MM-dd')}}</div>"  }
                        , { field: '单据类型', title: '单据类型' }
                        , { field: '表头备注 ', title: '表头备注', width: 105, sort: true }
                        , { field: '物料', title: '物料', sort: true }
                        , { field: '物料代码', title: '物料代码', sort: true }
                        , { field: '物料名称', title: '物料名称', sort: true }
                        , { field: '物料大类代码', title: '物料大类代码', sort: true }
                        , { field: '物料大类名称', title: '物料大类名称', width: 115, sort: true }
                        , { field: '单位代码', title: '单位代码', width: 115, sort: true }
                        , { field: '单位名称', title: '单位名称', sort: true }
                        , { field: '工序代码', title: '工序代码', width: 160, sort: true }
                        , { field: '工序名称', title: '工序名称', width: 160, sort: true }
                        , { field: '部门代码', title: '部门代码', width: 160, sort: true }
                        , { field: '部门名称', title: '部门名称', width: 160, sort: true }
                        , { field: '制单人', title: '制单人', width: 160, sort: true }
                        , { field: '制单日期', title: '制单日期', width: 160, templet: "<div>{{d.制单日期 ==null ?'':layui.util.toDateString(d.制单日期, 'yyyy-MM-dd')}}</div>", sort: true }
                        , { field: '审核人', title: '审核人', width: 160, sort: true }
                        , { field: '审核日期', title: '审核日期', width: 160, templet: "<div>{{d.审核日期 ==null ?'':layui.util.toDateString(d.审核日期, 'yyyy-MM-dd')}}</div>", sort: true }
                        , { field: '修改人 ', title: '修改人', width: 215, sort: true }
                        , { field: '修改日期 ', title: '修改日期 ', width: 115, templet: "<div>{{d.修改日期 ==null ?'':layui.util.toDateString(d.修改日期, 'yyyy-MM-dd')}}</div>", sort: true }
                        , { field: '关闭人', title: '关闭人', sort: true }
                        , { field: '关闭日期   ', title: '关闭日期', width: 100, templet: "<div>{{d.关闭日期 ==null ?'':layui.util.toDateString(d.关闭日期, 'yyyy-MM-dd')}}</div>", sort: true }
                        , { field: '作废人', title: '作废人', sort: true }
                        , { field: '作废日期', title: '作废日期', templet: "<div>{{d.作废日期 ==null ?'':layui.util.toDateString(d.作废日期, 'yyyy-MM-dd')}}</div>", sort: true }
                        , { field: '单据类型', title: '单据类型', sort: true }
                    ]]
                };
@@ -217,7 +233,7 @@
                $.ajax({
                    url: GetWEBURL() + "/QC_Management/MES_QC_CheckProjectList_Json",
                    type: "GET",
                    data: { "sWhere": sWhere },
                    data: { "sWhere": sWhere, "user": sessionStorage["HUserName"]},
                    success: function (result) {
                        if (result.count == 1) {
                            option.data = result.data;
@@ -320,7 +336,7 @@
                    layer.confirm("确认要删除吗,删除后不能恢复", { title: "删除确认" }, function (index) {
                        $.ajax({
                            type: "GET",
                            url: GetWEBURL() + "Sc_MESBeginWorkBill/DeltetQCCheckProject", //方法所在页面和方法名
                            url: GetWEBURL() + "DeltetQCCheckProject", //方法所在页面和方法名
                            data: { "HInterID": InterID, "UserName": sessionStorage["HUserName"] },
                            success: function (result) {
                                if (result.count == 1) {
@@ -357,6 +373,124 @@
            }
            //隐藏列设置
            function get_HideColumn() {
                var colName = "";
                var contentUrl = "";
                for (var i = 1; i < option.cols[0].length - 1; i++) {
                    colName += option.cols[0][i]["title"] + ",";
                }
                var urlStr = window.document.location.pathname;//获取文件路径
                var urlLen = urlStr.split('/');
                for (var i = 0; i < urlLen.length - 4; i++) {
                    contentUrl += "../";
                }
                colName = encodeURI(colName.substring(0, colName.length - 1));//对 URI è¿›è¡Œç¼–码
                contentUrl += '基础资料/隐藏列设置/Gy_GridView_Hide.html?HModName=' + HModName + '&colName=' + colName;
                layer.open({
                    type: 2
                    , skin: "layui-layer-rim" //加上边框
                    , title: "隐藏列设置"  //标题
                    , closeBtn: 1  //窗体右上角关闭 çš„ æ ·å¼
                    , shift: 2 //弹出动画
                    , area: ["50%", "90%"] //窗体大小
                    , maxmin: true //设置最大最小按钮是否显示
                    , content: [contentUrl, "yes"]
                    , btn: ["确定", "取消"]
                    , btn1: function (index, laero) {
                        //刷新表格数据
                        DisPlay_HideColumn();
                        //更新表格缓存的数据
                        layer.close(index);//关闭弹窗
                    }
                })
            }
            //显示列数据
            function DisPlay_HideColumn() {
                $.ajax({
                    url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList',
                    type: "GET",
                    data: { "HModName": HModName, "user": sessionStorage["HUserName"] },
                    success: function (data1) {
                        if (data1.data.length != 0) {
                            var dataCol = [];//数据库查询出的列数据
                            var titleData = ["hmainid", "hsubid"];//不需要显示的字段 å¯æ‰©å±•
                            dataCol = data1.data[0].HGridString.split(',');
                            for (var i = 0; i < option.cols[0].length - 2; i++) {
                                var dataCols = dataCol[i].split('|');
                                //隐藏列
                                if (dataCols[1] == 1) {
                                    option.cols[0][i + 1]["hide"] = true;
                                }
                                //设置列宽
                                if (dataCols[3] > 0) {
                                    option.cols[0][i + 1]["width"] = dataCols[3];
                                }
                                //设置内容字体大小
                                if (data1.data[0].HFontSize != 0) {
                                    option.cols[0][i + 1]["style"] = "font-size:" + data1.data[0].HFontSize + "px;";
                                } else {
                                    option.cols[0][i + 1]["style"] = "font-size:100%";
                                }
                                //设置列宽
                                //if (data1.data[0].HColumnWidth != 0) {
                                //    option.cols[0][i + 1]["width"] = data1.data[0].HColumnWidth + "px;";
                                //} else {
                                //    option.cols[0][i + 1]["width"] = "";
                                //}
                                //显示列
                                if (dataCols[1] == 0 && $.inArray(option.cols[0][i + 1]["title"], titleData) == -1) {
                                    option.cols[0][i + 1]["hide"] = false;
                                }
                                //字体所在位置(å·¦ å±…中 å³)
                                switch (dataCols[2]) {
                                    case "L":
                                        option.cols[0][i + 1]["align"] = "left";
                                        break;
                                    case "M":
                                        option.cols[0][i + 1]["align"] = "center";
                                        break;
                                    case "R":
                                        option.cols[0][i + 1]["align"] = "right";
                                        break;
                                }
                            }
                            //取消冻结列
                            for (var i = 1; i < option.cols[0].length - 1; i++) {
                                if (option.cols[0][i]["fixed"] != null) {
                                    option.cols[0][i]["fixed"] = null;
                                }
                                else {
                                    break;
                                }
                            }
                            //冻结列
                            if (data1.data[0].HFixCols != 0) {
                                for (var i = 0; i < data1.data[0].HFixCols; i++) {
                                    if ($.inArray(option.cols[0][i + 1]["title"], titleData) != -1) {
                                        data1.data[0].HFixCols += 1;
                                    }
                                    option.cols[0][i + 1]["fixed"] = "left";
                                }
                            }
                            table.render(option);
                        } else {
                            table.render(option);
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                })
            }
            //#endregion